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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user