mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
refresh the folders at changing view type
This commit is contained in:
parent
da00ed8422
commit
9947d661a3
1 changed files with 11 additions and 5 deletions
|
@ -182,11 +182,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
else
|
||||
getDirectories()
|
||||
|
||||
if (config.viewTypeFolders == VIEW_TYPE_GRID)
|
||||
setupGridLayoutManager()
|
||||
else
|
||||
setupListLayoutManager()
|
||||
|
||||
setupLayoutManager()
|
||||
checkIfColorChanged()
|
||||
} else {
|
||||
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), STORAGE_PERMISSION)
|
||||
|
@ -261,6 +257,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
RadioGroupDialog(this, items, config.viewTypeFolders) {
|
||||
config.viewTypeFolders = it as Int
|
||||
invalidateOptionsMenu()
|
||||
setupLayoutManager()
|
||||
directories_grid.adapter = null
|
||||
setupAdapter()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -300,6 +299,13 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
|
||||
private fun getRecyclerAdapter() = (directories_grid.adapter as DirectoryAdapter)
|
||||
|
||||
private fun setupLayoutManager() {
|
||||
if (config.viewTypeFolders == VIEW_TYPE_GRID)
|
||||
setupGridLayoutManager()
|
||||
else
|
||||
setupListLayoutManager()
|
||||
}
|
||||
|
||||
private fun setupGridLayoutManager() {
|
||||
val layoutManager = directories_grid.layoutManager as GridLayoutManager
|
||||
if (config.scrollHorizontally) {
|
||||
|
|
Loading…
Reference in a new issue