am 18d536f6: Merge "Dismiss orange highlight after suggestion has been selected" into gingerbread
Merge commit '18d536f66b2a063a462b2d28410da80b7788e5da' into gingerbread-plus-aosp * commit '18d536f66b2a063a462b2d28410da80b7788e5da': Dismiss orange highlight after suggestion has been selectedmain
commit
8e6a92703d
|
@ -40,14 +40,15 @@ import java.util.List;
|
||||||
|
|
||||||
public class CandidateView extends View {
|
public class CandidateView extends View {
|
||||||
|
|
||||||
private static final int OUT_OF_BOUNDS = -1;
|
private static final int OUT_OF_BOUNDS_WORD_INDEX = -1;
|
||||||
|
private static final int OUT_OF_BOUNDS_X_COORD = -1;
|
||||||
|
|
||||||
private LatinIME mService;
|
private LatinIME mService;
|
||||||
private final ArrayList<CharSequence> mSuggestions = new ArrayList<CharSequence>();
|
private final ArrayList<CharSequence> mSuggestions = new ArrayList<CharSequence>();
|
||||||
private boolean mShowingCompletions;
|
private boolean mShowingCompletions;
|
||||||
private CharSequence mSelectedString;
|
private CharSequence mSelectedString;
|
||||||
private int mSelectedIndex;
|
private int mSelectedIndex;
|
||||||
private int mTouchX = OUT_OF_BOUNDS;
|
private int mTouchX = OUT_OF_BOUNDS_X_COORD;
|
||||||
private final Drawable mSelectionHighlight;
|
private final Drawable mSelectionHighlight;
|
||||||
private boolean mTypedWordValid;
|
private boolean mTypedWordValid;
|
||||||
|
|
||||||
|
@ -256,8 +257,8 @@ public class CandidateView extends View {
|
||||||
|
|
||||||
mWordX[i] = x;
|
mWordX[i] = x;
|
||||||
|
|
||||||
if (touchX + scrollX >= x && touchX + scrollX < x + wordWidth && !scrolled &&
|
if (touchX != OUT_OF_BOUNDS_X_COORD && !scrolled
|
||||||
touchX != OUT_OF_BOUNDS) {
|
&& touchX + scrollX >= x && touchX + scrollX < x + wordWidth) {
|
||||||
if (canvas != null && !mShowingAddToDictionary) {
|
if (canvas != null && !mShowingAddToDictionary) {
|
||||||
canvas.translate(x, 0);
|
canvas.translate(x, 0);
|
||||||
mSelectionHighlight.setBounds(0, bgPadding.top, wordWidth, height);
|
mSelectionHighlight.setBounds(0, bgPadding.top, wordWidth, height);
|
||||||
|
@ -360,7 +361,7 @@ public class CandidateView extends View {
|
||||||
// Don't call mSuggestions.clear() because it's being used for logging
|
// Don't call mSuggestions.clear() because it's being used for logging
|
||||||
// in LatinIME.pickSuggestionManually().
|
// in LatinIME.pickSuggestionManually().
|
||||||
mSuggestions.clear();
|
mSuggestions.clear();
|
||||||
mTouchX = OUT_OF_BOUNDS;
|
mTouchX = OUT_OF_BOUNDS_X_COORD;
|
||||||
mSelectedString = null;
|
mSelectedString = null;
|
||||||
mSelectedIndex = -1;
|
mSelectedIndex = -1;
|
||||||
mShowingAddToDictionary = false;
|
mShowingAddToDictionary = false;
|
||||||
|
@ -429,7 +430,8 @@ public class CandidateView extends View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hidePreview() {
|
private void hidePreview() {
|
||||||
mCurrentWordIndex = OUT_OF_BOUNDS;
|
mTouchX = OUT_OF_BOUNDS_X_COORD;
|
||||||
|
mCurrentWordIndex = OUT_OF_BOUNDS_WORD_INDEX;
|
||||||
mPreviewPopup.dismiss();
|
mPreviewPopup.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +440,7 @@ public class CandidateView extends View {
|
||||||
mCurrentWordIndex = wordIndex;
|
mCurrentWordIndex = wordIndex;
|
||||||
// If index changed or changing text
|
// If index changed or changing text
|
||||||
if (oldWordIndex != mCurrentWordIndex || altText != null) {
|
if (oldWordIndex != mCurrentWordIndex || altText != null) {
|
||||||
if (wordIndex == OUT_OF_BOUNDS) {
|
if (wordIndex == OUT_OF_BOUNDS_WORD_INDEX) {
|
||||||
hidePreview();
|
hidePreview();
|
||||||
} else {
|
} else {
|
||||||
CharSequence word = altText != null? altText : mSuggestions.get(wordIndex);
|
CharSequence word = altText != null? altText : mSuggestions.get(wordIndex);
|
||||||
|
|
Loading…
Reference in New Issue