diff options
author | Joe Onorato <joeo@android.com> | 2010-09-26 13:02:01 -0700 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2010-09-26 13:02:01 -0700 |
commit | 55d2d7646bf13bb5406bf01fd1bb96e58588570c (patch) | |
tree | 92da8833f1f735e3b16cbae534c980dddbd4f7ae /packages/SystemUI | |
parent | 81859bc3d4d18f558b903db1306e76d0db115cf6 (diff) | |
download | frameworks_base-55d2d7646bf13bb5406bf01fd1bb96e58588570c.zip frameworks_base-55d2d7646bf13bb5406bf01fd1bb96e58588570c.tar.gz frameworks_base-55d2d7646bf13bb5406bf01fd1bb96e58588570c.tar.bz2 |
Notification updates.
When the drawer is open, hide the icons & toasts.
Move Clear button to the bottom and add DND button.
Change-Id: I8b3253eb8f2ff3b1e11a819d58b202e023f00710
Diffstat (limited to 'packages/SystemUI')
8 files changed, 198 insertions, 41 deletions
diff --git a/packages/SystemUI/res/anim/notification_buttons_in.xml b/packages/SystemUI/res/anim/notification_buttons_in.xml new file mode 100644 index 0000000..630fd72 --- /dev/null +++ b/packages/SystemUI/res/anim/notification_buttons_in.xml @@ -0,0 +1,22 @@ +<?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" + > + <alpha android:fromAlpha="0.0" android:toAlpha="1.0" + android:duration="@android:integer/config_longAnimTime" + /> +</set> diff --git a/packages/SystemUI/res/anim/notification_buttons_out.xml b/packages/SystemUI/res/anim/notification_buttons_out.xml new file mode 100644 index 0000000..4717e47 --- /dev/null +++ b/packages/SystemUI/res/anim/notification_buttons_out.xml @@ -0,0 +1,22 @@ +<?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" + > + <alpha android:toAlpha="0.0" android:fromAlpha="1.0" + android:duration="@android:integer/config_longAnimTime" + /> +</set> diff --git a/packages/SystemUI/res/anim/notification_icons_in.xml b/packages/SystemUI/res/anim/notification_icons_in.xml new file mode 100644 index 0000000..630fd72 --- /dev/null +++ b/packages/SystemUI/res/anim/notification_icons_in.xml @@ -0,0 +1,22 @@ +<?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" + > + <alpha android:fromAlpha="0.0" android:toAlpha="1.0" + android:duration="@android:integer/config_longAnimTime" + /> +</set> diff --git a/packages/SystemUI/res/anim/notification_icons_out.xml b/packages/SystemUI/res/anim/notification_icons_out.xml new file mode 100644 index 0000000..4717e47 --- /dev/null +++ b/packages/SystemUI/res/anim/notification_icons_out.xml @@ -0,0 +1,22 @@ +<?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" + > + <alpha android:toAlpha="0.0" android:fromAlpha="1.0" + android:duration="@android:integer/config_longAnimTime" + /> +</set> diff --git a/packages/SystemUI/res/layout-xlarge/status_bar.xml b/packages/SystemUI/res/layout-xlarge/status_bar.xml index 958b5e7..5741a66 100644 --- a/packages/SystemUI/res/layout-xlarge/status_bar.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar.xml @@ -27,23 +27,64 @@ android:layout_height="match_parent" > - <com.android.systemui.statusbar.tablet.NotificationIconArea - android:id="@+id/notificationIcons" + <ImageView + class="com.android.systemui.statusbar.tablet.NotificationIconArea$MoreView" + android:id="@+id/expand" android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_alignParentLeft="true" + android:layout_height="wrap_content" + android:src="@drawable/ic_sysbar_open" android:paddingLeft="6dip" + android:onClick="notificationIconsClicked" + /> + + <LinearLayout + android:id="@+id/notificationButtons" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_toRightOf="@+id/expand" + android:layout_toLeftOf="@+id/systemInfo" android:gravity="center_vertical" android:orientation="horizontal" + android:visibility="gone" > - <ImageView - class="com.android.systemui.statusbar.tablet.NotificationIconArea$MoreView" - android:id="@+id/expand" + + <TextView android:id="@+id/do_not_disturb" + style="?android:attr/textAppearance" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:src="@drawable/ic_sysbar_open" - android:onClick="notificationIconsClicked" + android:layout_gravity="right|center_vertical" + android:layout_marginTop="2dip" + android:layout_marginBottom="1dip" + android:layout_marginRight="10dip" + android:padding="6dip" + android:textSize="14sp" + android:text="@string/status_bar_do_not_disturb_button" /> + + <TextView android:id="@+id/clear_all_button" + style="?android:attr/textAppearance" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right|center_vertical" + android:layout_marginTop="2dip" + android:layout_marginBottom="1dip" + android:layout_marginRight="10dip" + android:padding="6dip" + android:textSize="14sp" + android:text="@string/status_bar_clear_all_button" + /> + + </LinearLayout> + + <com.android.systemui.statusbar.tablet.NotificationIconArea + android:id="@+id/notificationIcons" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_toRightOf="@+id/expand" + android:layout_toLeftOf="@+id/systemInfo" + android:gravity="center_vertical" + android:orientation="horizontal" + > <view class="com.android.systemui.statusbar.tablet.NotificationIconArea$IconLayout" android:id="@+id/icons" @@ -59,7 +100,6 @@ android:background="@drawable/sysbar_hidenotification_handle" android:layout_marginLeft="8dip" /> - </com.android.systemui.statusbar.tablet.NotificationIconArea> <FrameLayout diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml index 3489eec..2671e17 100644 --- a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml +++ b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml @@ -27,25 +27,6 @@ android:orientation="vertical" > - <TextView android:id="@+id/clear_all_button" - style="?android:attr/textAppearance" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right|center_vertical" - android:layout_marginTop="2dip" - android:layout_marginBottom="1dip" - android:layout_marginRight="10dip" - android:padding="6dip" - android:textSize="14sp" - android:text="@string/status_bar_clear_all_button" - /> - - <View - android:layout_width="match_parent" - android:layout_height="1sp" - android:background="@android:drawable/divider_horizontal_dark" - /> - <ScrollView android:id="@+id/notificationScroller" android:layout_height="wrap_content" diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 037dc4a..1f24ba6 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -24,6 +24,18 @@ all of the currently visible notifications. --> <string name="status_bar_clear_all_button">Clear</string> + <!-- The text for the button in the notification window-shade that turns + on do not disturb mode, where notifications no longer show their ticker, + no sound plays, and no icons are visible. The windowshade continues to show + the notifications. --> + <string name="status_bar_do_not_disturb_button">Do not disturb</string> + + <!-- The text for the button in the notification window-shade that turns + off do not disturb mode. After clicking this, notifications will be + shown again. --> + <string name="status_bar_please_disturb_button">Show notifications</string> + + <!-- The label in the bar at the top of the status bar when there are no notifications showing. --> <string name="status_bar_no_notifications_title">No notifications</string> 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 ea61ad0..de939a4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java @@ -31,6 +31,7 @@ import android.os.Message; import android.os.RemoteException; import android.text.TextUtils; import android.util.Slog; +import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.view.Gravity; import android.view.LayoutInflater; @@ -73,7 +74,9 @@ public class TabletStatusBarService extends StatusBarService { private NotificationData mNotns = new NotificationData(); TabletStatusBarView mStatusBarView; + View mNotificationTrigger; NotificationIconArea mNotificationIconArea; + View mNotificationButtons; View mSystemInfo; View mNotificationPanel; @@ -81,6 +84,7 @@ public class TabletStatusBarService extends StatusBarService { ViewGroup mPile; TextView mClearButton; + TextView mDoNotDisturbButton; ImageView mBatteryMeter; ImageView mSignalMeter; @@ -99,6 +103,8 @@ public class TabletStatusBarService extends StatusBarService { // for disabling the status bar int mDisabled = 0; + boolean mNotificationsOn = true; + protected void addPanelWindows() { final Resources res = getResources(); final int barHeight= res.getDimensionPixelSize( @@ -109,7 +115,7 @@ public class TabletStatusBarService extends StatusBarService { mNotificationPanel.setOnTouchListener( new TouchOutsideListener(MSG_CLOSE_NOTIFICATION_PANEL)); - mStatusBarView.setIgnoreChildren(0, mNotificationIconArea, mNotificationPanel); + mStatusBarView.setIgnoreChildren(0, mNotificationTrigger, mNotificationPanel); WindowManager.LayoutParams lp = new WindowManager.LayoutParams( 400, // ViewGroup.LayoutParams.WRAP_CONTENT, @@ -177,9 +183,20 @@ public class TabletStatusBarService extends StatusBarService { mCurtains.setOnClickListener(on); mCurtains.setOnLongClickListener(on); + // the button to open the notification area + mNotificationTrigger = sb.findViewById(R.id.expand); + // the more notifications icon mNotificationIconArea = (NotificationIconArea)sb.findViewById(R.id.notificationIcons); + // the clear and dnd buttons + mNotificationButtons = sb.findViewById(R.id.notificationButtons); + mClearButton = (TextView)mNotificationButtons.findViewById(R.id.clear_all_button); + mClearButton.setOnClickListener(mClearButtonListener); + mDoNotDisturbButton = (TextView)mNotificationButtons.findViewById(R.id.do_not_disturb); + mDoNotDisturbButton.setOnClickListener(mDoNotDisturbButtonListener); + + // where the icons go mIconLayout = (NotificationIconArea.IconLayout) sb.findViewById(R.id.icons); @@ -199,9 +216,6 @@ public class TabletStatusBarService extends StatusBarService { ScrollView scroller = (ScrollView)mPile.getParent(); scroller.setFillViewport(true); - mClearButton = (TextView)mNotificationPanel.findViewById(R.id.clear_all_button); - mClearButton.setOnClickListener(mClearButtonListener); - return sb; } @@ -214,12 +228,23 @@ public class TabletStatusBarService extends StatusBarService { switch (m.what) { case MSG_OPEN_NOTIFICATION_PANEL: if (DEBUG) Slog.d(TAG, "opening notifications panel"); + mDoNotDisturbButton.setText(mNotificationsOn + ? R.string.status_bar_do_not_disturb_button + : R.string.status_bar_please_disturb_button); mNotificationPanel.setVisibility(View.VISIBLE); + mNotificationIconArea.setAnimation(loadAnim(R.anim.notification_icons_out)); + mNotificationIconArea.setVisibility(View.GONE); + mNotificationButtons.setAnimation(loadAnim(R.anim.notification_icons_in)); + mNotificationButtons.setVisibility(View.VISIBLE); mExpandedVisible = true; break; case MSG_CLOSE_NOTIFICATION_PANEL: if (DEBUG) Slog.d(TAG, "closing notifications panel"); mNotificationPanel.setVisibility(View.GONE); + mNotificationIconArea.setAnimation(loadAnim(R.anim.notification_icons_in)); + mNotificationIconArea.setVisibility(View.VISIBLE); + mNotificationButtons.setAnimation(loadAnim(R.anim.notification_buttons_out)); + mNotificationButtons.setVisibility(View.GONE); mExpandedVisible = false; break; case MSG_OPEN_SYSTEM_PANEL: @@ -446,6 +471,10 @@ public class TabletStatusBarService extends StatusBarService { } private void tick(StatusBarNotification n) { + // Don't show the ticker when the windowshade is open. + if (mNotificationPanel.getVisibility() == View.VISIBLE) { + return; + } // Show the ticker if one is requested. Also don't do this // until status bar window is attached to the window manager, // because... well, what's the point otherwise? And trying to @@ -472,19 +501,15 @@ public class TabletStatusBarService extends StatusBarService { public void setLightsOn(boolean on) { if (on) { - mCurtains.setAnimation(AnimationUtils.loadAnimation((Context)this, - R.anim.lights_out_out)); + mCurtains.setAnimation(loadAnim(R.anim.lights_out_out)); mCurtains.setVisibility(View.GONE); - mBarContents.setAnimation(AnimationUtils.loadAnimation((Context)this, - R.anim.status_bar_in)); + mBarContents.setAnimation(loadAnim(R.anim.status_bar_in)); mBarContents.setVisibility(View.VISIBLE); } else { animateCollapse(); - mCurtains.setAnimation(AnimationUtils.loadAnimation((Context)this, - R.anim.lights_out_in)); + mCurtains.setAnimation(loadAnim(R.anim.lights_out_in)); mCurtains.setVisibility(View.VISIBLE); - mBarContents.setAnimation(AnimationUtils.loadAnimation((Context)this, - R.anim.status_bar_out)); + mBarContents.setAnimation(loadAnim(R.anim.status_bar_out)); mBarContents.setVisibility(View.GONE); } } @@ -539,6 +564,13 @@ public class TabletStatusBarService extends StatusBarService { } }; + private View.OnClickListener mDoNotDisturbButtonListener = new View.OnClickListener() { + public void onClick(View v) { + mNotificationsOn = !mNotificationsOn; + animateCollapse(); + } + }; + private class NotificationClicker implements View.OnClickListener { private PendingIntent mIntent; private String mPkg; @@ -662,6 +694,10 @@ public class TabletStatusBarService extends StatusBarService { } } + Animation loadAnim(int id) { + return AnimationUtils.loadAnimation((Context)this, id); + } + private boolean inflateViews(NotificationData.Entry entry, ViewGroup parent) { StatusBarNotification sbn = entry.notification; RemoteViews remoteViews = sbn.notification.contentView; |