Fix issues with long-press access to more suggestions
Change-Id: If5a45dcae7f7e7881d305104e35a04c341719aec
This commit is contained in:
parent
c2b6a35e65
commit
bbf25cf251
1 changed files with 11 additions and 5 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue