Merge "Bug 5254884: suggestions are no logner copied in the clipboard"
This commit is contained in:
committed by
Android (Google) Code Review
commit
5b92a451c0
@@ -9192,19 +9192,23 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case ID_CUT:
|
case ID_CUT:
|
||||||
setPrimaryClip(ClipData.newPlainText(null, mTransformed.subSequence(min, max)));
|
setPrimaryClip(ClipData.newPlainText(null, getTransformedText(min, max)));
|
||||||
((Editable) mText).delete(min, max);
|
((Editable) mText).delete(min, max);
|
||||||
stopSelectionActionMode();
|
stopSelectionActionMode();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case ID_COPY:
|
case ID_COPY:
|
||||||
setPrimaryClip(ClipData.newPlainText(null, mTransformed.subSequence(min, max)));
|
setPrimaryClip(ClipData.newPlainText(null, getTransformedText(min, max)));
|
||||||
stopSelectionActionMode();
|
stopSelectionActionMode();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CharSequence getTransformedText(int start, int end) {
|
||||||
|
return removeSuggestionSpans(mTransformed.subSequence(start, end));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare text so that there are not zero or two spaces at beginning and end of region defined
|
* Prepare text so that there are not zero or two spaces at beginning and end of region defined
|
||||||
* by [min, max] when replacing this region by paste.
|
* by [min, max] when replacing this region by paste.
|
||||||
@@ -9321,7 +9325,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
// Start a drag
|
// Start a drag
|
||||||
final int start = getSelectionStart();
|
final int start = getSelectionStart();
|
||||||
final int end = getSelectionEnd();
|
final int end = getSelectionEnd();
|
||||||
CharSequence selectedText = mTransformed.subSequence(start, end);
|
CharSequence selectedText = getTransformedText(start, end);
|
||||||
ClipData data = ClipData.newPlainText(null, selectedText);
|
ClipData data = ClipData.newPlainText(null, selectedText);
|
||||||
DragLocalState localState = new DragLocalState(this, start, end);
|
DragLocalState localState = new DragLocalState(this, start, end);
|
||||||
startDrag(data, getTextThumbnailBuilder(selectedText), localState, 0);
|
startDrag(data, getTextThumbnailBuilder(selectedText), localState, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user