Add selection handle dragging tests.
- Set an id for each HandleView to access the hanlde. - Rename DragOnTextViewActions to DragAction to use it for dragging handles. - Introduce HandleCoordinates to provide proper coordinates for handles. More tests will be added in following CLs. Bug: 25730231 Change-Id: I9276bf2f983983ec9aae0ddcf674d3dcee566892
This commit is contained in:
@@ -3494,7 +3494,8 @@ public class Editor {
|
||||
}
|
||||
}
|
||||
|
||||
private abstract class HandleView extends View implements TextViewPositionListener {
|
||||
@VisibleForTesting
|
||||
public abstract class HandleView extends View implements TextViewPositionListener {
|
||||
protected Drawable mDrawable;
|
||||
protected Drawable mDrawableLtr;
|
||||
protected Drawable mDrawableRtl;
|
||||
@@ -3525,8 +3526,9 @@ public class Editor {
|
||||
// a different line.
|
||||
protected int mPreviousLineTouched = UNSET_LINE;
|
||||
|
||||
public HandleView(Drawable drawableLtr, Drawable drawableRtl) {
|
||||
private HandleView(Drawable drawableLtr, Drawable drawableRtl, final int id) {
|
||||
super(mTextView.getContext());
|
||||
setId(id);
|
||||
mContainer = new PopupWindow(mTextView.getContext(), null,
|
||||
com.android.internal.R.attr.textSelectHandleWindowStyle);
|
||||
mContainer.setSplitTouchEnabled(true);
|
||||
@@ -3888,7 +3890,7 @@ public class Editor {
|
||||
private Runnable mHider;
|
||||
|
||||
public InsertionHandleView(Drawable drawable) {
|
||||
super(drawable, drawable);
|
||||
super(drawable, drawable, com.android.internal.R.id.insertion_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -4073,7 +4075,7 @@ public class Editor {
|
||||
private final int[] mTextViewLocation = new int[2];
|
||||
|
||||
public SelectionStartHandleView(Drawable drawableLtr, Drawable drawableRtl) {
|
||||
super(drawableLtr, drawableRtl);
|
||||
super(drawableLtr, drawableRtl, com.android.internal.R.id.selection_start_handle);
|
||||
ViewConfiguration viewConfiguration = ViewConfiguration.get(
|
||||
mTextView.getContext());
|
||||
mTextViewEdgeSlop = viewConfiguration.getScaledTouchSlop() * 4;
|
||||
@@ -4313,7 +4315,7 @@ public class Editor {
|
||||
private final int[] mTextViewLocation = new int[2];
|
||||
|
||||
public SelectionEndHandleView(Drawable drawableLtr, Drawable drawableRtl) {
|
||||
super(drawableLtr, drawableRtl);
|
||||
super(drawableLtr, drawableRtl, com.android.internal.R.id.selection_end_handle);
|
||||
ViewConfiguration viewConfiguration = ViewConfiguration.get(
|
||||
mTextView.getContext());
|
||||
mTextViewEdgeSlop = viewConfiguration.getScaledTouchSlop() * 4;
|
||||
|
||||
Reference in New Issue
Block a user