From: Damyan Ivanov Date: Thu, 14 May 2020 21:03:40 +0000 (+0300) Subject: completely abandon fiddling with KeyListener's X-Git-Tag: v0.13.1~1 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=8616cfa852b90f9fc9cc37c435205f138151978e;p=mobile-ledger.git completely abandon fiddling with KeyListener's inputType setting seems do work alright --- diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java index eee34693..05b7258f 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java @@ -19,10 +19,8 @@ package net.ktnx.mobileledger.ui.activity; import android.annotation.SuppressLint; import android.graphics.Typeface; -import android.os.Build; import android.text.Editable; import android.text.TextWatcher; -import android.text.method.DigitsKeyListener; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; @@ -186,9 +184,13 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder MLDB.hookAutocompletionAdapter(tvAccount.getContext(), tvAccount, MLDB.ACCOUNTS_TABLE, "name", true, this, mProfile); - // updated on locale changes by an observer below decimalSeparator = String.valueOf(DecimalFormatSymbols.getInstance() .getMonetaryDecimalSeparator()); + localeObserver = locale -> { + decimalSeparator = String.valueOf(DecimalFormatSymbols.getInstance(locale) + .getMonetaryDecimalSeparator()); + }; + decimalDot = "."; final TextWatcher tw = new TextWatcher() { @@ -360,14 +362,6 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder tvAmount.setImeOptions(EditorInfo.IME_ACTION_NEXT); }; - localeObserver = locale -> { - decimalSeparator = String.valueOf(DecimalFormatSymbols.getInstance(locale) - .getMonetaryDecimalSeparator()); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) - tvAmount.setKeyListener(DigitsKeyListener.getInstance(locale, true, true)); - }; - currencyObserver = currency -> { setCurrency(currency); adapter.checkTransactionSubmittable();