|
|
|
@@ -45,7 +45,10 @@ import com.android.launcher3.BaseDraggingActivity;
|
|
|
|
|
import com.android.launcher3.R;
|
|
|
|
|
import com.android.launcher3.ResourceUtils;
|
|
|
|
|
import com.android.launcher3.Utilities;
|
|
|
|
|
import com.android.launcher3.config.FeatureFlags;
|
|
|
|
|
import com.android.launcher3.util.DynamicResource;
|
|
|
|
|
import com.android.launcher3.util.Themes;
|
|
|
|
|
import com.android.systemui.plugins.ResourceProvider;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* View scrim which draws behind hotseat and workspace
|
|
|
|
@@ -101,8 +104,10 @@ public class SysUiScrim implements View.OnAttachStateChangeListener {
|
|
|
|
|
private static final int ALPHA_MASK_BITMAP_DP = 200;
|
|
|
|
|
private static final int ALPHA_MASK_WIDTH_DP = 2;
|
|
|
|
|
|
|
|
|
|
private boolean mDrawTopScrim, mDrawBottomScrim;
|
|
|
|
|
private boolean mDrawTopScrim, mDrawBottomScrim, mDrawWallpaperScrim;
|
|
|
|
|
|
|
|
|
|
private final RectF mWallpaperScrimRect = new RectF();
|
|
|
|
|
private final Paint mWallpaperScrimPaint = new Paint();
|
|
|
|
|
private final RectF mFinalMaskRect = new RectF();
|
|
|
|
|
private final Paint mBottomMaskPaint = new Paint(Paint.FILTER_BITMAP_FLAG);
|
|
|
|
|
private final Bitmap mBottomMask;
|
|
|
|
@@ -117,6 +122,7 @@ public class SysUiScrim implements View.OnAttachStateChangeListener {
|
|
|
|
|
|
|
|
|
|
private boolean mAnimateScrimOnNextDraw = false;
|
|
|
|
|
private float mSysUiAnimMultiplier = 1;
|
|
|
|
|
private int mWallpaperScrimMaxAlpha;
|
|
|
|
|
|
|
|
|
|
public SysUiScrim(View view) {
|
|
|
|
|
mRoot = view;
|
|
|
|
@@ -127,6 +133,14 @@ public class SysUiScrim implements View.OnAttachStateChangeListener {
|
|
|
|
|
mBottomMask = mTopScrim == null ? null : createDitheredAlphaMask();
|
|
|
|
|
mHideSysUiScrim = mTopScrim == null;
|
|
|
|
|
|
|
|
|
|
mDrawWallpaperScrim = FeatureFlags.ENABLE_WALLPAPER_SCRIM.get()
|
|
|
|
|
&& !Themes.getAttrBoolean(view.getContext(), R.attr.isMainColorDark)
|
|
|
|
|
&& !Themes.getAttrBoolean(view.getContext(), R.attr.isWorkspaceDarkText);
|
|
|
|
|
ResourceProvider rp = DynamicResource.provider(view.getContext());
|
|
|
|
|
int wallpaperScrimColor = rp.getColor(R.color.wallpaper_scrim_color);
|
|
|
|
|
mWallpaperScrimMaxAlpha = Color.alpha(wallpaperScrimColor);
|
|
|
|
|
mWallpaperScrimPaint.setColor(wallpaperScrimColor);
|
|
|
|
|
|
|
|
|
|
view.addOnAttachStateChangeListener(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -151,6 +165,9 @@ public class SysUiScrim implements View.OnAttachStateChangeListener {
|
|
|
|
|
mAnimateScrimOnNextDraw = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mDrawWallpaperScrim) {
|
|
|
|
|
canvas.drawRect(mWallpaperScrimRect, mWallpaperScrimPaint);
|
|
|
|
|
}
|
|
|
|
|
if (mDrawTopScrim) {
|
|
|
|
|
mTopScrim.draw(canvas);
|
|
|
|
|
}
|
|
|
|
@@ -214,6 +231,7 @@ public class SysUiScrim implements View.OnAttachStateChangeListener {
|
|
|
|
|
mTopScrim.setBounds(0, 0, w, h);
|
|
|
|
|
mFinalMaskRect.set(0, h - mMaskHeight, w, h);
|
|
|
|
|
}
|
|
|
|
|
mWallpaperScrimRect.set(0, 0, w, h);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setSysUiProgress(float progress) {
|
|
|
|
@@ -236,6 +254,7 @@ public class SysUiScrim implements View.OnAttachStateChangeListener {
|
|
|
|
|
if (mTopScrim != null) {
|
|
|
|
|
mTopScrim.setAlpha(Math.round(255 * factor));
|
|
|
|
|
}
|
|
|
|
|
mWallpaperScrimPaint.setAlpha(Math.round(mWallpaperScrimMaxAlpha * factor));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Bitmap createDitheredAlphaMask() {
|
|
|
|
|