summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java11
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java16
2 files changed, 17 insertions, 10 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index 2ce19a26643d..027add067f84 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -118,7 +118,7 @@ public class NotificationStackScrollLayout extends ViewGroup
/**
* The algorithm which calculates the properties for our children
*/
- private StackScrollAlgorithm mStackScrollAlgorithm;
+ private final StackScrollAlgorithm mStackScrollAlgorithm;
/**
* The current State this Layout is in
@@ -258,6 +258,7 @@ public class NotificationStackScrollLayout extends ViewGroup
mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, getContext());
mSwipeHelper.setLongPressListener(mLongPressListener);
+ mStackScrollAlgorithm = new StackScrollAlgorithm(context);
initView(context);
if (DEBUG) {
setWillNotDraw(false);
@@ -303,8 +304,7 @@ public class NotificationStackScrollLayout extends ViewGroup
.getDimensionPixelSize(R.dimen.notification_min_height);
mBottomStackPeekSize = context.getResources()
.getDimensionPixelSize(R.dimen.bottom_stack_peek_amount);
- mStackScrollAlgorithm = new StackScrollAlgorithm(context);
- mStackScrollAlgorithm.setDimmed(mAmbientState.isDimmed());
+ mStackScrollAlgorithm.initView(context);
mPaddingBetweenElementsDimmed = context.getResources()
.getDimensionPixelSize(R.dimen.notification_padding_dimmed);
mPaddingBetweenElementsNormal = context.getResources()
@@ -367,6 +367,7 @@ public class NotificationStackScrollLayout extends ViewGroup
mRequestViewResizeAnimationOnLayout = false;
}
requestChildrenUpdate();
+ mStackScrollAlgorithm.notifyChildrenSizesChanged(this);
}
private void requestAnimationOnViewResize() {
@@ -1639,7 +1640,7 @@ public class NotificationStackScrollLayout extends ViewGroup
}
private void onViewRemovedInternal(View child) {
- mStackScrollAlgorithm.notifyChildrenChanged(this);
+ mStackScrollAlgorithm.notifyChildrenSizesChanged(this);
if (mChangePositionInProgress) {
// This is only a position change, don't do anything special
return;
@@ -1793,7 +1794,7 @@ public class NotificationStackScrollLayout extends ViewGroup
private void onViewAddedInternal(View child) {
updateHideSensitiveForChild(child);
- mStackScrollAlgorithm.notifyChildrenChanged(this);
+ mStackScrollAlgorithm.notifyChildrenSizesChanged(this);
((ExpandableView) child).setOnHeightChangedListener(this);
generateAddAnimation(child, false /* fromMoreCard */);
updateAnimationState(child);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
index 36c26ec5503f..2324d3753d72 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
@@ -73,14 +73,19 @@ public class StackScrollAlgorithm {
private boolean mScaleDimmed;
private HeadsUpManager mHeadsUpManager;
private int mFirstChildMinHeight;
+ private boolean mDimmed;
public StackScrollAlgorithm(Context context) {
+ initView(context);
+ }
+
+ public void initView(Context context) {
initConstants(context);
- updatePadding(false);
+ updatePadding();
}
- private void updatePadding(boolean dimmed) {
- mPaddingBetweenElements = dimmed && mScaleDimmed
+ private void updatePadding() {
+ mPaddingBetweenElements = mDimmed && mScaleDimmed
? mPaddingBetweenElementsDimmed
: mPaddingBetweenElementsNormal;
mTopStackTotalSize = mTopStackSlowDownLength + mPaddingBetweenElements
@@ -932,7 +937,7 @@ public class StackScrollAlgorithm {
this.mIsExpanded = isExpanded;
}
- public void notifyChildrenChanged(final NotificationStackScrollLayout hostView) {
+ public void notifyChildrenSizesChanged(final NotificationStackScrollLayout hostView) {
int firstItemMinHeight = hostView.getFirstItemMinHeight();
if (firstItemMinHeight != mFirstChildMinHeight) {
mFirstChildMinHeight = firstItemMinHeight;
@@ -948,7 +953,8 @@ public class StackScrollAlgorithm {
}
public void setDimmed(boolean dimmed) {
- updatePadding(dimmed);
+ mDimmed = dimmed;
+ updatePadding();
}
public void onReset(ExpandableView view) {