Merge "Draw legacy nav bar background directly" into qt-dev
am: 324cdd4ae0
Change-Id: I3291e2788df951510c5abf3a23df226d5174a5c5
This commit is contained in:
@@ -262,8 +262,10 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
|
|||||||
private final int mResizeShadowSize;
|
private final int mResizeShadowSize;
|
||||||
private final Paint mVerticalResizeShadowPaint = new Paint();
|
private final Paint mVerticalResizeShadowPaint = new Paint();
|
||||||
private final Paint mHorizontalResizeShadowPaint = new Paint();
|
private final Paint mHorizontalResizeShadowPaint = new Paint();
|
||||||
|
private final Paint mLegacyNavigationBarBackgroundPaint = new Paint();
|
||||||
private Insets mBackgroundInsets = Insets.NONE;
|
private Insets mBackgroundInsets = Insets.NONE;
|
||||||
private Insets mLastBackgroundInsets = Insets.NONE;
|
private Insets mLastBackgroundInsets = Insets.NONE;
|
||||||
|
private boolean mDrawLegacyNavigationBarBackground;
|
||||||
|
|
||||||
DecorView(Context context, int featureId, PhoneWindow window,
|
DecorView(Context context, int featureId, PhoneWindow window,
|
||||||
WindowManager.LayoutParams params) {
|
WindowManager.LayoutParams params) {
|
||||||
@@ -292,6 +294,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
|
|||||||
mResizeShadowSize = context.getResources().getDimensionPixelSize(
|
mResizeShadowSize = context.getResources().getDimensionPixelSize(
|
||||||
R.dimen.resize_shadow_size);
|
R.dimen.resize_shadow_size);
|
||||||
initResizingPaints();
|
initResizingPaints();
|
||||||
|
|
||||||
|
mLegacyNavigationBarBackgroundPaint.setColor(Color.BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBackgroundFallback(@Nullable Drawable fallbackDrawable) {
|
void setBackgroundFallback(@Nullable Drawable fallbackDrawable) {
|
||||||
@@ -1143,6 +1147,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
|
|||||||
navBarToRightEdge || navBarToLeftEdge, navBarToLeftEdge,
|
navBarToRightEdge || navBarToLeftEdge, navBarToLeftEdge,
|
||||||
0 /* sideInset */, animate && !disallowAnimate,
|
0 /* sideInset */, animate && !disallowAnimate,
|
||||||
mForceWindowDrawsBarBackgrounds);
|
mForceWindowDrawsBarBackgrounds);
|
||||||
|
mDrawLegacyNavigationBarBackground = mNavigationColorViewState.visible
|
||||||
|
&& (mWindow.getAttributes().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0;
|
||||||
|
|
||||||
boolean statusBarNeedsRightInset = navBarToRightEdge
|
boolean statusBarNeedsRightInset = navBarToRightEdge
|
||||||
&& mNavigationColorViewState.present;
|
&& mNavigationColorViewState.present;
|
||||||
@@ -2310,6 +2316,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
|
|||||||
@Override
|
@Override
|
||||||
public void onPostDraw(RecordingCanvas canvas) {
|
public void onPostDraw(RecordingCanvas canvas) {
|
||||||
drawResizingShadowIfNeeded(canvas);
|
drawResizingShadowIfNeeded(canvas);
|
||||||
|
drawLegacyNavigationBarBackground(canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initResizingPaints() {
|
private void initResizingPaints() {
|
||||||
@@ -2342,6 +2349,18 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
|
|||||||
canvas.restore();
|
canvas.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void drawLegacyNavigationBarBackground(RecordingCanvas canvas) {
|
||||||
|
if (!mDrawLegacyNavigationBarBackground) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
View v = mNavigationColorViewState.view;
|
||||||
|
if (v == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
canvas.drawRect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom(),
|
||||||
|
mLegacyNavigationBarBackgroundPaint);
|
||||||
|
}
|
||||||
|
|
||||||
/** Release the renderer thread which is usually done when the user stops resizing. */
|
/** Release the renderer thread which is usually done when the user stops resizing. */
|
||||||
private void releaseThreadedRenderer() {
|
private void releaseThreadedRenderer() {
|
||||||
if (mResizingBackgroundDrawable != null && mLastBackgroundDrawableCb != null) {
|
if (mResizingBackgroundDrawable != null && mLastBackgroundDrawableCb != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user