Fixed bug in Android that DecimalFormatSymbols sometimes uses the wrong Locale and therefore using the wrong decimal separator. Now both, dot and semicolon, can be entered at once but it's way better that way.
This commit is contained in:
parent
0200a274a9
commit
ebac99eeeb
|
@ -150,10 +150,6 @@ open class TransferMoneyDialog : DialogFragment() {
|
|||
transferMoneyIfEnterPressed(rootView.edtxtAmount)
|
||||
transferMoneyIfEnterPressed(rootView.edtxtReference)
|
||||
|
||||
// fix that even in Locales using ',' as decimal separator entering ',' is not allowed (thanks dstibbe! https://stackoverflow.com/a/34256139)
|
||||
val decimalSeparator = DecimalFormatSymbols.getInstance().getDecimalSeparator()
|
||||
rootView.edtxtAmount.keyListener = DigitsKeyListener.getInstance("0123456789$decimalSeparator")
|
||||
|
||||
rootView.btnShowRealTimeTransferInfo.setOnClickListener { showRealTimeTransferInfo(rootView.btnShowRealTimeTransferInfo) }
|
||||
|
||||
setRealTimeTransferControlsVisibility(rootView)
|
||||
|
|
|
@ -103,11 +103,14 @@
|
|||
android:hint="@string/dialog_transfer_money_amount"
|
||||
>
|
||||
|
||||
<!-- Yes, i know, it isn't correct allowing dot and comma as decimal separator at the same time, but due to a bug in Android DecimalFormatSymbol's locale is
|
||||
sometimes incorrect and therefore using then the wrong decimal separator so that this solution doesn't work reliable: https://stackoverflow.com/a/34256139 -> better allow both than the wrong one -->
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edtxtAmount"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dialog_transfer_money_input_fields_height"
|
||||
android:inputType="numberDecimal"
|
||||
android:digits="0123456789.,"
|
||||
/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
|
Loading…
Reference in New Issue