From 2c5fce62f1999ec1681cb7b83c1320da83642ffe Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Mon, 5 Mar 2018 19:06:00 -0800 Subject: [PATCH] Fix notification padding and slice collision Slices should completely replace notifications, they should never be visible at the same time. Test: send notification, look at AOD Change-Id: I14f04db1e4541a24f7b9117659e4c9481262aeff Fixes: 73908553 --- .../com/android/keyguard/KeyguardSliceView.java | 16 +++++++++++++--- .../com/android/keyguard/KeyguardStatusView.java | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java index 2adb2869e0f6c..b657ba75151c0 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java @@ -72,6 +72,7 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe private int mIconSize; private Consumer mListener; private boolean mHasHeader; + private boolean mHideContent; public KeyguardSliceView(Context context) { this(context, null, 0); @@ -192,12 +193,16 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe } } - final int visibility = mHasHeader || subItemsCount > 0 ? VISIBLE : GONE; + updateVisibility(); + mListener.accept(mHasHeader); + } + + private void updateVisibility() { + final boolean hasContent = mHasHeader || mRow.getChildCount() > 0; + final int visibility = hasContent && !mHideContent ? VISIBLE : GONE; if (visibility != getVisibility()) { setVisibility(visibility); } - - mListener.accept(mHasHeader); } /** @@ -321,6 +326,11 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe updateTextColors(); } + public void setHideContent(boolean hideContent) { + mHideContent = hideContent; + updateVisibility(); + } + /** * Representation of an item that appears under the clock on main keyguard message. */ diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java index 3b5f34cd84ccd..a3ffa40ee19a1 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java @@ -362,7 +362,7 @@ public class KeyguardStatusView extends GridLayout { public void setPulsing(boolean pulsing) { mPulsing = pulsing; - mKeyguardSlice.setVisibility(pulsing ? INVISIBLE : VISIBLE); + mKeyguardSlice.setHideContent(pulsing); onSliceContentChanged(mKeyguardSlice.hasHeader()); updateDozeVisibleViews(); }