Search in sources :

Example 1 with InboxStyle

use of android.app.Notification.InboxStyle in project platform_frameworks_base by android.

the class NotificationController method createStackedNotification.

private void createStackedNotification(List<PrintJobInfo> printJobs) {
    Notification.Builder builder = new Notification.Builder(mContext).setContentIntent(createContentIntent(null)).setWhen(System.currentTimeMillis()).setOngoing(true).setShowWhen(true).setGroup(PRINT_JOB_NOTIFICATION_GROUP_KEY).setGroupSummary(true);
    final int printJobCount = printJobs.size();
    InboxStyle inboxStyle = new InboxStyle();
    int icon = com.android.internal.R.drawable.ic_print;
    for (int i = printJobCount - 1; i >= 0; i--) {
        PrintJobInfo printJob = printJobs.get(i);
        inboxStyle.addLine(computeNotificationTitle(printJob));
        // if any print job is in an error state show an error icon for the summary
        if (printJob.getState() == PrintJobInfo.STATE_FAILED || printJob.getState() == PrintJobInfo.STATE_BLOCKED) {
            icon = com.android.internal.R.drawable.ic_print_error;
        }
    }
    builder.setSmallIcon(icon);
    builder.setLargeIcon(((BitmapDrawable) mContext.getResources().getDrawable(icon, null)).getBitmap());
    builder.setNumber(printJobCount);
    builder.setStyle(inboxStyle);
    builder.setColor(mContext.getColor(com.android.internal.R.color.system_notification_accent_color));
    mNotificationManager.notify(PRINT_JOB_NOTIFICATION_SUMMARY, 0, builder.build());
}
Also used : InboxStyle(android.app.Notification.InboxStyle) PrintJobInfo(android.print.PrintJobInfo) Notification(android.app.Notification)

Example 2 with InboxStyle

use of android.app.Notification.InboxStyle in project android_frameworks_base by AOSPA.

the class NotificationController method createStackedNotification.

private void createStackedNotification(List<PrintJobInfo> printJobs) {
    Notification.Builder builder = new Notification.Builder(mContext).setContentIntent(createContentIntent(null)).setWhen(System.currentTimeMillis()).setOngoing(true).setShowWhen(true).setGroup(PRINT_JOB_NOTIFICATION_GROUP_KEY).setGroupSummary(true);
    final int printJobCount = printJobs.size();
    InboxStyle inboxStyle = new InboxStyle();
    int icon = com.android.internal.R.drawable.ic_print;
    for (int i = printJobCount - 1; i >= 0; i--) {
        PrintJobInfo printJob = printJobs.get(i);
        inboxStyle.addLine(computeNotificationTitle(printJob));
        // if any print job is in an error state show an error icon for the summary
        if (printJob.getState() == PrintJobInfo.STATE_FAILED || printJob.getState() == PrintJobInfo.STATE_BLOCKED) {
            icon = com.android.internal.R.drawable.ic_print_error;
        }
    }
    builder.setSmallIcon(icon);
    builder.setLargeIcon(((BitmapDrawable) mContext.getResources().getDrawable(icon, null)).getBitmap());
    builder.setNumber(printJobCount);
    builder.setStyle(inboxStyle);
    builder.setColor(mContext.getColor(com.android.internal.R.color.system_notification_accent_color));
    mNotificationManager.notify(PRINT_JOB_NOTIFICATION_SUMMARY, 0, builder.build());
}
Also used : InboxStyle(android.app.Notification.InboxStyle) PrintJobInfo(android.print.PrintJobInfo) Notification(android.app.Notification)

Example 3 with InboxStyle

use of android.app.Notification.InboxStyle in project android_frameworks_base by ResurrectionRemix.

the class NotificationController method createStackedNotification.

private void createStackedNotification(List<PrintJobInfo> printJobs) {
    Notification.Builder builder = new Notification.Builder(mContext).setContentIntent(createContentIntent(null)).setWhen(System.currentTimeMillis()).setOngoing(true).setShowWhen(true).setGroup(PRINT_JOB_NOTIFICATION_GROUP_KEY).setGroupSummary(true);
    final int printJobCount = printJobs.size();
    InboxStyle inboxStyle = new InboxStyle();
    int icon = com.android.internal.R.drawable.ic_print;
    for (int i = printJobCount - 1; i >= 0; i--) {
        PrintJobInfo printJob = printJobs.get(i);
        inboxStyle.addLine(computeNotificationTitle(printJob));
        // if any print job is in an error state show an error icon for the summary
        if (printJob.getState() == PrintJobInfo.STATE_FAILED || printJob.getState() == PrintJobInfo.STATE_BLOCKED) {
            icon = com.android.internal.R.drawable.ic_print_error;
        }
    }
    builder.setSmallIcon(icon);
    builder.setLargeIcon(((BitmapDrawable) mContext.getResources().getDrawable(icon, null)).getBitmap());
    builder.setNumber(printJobCount);
    builder.setStyle(inboxStyle);
    builder.setColor(mContext.getColor(com.android.internal.R.color.system_notification_accent_color));
    mNotificationManager.notify(PRINT_JOB_NOTIFICATION_SUMMARY, 0, builder.build());
}
Also used : InboxStyle(android.app.Notification.InboxStyle) PrintJobInfo(android.print.PrintJobInfo) Notification(android.app.Notification)

