diff options
author | Jorim Jaggi <jjaggi@google.com> | 2014-05-20 21:28:59 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-05-20 21:29:00 +0000 |
commit | 112e5147f64a953717d408528c4e70cd469f04eb (patch) | |
tree | 5bb916f40deeb8e8cdb97325696c8a3da9290bf2 /packages/SystemUI/src | |
parent | 23a42810e341fbc7444bcab4a61279d879e0c610 (diff) | |
parent | 3c3c3fc38c474924629aa591c98d6dc190ed4e83 (diff) | |
download | frameworks_base-112e5147f64a953717d408528c4e70cd469f04eb.zip frameworks_base-112e5147f64a953717d408528c4e70cd469f04eb.tar.gz frameworks_base-112e5147f64a953717d408528c4e70cd469f04eb.tar.bz2 |
Merge "Fix invisible notification backgrounds."
Diffstat (limited to 'packages/SystemUI/src')
3 files changed, 14 insertions, 21 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java index 724b6a4..ac16164 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java @@ -89,7 +89,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView super.onFinishInflate(); mBackgroundNormal = (NotificationBackgroundView) findViewById(R.id.backgroundNormal); mBackgroundDimmed = (NotificationBackgroundView) findViewById(R.id.backgroundDimmed); - updateBackgroundResource(); + updateBackgroundResources(); } private final Runnable mTapTimeoutRunnable = new Runnable() { @@ -215,9 +215,9 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView if (mDimmed != dimmed) { mDimmed = dimmed; if (fade) { - fadeBackgroundResource(); + fadeBackground(); } else { - updateBackgroundResource(); + updateBackground(); } } } @@ -233,14 +233,14 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView mBgTint = bgTint; mDimmedBgResId = dimmedBgResId; mDimmedBgTint = dimmedTint; - updateBackgroundResource(); + updateBackgroundResources(); } public void setBackgroundResourceIds(int bgResId, int dimmedBgResId) { setBackgroundResourceIds(bgResId, 0, dimmedBgResId, 0); } - private void fadeBackgroundResource() { + private void fadeBackground() { if (mDimmed) { mBackgroundDimmed.setVisibility(View.VISIBLE); } else { @@ -256,7 +256,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView mBackgroundAnimator.removeAllListeners(); mBackgroundAnimator.cancel(); if (duration <= 0) { - updateBackgroundResource(); + updateBackground(); return; } } @@ -279,19 +279,22 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView mBackgroundAnimator.start(); } - private void updateBackgroundResource() { + private void updateBackground() { if (mDimmed) { mBackgroundDimmed.setVisibility(View.VISIBLE); - mBackgroundDimmed.setCustomBackground(mDimmedBgResId, mDimmedBgTint); mBackgroundNormal.setVisibility(View.INVISIBLE); } else { mBackgroundDimmed.setVisibility(View.INVISIBLE); mBackgroundNormal.setVisibility(View.VISIBLE); - mBackgroundNormal.setCustomBackground(mBgResId, mBgTint); mBackgroundNormal.setAlpha(1f); } } + private void updateBackgroundResources() { + mBackgroundDimmed.setCustomBackground(mDimmedBgResId, mDimmedBgTint); + mBackgroundNormal.setCustomBackground(mBgResId, mBgTint); + } + @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java index 0d3116f..eaaac10 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java @@ -90,9 +90,8 @@ public abstract class ExpandableView extends FrameLayout { protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); if (!mActualHeightInitialized && mActualHeight == 0) { - mActualHeight = getInitialHeight(); + setActualHeight(getInitialHeight()); } - mActualHeightInitialized = true; } protected int getInitialHeight() { @@ -127,6 +126,7 @@ public abstract class ExpandableView extends FrameLayout { } public void setActualHeight(int actualHeight) { + mActualHeightInitialized = true; setActualHeight(actualHeight, true); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBackgroundView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBackgroundView.java index e49ec64..3c080fe 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBackgroundView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBackgroundView.java @@ -31,7 +31,6 @@ public class NotificationBackgroundView extends View { private Drawable mBackground; private int mClipTopAmount; private int mActualHeight; - private boolean mActualHeightInitialized; public NotificationBackgroundView(Context context, AttributeSet attrs) { super(context, attrs); @@ -39,15 +38,6 @@ public class NotificationBackgroundView extends View { } @Override - protected void onLayout(boolean changed, int left, int top, int right, int bottom) { - super.onLayout(changed, left, top, right, bottom); - if (!mActualHeightInitialized && mActualHeight == 0) { - mActualHeight = getHeight(); - } - mActualHeightInitialized = true; - } - - @Override protected void onDraw(Canvas canvas) { draw(canvas, mBackground); } |