Merge "Cutout Overlay: Flip color in inverted color mode" into pi-dev
am: aceee95fa0
Change-Id: Ic9374e3d3d753f0da8841229e16d5e2cee6f0271
This commit is contained in:
@@ -135,12 +135,14 @@ public class ScreenDecorations extends SystemUI implements Tunable {
|
|||||||
private void setupDecorations() {
|
private void setupDecorations() {
|
||||||
mOverlay = LayoutInflater.from(mContext)
|
mOverlay = LayoutInflater.from(mContext)
|
||||||
.inflate(R.layout.rounded_corners, null);
|
.inflate(R.layout.rounded_corners, null);
|
||||||
((ViewGroup)mOverlay).addView(new DisplayCutoutView(mContext, true,
|
DisplayCutoutView cutoutTop = new DisplayCutoutView(mContext, true,
|
||||||
this::updateWindowVisibilities));
|
this::updateWindowVisibilities);
|
||||||
|
((ViewGroup)mOverlay).addView(cutoutTop);
|
||||||
mBottomOverlay = LayoutInflater.from(mContext)
|
mBottomOverlay = LayoutInflater.from(mContext)
|
||||||
.inflate(R.layout.rounded_corners, null);
|
.inflate(R.layout.rounded_corners, null);
|
||||||
((ViewGroup)mBottomOverlay).addView(new DisplayCutoutView(mContext, false,
|
DisplayCutoutView cutoutBottom = new DisplayCutoutView(mContext, false,
|
||||||
this::updateWindowVisibilities));
|
this::updateWindowVisibilities);
|
||||||
|
((ViewGroup)mBottomOverlay).addView(cutoutBottom);
|
||||||
|
|
||||||
mOverlay.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
mOverlay.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||||
mOverlay.setAlpha(0);
|
mOverlay.setAlpha(0);
|
||||||
@@ -170,6 +172,8 @@ public class ScreenDecorations extends SystemUI implements Tunable {
|
|||||||
((ImageView) mOverlay.findViewById(R.id.right)).setImageTintList(tintList);
|
((ImageView) mOverlay.findViewById(R.id.right)).setImageTintList(tintList);
|
||||||
((ImageView) mBottomOverlay.findViewById(R.id.left)).setImageTintList(tintList);
|
((ImageView) mBottomOverlay.findViewById(R.id.left)).setImageTintList(tintList);
|
||||||
((ImageView) mBottomOverlay.findViewById(R.id.right)).setImageTintList(tintList);
|
((ImageView) mBottomOverlay.findViewById(R.id.right)).setImageTintList(tintList);
|
||||||
|
cutoutTop.setColor(tint);
|
||||||
|
cutoutBottom.setColor(tint);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
setting.setListening(true);
|
setting.setListening(true);
|
||||||
@@ -414,6 +418,7 @@ public class ScreenDecorations extends SystemUI implements Tunable {
|
|||||||
private final int[] mLocation = new int[2];
|
private final int[] mLocation = new int[2];
|
||||||
private final boolean mStart;
|
private final boolean mStart;
|
||||||
private final Runnable mVisibilityChangedListener;
|
private final Runnable mVisibilityChangedListener;
|
||||||
|
private int mColor = Color.BLACK;
|
||||||
|
|
||||||
public DisplayCutoutView(Context context, boolean start,
|
public DisplayCutoutView(Context context, boolean start,
|
||||||
Runnable visibilityChangedListener) {
|
Runnable visibilityChangedListener) {
|
||||||
@@ -423,6 +428,11 @@ public class ScreenDecorations extends SystemUI implements Tunable {
|
|||||||
setId(R.id.display_cutout);
|
setId(R.id.display_cutout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setColor(int color) {
|
||||||
|
mColor = color;
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onAttachedToWindow() {
|
protected void onAttachedToWindow() {
|
||||||
super.onAttachedToWindow();
|
super.onAttachedToWindow();
|
||||||
@@ -443,7 +453,7 @@ public class ScreenDecorations extends SystemUI implements Tunable {
|
|||||||
getLocationOnScreen(mLocation);
|
getLocationOnScreen(mLocation);
|
||||||
canvas.translate(-mLocation[0], -mLocation[1]);
|
canvas.translate(-mLocation[0], -mLocation[1]);
|
||||||
if (!mBoundingPath.isEmpty()) {
|
if (!mBoundingPath.isEmpty()) {
|
||||||
mPaint.setColor(Color.BLACK);
|
mPaint.setColor(mColor);
|
||||||
mPaint.setStyle(Paint.Style.FILL);
|
mPaint.setStyle(Paint.Style.FILL);
|
||||||
mPaint.setAntiAlias(true);
|
mPaint.setAntiAlias(true);
|
||||||
canvas.drawPath(mBoundingPath, mPaint);
|
canvas.drawPath(mBoundingPath, mPaint);
|
||||||
|
|||||||
Reference in New Issue
Block a user