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

NotificationCompatApi21

public class NotificationCompatApi21 extends Object

Fields Summary
public static final String
CATEGORY_CALL
public static final String
CATEGORY_MESSAGE
public static final String
CATEGORY_EMAIL
public static final String
CATEGORY_EVENT
public static final String
CATEGORY_PROMO
public static final String
CATEGORY_ALARM
public static final String
CATEGORY_PROGRESS
public static final String
CATEGORY_SOCIAL
public static final String
CATEGORY_ERROR
public static final String
CATEGORY_TRANSPORT
public static final String
CATEGORY_SYSTEM
public static final String
CATEGORY_SERVICE
public static final String
CATEGORY_RECOMMENDATION
public static final String
CATEGORY_STATUS
private static final String
KEY_AUTHOR
private static final String
KEY_TEXT
private static final String
KEY_MESSAGES
private static final String
KEY_REMOTE_INPUT
private static final String
KEY_ON_REPLY
private static final String
KEY_ON_READ
private static final String
KEY_PARTICIPANTS
private static final String
KEY_TIMESTAMP
Constructors Summary
Methods Summary
private static android.app.RemoteInputfromCompatRemoteInput(RemoteInputCompatBase.RemoteInput src)

        return new android.app.RemoteInput.Builder(src.getResultKey())
                .setLabel(src.getLabel())
                .setChoices(src.getChoices())
                .setAllowFreeFormInput(src.getAllowFreeFormInput())
                .addExtras(src.getExtras())
                .build();
    
static android.os.BundlegetBundleForUnreadConversation(NotificationCompatBase.UnreadConversation uc)

        if (uc == null) {
            return null;
        }
        Bundle b = new Bundle();
        String author = null;
        if (uc.getParticipants() != null && uc.getParticipants().length > 1) {
            author = uc.getParticipants()[0];
        }
        Parcelable[] messages = new Parcelable[uc.getMessages().length];
        for (int i = 0; i < messages.length; i++) {
            Bundle m = new Bundle();
            m.putString(KEY_TEXT, uc.getMessages()[i]);
            m.putString(KEY_AUTHOR, author);
            messages[i] = m;
        }
        b.putParcelableArray(KEY_MESSAGES, messages);
        RemoteInputCompatBase.RemoteInput remoteInput = uc.getRemoteInput();
        if (remoteInput != null) {
            b.putParcelable(KEY_REMOTE_INPUT, fromCompatRemoteInput(remoteInput));
        }
        b.putParcelable(KEY_ON_REPLY, uc.getReplyPendingIntent());
        b.putParcelable(KEY_ON_READ, uc.getReadPendingIntent());
        b.putStringArray(KEY_PARTICIPANTS, uc.getParticipants());
        b.putLong(KEY_TIMESTAMP, uc.getLatestTimestamp());
        return b;
    
public static java.lang.StringgetCategory(android.app.Notification notif)

        return notif.category;
    
static NotificationCompatBase.UnreadConversationgetUnreadConversationFromBundle(android.os.Bundle b, NotificationCompatBase.UnreadConversation.Factory factory, RemoteInputCompatBase.RemoteInput.Factory remoteInputFactory)

        if (b == null) {
            return null;
        }
        Parcelable[] parcelableMessages = b.getParcelableArray(KEY_MESSAGES);
        String[] messages = null;
        if (parcelableMessages != null) {
            String[] tmp = new String[parcelableMessages.length];
            boolean success = true;
            for (int i = 0; i < tmp.length; i++) {
                if (!(parcelableMessages[i] instanceof Bundle)) {
                    success = false;
                    break;
                }
                tmp[i] = ((Bundle) parcelableMessages[i]).getString(KEY_TEXT);
                if (tmp[i] == null) {
                    success = false;
                    break;
                }
            }
            if (success) {
                messages = tmp;
            } else {
                return null;
            }
        }

        PendingIntent onRead = b.getParcelable(KEY_ON_READ);
        PendingIntent onReply = b.getParcelable(KEY_ON_REPLY);

        android.app.RemoteInput remoteInput = b.getParcelable(KEY_REMOTE_INPUT);

        String[] participants = b.getStringArray(KEY_PARTICIPANTS);
        if (participants == null || participants.length != 1) {
            return null;
        }


        return factory.build(
                messages,
                remoteInput != null ? toCompatRemoteInput(remoteInput, remoteInputFactory) : null,
                onReply,
                onRead,
                participants, b.getLong(KEY_TIMESTAMP));
    
private static RemoteInputCompatBase.RemoteInputtoCompatRemoteInput(android.app.RemoteInput remoteInput, RemoteInputCompatBase.RemoteInput.Factory factory)

        return factory.build(remoteInput.getResultKey(),
                remoteInput.getLabel(),
                remoteInput.getChoices(),
                remoteInput.getAllowFreeFormInput(),
                remoteInput.getExtras());