summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Selim Cinek <cinek@google.com> 2015-12-15 17:01:44 -0800
committer Selim Cinek <cinek@google.com> 2015-12-19 16:07:53 -0800
commitaf0dc31892d03670e22e5e33e6a0b345be701b9d (patch)
treef777b05ad23fc6e8622113a06a172962a42615dd
parentd84a5930cca7add37e7e23305538d29959daf199 (diff)
Reusing the notification algorithm now when rotating
The notification algorithm had some state which was simply dropped on rotation and therefore weird things could happen. This is now fixed. Change-Id: Ibb3d007b3298f745743bd3a5889bccebebf8105a
-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) {