From 92fc3ec90c61b22e810e4de6c520b1d8c46e3ae8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 24 Jun 2018 18:07:01 +0200 Subject: [PATCH] recreate the MediaAdapter in some extra cases --- app/build.gradle | 2 +- .../simplemobiletools/gallery/activities/MediaActivity.kt | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index c6bdcaf90..3692780c0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -47,7 +47,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:4.2.13' + implementation 'com.simplemobiletools:commons:4.3.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0' implementation 'com.android.support:multidex:1.0.3' implementation 'it.sephiroth.android.exif:library:1.0.1' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 6d51be4fb..a24de85c4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -403,6 +403,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun showSortingDialog() { ChangeSortingDialog(this, false, !config.showAll, mPath) { mLoadedInitialPhotos = false + media_grid.adapter = null getMedia() } } @@ -411,6 +412,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { FilterMediaDialog(this) { mLoadedInitialPhotos = false media_refresh_layout.isRefreshing = true + media_grid.adapter = null getMedia() } } @@ -443,6 +445,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun showGroupByDialog() { ChangeGroupingDialog(this, mShowAll, mPath) { mLoadedInitialPhotos = false + media_grid.adapter = null getMedia() } } @@ -651,6 +654,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { config.mediaColumnCnt = ++(media_grid.layoutManager as MyGridLayoutManager).spanCount invalidateOptionsMenu() media_grid.adapter?.notifyDataSetChanged() + measureRecyclerViewContent(mMedia) } private fun reduceColumnCount() { @@ -659,6 +663,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { config.mediaColumnCnt = --(media_grid.layoutManager as MyGridLayoutManager).spanCount invalidateOptionsMenu() media_grid.adapter?.notifyDataSetChanged() + measureRecyclerViewContent(mMedia) } private fun isSetWallpaperIntent() = intent.getBooleanExtra(SET_WALLPAPER_INTENT, false)