fix #618, properly refresh menu items when appropriate

This commit is contained in:
tibbi 2022-08-20 22:35:13 +02:00
parent 12c2ba7590
commit 23955ac05d
4 changed files with 6 additions and 5 deletions

View File

@ -145,7 +145,7 @@ class MainActivity : SimpleActivity() {
config.temporarilyShowHidden = false
}
private fun refreshMenuItems() {
fun refreshMenuItems() {
val currentFragment = getCurrentFragment() ?: return
val currentViewType = config.getFolderViewType(currentFragment.currentPath)
val favorites = config.favorites

View File

@ -351,6 +351,7 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
ChangeViewTypeDialog(this, currentMimeType, true) {
recreateList()
setupLayoutManager()
refreshMenuItems()
}
}
@ -375,7 +376,7 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
}
private fun columnCountChanged() {
invalidateOptionsMenu()
refreshMenuItems()
getRecyclerAdapter()?.apply {
notifyItemRangeChanged(0, listItems.size)
}

View File

@ -115,7 +115,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
itemsIgnoringSearch = listItems
activity?.runOnUiThread {
activity?.invalidateOptionsMenu()
(activity as? MainActivity)?.refreshMenuItems()
addItems(listItems, forceRefresh)
if (context != null && currentViewType != context!!.config.getFolderViewType(currentPath)) {
setupLayoutManager()
@ -492,7 +492,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
}
private fun columnCountChanged() {
activity?.invalidateOptionsMenu()
(activity as? MainActivity)?.refreshMenuItems()
getRecyclerAdapter()?.apply {
notifyItemRangeChanged(0, listItems.size)
}

View File

@ -188,7 +188,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
}
private fun columnCountChanged() {
activity?.invalidateOptionsMenu()
(activity as? MainActivity)?.refreshMenuItems()
getRecyclerAdapter()?.apply {
notifyItemRangeChanged(0, listItems.size)
}