use of com.android.systemui.statusbar.NotificationData in project android_frameworks_base by ParanoidAndroid.
the class TabletStatusBar method copyNotifications.
private static void copyNotifications(ArrayList<Pair<IBinder, StatusBarNotification>> dest, NotificationData source) {
int N = source.size();
for (int i = 0; i < N; i++) {
NotificationData.Entry entry = source.get(i);
dest.add(Pair.create(entry.key, entry.notification));
}
}
use of com.android.systemui.statusbar.NotificationData in project android_frameworks_base by ParanoidAndroid.
the class PieMenu method getNotifications.
private void getNotifications() {
NotificationData notifData = mPanel.getBar().getNotificationData();
if (notifData != null) {
mNotificationText = new String[notifData.size()];
mNotificationIcon = new Bitmap[notifData.size()];
mNotificationPath = new Path[notifData.size()];
for (int i = 0; i < notifData.size(); i++) {
NotificationData.Entry entry = notifData.get(i);
StatusBarNotification statusNotif = entry.notification;
if (statusNotif == null)
continue;
boolean hide = statusNotif.getPackageName().equals("com.paranoid.halo");
if (hide) {
mHiddenNotification++;
continue;
}
Notification notif = statusNotif.getNotification();
if (notif == null)
continue;
CharSequence tickerText = notif.tickerText;
if (tickerText == null)
continue;
if (entry.icon != null) {
StatusBarIconView iconView = entry.icon;
StatusBarIcon icon = iconView.getStatusBarIcon();
Drawable drawable = entry.icon.getIcon(mContext, icon);
if (!(drawable instanceof BitmapDrawable))
continue;
mNotificationIcon[mNotificationCount] = ((BitmapDrawable) drawable).getBitmap();
String text = tickerText.toString();
if (text.length() > 100)
text = text.substring(0, 100) + "..";
mNotificationText[mNotificationCount] = text;
Path notifictionPath = new Path();
notifictionPath.addCircle(mCenter.x, mCenter.y, mNotificationsRadius + (mNotificationsRowSize * mNotificationCount) + (mNotificationsRowSize - mNotificationTextSize), Path.Direction.CW);
mNotificationPath[mNotificationCount] = notifictionPath;
mNotificationCount++;
}
}
}
}
use of com.android.systemui.statusbar.NotificationData in project android_frameworks_base by DirtyUnicorns.
the class NotificationIconAreaController method updateNotificationIcons.
/**
* Updates the notifications with the given list of notifications to display.
*/
public void updateNotificationIcons(NotificationData notificationData) {
final LinearLayout.LayoutParams params = generateIconLayoutParams();
ArrayList<NotificationData.Entry> activeNotifications = notificationData.getActiveNotifications();
final int size = activeNotifications.size();
ArrayList<StatusBarIconView> toShow = new ArrayList<>(size);
// Filter out ambient notifications and notification children.
for (int i = 0; i < size; i++) {
NotificationData.Entry ent = activeNotifications.get(i);
if (shouldShowNotification(ent, notificationData)) {
toShow.add(ent.icon);
}
}
ArrayList<View> toRemove = new ArrayList<>();
for (int i = 0; i < mNotificationIcons.getChildCount(); i++) {
View child = mNotificationIcons.getChildAt(i);
if (!toShow.contains(child)) {
toRemove.add(child);
}
}
final int toRemoveCount = toRemove.size();
for (int i = 0; i < toRemoveCount; i++) {
mNotificationIcons.removeView(toRemove.get(i));
}
for (int i = 0; i < toShow.size(); i++) {
View v = toShow.get(i);
if (v.getParent() == null) {
mNotificationIcons.addView(v, i, params);
}
}
// Re-sort notification icons
final int childCount = mNotificationIcons.getChildCount();
for (int i = 0; i < childCount; i++) {
View actual = mNotificationIcons.getChildAt(i);
StatusBarIconView expected = toShow.get(i);
if (actual == expected) {
continue;
}
mNotificationIcons.removeView(expected);
mNotificationIcons.addView(expected, i);
}
applyNotificationIconsTint();
}
Aggregations