refresh items after sorting/filtering/grouping only if something changed

This commit is contained in:
tibbi 2022-02-13 16:42:21 +01:00
parent f38612de5f
commit 80390c67f2
4 changed files with 33 additions and 21 deletions

View file

@ -19,6 +19,7 @@ class ChangeGroupingDialog(val activity: BaseSimpleActivity, val path: String =
private var view: View private var view: View
init { init {
currGrouping = config.getFolderGrouping(pathToUse)
view = activity.layoutInflater.inflate(R.layout.dialog_change_grouping, null).apply { view = activity.layoutInflater.inflate(R.layout.dialog_change_grouping, null).apply {
grouping_dialog_use_for_this_folder.isChecked = config.hasCustomGrouping(pathToUse) grouping_dialog_use_for_this_folder.isChecked = config.hasCustomGrouping(pathToUse)
grouping_dialog_radio_folder.beVisibleIf(path.isEmpty()) grouping_dialog_radio_folder.beVisibleIf(path.isEmpty())
@ -31,7 +32,6 @@ class ChangeGroupingDialog(val activity: BaseSimpleActivity, val path: String =
activity.setupDialogStuff(view, this, R.string.group_by) activity.setupDialogStuff(view, this, R.string.group_by)
} }
currGrouping = config.getFolderGrouping(pathToUse)
setupGroupRadio() setupGroupRadio()
setupOrderRadio() setupOrderRadio()
view.grouping_dialog_show_file_count.isChecked = currGrouping and GROUP_SHOW_FILE_COUNT != 0 view.grouping_dialog_show_file_count.isChecked = currGrouping and GROUP_SHOW_FILE_COUNT != 0
@ -90,6 +90,7 @@ class ChangeGroupingDialog(val activity: BaseSimpleActivity, val path: String =
config.removeFolderGrouping(pathToUse) config.removeFolderGrouping(pathToUse)
config.groupBy = grouping config.groupBy = grouping
} }
callback() callback()
} }
} }

View file

@ -113,6 +113,9 @@ class ChangeSortingDialog(
config.sorting = sorting config.sorting = sorting
} }
} }
if (currSorting != sorting) {
callback() callback()
} }
} }
}

View file

@ -55,7 +55,12 @@ class ChangeViewTypeDialog(val activity: BaseSimpleActivity, val fromFoldersView
} }
private fun dialogConfirmed() { private fun dialogConfirmed() {
val viewType = if (view.change_view_type_dialog_radio.checkedRadioButtonId == view.change_view_type_dialog_radio_grid.id) VIEW_TYPE_GRID else VIEW_TYPE_LIST val viewType = if (view.change_view_type_dialog_radio.checkedRadioButtonId == view.change_view_type_dialog_radio_grid.id) {
VIEW_TYPE_GRID
} else {
VIEW_TYPE_LIST
}
if (fromFoldersView) { if (fromFoldersView) {
config.viewTypeFolders = viewType config.viewTypeFolders = viewType
config.groupDirectSubfolders = view.change_view_type_dialog_group_direct_subfolders.isChecked config.groupDirectSubfolders = view.change_view_type_dialog_group_direct_subfolders.isChecked
@ -68,6 +73,7 @@ class ChangeViewTypeDialog(val activity: BaseSimpleActivity, val fromFoldersView
} }
} }
callback() callback()
} }
} }

View file

@ -49,7 +49,9 @@ class FilterMediaDialog(val activity: BaseSimpleActivity, val callback: (result:
result = getDefaultFileFilter() result = getDefaultFileFilter()
} }
if (activity.config.filterMedia != result) {
activity.config.filterMedia = result activity.config.filterMedia = result
callback(result) callback(result)
} }
} }
}