am 95f100ba: Merge "Performance fix for multiple language subtypes"
* commit '95f100ba404c3f905739db628ec71b7c1b7b5ace': Performance fix for multiple language subtypesmain
commit
cbffb79584
|
@ -46,7 +46,7 @@ public class AdditionalFeaturesSettingUtils {
|
||||||
// do nothing.
|
// do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RichInputMethodSubtype getRichInputMethodSubtype(
|
public static RichInputMethodSubtype createRichInputMethodSubtype(
|
||||||
@Nonnull final RichInputMethodManager imm,
|
@Nonnull final RichInputMethodManager imm,
|
||||||
@Nonnull final InputMethodSubtype subtype) {
|
@Nonnull final InputMethodSubtype subtype) {
|
||||||
return new RichInputMethodSubtype(subtype);
|
return new RichInputMethodSubtype(subtype);
|
||||||
|
|
|
@ -568,6 +568,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
// TODO: Resolve mutual dependencies of {@link #loadSettings()} and
|
// TODO: Resolve mutual dependencies of {@link #loadSettings()} and
|
||||||
// {@link #resetDictionaryFacilitatorIfNecessary()}.
|
// {@link #resetDictionaryFacilitatorIfNecessary()}.
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
mSubtypeSwitcher.onSubtypeChanged(mRichImm.getCurrentRawSubtype());
|
||||||
resetDictionaryFacilitatorIfNecessary();
|
resetDictionaryFacilitatorIfNecessary();
|
||||||
|
|
||||||
// Register to receive ringer mode change and network state change.
|
// Register to receive ringer mode change and network state change.
|
||||||
|
@ -837,8 +838,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
public void onCurrentInputMethodSubtypeChanged(final InputMethodSubtype subtype) {
|
public void onCurrentInputMethodSubtypeChanged(final InputMethodSubtype subtype) {
|
||||||
// Note that the calling sequence of onCreate() and onCurrentInputMethodSubtypeChanged()
|
// Note that the calling sequence of onCreate() and onCurrentInputMethodSubtypeChanged()
|
||||||
// is not guaranteed. It may even be called at the same time on a different thread.
|
// is not guaranteed. It may even be called at the same time on a different thread.
|
||||||
final RichInputMethodSubtype richSubtype = new RichInputMethodSubtype(subtype);
|
mSubtypeSwitcher.onSubtypeChanged(subtype);
|
||||||
mSubtypeSwitcher.onSubtypeChanged(richSubtype);
|
|
||||||
mInputLogic.onSubtypeChanged(SubtypeLocaleUtils.getCombiningRulesExtraValue(subtype),
|
mInputLogic.onSubtypeChanged(SubtypeLocaleUtils.getCombiningRulesExtraValue(subtype),
|
||||||
mSettings.getCurrent());
|
mSettings.getCurrent());
|
||||||
loadKeyboard();
|
loadKeyboard();
|
||||||
|
|
|
@ -299,13 +299,13 @@ public class RichInputMethodManager {
|
||||||
return INDEX_NOT_FOUND;
|
return INDEX_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RichInputMethodSubtype getCurrentInputMethodSubtype(
|
public InputMethodSubtype getCurrentRawSubtype() {
|
||||||
final RichInputMethodSubtype defaultSubtype) {
|
return mImmWrapper.mImm.getCurrentInputMethodSubtype();
|
||||||
final InputMethodSubtype currentSubtype = mImmWrapper.mImm.getCurrentInputMethodSubtype();
|
}
|
||||||
if (currentSubtype == null) {
|
|
||||||
return defaultSubtype;
|
public RichInputMethodSubtype createCurrentRichInputMethodSubtype(
|
||||||
}
|
final InputMethodSubtype rawSubtype) {
|
||||||
return AdditionalFeaturesSettingUtils.getRichInputMethodSubtype(this, currentSubtype);
|
return AdditionalFeaturesSettingUtils.createRichInputMethodSubtype(this, rawSubtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasMultipleEnabledIMEsOrSubtypes(final boolean shouldIncludeAuxiliarySubtypes) {
|
public boolean hasMultipleEnabledIMEsOrSubtypes(final boolean shouldIncludeAuxiliarySubtypes) {
|
||||||
|
|
|
@ -58,6 +58,7 @@ public final class SubtypeSwitcher {
|
||||||
new LanguageOnSpacebarHelper();
|
new LanguageOnSpacebarHelper();
|
||||||
private InputMethodInfo mShortcutInputMethodInfo;
|
private InputMethodInfo mShortcutInputMethodInfo;
|
||||||
private InputMethodSubtype mShortcutSubtype;
|
private InputMethodSubtype mShortcutSubtype;
|
||||||
|
private RichInputMethodSubtype mCurrentRichInputMethodSubtype;
|
||||||
private RichInputMethodSubtype mNoLanguageSubtype;
|
private RichInputMethodSubtype mNoLanguageSubtype;
|
||||||
private RichInputMethodSubtype mEmojiSubtype;
|
private RichInputMethodSubtype mEmojiSubtype;
|
||||||
private boolean mIsNetworkConnected;
|
private boolean mIsNetworkConnected;
|
||||||
|
@ -117,7 +118,7 @@ public final class SubtypeSwitcher {
|
||||||
final NetworkInfo info = connectivityManager.getActiveNetworkInfo();
|
final NetworkInfo info = connectivityManager.getActiveNetworkInfo();
|
||||||
mIsNetworkConnected = (info != null && info.isConnected());
|
mIsNetworkConnected = (info != null && info.isConnected());
|
||||||
|
|
||||||
onSubtypeChanged(getCurrentSubtype());
|
onSubtypeChanged(mRichImm.getCurrentRawSubtype());
|
||||||
updateParametersOnStartInputView();
|
updateParametersOnStartInputView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,12 +166,14 @@ public final class SubtypeSwitcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the current subtype. LatinIME.onCurrentInputMethodSubtypeChanged calls this function.
|
// Update the current subtype. LatinIME.onCurrentInputMethodSubtypeChanged calls this function.
|
||||||
public void onSubtypeChanged(final RichInputMethodSubtype newSubtype) {
|
public void onSubtypeChanged(final InputMethodSubtype newSubtype) {
|
||||||
|
final RichInputMethodSubtype richSubtype =
|
||||||
|
mRichImm.createCurrentRichInputMethodSubtype(newSubtype);
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
Log.w(TAG, "onSubtypeChanged: " + newSubtype.getNameForLogging());
|
Log.w(TAG, "onSubtypeChanged: " + richSubtype.getNameForLogging());
|
||||||
}
|
}
|
||||||
|
mCurrentRichInputMethodSubtype = richSubtype;
|
||||||
final Locale[] newLocales = newSubtype.getLocales();
|
final Locale[] newLocales = richSubtype.getLocales();
|
||||||
if (newLocales.length > 1) {
|
if (newLocales.length > 1) {
|
||||||
// In multi-locales mode, the system language is never the same as the input language
|
// In multi-locales mode, the system language is never the same as the input language
|
||||||
// because there is no single input language.
|
// because there is no single input language.
|
||||||
|
@ -181,7 +184,7 @@ public final class SubtypeSwitcher {
|
||||||
final boolean sameLocale = systemLocale.equals(newLocale);
|
final boolean sameLocale = systemLocale.equals(newLocale);
|
||||||
final boolean sameLanguage = systemLocale.getLanguage().equals(newLocale.getLanguage());
|
final boolean sameLanguage = systemLocale.getLanguage().equals(newLocale.getLanguage());
|
||||||
final boolean implicitlyEnabled = mRichImm
|
final boolean implicitlyEnabled = mRichImm
|
||||||
.checkIfSubtypeBelongsToThisImeAndImplicitlyEnabled(newSubtype.getRawSubtype());
|
.checkIfSubtypeBelongsToThisImeAndImplicitlyEnabled(newSubtype);
|
||||||
mLanguageOnSpacebarHelper.updateIsSystemLanguageSameAsInputLanguage(
|
mLanguageOnSpacebarHelper.updateIsSystemLanguageSameAsInputLanguage(
|
||||||
sameLocale || (sameLanguage && implicitlyEnabled));
|
sameLocale || (sameLanguage && implicitlyEnabled));
|
||||||
}
|
}
|
||||||
|
@ -301,7 +304,7 @@ public final class SubtypeSwitcher {
|
||||||
if (null != sForcedSubtypeForTesting) {
|
if (null != sForcedSubtypeForTesting) {
|
||||||
return sForcedSubtypeForTesting;
|
return sForcedSubtypeForTesting;
|
||||||
}
|
}
|
||||||
return mRichImm.getCurrentInputMethodSubtype(getNoLanguageSubtype());
|
return mCurrentRichInputMethodSubtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RichInputMethodSubtype getNoLanguageSubtype() {
|
public RichInputMethodSubtype getNoLanguageSubtype() {
|
||||||
|
|
Loading…
Reference in New Issue