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 2 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
5 changes: 5 additions & 0 deletions app/src/main/java/com/itsaky/androidide/preferences/editor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ private class TabSize(
tabSize = size
}

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

override fun getSelectedItem(): Int {
var current = tabSize / 2 - 1
if (current < 0 || current >= choices.size) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package com.itsaky.androidide.preferences
import android.content.Context
import androidx.appcompat.app.AppCompatDelegate
import androidx.preference.Preference
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.itsaky.androidide.R
import com.itsaky.androidide.preferences.internal.CONFIRM_PROJECT_OPEN
import com.itsaky.androidide.preferences.internal.ENABLE_MATERIAL_YOU
Expand Down Expand Up @@ -118,6 +119,11 @@ class UiMode(
uiMode = mode
}
}

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 @@ -18,6 +18,8 @@
package com.itsaky.androidide.preferences

import android.content.Context
import androidx.preference.Preference
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.itsaky.androidide.resources.R.string
import com.itsaky.androidide.preferences.internal.CLOSING_BRACKET_NEW_LINE
import com.itsaky.androidide.preferences.internal.EMPTY_ELEMENTS_BEHAVIOR
Expand Down Expand Up @@ -237,4 +239,10 @@ private class EmptyElementsBehavior(
override fun onItemSelected(position: Int, isSelected: Boolean) {
emptyElementsBehavior = EmptyElements.values()[position].toString()
}

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

}