adding some cab selection menu buttons at recordings
This commit is contained in:
parent
daf4d9800a
commit
491d330fdf
|
@ -27,9 +27,23 @@ class RecordingsAdapter(activity: SimpleActivity, var recordings: ArrayList<Reco
|
|||
|
||||
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
|
||||
|
||||
|
@ -55,6 +69,14 @@ class RecordingsAdapter(activity: SimpleActivity, var recordings: ArrayList<Reco
|
|||
|
||||
override fun getItemCount() = recordings.size
|
||||
|
||||
private fun renameRecording() {
|
||||
|
||||
}
|
||||
|
||||
private fun askConfirmDelete() {
|
||||
|
||||
}
|
||||
|
||||
fun updateCurrentRecording(newId: Int) {
|
||||
val oldId = currRecordingId
|
||||
currRecordingId = newId
|
||||
|
|
|
@ -1,4 +1,19 @@
|
|||
<?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>
|
||||
|
|
Loading…
Reference in New Issue