diff options
author | 2014-05-20 17:31:24 +0900 | |
---|---|---|
committer | 2014-05-21 11:19:01 +0900 | |
commit | 5fc1510bc1cbe9bcd1105a403e07b5400470ae96 (patch) | |
tree | ea82f408afcf6e3872f25121368a8abe1e19e97d /java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java | |
parent | 06dd0ef877d0ed1027a326769274c1f00f8bbf35 (diff) | |
download | latinime-5fc1510bc1cbe9bcd1105a403e07b5400470ae96.tar.gz latinime-5fc1510bc1cbe9bcd1105a403e07b5400470ae96.tar.xz latinime-5fc1510bc1cbe9bcd1105a403e07b5400470ae96.zip |
Refactor MoreKeysKeyboardView to use Key class
This can make MoreSuggestionsView to use extended Key class to hold
a index of a suggested word.
Change-Id: I54d03d2447b04e3caf3e19e7cadcd391cbf58dd5
Diffstat (limited to 'java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java | 11 |
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; |