Search in sources :

Example 36 with StatusBarIcon

use of com.android.internal.statusbar.StatusBarIcon in project android_frameworks_base by DirtyUnicorns.

the class StatusBarIconController method setIcon.

public void setIcon(String slot, int resourceId, CharSequence contentDescription) {
    int index = getSlotIndex(slot);
    StatusBarIcon icon = getIcon(index);
    if (icon == null) {
        icon = new StatusBarIcon(UserHandle.SYSTEM, mContext.getPackageName(), Icon.createWithResource(mContext, resourceId), 0, 0, contentDescription);
        setIcon(slot, icon);
    } else {
        icon.icon = Icon.createWithResource(mContext, resourceId);
        icon.contentDescription = contentDescription;
        handleSet(index, icon);
    }
}
Also used : StatusBarIcon(com.android.internal.statusbar.StatusBarIcon)

Example 37 with StatusBarIcon

use of com.android.internal.statusbar.StatusBarIcon in project android_frameworks_base by DirtyUnicorns.

the class StatusBarManagerService method setIcon.

@Override
public void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription) {
    enforceStatusBar();
    synchronized (mIcons) {
        StatusBarIcon icon = new StatusBarIcon(iconPackage, UserHandle.SYSTEM, iconId, iconLevel, 0, contentDescription);
        //Slog.d(TAG, "setIcon slot=" + slot + " index=" + index + " icon=" + icon);
        mIcons.put(slot, icon);
        if (mBar != null) {
            try {
                mBar.setIcon(slot, icon);
            } catch (RemoteException ex) {
            }
        }
    }
}
Also used : StatusBarIcon(com.android.internal.statusbar.StatusBarIcon) RemoteException(android.os.RemoteException)

Example 38 with StatusBarIcon

use of com.android.internal.statusbar.StatusBarIcon in project android_frameworks_base by AOSPA.

the class StatusBarIconController method setIcon.

public void setIcon(String slot, int resourceId, CharSequence contentDescription) {
    int index = getSlotIndex(slot);
    StatusBarIcon icon = getIcon(index);
    if (icon == null) {
        icon = new StatusBarIcon(UserHandle.SYSTEM, mContext.getPackageName(), Icon.createWithResource(mContext, resourceId), 0, 0, contentDescription);
        setIcon(slot, icon);
    } else {
        icon.icon = Icon.createWithResource(mContext, resourceId);
        icon.contentDescription = contentDescription;
        handleSet(index, icon);
    }
}
Also used : StatusBarIcon(com.android.internal.statusbar.StatusBarIcon)

Example 39 with StatusBarIcon

use of com.android.internal.statusbar.StatusBarIcon in project android_frameworks_base by AOSPA.

the class StatusBarIconController method setIconVisibility.

public void setIconVisibility(String slot, boolean visibility) {
    int index = getSlotIndex(slot);
    StatusBarIcon icon = getIcon(index);
    if (icon == null || icon.visible == visibility) {
        return;
    }
    icon.visible = visibility;
    handleSet(index, icon);
}
Also used : StatusBarIcon(com.android.internal.statusbar.StatusBarIcon)

Example 40 with StatusBarIcon

use of com.android.internal.statusbar.StatusBarIcon in project android_frameworks_base by AOSPA.

the class BaseStatusBar method createIcon.

public StatusBarIconView createIcon(StatusBarNotification sbn) {
    // Construct the icon.
    Notification n = sbn.getNotification();
    final StatusBarIconView iconView = new StatusBarIconView(mContext, sbn.getPackageName() + "/0x" + Integer.toHexString(sbn.getId()), n);
    iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    final Icon smallIcon = n.getSmallIcon();
    if (smallIcon == null) {
        handleNotificationError(sbn, "No small icon in notification from " + sbn.getPackageName());
        return null;
    }
    final StatusBarIcon ic = new StatusBarIcon(sbn.getUser(), sbn.getPackageName(), smallIcon, n.iconLevel, n.number, StatusBarIconView.contentDescForNotification(mContext, n));
    if (!iconView.set(ic)) {
        handleNotificationError(sbn, "Couldn't create icon: " + ic);
        return null;
    }
    return iconView;
}
Also used : StatusBarIcon(com.android.internal.statusbar.StatusBarIcon) Icon(android.graphics.drawable.Icon) StatusBarIcon(com.android.internal.statusbar.StatusBarIcon) Notification(android.app.Notification) StatusBarNotification(android.service.notification.StatusBarNotification)

Aggregations

StatusBarIcon (com.android.internal.statusbar.StatusBarIcon)56 StatusBarNotification (android.service.notification.StatusBarNotification)16 Notification (android.app.Notification)13 RemoteException (android.os.RemoteException)13 ComponentName (android.content.ComponentName)10 Drawable (android.graphics.drawable.Drawable)8 StatusBarIconView (com.android.systemui.statusbar.StatusBarIconView)8 IBinder (android.os.IBinder)7 ArrayList (java.util.ArrayList)7 IntentFilter (android.content.IntentFilter)6 Rect (android.graphics.Rect)6 PackageInfo (android.content.pm.PackageInfo)5 PackageManager (android.content.pm.PackageManager)5 Configuration (android.content.res.Configuration)5 Icon (android.graphics.drawable.Icon)5 UserHandle (android.os.UserHandle)5 IVrManager (android.service.vr.IVrManager)5 LinearLayout (android.widget.LinearLayout)5 LockPatternUtils (com.android.internal.widget.LockPatternUtils)5 Entry (com.android.systemui.statusbar.NotificationData.Entry)5