Adjust QS side spacing in split shade according to specs

QS should have 40dp margins on both sides.
Dimensions in QS were dependent on dimensions of notification so I extracted them to separate dimensions - dependendent on notifications in regular shade but indepedent in large screen shade.
Also created new qs_tiles_page_horizontal_margin because it should have different value on its own for large screen, otherwise clipping of QS tiles while swiping was not reaching edge of screen and notification scrim.

Fixes: 228056456
Test: open split shade QS and swipe between tile pages
Change-Id: Ie72548b6a84aaf43381b5da497aa7912a0eb7b1d
This commit is contained in:
Michal Brzezinski
2022-04-12 16:58:31 +01:00
parent 239f082d75
commit f4d20b9f1b
6 changed files with 58 additions and 25 deletions

View File

@@ -22,6 +22,4 @@
<!-- Overload default clock widget parameters -->
<dimen name="widget_big_font_size">88dp</dimen>
<dimen name="qs_panel_padding_top">16dp</dimen>
</resources>
</resources>

View File

@@ -19,7 +19,7 @@
android:id="@+id/tile_page"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="@dimen/notification_side_paddings"
android:paddingEnd="@dimen/notification_side_paddings"
android:paddingStart="@dimen/qs_tiles_page_horizontal_margin"
android:paddingEnd="@dimen/qs_tiles_page_horizontal_margin"
android:clipChildren="false"
android:clipToPadding="false" />

View File

@@ -21,13 +21,20 @@
<dimen name="keyguard_indication_margin_bottom">25dp</dimen>
<dimen name="ambient_indication_margin_bottom">115dp</dimen>
<dimen name="lock_icon_margin_bottom">60dp</dimen>
<dimen name="qs_media_session_height_expanded">172dp</dimen>
<!-- margin from keyguard status bar to clock. For split shade it should be
keyguard_split_shade_top_margin - status_bar_header_height_keyguard = 8dp -->
<dimen name="keyguard_clock_top_margin">8dp</dimen>
<!-- QS-->
<dimen name="qs_panel_padding_top">16dp</dimen>
<dimen name="qs_content_horizontal_padding">24dp</dimen>
<dimen name="qs_horizontal_margin">24dp</dimen>
<!-- in split shade qs_tiles_page_horizontal_margin should be equal of qs_horizontal_margin/2,
otherwise full space between two pages is qs_horizontal_margin*2, and that makes tiles page
not appear immediately after user swipes to the side -->
<dimen name="qs_tiles_page_horizontal_margin">12dp</dimen>
<dimen name="qs_media_session_height_expanded">172dp</dimen>
<dimen name="split_shade_notifications_scrim_margin_bottom">16dp</dimen>
<dimen name="notification_panel_margin_bottom">48dp</dimen>

View File

@@ -26,6 +26,12 @@
<dimen name="status_bar_header_height_keyguard">56dp</dimen>
<dimen name="qs_media_session_height_expanded">251dp</dimen>
<dimen name="qs_content_horizontal_padding">40dp</dimen>
<dimen name="qs_horizontal_margin">40dp</dimen>
<!-- in split shade qs_tiles_page_horizontal_margin should be equal of qs_horizontal_margin/2,
otherwise full space between two pages is qs_horizontal_margin*2, and that makes tiles page
not appear immediately after user swipes to the side -->
<dimen name="qs_tiles_page_horizontal_margin">20dp</dimen>
<dimen name="lockscreen_shade_max_over_scroll_amount">42dp</dimen>

View File

