This enables to slide up All Apps from anywhere in the workspace,

not only over the hotseat.

The tricky part handling with scrollable widgets is solved by
setting requestDisallowInterceptTouchEvent from within the
widget view host (and resetting it upon performing long click).

Change-Id: I8b60e7ea2c1e8ae830b4737e94ed2d796265fa24
This commit is contained in:
Mario Bertschler
2017-01-04 16:31:57 -08:00
parent 2c3194e879
commit cd0f679030
3 changed files with 47 additions and 36 deletions

View File

@@ -18,15 +18,12 @@ import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Hotseat;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
import com.android.launcher3.shortcuts.DeepShortcutsContainer;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.util.TouchController;
@@ -88,7 +85,6 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
private static final float RECATCH_REJECTION_FRACTION = .0875f;
private int mBezelSwipeUpHeight;
private long mAnimationDuration;
private AnimatorSet mCurrentAnimation;
@@ -104,8 +100,6 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
mDetector.setListener(this);
mShiftRange = DEFAULT_SHIFT_RANGE;
mProgress = 1f;
mBezelSwipeUpHeight = l.getResources().getDimensionPixelSize(
R.dimen.all_apps_bezel_swipe_height);
mEvaluator = new ArgbEvaluator();
mAllAppsBackgroundColor = ContextCompat.getColor(l, R.color.all_apps_container_color);
@@ -120,8 +114,6 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
} else if (mLauncher.isAllAppsVisible() &&
!mAppsView.shouldContainerScroll(ev)) {
mNoIntercept = true;
} else if (!mLauncher.isAllAppsVisible() && !shouldPossiblyIntercept(ev)) {
mNoIntercept = true;
} else if (AbstractFloatingView.getTopOpenView(mLauncher) != null) {
mNoIntercept = true;
} else {
@@ -150,6 +142,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
ignoreSlopWhenSettling);
}
}
if (mNoIntercept) {
return false;
}
@@ -160,25 +153,6 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
return mDetector.isDraggingOrSettling();
}
private boolean shouldPossiblyIntercept(MotionEvent ev) {
DeviceProfile grid = mLauncher.getDeviceProfile();
if (mDetector.isIdleState()) {
if (grid.isVerticalBarLayout()) {
if (ev.getY() > mLauncher.getDeviceProfile().heightPx - mBezelSwipeUpHeight) {
return true;
}
} else {
if (mLauncher.getDragLayer().isEventOverHotseat(ev) ||
mLauncher.getDragLayer().isEventOverPageIndicator(ev)) {
return true;
}
}
return false;
} else {
return true;
}
}
@Override
public boolean onControllerTouchEvent(MotionEvent ev) {
return mDetector.onTouchEvent(ev);