Loading core/java/android/widget/TextView.java +56 −55 Original line number Diff line number Diff line Loading @@ -8923,13 +8923,26 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener TextView.this.requestFocus(); return true; case DragEvent.ACTION_DRAG_LOCATION: { case DragEvent.ACTION_DRAG_LOCATION: final int offset = getOffset((int) event.getX(), (int) event.getY()); Selection.setSelection((Spannable)mText, offset); return true; case DragEvent.ACTION_DROP: onDrop(event); return true; case DragEvent.ACTION_DRAG_ENDED: mDragSourcePositions = -1; return true; case DragEvent.ACTION_DRAG_EXITED: default: return true; } } case DragEvent.ACTION_DROP: { private void onDrop(DragEvent event) { StringBuilder content = new StringBuilder(""); ClipData clipData = event.getClipData(); final int itemCount = clipData.getItemCount(); Loading @@ -8945,7 +8958,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener final int dragSourceEnd = extractRangeEndFromLong(mDragSourcePositions); if (offset >= dragSourceStart && offset < dragSourceEnd) { // A drop inside the original selection discards the drop. return true; return; } } Loading Loading @@ -8980,18 +8993,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener ((Editable) mText).delete(pos, pos + 1); } } return true; } case DragEvent.ACTION_DRAG_ENDED: mDragSourcePositions = -1; return true; case DragEvent.ACTION_DRAG_EXITED: default: return true; } } /** Loading Loading
core/java/android/widget/TextView.java +56 −55 Original line number Diff line number Diff line Loading @@ -8923,13 +8923,26 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener TextView.this.requestFocus(); return true; case DragEvent.ACTION_DRAG_LOCATION: { case DragEvent.ACTION_DRAG_LOCATION: final int offset = getOffset((int) event.getX(), (int) event.getY()); Selection.setSelection((Spannable)mText, offset); return true; case DragEvent.ACTION_DROP: onDrop(event); return true; case DragEvent.ACTION_DRAG_ENDED: mDragSourcePositions = -1; return true; case DragEvent.ACTION_DRAG_EXITED: default: return true; } } case DragEvent.ACTION_DROP: { private void onDrop(DragEvent event) { StringBuilder content = new StringBuilder(""); ClipData clipData = event.getClipData(); final int itemCount = clipData.getItemCount(); Loading @@ -8945,7 +8958,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener final int dragSourceEnd = extractRangeEndFromLong(mDragSourcePositions); if (offset >= dragSourceStart && offset < dragSourceEnd) { // A drop inside the original selection discards the drop. return true; return; } } Loading Loading @@ -8980,18 +8993,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener ((Editable) mText).delete(pos, pos + 1); } } return true; } case DragEvent.ACTION_DRAG_ENDED: mDragSourcePositions = -1; return true; case DragEvent.ACTION_DRAG_EXITED: default: return true; } } /** Loading