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.

This commit is contained in:
Severiano Jaramillo 2019-01-02 17:03:20 -06:00
parent 71f2a8b25b
commit d4dbdc4aeb
2 changed files with 17 additions and 10 deletions

View file

@ -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 // 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( val asset = cy.agorise.bitsybitshareswallet.database.entities.Asset(
OTHER_ASSET, "Other...", 0, "", "" OTHER_ASSET, getString(R.string.text__other), 0, "", ""
) )
mAssets.add(asset) mAssets.add(asset)
@ -325,14 +325,18 @@ class ReceiveTransactionFragment : Fragment(), ServiceConnection {
* @param account Account to pay total * @param account Account to pay total
*/ */
private fun updateAmountAddressUI(total: AssetAmount, account: String) { private fun updateAmountAddressUI(total: AssetAmount, account: String) {
val df = DecimalFormat("####."+("#".repeat(total.asset.precision))) val txtAmount: String = if (total.amount.toLong() == 0L) {
df.roundingMode = RoundingMode.CEILING getString(R.string.template__please_send, getString(R.string.text__any_amount), " ")
df.decimalFormatSymbols = DecimalFormatSymbols(Locale.getDefault()) } 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 amount = total.amount.toDouble() / Math.pow(10.toDouble(), total.asset.precision.toDouble())
val strAmount = df.format(amount) 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) val txtAccount = getString(R.string.template__to, account)
tvPleasePay.text = txtAmount tvPleasePay.text = txtAmount
@ -370,8 +374,7 @@ class ReceiveTransactionFragment : Fragment(), ServiceConnection {
if ((grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED)) { if ((grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED)) {
shareQRScreenshot() shareQRScreenshot()
} else { } else {
// TODO extract string resource Toast.makeText(context!!, getString(R.string.msg__storage__permission__necessary), Toast.LENGTH_SHORT).show()
Toast.makeText(context!!, "Storage permission is necessary to share QR codes.", Toast.LENGTH_SHORT).show()
} }
return return
} }

View file

@ -55,11 +55,14 @@
<string name="text__memo">Memo</string> <string name="text__memo">Memo</string>
<string name="text__scan_qr">Scan QR</string> <string name="text__scan_qr">Scan QR</string>
<string name="text__asset">Asset</string> <string name="text__asset">Asset</string>
<string name="template__please_pay">Please Pay: %1$s %2$s</string> <string name="text__other">Other…</string>
<string name="template__please_send">Please Send: %1$s %2$s</string>
<string name="text__any_amount">Any Amount</string>
<string name="template__to">To: %1$s</string> <string name="template__to">To: %1$s</string>
<string name="msg__invoice_subject">BiTSy invoice from %1$s</string> <string name="msg__invoice_subject">BiTSy invoice from %1$s</string>
<string name="title_share">Share</string> <string name="title_share">Share</string>
<string name="text__share_with">Share with</string> <string name="text__share_with">Share with</string>
<string name="msg__storage__permission__necessary">Storage permission is necessary to share images.</string>
<!-- Settings --> <!-- Settings -->
<string name="title_settings">Settings</string> <string name="title_settings">Settings</string>
@ -80,4 +83,5 @@
</string> </string>
<string name="title__bitshares_nodes_dialog">Block: %1$s</string> <string name="title__bitshares_nodes_dialog">Block: %1$s</string>
</resources> </resources>