Fix comma issue in SendTransactionFragment.
- The amount field in the SendTransactionsFragment wasn't prepared to deal with Locales where the decimal separator is a comma. In order to deal with that internally, the commas in the amount are first converted to points before trying to convert the amount string to a double.
This commit is contained in:
parent
f6d00053db
commit
eecc28bb06
2 changed files with 4 additions and 2 deletions
|
@ -457,7 +457,7 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun validateAmount() {
|
private fun validateAmount() {
|
||||||
val txtAmount = tietAmount.text.toString()
|
val txtAmount = tietAmount.text.toString().replace(",", ".")
|
||||||
|
|
||||||
if (mBalancesDetailsAdapter?.isEmpty != false) return
|
if (mBalancesDetailsAdapter?.isEmpty != false) return
|
||||||
val balance = mBalancesDetailsAdapter?.getItem(spAsset.selectedItemPosition) ?: return
|
val balance = mBalancesDetailsAdapter?.getItem(spAsset.selectedItemPosition) ?: return
|
||||||
|
@ -543,7 +543,8 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand
|
||||||
// Create TransferOperation
|
// Create TransferOperation
|
||||||
if (mNetworkService?.isConnected == true) {
|
if (mNetworkService?.isConnected == true) {
|
||||||
val balance = mBalancesDetailsAdapter!!.getItem(spAsset.selectedItemPosition)!!
|
val balance = mBalancesDetailsAdapter!!.getItem(spAsset.selectedItemPosition)!!
|
||||||
val amount = (tietAmount.text.toString().toDouble() * Math.pow(10.0, balance.precision.toDouble())).toLong()
|
val amount = (tietAmount.text.toString().replace(",", ".").toDouble()
|
||||||
|
* Math.pow(10.0, balance.precision.toDouble())).toLong()
|
||||||
|
|
||||||
val transferAmount = AssetAmount(UnsignedLong.valueOf(amount), Asset(balance.id))
|
val transferAmount = AssetAmount(UnsignedLong.valueOf(amount), Asset(balance.id))
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
|
android:digits="0123456789.,"
|
||||||
android:inputType="numberDecimal"/>
|
android:inputType="numberDecimal"/>
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
Loading…
Reference in a new issue