allow changing the column level with zooming again

This commit is contained in:
tibbi 2020-10-29 23:03:59 +01:00
parent 10ab22508f
commit f2c1f7688a
2 changed files with 6 additions and 9 deletions

View File

@ -291,7 +291,7 @@ class MainActivity : SimpleActivity() {
private fun changeViewType() { private fun changeViewType() {
ChangeViewTypeDialog(this, fragment.currentPath) { ChangeViewTypeDialog(this, fragment.currentPath) {
fragment.setupLayoutManager(true) fragment.setupLayoutManager()
} }
} }

View File

@ -69,7 +69,6 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
breadcrumbs.listener = this@ItemsFragment breadcrumbs.listener = this@ItemsFragment
breadcrumbs.updateFontSize(context!!.getTextSize()) breadcrumbs.updateFontSize(context!!.getTextSize())
} }
initZoomListener()
} }
override fun onSaveInstanceState(outState: Bundle) { override fun onSaveInstanceState(outState: Bundle) {
@ -156,9 +155,8 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
activity?.runOnUiThread { activity?.runOnUiThread {
activity?.invalidateOptionsMenu() activity?.invalidateOptionsMenu()
addItems(listItems, forceRefresh) addItems(listItems, forceRefresh)
val curr = context?.config?.getFolderViewType(currentPath)
if (currentViewType != context?.config?.getFolderViewType(currentPath)) { if (currentViewType != context?.config?.getFolderViewType(currentPath)) {
setupLayoutManager(true) setupLayoutManager()
} }
} }
} }
@ -412,7 +410,7 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
private fun getRecyclerAdapter() = mView.items_list.adapter as? ItemsAdapter private fun getRecyclerAdapter() = mView.items_list.adapter as? ItemsAdapter
fun setupLayoutManager(resetAdapter: Boolean) { fun setupLayoutManager() {
if (context!!.config.getFolderViewType(currentPath) == VIEW_TYPE_GRID) { if (context!!.config.getFolderViewType(currentPath) == VIEW_TYPE_GRID) {
currentViewType = VIEW_TYPE_GRID currentViewType = VIEW_TYPE_GRID
setupGridLayoutManager() setupGridLayoutManager()
@ -421,10 +419,9 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
setupListLayoutManager() setupListLayoutManager()
} }
if (resetAdapter) { mView.items_list.adapter = null
mView.items_list.adapter = null initZoomListener()
addItems(storedItems, true) addItems(storedItems, true)
}
} }
private fun setupGridLayoutManager() { private fun setupGridLayoutManager() {