Search in sources :

Example 41 with StatusBarIconView

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

the class DemoStatusIcons method updateSlot.

private void updateSlot(String slot, String iconPkg, int iconId) {
    if (!mDemoMode)
        return;
    if (iconPkg == null) {
        iconPkg = mContext.getPackageName();
    }
    int removeIndex = -1;
    for (int i = 0; i < getChildCount(); i++) {
        StatusBarIconView v = (StatusBarIconView) getChildAt(i);
        if (slot.equals(v.getTag())) {
            if (iconId == 0) {
                removeIndex = i;
                break;
            } else {
                StatusBarIcon icon = v.getStatusBarIcon();
                icon.icon = Icon.createWithResource(icon.icon.getResPackage(), iconId);
                v.set(icon);
                v.updateDrawable();
                return;
            }
        }
    }
    if (iconId == 0) {
        if (removeIndex != -1) {
            removeViewAt(removeIndex);
        }
        return;
    }
    StatusBarIcon icon = new StatusBarIcon(iconPkg, UserHandle.SYSTEM, iconId, 0, 0, "Demo");
    StatusBarIconView v = new StatusBarIconView(getContext(), null, null);
    v.setTag(slot);
    v.set(icon);
    addView(v, 0, new LinearLayout.LayoutParams(mIconSize, mIconSize));
}
Also used : StatusBarIcon(com.android.internal.statusbar.StatusBarIcon) LinearLayout(android.widget.LinearLayout) StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView)

Example 42 with StatusBarIconView

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

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)

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