Fix off-device build

This CL fixed the breakage caused by DistracterFilter.
It should be checked in together with I8f53e9481c0f

Bug: 14911612
Bug: 13142176
Change-Id: I33c3526165cea58926d10404552f1fadc385c2e5
This commit is contained in:
Xiaojun Bi 2014-05-14 13:33:52 -07:00
parent aa7329de15
commit 3686bdfcc1
3 changed files with 43 additions and 15 deletions

View File

@ -84,6 +84,7 @@ import com.android.inputmethod.latin.utils.CapsModeUtils;
import com.android.inputmethod.latin.utils.CoordinateUtils;
import com.android.inputmethod.latin.utils.DialogUtils;
import com.android.inputmethod.latin.utils.DistracterFilter;
import com.android.inputmethod.latin.utils.DistracterFilterUtils;
import com.android.inputmethod.latin.utils.ImportantNoticeUtils;
import com.android.inputmethod.latin.utils.IntentUtils;
import com.android.inputmethod.latin.utils.JniUtils;
@ -1745,7 +1746,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@UsedForTesting
/* package for test */ DistracterFilter createDistracterFilter() {
return DistracterFilter.createDistracterFilter(mInputLogic.mSuggest, mKeyboardSwitcher);
return DistracterFilterUtils.createDistracterFilter(
mInputLogic.mSuggest, mKeyboardSwitcher);
}
public void dumpDictionaryForDebug(final String dictName) {

View File

@ -17,8 +17,6 @@
package com.android.inputmethod.latin.utils;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardSwitcher;
import com.android.inputmethod.keyboard.MainKeyboardView;
import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.Suggest;
import com.android.inputmethod.latin.Suggest.OnGetSuggestedWordsCallback;
@ -54,18 +52,6 @@ public class DistracterFilter {
mKeyboard = keyboard;
}
public static DistracterFilter createDistracterFilter(final Suggest suggest,
final KeyboardSwitcher keyboardSwitcher) {
final MainKeyboardView mainKeyboardView = keyboardSwitcher.getMainKeyboardView();
// TODO: Create Keyboard when mainKeyboardView is null.
// TODO: Figure out the most reasonable keyboard for the filter. Refer to the
// spellchecker's logic.
final Keyboard keyboard = (mainKeyboardView != null) ?
mainKeyboardView.getKeyboard() : null;
final DistracterFilter distracterFilter = new DistracterFilter(suggest, keyboard);
return distracterFilter;
}
private static boolean suggestionExceedsDistracterThreshold(
final SuggestedWordInfo suggestion, final String consideredWord,
final float distracterThreshold) {

View File

@ -0,0 +1,40 @@
/*
* 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.utils;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardSwitcher;
import com.android.inputmethod.keyboard.MainKeyboardView;
import com.android.inputmethod.latin.Suggest;
public class DistracterFilterUtils {
private DistracterFilterUtils() {
// This utility class is not publicly instantiable.
}
public static final DistracterFilter createDistracterFilter(final Suggest suggest,
final KeyboardSwitcher keyboardSwitcher) {
final MainKeyboardView mainKeyboardView = keyboardSwitcher.getMainKeyboardView();
// TODO: Create Keyboard when mainKeyboardView is null.
// TODO: Figure out the most reasonable keyboard for the filter. Refer to the
// spellchecker's logic.
final Keyboard keyboard = (mainKeyboardView != null) ?
mainKeyboardView.getKeyboard() : null;
final DistracterFilter distracterFilter = new DistracterFilter(suggest, keyboard);
return distracterFilter;
}
}