From 72caa8e573a166cadc36bdfd93dcd1e1a5a6b976 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 11 Jan 2022 23:52:22 +0000 Subject: [PATCH] Tune nav bar height Here is the maths: https://docs.google.com/document/d/1oKrjSOQ8cdeM99QBjeYNU26W2A1Qlg_Pe2mG3TZ_L-8/edit?resourcekey=0-iVEFnkGPBaRVp0Hc937Ksw Fixes: 200310506 Test: manual Change-Id: Ia174f30ac8527991eb3dfa8a84a3d8adeb0e2c5d --- packages/SystemUI/res/values/dimens.xml | 6 +++--- .../gestural/NavigationHandle.java | 12 +++++------ .../QuickswitchOrientedNavHandle.java | 20 +++++++++---------- .../res/values/dimens.xml | 6 +++--- .../res/values/dimens.xml | 6 +++--- .../res/values/dimens.xml | 6 +++--- .../res/values/dimens.xml | 6 +++--- 7 files changed, 31 insertions(+), 31 deletions(-) diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index f77430bae4ab1..ea8866ea66411 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -30,10 +30,10 @@ 32dp - 1dp - 6dp + 2dp + 8dp 10dp - 72dp + 108dp diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/NavigationHandle.java b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/NavigationHandle.java index 33e6aa46724b7..913b65289e12e 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/NavigationHandle.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/NavigationHandle.java @@ -36,8 +36,8 @@ public class NavigationHandle extends View implements ButtonInterface { protected final Paint mPaint = new Paint(); private @ColorInt final int mLightColor; private @ColorInt final int mDarkColor; - protected final int mRadius; - protected final int mBottom; + protected final float mRadius; + protected final float mBottom; private boolean mRequiresInvalidate; public NavigationHandle(Context context) { @@ -47,8 +47,8 @@ public class NavigationHandle extends View implements ButtonInterface { public NavigationHandle(Context context, AttributeSet attr) { super(context, attr); final Resources res = context.getResources(); - mRadius = res.getDimensionPixelSize(R.dimen.navigation_handle_radius); - mBottom = res.getDimensionPixelSize(R.dimen.navigation_handle_bottom); + mRadius = res.getDimension(R.dimen.navigation_handle_radius); + mBottom = res.getDimension(R.dimen.navigation_handle_bottom); final int dualToneDarkTheme = Utils.getThemeAttr(context, R.attr.darkIconTheme); final int dualToneLightTheme = Utils.getThemeAttr(context, R.attr.lightIconTheme); @@ -75,9 +75,9 @@ public class NavigationHandle extends View implements ButtonInterface { // Draw that bar int navHeight = getHeight(); - int height = mRadius * 2; + float height = mRadius * 2; int width = getWidth(); - int y = (navHeight - mBottom - height); + float y = (navHeight - mBottom - height); canvas.drawRoundRect(0, y, width, y + height, mRadius, mRadius, mPaint); } diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/QuickswitchOrientedNavHandle.java b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/QuickswitchOrientedNavHandle.java index 71c8a2c1e6ca5..88622aadd5431 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/QuickswitchOrientedNavHandle.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/QuickswitchOrientedNavHandle.java @@ -44,33 +44,33 @@ public class QuickswitchOrientedNavHandle extends NavigationHandle { } public RectF computeHomeHandleBounds() { - int left; - int top; - int bottom; - int right; - int radiusOffset = mRadius * 2; + float left; + float top; + float bottom; + float right; + float radiusOffset = mRadius * 2; int topStart = getLocationOnScreen()[1]; switch (mDeltaRotation) { default: case Surface.ROTATION_0: case Surface.ROTATION_180: - int height = mRadius * 2; - left = getWidth() / 2 - mWidth / 2; + float height = mRadius * 2; + left = getWidth() / 2f - mWidth / 2f; top = (getHeight() - mBottom - height); - right = getWidth() / 2 + mWidth / 2; + right = getWidth() / 2f + mWidth / 2f; bottom = top + height; break; case Surface.ROTATION_90: left = mBottom; right = left + radiusOffset; - top = getHeight() / 2 - (mWidth / 2) - (topStart / 2); + top = getHeight() / 2f - (mWidth / 2f) - (topStart / 2f); bottom = top + mWidth; break; case Surface.ROTATION_270: right = getWidth() - mBottom; left = right - radiusOffset; - top = getHeight() / 2 - (mWidth / 2) - (topStart / 2); + top = getHeight() / 2f - (mWidth / 2f) - (topStart / 2f); bottom = top + mWidth; break; } diff --git a/packages/overlays/NavigationBarModeGesturalOverlay/res/values/dimens.xml b/packages/overlays/NavigationBarModeGesturalOverlay/res/values/dimens.xml index ac1f0226be523..674bc749bc11b 100644 --- a/packages/overlays/NavigationBarModeGesturalOverlay/res/values/dimens.xml +++ b/packages/overlays/NavigationBarModeGesturalOverlay/res/values/dimens.xml @@ -18,11 +18,11 @@ --> - 16dp + 24dp - 16dp + 24dp - 16dp + 24dp 48dp diff --git a/packages/overlays/NavigationBarModeGesturalOverlayExtraWideBack/res/values/dimens.xml b/packages/overlays/NavigationBarModeGesturalOverlayExtraWideBack/res/values/dimens.xml index ac1f0226be523..674bc749bc11b 100644 --- a/packages/overlays/NavigationBarModeGesturalOverlayExtraWideBack/res/values/dimens.xml +++ b/packages/overlays/NavigationBarModeGesturalOverlayExtraWideBack/res/values/dimens.xml @@ -18,11 +18,11 @@ --> - 16dp + 24dp - 16dp + 24dp - 16dp + 24dp 48dp diff --git a/packages/overlays/NavigationBarModeGesturalOverlayNarrowBack/res/values/dimens.xml b/packages/overlays/NavigationBarModeGesturalOverlayNarrowBack/res/values/dimens.xml index ac1f0226be523..674bc749bc11b 100644 --- a/packages/overlays/NavigationBarModeGesturalOverlayNarrowBack/res/values/dimens.xml +++ b/packages/overlays/NavigationBarModeGesturalOverlayNarrowBack/res/values/dimens.xml @@ -18,11 +18,11 @@ --> - 16dp + 24dp - 16dp + 24dp - 16dp + 24dp 48dp diff --git a/packages/overlays/NavigationBarModeGesturalOverlayWideBack/res/values/dimens.xml b/packages/overlays/NavigationBarModeGesturalOverlayWideBack/res/values/dimens.xml index ac1f0226be523..674bc749bc11b 100644 --- a/packages/overlays/NavigationBarModeGesturalOverlayWideBack/res/values/dimens.xml +++ b/packages/overlays/NavigationBarModeGesturalOverlayWideBack/res/values/dimens.xml @@ -18,11 +18,11 @@ --> - 16dp + 24dp - 16dp + 24dp - 16dp + 24dp 48dp