mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
[IL27] Some refactoring
Bug: 8636060 Change-Id: Iedfdf71350f5fe3ab451fc5ec6e3c9901f71e50f
This commit is contained in:
parent
221df9e59a
commit
55ce2cc2d5
@ -128,7 +128,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||
private final SubtypeState mSubtypeState = new SubtypeState();
|
||||
|
||||
private UserBinaryDictionary mUserDictionary;
|
||||
private boolean mIsUserDictionaryAvailable;
|
||||
|
||||
// Personalization debugging params
|
||||
private boolean mUseOnlyPersonalizationDictionaryForDebug = false;
|
||||
@ -563,7 +562,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||
}
|
||||
|
||||
mUserDictionary = new UserBinaryDictionary(this, subtypeLocale);
|
||||
mIsUserDictionaryAvailable = mUserDictionary.isEnabled();
|
||||
newSuggest.setUserDictionary(mUserDictionary);
|
||||
newSuggest.setAdditionalDictionaries(mInputLogic.mSuggest /* oldSuggest */,
|
||||
mSettings.getCurrent());
|
||||
@ -1246,6 +1244,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||
return mInputLogic.getCurrentRecapitalizeState();
|
||||
}
|
||||
|
||||
public Locale getCurrentSubtypeLocale() {
|
||||
return mSubtypeSwitcher.getCurrentSubtypeLocale();
|
||||
}
|
||||
|
||||
// Callback for the {@link SuggestionStripView}, to call when the "add to dictionary" hint is
|
||||
// pressed.
|
||||
@Override
|
||||
@ -1256,7 +1258,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||
}
|
||||
final String wordToEdit;
|
||||
if (CapsModeUtils.isAutoCapsMode(mInputLogic.mLastComposedWord.mCapitalizedMode)) {
|
||||
wordToEdit = word.toLowerCase(mSubtypeSwitcher.getCurrentSubtypeLocale());
|
||||
wordToEdit = word.toLowerCase(getCurrentSubtypeLocale());
|
||||
} else {
|
||||
wordToEdit = word;
|
||||
}
|
||||
@ -1884,7 +1886,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||
LatinImeLoggerUtils.onSeparator((char)Constants.CODE_SPACE,
|
||||
Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE);
|
||||
}
|
||||
if (showingAddToDictionaryHint && mIsUserDictionaryAvailable) {
|
||||
if (showingAddToDictionaryHint && mUserDictionary.mEnabled) {
|
||||
mSuggestionStripView.showAddToDictionaryHint(
|
||||
suggestion, currentSettings.mHintToSaveText);
|
||||
} else {
|
||||
|
@ -74,6 +74,7 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary {
|
||||
private ContentObserver mObserver;
|
||||
final private String mLocale;
|
||||
final private boolean mAlsoUseMoreRestrictiveLocales;
|
||||
final public boolean mEnabled;
|
||||
|
||||
public UserBinaryDictionary(final Context context, final Locale locale) {
|
||||
this(context, locale, false);
|
||||
@ -118,7 +119,7 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary {
|
||||
}
|
||||
};
|
||||
cres.registerContentObserver(Words.CONTENT_URI, true, mObserver);
|
||||
|
||||
mEnabled = readIsEnabled();
|
||||
loadDictionary();
|
||||
}
|
||||
|
||||
@ -196,7 +197,7 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
private boolean readIsEnabled() {
|
||||
final ContentResolver cr = mContext.getContentResolver();
|
||||
final ContentProviderClient client = cr.acquireContentProviderClient(Words.CONTENT_URI);
|
||||
if (client != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user