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();
|
hideControllers();
|
||||||
|
if (mSuggestionsPopupWindow != null) {
|
||||||
|
mSuggestionsPopupWindow.onParentLostFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
startStopMarquee(hasWindowFocus);
|
startStopMarquee(hasWindowFocus);
|
||||||
@@ -9618,6 +9621,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
private SuggestionInfo[] mSuggestionInfos;
|
private SuggestionInfo[] mSuggestionInfos;
|
||||||
private int mNumberOfSuggestions;
|
private int mNumberOfSuggestions;
|
||||||
private boolean mCursorWasVisibleBeforeSuggestions;
|
private boolean mCursorWasVisibleBeforeSuggestions;
|
||||||
|
private boolean mIsShowingUp = false;
|
||||||
private SuggestionAdapter mSuggestionsAdapter;
|
private SuggestionAdapter mSuggestionsAdapter;
|
||||||
private final Comparator<SuggestionSpan> mSuggestionSpanComparator;
|
private final Comparator<SuggestionSpan> mSuggestionSpanComparator;
|
||||||
private final HashMap<SuggestionSpan, Integer> mSpansLengths;
|
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 {
|
private class SuggestionInfo {
|
||||||
int suggestionStart, suggestionEnd; // range of actual suggestion within text
|
int suggestionStart, suggestionEnd; // range of actual suggestion within text
|
||||||
SuggestionSpan suggestionSpan; // the SuggestionSpan that this TextView represents
|
SuggestionSpan suggestionSpan; // the SuggestionSpan that this TextView represents
|
||||||
@@ -9776,6 +9788,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
updateSuggestions();
|
updateSuggestions();
|
||||||
mCursorWasVisibleBeforeSuggestions = mCursorVisible;
|
mCursorWasVisibleBeforeSuggestions = mCursorVisible;
|
||||||
setCursorVisible(false);
|
setCursorVisible(false);
|
||||||
|
mIsShowingUp = true;
|
||||||
super.show();
|
super.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11188,6 +11201,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void hideCursorControllers() {
|
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();
|
hideInsertionPointCursorController();
|
||||||
stopSelectionActionMode();
|
stopSelectionActionMode();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user