Merge "Contextual dictionary updater."
This commit is contained in:
commit
a4f2e8eee0
2 changed files with 44 additions and 1 deletions
|
@ -69,6 +69,7 @@ import com.android.inputmethod.latin.Suggest.OnGetSuggestedWordsCallback;
|
|||
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
|
||||
import com.android.inputmethod.latin.define.ProductionFlag;
|
||||
import com.android.inputmethod.latin.inputlogic.InputLogic;
|
||||
import com.android.inputmethod.latin.personalization.ContextualDictionaryUpdater;
|
||||
import com.android.inputmethod.latin.personalization.DictionaryDecayBroadcastReciever;
|
||||
import com.android.inputmethod.latin.personalization.PersonalizationDictionaryUpdater;
|
||||
import com.android.inputmethod.latin.personalization.PersonalizationHelper;
|
||||
|
@ -125,6 +126,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
// TODO: Move from LatinIME.
|
||||
private final PersonalizationDictionaryUpdater mPersonalizationDictionaryUpdater =
|
||||
new PersonalizationDictionaryUpdater(this /* context */, mDictionaryFacilitator);
|
||||
private final ContextualDictionaryUpdater mContextualDictionaryUpdater =
|
||||
new ContextualDictionaryUpdater(this /* context */, mDictionaryFacilitator);
|
||||
private final InputLogic mInputLogic = new InputLogic(this /* LatinIME */,
|
||||
this /* SuggestionStripViewAccessor */, mDictionaryFacilitator);
|
||||
// We expect to have only one decoder in almost all cases, hence the default capacity of 1.
|
||||
|
@ -552,8 +555,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
mPersonalizationDictionaryUpdater.onLoadSettings(
|
||||
currentSettingsValues.mUsePersonalizedDicts,
|
||||
mSubtypeSwitcher.isSystemLocaleSameAsLocaleOfAllEnabledSubtypesOfEnabledImes());
|
||||
mContextualDictionaryUpdater.onLoadSettings(currentSettingsValues.mUsePersonalizedDicts);
|
||||
final boolean shouldKeepUserHistoryDictionaries;
|
||||
if (mSettings.getCurrent().mUsePersonalizedDicts) {
|
||||
if (currentSettingsValues.mUsePersonalizedDicts) {
|
||||
shouldKeepUserHistoryDictionaries = true;
|
||||
} else {
|
||||
shouldKeepUserHistoryDictionaries = false;
|
||||
|
@ -623,6 +627,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
public void onDestroy() {
|
||||
mDictionaryFacilitator.closeDictionaries();
|
||||
mPersonalizationDictionaryUpdater.onDestroy();
|
||||
mContextualDictionaryUpdater.onDestroy();
|
||||
mSettings.onDestroy();
|
||||
unregisterReceiver(mConnectivityAndRingerModeChangeReceiver);
|
||||
unregisterReceiver(mDictionaryPackInstallReceiver);
|
||||
|
@ -864,6 +869,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
currentSettingsValues.mGestureTrailEnabled,
|
||||
currentSettingsValues.mGestureFloatingPreviewTextEnabled);
|
||||
|
||||
// Contextual dictionary should be updated for the current application.
|
||||
mContextualDictionaryUpdater.onStartInputView(editorInfo.packageName);
|
||||
if (TRACE) Debug.startMethodTracing("/data/trace/latinime");
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.inputmethod.latin.personalization;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.inputmethod.latin.DictionaryFacilitator;
|
||||
|
||||
public class ContextualDictionaryUpdater {
|
||||
public ContextualDictionaryUpdater(final Context context,
|
||||
final DictionaryFacilitator dictionaryFacilitator) {
|
||||
}
|
||||
|
||||
public void onLoadSettings(final boolean usePersonalizedDicts) {
|
||||
}
|
||||
|
||||
public void onStartInputView(final String packageName) {
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue