diff options
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 9f57e72..b2d4e85 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -108,6 +108,10 @@ public abstract class BaseStatusBar extends SystemUI implements public static final int EXPANDED_LEAVE_ALONE = -10000; public static final int EXPANDED_FULL_OPEN = -10001; + private static final boolean CLOSE_PANEL_WHEN_EMPTIED = true; + private static final int COLLAPSE_AFTER_DISMISS_DELAY = 200; + private static final int COLLAPSE_AFTER_REMOVE_DELAY = 400; + protected CommandQueue mCommandQueue; protected IStatusBarService mBarService; protected H mHandler = createHandler(); @@ -130,6 +134,13 @@ public abstract class BaseStatusBar extends SystemUI implements protected FrameLayout mStatusBarContainer; + private Runnable mPanelCollapseRunnable = new Runnable() { + @Override + public void run() { + animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE); + } + }; + /** * An interface for navigation key bars to allow status bars to signal which keys are * currently of interest to the user.<br> @@ -940,14 +951,14 @@ public abstract class BaseStatusBar extends SystemUI implements updateExpansionStates(); updateNotificationIcons(); - if (entry.userCleared() && !mNotificationData.hasClearableItems()) { - // wait a bit to make the user aware of what's happening - mHandler.postDelayed(new Runnable() { - @Override - public void run() { - animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE); - } - }, 225); + if (CLOSE_PANEL_WHEN_EMPTIED && isNotificationPanelFullyVisible()) { + if (entry.userDismissed() && !mNotificationData.hasClearableItems()) { + mHandler.removeCallbacks(mPanelCollapseRunnable); + mHandler.postDelayed(mPanelCollapseRunnable, COLLAPSE_AFTER_DISMISS_DELAY); + } else if (mNotificationData.size() == 0) { + mHandler.removeCallbacks(mPanelCollapseRunnable); + mHandler.postDelayed(mPanelCollapseRunnable, COLLAPSE_AFTER_REMOVE_DELAY); + } } return entry.notification; @@ -989,6 +1000,7 @@ public abstract class BaseStatusBar extends SystemUI implements } updateExpansionStates(); updateNotificationIcons(); + mHandler.removeCallbacks(mPanelCollapseRunnable); return iconView; } @@ -1036,6 +1048,7 @@ public abstract class BaseStatusBar extends SystemUI implements protected abstract void tick(IBinder key, StatusBarNotification n, boolean firstTime); protected abstract void updateExpandedViewPos(int expandedPosition); protected abstract int getExpandedViewMaxHeight(); + protected abstract boolean isNotificationPanelFullyVisible(); protected abstract boolean shouldDisableNavbarGestures(); protected boolean isTopNotification(ViewGroup parent, NotificationData.Entry entry) { |