diff options
author | Selim Cinek <cinek@google.com> | 2014-05-02 10:16:06 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-05-02 10:16:06 +0000 |
commit | 97f1b8572f9fba9c5bf771951fa24459e3bdb9c7 (patch) | |
tree | 022cea312783025315897c08dedd942da795858c /packages | |
parent | 13353dbc746d48aac5ea61add6de29039625211a (diff) | |
parent | 1f553cfcf286874e154f61798fb01a5be48ce911 (diff) | |
download | frameworks_base-97f1b8572f9fba9c5bf771951fa24459e3bdb9c7.zip frameworks_base-97f1b8572f9fba9c5bf771951fa24459e3bdb9c7.tar.gz frameworks_base-97f1b8572f9fba9c5bf771951fa24459e3bdb9c7.tar.bz2 |
Merge "Removed always running preDrawListener"
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java | 19 |
1 files changed, 10 insertions, 9 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 4c0962e..0114f3c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -106,15 +106,14 @@ public class NotificationStackScrollLayout extends ViewGroup private ExpandableView.OnHeightChangedListener mOnHeightChangedListener; private boolean mChildHierarchyDirty; private boolean mIsExpanded = true; - private boolean mChildrenNeedUpdate; - private ViewTreeObserver.OnPreDrawListener mPreDrawListener + private boolean mChildrenUpdateRequested; + private ViewTreeObserver.OnPreDrawListener mChildrenUpdater = new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { - if (mChildrenNeedUpdate) { - updateChildren(); - mChildrenNeedUpdate = false; - } + updateChildren(); + mChildrenUpdateRequested = false; + getViewTreeObserver().removeOnPreDrawListener(this); return true; } }; @@ -181,7 +180,6 @@ public class NotificationStackScrollLayout extends ViewGroup mPaddingBetweenElements = context.getResources() .getDimensionPixelSize(R.dimen.notification_padding); mStackScrollAlgorithm = new StackScrollAlgorithm(context); - getViewTreeObserver().addOnPreDrawListener(mPreDrawListener); } @Override @@ -275,8 +273,11 @@ public class NotificationStackScrollLayout extends ViewGroup } private void requestChildrenUpdate() { - mChildrenNeedUpdate = true; - invalidate(); + if (!mChildrenUpdateRequested) { + getViewTreeObserver().addOnPreDrawListener(mChildrenUpdater); + mChildrenUpdateRequested = true; + invalidate(); + } } private boolean isCurrentlyAnimating() { |