From b543f846aa2f6a3cafb1607dac1dc0762a92e5aa Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Wed, 12 Jun 2019 16:39:43 -0700 Subject: [PATCH] Fixes an issue where the padding to the clock was wrong Because I moved around where the padding was set and there was also setting the same padding programmically, we ended up with double the padding after an event came in that never went away anymore. This is now fixed. I also adjusted the paddings slightly to adjust it back to the spec again, since the calculation was off by 1dp before. Fixes: 134927633 Test: atest SystemUITests Change-Id: I67395cb9b7bf54a95ceee51c3384539c4d53578e --- .../res-keyguard/layout/keyguard_presentation.xml | 2 +- .../res-keyguard/layout/keyguard_status_view.xml | 2 +- packages/SystemUI/res-keyguard/values/dimens.xml | 4 ++-- .../com/android/keyguard/KeyguardStatusView.java | 22 ++++++++++++---------- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_presentation.xml b/packages/SystemUI/res-keyguard/layout/keyguard_presentation.xml index a9ba19d2d393..f4d34f4ca141 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_presentation.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_presentation.xml @@ -41,7 +41,7 @@ diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml index e08a27779da5..847fba41f593 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml @@ -74,7 +74,7 @@ android:id="@+id/clock_notification_icon_container" android:layout_width="match_parent" android:layout_height="@dimen/notification_shelf_height" - android:layout_marginTop="18dp" + android:layout_marginTop="@dimen/widget_vertical_padding" /> diff --git a/packages/SystemUI/res-keyguard/values/dimens.xml b/packages/SystemUI/res-keyguard/values/dimens.xml index 8e00efeed62c..f9389ce24d96 100644 --- a/packages/SystemUI/res-keyguard/values/dimens.xml +++ b/packages/SystemUI/res-keyguard/values/dimens.xml @@ -53,8 +53,8 @@ 4dp @dimen/widget_title_font_size - 24dp - 32dp + 17dp + 25dp 12dp 8dp diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java index 65c80e22b1e1..83f72cf1ac2b 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java @@ -73,8 +73,8 @@ public class KeyguardStatusView extends GridLayout implements * Bottom margin that defines the margin between bottom of smart space and top of notification * icons on AOD. */ - private int mBottomMargin; - private int mBottomMarginWithHeader; + private int mIconTopMargin; + private int mIconTopMarginWithHeader; private boolean mShowingHeader; private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() { @@ -209,12 +209,14 @@ public class KeyguardStatusView extends GridLayout implements return; } mShowingHeader = hasHeader; - // Update bottom margin since header has appeared/disappeared. - if (mStatusViewContainer != null) { - MarginLayoutParams params = (MarginLayoutParams) mStatusViewContainer.getLayoutParams(); - params.setMargins(params.leftMargin, params.topMargin, params.rightMargin, - hasHeader ? mBottomMarginWithHeader : mBottomMargin); - mStatusViewContainer.setLayoutParams(params); + if (mNotificationIcons != null) { + // Update top margin since header has appeared/disappeared. + MarginLayoutParams params = (MarginLayoutParams) mNotificationIcons.getLayoutParams(); + params.setMargins(params.leftMargin, + hasHeader ? mIconTopMarginWithHeader : mIconTopMargin, + params.rightMargin, + params.bottomMargin); + mNotificationIcons.setLayoutParams(params); } } @@ -340,8 +342,8 @@ public class KeyguardStatusView extends GridLayout implements } private void loadBottomMargin() { - mBottomMargin = getResources().getDimensionPixelSize(R.dimen.widget_vertical_padding); - mBottomMarginWithHeader = getResources().getDimensionPixelSize( + mIconTopMargin = getResources().getDimensionPixelSize(R.dimen.widget_vertical_padding); + mIconTopMarginWithHeader = getResources().getDimensionPixelSize( R.dimen.widget_vertical_padding_with_header); } -- 2.11.0