diff options
| author | 2022-11-15 23:08:11 +0000 | |
|---|---|---|
| committer | 2022-11-15 23:08:11 +0000 | |
| commit | 85ce6f1b4e72d6049a82e8c59511d02f33f90dfc (patch) | |
| tree | f90c5a4b5db900b965b4174fa7ca298803b89eb6 | |
| parent | a3542e18d252c91e8b7524d13727e3152b068d7e (diff) | |
| parent | 89d5739071fae7d456e19dbcbbac97aa62642fb3 (diff) | |
Merge "Add flags to enable Notifications clipping." into tm-qpr-dev
3 files changed, 13 insertions, 5 deletions
diff --git a/packages/SystemUI/res/values/bools.xml b/packages/SystemUI/res/values/bools.xml index 8221d78fbfd7..04fc4b8c45a8 100644 --- a/packages/SystemUI/res/values/bools.xml +++ b/packages/SystemUI/res/values/bools.xml @@ -25,6 +25,9 @@ <!-- Whether to enable clipping on Quick Settings --> <bool name="qs_enable_clipping">true</bool> + <!-- Whether to enable clipping on Notification Views --> + <bool name="notification_enable_clipping">true</bool> + <!-- Whether to enable transparent background for notification scrims --> <bool name="notification_scrim_transparent">false</bool> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index cd130854ff3f..d7eddf53dea5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -71,6 +71,7 @@ public class NotificationShelf extends ActivatableNotificationView implements private int[] mTmp = new int[2]; private boolean mHideBackground; private int mStatusBarHeight; + private boolean mEnableNotificationClipping; private AmbientState mAmbientState; private NotificationStackScrollLayoutController mHostLayoutController; private int mPaddingBetweenElements; @@ -117,7 +118,7 @@ public class NotificationShelf extends ActivatableNotificationView implements // Setting this to first in section to get the clipping to the top roundness correct. This // value determines the way we are clipping to the top roundness of the overall shade setFirstInSection(true); - initDimens(); + updateResources(); } public void bind(AmbientState ambientState, @@ -126,7 +127,7 @@ public class NotificationShelf extends ActivatableNotificationView implements mHostLayoutController = hostLayoutController; } - private void initDimens() { + private void updateResources() { Resources res = getResources(); mStatusBarHeight = SystemBarUtils.getStatusBarHeight(mContext); mPaddingBetweenElements = res.getDimensionPixelSize(R.dimen.notification_divider_height); @@ -144,6 +145,7 @@ public class NotificationShelf extends ActivatableNotificationView implements mShowNotificationShelf = res.getBoolean(R.bool.config_showNotificationShelf); mCornerAnimationDistance = res.getDimensionPixelSize( R.dimen.notification_corner_animation_distance); + mEnableNotificationClipping = res.getBoolean(R.bool.notification_enable_clipping); mShelfIcons.setInNotificationIconShelf(true); if (!mShowNotificationShelf) { @@ -154,7 +156,7 @@ public class NotificationShelf extends ActivatableNotificationView implements @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); - initDimens(); + updateResources(); } @Override @@ -639,7 +641,8 @@ public class NotificationShelf extends ActivatableNotificationView implements } if (!isPinned) { if (viewEnd > notificationClipEnd && !shouldClipOwnTop) { - int clipBottomAmount = (int) (viewEnd - notificationClipEnd); + int clipBottomAmount = + mEnableNotificationClipping ? (int) (viewEnd - notificationClipEnd) : 0; view.setClipBottomAmount(clipBottomAmount); } else { view.setClipBottomAmount(0); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java index eea1d9118fb7..62f57b8d4068 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java @@ -57,6 +57,7 @@ public class StackScrollAlgorithm { private float mGapHeight; private float mGapHeightOnLockscreen; private int mCollapsedSize; + private boolean mEnableNotificationClipping; private StackScrollAlgorithmState mTempAlgorithmState = new StackScrollAlgorithmState(); private boolean mIsExpanded; @@ -85,6 +86,7 @@ public class StackScrollAlgorithm { mPaddingBetweenElements = res.getDimensionPixelSize( R.dimen.notification_divider_height); mCollapsedSize = res.getDimensionPixelSize(R.dimen.notification_min_height); + mEnableNotificationClipping = res.getBoolean(R.bool.notification_enable_clipping); mClipNotificationScrollToTop = res.getBoolean(R.bool.config_clipNotificationScrollToTop); int statusBarHeight = SystemBarUtils.getStatusBarHeight(context); mHeadsUpInset = statusBarHeight + res.getDimensionPixelSize( @@ -289,7 +291,7 @@ public class StackScrollAlgorithm { // The bottom of this view is peeking out from under the previous view. // Clip the part that is peeking out. float overlapAmount = newNotificationEnd - firstHeadsUpEnd; - state.clipBottomAmount = (int) overlapAmount; + state.clipBottomAmount = mEnableNotificationClipping ? (int) overlapAmount : 0; } else { state.clipBottomAmount = 0; } |