diff options
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 107 |
1 files changed, 48 insertions, 59 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 82b6538..7d98350 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -290,7 +290,6 @@ public class PhoneStatusBar extends BaseStatusBar { float mFlingVelocity; int mFlingY; int[] mAbsPos = new int[2]; - Runnable mPostCollapseCleanup = null; private Animator mLightsOutAnimation; private Animator mLightsOnAnimation; @@ -340,6 +339,19 @@ public class PhoneStatusBar extends BaseStatusBar { } }; + private final Runnable mNotifyClearAll = new Runnable() { + @Override + public void run() { + if (DEBUG) { + Slog.v(TAG, "Notifying status bar of notification clear"); + } + try { + mPile.setViewRemoval(true); + mBarService.onClearAllNotifications(); + } catch (RemoteException ex) { } + } + }; + class SettingsObserver extends ContentObserver { SettingsObserver(Handler handler) { super(handler); @@ -1878,11 +1890,6 @@ public class PhoneStatusBar extends BaseStatusBar { // Close any "App info" popups that might have snuck on-screen dismissPopups(); - - if (mPostCollapseCleanup != null) { - mPostCollapseCleanup.run(); - mPostCollapseCleanup = null; - } } /** @@ -2487,6 +2494,11 @@ public class PhoneStatusBar extends BaseStatusBar { } @Override + protected boolean isNotificationPanelFullyVisible() { + return mExpandedVisible && !mAnimating && !isShowingSettings(); + } + + @Override public void updateExpandedViewPos(int thingy) { if (DEBUG) Slog.v(TAG, "updateExpandedViewPos"); @@ -2522,7 +2534,7 @@ public class PhoneStatusBar extends BaseStatusBar { @Override public void onClick(View v) { synchronized (mNotificationData) { - // animate-swipe all dismissable notifications, then animate the shade closed + // animate-swipe all dismissable notifications int numChildren = mPile.getChildCount(); int scrollTop = mScrollView.getScrollY(); @@ -2535,63 +2547,40 @@ public class PhoneStatusBar extends BaseStatusBar { snapshot.add(child); } } + if (snapshot.isEmpty()) { animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE); return; } - new Thread(new Runnable() { - @Override - public void run() { - // Decrease the delay for every row we animate to give the sense of - // accelerating the swipes - final int ROW_DELAY_DECREMENT = 10; - int currentDelay = 140; - int totalDelay = 0; - - // Set the shade-animating state to avoid doing other work during - // all of these animations. In particular, avoid layout and - // redrawing when collapsing the shade. - mPile.setViewRemoval(false); - - mPostCollapseCleanup = new Runnable() { - @Override - public void run() { - if (DEBUG) { - Slog.v(TAG, "running post-collapse cleanup"); - } - try { - mPile.setViewRemoval(true); - mBarService.onClearAllNotifications(); - } catch (Exception ex) { } - } - }; - - View sampleView = snapshot.get(0); - int width = sampleView.getWidth(); - final int velocity = width * 8; // 1000/8 = 125 ms duration - for (final View _v : snapshot) { - mHandler.postDelayed(new Runnable() { - @Override - public void run() { - mPile.dismissRowAnimated(_v, velocity); - } - }, totalDelay); - currentDelay = Math.max(50, currentDelay - ROW_DELAY_DECREMENT); - totalDelay += currentDelay; + + // Decrease the delay for every row we animate to give the sense of + // accelerating the swipes + final int ROW_DELAY_DECREMENT = 10; + int currentDelay = 140; + int totalDelay = 0; + + // Set the shade-animating state to avoid doing other work, in + // particular layout and redrawing, during all of these animations. + mPile.setViewRemoval(false); + + View sampleView = snapshot.get(0); + int width = sampleView.getWidth(); + final int velocity = width * 8; // 1000/8 = 125 ms duration + for (final View _v : snapshot) { + mHandler.postDelayed(new Runnable() { + @Override + public void run() { + mPile.dismissRowAnimated(_v, velocity); } - // Delay the collapse animation until after all swipe animations have - // finished. Provide some buffer because there may be some extra delay - // before actually starting each swipe animation. Ideally, we'd - // synchronize the end of those animations with the start of the collaps - // exactly. - mHandler.postDelayed(new Runnable() { - @Override - public void run() { - animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE); - } - }, totalDelay + 225); - } - }).start(); + }, totalDelay); + currentDelay = Math.max(50, currentDelay - ROW_DELAY_DECREMENT); + totalDelay += currentDelay; + } + + // After ending all animations, tell the service to remove the + // notifications, which will trigger collapsing the shade + final View lastEntry = snapshot.get(snapshot.size() - 1); + mPile.runOnDismiss(lastEntry, mNotifyClearAll); } } }; |