Search in sources :

Example 1 with NotificationData

use of com.android.systemui.statusbar.NotificationData in project platform_frameworks_base by android.

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)

Example 2 with NotificationData

use of com.android.systemui.statusbar.NotificationData in project android_frameworks_base by AOSPA.

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)

Example 3 with NotificationData

use of com.android.systemui.statusbar.NotificationData in project android_frameworks_base by ResurrectionRemix.

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)

Example 4 with NotificationData

use of com.android.systemui.statusbar.NotificationData in project android_frameworks_base by crdroidandroid.

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)

Example 5 with NotificationData

use of com.android.systemui.statusbar.NotificationData in project android_frameworks_base by ParanoidAndroid.

the class PhoneStatusBar 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)

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