Merge "Fix crash during TextView.onCreateContextMenu" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
58df6ab93f
@@ -2584,14 +2584,18 @@ public class Editor {
|
|||||||
if (offset == -1) {
|
if (offset == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
stopTextActionModeWithPreservingSelection();
|
stopTextActionModeWithPreservingSelection();
|
||||||
final boolean isOnSelection = mTextView.hasSelection()
|
if (mTextView.canSelectText()) {
|
||||||
&& offset >= mTextView.getSelectionStart() && offset <= mTextView.getSelectionEnd();
|
final boolean isOnSelection = mTextView.hasSelection()
|
||||||
if (!isOnSelection) {
|
&& offset >= mTextView.getSelectionStart()
|
||||||
// Right clicked position is not on the selection. Remove the selection and move the
|
&& offset <= mTextView.getSelectionEnd();
|
||||||
// cursor to the right clicked position.
|
if (!isOnSelection) {
|
||||||
Selection.setSelection((Spannable) mTextView.getText(), offset);
|
// Right clicked position is not on the selection. Remove the selection and move the
|
||||||
stopTextActionMode();
|
// cursor to the right clicked position.
|
||||||
|
Selection.setSelection((Spannable) mTextView.getText(), offset);
|
||||||
|
stopTextActionMode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldOfferToShowSuggestions()) {
|
if (shouldOfferToShowSuggestions()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user