diff --git a/app/build.gradle b/app/build.gradle index 93b11d6c2..fbad76fa5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -47,7 +47,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.0.6' + implementation 'com.simplemobiletools:commons:3.0.9' implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.8.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.0' implementation 'com.android.support:multidex:1.0.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 8a13d5c40..86e9a54bc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -35,10 +35,6 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: MutableList) { dirs = newDirs - selectableItemCount = dirs.size notifyDataSetChanged() finishActMode() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/ManageFoldersAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/ManageFoldersAdapter.kt index 98c2cb4a5..73818a600 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/ManageFoldersAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/ManageFoldersAdapter.kt @@ -18,10 +18,6 @@ class ManageFoldersAdapter(activity: BaseSimpleActivity, var folders: ArrayList< private val config = activity.config - init { - selectableItemCount = folders.size - } - override fun getActionMenuId() = R.menu.cab_delete_only override fun prepareActionMode(menu: Menu) {} @@ -38,6 +34,8 @@ class ManageFoldersAdapter(activity: BaseSimpleActivity, var folders: ArrayList< } } + override fun getSelectableItemCount() = folders.size + override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int) = createViewHolder(R.layout.item_manage_folder, parent) override fun onBindViewHolder(holder: ViewHolder, position: Int) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index 4ea65d63a..58a76c181 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -35,10 +35,6 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList, private var cropThumbnails = config.cropThumbnails private var displayFilenames = config.displayFileNames - init { - selectableItemCount = media.count() - } - override fun getActionMenuId() = R.menu.cab_media override fun prepareItemSelection(view: View) { @@ -92,6 +88,8 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList, } } + override fun getSelectableItemCount() = media.size + override fun onViewRecycled(holder: ViewHolder?) { super.onViewRecycled(holder) if (!activity.isActivityDestroyed()) { @@ -233,7 +231,6 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList, fun updateMedia(newMedia: ArrayList) { media = newMedia - selectableItemCount = media.size notifyDataSetChanged() finishActMode() }