Loading packages/StatusBarPhone/src/com/android/policy/statusbar/phone/NotificationData.java +23 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.policy.statusbar.phone; import android.app.Notification; import android.os.IBinder; import android.view.View; Loading Loading @@ -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; } } packages/StatusBarPhone/src/com/android/policy/statusbar/phone/PhoneStatusBarService.java +6 −7 Original line number Diff line number Diff line Loading @@ -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); } Loading Loading @@ -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) { Loading @@ -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); Loading @@ -520,7 +520,6 @@ public class PhoneStatusBarService extends StatusBarService { } else { mNoNotificationsTitle.setVisibility(View.VISIBLE); } */ } Loading Loading
packages/StatusBarPhone/src/com/android/policy/statusbar/phone/NotificationData.java +23 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.policy.statusbar.phone; import android.app.Notification; import android.os.IBinder; import android.view.View; Loading Loading @@ -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; } }
packages/StatusBarPhone/src/com/android/policy/statusbar/phone/PhoneStatusBarService.java +6 −7 Original line number Diff line number Diff line Loading @@ -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); } Loading Loading @@ -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) { Loading @@ -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); Loading @@ -520,7 +520,6 @@ public class PhoneStatusBarService extends StatusBarService { } else { mNoNotificationsTitle.setVisibility(View.VISIBLE); } */ } Loading