Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +69 −10 Original line number Diff line number Diff line Loading @@ -87,6 +87,7 @@ import com.android.systemui.statusbar.policy.DateView; import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.statusbar.policy.LocationController; import com.android.systemui.statusbar.policy.NetworkController; import com.android.systemui.statusbar.policy.NotificationRowLayout; public class PhoneStatusBar extends StatusBar { static final String TAG = "PhoneStatusBar"; Loading @@ -103,8 +104,10 @@ public class PhoneStatusBar extends StatusBar { static final int EXPANDED_LEAVE_ALONE = -10000; static final int EXPANDED_FULL_OPEN = -10001; private static final int MSG_ANIMATE = 1000; private static final int MSG_ANIMATE_REVEAL = 1001; private static final int MSG_ANIMATE = 100; private static final int MSG_ANIMATE_REVEAL = 101; private static final int MSG_OPEN_NOTIFICATION_PANEL = 1000; private static final int MSG_CLOSE_NOTIFICATION_PANEL = 1001; private static final int MSG_SHOW_INTRUDER = 1002; private static final int MSG_HIDE_INTRUDER = 1003; private static final int MSG_OPEN_RECENTS_PANEL = 1020; Loading Loading @@ -165,7 +168,7 @@ public class PhoneStatusBar extends StatusBar { // all notifications NotificationData mNotificationData = new NotificationData(); ViewGroup mPile; NotificationRowLayout mPile; // position int[] mPositionTmp = new int[2]; Loading Loading @@ -324,7 +327,7 @@ public class PhoneStatusBar extends StatusBar { mExpandedDialog = new ExpandedDialog(context); mExpandedView = expanded; mPile = (ViewGroup)expanded.findViewById(R.id.latestItems); mPile = (NotificationRowLayout)expanded.findViewById(R.id.latestItems); mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout); mNoNotificationsTitle = (TextView)expanded.findViewById(R.id.noNotificationsTitle); mNoNotificationsTitle.setVisibility(View.GONE); // disabling for now Loading @@ -332,6 +335,7 @@ public class PhoneStatusBar extends StatusBar { mClearButton = expanded.findViewById(R.id.clear_all_button); mClearButton.setOnClickListener(mClearButtonListener); mClearButton.setAlpha(0f); mClearButton.setEnabled(false); mDateView = (DateView)expanded.findViewById(R.id.date); mSettingsButton = expanded.findViewById(R.id.settings_button); mSettingsButton.setOnClickListener(mSettingsButtonListener); Loading Loading @@ -1005,6 +1009,7 @@ public class PhoneStatusBar extends StatusBar { } else { mClearButton.setAlpha(clearable ? 1.0f : 0.0f); } mClearButton.setEnabled(clearable); /* if (mNoNotificationsTitle.isShown()) { Loading Loading @@ -1114,6 +1119,12 @@ public class PhoneStatusBar extends StatusBar { case MSG_ANIMATE_REVEAL: doRevealAnimation(); break; case MSG_OPEN_NOTIFICATION_PANEL: animateExpand(); break; case MSG_CLOSE_NOTIFICATION_PANEL: animateCollapse(); break; case MSG_SHOW_INTRUDER: setIntruderAlertVisibility(true); break; Loading Loading @@ -1181,6 +1192,10 @@ public class PhoneStatusBar extends StatusBar { } public void animateCollapse(boolean excludeRecents) { animateCollapse(excludeRecents, 1.0f); } public void animateCollapse(boolean excludeRecents, float velocityMultiplier) { if (SPEW) { Slog.d(TAG, "animateCollapse(): mExpanded=" + mExpanded + " mExpandedVisible=" + mExpandedVisible Loading Loading @@ -1209,7 +1224,7 @@ public class PhoneStatusBar extends StatusBar { // and doesn't try to re-open the windowshade. mExpanded = true; prepareTracking(y, false); performFling(y, -mSelfCollapseVelocityPx, true); performFling(y, -mSelfCollapseVelocityPx*velocityMultiplier, true); } void performExpand() { Loading Loading @@ -2086,13 +2101,57 @@ public class PhoneStatusBar extends StatusBar { } private View.OnClickListener mClearButtonListener = new View.OnClickListener() { final int mini(int a, int b) { return (b>a?a:b); } public void onClick(View v) { synchronized (mNotificationData) { // let's also queue up 400ms worth of animated dismissals final int N = mini(5, mPile.getChildCount()); final ArrayList<View> snapshot = new ArrayList<View>(N); for (int i=0; i<N; i++) { final View child = mPile.getChildAt(i); if (mPile.canChildBeDismissed(child)) snapshot.add(child); } new Thread(new Runnable() { @Override public void run() { final int ROW_DELAY = 100; mHandler.postDelayed(new Runnable() { public void run() { animateCollapse(false, 0f); } }, (N-1) * ROW_DELAY); mHandler.postDelayed(new Runnable() { public void run() { try { mBarService.onClearAllNotifications(); } catch (RemoteException ex) { // system process is dead if we're here. } catch (RemoteException ex) { } } }, N * ROW_DELAY + 500); mPile.setAnimateBounds(false); // temporarily disable some re-layouts for (View v : snapshot) { final View _v = v; mHandler.post(new Runnable() { @Override public void run() { mPile.dismissRowAnimated(_v, (int)(ROW_DELAY*0.25f)); } }); try { Thread.sleep(ROW_DELAY); } catch (InterruptedException ex) { } } mPile.setAnimateBounds(true); // reenable layout animation } }).start(); } animateCollapse(); } }; Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java +17 −5 Original line number Diff line number Diff line Loading @@ -44,11 +44,11 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call private static final boolean DEBUG = false; private static final boolean SLOW_ANIMATIONS = DEBUG; private static final boolean ANIMATE_LAYOUT = true; private static final int APPEAR_ANIM_LEN = SLOW_ANIMATIONS ? 5000 : 250; private static final int DISAPPEAR_ANIM_LEN = APPEAR_ANIM_LEN; boolean mAnimateBounds = true; Rect mTmpRect = new Rect(); int mNumRows = 0; int mRowHeight = 0; Loading Loading @@ -93,6 +93,10 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, densityScale, pagingTouchSlop); } public void setAnimateBounds(boolean anim) { mAnimateBounds = anim; } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (DEBUG) Log.v(TAG, "onInterceptTouchEvent()"); Loading Loading @@ -165,7 +169,7 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call final View childF = child; if (ANIMATE_LAYOUT) { if (mAnimateBounds) { child.setPivotY(0); final ObjectAnimator alphaFade = ObjectAnimator.ofFloat(child, "alpha", 0f, 1f); alphaFade.setDuration(APPEAR_ANIM_LEN); Loading @@ -185,10 +189,18 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call } } public void dismissRowAnimated(View child) { dismissRowAnimated(child, 0); } public void dismissRowAnimated(View child, int vel) { mSwipeHelper.dismissChild(child, vel); } @Override public void removeView(View child) { final View childF = child; if (ANIMATE_LAYOUT) { if (mAnimateBounds) { if (mAppearingViews.containsKey(child)) { mAppearingViews.remove(child); } Loading Loading @@ -264,7 +276,7 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call mNumRows = numRows; if (ANIMATE_LAYOUT && isShown()) { if (mAnimateBounds && isShown()) { ObjectAnimator.ofInt(this, "forcedHeight", computedHeight) .setDuration(APPEAR_ANIM_LEN) .start(); Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +69 −10 Original line number Diff line number Diff line Loading @@ -87,6 +87,7 @@ import com.android.systemui.statusbar.policy.DateView; import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.statusbar.policy.LocationController; import com.android.systemui.statusbar.policy.NetworkController; import com.android.systemui.statusbar.policy.NotificationRowLayout; public class PhoneStatusBar extends StatusBar { static final String TAG = "PhoneStatusBar"; Loading @@ -103,8 +104,10 @@ public class PhoneStatusBar extends StatusBar { static final int EXPANDED_LEAVE_ALONE = -10000; static final int EXPANDED_FULL_OPEN = -10001; private static final int MSG_ANIMATE = 1000; private static final int MSG_ANIMATE_REVEAL = 1001; private static final int MSG_ANIMATE = 100; private static final int MSG_ANIMATE_REVEAL = 101; private static final int MSG_OPEN_NOTIFICATION_PANEL = 1000; private static final int MSG_CLOSE_NOTIFICATION_PANEL = 1001; private static final int MSG_SHOW_INTRUDER = 1002; private static final int MSG_HIDE_INTRUDER = 1003; private static final int MSG_OPEN_RECENTS_PANEL = 1020; Loading Loading @@ -165,7 +168,7 @@ public class PhoneStatusBar extends StatusBar { // all notifications NotificationData mNotificationData = new NotificationData(); ViewGroup mPile; NotificationRowLayout mPile; // position int[] mPositionTmp = new int[2]; Loading Loading @@ -324,7 +327,7 @@ public class PhoneStatusBar extends StatusBar { mExpandedDialog = new ExpandedDialog(context); mExpandedView = expanded; mPile = (ViewGroup)expanded.findViewById(R.id.latestItems); mPile = (NotificationRowLayout)expanded.findViewById(R.id.latestItems); mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout); mNoNotificationsTitle = (TextView)expanded.findViewById(R.id.noNotificationsTitle); mNoNotificationsTitle.setVisibility(View.GONE); // disabling for now Loading @@ -332,6 +335,7 @@ public class PhoneStatusBar extends StatusBar { mClearButton = expanded.findViewById(R.id.clear_all_button); mClearButton.setOnClickListener(mClearButtonListener); mClearButton.setAlpha(0f); mClearButton.setEnabled(false); mDateView = (DateView)expanded.findViewById(R.id.date); mSettingsButton = expanded.findViewById(R.id.settings_button); mSettingsButton.setOnClickListener(mSettingsButtonListener); Loading Loading @@ -1005,6 +1009,7 @@ public class PhoneStatusBar extends StatusBar { } else { mClearButton.setAlpha(clearable ? 1.0f : 0.0f); } mClearButton.setEnabled(clearable); /* if (mNoNotificationsTitle.isShown()) { Loading Loading @@ -1114,6 +1119,12 @@ public class PhoneStatusBar extends StatusBar { case MSG_ANIMATE_REVEAL: doRevealAnimation(); break; case MSG_OPEN_NOTIFICATION_PANEL: animateExpand(); break; case MSG_CLOSE_NOTIFICATION_PANEL: animateCollapse(); break; case MSG_SHOW_INTRUDER: setIntruderAlertVisibility(true); break; Loading Loading @@ -1181,6 +1192,10 @@ public class PhoneStatusBar extends StatusBar { } public void animateCollapse(boolean excludeRecents) { animateCollapse(excludeRecents, 1.0f); } public void animateCollapse(boolean excludeRecents, float velocityMultiplier) { if (SPEW) { Slog.d(TAG, "animateCollapse(): mExpanded=" + mExpanded + " mExpandedVisible=" + mExpandedVisible Loading Loading @@ -1209,7 +1224,7 @@ public class PhoneStatusBar extends StatusBar { // and doesn't try to re-open the windowshade. mExpanded = true; prepareTracking(y, false); performFling(y, -mSelfCollapseVelocityPx, true); performFling(y, -mSelfCollapseVelocityPx*velocityMultiplier, true); } void performExpand() { Loading Loading @@ -2086,13 +2101,57 @@ public class PhoneStatusBar extends StatusBar { } private View.OnClickListener mClearButtonListener = new View.OnClickListener() { final int mini(int a, int b) { return (b>a?a:b); } public void onClick(View v) { synchronized (mNotificationData) { // let's also queue up 400ms worth of animated dismissals final int N = mini(5, mPile.getChildCount()); final ArrayList<View> snapshot = new ArrayList<View>(N); for (int i=0; i<N; i++) { final View child = mPile.getChildAt(i); if (mPile.canChildBeDismissed(child)) snapshot.add(child); } new Thread(new Runnable() { @Override public void run() { final int ROW_DELAY = 100; mHandler.postDelayed(new Runnable() { public void run() { animateCollapse(false, 0f); } }, (N-1) * ROW_DELAY); mHandler.postDelayed(new Runnable() { public void run() { try { mBarService.onClearAllNotifications(); } catch (RemoteException ex) { // system process is dead if we're here. } catch (RemoteException ex) { } } }, N * ROW_DELAY + 500); mPile.setAnimateBounds(false); // temporarily disable some re-layouts for (View v : snapshot) { final View _v = v; mHandler.post(new Runnable() { @Override public void run() { mPile.dismissRowAnimated(_v, (int)(ROW_DELAY*0.25f)); } }); try { Thread.sleep(ROW_DELAY); } catch (InterruptedException ex) { } } mPile.setAnimateBounds(true); // reenable layout animation } }).start(); } animateCollapse(); } }; Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java +17 −5 Original line number Diff line number Diff line Loading @@ -44,11 +44,11 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call private static final boolean DEBUG = false; private static final boolean SLOW_ANIMATIONS = DEBUG; private static final boolean ANIMATE_LAYOUT = true; private static final int APPEAR_ANIM_LEN = SLOW_ANIMATIONS ? 5000 : 250; private static final int DISAPPEAR_ANIM_LEN = APPEAR_ANIM_LEN; boolean mAnimateBounds = true; Rect mTmpRect = new Rect(); int mNumRows = 0; int mRowHeight = 0; Loading Loading @@ -93,6 +93,10 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, densityScale, pagingTouchSlop); } public void setAnimateBounds(boolean anim) { mAnimateBounds = anim; } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (DEBUG) Log.v(TAG, "onInterceptTouchEvent()"); Loading Loading @@ -165,7 +169,7 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call final View childF = child; if (ANIMATE_LAYOUT) { if (mAnimateBounds) { child.setPivotY(0); final ObjectAnimator alphaFade = ObjectAnimator.ofFloat(child, "alpha", 0f, 1f); alphaFade.setDuration(APPEAR_ANIM_LEN); Loading @@ -185,10 +189,18 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call } } public void dismissRowAnimated(View child) { dismissRowAnimated(child, 0); } public void dismissRowAnimated(View child, int vel) { mSwipeHelper.dismissChild(child, vel); } @Override public void removeView(View child) { final View childF = child; if (ANIMATE_LAYOUT) { if (mAnimateBounds) { if (mAppearingViews.containsKey(child)) { mAppearingViews.remove(child); } Loading Loading @@ -264,7 +276,7 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call mNumRows = numRows; if (ANIMATE_LAYOUT && isShown()) { if (mAnimateBounds && isShown()) { ObjectAnimator.ofInt(this, "forcedHeight", computedHeight) .setDuration(APPEAR_ANIM_LEN) .start(); Loading