Refresh tablet notification drawer.
* New "X" button appears in the system bar, allowing the
user to clear all notifications. Only appears when the
notifications list is showing and there are clearable
items. (Note: the textual button on phones has also been
replaced with an X.)
* Updated panel background artwork and positioning.
* Removed a bunch of old art.
Bug: 4970588
Bug: 4974043
Bug: 3509407 (regression)
Change-Id: Ibadb638cd18c4faa751cd1f311d73ceda65cb3ca
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 4239d24..18026f1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -141,7 +141,7 @@
View mExpandedContents;
// top bar
TextView mNoNotificationsTitle;
- TextView mClearButton;
+ View mClearButton;
// drag bar
CloseDragHandle mCloseView;
@@ -301,7 +301,7 @@
mExpandedContents = expanded.findViewById(R.id.notificationLinearLayout);
mPile = (ViewGroup)expanded.findViewById(R.id.latestItems);
mNoNotificationsTitle = (TextView)expanded.findViewById(R.id.noNotificationsTitle);
- mClearButton = (TextView)expanded.findViewById(R.id.clear_all_button);
+ mClearButton = expanded.findViewById(R.id.clear_all_button);
mClearButton.setOnClickListener(mClearButtonListener);
mScrollView = (ScrollView)expanded.findViewById(R.id.scroll);
mNotificationLinearLayout = expanded.findViewById(R.id.notificationLinearLayout);
@@ -1984,7 +1984,9 @@
final Context context = mContext;
final Resources res = context.getResources();
- mClearButton.setText(context.getText(R.string.status_bar_clear_all_button));
+ if (mClearButton instanceof TextView) {
+ ((TextView)mClearButton).setText(context.getText(R.string.status_bar_clear_all_button));
+ }
mNoNotificationsTitle.setText(context.getText(R.string.status_bar_no_notifications_title));
loadDimens();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
index a316e4b..74dbfef 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
@@ -49,6 +49,7 @@
Rect mContentArea = new Rect();
View mSettingsView;
ViewGroup mContentParent;
+ TabletStatusBar mBar;
// amount to slide mContentParent down by when mContentFrame is missing
float mContentFrameMissingTranslation;
@@ -63,6 +64,10 @@
super(context, attrs, defStyle);
}
+ public void setBar(TabletStatusBar b) {
+ mBar = b;
+ }
+
@Override
public void onFinishInflate() {
super.onFinishInflate();
@@ -202,15 +207,16 @@
;
set.setDuration(200);
- if (!showing) {
- set.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator _a) {
+ set.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator _a) {
+ if (!showing) {
mContentFrame.setVisibility(View.GONE);
mContentFrame.setAlpha(1f);
}
- });
- }
+ updateClearButton();
+ }
+ });
set.start();
}
@@ -247,12 +253,23 @@
removeSettingsView();
}
}
+ updateClearButton();
updatePanelModeButtons();
}
});
a.start();
}
+ public void updateClearButton() {
+ if (mBar != null) {
+ final boolean showX
+ = (isShowing()
+ && mNotificationScroller.getVisibility() == View.VISIBLE
+ && mNotificationCount > 0);
+ mBar.getClearButton().setVisibility(showX ? View.VISIBLE : View.INVISIBLE);
+ }
+ }
+
public void updatePanelModeButtons() {
final boolean settingsVisible = (mSettingsView != null);
mSettingsButton.setVisibility(!settingsVisible ? View.VISIBLE : View.INVISIBLE);
@@ -294,11 +311,11 @@
AnimatorSet mContentAnim;
// should group this into a multi-property animation
- final static int OPEN_DURATION = 136;
- final static int CLOSE_DURATION = 250;
+ final static int OPEN_DURATION = 300;
+ final static int CLOSE_DURATION = 300;
// the panel will start to appear this many px from the end
- final int HYPERSPACE_OFFRAMP = 100;
+ final int HYPERSPACE_OFFRAMP = 200;
Choreographer() {
}
@@ -306,10 +323,6 @@
void createAnimation(boolean appearing) {
// mVisible: previous state; appearing: new state
- View root = findViewById(R.id.panel_root);
- Animator bgAnim = ObjectAnimator.ofInt(root.getBackground(), "alpha",
- mVisible ? 255 : 0, appearing ? 255 : 0);
-
float start, end;
// 0: on-screen
@@ -347,7 +360,6 @@
mContentAnim = new AnimatorSet();
mContentAnim
.play(fadeAnim)
- .with(bgAnim)
.with(posAnim)
;
mContentAnim.setDuration((DEBUG?10:1)*(appearing ? OPEN_DURATION : CLOSE_DURATION));
@@ -363,6 +375,9 @@
mContentAnim.start();
mVisible = appearing;
+
+ // we want to start disappearing promptly
+ if (!mVisible) updateClearButton();
}
public void onAnimationCancel(Animator animation) {
@@ -376,6 +391,9 @@
}
mContentParent.setLayerType(View.LAYER_TYPE_NONE, null);
mContentAnim = null;
+
+ // we want to show the X lazily
+ if (mVisible) updateClearButton();
}
public void onAnimationRepeat(Animator animation) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index c6e546e..dc7e3137 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -122,6 +122,7 @@
View mNotificationTrigger;
NotificationIconArea mNotificationIconArea;
ViewGroup mNavigationArea;
+ View mClearButton;
boolean mNotificationDNDMode;
NotificationData.Entry mNotificationDNDDummyEntry;
@@ -187,6 +188,7 @@
// Notification Panel
mNotificationPanel = (NotificationPanel)View.inflate(context,
R.layout.status_bar_notification_panel, null);
+ mNotificationPanel.setBar(this);
mNotificationPanel.show(false, false);
mNotificationPanel.setOnTouchListener(
new TouchOutsideListener(MSG_CLOSE_NOTIFICATION_PANEL, mNotificationPanel));
@@ -451,6 +453,10 @@
// the more notifications icon
mNotificationIconArea = (NotificationIconArea)sb.findViewById(R.id.notificationIcons);
+ // the "X" that appears in place of the clock when the panel is showing notifications
+ mClearButton = sb.findViewById(R.id.clear_all_button);
+ mClearButton.setOnClickListener(mClearButtonListener);
+
// where the icons go
mIconLayout = (NotificationIconArea.IconLayout) sb.findViewById(R.id.icons);
mIconLayout.setOnTouchListener(new NotificationIconTouchListener());
@@ -581,6 +587,21 @@
return sb;
}
+ private View.OnClickListener mClearButtonListener = new View.OnClickListener() {
+ public void onClick(View v) {
+ try {
+ mBarService.onClearAllNotifications();
+ } catch (RemoteException ex) {
+ // system process is dead if we're here.
+ }
+ animateCollapse();
+ }
+ };
+
+ public View getClearButton() {
+ return mClearButton;
+ }
+
public int getStatusBarHeight() {
return mHeightReceiver.getHeight();
}
@@ -1183,7 +1204,6 @@
}
private void setAreThereNotifications() {
- final boolean hasClearable = mNotificationData.hasClearableItems();
}
/**