FileDocCategorySizeDatePackage
NotificationCompatApi20.javaAPI DocAndroid 5.1 API8588Thu Mar 12 22:22:56 GMT 2015android.support.v4.app

NotificationCompatApi20

public class NotificationCompatApi20 extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidaddAction(Notification.Builder b, NotificationCompatBase.Action action)

        Notification.Action.Builder actionBuilder = new Notification.Action.Builder(
                action.getIcon(), action.getTitle(), action.getActionIntent());
        if (action.getRemoteInputs() != null) {
            for (RemoteInput remoteInput : RemoteInputCompatApi20.fromCompat(
                    action.getRemoteInputs())) {
                actionBuilder.addRemoteInput(remoteInput);
            }
        }
        if (action.getExtras() != null) {
            actionBuilder.addExtras(action.getExtras());
        }
        b.addAction(actionBuilder.build());
    
public static NotificationCompatBase.ActiongetAction(android.app.Notification notif, int actionIndex, NotificationCompatBase.Action.Factory actionFactory, RemoteInputCompatBase.RemoteInput.Factory remoteInputFactory)

        return getActionCompatFromAction(notif.actions[actionIndex], actionFactory, remoteInputFactory);
    
private static NotificationCompatBase.ActiongetActionCompatFromAction(Notification.Action action, NotificationCompatBase.Action.Factory actionFactory, RemoteInputCompatBase.RemoteInput.Factory remoteInputFactory)

        RemoteInputCompatBase.RemoteInput[] remoteInputs = RemoteInputCompatApi20.toCompat(
                action.getRemoteInputs(), remoteInputFactory);
        return actionFactory.build(action.icon, action.title, action.actionIntent,
                action.getExtras(), remoteInputs);
    
private static Notification.ActiongetActionFromActionCompat(NotificationCompatBase.Action actionCompat)

        Notification.Action.Builder actionBuilder = new Notification.Action.Builder(
                actionCompat.getIcon(), actionCompat.getTitle(), actionCompat.getActionIntent())
                .addExtras(actionCompat.getExtras());
        RemoteInputCompatBase.RemoteInput[] remoteInputCompats = actionCompat.getRemoteInputs();
        if (remoteInputCompats != null) {
            RemoteInput[] remoteInputs = RemoteInputCompatApi20.fromCompat(remoteInputCompats);
            for (RemoteInput remoteInput : remoteInputs) {
                actionBuilder.addRemoteInput(remoteInput);
            }
        }
        return actionBuilder.build();
    
public static NotificationCompatBase.Action[]getActionsFromParcelableArrayList(java.util.ArrayList parcelables, NotificationCompatBase.Action.Factory actionFactory, RemoteInputCompatBase.RemoteInput.Factory remoteInputFactory)
Get a list of notification compat actions by parsing actions stored within a list of parcelables using the {@link Bundle#getParcelableArrayList} function in the same manner that framework code would do so. In API20, Using Action parcelable directly is correct.

        if (parcelables == null) {
            return null;
        }
        NotificationCompatBase.Action[] actions = actionFactory.newArray(parcelables.size());
        for (int i = 0; i < actions.length; i++) {
            Notification.Action action = (Notification.Action) parcelables.get(i);
            actions[i] = getActionCompatFromAction(action, actionFactory, remoteInputFactory);
        }
        return actions;
    
public static java.lang.StringgetGroup(android.app.Notification notif)

        return notif.getGroup();
    
public static booleangetLocalOnly(android.app.Notification notif)

        return (notif.flags & Notification.FLAG_LOCAL_ONLY) != 0;
    
public static java.util.ArrayListgetParcelableArrayListForActions(NotificationCompatBase.Action[] actions)
Get an array list of parcelables, suitable for {@link Bundle#putParcelableArrayList}, that matches what framework code would do to store an actions list in this way. In API20, action parcelables were directly placed as entries in the array list.

        if (actions == null) {
            return null;
        }
        ArrayList<Parcelable> parcelables = new ArrayList<Parcelable>(actions.length);
        for (NotificationCompatBase.Action action : actions) {
            parcelables.add(getActionFromActionCompat(action));
        }
        return parcelables;
    
public static java.lang.StringgetSortKey(android.app.Notification notif)

        return notif.getSortKey();
    
public static booleanisGroupSummary(android.app.Notification notif)

        return (notif.flags & Notification.FLAG_GROUP_SUMMARY) != 0;