From 26125f02df9d31dc61431fce4efa0d33fda0bb4c Mon Sep 17 00:00:00 2001 From: darthpaul Date: Sun, 23 Oct 2022 00:22:31 +0100 Subject: [PATCH] confirm recording delete from the overflow menu --- .../voicerecorder/adapters/RecordingsAdapter.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/adapters/RecordingsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/adapters/RecordingsAdapter.kt index 493b293..89c502f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/adapters/RecordingsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/adapters/RecordingsAdapter.kt @@ -273,8 +273,8 @@ class RecordingsAdapter( } } R.id.cab_delete -> { - executeItemMenuOperation(recordingId) { - deleteMediaStoreRecordings() + executeItemMenuOperation(recordingId, removeAfterCallback = false) { + askConfirmDelete() } } } @@ -285,9 +285,11 @@ class RecordingsAdapter( } } - private fun executeItemMenuOperation(callId: Int, callback: () -> Unit) { + private fun executeItemMenuOperation(callId: Int, removeAfterCallback: Boolean = true, callback: () -> Unit) { selectedKeys.add(callId) callback() - selectedKeys.remove(callId) + if (removeAfterCallback) { + selectedKeys.remove(callId) + } } }