Use in-app dividers

This commit is contained in:
Naveen 2023-09-06 18:10:39 +05:30
parent fd043a7805
commit 4cb053847c
No known key found for this signature in database
GPG key ID: 0E155DAD31671DA3
2 changed files with 16 additions and 10 deletions

View file

@ -22,7 +22,7 @@ class ChangeSortingDialog(
init { init {
currSorting = if (isDirectorySorting) config.directorySorting else config.getFolderSorting(pathToUse) currSorting = if (isDirectorySorting) config.directorySorting else config.getFolderSorting(pathToUse)
binding = DialogChangeSortingBinding.inflate(activity.layoutInflater).apply { binding = DialogChangeSortingBinding.inflate(activity.layoutInflater).apply {
useForThisFolderDivider.beVisibleIf(showFolderCheckbox || (currSorting and SORT_BY_NAME != 0 || currSorting and SORT_BY_PATH != 0)) sortingDialogOrderDivider.beVisibleIf(showFolderCheckbox || (currSorting and SORT_BY_NAME != 0 || currSorting and SORT_BY_PATH != 0))
sortingDialogNumericSorting.beVisibleIf(showFolderCheckbox && (currSorting and SORT_BY_NAME != 0 || currSorting and SORT_BY_PATH != 0)) sortingDialogNumericSorting.beVisibleIf(showFolderCheckbox && (currSorting and SORT_BY_NAME != 0 || currSorting and SORT_BY_PATH != 0))
sortingDialogNumericSorting.isChecked = currSorting and SORT_USE_NUMERIC_VALUE != 0 sortingDialogNumericSorting.isChecked = currSorting and SORT_USE_NUMERIC_VALUE != 0
@ -46,14 +46,14 @@ class ChangeSortingDialog(
private fun setupSortRadio() { private fun setupSortRadio() {
val sortingRadio = binding.sortingDialogRadioSorting val sortingRadio = binding.sortingDialogRadioSorting
sortingRadio.setOnCheckedChangeListener { group, checkedId -> sortingRadio.setOnCheckedChangeListener { _, checkedId ->
val isSortingByNameOrPath = checkedId == binding.sortingDialogRadioName.id || checkedId == binding.sortingDialogRadioPath.id val isSortingByNameOrPath = checkedId == binding.sortingDialogRadioName.id || checkedId == binding.sortingDialogRadioPath.id
binding.sortingDialogNumericSorting.beVisibleIf(isSortingByNameOrPath) binding.sortingDialogNumericSorting.beVisibleIf(isSortingByNameOrPath)
binding.useForThisFolderDivider.beVisibleIf(binding.sortingDialogNumericSorting.isVisible() || binding.sortingDialogUseForThisFolder.isVisible()) binding.sortingDialogOrderDivider.beVisibleIf(binding.sortingDialogNumericSorting.isVisible() || binding.sortingDialogUseForThisFolder.isVisible())
val hideSortOrder = checkedId == binding.sortingDialogRadioCustom.id || checkedId == binding.sortingDialogRadioRandom.id val hideSortOrder = checkedId == binding.sortingDialogRadioCustom.id || checkedId == binding.sortingDialogRadioRandom.id
binding.sortingDialogRadioOrder.beGoneIf(hideSortOrder) binding.sortingDialogRadioOrder.beGoneIf(hideSortOrder)
binding.sortingDialogOrderDivider.beGoneIf(hideSortOrder) binding.sortingDialogSortingDivider.beGoneIf(hideSortOrder)
} }
val sortBtn = when { val sortBtn = when {

View file

@ -63,9 +63,12 @@
</RadioGroup> </RadioGroup>
<include <ImageView
android:id="@+id/sorting_dialog_order_divider" android:id="@+id/sorting_dialog_sorting_divider"
layout="@layout/divider" /> android:layout_width="match_parent"
android:layout_height="@dimen/divider_height"
android:background="@color/divider_grey"
android:importantForAccessibility="no" />
<RadioGroup <RadioGroup
android:id="@+id/sorting_dialog_radio_order" android:id="@+id/sorting_dialog_radio_order"
@ -87,9 +90,12 @@
android:text="@string/descending" /> android:text="@string/descending" />
</RadioGroup> </RadioGroup>
<include <ImageView
android:id="@+id/use_for_this_folder_divider" android:id="@+id/sorting_dialog_order_divider"
layout="@layout/divider" /> android:layout_width="match_parent"
android:layout_height="@dimen/divider_height"
android:background="@color/divider_grey"
android:importantForAccessibility="no" />
<com.simplemobiletools.commons.views.MyAppCompatCheckbox <com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/sorting_dialog_numeric_sorting" android:id="@+id/sorting_dialog_numeric_sorting"