Search in sources :

Example 11 with Builder

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

the class Job method createProgressBuilder.

final Builder createProgressBuilder(String title, @DrawableRes int icon, String actionTitle, @DrawableRes int actionIcon) {
    Notification.Builder progressBuilder = new Notification.Builder(service).setContentTitle(title).setContentIntent(PendingIntent.getActivity(appContext, 0, buildNavigateIntent(INTENT_TAG_PROGRESS), 0)).setCategory(Notification.CATEGORY_PROGRESS).setSmallIcon(icon).setOngoing(true);
    final Intent cancelIntent = createCancelIntent();
    progressBuilder.addAction(actionIcon, actionTitle, PendingIntent.getService(service, 0, cancelIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_CANCEL_CURRENT));
    return progressBuilder;
}
Also used : Builder(android.app.Notification.Builder) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) Notification(android.app.Notification)

Example 12 with Builder

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

the class NotificationListenerService method maybePopulateRemoteViews.

/**
     * Populates remote views for pre-N targeting apps.
     */
private void maybePopulateRemoteViews(Notification notification) {
    if (getContext().getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.N) {
        Builder builder = Builder.recoverBuilder(getContext(), notification);
        // Some styles wrap Notification's contentView, bigContentView and headsUpContentView.
        // First inflate them all, only then set them to avoid recursive wrapping.
        RemoteViews content = builder.createContentView();
        RemoteViews big = builder.createBigContentView();
        RemoteViews headsUp = builder.createHeadsUpContentView();
        notification.contentView = content;
        notification.bigContentView = big;
        notification.headsUpContentView = headsUp;
    }
}
Also used : RemoteViews(android.widget.RemoteViews) Builder(android.app.Notification.Builder)

Example 13 with Builder

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

the class Job method createProgressBuilder.

final Builder createProgressBuilder(String title, @DrawableRes int icon, String actionTitle, @DrawableRes int actionIcon) {
    Notification.Builder progressBuilder = new Notification.Builder(service).setContentTitle(title).setContentIntent(PendingIntent.getActivity(appContext, 0, buildNavigateIntent(INTENT_TAG_PROGRESS), 0)).setCategory(Notification.CATEGORY_PROGRESS).setSmallIcon(icon).setOngoing(true);
    final Intent cancelIntent = createCancelIntent();
    progressBuilder.addAction(actionIcon, actionTitle, PendingIntent.getService(service, 0, cancelIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_CANCEL_CURRENT));
    return progressBuilder;
}
Also used : Builder(android.app.Notification.Builder) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) Notification(android.app.Notification)

Example 14 with Builder

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

the class Job method createProgressBuilder.

final Builder createProgressBuilder(String title, @DrawableRes int icon, String actionTitle, @DrawableRes int actionIcon) {
    Notification.Builder progressBuilder = new Notification.Builder(service).setContentTitle(title).setContentIntent(PendingIntent.getActivity(appContext, 0, buildNavigateIntent(INTENT_TAG_PROGRESS), 0)).setCategory(Notification.CATEGORY_PROGRESS).setSmallIcon(icon).setOngoing(true);
    final Intent cancelIntent = createCancelIntent();
    progressBuilder.addAction(actionIcon, actionTitle, PendingIntent.getService(service, 0, cancelIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_CANCEL_CURRENT));
    return progressBuilder;
}
Also used : Builder(android.app.Notification.Builder) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) Notification(android.app.Notification)

Aggregations

Builder (android.app.Notification.Builder)14 Notification (android.app.Notification)9 PendingIntent (android.app.PendingIntent)5 Intent (android.content.Intent)5 RemoteViews (android.widget.RemoteViews)5 StatusBarNotification (android.service.notification.StatusBarNotification)4