From 021eee53e52c880a529ece28a3a9edb3cd0776b7 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Thu, 11 Jun 2015 17:07:18 -0700 Subject: [PATCH] Fix dark mode for custom views Bug: 20847909 Change-Id: I9f5c6cf2d0fa4e632ce654660050a48c76bc671b --- .../src/com/android/systemui/statusbar/BaseStatusBar.java | 2 +- .../android/systemui/statusbar/NotificationContentView.java | 4 ++-- .../android/systemui/statusbar/stack/StackScrollState.java | 6 +++--- .../systemui/statusbar/stack/StackStateAnimator.java | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index c945fc9d9f6e0..626202fb2264a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -1377,7 +1377,6 @@ public abstract class BaseStatusBar extends SystemUI implements R.layout.notification_public_default, contentContainerPublic, false); publicViewLocal.setIsRootNamespace(true); - contentContainerPublic.setContractedChild(publicViewLocal); final TextView title = (TextView) publicViewLocal.findViewById(R.id.title); try { @@ -1443,6 +1442,7 @@ public abstract class BaseStatusBar extends SystemUI implements mContext.getResources().getConfiguration().fontScale); title.setPadding(0, topPadding, 0, 0); + contentContainerPublic.setContractedChild(publicViewLocal); entry.autoRedacted = true; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java index 8172a4d36ab6a..86d7f4f5a8173 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java @@ -311,9 +311,9 @@ public class NotificationContentView extends FrameLayout { } int visibleType = calculateVisibleType(); if (visibleType != mVisibleType || force) { - if (animate && (visibleType == VISIBLE_TYPE_EXPANDED && mExpandedChild != null) + if (animate && ((visibleType == VISIBLE_TYPE_EXPANDED && mExpandedChild != null) || (visibleType == VISIBLE_TYPE_HEADSUP && mHeadsUpChild != null) - || visibleType == VISIBLE_TYPE_CONTRACTED) { + || visibleType == VISIBLE_TYPE_CONTRACTED)) { runSwitchAnimation(visibleType); } else { updateViewVisibilities(visibleType); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java index feae590aecfe7..abe90cd1292d3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java @@ -149,9 +149,6 @@ public class StackScrollState { // apply dimming view.setDimmed(state.dimmed, false /* animate */); - // apply dark - view.setDark(state.dark, false /* animate */, 0 /* delay */); - // apply hiding sensitive view.setHideSensitive( state.hideSensitive, false /* animated */, 0 /* delay */, 0 /* duration */); @@ -159,6 +156,9 @@ public class StackScrollState { // apply speed bump state view.setBelowSpeedBump(state.belowSpeedBump); + // apply dark + view.setDark(state.dark, false /* animate */, 0 /* delay */); + // apply clipping float oldClipTopAmount = view.getClipTopAmount(); if (oldClipTopAmount != state.clipTopAmount) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java index c31244ce36187..f377dab1ae896 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java @@ -243,9 +243,6 @@ public class StackStateAnimator { // start dimmed animation child.setDimmed(viewState.dimmed, mAnimationFilter.animateDimmed); - // start dark animation - child.setDark(viewState.dark, mAnimationFilter.animateDark, delay); - // apply speed bump state child.setBelowSpeedBump(viewState.belowSpeedBump); @@ -253,6 +250,9 @@ public class StackStateAnimator { child.setHideSensitive(viewState.hideSensitive, mAnimationFilter.animateHideSensitive, delay, duration); + // start dark animation + child.setDark(viewState.dark, mAnimationFilter.animateDark, delay); + if (wasAdded) { child.performAddAnimation(delay, mCurrentLength); }