diff options
author | Joe Onorato <joeo@android.com> | 2010-05-24 16:39:29 -0400 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2010-06-02 14:48:44 -0700 |
commit | 20da8f8ac9cfc8b845231c6b93f5b64a764ab39a (patch) | |
tree | 647fa6408db7952dc84fd880b58a5231c8993c7a /packages | |
parent | 0e26dffd6cfcb09b08a94a857b891fdef7fe2b1e (diff) | |
download | frameworks_base-20da8f8ac9cfc8b845231c6b93f5b64a764ab39a.zip frameworks_base-20da8f8ac9cfc8b845231c6b93f5b64a764ab39a.tar.gz frameworks_base-20da8f8ac9cfc8b845231c6b93f5b64a764ab39a.tar.bz2 |
Implement setAreThereNotifications.
Change-Id: I8b69330c35d613ce808a472748dd2651adb5efa3
Diffstat (limited to 'packages')
-rw-r--r-- | packages/StatusBarPhone/src/com/android/policy/statusbar/phone/NotificationData.java | 23 | ||||
-rw-r--r-- | packages/StatusBarPhone/src/com/android/policy/statusbar/phone/PhoneStatusBarService.java | 13 |
2 files changed, 29 insertions, 7 deletions
diff --git a/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/NotificationData.java b/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/NotificationData.java index 3c93021..5499cc4 100644 --- a/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/NotificationData.java +++ b/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/NotificationData.java @@ -16,6 +16,7 @@ package com.android.policy.statusbar.phone; +import android.app.Notification; import android.os.IBinder; import android.view.View; @@ -89,4 +90,26 @@ public class NotificationData { } return N; } + + /** + * Return whether there are any visible items (i.e. items without an error). + */ + public boolean hasVisibleItems() { + return mEntries.size() != 0; // TODO + } + + /** + * Return whether there are any clearable items (that aren't errors). + */ + public boolean hasClearableItems() { + final int N = mEntries.size(); + for (int i=0; i<N; i++) { + Entry entry = mEntries.get(i); + // TODO: if (!entry.error) + if ((entry.notification.notification.flags & Notification.FLAG_NO_CLEAR) == 0) { + return true; + } + } + return false; + } } diff --git a/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/PhoneStatusBarService.java b/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/PhoneStatusBarService.java index 397dd47..4acd57c 100644 --- a/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/PhoneStatusBarService.java +++ b/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/PhoneStatusBarService.java @@ -324,7 +324,8 @@ public class PhoneStatusBarService extends StatusBarService { // show the ticker // TODO - // recalculate the position of the sliding windows + // Recalculate the position of the sliding windows and the titles. + setAreThereNotifications(); updateExpandedViewPos(EXPANDED_LEAVE_ALONE); } @@ -483,7 +484,6 @@ public class PhoneStatusBarService extends StatusBarService { final int iconIndex = chooseIconIndex(isOngoing, viewIndex); mNotificationIcons.addView(iconView, iconIndex, new LinearLayout.LayoutParams(mIconWidth, mHeight)); - } void removeNotificationViews(IBinder key) { @@ -502,11 +502,11 @@ public class PhoneStatusBarService extends StatusBarService { } private void setAreThereNotifications() { - /* - boolean ongoing = mOngoingItems.getChildCount() != 0; - boolean latest = mLatestItems.getChildCount() != 0; + boolean ongoing = mOngoing.hasVisibleItems(); + boolean latest = mLatest.hasVisibleItems(); - if (mNotificationData.hasClearableItems()) { + // (no ongoing notifications are clearable) + if (mLatest.hasClearableItems()) { mClearButton.setVisibility(View.VISIBLE); } else { mClearButton.setVisibility(View.INVISIBLE); @@ -520,7 +520,6 @@ public class PhoneStatusBarService extends StatusBarService { } else { mNoNotificationsTitle.setVisibility(View.VISIBLE); } - */ } |