From 4f665e694b819f7999bb96919d8b468c2a3de48b Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Fri, 17 Jul 2020 16:25:14 -0300 Subject: [wallet] add UI for making manual withdrawal via exchange --- taler-kotlin-common/src/main/java/net/taler/common/Amount.kt | 1 + taler-kotlin-common/src/main/java/net/taler/common/AndroidUtils.kt | 7 +++++++ 2 files changed, 8 insertions(+) (limited to 'taler-kotlin-common') diff --git a/taler-kotlin-common/src/main/java/net/taler/common/Amount.kt b/taler-kotlin-common/src/main/java/net/taler/common/Amount.kt index bd12a40..76cd294 100644 --- a/taler-kotlin-common/src/main/java/net/taler/common/Amount.kt +++ b/taler-kotlin-common/src/main/java/net/taler/common/Amount.kt @@ -159,6 +159,7 @@ data class Amount( @Throws(AmountOverflowException::class) operator fun times(factor: Int): Amount { + if (factor == 0) return zero(currency) var result = this for (i in 1 until factor) result += this return result diff --git a/taler-kotlin-common/src/main/java/net/taler/common/AndroidUtils.kt b/taler-kotlin-common/src/main/java/net/taler/common/AndroidUtils.kt index fda537b..ba6ee1c 100644 --- a/taler-kotlin-common/src/main/java/net/taler/common/AndroidUtils.kt +++ b/taler-kotlin-common/src/main/java/net/taler/common/AndroidUtils.kt @@ -38,6 +38,8 @@ import android.text.format.DateUtils.getRelativeTimeSpanString import android.view.View import android.view.View.INVISIBLE import android.view.View.VISIBLE +import android.view.inputmethod.InputMethodManager +import androidx.core.content.ContextCompat.getSystemService import androidx.fragment.app.Fragment import androidx.navigation.NavDirections import androidx.navigation.fragment.findNavController @@ -61,6 +63,11 @@ fun View.fadeOut(endAction: () -> Unit = {}) { }.start() } +fun View.hideKeyboard() { + getSystemService(context, InputMethodManager::class.java) + ?.hideSoftInputFromWindow(windowToken, 0) +} + fun assertUiThread() { check(Looper.getMainLooper().thread == Thread.currentThread()) } -- cgit v1.2.3