From d4dbdc4aebc466619b9ff5fcc3ed3a8e63398ba0 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Wed, 2 Jan 2019 17:03:20 -0600 Subject: [PATCH] Change 'Please Pay' to 'Please Send' string in ReceiveTransactionFragment. Also, in the same Fragment, added an 'Any Amount' string when the user has not explicitly specified an amount to receive. --- .../fragments/ReceiveTransactionFragment.kt | 21 +++++++++++-------- app/src/main/res/values/strings.xml | 6 +++++- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/ReceiveTransactionFragment.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/ReceiveTransactionFragment.kt index 9b81fdb..624ae61 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/ReceiveTransactionFragment.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/ReceiveTransactionFragment.kt @@ -121,7 +121,7 @@ class ReceiveTransactionFragment : Fragment(), ServiceConnection { // Add an option at the end so the user can search for an asset other than the ones saved in the db val asset = cy.agorise.bitsybitshareswallet.database.entities.Asset( - OTHER_ASSET, "Other...", 0, "", "" + OTHER_ASSET, getString(R.string.text__other), 0, "", "" ) mAssets.add(asset) @@ -325,14 +325,18 @@ class ReceiveTransactionFragment : Fragment(), ServiceConnection { * @param account Account to pay total */ private fun updateAmountAddressUI(total: AssetAmount, account: String) { - val df = DecimalFormat("####."+("#".repeat(total.asset.precision))) - df.roundingMode = RoundingMode.CEILING - df.decimalFormatSymbols = DecimalFormatSymbols(Locale.getDefault()) + val txtAmount: String = if (total.amount.toLong() == 0L) { + getString(R.string.template__please_send, getString(R.string.text__any_amount), " ") + } else { + val df = DecimalFormat("####."+("#".repeat(total.asset.precision))) + df.roundingMode = RoundingMode.CEILING + df.decimalFormatSymbols = DecimalFormatSymbols(Locale.getDefault()) - val amount = total.amount.toDouble() / Math.pow(10.toDouble(), total.asset.precision.toDouble()) - val strAmount = df.format(amount) + val amount = total.amount.toDouble() / Math.pow(10.toDouble(), total.asset.precision.toDouble()) + val strAmount = df.format(amount) + getString(R.string.template__please_send, strAmount, total.asset.symbol) + } - val txtAmount = getString(R.string.template__please_pay, strAmount, total.asset.symbol) val txtAccount = getString(R.string.template__to, account) tvPleasePay.text = txtAmount @@ -370,8 +374,7 @@ class ReceiveTransactionFragment : Fragment(), ServiceConnection { if ((grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED)) { shareQRScreenshot() } else { - // TODO extract string resource - Toast.makeText(context!!, "Storage permission is necessary to share QR codes.", Toast.LENGTH_SHORT).show() + Toast.makeText(context!!, getString(R.string.msg__storage__permission__necessary), Toast.LENGTH_SHORT).show() } return } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2a98296..970b144 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -55,11 +55,14 @@ Memo Scan QR Asset - Please Pay: %1$s %2$s + Other… + Please Send: %1$s %2$s + Any Amount To: %1$s BiTSy invoice from %1$s Share Share with + Storage permission is necessary to share images. Settings @@ -80,4 +83,5 @@ Block: %1$s +