diff options
author | Danny Baumann <dannybaumann@web.de> | 2013-07-14 13:12:50 +0200 |
---|---|---|
committer | Danny Baumann <dannybaumann@web.de> | 2013-07-16 12:37:33 +0200 |
commit | c233a5bdf397b423c54f038935fcaf05b6d143e6 (patch) | |
tree | 4cd81205a0d067b4c8e27c38b9d8fb70f0a0cb70 /packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java | |
parent | 6c33ad36e429b3a3ad69e53275714ca43cdc03fe (diff) | |
download | frameworks_base-c233a5bdf397b423c54f038935fcaf05b6d143e6.zip frameworks_base-c233a5bdf397b423c54f038935fcaf05b6d143e6.tar.gz frameworks_base-c233a5bdf397b423c54f038935fcaf05b6d143e6.tar.bz2 |
Improve notification shade collapse code.
- Collapse after dismissing the last notification
- Avoid duplicate code paths for collapsing
- Improve variable naming according to AOSP review suggestions
Change-Id: Ic6f26a61f263c5beebbcc9725fe8914d3858576f
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java index 9e9dec2..2aa0f5e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java @@ -61,7 +61,8 @@ public class NotificationRowLayout HashMap<View, ValueAnimator> mDisappearingViews = new HashMap<View, ValueAnimator>(); private SwipeHelper mSwipeHelper; - + private HashMap<View, Runnable> mDismissRunnables = new HashMap<View, Runnable>(); + private OnSizeChangedListener mOnSizeChangedListener; // Flag set during notification removal animation to avoid causing too much work until @@ -111,6 +112,10 @@ public class NotificationRowLayout mOnSizeChangedListener = l; } + public void runOnDismiss(View child, Runnable runnable) { + mDismissRunnables.put(child, runnable); + } + @Override public void onWindowFocusChanged(boolean hasWindowFocus) { super.onWindowFocusChanged(hasWindowFocus); @@ -166,14 +171,17 @@ public class NotificationRowLayout return NotificationData.setUserLocked(v, userLocked); } - public void onChildDismissed(View v, boolean fromUser) { + public void onChildDismissed(View v) { if (DEBUG) Slog.v(TAG, "onChildDismissed: " + v + " mRemoveViews=" + mRemoveViews); final View veto = v.findViewById(R.id.veto); if (veto != null && veto.getVisibility() != View.GONE && mRemoveViews) { veto.performClick(); } - if (fromUser) { - NotificationData.setUserCleared(v); + NotificationData.setUserDismissed(v); + + Runnable dismissRunnable = mDismissRunnables.remove(v); + if (dismissRunnable != null) { + dismissRunnable.run(); } } |