Fixes around extract mode

Stop selection mode after Edit/Copy while in extracted mode.

The selection mode was started by a long press in the ExtractedEditText.
Selection Copy in the menu simply sends the id to the context menu.
SelectionMode is not stopped in the underlying text since it was not
started there. Stop it directly in the ExtractedEditText.

Cut and paste do stop the mode because the text is modified.

Change-Id: Id7dbfa99de404c4eb85ced9627c99af4895ac628
This commit is contained in:
Gilles Debunne
2012-01-13 15:26:05 -08:00
parent ade3289bee
commit 14568c3f76
2 changed files with 9 additions and 5 deletions

View File

@ -100,6 +100,9 @@ public class ExtractEditText extends EditText {
@Override public boolean onTextContextMenuItem(int id) {
if (mIME != null && mIME.onExtractTextContextMenuItem(id)) {
// Mode was started on Extracted, needs to be stopped here.
// Cut and paste will change the text, which stops selection mode.
if (id == android.R.id.copy) stopSelectionActionMode();
return true;
}
return super.onTextContextMenuItem(id);

View File

@ -5254,10 +5254,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
state.handleUpEvent(event);
}
if (event.isTracking() && !event.isCanceled()) {
if (isInSelectionMode) {
stopSelectionActionMode();
return true;
}
stopSelectionActionMode();
return true;
}
}
}
@ -10158,7 +10156,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
return false;
}
private void stopSelectionActionMode() {
/**
* @hide
*/
protected void stopSelectionActionMode() {
if (mSelectionActionMode != null) {
// This will hide the mSelectionModifierCursorController
mSelectionActionMode.finish();