Refinements to the notification icon area.
- New icon states per revised UX designs.
- Basic implementation of do-not-disturb mode.
- Removed unused grippies.
Change-Id: I506dcdc8ceb855902f2401e3145c3c676c0de207
diff --git a/packages/SystemUI/res/anim/notification_dnd_off.xml b/packages/SystemUI/res/anim/notification_dnd_off.xml
new file mode 100644
index 0000000..4e88855
--- /dev/null
+++ b/packages/SystemUI/res/anim/notification_dnd_off.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ >
+ <translate android:fromXDelta="100%p" android:toXDelta="0"
+ android:duration="@android:integer/config_longAnimTime"
+ android:interpolator="@anim/hydraulic_brake_interpolator"
+ />
+</set>
diff --git a/packages/SystemUI/res/anim/notification_dnd_on.xml b/packages/SystemUI/res/anim/notification_dnd_on.xml
new file mode 100644
index 0000000..309943b
--- /dev/null
+++ b/packages/SystemUI/res/anim/notification_dnd_on.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ >
+ <translate android:toXDelta="100%p" android:fromXDelta="0"
+ android:duration="@android:integer/config_longAnimTime"
+ android:interpolator="@anim/hydraulic_brake_interpolator"
+ />
+</set>
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_avail.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_avail.png
new file mode 100644
index 0000000..9123fef
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_avail.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_avail_open.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_avail_open.png
new file mode 100644
index 0000000..8e56f2a
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_avail_open.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_dnd.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_dnd.png
new file mode 100644
index 0000000..80cf99c
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_dnd.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_none.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_none.png
new file mode 100644
index 0000000..e0d018b
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_none.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_none_open.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_none_open.png
new file mode 100644
index 0000000..5db8c9c
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_none_open.png
Binary files differ
diff --git a/packages/SystemUI/res/layout-xlarge/status_bar.xml b/packages/SystemUI/res/layout-xlarge/status_bar.xml
index ed52ad5..cf96e37 100644
--- a/packages/SystemUI/res/layout-xlarge/status_bar.xml
+++ b/packages/SystemUI/res/layout-xlarge/status_bar.xml
@@ -28,19 +28,21 @@
>
<ImageView
- android:id="@+id/expand"
+ android:id="@+id/notificationTrigger"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/ic_sysbar_open"
+ android:layout_height="match_parent"
+ android:layout_alignParentRight="true"
+ android:layout_marginLeft="6dip"
+ android:src="@drawable/ic_sysbar_noti_none"
android:background="@drawable/ic_sysbar_icon_bg"
- android:paddingLeft="6dip"
+ android:gravity="center"
/>
<LinearLayout
android:id="@+id/notificationButtons"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:layout_toRightOf="@+id/expand"
+ android:layout_toLeftOf="@+id/notificationTrigger"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="gone"
@@ -78,7 +80,7 @@
android:id="@+id/notificationIcons"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:layout_toLeftOf="@+id/expand"
+ android:layout_toLeftOf="@+id/notificationTrigger"
android:gravity="center_vertical"
android:orientation="horizontal"
>
@@ -92,14 +94,6 @@
android:visibility="invisible"
/>
<view
- class="com.android.systemui.statusbar.tablet.NotificationIconArea$DraggerView"
- android:id="@+id/handle"
- android:layout_width="32dip"
- android:layout_height="match_parent"
- android:background="@drawable/sysbar_hidenotification_handle"
- android:layout_marginLeft="8dip"
- />
- <view
class="com.android.systemui.statusbar.tablet.NotificationIconArea$IconLayout"
android:id="@+id/icons"
android:layout_width="wrap_content"
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationIconArea.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationIconArea.java
index 7c7d74c3..2b4f9d2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationIconArea.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationIconArea.java
@@ -32,13 +32,11 @@
private static final String TAG = "NotificationIconArea";
IconLayout mIconLayout;
- DraggerView mDraggerView;
public NotificationIconArea(Context context, AttributeSet attrs) {
super(context, attrs);
mIconLayout = (IconLayout)findViewById(R.id.icons);
- mDraggerView = (DraggerView) findViewById(R.id.handle);
}
static class IconLayout extends LinearLayout {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
index fd65e4d..0c004ae 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
@@ -77,7 +77,7 @@
private NotificationData mNotns = new NotificationData();
TabletStatusBarView mStatusBarView;
- View mNotificationTrigger;
+ ImageView mNotificationTrigger;
NotificationIconArea mNotificationIconArea;
View mNotificationButtons;
View mSystemInfo;
@@ -192,7 +192,7 @@
mCurtains.setOnLongClickListener(on);
// the button to open the notification area
- mNotificationTrigger = sb.findViewById(R.id.expand);
+ mNotificationTrigger = (ImageView) sb.findViewById(R.id.notificationTrigger);
mNotificationTrigger.setOnClickListener(mOnClickListener);
// the more notifications icon
@@ -222,6 +222,7 @@
// set the initial view visibility
setAreThereNotifications();
+ refreshNotificationTrigger();
// Add the windows
addPanelWindows();
@@ -253,6 +254,7 @@
R.anim.notification_icons_out);
setViewVisibility(mNotificationButtons, View.VISIBLE,
R.anim.notification_buttons_in);
+ refreshNotificationTrigger();
}
break;
case MSG_CLOSE_NOTIFICATION_PANEL:
@@ -263,6 +265,7 @@
R.anim.notification_icons_in);
setViewVisibility(mNotificationButtons, View.GONE,
R.anim.notification_buttons_out);
+ refreshNotificationTrigger();
}
break;
case MSG_OPEN_SYSTEM_PANEL:
@@ -276,6 +279,20 @@
}
}
}
+
+ public void refreshNotificationTrigger() {
+ int resId;
+ boolean panel = (mNotificationPanel != null
+ && mNotificationPanel.getVisibility() == View.VISIBLE);
+ if (!mNotificationsOn) {
+ resId = R.drawable.ic_sysbar_noti_dnd;
+ } else if (mNotns.size() > 0) {
+ resId = panel ? R.drawable.ic_sysbar_noti_avail_open : R.drawable.ic_sysbar_noti_avail;
+ } else {
+ resId = panel ? R.drawable.ic_sysbar_noti_none_open : R.drawable.ic_sysbar_noti_none;
+ }
+ mNotificationTrigger.setImageResource(resId);
+ }
public void setBatteryMeter(int level, boolean plugged) {
if (DEBUG) Slog.d(TAG, "battery=" + level + (plugged ? " - plugged" : " - unplugged"));
@@ -598,21 +615,34 @@
// system process is dead if we're here.
}
animateCollapse();
+ refreshNotificationTrigger();
}
void onClickDoNotDisturb() {
mNotificationsOn = !mNotificationsOn;
+ setViewVisibility(mIconLayout,
+ mNotificationsOn ? View.VISIBLE : View.INVISIBLE,
+ mNotificationsOn ? R.anim.notification_dnd_off : R.anim.notification_dnd_on);
animateCollapse();
+ refreshNotificationTrigger();
}
public void onClickNotificationTrigger() {
if (DEBUG) Slog.d(TAG, "clicked notification icons");
if ((mDisabled & StatusBarManager.DISABLE_EXPAND) == 0) {
- int msg = (mNotificationPanel.getVisibility() == View.GONE)
- ? MSG_OPEN_NOTIFICATION_PANEL
- : MSG_CLOSE_NOTIFICATION_PANEL;
- mHandler.removeMessages(msg);
- mHandler.sendEmptyMessage(msg);
+ if (!mNotificationsOn) {
+ mNotificationsOn = true;
+ setViewVisibility(mIconLayout,
+ View.VISIBLE,
+ R.anim.notification_dnd_off);
+ refreshNotificationTrigger();
+ } else {
+ int msg = (mNotificationPanel.getVisibility() == View.GONE)
+ ? MSG_OPEN_NOTIFICATION_PANEL
+ : MSG_CLOSE_NOTIFICATION_PANEL;
+ mHandler.removeMessages(msg);
+ mHandler.sendEmptyMessage(msg);
+ }
}
}
@@ -757,6 +787,8 @@
for (int i=0; i<N; i++) {
mPile.addView(mNotns.get(N-i-1).row);
}
+
+ refreshNotificationTrigger();
}
private boolean inflateViews(NotificationData.Entry entry, ViewGroup parent) {