Fixing broken accessibility drag

> Allow touch events on hotseat while in accessible drag as drag now
happens in spring loaded state.
> Allow drop target buttons to ignore thershold check when in
accessibility drag

Bug: 30900444
Change-Id: I88274367983fc027b2ddde3a719ca943f4f48587
(cherry picked from commit 4583d09c05)
This commit is contained in:
Sunny Goyal
2016-08-17 11:11:48 -07:00
parent def6e474da
commit 9be9936653
2 changed files with 8 additions and 7 deletions
@@ -62,6 +62,8 @@ public abstract class ButtonDropTarget extends TextView
/** Whether this drop target is active for the current drag */ /** Whether this drop target is active for the current drag */
protected boolean mActive; protected boolean mActive;
/** Whether an accessible drag is in progress */
private boolean mAccessibleDrag;
/** An item must be dragged at least this many pixels before this drop target is enabled. */ /** An item must be dragged at least this many pixels before this drop target is enabled. */
private final int mDragDistanceThreshold; private final int mDragDistanceThreshold;
@@ -218,8 +220,8 @@ public abstract class ButtonDropTarget extends TextView
@Override @Override
public boolean isDropEnabled() { public boolean isDropEnabled() {
return mActive return mActive && (mAccessibleDrag ||
&& mLauncher.getDragController().getDistanceDragged() >= mDragDistanceThreshold; mLauncher.getDragController().getDistanceDragged() >= mDragDistanceThreshold);
} }
@Override @Override
@@ -307,6 +309,7 @@ public abstract class ButtonDropTarget extends TextView
} }
public void enableAccessibleDrag(boolean enable) { public void enableAccessibleDrag(boolean enable) {
mAccessibleDrag = enable;
setOnClickListener(enable ? this : null); setOnClickListener(enable ? this : null);
} }
+3 -5
View File
@@ -165,11 +165,9 @@ public class Hotseat extends FrameLayout
@Override @Override
public boolean onInterceptTouchEvent(MotionEvent ev) { public boolean onInterceptTouchEvent(MotionEvent ev) {
// We don't want any clicks to go through to the hotseat unless the workspace is in // We don't want any clicks to go through to the hotseat unless the workspace is in
// the normal state. // the normal state or an accessible drag is in progress.
if (mLauncher.getWorkspace().workspaceInModalState()) { return mLauncher.getWorkspace().workspaceInModalState() &&
return true; !mLauncher.getAccessibilityDelegate().isInAccessibleDrag();
}
return false;
} }
@Override @Override