Search in sources :

Example 31 with StatusBarIconView

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

the class StatusBarIconController method addSystemIcon.

private void addSystemIcon(int index, StatusBarIcon icon) {
    String slot = getSlot(index);
    int viewIndex = getViewIndex(index);
    boolean blocked = mIconBlacklist.contains(slot);
    StatusBarIconView view = new StatusBarIconView(mContext, slot, null, blocked);
    view.set(icon);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, mIconSize);
    lp.setMargins(mIconHPadding, 0, mIconHPadding, 0);
    mStatusIcons.addView(view, viewIndex, lp);
    view = new StatusBarIconView(mContext, slot, null, blocked);
    view.set(icon);
    mStatusIconsKeyguard.addView(view, viewIndex, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, mIconSize));
    applyIconTint();
}
Also used : LinearLayout(android.widget.LinearLayout) StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView)

Example 32 with StatusBarIconView

use of com.android.systemui.statusbar.StatusBarIconView in project android_frameworks_base by DirtyUnicorns.

the class StatusBarIconController method handleSet.

private void handleSet(int index, StatusBarIcon icon) {
    int viewIndex = getViewIndex(index);
    StatusBarIconView view = (StatusBarIconView) mStatusIcons.getChildAt(viewIndex);
    view.set(icon);
    view = (StatusBarIconView) mStatusIconsKeyguard.getChildAt(viewIndex);
    view.set(icon);
    applyIconTint();
}
Also used : StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView)

Example 33 with StatusBarIconView

use of com.android.systemui.statusbar.StatusBarIconView in project android_frameworks_base by DirtyUnicorns.

the class StatusBarIconController method dump.

public void dump(PrintWriter pw) {
    int N = mStatusIcons.getChildCount();
    pw.println("  icon views: " + N);
    for (int i = 0; i < N; i++) {
        StatusBarIconView ic = (StatusBarIconView) mStatusIcons.getChildAt(i);
        pw.println("    [" + i + "] icon=" + ic);
    }
    super.dump(pw);
}
Also used : StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView)

Example 34 with StatusBarIconView

use of com.android.systemui.statusbar.StatusBarIconView in project android_frameworks_base by DirtyUnicorns.

the class NotificationIconAreaController method applyNotificationIconsTint.

/**
     * Applies {@link #mIconTint} to the notification icons.
     */
private void applyNotificationIconsTint() {
    for (int i = 0; i < mNotificationIcons.getChildCount(); i++) {
        StatusBarIconView v = (StatusBarIconView) mNotificationIcons.getChildAt(i);
        boolean isPreL = Boolean.TRUE.equals(v.getTag(R.id.icon_is_pre_L));
        boolean colorize = !isPreL || NotificationUtils.isGrayscale(v, mNotificationColorUtil);
        if (colorize) {
            v.setImageTintList(ColorStateList.valueOf(StatusBarIconController.getTint(mTintArea, v, mIconTint)));
        }
    }
}
Also used : StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView)

Example 35 with StatusBarIconView

use of com.android.systemui.statusbar.StatusBarIconView 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

StatusBarIconView (com.android.systemui.statusbar.StatusBarIconView)42 LinearLayout (android.widget.LinearLayout)17 NotificationData (com.android.systemui.statusbar.NotificationData)8 StatusBarIcon (com.android.internal.statusbar.StatusBarIcon)7 ArrayList (java.util.ArrayList)7 View (android.view.View)6 ImageView (android.widget.ImageView)6 Point (android.graphics.Point)4 StatusBarNotification (android.service.notification.StatusBarNotification)4 ColorDrawable (android.graphics.drawable.ColorDrawable)3 Drawable (android.graphics.drawable.Drawable)3 Notification (android.app.Notification)2 NinePatchDrawable (android.graphics.drawable.NinePatchDrawable)2 Entry (com.android.systemui.statusbar.NotificationData.Entry)2 PendingIntent (android.app.PendingIntent)1 Paint (android.graphics.Paint)1 Path (android.graphics.Path)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 IBinder (android.os.IBinder)1 RemoteException (android.os.RemoteException)1