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 {
currSorting = if (isDirectorySorting) config.directorySorting else config.getFolderSorting(pathToUse)
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.isChecked = currSorting and SORT_USE_NUMERIC_VALUE != 0
@ -46,14 +46,14 @@ class ChangeSortingDialog(
private fun setupSortRadio() {
val sortingRadio = binding.sortingDialogRadioSorting
sortingRadio.setOnCheckedChangeListener { group, checkedId ->
sortingRadio.setOnCheckedChangeListener { _, checkedId ->
val isSortingByNameOrPath = checkedId == binding.sortingDialogRadioName.id || checkedId == binding.sortingDialogRadioPath.id
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
binding.sortingDialogRadioOrder.beGoneIf(hideSortOrder)
binding.sortingDialogOrderDivider.beGoneIf(hideSortOrder)
binding.sortingDialogSortingDivider.beGoneIf(hideSortOrder)
}
val sortBtn = when {

View File

@ -63,9 +63,12 @@
</RadioGroup>
<include
android:id="@+id/sorting_dialog_order_divider"
layout="@layout/divider" />
<ImageView
android:id="@+id/sorting_dialog_sorting_divider"
android:layout_width="match_parent"
android:layout_height="@dimen/divider_height"
android:background="@color/divider_grey"
android:importantForAccessibility="no" />
<RadioGroup
android:id="@+id/sorting_dialog_radio_order"
@ -87,9 +90,12 @@
android:text="@string/descending" />
</RadioGroup>
<include
android:id="@+id/use_for_this_folder_divider"
layout="@layout/divider" />
<ImageView
android:id="@+id/sorting_dialog_order_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
android:id="@+id/sorting_dialog_numeric_sorting"