mirror of
https://github.com/SimpleMobileTools/Simple-Voice-Recorder.git
synced 2025-06-05 21:59:31 +02:00
adding some cab selection menu buttons at recordings
This commit is contained in:
@ -27,9 +27,23 @@ class RecordingsAdapter(activity: SimpleActivity, var recordings: ArrayList<Reco
|
|||||||
|
|
||||||
override fun getActionMenuId() = R.menu.cab_recordings
|
override fun getActionMenuId() = R.menu.cab_recordings
|
||||||
|
|
||||||
override fun prepareActionMode(menu: Menu) {}
|
override fun prepareActionMode(menu: Menu) {
|
||||||
|
menu.apply {
|
||||||
|
findItem(R.id.cab_rename).isVisible = isOneItemSelected()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun actionItemPressed(id: Int) {}
|
override fun actionItemPressed(id: Int) {
|
||||||
|
if (selectedKeys.isEmpty()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
when (id) {
|
||||||
|
R.id.cab_rename -> renameRecording()
|
||||||
|
R.id.cab_select_all -> selectAll()
|
||||||
|
R.id.cab_delete -> askConfirmDelete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun getSelectableItemCount() = recordings.size
|
override fun getSelectableItemCount() = recordings.size
|
||||||
|
|
||||||
@ -55,6 +69,14 @@ class RecordingsAdapter(activity: SimpleActivity, var recordings: ArrayList<Reco
|
|||||||
|
|
||||||
override fun getItemCount() = recordings.size
|
override fun getItemCount() = recordings.size
|
||||||
|
|
||||||
|
private fun renameRecording() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun askConfirmDelete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
fun updateCurrentRecording(newId: Int) {
|
fun updateCurrentRecording(newId: Int) {
|
||||||
val oldId = currRecordingId
|
val oldId = currRecordingId
|
||||||
currRecordingId = newId
|
currRecordingId = newId
|
||||||
|
@ -1,4 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu>
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item
|
||||||
|
android:id="@+id/cab_rename"
|
||||||
|
android:icon="@drawable/ic_rename_new"
|
||||||
|
android:title="@string/rename"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/cab_select_all"
|
||||||
|
android:icon="@drawable/ic_select_all_vector"
|
||||||
|
android:title="@string/select_all"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/cab_delete"
|
||||||
|
android:icon="@drawable/ic_delete_vector"
|
||||||
|
android:title="@string/delete"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
</menu>
|
</menu>
|
||||||
|
Reference in New Issue
Block a user