Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

fix(settings): single choice prefs not being dismissed when clicking … #1311

Merged
merged 3 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions app/src/main/java/com/itsaky/androidide/preferences/editor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ private class TabSize(
override val summary: Int? = string.msg_tab_size,
override val icon: Int? = drawable.ic_font_ligatures,
) : SingleChoicePreference() {
override val dialogCancellable = true

@IgnoredOnParcel private val choices = arrayOf("2", "4", "6", "8")

Expand Down Expand Up @@ -196,6 +197,7 @@ private class ColorSchemePreference(
override val summary: Int? = R.string.idepref_editor_colorScheme_summary,
override val icon: Int? = R.drawable.ic_color_scheme
) : SingleChoicePreference() {
override val dialogCancellable = true

@IgnoredOnParcel private val schemes = IDEColorSchemeProvider.list()

Expand All @@ -212,11 +214,6 @@ private class ColorSchemePreference(
colorScheme = schemes[position].key
}
}

override fun onConfigureDialog(preference: Preference, dialog: MaterialAlertDialogBuilder) {
super.onConfigureDialog(preference, dialog)
dialog.setCancelable(true)
}
}

@Parcelize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class UiMode(
override val summary: Int? = R.string.idepref_general_uiMode_summary,
override val icon: Int? = R.drawable.ic_ui_mode
) : SingleChoicePreference() {
override val dialogCancellable = true

override fun getChoices(context: Context): Array<String> {
return arrayOf(
context.getString(R.string.uiMode_light),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ private class EmptyElementsBehavior(
override val title: Int = string.idepref_emptyElements_title,
override val summary: Int? = string.idepref_emptyElements_summary
) : SingleChoicePreference() {
override val dialogCancellable = true

override fun getSelectedItem(): Int {
return EmptyElements.valueOf(emptyElementsBehavior).ordinal
Expand Down