mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-22 15:19:10 +00:00
add another setting to disable always show suggestions just for web edit fields, which seem fo frequenty cause issues with this setting
This commit is contained in:
parent
7228fa06d1
commit
9e91e7562b
5 changed files with 18 additions and 1 deletions
|
@ -66,6 +66,7 @@ object Defaults {
|
|||
const val PREF_CENTER_SUGGESTION_TEXT_TO_ENTER = false
|
||||
const val PREF_SHOW_SUGGESTIONS = true
|
||||
const val PREF_ALWAYS_SHOW_SUGGESTIONS = false
|
||||
const val PREF_ALWAYS_SHOW_SUGGESTIONS_EXCEPT_WEB_TEXT = true
|
||||
const val PREF_KEY_USE_PERSONALIZED_DICTS = true
|
||||
const val PREF_KEY_USE_DOUBLE_SPACE_PERIOD = true
|
||||
const val PREF_BLOCK_POTENTIALLY_OFFENSIVE = true
|
||||
|
|
|
@ -74,6 +74,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
public static final String PREF_CENTER_SUGGESTION_TEXT_TO_ENTER = "center_suggestion_text_to_enter";
|
||||
public static final String PREF_SHOW_SUGGESTIONS = "show_suggestions";
|
||||
public static final String PREF_ALWAYS_SHOW_SUGGESTIONS = "always_show_suggestions";
|
||||
public static final String PREF_ALWAYS_SHOW_SUGGESTIONS_EXCEPT_WEB_TEXT = "always_show_suggestions_except_web_text";
|
||||
public static final String PREF_KEY_USE_PERSONALIZED_DICTS = "use_personalized_dicts";
|
||||
public static final String PREF_KEY_USE_DOUBLE_SPACE_PERIOD = "use_double_space_period";
|
||||
public static final String PREF_BLOCK_POTENTIALLY_OFFENSIVE = "block_potentially_offensive";
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.content.Context;
|
|||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.text.InputType;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodSubtype;
|
||||
|
||||
|
@ -221,7 +222,10 @@ public class SettingsValues {
|
|||
mGestureFastTypingCooldown = prefs.getInt(Settings.PREF_GESTURE_FAST_TYPING_COOLDOWN, Defaults.PREF_GESTURE_FAST_TYPING_COOLDOWN);
|
||||
mGestureTrailFadeoutDuration = prefs.getInt(Settings.PREF_GESTURE_TRAIL_FADEOUT_DURATION, Defaults.PREF_GESTURE_TRAIL_FADEOUT_DURATION);
|
||||
mAccount = null; // remove? or can it be useful somewhere?
|
||||
mOverrideShowingSuggestions = mInputAttributes.mMayOverrideShowingSuggestions && prefs.getBoolean(Settings.PREF_ALWAYS_SHOW_SUGGESTIONS, Defaults.PREF_ALWAYS_SHOW_SUGGESTIONS);
|
||||
mOverrideShowingSuggestions = mInputAttributes.mMayOverrideShowingSuggestions
|
||||
&& prefs.getBoolean(Settings.PREF_ALWAYS_SHOW_SUGGESTIONS, Defaults.PREF_ALWAYS_SHOW_SUGGESTIONS)
|
||||
&& ((inputAttributes.mInputType & InputType.TYPE_MASK_VARIATION) != InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT
|
||||
|| !prefs.getBoolean(Settings.PREF_ALWAYS_SHOW_SUGGESTIONS_EXCEPT_WEB_TEXT, Defaults.PREF_ALWAYS_SHOW_SUGGESTIONS_EXCEPT_WEB_TEXT));
|
||||
final boolean suggestionsEnabled = prefs.getBoolean(Settings.PREF_SHOW_SUGGESTIONS, Defaults.PREF_SHOW_SUGGESTIONS);
|
||||
mSuggestionsEnabledPerUserSettings = (mInputAttributes.mShouldShowSuggestions && suggestionsEnabled)
|
||||
|| mOverrideShowingSuggestions;
|
||||
|
|
|
@ -63,6 +63,8 @@ fun TextCorrectionScreen(
|
|||
R.string.settings_category_suggestions,
|
||||
Settings.PREF_SHOW_SUGGESTIONS,
|
||||
if (suggestionsEnabled) Settings.PREF_ALWAYS_SHOW_SUGGESTIONS else null,
|
||||
if (suggestionsEnabled && prefs.getBoolean(Settings.PREF_ALWAYS_SHOW_SUGGESTIONS, Defaults.PREF_ALWAYS_SHOW_SUGGESTIONS))
|
||||
Settings.PREF_ALWAYS_SHOW_SUGGESTIONS_EXCEPT_WEB_TEXT else null,
|
||||
if (suggestionsEnabled) Settings.PREF_CENTER_SUGGESTION_TEXT_TO_ENTER else null,
|
||||
Settings.PREF_KEY_USE_PERSONALIZED_DICTS,
|
||||
Settings.PREF_BIGRAM_PREDICTIONS,
|
||||
|
@ -139,6 +141,11 @@ fun createCorrectionSettings(context: Context) = listOf(
|
|||
) {
|
||||
SwitchPreference(it, Defaults.PREF_ALWAYS_SHOW_SUGGESTIONS)
|
||||
},
|
||||
Setting(context, Settings.PREF_ALWAYS_SHOW_SUGGESTIONS_EXCEPT_WEB_TEXT,
|
||||
R.string.prefs_always_show_suggestions_except_web_text, R.string.prefs_always_show_suggestions_except_web_text_summary
|
||||
) {
|
||||
SwitchPreference(it, Defaults.PREF_ALWAYS_SHOW_SUGGESTIONS_EXCEPT_WEB_TEXT)
|
||||
},
|
||||
Setting(context, Settings.PREF_KEY_USE_PERSONALIZED_DICTS,
|
||||
R.string.use_personalized_dicts, R.string.use_personalized_dicts_summary
|
||||
) { setting ->
|
||||
|
|
|
@ -104,6 +104,10 @@
|
|||
<string name="prefs_always_show_suggestions">Always show suggestions</string>
|
||||
<!-- Description for override app flag to not show suggestions -->
|
||||
<string name="prefs_always_show_suggestions_summary">Ignore other apps’ request to disable suggestions (may cause issues)</string>
|
||||
<!-- Option to not override the above flags for InputType.WEB_EDIT_TEXT -->
|
||||
<string name="prefs_always_show_suggestions_except_web_text">Don’t always show suggestions for web edit fields</string>
|
||||
<!-- Description for prefs_always_show_suggestions_except_web_text -->
|
||||
<string name="prefs_always_show_suggestions_except_web_text_summary">Web edit fields (mostly found in browsers) are a very common cause for issues with the always show suggestions setting</string>
|
||||
<!-- Option to block potentially offensive words to be shown -->
|
||||
<string name="prefs_block_potentially_offensive_title">Block offensive words</string>
|
||||
<!-- Summary for option to block potentially offensive words to be shown -->
|
||||
|
|
Loading…
Add table
Reference in a new issue