]> git.ktnx.net Git - mobile-ledger.git/commitdiff
completely abandon fiddling with KeyListener's
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 14 May 2020 21:03:40 +0000 (00:03 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 14 May 2020 21:03:40 +0000 (00:03 +0300)
inputType setting seems do work alright

app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java

index eee34693c54a1272c1a3909dff5488019a9762b6..05b7258f50566af7e9ec212a7f45c418f394dd23 100644 (file)
@@ -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();