adding some floating contextual menu related fixes

This commit is contained in:
tibbi 2022-05-08 23:09:34 +02:00
parent 291de123c2
commit 096685dc2a
2 changed files with 9 additions and 3 deletions

View File

@ -70,7 +70,7 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:b30a1e0b37'
implementation 'com.github.SimpleMobileTools:Simple-Commons:d04f40487b'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

View File

@ -38,7 +38,7 @@ class ManageEventTypesAdapter(
}
when (id) {
R.id.cab_edit -> itemClick.invoke(getSelectedItems().first())
R.id.cab_edit -> editEventType()
R.id.cab_delete -> askConfirmDelete()
}
}
@ -90,6 +90,7 @@ class ManageEventTypesAdapter(
}
private fun showPopupMenu(view: View, eventType: EventType) {
finishActMode()
val theme = activity.getPopupMenuTheme()
val contextTheme = ContextThemeWrapper(activity, theme)
@ -116,11 +117,16 @@ class ManageEventTypesAdapter(
}
private fun executeItemMenuOperation(eventTypeId: Int, callback: () -> Unit) {
finishActMode()
selectedKeys.clear()
selectedKeys.add(eventTypeId)
callback()
}
private fun editEventType() {
itemClick.invoke(getSelectedItems().first())
finishActMode()
}
private fun askConfirmDelete() {
val eventTypes = eventTypes.filter { selectedKeys.contains(it.id?.toInt()) }.map { it.id } as ArrayList<Long>