Merge "Tune nav bar height" into tm-dev

This commit is contained in:
Tracy Zhou
2022-05-12 18:17:19 +00:00
committed by Android (Google) Code Review
7 changed files with 31 additions and 31 deletions

View File

@@ -30,10 +30,10 @@
<dimen name="navigation_bar_deadzone_size_max">32dp</dimen> <dimen name="navigation_bar_deadzone_size_max">32dp</dimen>
<!-- dimensions for the navigation bar handle --> <!-- dimensions for the navigation bar handle -->
<dimen name="navigation_handle_radius">1dp</dimen> <dimen name="navigation_handle_radius">2dp</dimen>
<dimen name="navigation_handle_bottom">6dp</dimen> <dimen name="navigation_handle_bottom">8dp</dimen>
<dimen name="navigation_handle_sample_horizontal_margin">10dp</dimen> <dimen name="navigation_handle_sample_horizontal_margin">10dp</dimen>
<dimen name="navigation_home_handle_width">72dp</dimen> <dimen name="navigation_home_handle_width">108dp</dimen>
<!-- Size of the nav bar edge panels, should be greater to the <!-- Size of the nav bar edge panels, should be greater to the
edge sensitivity + the drag threshold --> edge sensitivity + the drag threshold -->

View File

@@ -36,8 +36,8 @@ public class NavigationHandle extends View implements ButtonInterface {
protected final Paint mPaint = new Paint(); protected final Paint mPaint = new Paint();
private @ColorInt final int mLightColor; private @ColorInt final int mLightColor;
private @ColorInt final int mDarkColor; private @ColorInt final int mDarkColor;
protected final int mRadius; protected final float mRadius;
protected final int mBottom; protected final float mBottom;
private boolean mRequiresInvalidate; private boolean mRequiresInvalidate;
public NavigationHandle(Context context) { public NavigationHandle(Context context) {
@@ -47,8 +47,8 @@ public class NavigationHandle extends View implements ButtonInterface {
public NavigationHandle(Context context, AttributeSet attr) { public NavigationHandle(Context context, AttributeSet attr) {
super(context, attr); super(context, attr);
final Resources res = context.getResources(); final Resources res = context.getResources();
mRadius = res.getDimensionPixelSize(R.dimen.navigation_handle_radius); mRadius = res.getDimension(R.dimen.navigation_handle_radius);
mBottom = res.getDimensionPixelSize(R.dimen.navigation_handle_bottom); mBottom = res.getDimension(R.dimen.navigation_handle_bottom);
final int dualToneDarkTheme = Utils.getThemeAttr(context, R.attr.darkIconTheme); final int dualToneDarkTheme = Utils.getThemeAttr(context, R.attr.darkIconTheme);
final int dualToneLightTheme = Utils.getThemeAttr(context, R.attr.lightIconTheme); final int dualToneLightTheme = Utils.getThemeAttr(context, R.attr.lightIconTheme);
@@ -75,9 +75,9 @@ public class NavigationHandle extends View implements ButtonInterface {
// Draw that bar // Draw that bar
int navHeight = getHeight(); int navHeight = getHeight();
int height = mRadius * 2; float height = mRadius * 2;
int width = getWidth(); int width = getWidth();
int y = (navHeight - mBottom - height); float y = (navHeight - mBottom - height);
canvas.drawRoundRect(0, y, width, y + height, mRadius, mRadius, mPaint); canvas.drawRoundRect(0, y, width, y + height, mRadius, mRadius, mPaint);
} }

View File

@@ -44,33 +44,33 @@ public class QuickswitchOrientedNavHandle extends NavigationHandle {
} }
public RectF computeHomeHandleBounds() { public RectF computeHomeHandleBounds() {
int left; float left;
int top; float top;
int bottom; float bottom;
int right; float right;
int radiusOffset = mRadius * 2; float radiusOffset = mRadius * 2;
int topStart = getLocationOnScreen()[1]; int topStart = getLocationOnScreen()[1];
switch (mDeltaRotation) { switch (mDeltaRotation) {
default: default:
case Surface.ROTATION_0: case Surface.ROTATION_0:
case Surface.ROTATION_180: case Surface.ROTATION_180:
int height = mRadius * 2; float height = mRadius * 2;
left = getWidth() / 2 - mWidth / 2; left = getWidth() / 2f - mWidth / 2f;
top = (getHeight() - mBottom - height); top = (getHeight() - mBottom - height);
right = getWidth() / 2 + mWidth / 2; right = getWidth() / 2f + mWidth / 2f;
bottom = top + height; bottom = top + height;
break; break;
case Surface.ROTATION_90: case Surface.ROTATION_90:
left = mBottom; left = mBottom;
right = left + radiusOffset; right = left + radiusOffset;
top = getHeight() / 2 - (mWidth / 2) - (topStart / 2); top = getHeight() / 2f - (mWidth / 2f) - (topStart / 2f);
bottom = top + mWidth; bottom = top + mWidth;
break; break;
case Surface.ROTATION_270: case Surface.ROTATION_270:
right = getWidth() - mBottom; right = getWidth() - mBottom;
left = right - radiusOffset; left = right - radiusOffset;
top = getHeight() / 2 - (mWidth / 2) - (topStart / 2); top = getHeight() / 2f - (mWidth / 2f) - (topStart / 2f);
bottom = top + mWidth; bottom = top + mWidth;
break; break;
} }

View File

@@ -18,11 +18,11 @@
--> -->
<resources> <resources>
<!-- Height of the bottom navigation / system bar. --> <!-- Height of the bottom navigation / system bar. -->
<dimen name="navigation_bar_height">16dp</dimen> <dimen name="navigation_bar_height">24dp</dimen>
<!-- Height of the bottom navigation bar in portrait; often the same as @dimen/navigation_bar_height --> <!-- Height of the bottom navigation bar in portrait; often the same as @dimen/navigation_bar_height -->
<dimen name="navigation_bar_height_landscape">16dp</dimen> <dimen name="navigation_bar_height_landscape">24dp</dimen>
<!-- Width of the navigation bar when it is placed vertically on the screen --> <!-- Width of the navigation bar when it is placed vertically on the screen -->
<dimen name="navigation_bar_width">16dp</dimen> <dimen name="navigation_bar_width">24dp</dimen>
<!-- Height of the bottom navigation / system bar. --> <!-- Height of the bottom navigation / system bar. -->
<dimen name="navigation_bar_frame_height">48dp</dimen> <dimen name="navigation_bar_frame_height">48dp</dimen>
<!-- The height of the bottom navigation gesture area. --> <!-- The height of the bottom navigation gesture area. -->

View File

@@ -18,11 +18,11 @@
--> -->
<resources> <resources>
<!-- Height of the bottom navigation / system bar. --> <!-- Height of the bottom navigation / system bar. -->
<dimen name="navigation_bar_height">16dp</dimen> <dimen name="navigation_bar_height">24dp</dimen>
<!-- Height of the bottom navigation bar in portrait; often the same as @dimen/navigation_bar_height --> <!-- Height of the bottom navigation bar in portrait; often the same as @dimen/navigation_bar_height -->
<dimen name="navigation_bar_height_landscape">16dp</dimen> <dimen name="navigation_bar_height_landscape">24dp</dimen>
<!-- Width of the navigation bar when it is placed vertically on the screen --> <!-- Width of the navigation bar when it is placed vertically on the screen -->
<dimen name="navigation_bar_width">16dp</dimen> <dimen name="navigation_bar_width">24dp</dimen>
<!-- Height of the bottom navigation / system bar. --> <!-- Height of the bottom navigation / system bar. -->
<dimen name="navigation_bar_frame_height">48dp</dimen> <dimen name="navigation_bar_frame_height">48dp</dimen>
<!-- The height of the bottom navigation gesture area. --> <!-- The height of the bottom navigation gesture area. -->

View File

@@ -18,11 +18,11 @@
--> -->
<resources> <resources>
<!-- Height of the bottom navigation / system bar. --> <!-- Height of the bottom navigation / system bar. -->
<dimen name="navigation_bar_height">16dp</dimen> <dimen name="navigation_bar_height">24dp</dimen>
<!-- Height of the bottom navigation bar in portrait; often the same as @dimen/navigation_bar_height --> <!-- Height of the bottom navigation bar in portrait; often the same as @dimen/navigation_bar_height -->
<dimen name="navigation_bar_height_landscape">16dp</dimen> <dimen name="navigation_bar_height_landscape">24dp</dimen>
<!-- Width of the navigation bar when it is placed vertically on the screen --> <!-- Width of the navigation bar when it is placed vertically on the screen -->
<dimen name="navigation_bar_width">16dp</dimen> <dimen name="navigation_bar_width">24dp</dimen>
<!-- Height of the bottom navigation / system bar. --> <!-- Height of the bottom navigation / system bar. -->
<dimen name="navigation_bar_frame_height">48dp</dimen> <dimen name="navigation_bar_frame_height">48dp</dimen>
<!-- The height of the bottom navigation gesture area. --> <!-- The height of the bottom navigation gesture area. -->

View File

@@ -18,11 +18,11 @@
--> -->
<resources> <resources>
<!-- Height of the bottom navigation / system bar. --> <!-- Height of the bottom navigation / system bar. -->
<dimen name="navigation_bar_height">16dp</dimen> <dimen name="navigation_bar_height">24dp</dimen>
<!-- Height of the bottom navigation bar in portrait; often the same as @dimen/navigation_bar_height --> <!-- Height of the bottom navigation bar in portrait; often the same as @dimen/navigation_bar_height -->
<dimen name="navigation_bar_height_landscape">16dp</dimen> <dimen name="navigation_bar_height_landscape">24dp</dimen>
<!-- Width of the navigation bar when it is placed vertically on the screen --> <!-- Width of the navigation bar when it is placed vertically on the screen -->
<dimen name="navigation_bar_width">16dp</dimen> <dimen name="navigation_bar_width">24dp</dimen>
<!-- Height of the bottom navigation / system bar. --> <!-- Height of the bottom navigation / system bar. -->
<dimen name="navigation_bar_frame_height">48dp</dimen> <dimen name="navigation_bar_frame_height">48dp</dimen>
<!-- The height of the bottom navigation gesture area. --> <!-- The height of the bottom navigation gesture area. -->