diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index ebe559cf0..2b39e9974 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -84,6 +84,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { private var mStoredScrollHorizontally = true private var mStoredTextColor = 0 private var mStoredPrimaryColor = 0 + private var mStoredStyleString = "" override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -189,6 +190,11 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { directories_horizontal_fastscroller.updatePrimaryColor() } + val styleString = "${config.folderStyle}${config.showFolderMediaCount}${config.limitFolderTitle}" + if (mStoredStyleString != styleString) { + setupAdapter(mDirs, forceRecreate = true) + } + directories_horizontal_fastscroller.updateBubbleColors() directories_vertical_fastscroller.updateBubbleColors() directories_refresh_layout.isEnabled = config.enablePullToRefresh @@ -329,6 +335,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { mStoredScrollHorizontally = scrollHorizontally mStoredTextColor = textColor mStoredPrimaryColor = primaryColor + mStoredStyleString = "$folderStyle$showFolderMediaCount$limitFolderTitle" } } @@ -1141,13 +1148,13 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { directories_grid.beVisibleIf(directories_empty_placeholder.isGone()) } - private fun setupAdapter(dirs: ArrayList, textToSearch: String = "") { + private fun setupAdapter(dirs: ArrayList, textToSearch: String = "", forceRecreate: Boolean = false) { val currAdapter = directories_grid.adapter val distinctDirs = dirs.distinctBy { it.path.getDistinctPath() }.toMutableList() as ArrayList val sortedDirs = getSortedDirectories(distinctDirs) var dirsToShow = getDirsToShow(sortedDirs, mDirs, mCurrentPathPrefix).clone() as ArrayList - if (currAdapter == null) { + if (currAdapter == null || forceRecreate) { initZoomListener() val fastscroller = if (config.scrollHorizontally) directories_horizontal_fastscroller else directories_vertical_fastscroller DirectoryAdapter(this, dirsToShow, this, directories_grid, isPickIntent(intent) || isGetAnyContentIntent(intent), fastscroller) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt index f1eb345d3..18275b9e8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt @@ -48,13 +48,16 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList() + private var showMediaCount = config.showFolderMediaCount + private var folderStyle = config.folderStyle + private var limitFolderTitle = config.limitFolderTitle + init { setupDragListener(true) fillLockedFolders() @@ -63,12 +66,10 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList R.layout.directory_item_list + folderStyle == FOLDER_STYLE_SQUARE -> R.layout.directory_item_grid_square + else -> R.layout.directory_item_grid_rounded_corners } return createViewHolder(layoutType, parent) @@ -679,7 +680,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList ROUNDED_CORNERS_SMALL - config.folderStyle == FOLDER_STYLE_SQUARE -> ROUNDED_CORNERS_NONE + folderStyle == FOLDER_STYLE_SQUARE -> ROUNDED_CORNERS_NONE else -> ROUNDED_CORNERS_BIG } @@ -721,7 +722,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList