simplifying a check in the sorting dialog

This commit is contained in:
tibbi 2021-10-12 23:18:26 +02:00
parent a87d3281dc
commit e69fed1981

View file

@ -4,6 +4,7 @@ import android.content.DialogInterface
import android.view.View import android.view.View
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.beGoneIf
import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.isVisible import com.simplemobiletools.commons.extensions.isVisible
import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.setupDialogStuff
@ -13,8 +14,10 @@ import com.simplemobiletools.gallery.pro.extensions.config
import com.simplemobiletools.gallery.pro.helpers.SHOW_ALL import com.simplemobiletools.gallery.pro.helpers.SHOW_ALL
import kotlinx.android.synthetic.main.dialog_change_sorting.view.* import kotlinx.android.synthetic.main.dialog_change_sorting.view.*
class ChangeSortingDialog(val activity: BaseSimpleActivity, val isDirectorySorting: Boolean, val showFolderCheckbox: Boolean, class ChangeSortingDialog(
val path: String = "", val callback: () -> Unit) : val activity: BaseSimpleActivity, val isDirectorySorting: Boolean, val showFolderCheckbox: Boolean,
val path: String = "", val callback: () -> Unit
) :
DialogInterface.OnClickListener { DialogInterface.OnClickListener {
private var currSorting = 0 private var currSorting = 0
private var config = activity.config private var config = activity.config
@ -54,8 +57,8 @@ class ChangeSortingDialog(val activity: BaseSimpleActivity, val isDirectorySorti
view.use_for_this_folder_divider.beVisibleIf(view.sorting_dialog_numeric_sorting.isVisible() || view.sorting_dialog_use_for_this_folder.isVisible()) view.use_for_this_folder_divider.beVisibleIf(view.sorting_dialog_numeric_sorting.isVisible() || view.sorting_dialog_use_for_this_folder.isVisible())
val isCustomSorting = checkedId == sortingRadio.sorting_dialog_radio_custom.id val isCustomSorting = checkedId == sortingRadio.sorting_dialog_radio_custom.id
view.sorting_dialog_radio_order.beVisibleIf(!isCustomSorting) view.sorting_dialog_radio_order.beGoneIf(isCustomSorting)
view.sorting_dialog_order_divider.beVisibleIf(!isCustomSorting) view.sorting_dialog_order_divider.beGoneIf(isCustomSorting)
} }
val sortBtn = when { val sortBtn = when {