fix(settings): always show language switch key when toggle is on#144
Open
sfrvn wants to merge 1 commit into
Open
fix(settings): always show language switch key when toggle is on#144sfrvn wants to merge 1 commit into
sfrvn wants to merge 1 commit into
Conversation
The 'Language switch key' toggle silently had no effect when only a single subtype was enabled, because isLanguageSwitchKeyEnabled() gated visibility on the *behavior* preference (internal / input_method / both). For the default 'internal' behavior, the key was hidden whenever the user had a single LeanType subtype, which is the common case. The behavior preference should only decide what tapping the key does, not whether the key is rendered. With this fix, the key is shown whenever the user explicitly enables the toggle and there is anything to switch to (any other subtype in this IME or any other enabled IME).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make the "Language switch key" toggle actually show the key in the common
case (single enabled subtype). Closes #143
Problem
SettingsValues#isLanguageSwitchKeyEnabled()used the behavior preference(
PREF_LANGUAGE_SWITCH_KEY:internal/input_method/both) to decidevisibility. With the default
internalbehavior, the key is hiddenwhenever the user has only one subtype enabled in this IME — i.e. for a
typical freshly-installed user. Turning the toggle on appears to do nothing.
Fix
Removed the behavior-based branches. The key is now shown whenever:
other enabled IME).
The behavior preference still fully controls tap action — see
LatinIME#switchToNextSubtype()andRichInputMethodManager#canSwitchLanguage(),both untouched. No regression for users who configured a specific behavior.
Verification
isLanguageSwitchKeyEnabled()returnstruewhenever the toggle is onand there is something to switch to. With nothing to switch to (single
IME, single subtype), it still returns
false(avoids a useless key).Note on upstream
The same code path exists in upstream
Helium314/HeliBoard. I verified byreading the source, not by running their build. Happy to forward this
upstream after it lands here if the maintainers prefer.