aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-05-21 03:08:48 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-21 03:08:48 +0000
commitf273a25b03318553391ee8d4e6049aa1d942ee16 (patch)
treeb5d4b9304cdd5af21b288b2ea5eb8e5b48d76d2e /java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java
parentf30d579df27946c3a166e5f30a6d00a0bbf81183 (diff)
parent73788ea154f735014d5e4c50750a6f600a280a6b (diff)
downloadlatinime-f273a25b03318553391ee8d4e6049aa1d942ee16.tar.gz
latinime-f273a25b03318553391ee8d4e6049aa1d942ee16.tar.xz
latinime-f273a25b03318553391ee8d4e6049aa1d942ee16.zip
am 73788ea1: Merge "Refactor MoreKeysKeyboardView to use Key class"
* commit '73788ea154f735014d5e4c50750a6f600a280a6b': Refactor MoreKeysKeyboardView to use Key class
Diffstat (limited to 'java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java')
-rw-r--r--java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java
index 549ff0d9d..7fd64c4bf 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java
@@ -20,10 +20,12 @@ import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
+import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.MoreKeysKeyboardView;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.SuggestedWords;
+import com.android.inputmethod.latin.suggestions.MoreSuggestions.MoreSuggestionKey;
import com.android.inputmethod.latin.suggestions.MoreSuggestions.MoreSuggestionsListener;
/**
@@ -59,7 +61,12 @@ public final class MoreSuggestionsView extends MoreKeysKeyboardView {
}
@Override
- public void onCodeInput(final int code, final int x, final int y) {
+ protected void onKeyInput(final Key key, final int x, final int y) {
+ if (!(key instanceof MoreSuggestionKey)) {
+ Log.e(TAG, "Expected key is MoreSuggestionKey, but found "
+ + key.getClass().getName());
+ return;
+ }
final Keyboard keyboard = getKeyboard();
if (!(keyboard instanceof MoreSuggestions)) {
Log.e(TAG, "Expected keyboard is MoreSuggestions, but found "
@@ -67,7 +74,7 @@ public final class MoreSuggestionsView extends MoreKeysKeyboardView {
return;
}
final SuggestedWords suggestedWords = ((MoreSuggestions)keyboard).mSuggestedWords;
- final int index = code - MoreSuggestions.SUGGESTION_CODE_BASE;
+ final int index = ((MoreSuggestionKey)key).mSuggestedWordIndex;
if (index < 0 || index >= suggestedWords.size()) {
Log.e(TAG, "Selected suggestion has an illegal index: " + index);
return;