0abb36f692
The navigation bar is opaque on mobile devices in landscape mode. Launcher should ignore the right insets and draw the edge effect appropriately. Also draw the black bar under the navigation bar, just in case we assume it to be opaque, but it was not actually opaque. Bug: 18526657 Change-Id: I1d49dcb82b8a5ee25009bc738cd9b8c0c5c88263
42 lines
1.3 KiB
Java
42 lines
1.3 KiB
Java
package com.android.launcher3;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.Canvas;
|
|
import android.graphics.Color;
|
|
import android.graphics.Paint;
|
|
import android.graphics.Rect;
|
|
import android.util.AttributeSet;
|
|
|
|
public class LauncherRootView extends InsettableFrameLayout {
|
|
|
|
private final Paint mOpaquePaint;
|
|
private boolean mDrawRightInsetBar;
|
|
|
|
public LauncherRootView(Context context, AttributeSet attrs) {
|
|
super(context, attrs);
|
|
|
|
mOpaquePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
|
mOpaquePaint.setColor(Color.BLACK);
|
|
mOpaquePaint.setStyle(Paint.Style.FILL);
|
|
}
|
|
|
|
@Override
|
|
protected boolean fitSystemWindows(Rect insets) {
|
|
setInsets(insets);
|
|
mDrawRightInsetBar = mInsets.right > 0 && LauncherAppState
|
|
.getInstance().getInvariantDeviceProfile().isRightInsetOpaque;
|
|
|
|
return true; // I'll take it from here
|
|
}
|
|
|
|
@Override
|
|
protected void dispatchDraw(Canvas canvas) {
|
|
super.dispatchDraw(canvas);
|
|
|
|
// If the right inset is opaque, draw a black rectangle to ensure that is stays opaque.
|
|
if (mDrawRightInsetBar) {
|
|
int width = getWidth();
|
|
canvas.drawRect(width - mInsets.right, 0, width, getHeight(), mOpaquePaint);
|
|
}
|
|
}
|
|
} |