summaryrefslogtreecommitdiff
path: root/cashier
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2020-04-22 16:51:25 -0300
committerTorsten Grote <t@grobox.de>2020-04-22 16:51:25 -0300
commita99932be13e415d542658696f1281eac8a1c48f0 (patch)
treed0a8073d4a1514de0069bcad72268bbd96583ac1 /cashier
parentd57645954dda2d478fe09dd0135183e1b3526db0 (diff)
downloadtaler-android-a99932be13e415d542658696f1281eac8a1c48f0.tar.gz
taler-android-a99932be13e415d542658696f1281eac8a1c48f0.tar.bz2
taler-android-a99932be13e415d542658696f1281eac8a1c48f0.zip
[cashier] improve strings and error messages after input from Christian
Diffstat (limited to 'cashier')
-rw-r--r--cashier/src/main/java/net/taler/cashier/withdraw/ErrorFragment.kt5
-rw-r--r--cashier/src/main/java/net/taler/cashier/withdraw/WithdrawManager.kt7
-rw-r--r--cashier/src/main/res/layout/fragment_error.xml6
-rw-r--r--cashier/src/main/res/values/strings.xml20
4 files changed, 22 insertions, 16 deletions
diff --git a/cashier/src/main/java/net/taler/cashier/withdraw/ErrorFragment.kt b/cashier/src/main/java/net/taler/cashier/withdraw/ErrorFragment.kt
index ceffcec..ea33b0d 100644
--- a/cashier/src/main/java/net/taler/cashier/withdraw/ErrorFragment.kt
+++ b/cashier/src/main/java/net/taler/cashier/withdraw/ErrorFragment.kt
@@ -42,11 +42,14 @@ class ErrorFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
withdrawManager.withdrawStatus.observe(viewLifecycleOwner, Observer { status ->
+ if (status == null) return@Observer
if (status is WithdrawStatus.Aborted) {
textView.setText(R.string.transaction_aborted)
+ } else if (status is WithdrawStatus.Error) {
+ textView.text = status.msg
}
+ withdrawManager.completeTransaction()
})
- withdrawManager.completeTransaction()
backButton.setOnClickListener {
findNavController().popBackStack()
}
diff --git a/cashier/src/main/java/net/taler/cashier/withdraw/WithdrawManager.kt b/cashier/src/main/java/net/taler/cashier/withdraw/WithdrawManager.kt
index edefa5a..32e0802 100644
--- a/cashier/src/main/java/net/taler/cashier/withdraw/WithdrawManager.kt
+++ b/cashier/src/main/java/net/taler/cashier/withdraw/WithdrawManager.kt
@@ -125,7 +125,8 @@ class WithdrawManager(
override fun onFinish() {
abort()
- mWithdrawStatus.postValue(WithdrawStatus.Error)
+ val str = app.getString(R.string.withdraw_error_timeout)
+ mWithdrawStatus.postValue(WithdrawStatus.Error(str))
cancel()
}
}
@@ -196,7 +197,7 @@ class WithdrawManager(
}
is Error -> {
Log.e(TAG, "Error confirming withdrawal. Status code: ${result.statusCode}")
- mWithdrawStatus.postValue(WithdrawStatus.Error)
+ mWithdrawStatus.postValue(WithdrawStatus.Error(result.msg))
}
}
}
@@ -220,7 +221,7 @@ sealed class WithdrawResult {
}
sealed class WithdrawStatus {
- object Error : WithdrawStatus()
+ class Error(val msg: String) : WithdrawStatus()
object Aborted : WithdrawStatus()
class SelectionDone(val withdrawalId: String) : WithdrawStatus()
object Confirming : WithdrawStatus()
diff --git a/cashier/src/main/res/layout/fragment_error.xml b/cashier/src/main/res/layout/fragment_error.xml
index fe1db37..2eab923 100644
--- a/cashier/src/main/res/layout/fragment_error.xml
+++ b/cashier/src/main/res/layout/fragment_error.xml
@@ -40,7 +40,6 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="32dp"
- android:text="@string/transaction_error"
android:textAlignment="center"
android:textColor="@color/red"
app:autoSizeMaxTextSize="42sp"
@@ -49,7 +48,8 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/imageView" />
+ app:layout_constraintTop_toBottomOf="@+id/imageView"
+ tools:text="@string/withdraw_error_timeout" />
<Button
android:id="@+id/backButton"
@@ -61,4 +61,4 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
-</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/cashier/src/main/res/values/strings.xml b/cashier/src/main/res/values/strings.xml
index 43e3573..d0ac3ae 100644
--- a/cashier/src/main/res/values/strings.xml
+++ b/cashier/src/main/res/values/strings.xml
@@ -5,35 +5,37 @@
<string name="config_username">Username</string>
<string name="config_password">Password</string>
<string name="config_button_save">Save</string>
- <string name="config_bank_url_error">The address in invalid.</string>
- <string name="config_username_error">Please enter your username</string>
+ <string name="config_bank_url_error">The address is invalid.</string>
+ <string name="config_username_error">Please enter your username!</string>
<string name="config_error">Error retrieving configuration%s</string>
- <string name="config_error_auth">Invalid username or password</string>
+ <string name="config_error_auth">Invalid username or password!</string>
<string name="config_demo_hint" tools:ignore="StringFormatInvalid">For testing, you can <![CDATA[<a href="%s">create a test account at the demo bank</a>]]>.</string>
<string name="balance_current_label">Current balance</string>
<string name="balance_error">ERROR%s</string>
- <string name="balance_offline">Offline. Please connect to the Internet</string>
+ <string name="balance_offline">Offline. Please connect to the Internet.</string>
<string name="action_reconfigure">Reconfigure</string>
<string name="action_lock">Lock</string>
<string name="withdraw_input_amount">Amount</string>
<string name="withdraw_into">How much e-cash should be withdrawn?</string>
- <string name="withdraw_error_zero">Enter positive amount</string>
+ <string name="withdraw_error_zero">Enter positive amount!</string>
<string name="withdraw_error_insufficient_balance">Insufficient balance</string>
<string name="withdraw_error_fetch">Error communicating with bank%s</string>
+ <string name="withdraw_error_timeout">No wallet tried to withdraw. Please try again.</string>
<string name="withdraw_button_confirm">Withdraw</string>
- <string name="transaction_intro">Scan code\nwith the Taler wallet app\nto get</string>
- <string name="transaction_intro_nfc">Scan code or use NFC\nwith the Taler wallet app\nto get</string>
+ <!-- "to get" refers to the amount that will be withdrawn, e.g. to get 12 EUR -->
+ <string name="transaction_intro">Scan code with the Taler wallet app to get</string>
+ <!-- "to get" refers to the amount that will be withdrawn, e.g. to get 12 EUR -->
+ <string name="transaction_intro_nfc">Scan code or use NFC with the Taler wallet app to get</string>
<string name="transaction_intro_scanned">Please confirm the transaction!</string>
<string name="transaction_confirm">Confirm</string>
<string name="transaction_abort">Abort</string>
- <string name="transaction_error">Transaction error</string>
<string name="transaction_aborted">Transaction aborted</string>
<string name="transaction_button_back">Go back</string>
<string name="transaction_last_success">Last Transaction: %s withdrawn</string>
<string name="transaction_last_aborted">Last Transaction: Aborted</string>
- <string name="transaction_last_error">Last Transaction: Error</string>
+ <string name="transaction_last_error">Last Transaction: Failed</string>
</resources>