show the numeric sorting checkbox only at sorting by name or path

This commit is contained in:
tibbi 2019-05-05 22:46:06 +02:00
parent 4812dff077
commit dcfca72064

View file

@ -25,7 +25,7 @@ class ChangeSortingDialog(val activity: BaseSimpleActivity, val isDirectorySorti
view = activity.layoutInflater.inflate(R.layout.dialog_change_sorting, null).apply { view = activity.layoutInflater.inflate(R.layout.dialog_change_sorting, null).apply {
use_for_this_folder_divider.beVisibleIf(showFolderCheckbox) use_for_this_folder_divider.beVisibleIf(showFolderCheckbox)
sorting_dialog_numeric_sorting.beVisibleIf(showFolderCheckbox) sorting_dialog_numeric_sorting.beVisibleIf(showFolderCheckbox && (currSorting and SORT_BY_NAME != 0 || currSorting and SORT_BY_PATH != 0))
sorting_dialog_numeric_sorting.isChecked = currSorting and SORT_USE_NUMERIC_VALUE != 0 sorting_dialog_numeric_sorting.isChecked = currSorting and SORT_USE_NUMERIC_VALUE != 0
sorting_dialog_use_for_this_folder.beVisibleIf(showFolderCheckbox) sorting_dialog_use_for_this_folder.beVisibleIf(showFolderCheckbox)
@ -46,6 +46,9 @@ class ChangeSortingDialog(val activity: BaseSimpleActivity, val isDirectorySorti
private fun setupSortRadio() { private fun setupSortRadio() {
val sortingRadio = view.sorting_dialog_radio_sorting val sortingRadio = view.sorting_dialog_radio_sorting
sortingRadio.setOnCheckedChangeListener { group, checkedId ->
view.sorting_dialog_numeric_sorting.beVisibleIf(checkedId == sortingRadio.sorting_dialog_radio_name.id || checkedId == sortingRadio.sorting_dialog_radio_path.id)
}
val sortBtn = when { val sortBtn = when {
currSorting and SORT_BY_PATH != 0 -> sortingRadio.sorting_dialog_radio_path currSorting and SORT_BY_PATH != 0 -> sortingRadio.sorting_dialog_radio_path