Android 10 导航栏按钮图标点击范围过大

diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 421a58f..96b7967 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -109,6 +109,8 @@ public class NavigationBarView extends FrameLayout implements
     private Rect mBackButtonBounds = new Rect();
     private Rect mRecentsButtonBounds = new Rect();
     private Rect mRotationButtonBounds = new Rect();
+    private Rect mVolumeAddButtonBounds = new Rect();
+    private Rect mVolumeSubButtonBounds = new Rect();
     private final Region mActiveRegion = new Region();
     private int[] mTmpPosition = new int[2];
 
@@ -878,6 +880,8 @@ public class NavigationBarView extends FrameLayout implements
         updateButtonLocation(getBackButton(), mBackButtonBounds, true);
         updateButtonLocation(getHomeButton(), mHomeButtonBounds, false);
         updateButtonLocation(getRecentsButton(), mRecentsButtonBounds, false);
+        updateButtonLocation(getVolumeAddButton(), mVolumeAddButtonBounds, false);
+        updateButtonLocation(getVolumeSubButton(), mVolumeSubButtonBounds, false);
         updateButtonLocation(getRotateSuggestionButton(), mRotationButtonBounds, true);
         // TODO: Handle button visibility changes
         mOverviewProxyService.onActiveNavBarRegionChanges(mActiveRegion);
@@ -924,6 +928,13 @@ public class NavigationBarView extends FrameLayout implements
     }
 
     private void updateCurrentView() {
+        if (mCurrentRotation == Surface.ROTATION_0
+                || mCurrentRotation == Surface.ROTATION_180) {
+            setPadding(650, 0, 650, 0);
+        } else if (mCurrentRotation == Surface.ROTATION_90
+                || mCurrentRotation == Surface.ROTATION_270) {
+            setPadding(230, 0, 230, 0);
+        }
         resetViews();
         mCurrentView = mIsVertical ? mVertical : mHorizontal;
         mCurrentView.setVisibility(View.VISIBLE);
@@ -1173,8 +1184,17 @@ public class NavigationBarView extends FrameLayout implements
     public WindowInsets onApplyWindowInsets(WindowInsets insets) {
         int leftInset = insets.getSystemWindowInsetLeft();
         int rightInset = insets.getSystemWindowInsetRight();
-        setPadding(leftInset, insets.getSystemWindowInsetTop(), rightInset,
-                insets.getSystemWindowInsetBottom());
+//        setPadding(leftInset, insets.getSystemWindowInsetTop(), rightInset,
+//                insets.getSystemWindowInsetBottom());
+        if (mCurrentRotation == Surface.ROTATION_0
+                || mCurrentRotation == Surface.ROTATION_180) {
+            setPadding(650, insets.getSystemWindowInsetTop(), 650,
+                    insets.getSystemWindowInsetBottom());
+        } else if (mCurrentRotation == Surface.ROTATION_90
+                || mCurrentRotation == Surface.ROTATION_270) {
+            setPadding(230, insets.getSystemWindowInsetTop(), 230,
+                    insets.getSystemWindowInsetBottom());
+        }
         // we're passing the insets onto the gesture handler since the back arrow is only
         // conditionally added and doesn't always get all the insets.
         mEdgeBackGestureHandler.setInsets(leftInset, rightInset);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值