From f2c1f7688aa50e42f247c2d5f7f14f7e77a73346 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 29 Oct 2020 23:03:59 +0100 Subject: [PATCH] allow changing the column level with zooming again --- .../filemanager/pro/activities/MainActivity.kt | 2 +- .../filemanager/pro/fragments/ItemsFragment.kt | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt index 6be8a4c1..62ab0ef7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt @@ -291,7 +291,7 @@ class MainActivity : SimpleActivity() { private fun changeViewType() { ChangeViewTypeDialog(this, fragment.currentPath) { - fragment.setupLayoutManager(true) + fragment.setupLayoutManager() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt index a544af8a..4b2a5f3a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt @@ -69,7 +69,6 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb breadcrumbs.listener = this@ItemsFragment breadcrumbs.updateFontSize(context!!.getTextSize()) } - initZoomListener() } override fun onSaveInstanceState(outState: Bundle) { @@ -156,9 +155,8 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb activity?.runOnUiThread { activity?.invalidateOptionsMenu() addItems(listItems, forceRefresh) - val curr = 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 - fun setupLayoutManager(resetAdapter: Boolean) { + fun setupLayoutManager() { if (context!!.config.getFolderViewType(currentPath) == VIEW_TYPE_GRID) { currentViewType = VIEW_TYPE_GRID setupGridLayoutManager() @@ -421,10 +419,9 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb setupListLayoutManager() } - if (resetAdapter) { - mView.items_list.adapter = null - addItems(storedItems, true) - } + mView.items_list.adapter = null + initZoomListener() + addItems(storedItems, true) } private fun setupGridLayoutManager() {