summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI/src/com/android')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java72
2 files changed, 61 insertions, 13 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..0e26f52 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) {
@@ -690,19 +733,23 @@ public class TabletStatusBarService extends StatusBarService {
LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View row = inflater.inflate(R.layout.status_bar_latest_event, parent, false);
View vetoButton = row.findViewById(R.id.veto);
- final String _pkg = sbn.pkg;
- final String _tag = sbn.tag;
- final int _id = sbn.id;
- vetoButton.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
- try {
- mBarService.onNotificationClear(_pkg, _tag, _id);
- } catch (RemoteException ex) {
- // system process is dead if we're here.
+ if (entry.notification.isClearable()) {
+ final String _pkg = sbn.pkg;
+ final String _tag = sbn.tag;
+ final int _id = sbn.id;
+ vetoButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ try {
+ mBarService.onNotificationClear(_pkg, _tag, _id);
+ } catch (RemoteException ex) {
+ // system process is dead if we're here.
+ }
+ // animateCollapse();
}
-// animateCollapse();
- }
- });
+ });
+ } else {
+ vetoButton.setVisibility(View.INVISIBLE);
+ }
// bind the click event to the content area
ViewGroup content = (ViewGroup)row.findViewById(R.id.content);
@@ -790,6 +837,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);
}