Increasing top padding for notifications in split shade mode

In split shade mode notifications should be aligned to quick settings
header

Bug: 181235858
Test: manual + presubmit
Change-Id: Iae798f82bc8254b9834d0f4bea392bc3adfdb84e
This commit is contained in:
Michal Brzezinski
2021-04-09 10:13:09 +00:00
parent bcc5b4c1ff
commit eb9b254e4a
3 changed files with 19 additions and 5 deletions

View File

@@ -40,4 +40,9 @@
<dimen name="qs_tile_margin_top">32dp</dimen>
<dimen name="qs_brightness_padding_top">6dp</dimen>
<dimen name="qs_detail_margin_top">28dp</dimen>
<!-- In split shade mode notifications should be aligned to QS header so the value should be
adjusted to qs header height and height of centered content inside of it:
(quick_qs_offset_height (48dp) - ongoing_appops_chip_height (24dp) ) / 2 -->
<dimen name="notifications_top_padding_split_shade">12dp</dimen>
</resources>

View File

@@ -426,6 +426,11 @@
<!-- The padding between the notifications and the quick settings container -->
<dimen name="qs_notification_padding">@dimen/notification_side_paddings</dimen>
<!-- In split shade mode notifications should be aligned to QS header so the value should be
adjusted to qs header height and height of centered content inside of it:
(quick_qs_offset_height (60dp) - ongoing_appops_chip_height (24dp) ) / 2 -->
<dimen name="notifications_top_padding_split_shade">18dp</dimen>
<!-- Height of the status bar header bar when expanded -->
<dimen name="status_bar_header_height_expanded">124dp</dimen>

View File

@@ -369,6 +369,7 @@ public class NotificationPanelViewController extends PanelViewController {
private float mDownX;
private float mDownY;
private int mDisplayCutoutTopInset = 0; // in pixels
private int mSplitShadeNotificationsTopPadding;
private final KeyguardClockPositionAlgorithm
mClockPositionAlgorithm =
@@ -858,6 +859,8 @@ public class NotificationPanelViewController extends PanelViewController {
}
public void updateResources() {
mSplitShadeNotificationsTopPadding =
mResources.getDimensionPixelSize(R.dimen.notifications_top_padding_split_shade);
int qsWidth = mResources.getDimensionPixelSize(R.dimen.qs_panel_width);
int panelWidth = mResources.getDimensionPixelSize(R.dimen.notification_panel_width);
mShouldUseSplitNotificationShade =
@@ -2033,10 +2036,9 @@ public class NotificationPanelViewController extends PanelViewController {
}
}
private float calculateQsTopPadding() {
// in split shade mode we want notifications to be directly below status bar
private float calculateNotificationsTopPadding() {
if (mShouldUseSplitNotificationShade && !mKeyguardShowing) {
return 0f;
return mSplitShadeNotificationsTopPadding;
}
if (mKeyguardShowing && (mQsExpandImmediate
|| mIsExpanding && mQsExpandedWhenExpandingStarted)) {
@@ -2090,7 +2092,8 @@ public class NotificationPanelViewController extends PanelViewController {
protected void requestScrollerTopPaddingUpdate(boolean animate) {
mNotificationStackScrollLayoutController.updateTopPadding(calculateQsTopPadding(), animate);
mNotificationStackScrollLayoutController.updateTopPadding(
calculateNotificationsTopPadding(), animate);
if (mKeyguardShowing && mKeyguardBypassController.getBypassEnabled()) {
// update the position of the header
updateQsExpansion();
@@ -4098,7 +4101,8 @@ public class NotificationPanelViewController extends PanelViewController {
calculatePanelHeightShade(), p);
p.setColor(Color.MAGENTA);
canvas.drawLine(
0, calculateQsTopPadding(), mView.getWidth(), calculateQsTopPadding(), p);
0, calculateNotificationsTopPadding(), mView.getWidth(),
calculateNotificationsTopPadding(), p);
p.setColor(Color.CYAN);
canvas.drawLine(0, mClockPositionResult.stackScrollerPadding, mView.getWidth(),
mNotificationStackScrollLayoutController.getTopPadding(), p);