recreate the MediaAdapter in some extra cases

This commit is contained in:
tibbi 2018-06-24 18:07:01 +02:00
parent d69351fa99
commit 92fc3ec90c
2 changed files with 6 additions and 1 deletions

View file

@ -47,7 +47,7 @@ ext {
} }
dependencies { 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.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'com.android.support:multidex:1.0.3' implementation 'com.android.support:multidex:1.0.3'
implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1'

View file

@ -403,6 +403,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
private fun showSortingDialog() { private fun showSortingDialog() {
ChangeSortingDialog(this, false, !config.showAll, mPath) { ChangeSortingDialog(this, false, !config.showAll, mPath) {
mLoadedInitialPhotos = false mLoadedInitialPhotos = false
media_grid.adapter = null
getMedia() getMedia()
} }
} }
@ -411,6 +412,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
FilterMediaDialog(this) { FilterMediaDialog(this) {
mLoadedInitialPhotos = false mLoadedInitialPhotos = false
media_refresh_layout.isRefreshing = true media_refresh_layout.isRefreshing = true
media_grid.adapter = null
getMedia() getMedia()
} }
} }
@ -443,6 +445,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
private fun showGroupByDialog() { private fun showGroupByDialog() {
ChangeGroupingDialog(this, mShowAll, mPath) { ChangeGroupingDialog(this, mShowAll, mPath) {
mLoadedInitialPhotos = false mLoadedInitialPhotos = false
media_grid.adapter = null
getMedia() getMedia()
} }
} }
@ -651,6 +654,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
config.mediaColumnCnt = ++(media_grid.layoutManager as MyGridLayoutManager).spanCount config.mediaColumnCnt = ++(media_grid.layoutManager as MyGridLayoutManager).spanCount
invalidateOptionsMenu() invalidateOptionsMenu()
media_grid.adapter?.notifyDataSetChanged() media_grid.adapter?.notifyDataSetChanged()
measureRecyclerViewContent(mMedia)
} }
private fun reduceColumnCount() { private fun reduceColumnCount() {
@ -659,6 +663,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
config.mediaColumnCnt = --(media_grid.layoutManager as MyGridLayoutManager).spanCount config.mediaColumnCnt = --(media_grid.layoutManager as MyGridLayoutManager).spanCount
invalidateOptionsMenu() invalidateOptionsMenu()
media_grid.adapter?.notifyDataSetChanged() media_grid.adapter?.notifyDataSetChanged()
measureRecyclerViewContent(mMedia)
} }
private fun isSetWallpaperIntent() = intent.getBooleanExtra(SET_WALLPAPER_INTENT, false) private fun isSetWallpaperIntent() = intent.getBooleanExtra(SET_WALLPAPER_INTENT, false)