Search in sources :

Example 6 with NotificationData

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));
    }
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) Point(android.graphics.Point) NotificationData(com.android.systemui.statusbar.NotificationData)

Example 7 with NotificationData

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++;
            }
        }
    }
}
Also used : Path(android.graphics.Path) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Paint(android.graphics.Paint) Point(android.graphics.Point) Notification(android.app.Notification) StatusBarNotification(android.service.notification.StatusBarNotification) StatusBarNotification(android.service.notification.StatusBarNotification) StatusBarIcon(com.android.internal.statusbar.StatusBarIcon) NotificationData(com.android.systemui.statusbar.NotificationData) StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView)

Example 8 with NotificationData

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();
}
Also used : ArrayList(java.util.ArrayList) StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView) ImageView(android.widget.ImageView) View(android.view.View) LinearLayout(android.widget.LinearLayout) StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView) NotificationData(com.android.systemui.statusbar.NotificationData)

Aggregations

NotificationData (com.android.systemui.statusbar.NotificationData)8 StatusBarIconView (com.android.systemui.statusbar.StatusBarIconView)6 View (android.view.View)5 ImageView (android.widget.ImageView)5 LinearLayout (android.widget.LinearLayout)5 ArrayList (java.util.ArrayList)5 Point (android.graphics.Point)3 Entry (com.android.systemui.statusbar.NotificationData.Entry)2 Notification (android.app.Notification)1 Paint (android.graphics.Paint)1 Path (android.graphics.Path)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 Drawable (android.graphics.drawable.Drawable)1 StatusBarNotification (android.service.notification.StatusBarNotification)1 StatusBarIcon (com.android.internal.statusbar.StatusBarIcon)1