@@ -478,6 +478,22 @@
<dimen name="qqs_layout_margin_top">16dp</dimen>
<dimen name="qqs_layout_padding_bottom">24dp</dimen>
<!-- Most of the time it should be the same as notification_side_paddings as it's vertically
aligned with notifications. The exception is split shade when this value becomes
independent -->
<dimen name="qs_horizontal_margin">@dimen/notification_side_paddings</dimen>
<!-- Most of the time it should be the same as notification_shade_content_margin_horizontal as
it's vertically aligned with notifications. The exception is split shade when this value
becomes independent -->
<dimen name="qs_content_horizontal_padding">@dimen/notification_shade_content_margin_horizontal</dimen>
<!-- Most of the time it should be the same as notification_side_paddings as it's vertically
aligned with notifications. That's not the case on large screen when we have either split
shade and QS is not above notifications or in portrait shade when notification scrim is no
longer full width and next page of tiles should be at the edge of the screen -->
<dimen name="qs_tiles_page_horizontal_margin">@dimen/notification_side_paddings</dimen>
<dimen name="qs_customize_internal_side_paddings">8dp</dimen>
<dimen name="qs_icon_size">20dp</dimen>
<dimen name="qs_side_view_size">28dp</dimen>

View File

@@ -47,9 +47,10 @@ public class QSContainerImpl extends FrameLayout implements Dumpable {
private QSCustomizer mQSCustomizer;
private NonInterceptingScrollView mQSPanelContainer;
private int mSideMargins;
private int mHorizontalMargins;
private int mTilesPageMargin;
private boolean mQsDisabled;
private int mContentPadding = -1;
private int mContentHorizontalPadding = -1;
private boolean mClippingEnabled;
public QSContainerImpl(Context context, AttributeSet attrs) {
@@ -145,12 +146,17 @@ public class QSContainerImpl extends FrameLayout implements Dumpable {
mQSPanelContainer.getPaddingEnd(),
bottomPadding);
int sideMargins = getResources().getDimensionPixelSize(R.dimen.notification_side_paddings);
int padding = getResources().getDimensionPixelSize(
R.dimen.notification_shade_content_margin_horizontal);
boolean marginsChanged = padding != mContentPadding || sideMargins != mSideMargins;
mContentPadding = padding;
mSideMargins = sideMargins;
int horizontalMargins = getResources().getDimensionPixelSize(R.dimen.qs_horizontal_margin);
int horizontalPadding = getResources().getDimensionPixelSize(
R.dimen.qs_content_horizontal_padding);
int tilesPageMargin = getResources().getDimensionPixelSize(
R.dimen.qs_tiles_page_horizontal_margin);
boolean marginsChanged = horizontalPadding != mContentHorizontalPadding
|| horizontalMargins != mHorizontalMargins
|| tilesPageMargin != mTilesPageMargin;
mContentHorizontalPadding = horizontalPadding;
mHorizontalMargins = horizontalMargins;
mTilesPageMargin = tilesPageMargin;
if (marginsChanged) {
updatePaddingsAndMargins(qsPanelController, quickStatusBarHeaderController);
}
@@ -198,22 +204,22 @@ public class QSContainerImpl extends FrameLayout implements Dumpable {
// Only padding for FooterActionsView, no margin. That way, the background goes
// all the way to the edge.
LayoutParams lp = (LayoutParams) view.getLayoutParams();
lp.rightMargin = mSideMargins;
lp.leftMargin = mSideMargins;
lp.rightMargin = mHorizontalMargins;
lp.leftMargin = mHorizontalMargins;
}
if (view == mQSPanelContainer) {
// QS panel lays out some of its content full width
qsPanelController.setContentMargins(mContentPadding, mContentPadding);
// Set it as double the side margin (to simulate end margin of current page +
// start margin of next page).
qsPanelController.setPageMargin(mSideMargins);
qsPanelController.setContentMargins(mContentHorizontalPadding,
mContentHorizontalPadding);
qsPanelController.setPageMargin(mTilesPageMargin);
} else if (view == mHeader) {
quickStatusBarHeaderController.setContentMargins(mContentPadding, mContentPadding);
quickStatusBarHeaderController.setContentMargins(mContentHorizontalPadding,
mContentHorizontalPadding);
} else {
view.setPaddingRelative(
mContentPadding,
mContentHorizontalPadding,
view.getPaddingTop(),
mContentPadding,
mContentHorizontalPadding,
view.getPaddingBottom());
}
}