taler-android

Android apps for GNU Taler (wallet, PoS, cashier)
Log | Files | Refs | README | LICENSE

reset-dialog-puts-the-wipe-where-cancel-belongs.diff (2717B)


      1 diff --git a/wallet/src/main/java/net/taler/wallet/settings/SettingsScreen.kt b/wallet/src/main/java/net/taler/wallet/settings/SettingsScreen.kt
      2 index 5d904900..fd354ce8 100644
      3 --- a/wallet/src/main/java/net/taler/wallet/settings/SettingsScreen.kt
      4 +++ b/wallet/src/main/java/net/taler/wallet/settings/SettingsScreen.kt
      5 @@ -295,10 +295,15 @@ fun SettingsScreen(
      6                      onClick = {
      7                          MaterialAlertDialogBuilder(context)
      8                              .setMessage(R.string.settings_dialog_import_message)
      9 -                            .setNegativeButton(R.string.import_db) { _, _ ->
     10 +                            // The affirmative action goes in the positive slot:
     11 +                            // MaterialAlertDialogBuilder draws that one on the
     12 +                            // right, where this app's other dialogs and the
     13 +                            // platform put "continue" -- and the left-hand
     14 +                            // button is the one a user taps to back out.
     15 +                            .setPositiveButton(R.string.import_db) { _, _ ->
     16                                  dbImportLauncher.launch(arrayOf("application/json"))
     17                              }
     18 -                            .setPositiveButton(R.string.cancel) { _, _ ->
     19 +                            .setNegativeButton(R.string.cancel) { _, _ ->
     20                                  scope.launch { snackbarHostState.showSnackbar(importCanceledMessage) }
     21                              }
     22                              .show()
     23 @@ -358,13 +363,16 @@ fun SettingsScreen(
     24                      onClick = {
     25                          MaterialAlertDialogBuilder(context)
     26                              .setMessage(R.string.settings_dialog_reset_message)
     27 -                            .setNegativeButton(R.string.reset) { _, _ ->
     28 +                            // Likewise: wiping the wallet is the affirmative
     29 +                            // action, so it belongs on the right rather than
     30 +                            // where a dismissive tap lands.
     31 +                            .setPositiveButton(R.string.reset) { _, _ ->
     32                                  settingsManager.clearDb {
     33                                      model.dangerouslyReset()
     34                                  }
     35                                  scope.launch { snackbarHostState.showSnackbar(resetDoneMessage) }
     36                              }
     37 -                            .setPositiveButton(R.string.cancel) { _, _ ->
     38 +                            .setNegativeButton(R.string.cancel) { _, _ ->
     39                                  scope.launch { snackbarHostState.showSnackbar(resetCanceledMessage) }
     40                              }
     41                              .show()