summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2017-05-04 11:47:53 -0700
committerJon Miranda <jonmiranda@google.com>2017-05-11 12:32:28 -0700
commit2d89ea84530559e2002a3a4009a50bac1e568507 (patch)
treee15ac6f357eb6a911700e8cb781ced50e9b03684 /src
parente37d2b9f322d5a654f6089b90141a087ec484d72 (diff)
downloadandroid_packages_apps_Trebuchet-2d89ea84530559e2002a3a4009a50bac1e568507.tar.gz
android_packages_apps_Trebuchet-2d89ea84530559e2002a3a4009a50bac1e568507.tar.bz2
android_packages_apps_Trebuchet-2d89ea84530559e2002a3a4009a50bac1e568507.zip
Fade in background scrim when resuming from screen off.
This change hides the hard cut off that appears when the Launcher window is transitioning upwards when resuming from when the screen is off. Bug: 36446766 Change-Id: I0c0fe13ee9e08d27b94916d0407ef431d82b8d6a
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/Launcher.java22
-rw-r--r--src/com/android/launcher3/LauncherAnimUtils.java13
-rw-r--r--src/com/android/launcher3/allapps/AllAppsBackgroundDrawable.java4
3 files changed, 38 insertions, 1 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index c96c2a7b9..f77308e14 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -18,7 +18,9 @@ package com.android.launcher3;
import android.Manifest;
import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
@@ -267,6 +269,8 @@ public class Launcher extends BaseActivity
private boolean mHasFocus = false;
private boolean mAttached = false;
+ private ObjectAnimator mScrimAnimator;
+
private PopupDataProvider mPopupDataProvider;
private View.OnTouchListener mHapticFeedbackTouchListener;
@@ -920,6 +924,24 @@ public class Launcher extends BaseActivity
if (!isWorkspaceLoading()) {
NotificationListener.setNotificationsChangedListener(mPopupDataProvider);
}
+
+ if (mIsResumeFromActionScreenOff && mDragLayer.getBackground() != null) {
+ if (mScrimAnimator != null) {
+ mScrimAnimator.cancel();
+ }
+ mDragLayer.getBackground().setAlpha(0);
+ mScrimAnimator = ObjectAnimator.ofInt(mDragLayer.getBackground(),
+ LauncherAnimUtils.DRAWABLE_ALPHA, 0, 255);
+ mScrimAnimator.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mScrimAnimator = null;
+ }
+ });
+ mScrimAnimator.setDuration(600);
+ mScrimAnimator.setStartDelay(getWindow().getTransitionBackgroundFadeDuration());
+ mScrimAnimator.start();
+ }
}
@Override
diff --git a/src/com/android/launcher3/LauncherAnimUtils.java b/src/com/android/launcher3/LauncherAnimUtils.java
index 2be2021f1..cfb9b570b 100644
--- a/src/com/android/launcher3/LauncherAnimUtils.java
+++ b/src/com/android/launcher3/LauncherAnimUtils.java
@@ -21,6 +21,7 @@ import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
+import android.graphics.drawable.Drawable;
import android.util.Property;
import android.view.View;
import android.view.ViewTreeObserver;
@@ -128,4 +129,16 @@ public class LauncherAnimUtils {
return anim;
}
+ public static final Property<Drawable, Integer> DRAWABLE_ALPHA =
+ new Property<Drawable, Integer>(Integer.TYPE, "drawableAlpha") {
+ @Override
+ public Integer get(Drawable drawable) {
+ return drawable.getAlpha();
+ }
+
+ @Override
+ public void set(Drawable drawable, Integer alpha) {
+ drawable.setAlpha(alpha);
+ }
+ };
}
diff --git a/src/com/android/launcher3/allapps/AllAppsBackgroundDrawable.java b/src/com/android/launcher3/allapps/AllAppsBackgroundDrawable.java
index c71bc3166..54c5bd0b2 100644
--- a/src/com/android/launcher3/allapps/AllAppsBackgroundDrawable.java
+++ b/src/com/android/launcher3/allapps/AllAppsBackgroundDrawable.java
@@ -25,6 +25,7 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.view.Gravity;
+import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.R;
/**
@@ -119,7 +120,8 @@ public class AllAppsBackgroundDrawable extends Drawable {
int finalAlphaI = (int) (finalAlpha * 255f);
if (getAlpha() != finalAlphaI) {
mBackgroundAnim = cancelAnimator(mBackgroundAnim);
- mBackgroundAnim = ObjectAnimator.ofInt(this, "alpha", finalAlphaI);
+ mBackgroundAnim = ObjectAnimator.ofInt(this, LauncherAnimUtils.DRAWABLE_ALPHA,
+ finalAlphaI);
mBackgroundAnim.setDuration(duration);
mBackgroundAnim.start();
}