mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-27 04:07:10 +00:00
migrate preferences to androidx (bad state... wip)
This commit is contained in:
parent
70a86d9326
commit
71187f4b32
26 changed files with 263 additions and 288 deletions
|
@ -47,7 +47,6 @@ public class Colors {
|
|||
private ColorStateList adjustedBackgroundStateList;
|
||||
|
||||
public static Colors newColors(String themeStyle, int accent, int background, int keyBackground, int functionalKey, int spaceBar, int keyText, int keyHintText) {
|
||||
Log.i("test1", "colors with style "+themeStyle);
|
||||
if (themeStyle.equals(KeyboardTheme.THEME_STYLE_HOLO))
|
||||
return new HoloColors(accent, background, keyBackground, functionalKey, spaceBar, keyText, keyHintText);
|
||||
return new Colors(accent, background, keyBackground, functionalKey, spaceBar, keyText, keyHintText);
|
||||
|
|
|
@ -14,18 +14,19 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dslul.openboard.inputmethod.latin.settings;
|
||||
package org.dslul.openboard.inputmethod.latin.settings;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.dslul.openboard.inputmethod.latin.BuildConfig;
|
||||
import org.dslul.openboard.inputmethod.latin.R;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
/**
|
||||
import org.dslul.openboard.inputmethod.latin.BuildConfig;
|
||||
import org.dslul.openboard.inputmethod.latin.R;
|
||||
|
||||
/**
|
||||
* "About" sub screen.
|
||||
*/
|
||||
public final class AboutFragment extends SubScreenFragment {
|
||||
public final class AboutFragment extends SubScreenFragment {
|
||||
@Override
|
||||
public void onCreate(final Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
@ -33,4 +34,4 @@
|
|||
Preference versionPreference = findPreference("pref_key_version");
|
||||
versionPreference.setSummary(BuildConfig.VERSION_NAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@ import android.content.SharedPreferences;
|
|||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import org.dslul.openboard.inputmethod.latin.AudioAndHapticFeedbackManager;
|
||||
import org.dslul.openboard.inputmethod.latin.R;
|
||||
|
|
|
@ -21,12 +21,11 @@ import android.content.res.Configuration
|
|||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.preference.ListPreference
|
||||
import android.preference.Preference
|
||||
import android.preference.TwoStatePreference
|
||||
import android.util.Log
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.content.edit
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.TwoStatePreference
|
||||
import org.dslul.openboard.inputmethod.keyboard.KeyboardSwitcher
|
||||
import org.dslul.openboard.inputmethod.keyboard.KeyboardTheme
|
||||
import org.dslul.openboard.inputmethod.latin.R
|
||||
|
@ -91,8 +90,9 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
|||
setupTheme()
|
||||
|
||||
|
||||
val widthDp = activity.resources.displayMetrics.widthPixels / activity.resources.displayMetrics.density
|
||||
val heightDp = activity.resources.displayMetrics.heightPixels / activity.resources.displayMetrics.density
|
||||
val metrics = requireContext().resources.displayMetrics
|
||||
val widthDp = metrics.widthPixels / metrics.density
|
||||
val heightDp = metrics.heightPixels / metrics.density
|
||||
if (!ProductionFlags.IS_SPLIT_KEYBOARD_SUPPORTED || (min(widthDp, heightDp) < 600 && max(widthDp, heightDp) < 720)) {
|
||||
removePreference(Settings.PREF_ENABLE_SPLIT_KEYBOARD)
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
|||
override fun onPause() {
|
||||
super.onPause()
|
||||
// if (needsReload) // todo: until re-working settings, just always reload
|
||||
KeyboardSwitcher.getInstance().forceUpdateKeyboardTheme(activity)
|
||||
KeyboardSwitcher.getInstance().forceUpdateKeyboardTheme(requireContext())
|
||||
needsReload = false
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,6 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
|||
|
||||
override fun onSharedPreferenceChanged(prefs: SharedPreferences, key: String) {
|
||||
super.onSharedPreferenceChanged(prefs, key)
|
||||
Log.i("test1", "changed pref $key to ${prefs.all.filter { it.key == key }}")
|
||||
updateAfterPreferenceChanged()
|
||||
}
|
||||
|
||||
|
@ -135,29 +134,29 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
|||
// show preference to allow choosing a night theme
|
||||
// can't hide a preference, at least not without category or maybe some androidx things
|
||||
// -> just disable it instead (for now...)
|
||||
isEnabled = sharedPreferences.getBoolean(Settings.PREF_THEME_DAY_NIGHT, false)
|
||||
isEnabled = sharedPreferences!!.getBoolean(Settings.PREF_THEME_DAY_NIGHT, false)
|
||||
} else
|
||||
isEnabled = false
|
||||
|
||||
val variant = sharedPreferences.getString(Settings.PREF_THEME_VARIANT_NIGHT, KeyboardTheme.THEME_DARKER)
|
||||
val variant = sharedPreferences!!.getString(Settings.PREF_THEME_VARIANT_NIGHT, KeyboardTheme.THEME_DARKER)
|
||||
val variants = KeyboardTheme.THEME_VARIANTS_DARK
|
||||
entries = variants.map {
|
||||
// todo: this workaround get the same string as for "user" theme, maybe clarify that it's a separate theme
|
||||
val name = if (it == "user_dark") "theme_name_user" else "theme_name_$it"
|
||||
val resId = resources.getIdentifier(name, "string", activity.packageName)
|
||||
val resId = resources.getIdentifier(name, "string", requireContext().packageName)
|
||||
if (resId == 0) it else getString(resId)
|
||||
}.toTypedArray()
|
||||
entryValues = variants
|
||||
value = variant
|
||||
val name = if (variant == "user_dark") "theme_name_user" else "theme_name_$variant"
|
||||
val resId = resources.getIdentifier(name, "string", activity.packageName)
|
||||
val resId = resources.getIdentifier(name, "string", requireContext().packageName)
|
||||
summary = if (resId == 0) variant else getString(resId)
|
||||
}
|
||||
userColorsPref.apply {
|
||||
isEnabled = KeyboardTheme.getIsCustom(selectedThemeId)
|
||||
&& (sharedPreferences.getString(Settings.PREF_THEME_VARIANT, KeyboardTheme.THEME_LIGHT) == KeyboardTheme.THEME_USER
|
||||
|| (sharedPreferences.getString(Settings.PREF_THEME_VARIANT_NIGHT, KeyboardTheme.THEME_DARKER) == KeyboardTheme.THEME_USER_DARK
|
||||
&& sharedPreferences.getBoolean(Settings.PREF_THEME_DAY_NIGHT, false)
|
||||
&& (sharedPreferences!!.getString(Settings.PREF_THEME_VARIANT, KeyboardTheme.THEME_LIGHT) == KeyboardTheme.THEME_USER
|
||||
|| (sharedPreferences!!.getString(Settings.PREF_THEME_VARIANT_NIGHT, KeyboardTheme.THEME_DARKER) == KeyboardTheme.THEME_USER_DARK
|
||||
&& sharedPreferences!!.getBoolean(Settings.PREF_THEME_DAY_NIGHT, false)
|
||||
))
|
||||
isEnabled = true
|
||||
}
|
||||
|
@ -187,14 +186,14 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
|||
themeVariantPref.apply {
|
||||
entries = if (isLegacyFamily) variants // todo: translatable string for holo, not internal name
|
||||
else variants.map {
|
||||
val resId = resources.getIdentifier("theme_name_$it", "string", activity.packageName)
|
||||
val resId = resources.getIdentifier("theme_name_$it", "string", requireContext().packageName)
|
||||
if (resId == 0) it else getString(resId)
|
||||
}.toTypedArray()
|
||||
entryValues = variants
|
||||
value = variant ?: variants[0]
|
||||
summary = if (isLegacyFamily) variant
|
||||
else {
|
||||
val resId = resources.getIdentifier("theme_name_$variant", "string", activity.packageName)
|
||||
val resId = resources.getIdentifier("theme_name_$variant", "string", requireContext().packageName)
|
||||
if (resId == 0) variant else getString(resId)
|
||||
}
|
||||
}
|
||||
|
@ -205,12 +204,12 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
|||
}
|
||||
dayNightPref?.apply {
|
||||
isEnabled = !isLegacyFamily
|
||||
isChecked = !isLegacyFamily && KeyboardTheme.getIsCustom(selectedThemeId) && sharedPreferences.getBoolean(Settings.PREF_THEME_DAY_NIGHT, false)
|
||||
isChecked = !isLegacyFamily && KeyboardTheme.getIsCustom(selectedThemeId) && sharedPreferences!!.getBoolean(Settings.PREF_THEME_DAY_NIGHT, false)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupTheme() {
|
||||
themeFamilyPref = preferenceScreen.findPreference(Settings.PREF_THEME_STYLE) as ListPreference
|
||||
themeFamilyPref = preferenceScreen.findPreference(Settings.PREF_THEME_STYLE)!!
|
||||
themeFamilyPref.apply {
|
||||
entries = KeyboardTheme.THEME_STYLES
|
||||
entryValues = KeyboardTheme.THEME_STYLES
|
||||
|
@ -222,7 +221,7 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
|||
}
|
||||
}
|
||||
// todo: remove!
|
||||
themeVariantPref = preferenceScreen.findPreference(Settings.PREF_THEME_VARIANT) as ListPreference
|
||||
themeVariantPref = preferenceScreen.findPreference(Settings.PREF_THEME_VARIANT)!!
|
||||
themeVariantPref.apply {
|
||||
onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, value ->
|
||||
summary = entries[entryValues.indexOfFirst { it == value }]
|
||||
|
@ -230,9 +229,9 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
|||
if (themeFamilyPref.value == KeyboardTheme.THEME_STYLE_MATERIAL) {
|
||||
// not so nice workaround, could be removed in the necessary re-work: new value seems
|
||||
// to be stored only after this method call, but we update the summary and user-defined color enablement in here -> store it now
|
||||
if (value == sharedPreferences.getString(Settings.PREF_THEME_VARIANT, KeyboardTheme.THEME_LIGHT))
|
||||
if (value == sharedPreferences!!.getString(Settings.PREF_THEME_VARIANT, KeyboardTheme.THEME_LIGHT))
|
||||
return@OnPreferenceChangeListener true // avoid infinite loop
|
||||
sharedPreferences.edit { putString(Settings.PREF_THEME_VARIANT, value as String) }
|
||||
sharedPreferences!!.edit { putString(Settings.PREF_THEME_VARIANT, value as String) }
|
||||
|
||||
summary = entries[entryValues.indexOfFirst { it == value }]
|
||||
needsReload = true
|
||||
|
@ -242,13 +241,13 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
|||
true
|
||||
}
|
||||
}
|
||||
keyBordersPref = preferenceScreen.findPreference(Settings.PREF_THEME_KEY_BORDERS) as TwoStatePreference
|
||||
keyBordersPref = preferenceScreen.findPreference(Settings.PREF_THEME_KEY_BORDERS)!!
|
||||
keyBordersPref.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, value ->
|
||||
saveSelectedThemeId(keyBorders = value as Boolean)
|
||||
updateThemePreferencesState(skipThemeFamily = true)
|
||||
true
|
||||
}
|
||||
dayNightPref = preferenceScreen.findPreference(Settings.PREF_THEME_DAY_NIGHT) as? TwoStatePreference
|
||||
dayNightPref = preferenceScreen.findPreference(Settings.PREF_THEME_DAY_NIGHT)!!
|
||||
dayNightPref?.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, value ->
|
||||
updateThemePreferencesState(skipThemeFamily = true)
|
||||
true
|
||||
|
@ -258,9 +257,9 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
|||
onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, value ->
|
||||
// not so nice workaround, could be removed in the necessary re-work: new value seems
|
||||
// to be stored only after this method call, but we update the summary and user-defined color enablement in here -> store it now
|
||||
if (value == sharedPreferences.getString(Settings.PREF_THEME_VARIANT_NIGHT, KeyboardTheme.THEME_DARK))
|
||||
if (value == sharedPreferences!!.getString(Settings.PREF_THEME_VARIANT_NIGHT, KeyboardTheme.THEME_DARK))
|
||||
return@OnPreferenceChangeListener true // avoid infinite loop
|
||||
sharedPreferences.edit { putString(Settings.PREF_THEME_VARIANT_NIGHT, value as String) }
|
||||
sharedPreferences!!.edit { putString(Settings.PREF_THEME_VARIANT_NIGHT, value as String) }
|
||||
|
||||
summary = entries[entryValues.indexOfFirst { it == value }]
|
||||
needsReload = true
|
||||
|
@ -268,10 +267,10 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
|||
true
|
||||
}
|
||||
}
|
||||
userColorsPref = preferenceScreen.findPreference(Settings.PREF_THEME_USER)
|
||||
userColorsPref = preferenceScreen.findPreference(Settings.PREF_THEME_USER)!!
|
||||
userColorsPref.onPreferenceClickListener = Preference.OnPreferenceClickListener { _ ->
|
||||
if (sharedPreferences.getBoolean(Settings.PREF_THEME_DAY_NIGHT, false) && sharedPreferences.getString(Settings.PREF_THEME_VARIANT, KeyboardTheme.THEME_LIGHT) == KeyboardTheme.THEME_USER)
|
||||
AlertDialog.Builder(activity)
|
||||
AlertDialog.Builder(requireContext())
|
||||
.setMessage(R.string.day_or_night_colors)
|
||||
.setPositiveButton(R.string.day_or_night_night) { _, _ -> adjustColors(true)}
|
||||
.setNegativeButton(R.string.day_or_night_day) { _, _ -> adjustColors(false)}
|
||||
|
@ -282,7 +281,8 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
|||
adjustColors(false)
|
||||
true
|
||||
}
|
||||
preferenceScreen.findPreference(Settings.PREF_NARROW_KEY_GAPS)?.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, _ ->
|
||||
preferenceScreen.findPreference<Preference>(Settings.PREF_NARROW_KEY_GAPS)?.onPreferenceChangeListener =
|
||||
Preference.OnPreferenceChangeListener { _, _ ->
|
||||
needsReload = true
|
||||
true
|
||||
}
|
||||
|
@ -290,10 +290,10 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
|||
|
||||
private fun adjustColors(dark: Boolean) {
|
||||
val items = listOf(R.string.select_color_background, R.string.select_color_key, R.string.select_color_key_hint, R.string.select_color_accent, R.string.select_color_key_background)
|
||||
.map { activity.getString(it) }
|
||||
.map { requireContext().getString(it) }
|
||||
val itemsArray = if (keyBordersPref.isChecked) items.toTypedArray()
|
||||
else items.subList(0, 4).toTypedArray()
|
||||
AlertDialog.Builder(activity)
|
||||
AlertDialog.Builder(requireContext())
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.setTitle(R.string.select_color_to_adjust)
|
||||
.setItems(itemsArray) { _, i ->
|
||||
|
@ -314,7 +314,7 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
|||
3 -> Settings.PREF_THEME_USER_COLOR_ACCENT to Color.BLUE
|
||||
else -> Settings.PREF_THEME_USER_COLOR_KEYS to Color.LTGRAY
|
||||
}
|
||||
val d = ColorPickerDialog(activity, items[i], sharedPreferences, pref, default) { needsReload = true}
|
||||
val d = ColorPickerDialog(requireContext(), items[i], sharedPreferences, pref, default) { needsReload = true}
|
||||
d.show()
|
||||
}
|
||||
.show()
|
||||
|
@ -345,6 +345,10 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
|||
})
|
||||
}
|
||||
|
||||
override fun onDisplayPreferenceDialog(preference: Preference) {
|
||||
super.onDisplayPreferenceDialog(preference)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val PERCENTAGE_FLOAT = 100.0f
|
||||
}
|
||||
|
|
|
@ -26,10 +26,11 @@ import android.content.SharedPreferences;
|
|||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.SwitchPreference;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreferenceCompat;
|
||||
|
||||
import org.dslul.openboard.inputmethod.latin.R;
|
||||
import org.dslul.openboard.inputmethod.latin.permissions.PermissionsManager;
|
||||
import org.dslul.openboard.inputmethod.latin.permissions.PermissionsUtil;
|
||||
|
@ -60,7 +61,7 @@ public final class CorrectionSettingsFragment extends SubScreenFragment
|
|||
private static final boolean DBG_USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS = false;
|
||||
private static final boolean USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS =
|
||||
DBG_USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS;
|
||||
private SwitchPreference mLookupContactsPreference;
|
||||
private SwitchPreferenceCompat mLookupContactsPreference;
|
||||
|
||||
@Override
|
||||
public void onCreate(final Bundle icicle) {
|
||||
|
@ -74,13 +75,11 @@ public final class CorrectionSettingsFragment extends SubScreenFragment
|
|||
findPreference(Settings.PREF_EDIT_PERSONAL_DICTIONARY);
|
||||
final Intent editPersonalDictionaryIntent = editPersonalDictionary.getIntent();
|
||||
final ResolveInfo ri = USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS ? null
|
||||
: pm.resolveActivity(
|
||||
editPersonalDictionaryIntent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||
: pm.resolveActivity(editPersonalDictionaryIntent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||
if (ri == null) {
|
||||
overwriteUserDictionaryPreference(editPersonalDictionary);
|
||||
}
|
||||
mLookupContactsPreference = (SwitchPreference) findPreference(
|
||||
AndroidSpellCheckerService.PREF_USE_CONTACTS_KEY);
|
||||
mLookupContactsPreference = (SwitchPreferenceCompat) findPreference(AndroidSpellCheckerService.PREF_USE_CONTACTS_KEY);
|
||||
|
||||
refreshEnabledSettings();
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@ import android.content.SharedPreferences;
|
|||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.os.Process;
|
||||
import android.preference.Preference;
|
||||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.preference.PreferenceGroup;
|
||||
import android.preference.TwoStatePreference;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceGroup;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import org.dslul.openboard.inputmethod.latin.DictionaryDumpBroadcastReceiver;
|
||||
import org.dslul.openboard.inputmethod.latin.DictionaryFacilitatorImpl;
|
||||
|
@ -41,7 +41,7 @@ import java.util.Locale;
|
|||
* This settings sub screen handles a several preference options for debugging.
|
||||
*/
|
||||
public final class DebugSettingsFragment extends SubScreenFragment
|
||||
implements OnPreferenceClickListener {
|
||||
implements Preference.OnPreferenceClickListener {
|
||||
private static final String PREF_KEY_DUMP_DICTS = "pref_key_dump_dictionaries";
|
||||
private static final String PREF_KEY_DUMP_DICT_PREFIX = "pref_key_dump_dictionaries";
|
||||
|
||||
|
|
|
@ -3,12 +3,13 @@ package org.dslul.openboard.inputmethod.latin.settings
|
|||
import android.content.Context
|
||||
import android.graphics.Rect
|
||||
import android.graphics.Typeface
|
||||
import android.preference.Preference
|
||||
import android.os.Build
|
||||
import android.text.Spannable
|
||||
import android.text.SpannableString
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.style.StyleSpan
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -17,6 +18,9 @@ import androidx.core.view.doOnLayout
|
|||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.widget.doAfterTextChanged
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceGroupAdapter
|
||||
import androidx.preference.PreferenceViewHolder
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.dslul.openboard.inputmethod.latin.R
|
||||
import org.dslul.openboard.inputmethod.latin.common.LocaleUtils
|
||||
|
@ -24,7 +28,7 @@ import org.dslul.openboard.inputmethod.latin.utils.*
|
|||
|
||||
class LanguageFilterListPreference(context: Context, attrs: AttributeSet) : Preference(context, attrs) {
|
||||
|
||||
private var preferenceView: View? = null
|
||||
private lateinit var preferenceView: View
|
||||
private val adapter = LanguageAdapter(emptyList(), context)
|
||||
private val sortedSubtypes = mutableListOf<MutableList<SubtypeInfo>>()
|
||||
|
||||
|
@ -32,15 +36,33 @@ class LanguageFilterListPreference(context: Context, attrs: AttributeSet) : Pref
|
|||
adapter.fragment = newFragment
|
||||
}
|
||||
|
||||
override fun onBindView(view: View?) {
|
||||
super.onBindView(view)
|
||||
preferenceView = view
|
||||
preferenceView?.findViewById<RecyclerView>(R.id.language_list)?.adapter = adapter
|
||||
val searchField = preferenceView?.findViewById<EditText>(R.id.search_field)!!
|
||||
override fun onBindViewHolder(holder: PreferenceViewHolder) {
|
||||
super.onBindViewHolder(holder)
|
||||
preferenceView = holder.itemView
|
||||
/* val a = holder.bindingAdapter as PreferenceGroupAdapter
|
||||
preferenceManager.preferenceScreen
|
||||
*/
|
||||
preferenceView.findViewById<RecyclerView>(R.id.language_list)?.adapter = adapter
|
||||
val searchField = preferenceView.findViewById<EditText>(R.id.search_field)!!
|
||||
searchField.doAfterTextChanged { text ->
|
||||
adapter.list = sortedSubtypes.filter { it.first().displayName.startsWith(text.toString(), ignoreCase = true) }
|
||||
}
|
||||
view?.doOnLayout {
|
||||
// todo: why the fuck isn't the recyclerview scrolling after switching to androidx?
|
||||
// looks like nothing can scroll inside!
|
||||
// maybe just make it a list and add a note to the changelog with request for help
|
||||
// first play around with weirdly nested (Nested)ScrollViews and layouts
|
||||
|
||||
val recycler = preferenceView.findViewById<RecyclerView>(R.id.language_list)
|
||||
// recycler.isScrollContainer = true
|
||||
// recycler.isNestedScrollingEnabled = true
|
||||
// preferenceView.isScrollContainer = true
|
||||
/* val windowFrame = Rect()
|
||||
preferenceView.getWindowVisibleDisplayFrame(windowFrame) // rect the app has, we want the bottom (above screen bottom/navbar/keyboard)
|
||||
val globalRect = Rect()
|
||||
preferenceView.getGlobalVisibleRect(globalRect) // rect the view takes, we want the top (below the system language preference)
|
||||
val newHeight = windowFrame.bottom - globalRect.top - preferenceView.findViewById<View>(R.id.search_container).height
|
||||
preferenceView.layoutParams = preferenceView.layoutParams.apply { height = newHeight -250 }*/
|
||||
/* preferenceView.doOnLayout {
|
||||
// set correct height for recycler view, so there is no scrolling of the outside view happening
|
||||
// not sure how, but probably this can also be achieved in xml...
|
||||
val windowFrame = Rect()
|
||||
|
@ -52,7 +74,7 @@ class LanguageFilterListPreference(context: Context, attrs: AttributeSet) : Pref
|
|||
val newHeight = windowFrame.bottom - globalRect.top - it.findViewById<View>(R.id.search_container).height
|
||||
if (newHeight != recycler.layoutParams.height)
|
||||
recycler.layoutParams = recycler.layoutParams.apply { height = newHeight }
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
fun setLanguages(list: Collection<MutableList<SubtypeInfo>>, onlySystemLocales: Boolean) {
|
||||
|
@ -64,7 +86,6 @@ class LanguageFilterListPreference(context: Context, attrs: AttributeSet) : Pref
|
|||
|
||||
}
|
||||
|
||||
@Suppress("Deprecation")
|
||||
class LanguageAdapter(list: List<MutableList<SubtypeInfo>> = listOf(), context: Context) :
|
||||
RecyclerView.Adapter<LanguageAdapter.ViewHolder>() {
|
||||
var onlySystemLocales = false
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.dslul.openboard.inputmethod.latin.utils.*
|
|||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
@Suppress("deprecation")
|
||||
class LanguageSettingsDialog(
|
||||
context: Context,
|
||||
private val infos: MutableList<SubtypeInfo>,
|
||||
|
|
|
@ -6,8 +6,8 @@ import android.content.Intent
|
|||
import android.content.SharedPreferences
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.preference.TwoStatePreference
|
||||
import android.view.inputmethod.InputMethodSubtype
|
||||
import androidx.preference.SwitchPreferenceCompat
|
||||
import org.dslul.openboard.inputmethod.latin.R
|
||||
import org.dslul.openboard.inputmethod.latin.common.LocaleUtils
|
||||
import org.dslul.openboard.inputmethod.latin.utils.DictionaryInfoUtils
|
||||
|
@ -15,20 +15,18 @@ import org.dslul.openboard.inputmethod.latin.utils.SubtypeLocaleUtils
|
|||
import org.dslul.openboard.inputmethod.latin.utils.getDictionaryLocales
|
||||
import java.util.Locale
|
||||
|
||||
|
||||
@Suppress("Deprecation") // yes everything here is deprecated, but only work on this if really necessary
|
||||
class LanguageSettingsFragment : SubScreenFragment() {
|
||||
|
||||
private val sortedSubtypes = LinkedHashMap<String, MutableList<SubtypeInfo>>()
|
||||
private val enabledSubtypes = mutableListOf<InputMethodSubtype>()
|
||||
private val systemLocales = mutableListOf<Locale>()
|
||||
private val languageFilterListPreference by lazy { findPreference("pref_language_filter") as LanguageFilterListPreference }
|
||||
private val dictionaryLocales by lazy { getDictionaryLocales(activity).mapTo(HashSet()) { it.languageConsideringZZ() } }
|
||||
private val languageFilterListPreference by lazy { findPreference<LanguageFilterListPreference>("pref_language_filter")!! }
|
||||
private val dictionaryLocales by lazy { getDictionaryLocales(requireContext()).mapTo(HashSet()) { it.languageConsideringZZ() } }
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
addPreferencesFromResource(R.xml.prefs_screen_languages);
|
||||
SubtypeLocaleUtils.init(activity)
|
||||
addPreferencesFromResource(R.xml.prefs_screen_languages)
|
||||
SubtypeLocaleUtils.init(requireContext())
|
||||
|
||||
enabledSubtypes.addAll(getEnabledSubtypes(sharedPreferences))
|
||||
systemLocales.addAll(getSystemLocales())
|
||||
|
@ -52,7 +50,7 @@ class LanguageSettingsFragment : SubScreenFragment() {
|
|||
}
|
||||
|
||||
private fun loadSubtypes() {
|
||||
val systemOnly = (findPreference(Settings.PREF_USE_SYSTEM_LOCALES) as TwoStatePreference).isChecked
|
||||
val systemOnly = findPreference<SwitchPreferenceCompat>(Settings.PREF_USE_SYSTEM_LOCALES)!!.isChecked
|
||||
sortedSubtypes.clear()
|
||||
// list of all subtypes, any subtype added to sortedSubtypes will be removed to avoid duplicates
|
||||
val allSubtypes = getAllAvailableSubtypes().toMutableList()
|
||||
|
@ -115,7 +113,7 @@ class LanguageSettingsFragment : SubScreenFragment() {
|
|||
}
|
||||
|
||||
// add subtypes that have a dictionary
|
||||
val localesWithDictionary = DictionaryInfoUtils.getCachedDirectoryList(activity)?.mapNotNull { dir ->
|
||||
val localesWithDictionary = DictionaryInfoUtils.getCachedDirectoryList(requireContext())?.mapNotNull { dir ->
|
||||
if (!dir.isDirectory)
|
||||
return@mapNotNull null
|
||||
if (dir.list()?.any { it.endsWith(USER_DICTIONARY_SUFFIX) } == true)
|
||||
|
@ -139,7 +137,7 @@ class LanguageSettingsFragment : SubScreenFragment() {
|
|||
}
|
||||
|
||||
private fun InputMethodSubtype.toSubtypeInfo(locale: Locale, isEnabled: Boolean = false) =
|
||||
toSubtypeInfo(locale, activity, isEnabled, dictionaryLocales.contains(locale.languageConsideringZZ()))
|
||||
toSubtypeInfo(locale, requireContext(), isEnabled, dictionaryLocales.contains(locale.languageConsideringZZ()))
|
||||
|
||||
private fun List<SubtypeInfo>.addToSortedSubtypes() {
|
||||
forEach {
|
||||
|
|
|
@ -21,7 +21,8 @@ import android.content.SharedPreferences;
|
|||
import android.content.res.Resources;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import org.dslul.openboard.inputmethod.latin.AudioAndHapticFeedbackManager;
|
||||
import org.dslul.openboard.inputmethod.latin.R;
|
||||
|
|
|
@ -17,11 +17,14 @@
|
|||
package org.dslul.openboard.inputmethod.latin.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.preference.Preference;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.RadioButton;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
import org.dslul.openboard.inputmethod.latin.R;
|
||||
|
||||
/**
|
||||
|
@ -72,8 +75,9 @@ public class RadioButtonPreference extends Preference {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onBindView(final View view) {
|
||||
super.onBindView(view);
|
||||
public void onBindViewHolder(@NonNull final PreferenceViewHolder holder) {
|
||||
super.onBindViewHolder(holder);
|
||||
final View view = holder.itemView;
|
||||
mRadioButton = view.findViewById(R.id.radio_button);
|
||||
mRadioButton.setChecked(mIsSelected);
|
||||
mRadioButton.setOnClickListener(mClickListener);
|
||||
|
|
|
@ -16,20 +16,22 @@
|
|||
|
||||
package org.dslul.openboard.inputmethod.latin.settings;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.TypedArray;
|
||||
import android.preference.DialogPreference;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import org.dslul.openboard.inputmethod.latin.R;
|
||||
|
||||
public final class SeekBarDialogPreference extends DialogPreference
|
||||
implements SeekBar.OnSeekBarChangeListener {
|
||||
public final class SeekBarDialogPreference extends Preference
|
||||
implements SeekBar.OnSeekBarChangeListener, DialogInterface.OnClickListener {
|
||||
public interface ValueProxy {
|
||||
int readValue(final String key);
|
||||
int readDefaultValue(final String key);
|
||||
|
@ -56,7 +58,6 @@ public final class SeekBarDialogPreference extends DialogPreference
|
|||
mMinValue = a.getInt(R.styleable.SeekBarDialogPreference_minValue, 0);
|
||||
mStepValue = a.getInt(R.styleable.SeekBarDialogPreference_stepValue, 0);
|
||||
a.recycle();
|
||||
setDialogLayoutResource(R.layout.seek_bar_dialog);
|
||||
}
|
||||
|
||||
public void setInterface(final ValueProxy proxy) {
|
||||
|
@ -65,16 +66,6 @@ public final class SeekBarDialogPreference extends DialogPreference
|
|||
setSummary(mValueProxy.getValueText(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View onCreateDialogView() {
|
||||
final View view = super.onCreateDialogView();
|
||||
mSeekBar = view.findViewById(R.id.seek_bar_dialog_bar);
|
||||
mSeekBar.setMax(mMaxValue - mMinValue);
|
||||
mSeekBar.setOnSeekBarChangeListener(this);
|
||||
mValueView = view.findViewById(R.id.seek_bar_dialog_value);
|
||||
return view;
|
||||
}
|
||||
|
||||
private int getProgressFromValue(final int value) {
|
||||
return value - mMinValue;
|
||||
}
|
||||
|
@ -95,23 +86,32 @@ public final class SeekBarDialogPreference extends DialogPreference
|
|||
return clipValue(getValueFromProgress(progress));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBindDialogView(final View view) {
|
||||
private void onCreateDialogView(final View view) {
|
||||
mSeekBar = view.findViewById(R.id.seek_bar_dialog_bar);
|
||||
mSeekBar.setMax(mMaxValue - mMinValue);
|
||||
mSeekBar.setOnSeekBarChangeListener(this);
|
||||
mValueView = view.findViewById(R.id.seek_bar_dialog_value);
|
||||
final int value = mValueProxy.readValue(getKey());
|
||||
mValueView.setText(mValueProxy.getValueText(value));
|
||||
mSeekBar.setProgress(getProgressFromValue(clipValue(value)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPrepareDialogBuilder(final AlertDialog.Builder builder) {
|
||||
builder.setPositiveButton(android.R.string.ok, this)
|
||||
public void onClick() {
|
||||
final View view = LayoutInflater.from(getContext()).inflate(R.layout.seek_bar_dialog, null);
|
||||
final AlertDialog dialog = new AlertDialog.Builder(getContext())
|
||||
.setTitle(getTitle())
|
||||
.setView(view)
|
||||
.setPositiveButton(android.R.string.ok, this)
|
||||
.setNegativeButton(android.R.string.cancel, this)
|
||||
.setNeutralButton(R.string.button_default, this);
|
||||
.setNeutralButton(R.string.button_default, this)
|
||||
.create();
|
||||
dialog.setOnShowListener((d) -> onCreateDialogView(view));
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(final DialogInterface dialog, final int which) {
|
||||
super.onClick(dialog, which);
|
||||
final String key = getKey();
|
||||
if (which == DialogInterface.BUTTON_NEUTRAL) {
|
||||
final int value = mValueProxy.readDefaultValue(key);
|
||||
|
|
|
@ -16,18 +16,20 @@
|
|||
|
||||
package org.dslul.openboard.inputmethod.latin.settings;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import static android.preference.PreferenceActivity.EXTRA_NO_HEADERS;
|
||||
import static android.preference.PreferenceActivity.EXTRA_SHOW_FRAGMENT;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
|
||||
import org.dslul.openboard.inputmethod.latin.permissions.PermissionsManager;
|
||||
import org.dslul.openboard.inputmethod.latin.utils.FragmentUtils;
|
||||
import org.dslul.openboard.inputmethod.latin.utils.NewDictionaryAdder;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
|
||||
public final class SettingsActivity extends PreferenceActivity
|
||||
public final class SettingsActivity extends AppCompatActivity
|
||||
implements ActivityCompat.OnRequestPermissionsResultCallback {
|
||||
private static final String DEFAULT_FRAGMENT = SettingsFragment.class.getName();
|
||||
|
||||
|
@ -42,7 +44,7 @@ public final class SettingsActivity extends PreferenceActivity
|
|||
@Override
|
||||
protected void onCreate(final Bundle savedState) {
|
||||
super.onCreate(savedState);
|
||||
final ActionBar actionBar = getActionBar();
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setHomeButtonEnabled(true);
|
||||
|
@ -51,6 +53,9 @@ public final class SettingsActivity extends PreferenceActivity
|
|||
if (Intent.ACTION_VIEW.equals(i.getAction()) && i.getData() != null) {
|
||||
new NewDictionaryAdder(this, null).addDictionary(i.getData(), null);
|
||||
}
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(android.R.id.content, new SettingsFragment())
|
||||
.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,13 +69,9 @@ public final class SettingsActivity extends PreferenceActivity
|
|||
return intent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidFragment(final String fragmentName) {
|
||||
return FragmentUtils.isValidFragment(fragmentName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
PermissionsManager.get(this).onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,22 +16,24 @@
|
|||
|
||||
package org.dslul.openboard.inputmethod.latin.settings;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.provider.Settings.Secure;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.inputmethod.InputMethodSubtype;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import org.dslul.openboard.inputmethod.latin.BuildConfig;
|
||||
import org.dslul.openboard.inputmethod.latin.R;
|
||||
|
@ -51,7 +53,7 @@ import java.util.ArrayList;
|
|||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
public final class SettingsFragment extends PreferenceFragment {
|
||||
public final class SettingsFragment extends PreferenceFragmentCompat {
|
||||
// We don't care about menu grouping.
|
||||
private static final int NO_MENU_GROUP = Menu.NONE;
|
||||
// The first menu item id and order.
|
||||
|
@ -66,10 +68,13 @@ public final class SettingsFragment extends PreferenceFragment {
|
|||
public void onCreate(final Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(@Nullable Bundle bundle, @Nullable String s) {
|
||||
addPreferencesFromResource(R.xml.prefs);
|
||||
final PreferenceScreen preferenceScreen = getPreferenceScreen();
|
||||
preferenceScreen.setTitle(
|
||||
ApplicationUtils.getActivityTitleResId(getActivity(), SettingsActivity.class));
|
||||
preferenceScreen.setTitle(ApplicationUtils.getActivityTitleResId(getActivity(), SettingsActivity.class));
|
||||
if (!JniUtils.sHaveGestureLib) {
|
||||
final Preference gesturePreference = findPreference(Settings.SCREEN_GESTURE);
|
||||
preferenceScreen.removePreference(gesturePreference);
|
||||
|
@ -79,11 +84,14 @@ public final class SettingsFragment extends PreferenceFragment {
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
final ActionBar actionBar = getActivity().getActionBar();
|
||||
final Activity activity = getActivity();
|
||||
if (activity instanceof AppCompatActivity) {
|
||||
final ActionBar actionBar = ((AppCompatActivity) activity).getSupportActionBar();
|
||||
final CharSequence screenTitle = getPreferenceScreen().getTitle();
|
||||
if (actionBar != null && screenTitle != null) {
|
||||
actionBar.setTitle(screenTitle);
|
||||
}
|
||||
}
|
||||
|
||||
// todo: got a crash because it wasn't initialized...
|
||||
// but sometimes wrong languages are returned when not initializing on creation of LatinIME
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package org.dslul.openboard.inputmethod.latin.settings;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.app.backup.BackupManager;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
@ -24,18 +24,21 @@ import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
|||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceCategory;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
/**
|
||||
* A base abstract class for a {@link PreferenceFragment} that implements a nested
|
||||
* A base abstract class for a {@link PreferenceFragmentCompat} that implements a nested
|
||||
* {@link PreferenceScreen} of the main preference screen.
|
||||
*/
|
||||
public abstract class SubScreenFragment extends PreferenceFragment
|
||||
public abstract class SubScreenFragment extends PreferenceFragmentCompat
|
||||
implements OnSharedPreferenceChangeListener {
|
||||
private OnSharedPreferenceChangeListener mSharedPreferenceChangeListener;
|
||||
|
||||
|
@ -100,10 +103,9 @@ public abstract class SubScreenFragment extends PreferenceFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addPreferencesFromResource(final int preferencesResId) {
|
||||
super.addPreferencesFromResource(preferencesResId);
|
||||
TwoStatePreferenceHelper.replaceCheckBoxPreferencesBySwitchPreferences(
|
||||
getPreferenceScreen());
|
||||
public void onCreatePreferences(final Bundle savedInstanceState, final String s) {
|
||||
// this must be overridden, but is useless, because it's called during onCreate
|
||||
// so there is no possibility of calling setStorageDeviceProtected before this is called...
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,12 +137,15 @@ public abstract class SubScreenFragment extends PreferenceFragment
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
final ActionBar actionBar = getActivity().getActionBar();
|
||||
final Activity activity = getActivity();
|
||||
if (activity instanceof AppCompatActivity) {
|
||||
final ActionBar actionBar = ((AppCompatActivity) activity).getSupportActionBar();
|
||||
final CharSequence screenTitle = getPreferenceScreen().getTitle();
|
||||
if (actionBar != null && screenTitle != null) {
|
||||
actionBar.setTitle(screenTitle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
@ -153,4 +158,24 @@ public abstract class SubScreenFragment extends PreferenceFragment
|
|||
public void onSharedPreferenceChanged(final SharedPreferences prefs, final String key) {
|
||||
// This method may be overridden by an extended class.
|
||||
}
|
||||
|
||||
// for fixing the indent appearing with androidx preferences
|
||||
// we don't have icons in subscreens, so we don't want indent
|
||||
// should also be possible in xml, but didn't find a way to have it in a theme/style
|
||||
@Override
|
||||
public void setPreferenceScreen(PreferenceScreen preferenceScreen) {
|
||||
super.setPreferenceScreen(preferenceScreen);
|
||||
if (preferenceScreen == null) return;
|
||||
int count = preferenceScreen.getPreferenceCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
final Preference pref = preferenceScreen.getPreference(i);
|
||||
pref.setIconSpaceReserved(false);
|
||||
if (pref instanceof PreferenceCategory) {
|
||||
final int subPrefCount = ((PreferenceCategory) pref).getPreferenceCount();
|
||||
for (int j = 0; j < subPrefCount; j++) {
|
||||
((PreferenceCategory) pref).getPreference(j).setIconSpaceReserved(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dslul.openboard.inputmethod.latin.settings;
|
||||
|
||||
import android.os.Build;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceGroup;
|
||||
import android.preference.SwitchPreference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TwoStatePreferenceHelper {
|
||||
private static final String EMPTY_TEXT = "";
|
||||
|
||||
private TwoStatePreferenceHelper() {
|
||||
// This utility class is not publicly instantiable.
|
||||
}
|
||||
|
||||
public static void replaceCheckBoxPreferencesBySwitchPreferences(final PreferenceGroup group) {
|
||||
// The keyboard settings keeps using a CheckBoxPreference on KitKat or previous.
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
|
||||
return;
|
||||
}
|
||||
// The keyboard settings starts using a SwitchPreference without switch on/off text on
|
||||
// API versions newer than KitKat.
|
||||
replaceAllCheckBoxPreferencesBySwitchPreferences(group);
|
||||
}
|
||||
|
||||
private static void replaceAllCheckBoxPreferencesBySwitchPreferences(
|
||||
final PreferenceGroup group) {
|
||||
final ArrayList<Preference> preferences = new ArrayList<>();
|
||||
final int count = group.getPreferenceCount();
|
||||
for (int index = 0; index < count; index++) {
|
||||
preferences.add(group.getPreference(index));
|
||||
}
|
||||
group.removeAll();
|
||||
for (int index = 0; index < count; index++) {
|
||||
final Preference preference = preferences.get(index);
|
||||
if (preference instanceof CheckBoxPreference) {
|
||||
addSwitchPreferenceBasedOnCheckBoxPreference((CheckBoxPreference)preference, group);
|
||||
} else {
|
||||
group.addPreference(preference);
|
||||
if (preference instanceof PreferenceGroup) {
|
||||
replaceAllCheckBoxPreferencesBySwitchPreferences((PreferenceGroup)preference);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void addSwitchPreferenceBasedOnCheckBoxPreference(final CheckBoxPreference checkBox,
|
||||
final PreferenceGroup group) {
|
||||
final SwitchPreference switchPref = new SwitchPreference(checkBox.getContext());
|
||||
switchPref.setTitle(checkBox.getTitle());
|
||||
switchPref.setKey(checkBox.getKey());
|
||||
switchPref.setOrder(checkBox.getOrder());
|
||||
switchPref.setPersistent(checkBox.isPersistent());
|
||||
switchPref.setEnabled(checkBox.isEnabled());
|
||||
switchPref.setChecked(checkBox.isChecked());
|
||||
switchPref.setSummary(checkBox.getSummary());
|
||||
switchPref.setSummaryOn(checkBox.getSummaryOn());
|
||||
switchPref.setSummaryOff(checkBox.getSummaryOff());
|
||||
switchPref.setSwitchTextOn(EMPTY_TEXT);
|
||||
switchPref.setSwitchTextOff(EMPTY_TEXT);
|
||||
group.addPreference(switchPref);
|
||||
switchPref.setDependency(checkBox.getDependency());
|
||||
}
|
||||
}
|
|
@ -19,19 +19,19 @@ package org.dslul.openboard.inputmethod.latin.spellcheck;
|
|||
import android.Manifest;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.preference.SwitchPreference;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.dslul.openboard.inputmethod.latin.R;
|
||||
import org.dslul.openboard.inputmethod.latin.permissions.PermissionsManager;
|
||||
import org.dslul.openboard.inputmethod.latin.permissions.PermissionsUtil;
|
||||
import org.dslul.openboard.inputmethod.latin.settings.SubScreenFragment;
|
||||
import org.dslul.openboard.inputmethod.latin.settings.TwoStatePreferenceHelper;
|
||||
import org.dslul.openboard.inputmethod.latin.utils.ApplicationUtils;
|
||||
|
||||
import static org.dslul.openboard.inputmethod.latin.permissions.PermissionsManager.get;
|
||||
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreferenceCompat;
|
||||
|
||||
/**
|
||||
* Preference screen.
|
||||
*/
|
||||
|
@ -39,19 +39,16 @@ public final class SpellCheckerSettingsFragment extends SubScreenFragment
|
|||
implements SharedPreferences.OnSharedPreferenceChangeListener,
|
||||
PermissionsManager.PermissionsResultCallback {
|
||||
|
||||
private SwitchPreference mLookupContactsPreference;
|
||||
private SwitchPreferenceCompat mLookupContactsPreference;
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(final Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.spell_checker_settings);
|
||||
final PreferenceScreen preferenceScreen = getPreferenceScreen();
|
||||
preferenceScreen.setTitle(ApplicationUtils.getActivityTitleResId(
|
||||
getActivity(), SpellCheckerSettingsActivity.class));
|
||||
TwoStatePreferenceHelper.replaceCheckBoxPreferencesBySwitchPreferences(preferenceScreen);
|
||||
preferenceScreen.setTitle(ApplicationUtils.getActivityTitleResId(getActivity(), SpellCheckerSettingsActivity.class));
|
||||
|
||||
mLookupContactsPreference = (SwitchPreference) findPreference(
|
||||
AndroidSpellCheckerService.PREF_USE_CONTACTS_KEY);
|
||||
mLookupContactsPreference = (SwitchPreferenceCompat) findPreference(AndroidSpellCheckerService.PREF_USE_CONTACTS_KEY);
|
||||
turnOffLookupContactsIfNoPermission();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:id="@+id/search_container"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
android:title="@string/settings_screen_advanced"
|
||||
android:key="screen_advanced">
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_always_incognito_mode"
|
||||
android:title="@string/prefs_force_incognito_mode"
|
||||
android:summary="@string/prefs_force_incognito_mode_summary"
|
||||
|
@ -33,21 +33,21 @@
|
|||
latin:maxValue="@integer/config_max_longpress_timeout"
|
||||
latin:stepValue="@integer/config_longpress_timeout_step" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="prefs_long_press_keyboard_to_change_lang"
|
||||
android:title="@string/prefs_long_press_keyboard_to_change_lang"
|
||||
android:summary="@string/prefs_long_press_keyboard_to_change_lang_summary"
|
||||
android:persistent="true"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_enable_emoji_alt_physical_key"
|
||||
android:title="@string/prefs_enable_emoji_alt_physical_key"
|
||||
android:summary="@string/prefs_enable_emoji_alt_physical_key_summary"
|
||||
android:defaultValue="true"
|
||||
android:persistent="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_show_setup_wizard_icon"
|
||||
android:title="@string/show_setup_wizard_icon"
|
||||
android:summary="@string/show_setup_wizard_icon_summary"
|
||||
|
@ -64,19 +64,19 @@
|
|||
<PreferenceCategory
|
||||
android:title="@string/settings_category_experimental">
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_space_trackpad"
|
||||
android:title="@string/space_trackpad"
|
||||
android:summary="@string/space_trackpad_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_delete_swipe"
|
||||
android:title="@string/delete_swipe"
|
||||
android:summary="@string/delete_swipe_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_autospace_after_punctuation"
|
||||
android:title="@string/autospace_after_punctuation"
|
||||
android:summary="@string/autospace_after_punctuation_summary"
|
||||
|
|
|
@ -32,11 +32,11 @@
|
|||
android:key="theme_variant"
|
||||
android:title="@string/theme_variant"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="theme_key_borders"
|
||||
android:title="@string/key_borders"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="theme_auto_day_night"
|
||||
android:title="@string/day_night_mode"
|
||||
android:summary="@string/day_night_mode_summary"/>
|
||||
|
@ -50,7 +50,7 @@
|
|||
android:title="@string/select_user_colors"
|
||||
android:summary="@string/select_user_colors_summary"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_navbar_color"
|
||||
android:title="@string/theme_navbar"/>
|
||||
|
||||
|
@ -59,19 +59,19 @@
|
|||
<PreferenceCategory
|
||||
android:title="@string/settings_category_miscellaneous">
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_split_keyboard"
|
||||
android:title="@string/enable_split_keyboard"
|
||||
android:persistent="true"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_resize_keyboard"
|
||||
android:title="@string/prefs_resize_keyboard"
|
||||
android:defaultValue="false"
|
||||
android:persistent="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_narrow_key_gaps"
|
||||
android:title="@string/prefs_narrow_key_gaps"
|
||||
android:defaultValue="true"
|
||||
|
|
|
@ -27,14 +27,14 @@
|
|||
<PreferenceCategory
|
||||
android:title="@string/settings_category_correction">
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_key_block_potentially_offensive"
|
||||
android:title="@string/prefs_block_potentially_offensive_title"
|
||||
android:summary="@string/prefs_block_potentially_offensive_summary"
|
||||
android:defaultValue="@bool/config_block_potentially_offensive"
|
||||
android:persistent="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_key_auto_correction"
|
||||
android:title="@string/auto_correction"
|
||||
android:summary="@string/auto_correction_summary"
|
||||
|
@ -49,14 +49,14 @@
|
|||
android:entryValues="@array/auto_correction_threshold_mode_indexes"
|
||||
android:defaultValue="@string/auto_correction_threshold_mode_index_modest" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="auto_cap"
|
||||
android:title="@string/auto_cap"
|
||||
android:summary="@string/auto_cap_summary"
|
||||
android:defaultValue="true"
|
||||
android:persistent="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_key_use_double_space_period"
|
||||
android:title="@string/use_double_space_period"
|
||||
android:summary="@string/use_double_space_period_summary"
|
||||
|
@ -68,35 +68,35 @@
|
|||
<PreferenceCategory
|
||||
android:title="@string/settings_category_suggestions">
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="show_suggestions"
|
||||
android:summary="@string/prefs_show_suggestions_summary"
|
||||
android:title="@string/prefs_show_suggestions"
|
||||
android:defaultValue="true"
|
||||
android:persistent="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_key_use_personalized_dicts"
|
||||
android:title="@string/use_personalized_dicts"
|
||||
android:summary="@string/use_personalized_dicts_summary"
|
||||
android:defaultValue="true"
|
||||
android:persistent="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="next_word_prediction"
|
||||
android:title="@string/bigram_prediction"
|
||||
android:summary="@string/bigram_prediction_summary"
|
||||
android:defaultValue="true"
|
||||
android:persistent="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_spellcheck_use_contacts"
|
||||
android:title="@string/use_contacts_dict"
|
||||
android:summary="@string/use_contacts_dict_summary"
|
||||
android:defaultValue="true"
|
||||
android:persistent="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_add_to_personal_dictionary"
|
||||
android:title="@string/add_to_personal_dictionary"
|
||||
android:summary="@string/add_to_personal_dictionary_summary"
|
||||
|
|
|
@ -20,28 +20,28 @@
|
|||
android:title="@string/prefs_debug_mode"
|
||||
android:key="english_ime_debug_settings"
|
||||
>
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="debug_mode"
|
||||
android:title="@string/prefs_debug_mode"
|
||||
android:defaultValue="false"
|
||||
android:persistent="true" />
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="force_non_distinct_multitouch"
|
||||
android:title="@string/prefs_force_non_distinct_multitouch"
|
||||
android:defaultValue="false"
|
||||
android:persistent="true" />
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_should_show_lxx_suggestion_ui"
|
||||
android:title="@string/prefs_should_show_lxx_suggestion_ui"
|
||||
android:defaultValue="true"
|
||||
android:persistent="true" />
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_sliding_key_input_preview"
|
||||
android:title="@string/sliding_key_input_preview"
|
||||
android:summary="@string/sliding_key_input_preview_summary"
|
||||
android:defaultValue="true"
|
||||
android:persistent="true" />
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_has_custom_key_preview_animation_params"
|
||||
android:title="@string/prefs_customize_key_preview_animation"
|
||||
android:defaultValue="false"
|
||||
|
@ -76,7 +76,7 @@
|
|||
android:key="pref_key_preview_dismiss_duration"
|
||||
android:title="@string/prefs_key_popup_dismiss_duration_settings"
|
||||
latin:maxValue="100" /> <!-- milliseconds -->
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_resize_keyboard"
|
||||
android:title="@string/prefs_resize_keyboard"
|
||||
android:defaultValue="false"
|
||||
|
@ -87,8 +87,8 @@
|
|||
android:title="@string/prefs_keyboard_height_scale"
|
||||
latin:minValue="50"
|
||||
latin:maxValue="120" /> <!-- percentage -->
|
||||
<PreferenceCategory
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_key_dump_dictionaries"
|
||||
android:title="@string/prefs_dump_dynamic_dicts">
|
||||
</PreferenceCategory>
|
||||
</SwitchPreferenceCompat>
|
||||
</PreferenceScreen>
|
||||
|
|
|
@ -18,20 +18,20 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:title="@string/settings_screen_gesture"
|
||||
android:key="screen_gesture">
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="gesture_input"
|
||||
android:title="@string/gesture_input"
|
||||
android:summary="@string/gesture_input_summary"
|
||||
android:defaultValue="true"
|
||||
android:persistent="true" />
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_gesture_floating_preview_text"
|
||||
android:dependency="gesture_input"
|
||||
android:title="@string/gesture_floating_preview_text"
|
||||
android:summary="@string/gesture_floating_preview_text_summary"
|
||||
android:defaultValue="true"
|
||||
android:persistent="true" />
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_gesture_preview_trail"
|
||||
android:dependency="gesture_input"
|
||||
android:title="@string/gesture_preview_trail"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:title="@string/language_selection_title"
|
||||
android:key="screen_languages">
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_use_system_locales"
|
||||
android:title="@string/use_system_language_to_select_input_method_subtypes"
|
||||
android:defaultValue="true"
|
||||
|
|
|
@ -20,14 +20,14 @@
|
|||
|
||||
<PreferenceCategory android:title="@string/settings_category_input">
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_show_hints"
|
||||
android:title="@string/show_hints"
|
||||
android:summary="@string/show_hints_summary"
|
||||
android:defaultValue="true"
|
||||
android:persistent="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="vibrate_on"
|
||||
android:title="@string/vibrate_on_keypress"
|
||||
android:defaultValue="@bool/config_default_vibration_enabled"
|
||||
|
@ -38,7 +38,7 @@
|
|||
android:title="@string/prefs_keypress_vibration_duration_settings"
|
||||
latin:maxValue="@integer/config_max_vibration_duration" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="sound_on"
|
||||
android:title="@string/sound_on_keypress"
|
||||
android:defaultValue="@bool/config_default_sound_enabled"
|
||||
|
@ -51,7 +51,7 @@
|
|||
|
||||
</PreferenceCategory>
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="popup_on"
|
||||
android:title="@string/popup_on_keypress"
|
||||
android:defaultValue="@bool/config_default_key_preview_popup"
|
||||
|
@ -60,32 +60,32 @@
|
|||
<PreferenceCategory
|
||||
android:title="@string/settings_category_additional_keys">
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_show_number_row"
|
||||
android:title="@string/number_row"
|
||||
android:summary="@string/number_row_summary"
|
||||
android:defaultValue="false"
|
||||
android:persistent="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_show_language_switch_key"
|
||||
android:title="@string/show_language_switch_key"
|
||||
android:defaultValue="false"
|
||||
android:persistent="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_show_emoji_key"
|
||||
android:title="@string/show_emoji_key"
|
||||
android:defaultValue="false"
|
||||
android:persistent="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_voice_input_key"
|
||||
android:title="@string/voice_input"
|
||||
android:defaultValue="true"
|
||||
android:persistent="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_show_clipboard_key"
|
||||
android:title="@string/show_clipboard_key"
|
||||
android:defaultValue="false"
|
||||
|
@ -95,7 +95,7 @@
|
|||
|
||||
<PreferenceCategory android:title="@string/settings_category_clipboard_history">
|
||||
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_enable_clipboard_history"
|
||||
android:title="@string/enable_clipboard_history"
|
||||
android:summary="@string/enable_clipboard_history_summary"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
>
|
||||
<CheckBoxPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_spellcheck_use_contacts"
|
||||
android:title="@string/use_contacts_for_spellchecking_option_title"
|
||||
android:summary="@string/use_contacts_for_spellchecking_option_summary"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue