Merge pull request #155 from KryptKode/feat/delete-confirm-dialog

confirm recording delete from the overflow menu
This commit is contained in:
Tibor Kaputa 2022-10-24 16:56:08 +02:00 committed by GitHub
commit 74b966410a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -273,8 +273,8 @@ class RecordingsAdapter(
} }
} }
R.id.cab_delete -> { R.id.cab_delete -> {
executeItemMenuOperation(recordingId) { executeItemMenuOperation(recordingId, removeAfterCallback = false) {
deleteMediaStoreRecordings() 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) selectedKeys.add(callId)
callback() callback()
selectedKeys.remove(callId) if (removeAfterCallback) {
selectedKeys.remove(callId)
}
} }
} }