Merge "Stop text selection mode when new text replaces selection." into honeycomb
This commit is contained in:
committed by
Android (Google) Code Review
commit
b3fbd7e0fd
@ -4780,7 +4780,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
hideControllers();
|
hideControllers();
|
||||||
stopSelectionActionMode();
|
|
||||||
|
|
||||||
switch (keyCode) {
|
switch (keyCode) {
|
||||||
case KeyEvent.KEYCODE_DPAD_CENTER:
|
case KeyEvent.KEYCODE_DPAD_CENTER:
|
||||||
@ -5119,6 +5118,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
if (mInputMethodState != null) {
|
if (mInputMethodState != null) {
|
||||||
mInputMethodState.mExtracting = req;
|
mInputMethodState.mExtracting = req;
|
||||||
}
|
}
|
||||||
|
// This stops a possible text selection mode. Maybe not intended.
|
||||||
hideControllers();
|
hideControllers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6781,7 +6781,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
sendOnTextChanged(buffer, start, before, after);
|
sendOnTextChanged(buffer, start, before, after);
|
||||||
onTextChanged(buffer, start, before, after);
|
onTextChanged(buffer, start, before, after);
|
||||||
|
|
||||||
// Hide the controller if the amount of content changed
|
// Hide the controllers if the amount of content changed
|
||||||
if (before != after) {
|
if (before != after) {
|
||||||
hideControllers();
|
hideControllers();
|
||||||
}
|
}
|
||||||
@ -8207,9 +8207,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
selectCurrentWord();
|
selectCurrentWord();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!mTextIsSelectable) {
|
||||||
|
// Show the IME, except when selection non editable text.
|
||||||
final InputMethodManager imm = (InputMethodManager)
|
final InputMethodManager imm = (InputMethodManager)
|
||||||
getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
imm.showSoftInput(this, 0, null);
|
imm.showSoftInput(this, 0, null);
|
||||||
|
}
|
||||||
|
|
||||||
ActionMode.Callback actionModeCallback = new SelectionActionModeCallback();
|
ActionMode.Callback actionModeCallback = new SelectionActionModeCallback();
|
||||||
mSelectionActionMode = startActionMode(actionModeCallback);
|
mSelectionActionMode = startActionMode(actionModeCallback);
|
||||||
@ -8233,6 +8236,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
|
|
||||||
private void stopSelectionActionMode() {
|
private void stopSelectionActionMode() {
|
||||||
if (mSelectionActionMode != null) {
|
if (mSelectionActionMode != null) {
|
||||||
|
// This will hide the mSelectionModifierCursorController
|
||||||
mSelectionActionMode.finish();
|
mSelectionActionMode.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8356,8 +8360,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
if (mCustomSelectionActionModeCallback != null) {
|
if (mCustomSelectionActionModeCallback != null) {
|
||||||
mCustomSelectionActionModeCallback.onDestroyActionMode(mode);
|
mCustomSelectionActionModeCallback.onDestroyActionMode(mode);
|
||||||
}
|
}
|
||||||
Selection.setSelection((Spannable) mText, getSelectionStart());
|
Selection.setSelection((Spannable) mText, getSelectionEnd());
|
||||||
hideSelectionModifierCursorController();
|
|
||||||
|
if (mSelectionModifierCursorController != null) {
|
||||||
|
mSelectionModifierCursorController.hide();
|
||||||
|
}
|
||||||
|
|
||||||
mSelectionActionMode = null;
|
mSelectionActionMode = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9173,16 +9181,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideSelectionModifierCursorController() {
|
/**
|
||||||
// No need to create the controller to hide it.
|
* Hides the insertion controller and stops text selection mode, hiding the selection controller
|
||||||
if (mSelectionModifierCursorController != null) {
|
*/
|
||||||
mSelectionModifierCursorController.hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void hideControllers() {
|
private void hideControllers() {
|
||||||
hideInsertionPointCursorController();
|
hideInsertionPointCursorController();
|
||||||
hideSelectionModifierCursorController();
|
stopSelectionActionMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user