Merge "Refinements to the notification icon area."
This commit is contained in:
committed by
Android (Google) Code Review
commit
dca9cd6dd0
23
packages/SystemUI/res/anim/notification_dnd_off.xml
Normal file
23
packages/SystemUI/res/anim/notification_dnd_off.xml
Normal file
@@ -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>
|
||||
23
packages/SystemUI/res/anim/notification_dnd_on.xml
Normal file
23
packages/SystemUI/res/anim/notification_dnd_on.xml
Normal file
@@ -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>
|
||||
BIN
packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_avail.png
Normal file
BIN
packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_avail.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 247 B |
Binary file not shown.
|
After Width: | Height: | Size: 503 B |
BIN
packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_dnd.png
Normal file
BIN
packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_dnd.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 393 B |
BIN
packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_none.png
Normal file
BIN
packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_none.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 185 B |
BIN
packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_none_open.png
Normal file
BIN
packages/SystemUI/res/drawable-mdpi/ic_sysbar_noti_none_open.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 393 B |
@@ -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"
|
||||
>
|
||||
@@ -91,14 +93,6 @@
|
||||
android:background="@drawable/ic_sysbar_icon_bg"
|
||||
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"
|
||||
|
||||
@@ -32,13 +32,11 @@ public class NotificationIconArea extends LinearLayout {
|
||||
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 {
|
||||
|
||||
@@ -77,7 +77,7 @@ public class TabletStatusBarService extends StatusBarService {
|
||||
private NotificationData mNotns = new NotificationData();
|
||||
|
||||
TabletStatusBarView mStatusBarView;
|
||||
View mNotificationTrigger;
|
||||
ImageView mNotificationTrigger;
|
||||
NotificationIconArea mNotificationIconArea;
|
||||
View mNotificationButtons;
|
||||
View mSystemInfo;
|
||||
@@ -192,7 +192,7 @@ public class TabletStatusBarService extends StatusBarService {
|
||||
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 @@ public class TabletStatusBarService extends StatusBarService {
|
||||
|
||||
// set the initial view visibility
|
||||
setAreThereNotifications();
|
||||
refreshNotificationTrigger();
|
||||
|
||||
// Add the windows
|
||||
addPanelWindows();
|
||||
@@ -253,6 +254,7 @@ public class TabletStatusBarService extends StatusBarService {
|
||||
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 @@ public class TabletStatusBarService extends StatusBarService {
|
||||
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 class TabletStatusBarService extends StatusBarService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ public class TabletStatusBarService extends StatusBarService {
|
||||
// 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 @@ public class TabletStatusBarService extends StatusBarService {
|
||||
for (int i=0; i<N; i++) {
|
||||
mPile.addView(mNotns.get(N-i-1).row);
|
||||
}
|
||||
|
||||
refreshNotificationTrigger();
|
||||
}
|
||||
|
||||
private boolean inflateViews(NotificationData.Entry entry, ViewGroup parent) {
|
||||
|
||||
Reference in New Issue
Block a user