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
1 changed files with 6 additions and 4 deletions

View File

@ -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)
}
}
}