mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Merge "Make launcher opaque when scrim becomes opaque" into sc-dev am: c2bcdcee9b
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14654426 Change-Id: I99ac839e85f7e8638599b4e3f715621028341d58
This commit is contained in:
@@ -217,17 +217,11 @@ public class DepthController implements StateHandler<LauncherState>,
|
||||
}
|
||||
|
||||
if (supportsBlur) {
|
||||
final int blur;
|
||||
if (mLauncher.isInState(LauncherState.ALL_APPS) && mDepth == 1) {
|
||||
// All apps has a solid background. We don't need to draw blurs after it's fully
|
||||
// visible. This will take us out of GPU composition, saving battery and increasing
|
||||
// performance.
|
||||
blur = 0;
|
||||
} else {
|
||||
blur = (int) (mDepth * mMaxBlurRadius);
|
||||
}
|
||||
boolean isOpaque = mLauncher.getScrimView().isFullyOpaque();
|
||||
int blur = isOpaque ? 0 : (int) (mDepth * mMaxBlurRadius);
|
||||
new TransactionCompat()
|
||||
.setBackgroundBlurRadius(mSurface, blur)
|
||||
.setOpaque(mSurface, isOpaque)
|
||||
.apply();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import static com.android.launcher3.util.SystemUiController.UI_STATE_SCRIM_VIEW;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.util.AttributeSet;
|
||||
@@ -39,6 +40,8 @@ public class ScrimView extends View implements Insettable {
|
||||
private SystemUiController mSystemUiController;
|
||||
|
||||
private ScrimDrawingController mDrawingController;
|
||||
private int mBackgroundColor;
|
||||
private boolean mIsVisible = true;
|
||||
|
||||
public ScrimView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -62,10 +65,21 @@ public class ScrimView extends View implements Insettable {
|
||||
|
||||
@Override
|
||||
public void setBackgroundColor(int color) {
|
||||
mBackgroundColor = color;
|
||||
updateSysUiColors();
|
||||
super.setBackgroundColor(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVisibilityAggregated(boolean isVisible) {
|
||||
super.onVisibilityAggregated(isVisible);
|
||||
mIsVisible = isVisible;
|
||||
}
|
||||
|
||||
public boolean isFullyOpaque() {
|
||||
return mIsVisible && getAlpha() == 1 && Color.alpha(mBackgroundColor) == 255;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
|
||||
Reference in New Issue
Block a user