Merge "Make launcher opaque when scrim becomes opaque" into sc-dev
This commit is contained in:
@@ -217,17 +217,11 @@ public class DepthController implements StateHandler<LauncherState>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (supportsBlur) {
|
if (supportsBlur) {
|
||||||
final int blur;
|
boolean isOpaque = mLauncher.getScrimView().isFullyOpaque();
|
||||||
if (mLauncher.isInState(LauncherState.ALL_APPS) && mDepth == 1) {
|
int blur = isOpaque ? 0 : (int) (mDepth * mMaxBlurRadius);
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
new TransactionCompat()
|
new TransactionCompat()
|
||||||
.setBackgroundBlurRadius(mSurface, blur)
|
.setBackgroundBlurRadius(mSurface, blur)
|
||||||
|
.setOpaque(mSurface, isOpaque)
|
||||||
.apply();
|
.apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import static com.android.launcher3.util.SystemUiController.UI_STATE_SCRIM_VIEW;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
@@ -39,6 +40,8 @@ public class ScrimView extends View implements Insettable {
|
|||||||
private SystemUiController mSystemUiController;
|
private SystemUiController mSystemUiController;
|
||||||
|
|
||||||
private ScrimDrawingController mDrawingController;
|
private ScrimDrawingController mDrawingController;
|
||||||
|
private int mBackgroundColor;
|
||||||
|
private boolean mIsVisible = true;
|
||||||
|
|
||||||
public ScrimView(Context context, AttributeSet attrs) {
|
public ScrimView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
@@ -62,10 +65,21 @@ public class ScrimView extends View implements Insettable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBackgroundColor(int color) {
|
public void setBackgroundColor(int color) {
|
||||||
|
mBackgroundColor = color;
|
||||||
updateSysUiColors();
|
updateSysUiColors();
|
||||||
super.setBackgroundColor(color);
|
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
|
@Override
|
||||||
protected void onDraw(Canvas canvas) {
|
protected void onDraw(Canvas canvas) {
|
||||||
super.onDraw(canvas);
|
super.onDraw(canvas);
|
||||||
|
|||||||
Reference in New Issue
Block a user