diff options
author | Iván Ávalos <avalos@disroot.org> | 2023-01-06 13:00:35 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2023-01-06 14:13:01 -0600 |
commit | fa73257002ddf6b3e5aa3b8945fab78ce3ec0525 (patch) | |
tree | 15d2406105dd95f53f52c9282f50c665725fb4ad /wallet/src/main | |
parent | d431660b840c37fe6ce80d0486f2ab07d1cbf80f (diff) | |
download | taler-android-fa73257002ddf6b3e5aa3b8945fab78ce3ec0525.tar.gz taler-android-fa73257002ddf6b3e5aa3b8945fab78ce3ec0525.tar.bz2 taler-android-fa73257002ddf6b3e5aa3b8945fab78ce3ec0525.zip |
[wallet] Add delete dialog in transactions list
Diffstat (limited to 'wallet/src/main')
-rw-r--r-- | wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt | 21 | ||||
-rw-r--r-- | wallet/src/main/res/values/strings.xml | 1 |
2 files changed, 21 insertions, 1 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt index 0e7ef07..1926217 100644 --- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt @@ -25,6 +25,8 @@ import android.view.MenuItem import android.view.View import android.view.View.INVISIBLE import android.view.ViewGroup +import androidx.annotation.StringRes +import androidx.appcompat.app.AlertDialog import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView.OnQueryTextListener import androidx.fragment.app.Fragment @@ -216,11 +218,28 @@ class TransactionsFragment : Fragment(), OnTransactionClickListener, ActionMode. return false // no update needed } + @StringRes + val deleteDialogTitle = R.string.transactions_delete + @StringRes + val deleteDialogMessage = R.string.transactions_delete_selected_dialog_message + @StringRes + val deleteDialogButton = R.string.transactions_delete + override fun onActionItemClicked(mode: ActionMode, item: MenuItem): Boolean { when (item.itemId) { R.id.transaction_delete -> { tracker?.selection?.toList()?.let { transactionIds -> - transactionManager.deleteTransactions(transactionIds) + AlertDialog.Builder(requireContext(), R.style.DialogTheme) + .setTitle(deleteDialogTitle) + .setMessage(deleteDialogMessage) + .setPositiveButton(R.string.cancel) { dialog, _ -> + dialog.cancel() + } + .setNegativeButton(deleteDialogButton) { dialog, _ -> + transactionManager.deleteTransactions(transactionIds) + dialog.dismiss() + } + .show() } mode.finish() } diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml index ea5cbdf..51c2ff3 100644 --- a/wallet/src/main/res/values/strings.xml +++ b/wallet/src/main/res/values/strings.xml @@ -87,6 +87,7 @@ GNU Taler is immune against many types of fraud, such as phishing of credit card <string name="transactions_select_all">Select All</string> <string name="transactions_delete_dialog_title">Delete Transaction</string> <string name="transactions_delete_dialog_message">Are you sure you want to remove this transaction from your wallet?</string> + <string name="transactions_delete_selected_dialog_message">Are you sure you want to remove the selected transactions from your wallet?</string> <string name="transactions_cancel_dialog_message">Are you sure you want to cancel this withdrawal? Funds still in transit might get lost.</string> <!-- Transactions --> |