Merge "Removing unused app discovery support" into ub-launcher3-master
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index 9cc7973..bdc7c36 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -37,6 +37,4 @@
<!-- Launcher app transition -->
<dimen name="content_trans_y">25dp</dimen>
<dimen name="workspace_trans_y">80dp</dimen>
-
- <dimen name="shelf_min_value">-2.857dp</dimen>
</resources>
diff --git a/quickstep/src/com/android/launcher3/LauncherAppTransitionManager.java b/quickstep/src/com/android/launcher3/LauncherAppTransitionManager.java
index 256e926..47179c5 100644
--- a/quickstep/src/com/android/launcher3/LauncherAppTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/LauncherAppTransitionManager.java
@@ -16,7 +16,7 @@
package com.android.launcher3;
-import static com.android.launcher3.views.AllAppsScrim.SCRIM_PROGRESS;
+import static com.android.launcher3.allapps.AllAppsTransitionController.ALL_APPS_PROGRESS;
import static com.android.systemui.shared.recents.utilities.Utilities.getNextFrameNumber;
import static com.android.systemui.shared.recents.utilities.Utilities.getSurface;
import static com.android.systemui.shared.recents.utilities.Utilities.postAtFrontOfQueueAsynchronously;
@@ -40,9 +40,9 @@
import android.widget.ImageView;
import com.android.launcher3.InsettableFrameLayout.LayoutParams;
+import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.dragndrop.DragLayer;
-import com.android.launcher3.views.AllAppsScrim;
import com.android.systemui.shared.system.ActivityCompat;
import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.RemoteAnimationAdapterCompat;
@@ -62,14 +62,16 @@
private static final int CLOSING_TRANSITION_DURATION_MS = 350;
+ // Progress = 0: All apps is fully pulled up, Progress = 1: All apps is fully pulled down.
+ private static final float ALL_APPS_PROGRESS_START = 1.3059858f;
+ private static final float ALL_APPS_PROGRESS_SLIDE_END = 0.99581414f;
+
private final DragLayer mDragLayer;
private final Launcher mLauncher;
private final DeviceProfile mDeviceProfile;
private final float mContentTransY;
private final float mWorkspaceTransY;
- // The smallest y-value the shelf will reach on screen, before overshooting back down to 0.
- private final float mShelfMinValue;
private ImageView mFloatingView;
private boolean mIsRtl;
@@ -84,7 +86,6 @@
Resources res = launcher.getResources();
mContentTransY = res.getDimensionPixelSize(R.dimen.content_trans_y);
mWorkspaceTransY = res.getDimensionPixelSize(R.dimen.workspace_trans_y);
- mShelfMinValue = res.getDimensionPixelSize(R.dimen.shelf_min_value);
}
/**
@@ -477,31 +478,29 @@
workspaceAnimator.setDuration(333);
workspaceAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
- // Animate the shelf
- AllAppsScrim allAppsScrim = mLauncher.findViewById(R.id.all_apps_scrim);
- View hotseat = mLauncher.getHotseat();
- final float endY = mShelfMinValue;
- int startY = hotseat.getMeasuredHeight()
- + (allAppsScrim.getShadowBitmap().getHeight() / 2);
- hotseat.setTranslationY(startY);
- allAppsScrim.setTranslationY(startY);
+ // Animate the shelf in two parts: slide in, and overeshoot.
+ AllAppsTransitionController allAppsController = mLauncher.getAllAppsController();
+ // The shelf will start offscreen
+ final float startY = ALL_APPS_PROGRESS_START;
+ // And will end slightly pulled up, so that there is something to overshoot back to 1f.
+ final float slideEnd = ALL_APPS_PROGRESS_SLIDE_END;
- AnimatorSet hotseatSlideIn = new AnimatorSet();
- hotseatSlideIn.play(ObjectAnimator.ofFloat(hotseat, View.TRANSLATION_Y, startY, endY));
- hotseatSlideIn.play(ObjectAnimator.ofFloat(allAppsScrim, SCRIM_PROGRESS, startY, endY));
- hotseatSlideIn.setStartDelay(150);
- hotseatSlideIn.setDuration(317);
- hotseatSlideIn.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
+ allAppsController.setProgress(startY);
- AnimatorSet hotseatOvershoot = new AnimatorSet();
- hotseatOvershoot.play(ObjectAnimator.ofFloat(hotseat, View.TRANSLATION_Y, endY, 0));
- hotseatOvershoot.play(ObjectAnimator.ofFloat(allAppsScrim, SCRIM_PROGRESS, endY, 0));
- hotseatOvershoot.setDuration(153);
- hotseatOvershoot.setInterpolator(Interpolators.OVERSHOOT_0);
+ Animator allAppsSlideIn =
+ ObjectAnimator.ofFloat(allAppsController, ALL_APPS_PROGRESS, startY, slideEnd);
+ allAppsSlideIn.setStartDelay(150);
+ allAppsSlideIn.setDuration(317);
+ allAppsSlideIn.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
+
+ Animator allAppsOvershoot =
+ ObjectAnimator.ofFloat(allAppsController, ALL_APPS_PROGRESS, slideEnd, 1f);
+ allAppsOvershoot.setDuration(153);
+ allAppsOvershoot.setInterpolator(Interpolators.OVERSHOOT_0);
AnimatorSet resumeLauncherAnimation = new AnimatorSet();
resumeLauncherAnimation.play(workspaceAnimator);
- resumeLauncherAnimation.playSequentially(hotseatSlideIn, hotseatOvershoot);
+ resumeLauncherAnimation.playSequentially(allAppsSlideIn, allAppsOvershoot);
return resumeLauncherAnimation;
}
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/IgnoreTouchesInQuickScrub.java b/quickstep/src/com/android/launcher3/uioverrides/IgnoreTouchesInQuickScrub.java
new file mode 100644
index 0000000..92aa1fd
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/uioverrides/IgnoreTouchesInQuickScrub.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher3.uioverrides;
+
+import android.view.MotionEvent;
+
+import com.android.launcher3.Launcher;
+import com.android.launcher3.util.TouchController;
+import com.android.quickstep.QuickScrubController;
+import com.android.quickstep.RecentsView;
+
+/**
+ * Consumes touches when quick scrub is enabled.
+ */
+public class IgnoreTouchesInQuickScrub implements TouchController {
+
+ private QuickScrubController mQuickScrubController;
+
+ public IgnoreTouchesInQuickScrub(Launcher l) {
+ mQuickScrubController = ((RecentsView) l.getOverviewPanel()).getQuickScrubController();
+ }
+
+ @Override
+ public boolean onControllerTouchEvent(MotionEvent ev) {
+ return true;
+ }
+
+ @Override
+ public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
+ return mQuickScrubController.isQuickScrubEnabled();
+ }
+}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
index d086e74..e9d928c 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
@@ -38,12 +38,14 @@
public static TouchController[] createTouchControllers(Launcher launcher) {
if (FeatureFlags.ENABLE_TWO_SWIPE_TARGETS) {
- return new TouchController[]{
+ return new TouchController[] {
+ new IgnoreTouchesInQuickScrub(launcher),
new EdgeSwipeController(launcher),
new TwoStepSwipeController(launcher),
new OverviewSwipeController(launcher)};
} else {
- return new TouchController[]{
+ return new TouchController[] {
+ new IgnoreTouchesInQuickScrub(launcher),
new TwoStepSwipeController(launcher),
new OverviewSwipeController(launcher)};
}
diff --git a/quickstep/src/com/android/quickstep/QuickScrubController.java b/quickstep/src/com/android/quickstep/QuickScrubController.java
index f4c2055..d656f8a 100644
--- a/quickstep/src/com/android/quickstep/QuickScrubController.java
+++ b/quickstep/src/com/android/quickstep/QuickScrubController.java
@@ -40,6 +40,7 @@
private int mQuickScrubSection;
private int mStartPage;
+ private boolean mQuickScrubEnabled;
public QuickScrubController(Launcher launcher) {
mLauncher = launcher;
@@ -51,11 +52,14 @@
mRecentsView = mLauncher.getOverviewPanel();
mStartPage = startingFromHome ? 0 : mRecentsView.getFirstTaskIndex();
mQuickScrubSection = 0;
+ mQuickScrubEnabled = true;
}
public void onQuickScrubEnd() {
mAutoAdvanceAlarm.cancelAlarm();
- if (mRecentsView != null) {
+ if (mRecentsView == null) {
+ mQuickScrubEnabled = false;
+ } else {
int page = mRecentsView.getNextPage();
// Settle on the page then launch it.
int snapDuration = Math.abs(page - mRecentsView.getPageNearestToCenterOfScreen())
@@ -67,10 +71,15 @@
} else {
((TaskView) mRecentsView.getPageAt(page)).launchTask(true);
}
+ mQuickScrubEnabled = false;
}, snapDuration);
}
}
+ public boolean isQuickScrubEnabled() {
+ return mQuickScrubEnabled;
+ }
+
public void onQuickScrubProgress(float progress) {
int quickScrubSection = Math.round(progress * NUM_QUICK_SCRUB_SECTIONS);
if (quickScrubSection != mQuickScrubSection) {
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index c02f2df..dadc6cd 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -37,8 +37,8 @@
public class AllAppsTransitionController
implements SearchUiManager.OnScrollRangeChangeListener, LauncherStateManager.StateHandler {
- private static final Property<AllAppsTransitionController, Float> PROGRESS =
- new Property<AllAppsTransitionController, Float>(Float.class, "progress") {
+ public static final Property<AllAppsTransitionController, Float> ALL_APPS_PROGRESS =
+ new Property<AllAppsTransitionController, Float>(Float.class, "allAppsProgress") {
@Override
public Float get(AllAppsTransitionController controller) {
@@ -164,7 +164,8 @@
}
Interpolator interpolator = config.userControlled ? LINEAR : FAST_OUT_SLOW_IN;
- ObjectAnimator anim = ObjectAnimator.ofFloat(this, PROGRESS, mProgress, targetProgress);
+ ObjectAnimator anim =
+ ObjectAnimator.ofFloat(this, ALL_APPS_PROGRESS, mProgress, targetProgress);
anim.setDuration(config.duration);
anim.setInterpolator(interpolator);
anim.addListener(getProgressAnimatorListener());
diff --git a/src/com/android/launcher3/views/AllAppsScrim.java b/src/com/android/launcher3/views/AllAppsScrim.java
index 6cd40fd..662f99c 100644
--- a/src/com/android/launcher3/views/AllAppsScrim.java
+++ b/src/com/android/launcher3/views/AllAppsScrim.java
@@ -61,25 +61,11 @@
private final NinePatchDrawHelper mShadowHelper = new NinePatchDrawHelper();
- private float mProgress;
private int mFillAlpha;
private float mDrawHeight;
private float mDrawOffsetY;
- public static final Property<AllAppsScrim, Float> SCRIM_PROGRESS =
- new Property<AllAppsScrim, Float>(Float.class, "allAppsScrimProgress") {
- @Override
- public Float get(AllAppsScrim allAppsScrim) {
- return allAppsScrim.getProgress();
- }
-
- @Override
- public void set(AllAppsScrim allAppsScrim, Float progress) {
- allAppsScrim.setProgress(progress);
- }
- };
-
public AllAppsScrim(Context context) {
this(context, null);
}
@@ -174,23 +160,17 @@
public void setProgress(float translateY, float alpha) {
int newAlpha = Math.round(alpha * mAlphaRange + mMinAlpha);
- if (newAlpha != mFillAlpha) {
- mFillAlpha = newAlpha;
- mFillPaint.setAlpha(mFillAlpha);
- invalidateDrawRect();
- }
-
- setProgress(translateY);
- }
-
- public void setProgress(float translateY) {
// Negative translation means the scrim is moving up. For negative translation, we change
// draw offset as it requires redraw (since more area of the scrim needs to be shown). For
// position translation, we simply translate the scrim down as it avoids invalidate and
// hence could be optimized by the platform.
float drawOffsetY = Math.min(translateY, 0);
- if (drawOffsetY != mDrawOffsetY) {
+ if (newAlpha != mFillAlpha || drawOffsetY != mDrawOffsetY) {
+ invalidateDrawRect();
+
+ mFillAlpha = newAlpha;
+ mFillPaint.setAlpha(mFillAlpha);
mDrawOffsetY = drawOffsetY;
invalidateDrawRect();
}
@@ -198,10 +178,6 @@
setTranslationY(Math.max(translateY, 0));
}
- public float getProgress() {
- return mProgress;
- }
-
private void invalidateDrawRect() {
mDrawRect.top = (int) (getHeight()
+ mDrawOffsetY - mDrawHeight + mPadding.top - mShadowBlur - 0.5f);