mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 14:02:44 +00:00
do not switch for hintLocales if we have a matching secondary locale
fixes #1181
This commit is contained in:
parent
6e50d6e208
commit
32a37eaddf
1 changed files with 4 additions and 2 deletions
|
@ -89,6 +89,7 @@ import helium314.keyboard.latin.utils.StatsUtilsManager;
|
||||||
import helium314.keyboard.latin.utils.SubtypeLocaleUtils;
|
import helium314.keyboard.latin.utils.SubtypeLocaleUtils;
|
||||||
import helium314.keyboard.latin.utils.SubtypeSettingsKt;
|
import helium314.keyboard.latin.utils.SubtypeSettingsKt;
|
||||||
import helium314.keyboard.latin.utils.ViewLayoutUtils;
|
import helium314.keyboard.latin.utils.ViewLayoutUtils;
|
||||||
|
import kotlin.collections.CollectionsKt;
|
||||||
|
|
||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
@ -884,8 +885,9 @@ public class LatinIME extends InputMethodService implements
|
||||||
}
|
}
|
||||||
// Try switching to a subtype matching the hint language.
|
// Try switching to a subtype matching the hint language.
|
||||||
for (final Locale hintLocale : hintLocales) {
|
for (final Locale hintLocale : hintLocales) {
|
||||||
if (LocaleUtils.INSTANCE.getMatchLevel(hintLocale, mRichImm.getCurrentSubtypeLocale()) >= 3)
|
if (LocaleUtils.INSTANCE.getMatchLevel(hintLocale, mRichImm.getCurrentSubtypeLocale()) >= 3
|
||||||
return; // current locale is already a good match, and we want to avoid unnecessary layout switches
|
|| CollectionsKt.any(mSettings.getCurrent().mSecondaryLocales, (secLocale) -> LocaleUtils.INSTANCE.getMatchLevel(hintLocale, secLocale) >= 3))
|
||||||
|
return; // current locales are already a good match, and we want to avoid unnecessary layout switches
|
||||||
final InputMethodSubtype newSubtype = mRichImm.findSubtypeForHintLocale(hintLocale);
|
final InputMethodSubtype newSubtype = mRichImm.findSubtypeForHintLocale(hintLocale);
|
||||||
if (newSubtype == null) continue;
|
if (newSubtype == null) continue;
|
||||||
if (newSubtype.equals(mRichImm.getCurrentSubtype().getRawSubtype()))
|
if (newSubtype.equals(mRichImm.getCurrentSubtype().getRawSubtype()))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue