Merge "Bug 5420741: exception when rotating device while suggestion popup is visible"
This commit is contained in:
committed by
Android (Google) Code Review
commit
ae245d59b3
@@ -8243,6 +8243,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
}
|
||||
|
||||
hideControllers();
|
||||
if (mSuggestionsPopupWindow != null) {
|
||||
mSuggestionsPopupWindow.onParentLostFocus();
|
||||
}
|
||||
}
|
||||
|
||||
startStopMarquee(hasWindowFocus);
|
||||
@@ -9618,6 +9621,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
private SuggestionInfo[] mSuggestionInfos;
|
||||
private int mNumberOfSuggestions;
|
||||
private boolean mCursorWasVisibleBeforeSuggestions;
|
||||
private boolean mIsShowingUp = false;
|
||||
private SuggestionAdapter mSuggestionsAdapter;
|
||||
private final Comparator<SuggestionSpan> mSuggestionSpanComparator;
|
||||
private final HashMap<SuggestionSpan, Integer> mSpansLengths;
|
||||
@@ -9673,6 +9677,14 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isShowingUp() {
|
||||
return mIsShowingUp;
|
||||
}
|
||||
|
||||
public void onParentLostFocus() {
|
||||
mIsShowingUp = false;
|
||||
}
|
||||
|
||||
private class SuggestionInfo {
|
||||
int suggestionStart, suggestionEnd; // range of actual suggestion within text
|
||||
SuggestionSpan suggestionSpan; // the SuggestionSpan that this TextView represents
|
||||
@@ -9776,6 +9788,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
updateSuggestions();
|
||||
mCursorWasVisibleBeforeSuggestions = mCursorVisible;
|
||||
setCursorVisible(false);
|
||||
mIsShowingUp = true;
|
||||
super.show();
|
||||
}
|
||||
|
||||
@@ -11188,6 +11201,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
}
|
||||
|
||||
private void hideCursorControllers() {
|
||||
if (mSuggestionsPopupWindow != null && !mSuggestionsPopupWindow.isShowingUp()) {
|
||||
// Should be done before hide insertion point controller since it triggers a show of it
|
||||
mSuggestionsPopupWindow.hide();
|
||||
}
|
||||
hideInsertionPointCursorController();
|
||||
stopSelectionActionMode();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user