diff options
author | Joe Onorato <joeo@google.com> | 2010-09-27 15:34:04 -0700 |
---|---|---|
committer | Joe Onorato <joeo@google.com> | 2010-09-27 15:34:04 -0700 |
commit | 5dd1169ae95162383acf00d1e9a1886e0ac99a70 (patch) | |
tree | 7138fa91373d233b24db2c509a224e38e7fc9271 /packages/SystemUI | |
parent | 2953283fbd5da76dffa931dbe1d6cc597ad6a883 (diff) | |
download | frameworks_base-5dd1169ae95162383acf00d1e9a1886e0ac99a70.zip frameworks_base-5dd1169ae95162383acf00d1e9a1886e0ac99a70.tar.gz frameworks_base-5dd1169ae95162383acf00d1e9a1886e0ac99a70.tar.bz2 |
Hide the "Clear all" button in the notification panel if there are no clearable notifications.
Change-Id: I7145036724939220e1f23fb91c62027b28663c20
Diffstat (limited to 'packages/SystemUI')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java | 2 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java | 44 |
2 files changed, 45 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java index 45abe93..7e8a5c1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java @@ -117,7 +117,7 @@ public class NotificationData { public boolean hasClearableItems() { for (Entry e : mEntries) { if (e.expanded != null) { // the view successfully inflated - if ((e.notification.notification.flags & Notification.FLAG_NO_CLEAR) == 0) { + if (e.notification.isClearable()) { return true; } } 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 ffa1690..41ae06a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java @@ -206,6 +206,9 @@ public class TabletStatusBarService extends StatusBarService { // The navigation buttons mNavigationArea = sb.findViewById(R.id.navigationArea); + // set the initial view visibility + setAreThereNotifications(); + // Add the windows addPanelWindows(); @@ -318,6 +321,8 @@ public class TabletStatusBarService extends StatusBarService { } else { tick(notification); } + + setAreThereNotifications(); } public void updateNotification(IBinder key, StatusBarNotification notification) { @@ -387,11 +392,14 @@ public class TabletStatusBarService extends StatusBarService { addNotificationViews(key, notification); } // TODO: ticker; immersive mode + + setAreThereNotifications(); } public void removeNotification(IBinder key) { if (DEBUG) Slog.d(TAG, "removeNotification(" + key + ") // TODO"); removeNotificationViews(key); + setAreThereNotifications(); } public void disable(int state) { @@ -495,6 +503,41 @@ public class TabletStatusBarService extends StatusBarService { } } + private void setAreThereNotifications() { + final boolean hasClearable = mNotns.hasClearableItems(); + + //Slog.d(TAG, "setAreThereNotifications hasClerable=" + hasClearable); + + // Show or hide the "Clear all" button. Note that we don't do an animation + // if it's not on screen, so that if someone opens the bar right then they + // don't see the animation in progress. + // (no ongoing notifications are clearable) + if (hasClearable) { + if (mNotificationButtons.getVisibility() == View.VISIBLE) { + setViewVisibility(mClearButton, View.VISIBLE, R.anim.notification_buttons_in); + } else { + mClearButton.setVisibility(View.VISIBLE); + } + } else { + if (mNotificationButtons.getVisibility() == View.VISIBLE) { + setViewVisibility(mClearButton, View.GONE, R.anim.notification_buttons_out); + } else { + mClearButton.setVisibility(View.GONE); + } + } + + /* + mOngoingTitle.setVisibility(ongoing ? View.VISIBLE : View.GONE); + mLatestTitle.setVisibility(latest ? View.VISIBLE : View.GONE); + + if (ongoing || latest) { + mNoNotificationsTitle.setVisibility(View.GONE); + } else { + mNoNotificationsTitle.setVisibility(View.VISIBLE); + } + */ + } + public void notificationIconsClicked(View v) { if (DEBUG) Slog.d(TAG, "clicked notification icons"); if ((mDisabled & StatusBarManager.DISABLE_EXPAND) == 0) { @@ -790,6 +833,7 @@ public class TabletStatusBarService extends StatusBarService { private void setViewVisibility(View v, int vis, int anim) { if (v.getVisibility() != vis) { + //Slog.d(TAG, "setViewVisibility vis=" + (vis == View.VISIBLE) + " v=" + v); v.setAnimation(AnimationUtils.loadAnimation((Context)this, anim)); v.setVisibility(vis); } |