Merge "Updating some icons" into ub-launcher3-master
diff --git a/quickstep/src/com/android/launcher3/uioverrides/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/PortraitStatesTouchController.java
index 1e006e5..7d9cce4 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/PortraitStatesTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/PortraitStatesTouchController.java
@@ -207,6 +207,14 @@
@Override
protected void updateSwipeCompleteAnimation(ValueAnimator animator, long expectedDuration,
LauncherState targetState, float velocity, boolean isFling) {
+ handleFirstSwipeToOverview(animator, expectedDuration, targetState, velocity, isFling);
+ super.updateSwipeCompleteAnimation(animator, expectedDuration, targetState,
+ velocity, isFling);
+ }
+
+ private void handleFirstSwipeToOverview(final ValueAnimator animator,
+ final long expectedDuration, final LauncherState targetState, final float velocity,
+ final boolean isFling) {
if (mFromState == NORMAL && mToState == OVERVIEW && targetState == OVERVIEW) {
mFinishFastOnSecondTouch = true;
@@ -220,7 +228,7 @@
// TODO: Clean up these magic calculations
// Linearly interpolate the max value based on the velocity.
float maxValue = Math.max(absVelocity > 4 ? 1 + MAX_OVERSHOOT :
- 1 + (absVelocity - 1) * MAX_OVERSHOOT / 3,
+ 1 + (absVelocity - 1) * MAX_OVERSHOOT / 3,
currentValue);
double angleToPeak = PI_BY_2 - Math.asin(currentValue / maxValue);
@@ -248,8 +256,6 @@
if (currentFraction < LINEAR_SCALE_LIMIT) {
mAllAppsInterpolatorWrapper.baseInterpolator = LINEAR;
- super.updateSwipeCompleteAnimation(animator, expectedDuration, targetState,
- velocity, isFling);
return;
}
float extraValue = mAllAppsDampedInterpolator.getInterpolation(currentFraction) - 1;
@@ -267,8 +273,6 @@
return;
}
mFinishFastOnSecondTouch = false;
- super.updateSwipeCompleteAnimation(animator, expectedDuration, targetState,
- velocity, isFling);
}
@Override
diff --git a/quickstep/src/com/android/quickstep/QuickScrubController.java b/quickstep/src/com/android/quickstep/QuickScrubController.java
index d868d12..275fd29 100644
--- a/quickstep/src/com/android/quickstep/QuickScrubController.java
+++ b/quickstep/src/com/android/quickstep/QuickScrubController.java
@@ -38,9 +38,14 @@
public static final int QUICK_SCRUB_START_DURATION = 210;
+ /**
+ * Snap to a new page when crossing these thresholds. The first and last auto-advance.
+ */
+ private static final float[] QUICK_SCRUB_THRESHOLDS = new float[] {
+ 0.05f, 0.35f, 0.65f, 0.95f
+ };
+
private static final boolean ENABLE_AUTO_ADVANCE = true;
- private static final int NUM_QUICK_SCRUB_SECTIONS = 3;
- private static final long INITIAL_AUTO_ADVANCE_DELAY = 1000;
private static final long AUTO_ADVANCE_DELAY = 500;
private static final int QUICKSCRUB_SNAP_DURATION_PER_PAGE = 325;
private static final int QUICKSCRUB_END_SNAP_DURATION_PER_PAGE = 60;
@@ -52,7 +57,6 @@
private boolean mInQuickScrub;
private int mQuickScrubSection;
private boolean mStartedFromHome;
- private boolean mHasAlarmRun;
private boolean mFinishedTransitionToQuickScrub;
public QuickScrubController(BaseActivity activity, RecentsView recentsView) {
@@ -68,7 +72,6 @@
mInQuickScrub = true;
mStartedFromHome = startingFromHome;
mQuickScrubSection = 0;
- mHasAlarmRun = false;
mFinishedTransitionToQuickScrub = false;
snapToNextTaskIfAvailable();
@@ -105,16 +108,23 @@
}
public void onQuickScrubProgress(float progress) {
- int quickScrubSection = Math.round(progress * NUM_QUICK_SCRUB_SECTIONS);
+ int quickScrubSection = 0;
+ for (float threshold : QUICK_SCRUB_THRESHOLDS) {
+ if (progress < threshold) {
+ break;
+ }
+ quickScrubSection++;
+ }
if (quickScrubSection != mQuickScrubSection) {
+ boolean cameFromAutoAdvance = mQuickScrubSection == QUICK_SCRUB_THRESHOLDS.length
+ || mQuickScrubSection == 0;
int pageToGoTo = mRecentsView.getNextPage() + quickScrubSection - mQuickScrubSection;
- if (mFinishedTransitionToQuickScrub) {
+ if (mFinishedTransitionToQuickScrub && !cameFromAutoAdvance) {
goToPageWithHaptic(pageToGoTo);
}
if (ENABLE_AUTO_ADVANCE) {
- if (quickScrubSection == NUM_QUICK_SCRUB_SECTIONS || quickScrubSection == 0) {
- mAutoAdvanceAlarm.setAlarm(mHasAlarmRun
- ? AUTO_ADVANCE_DELAY : INITIAL_AUTO_ADVANCE_DELAY);
+ if (quickScrubSection == QUICK_SCRUB_THRESHOLDS.length || quickScrubSection == 0) {
+ mAutoAdvanceAlarm.setAlarm(AUTO_ADVANCE_DELAY);
} else {
mAutoAdvanceAlarm.cancelAlarm();
}
@@ -148,13 +158,12 @@
@Override
public void onAlarm(Alarm alarm) {
int currPage = mRecentsView.getNextPage();
- if (mQuickScrubSection == NUM_QUICK_SCRUB_SECTIONS
+ if (mQuickScrubSection == QUICK_SCRUB_THRESHOLDS.length
&& currPage < mRecentsView.getPageCount() - 1) {
goToPageWithHaptic(currPage + 1);
} else if (mQuickScrubSection == 0 && currPage > 0) {
goToPageWithHaptic(currPage - 1);
}
- mHasAlarmRun = true;
if (ENABLE_AUTO_ADVANCE) {
mAutoAdvanceAlarm.setAlarm(AUTO_ADVANCE_DELAY);
}
diff --git a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
index 25f2f87..98597c8 100644
--- a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -749,6 +749,10 @@
}
private void setupLauncherUiAfterSwipeUpAnimation() {
+ if (mLauncherTransitionController != null) {
+ mLauncherTransitionController.getAnimationPlayer().end();
+ mLauncherTransitionController = null;
+ }
mActivityControlHelper.onSwipeUpComplete(mActivity);
// Animate the first icon.
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index bac8fc7..6fb8a36 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -46,6 +46,7 @@
import android.util.SparseBooleanArray;
import android.view.KeyEvent;
import android.view.LayoutInflater;
+import android.view.MotionEvent;
import android.view.View;
import android.view.ViewDebug;
@@ -275,6 +276,13 @@
}
}
+ @Override
+ public boolean onTouchEvent(MotionEvent ev) {
+ super.onTouchEvent(ev);
+ // Do not let touch escape to siblings below this view.
+ return true;
+ }
+
private void applyLoadPlan(RecentsTaskLoadPlan loadPlan) {
if (mPendingAnimation != null) {
mPendingAnimation.addEndListener((b) -> applyLoadPlan(loadPlan));
diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
index 1a63326..baf6d87 100644
--- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java
+++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
@@ -16,9 +16,12 @@
package com.android.launcher3;
+import static android.view.MotionEvent.ACTION_DOWN;
+
import android.app.WallpaperManager;
import android.content.Context;
import android.graphics.Rect;
+import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
@@ -174,6 +177,15 @@
}
@Override
+ public boolean onInterceptTouchEvent(MotionEvent ev) {
+ if (ev.getAction() == ACTION_DOWN && getAlpha() == 0) {
+ // Dont let children handle touch, if we are not visible.
+ return true;
+ }
+ return super.onInterceptTouchEvent(ev);
+ }
+
+ @Override
public boolean shouldDelayChildPressedState() {
return false;
}