Launcher app close transition.
Bug: 70220260
Change-Id: I0a3a6153dc1cba53546f792bf3ec037b1a5f6d90
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 32342b2..3d5b7d1 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -403,6 +403,10 @@
getSystemUiController().updateUiState(SystemUiController.UI_STATE_BASE_WINDOW,
Themes.getAttrBoolean(this, R.attr.isWorkspaceDarkText));
+ if (!isInMultiWindowModeCompat()) {
+ UiFactory.registerRemoteAnimations(this);
+ }
+
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onCreate(savedInstanceState);
}
diff --git a/src/com/android/launcher3/anim/Interpolators.java b/src/com/android/launcher3/anim/Interpolators.java
index f3a3539..ee0dba6 100644
--- a/src/com/android/launcher3/anim/Interpolators.java
+++ b/src/com/android/launcher3/anim/Interpolators.java
@@ -20,6 +20,7 @@
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
+import android.view.animation.OvershootInterpolator;
import android.view.animation.PathInterpolator;
@@ -43,6 +44,9 @@
public static final Interpolator FAST_OUT_SLOW_IN = new PathInterpolator(0.4f, 0f, 0.2f, 1f);
public static final Interpolator AGGRESSIVE_EASE = new PathInterpolator(0.2f, 0f, 0f, 1f);
+ public static final Interpolator AGGRESSIVE_EASE_IN_OUT = new PathInterpolator(0.8f,0, 0.4f, 1);
+
+ public static final Interpolator OVERSHOOT_0 = new OvershootInterpolator(0);
/**
* Inversion of zInterpolate, compounded with an ease-out.
diff --git a/src/com/android/launcher3/views/AllAppsScrim.java b/src/com/android/launcher3/views/AllAppsScrim.java
index cc73182..6cd40fd 100644
--- a/src/com/android/launcher3/views/AllAppsScrim.java
+++ b/src/com/android/launcher3/views/AllAppsScrim.java
@@ -23,6 +23,7 @@
import android.graphics.Rect;
import android.support.v4.graphics.ColorUtils;
import android.util.AttributeSet;
+import android.util.Property;
import android.view.View;
import com.android.launcher3.DeviceProfile;
@@ -60,11 +61,25 @@
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);
}
@@ -109,6 +124,10 @@
return result;
}
+ public Bitmap getShadowBitmap() {
+ return mShadowBitmap;
+ }
+
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
@@ -154,18 +173,24 @@
}
public void setProgress(float translateY, float alpha) {
- float newAlpha = Math.round(alpha * mAlphaRange + mMinAlpha);
+ 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 (newAlpha != mFillAlpha || drawOffsetY != mDrawOffsetY) {
- invalidateDrawRect();
-
- mFillAlpha = Math.round(alpha * mAlphaRange + mMinAlpha);
- mFillPaint.setAlpha(mFillAlpha);
+ if (drawOffsetY != mDrawOffsetY) {
mDrawOffsetY = drawOffsetY;
invalidateDrawRect();
}
@@ -173,6 +198,10 @@
setTranslationY(Math.max(translateY, 0));
}
+ public float getProgress() {
+ return mProgress;
+ }
+
private void invalidateDrawRect() {
mDrawRect.top = (int) (getHeight()
+ mDrawOffsetY - mDrawHeight + mPadding.top - mShadowBlur - 0.5f);