Merge "Add flags to enable Notifications clipping." into tm-qpr-dev

This commit is contained in:
Ben Lin
2022-11-15 23:08:11 +00:00
committed by Android (Google) Code Review
3 changed files with 13 additions and 5 deletions

View File

@@ -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>

View File

@@ -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);

View File

@@ -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;
}