aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/CandidateView.java
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2011-08-08 20:33:44 +0900
committerKen Wakasa <kwakasa@google.com>2011-08-08 20:33:44 +0900
commitbbf25cf25169f640a361370cde5521ffc7789a1b (patch)
treeb387cebcca8550a53084a370504a7b5b53efa3a6 /java/src/com/android/inputmethod/latin/CandidateView.java
parentc2b6a35e651d005cae6d7d1bd13f1df3d988314b (diff)
downloadlatinime-bbf25cf25169f640a361370cde5521ffc7789a1b.tar.gz
latinime-bbf25cf25169f640a361370cde5521ffc7789a1b.tar.xz
latinime-bbf25cf25169f640a361370cde5521ffc7789a1b.zip
Fix issues with long-press access to more suggestions
Change-Id: If5a45dcae7f7e7881d305104e35a04c341719aec
Diffstat (limited to 'java/src/com/android/inputmethod/latin/CandidateView.java')
-rw-r--r--java/src/com/android/inputmethod/latin/CandidateView.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java
index 1cf093c67..d779c8565 100644
--- a/java/src/com/android/inputmethod/latin/CandidateView.java
+++ b/java/src/com/android/inputmethod/latin/CandidateView.java
@@ -387,7 +387,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
final int countInStrip = mCandidateCountInStrip;
setupTexts(suggestions, countInStrip);
-
+ mMoreSuggestionsAvailable = (suggestions.size() > countInStrip);
int x = 0;
for (int index = 0; index < countInStrip; index++) {
final int pos = getWordPosition(index, suggestions);
@@ -400,14 +400,12 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
final CharSequence styled = mTexts.get(pos);
final TextView word = mWords.get(pos);
- if (index == mCenterCandidateIndex && suggestions.size() > countInStrip) {
+ if (index == mCenterCandidateIndex && mMoreSuggestionsAvailable) {
// TODO: This "more suggestions hint" should have nicely designed icon.
word.setCompoundDrawablesWithIntrinsicBounds(
null, null, null, mMoreCandidateHint);
- mMoreSuggestionsAvailable = true;
} else {
word.setCompoundDrawables(null, null, null, null);
- mMoreSuggestionsAvailable = false;
}
// Disable this candidate if the suggestion is null or empty.
@@ -693,6 +691,14 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
mKeyboardView.setVisibility(VISIBLE);
}
+ private void toggleCandidatesPane() {
+ if (mCandidatesPaneContainer.getVisibility() == VISIBLE) {
+ closeCandidatesPane();
+ } else {
+ expandCandidatesPane();
+ }
+ }
+
public void onAutoCorrectionInverted(CharSequence autoCorrectedWord) {
final CharSequence inverted = mStripParams.getInvertedText(autoCorrectedWord);
if (inverted == null)
@@ -770,7 +776,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
@Override
public boolean onLongClick(View view) {
if (mStripParams.mMoreSuggestionsAvailable) {
- expandCandidatesPane();
+ toggleCandidatesPane();
return true;
}
return false;