Merge "Fix bug where workspace taps were not being sent to WallpaperManager." into ub-launcher3-edmonton
This commit is contained in:
commit
ad007ba9f1
|
@ -477,7 +477,7 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
|||
super.onViewAdded(child);
|
||||
}
|
||||
|
||||
boolean isTouchActive() {
|
||||
public boolean isTouchActive() {
|
||||
return mTouchState != TOUCH_STATE_REST;
|
||||
}
|
||||
|
||||
|
@ -974,19 +974,9 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
|||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
switch (ev.getAction() & MotionEvent.ACTION_MASK) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
if (ev.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||
mXDown = ev.getX();
|
||||
mYDown = ev.getY();
|
||||
break;
|
||||
case MotionEvent.ACTION_POINTER_UP:
|
||||
case MotionEvent.ACTION_UP:
|
||||
if (mTouchState == TOUCH_STATE_REST) {
|
||||
final CellLayout currentPage = (CellLayout) getChildAt(mCurrentPage);
|
||||
if (currentPage != null) {
|
||||
onWallpaperTap(ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
}
|
||||
|
@ -1443,7 +1433,7 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
|||
}
|
||||
}
|
||||
|
||||
protected void onWallpaperTap(MotionEvent ev) {
|
||||
public void onWallpaperTap(MotionEvent ev) {
|
||||
final int[] position = mTempXY;
|
||||
getLocationOnScreen(position);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ package com.android.launcher3.touch;
|
|||
|
||||
import static android.view.MotionEvent.ACTION_CANCEL;
|
||||
import static android.view.MotionEvent.ACTION_DOWN;
|
||||
import static android.view.MotionEvent.ACTION_POINTER_UP;
|
||||
import static android.view.MotionEvent.ACTION_UP;
|
||||
import static android.view.ViewConfiguration.getLongPressTimeout;
|
||||
|
||||
|
@ -30,6 +31,7 @@ import android.view.View;
|
|||
import android.view.View.OnTouchListener;
|
||||
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.CellLayout;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.Workspace;
|
||||
|
@ -121,6 +123,17 @@ public class WorkspaceTouchListener implements OnTouchListener, Runnable {
|
|||
// We don't want to handle touch, let workspace handle it as usual.
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (action == ACTION_UP || action == ACTION_POINTER_UP) {
|
||||
if (!mWorkspace.isTouchActive()) {
|
||||
final CellLayout currentPage =
|
||||
(CellLayout) mWorkspace.getChildAt(mWorkspace.getCurrentPage());
|
||||
if (currentPage != null) {
|
||||
mWorkspace.onWallpaperTap(ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (action == ACTION_UP || action == ACTION_CANCEL) {
|
||||
cancelLongPress();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue