mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 09:56:49 +00:00
Fix TaskViewTouchController crash in seascape
Previously, we were using scroll direction POSITIVE as a catch all to mean "up" but in seascape, we actually want NEGATIVE. Added getUpDirection() to capture that. Tried to clarify the code a bit by putting all the methods used solely by TaskViewTouchController together with documentation. It's still pretty confusing and feels redundant, but couldn't think of an obvious way to simplify. Test: Swipe up and down on a task in all permutations of: - 3 button mode - Gesture navigation - Portrait - Landscape - Seascape - LTR - RTL - Home rotation allowed - Home rotation disallowed Fixes: 174009771 Fixes: 173567204 Change-Id: Id0f8d6f4365d888eb46182d8544d18206795dfb8
This commit is contained in:
@@ -72,12 +72,6 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
out.screenCenter = insets.left + view.getPaddingLeft() + out.scroll + out.halfPageSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGoingUp(float displacement, boolean isRtl) {
|
||||
// Ignore rtl since it only affects X value displacement, Y displacement doesn't change
|
||||
return displacement < 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLayoutNaturalToLauncher() {
|
||||
return true;
|
||||
@@ -211,11 +205,6 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
return view.getWidth() - view.getPaddingRight() - insets.right;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleAxisSwipeDetector.Direction getOppositeSwipeDirection() {
|
||||
return VERTICAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPrimaryTranslationDirectionFactor() {
|
||||
return 1;
|
||||
@@ -225,12 +214,6 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTaskDragDisplacementFactor(boolean isRtl) {
|
||||
// Ignore rtl since it only affects X value displacement, Y displacement doesn't change
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTaskMenuX(float x, View thumbnailView) {
|
||||
return x;
|
||||
@@ -257,6 +240,33 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
// no-op, defaults are fine
|
||||
}
|
||||
|
||||
/* ---------- The following are only used by TaskViewTouchHandler. ---------- */
|
||||
|
||||
@Override
|
||||
public SingleAxisSwipeDetector.Direction getUpDownSwipeDirection() {
|
||||
return VERTICAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUpDirection(boolean isRtl) {
|
||||
// Ignore rtl since it only affects X value displacement, Y displacement doesn't change
|
||||
return SingleAxisSwipeDetector.DIRECTION_POSITIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGoingUp(float displacement, boolean isRtl) {
|
||||
// Ignore rtl since it only affects X value displacement, Y displacement doesn't change
|
||||
return displacement < 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTaskDragDisplacementFactor(boolean isRtl) {
|
||||
// Ignore rtl since it only affects X value displacement, Y displacement doesn't change
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* -------------------- */
|
||||
|
||||
@Override
|
||||
public ChildBounds getChildBounds(View child, int childStart, int pageCenter,
|
||||
boolean layoutChild) {
|
||||
|
||||
Reference in New Issue
Block a user