From c9d28b74eb586815da60abd23b1182f14d428a0b Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Mon, 22 Oct 2018 17:59:18 -0700 Subject: [PATCH] Remove dashes between clock and notifications Bug: 111405682 Test: visual - smart space, ambient notification, clock Change-Id: I68e0d9099e0d4eaa1a6c10838d584aded523c332 --- .../layout/keyguard_presentation.xml | 9 +--- .../layout/keyguard_status_area.xml | 1 + .../layout/keyguard_status_view.xml | 10 +---- .../SystemUI/res-keyguard/values/dimens.xml | 14 +++---- .../android/keyguard/KeyguardStatusView.java | 42 +++---------------- .../stack/NotificationStackScrollLayout.java | 31 ++++---------- .../phone/KeyguardClockPositionAlgorithm.java | 2 +- .../phone/NotificationIconAreaController.java | 24 ----------- 8 files changed, 24 insertions(+), 109 deletions(-) diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_presentation.xml b/packages/SystemUI/res-keyguard/layout/keyguard_presentation.xml index a795442c62f9c..7d8a1f5bbbc75 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_presentation.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_presentation.xml @@ -42,18 +42,11 @@ android:id="@+id/clock_view" android:layout_width="match_parent" android:layout_height="wrap_content" /> - + android:layout_below="@id/clock_view" /> diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml index 4ae2d41816564..32a7147cba850 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml @@ -59,19 +59,11 @@ android:id="@+id/clock_view" android:layout_width="match_parent" android:layout_height="wrap_content" /> - - + android:layout_below="@id/clock_view" /> 24dp - 7dp + 14dp 0dp 16dp @@ -52,19 +52,17 @@ 64dp + -25dp 24dp 0.6dp - - 12dp - 1dp - 26dp - 14dp + 32dp 8dp 16dp 8dp - - 28dp + 15dp + + -6dp 32dp diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java index 6d1313c151067..9a9247734512e 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java @@ -64,7 +64,6 @@ public class KeyguardStatusView extends GridLayout implements private TextView mLogoutView; private KeyguardClockSwitch mClockView; - private View mClockSeparator; private TextView mOwnerInfo; private KeyguardSliceView mKeyguardSlice; private Runnable mPendingMarqueeStart; @@ -75,8 +74,8 @@ public class KeyguardStatusView extends GridLayout implements private boolean mWasPulsing; private float mDarkAmount = 0; private int mTextColor; - private float mWidgetPadding; private int mLastLayoutHeight; + private int mSmallClockPadding; private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() { @@ -175,14 +174,12 @@ public class KeyguardStatusView extends GridLayout implements } mOwnerInfo = findViewById(R.id.owner_info); mKeyguardSlice = findViewById(R.id.keyguard_status_area); - mClockSeparator = findViewById(R.id.clock_separator); mVisibleInDoze = Sets.newArraySet(mClockView, mKeyguardSlice); mTextColor = mClockView.getCurrentTextColor(); int clockStroke = getResources().getDimensionPixelSize(R.dimen.widget_small_font_stroke); mClockView.getPaint().setStrokeWidth(clockStroke); mClockView.addOnLayoutChangeListener(this); - mClockSeparator.addOnLayoutChangeListener(this); mKeyguardSlice.setContentChangeListener(this::onSliceContentChanged); onSliceContentChanged(); @@ -199,26 +196,18 @@ public class KeyguardStatusView extends GridLayout implements } /** - * Moves clock and separator, adjusting margins when slice content changes. + * Moves clock, adjusting margins when slice content changes. */ private void onSliceContentChanged() { boolean smallClock = mKeyguardSlice.hasHeader() || mPulsing; - float clockScale = smallClock ? mSmallClockScale : 1; - RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mClockView.getLayoutParams(); - int height = mClockView.getHeight(); - layoutParams.bottomMargin = (int) -(height - (clockScale * height)); + layoutParams.bottomMargin = smallClock ? mSmallClockPadding : 0; mClockView.setLayoutParams(layoutParams); - - layoutParams = (RelativeLayout.LayoutParams) mClockSeparator.getLayoutParams(); - layoutParams.topMargin = smallClock ? (int) mWidgetPadding : 0; - layoutParams.bottomMargin = layoutParams.topMargin; - mClockSeparator.setLayoutParams(layoutParams); } /** - * Animate clock and its separator when necessary. + * Animate clock when necessary. */ @Override public void onLayoutChange(View view, int left, int top, int right, int bottom, @@ -258,25 +247,6 @@ public class KeyguardStatusView extends GridLayout implements mClockView.setStyle(style); mClockView.invalidate(); } - } else if (view == mClockSeparator) { - boolean hasSeparator = hasHeader && !mPulsing; - float alpha = hasSeparator ? 1 : 0; - mClockSeparator.animate().cancel(); - if (shouldAnimate) { - boolean isAwake = mDarkAmount != 0; - mClockSeparator.setY(oldTop + heightOffset); - mClockSeparator.animate() - .setInterpolator(Interpolators.FAST_OUT_SLOW_IN) - .setDuration(duration) - .setListener(isAwake ? null : new KeepAwakeAnimationListener(getContext())) - .setStartDelay(delay) - .y(top) - .alpha(alpha) - .start(); - } else { - mClockSeparator.setY(top); - mClockSeparator.setAlpha(alpha); - } } } @@ -291,7 +261,8 @@ public class KeyguardStatusView extends GridLayout implements @Override public void onDensityOrFontScaleChanged() { - mWidgetPadding = getResources().getDimension(R.dimen.widget_vertical_padding); + mSmallClockPadding = getResources() + .getDimensionPixelSize(R.dimen.widget_small_clock_padding); if (mClockView != null) { mClockView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.widget_big_font_size)); @@ -434,7 +405,6 @@ public class KeyguardStatusView extends GridLayout implements updateDozeVisibleViews(); mKeyguardSlice.setDarkAmount(mDarkAmount); mClockView.setTextColor(blendedTextColor); - mClockSeparator.setBackgroundColor(blendedTextColor); } private void layoutOwnerInfo() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index c9cbb40317dae..30d17017ca1cd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -25,7 +25,6 @@ import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.animation.TimeAnimator; import android.animation.ValueAnimator; -import android.animation.ValueAnimator.AnimatorUpdateListener; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.WallpaperManager; @@ -101,13 +100,11 @@ import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.notification.ShadeViewRefactor; import com.android.systemui.statusbar.notification.ShadeViewRefactor.RefactorComponent; -import com.android.systemui.statusbar.notification.VisibilityLocationProvider; import com.android.systemui.statusbar.notification.VisualStabilityManager; import com.android.systemui.statusbar.notification.logging.NotificationLogger; import com.android.systemui.statusbar.notification.row.ActivatableNotificationView; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableView; -import com.android.systemui.statusbar.notification.row.ExpandableView.OnHeightChangedListener; import com.android.systemui.statusbar.notification.row.FooterView; import com.android.systemui.statusbar.notification.row.NotificationBlockingHelperManager; import com.android.systemui.statusbar.notification.row.NotificationGuts; @@ -195,7 +192,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd // Current padding, will be either mRegularTopPadding or mDarkTopPadding private int mTopPadding; // Distance between AOD separator and shelf - private int mDarkSeparatorPadding; + private int mDarkShelfPadding; private int mBottomMargin; private int mBottomInset = 0; private float mQsExpansionFraction; @@ -424,8 +421,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private Runnable mAnimateScroll = this::animateScroll; private int mCornerRadius; private int mSidePaddings; - private final int mSeparatorWidth; - private final int mSeparatorThickness; private final Rect mBackgroundAnimationRect = new Rect(); private int mAntiBurnInOffsetX; private ArrayList> mExpandedHeightListeners = new ArrayList<>(); @@ -499,9 +494,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd res.getBoolean(R.bool.config_drawNotificationBackground); mFadeNotificationsOnDismiss = res.getBoolean(R.bool.config_fadeNotificationsOnDismiss); - mSeparatorWidth = res.getDimensionPixelSize(R.dimen.widget_separator_width); - mSeparatorThickness = res.getDimensionPixelSize(R.dimen.widget_separator_thickness); - mDarkSeparatorPadding = res.getDimensionPixelSize(R.dimen.widget_bottom_separator_padding); + mDarkShelfPadding = res.getDimensionPixelSize(R.dimen.widget_bottom_separator_padding); mRoundnessManager.setAnimatedChildren(mChildrenToAddAnimated); mRoundnessManager.setOnRoundingChangedCallback(this::invalidate); addOnExpandedHeightListener(mRoundnessManager::setExpanded); @@ -673,23 +666,15 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd final int lockScreenRight = getWidth() - mSidePaddings; final int lockScreenTop = mCurrentBounds.top; final int lockScreenBottom = mCurrentBounds.bottom; - int separatorWidth = 0; - int separatorThickness = 0; - if (mIconAreaController.hasShelfIconsWhenFullyDark()) { - separatorThickness = mSeparatorThickness; - separatorWidth = mSeparatorWidth; - } - final int darkLeft = getWidth() / 2 - separatorWidth / 2; - final int darkRight = darkLeft + separatorWidth; - final int darkTop = (int) (mRegularTopPadding + separatorThickness / 2f); - final int darkBottom = darkTop + separatorThickness; + final int darkLeft = getWidth() / 2; + final int darkTop = mRegularTopPadding; if (mAmbientState.hasPulsingNotifications()) { // No divider, we have a notification icon instead } else if (mAmbientState.isFullyDark()) { // Only draw divider on AOD if we actually have notifications if (mFirstVisibleBackgroundChild != null) { - canvas.drawRect(darkLeft, darkTop, darkRight, darkBottom, mBackgroundPaint); + canvas.drawRect(darkLeft, darkTop, darkLeft, darkTop, mBackgroundPaint); } } else { float yProgress = 1 - mInterpolatedDarkAmount; @@ -699,8 +684,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd mBackgroundAnimationRect.set( (int) MathUtils.lerp(darkLeft, lockScreenLeft, xProgress), (int) MathUtils.lerp(darkTop, lockScreenTop, yProgress), - (int) MathUtils.lerp(darkRight, lockScreenRight, xProgress), - (int) MathUtils.lerp(darkBottom, lockScreenBottom, yProgress)); + (int) MathUtils.lerp(darkLeft, lockScreenRight, xProgress), + (int) MathUtils.lerp(darkTop, lockScreenBottom, yProgress)); if (!mAmbientState.isDark() || mFirstVisibleBackgroundChild != null) { canvas.drawRoundRect(mBackgroundAnimationRect.left, mBackgroundAnimationRect.top, @@ -1013,7 +998,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private void setTopPadding(int topPadding, boolean animate) { if (mRegularTopPadding != topPadding) { mRegularTopPadding = topPadding; - mDarkTopPadding = topPadding + mDarkSeparatorPadding; + mDarkTopPadding = topPadding + mDarkShelfPadding; mAmbientState.setDarkTopPadding(mDarkTopPadding); updateAlgorithmHeightAndPadding(); updateContentHeight(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java index 836a55fde0f1d..4a7bc3a243534 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java @@ -145,7 +145,7 @@ public class KeyguardClockPositionAlgorithm { final int y = getClockY(); result.clockY = y; result.clockAlpha = getClockAlpha(y); - result.stackScrollerPadding = y + (mPulsing ? 0 : mKeyguardStatusHeight); + result.stackScrollerPadding = y + (mPulsing ? mPulsingPadding : mKeyguardStatusHeight); result.clockX = (int) interpolate(0, burnInPreventionOffsetX(), mDarkAmount); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java index b19f57d0dc93c..21b98db11a361 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java @@ -49,7 +49,6 @@ public class NotificationIconAreaController implements DarkReceiver { private ViewGroup mNotificationScrollLayout; private Context mContext; private boolean mFullyDark; - private boolean mHasShelfIconsWhenFullyDark; public NotificationIconAreaController(Context context, StatusBar statusBar) { mStatusBar = statusBar; @@ -176,33 +175,10 @@ public class NotificationIconAreaController implements DarkReceiver { updateStatusBarIcons(); updateShelfIcons(); - updateHasShelfIconsWhenFullyDark(); applyNotificationIconsTint(); } - private void updateHasShelfIconsWhenFullyDark() { - boolean hasIconsWhenFullyDark = false; - for (int i = 0; i < mNotificationScrollLayout.getChildCount(); i++) { - View view = mNotificationScrollLayout.getChildAt(i); - if (view instanceof ExpandableNotificationRow) { - NotificationData.Entry ent = ((ExpandableNotificationRow) view).getEntry(); - if (shouldShowNotificationIcon(ent, - NotificationShelf.SHOW_AMBIENT_ICONS /* showAmbient */, - false /* hideDismissed */, - true /* hideReplied */)) { - hasIconsWhenFullyDark = true; - break; - } - } - } - mHasShelfIconsWhenFullyDark = hasIconsWhenFullyDark; - } - - public boolean hasShelfIconsWhenFullyDark() { - return mHasShelfIconsWhenFullyDark; - } - private void updateShelfIcons() { updateIconsForLayout(entry -> entry.expandedIcon, mShelfIcons, NotificationShelf.SHOW_AMBIENT_ICONS, false /* hideDismissed */,