Example 4 with InboxStyle

use of android.app.Notification.InboxStyle in project android_frameworks_base by crdroidandroid.

the class NotificationController method createStackedNotification.

private void createStackedNotification(List<PrintJobInfo> printJobs) {
    Notification.Builder builder = new Notification.Builder(mContext).setContentIntent(createContentIntent(null)).setWhen(System.currentTimeMillis()).setOngoing(true).setShowWhen(true).setGroup(PRINT_JOB_NOTIFICATION_GROUP_KEY).setGroupSummary(true);
    final int printJobCount = printJobs.size();
    InboxStyle inboxStyle = new InboxStyle();
    int icon = com.android.internal.R.drawable.ic_print;
    for (int i = printJobCount - 1; i >= 0; i--) {
        PrintJobInfo printJob = printJobs.get(i);
        inboxStyle.addLine(computeNotificationTitle(printJob));
        // if any print job is in an error state show an error icon for the summary
        if (printJob.getState() == PrintJobInfo.STATE_FAILED || printJob.getState() == PrintJobInfo.STATE_BLOCKED) {
            icon = com.android.internal.R.drawable.ic_print_error;
        }
    }
    builder.setSmallIcon(icon);
    builder.setLargeIcon(((BitmapDrawable) mContext.getResources().getDrawable(icon, null)).getBitmap());
    builder.setNumber(printJobCount);
    builder.setStyle(inboxStyle);
    builder.setColor(mContext.getColor(com.android.internal.R.color.system_notification_accent_color));
    mNotificationManager.notify(PRINT_JOB_NOTIFICATION_SUMMARY, 0, builder.build());
}
Also used : InboxStyle(android.app.Notification.InboxStyle) PrintJobInfo(android.print.PrintJobInfo) Notification(android.app.Notification)

Example 5 with InboxStyle

use of android.app.Notification.InboxStyle in project android_frameworks_base by DirtyUnicorns.

the class NotificationController method createStackedNotification.

private void createStackedNotification(List<PrintJobInfo> printJobs) {
    Notification.Builder builder = new Notification.Builder(mContext).setContentIntent(createContentIntent(null)).setWhen(System.currentTimeMillis()).setOngoing(true).setShowWhen(true).setGroup(PRINT_JOB_NOTIFICATION_GROUP_KEY).setGroupSummary(true);
    final int printJobCount = printJobs.size();
    InboxStyle inboxStyle = new InboxStyle();
    int icon = com.android.internal.R.drawable.ic_print;
    for (int i = printJobCount - 1; i >= 0; i--) {
        PrintJobInfo printJob = printJobs.get(i);
        inboxStyle.addLine(computeNotificationTitle(printJob));
        // if any print job is in an error state show an error icon for the summary
        if (printJob.getState() == PrintJobInfo.STATE_FAILED || printJob.getState() == PrintJobInfo.STATE_BLOCKED) {
            icon = com.android.internal.R.drawable.ic_print_error;
        }
    }
    builder.setSmallIcon(icon);
    builder.setLargeIcon(((BitmapDrawable) mContext.getResources().getDrawable(icon, null)).getBitmap());
    builder.setNumber(printJobCount);
    builder.setStyle(inboxStyle);
    builder.setColor(mContext.getColor(com.android.internal.R.color.system_notification_accent_color));
    mNotificationManager.notify(PRINT_JOB_NOTIFICATION_SUMMARY, 0, builder.build());
}
Also used : InboxStyle(android.app.Notification.InboxStyle) PrintJobInfo(android.print.PrintJobInfo) Notification(android.app.Notification)

Aggregations

Notification (android.app.Notification)5 InboxStyle (android.app.Notification.InboxStyle)5 PrintJobInfo (android.print.PrintJobInfo)5