diff --git a/build.gradle b/build.gradle index d5b461393..01b16abf2 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { propMinSdkVersion = 21 propTargetSdkVersion = propCompileSdkVersion propVersionCode = 1 - propVersionName = '5.20.8' + propVersionName = '5.20.9' kotlin_version = '1.3.61' } diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/adapters/FilepickerItemsAdapter.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/adapters/FilepickerItemsAdapter.kt index dcd97f56e..2a3cf5b67 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/adapters/FilepickerItemsAdapter.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/adapters/FilepickerItemsAdapter.kt @@ -52,6 +52,10 @@ class FilepickerItemsAdapter(activity: BaseSimpleActivity, val fileDirItems: Lis override fun getItemSelectionKey(position: Int) = fileDirItems[position].path.hashCode() + override fun onActionModeCreated() {} + + override fun onActionModeDestroyed() {} + override fun onViewRecycled(holder: ViewHolder) { super.onViewRecycled(holder) if (!activity.isDestroyed && !activity.isFinishing) { diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/adapters/MyRecyclerViewAdapter.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/adapters/MyRecyclerViewAdapter.kt index 27e2f14a7..86b35946f 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/adapters/MyRecyclerViewAdapter.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/adapters/MyRecyclerViewAdapter.kt @@ -47,6 +47,10 @@ abstract class MyRecyclerViewAdapter(val activity: BaseSimpleActivity, val recyc abstract fun getItemKeyPosition(key: Int): Int + abstract fun onActionModeCreated() + + abstract fun onActionModeDestroyed() + protected fun isOneItemSelected() = selectedKeys.size == 1 init { @@ -72,6 +76,7 @@ abstract class MyRecyclerViewAdapter(val activity: BaseSimpleActivity, val recyc } } activity.menuInflater.inflate(getActionMenuId(), menu) + onActionModeCreated() return true } @@ -93,6 +98,7 @@ abstract class MyRecyclerViewAdapter(val activity: BaseSimpleActivity, val recyc actBarTextView?.text = "" actMode = null lastLongPressedItem = -1 + onActionModeDestroyed() } } } diff --git a/samples/src/main/kotlin/com/simplemobiletools/commons/samples/activities/StringsAdapter.kt b/samples/src/main/kotlin/com/simplemobiletools/commons/samples/activities/StringsAdapter.kt index e9b59b1f5..ea85758eb 100644 --- a/samples/src/main/kotlin/com/simplemobiletools/commons/samples/activities/StringsAdapter.kt +++ b/samples/src/main/kotlin/com/simplemobiletools/commons/samples/activities/StringsAdapter.kt @@ -29,6 +29,10 @@ class StringsAdapter(activity: BaseSimpleActivity, var strings: MutableList