diff options
author | Torsten Grote <t@grobox.de> | 2020-07-17 16:25:14 -0300 |
---|---|---|
committer | Torsten Grote <t@grobox.de> | 2020-07-17 16:25:14 -0300 |
commit | 4f665e694b819f7999bb96919d8b468c2a3de48b (patch) | |
tree | 75b38092b50bdcc2bf1ffd6c87f4da00ddd2976d /taler-kotlin-common | |
parent | aa4472c62acd909cea65dd26102b5d7188c7aacd (diff) | |
download | taler-android-4f665e694b819f7999bb96919d8b468c2a3de48b.tar.gz taler-android-4f665e694b819f7999bb96919d8b468c2a3de48b.tar.bz2 taler-android-4f665e694b819f7999bb96919d8b468c2a3de48b.zip |
[wallet] add UI for making manual withdrawal via exchange
Diffstat (limited to 'taler-kotlin-common')
-rw-r--r-- | taler-kotlin-common/src/main/java/net/taler/common/Amount.kt | 1 | ||||
-rw-r--r-- | taler-kotlin-common/src/main/java/net/taler/common/AndroidUtils.kt | 7 |
2 files changed, 8 insertions, 0 deletions
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()) } |