Search in sources :

Example 1 with Builder

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

the class BuzzBeepBlinkTest method getNotificationRecord.

private NotificationRecord getNotificationRecord(int id, boolean insistent, boolean once, boolean noisy, boolean buzzy) {
    final Builder builder = new Builder(getContext()).setContentTitle("foo").setSmallIcon(android.R.drawable.sym_def_app_icon).setPriority(Notification.PRIORITY_HIGH).setOnlyAlertOnce(once);
    int defaults = 0;
    if (noisy) {
        defaults |= Notification.DEFAULT_SOUND;
    }
    if (buzzy) {
        defaults |= Notification.DEFAULT_VIBRATE;
    }
    builder.setDefaults(defaults);
    Notification n = builder.build();
    if (insistent) {
        n.flags |= Notification.FLAG_INSISTENT;
    }
    StatusBarNotification sbn = new StatusBarNotification(mPkg, mPkg, id, mTag, mUid, mPid, mScore, n, mUser, System.currentTimeMillis());
    return new NotificationRecord(getContext(), sbn);
}
Also used : StatusBarNotification(android.service.notification.StatusBarNotification) Builder(android.app.Notification.Builder) Notification(android.app.Notification) StatusBarNotification(android.service.notification.StatusBarNotification)

Example 2 with Builder

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

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 3 with Builder

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

the class BuzzBeepBlinkTest method getNotificationRecord.

private NotificationRecord getNotificationRecord(int id, boolean insistent, boolean once, boolean noisy, boolean buzzy) {
    final Builder builder = new Builder(getContext()).setContentTitle("foo").setSmallIcon(android.R.drawable.sym_def_app_icon).setPriority(Notification.PRIORITY_HIGH).setOnlyAlertOnce(once);
    int defaults = 0;
    if (noisy) {
        defaults |= Notification.DEFAULT_SOUND;
    }
    if (buzzy) {
        defaults |= Notification.DEFAULT_VIBRATE;
    }
    builder.setDefaults(defaults);
    Notification n = builder.build();
    if (insistent) {
        n.flags |= Notification.FLAG_INSISTENT;
    }
    StatusBarNotification sbn = new StatusBarNotification(mPkg, mPkg, id, mTag, mUid, mPid, mScore, n, mUser, System.currentTimeMillis());
    return new NotificationRecord(getContext(), sbn);
}
Also used : StatusBarNotification(android.service.notification.StatusBarNotification) Builder(android.app.Notification.Builder) Notification(android.app.Notification) StatusBarNotification(android.service.notification.StatusBarNotification)

Example 4 with Builder

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

the class BuzzBeepBlinkTest method getNotificationRecord.

private NotificationRecord getNotificationRecord(int id, boolean insistent, boolean once, boolean noisy, boolean buzzy) {
    final Builder builder = new Builder(getContext()).setContentTitle("foo").setSmallIcon(android.R.drawable.sym_def_app_icon).setPriority(Notification.PRIORITY_HIGH).setOnlyAlertOnce(once);
    int defaults = 0;
    if (noisy) {
        defaults |= Notification.DEFAULT_SOUND;
    }
    if (buzzy) {
        defaults |= Notification.DEFAULT_VIBRATE;
    }
    builder.setDefaults(defaults);
    Notification n = builder.build();
    if (insistent) {
        n.flags |= Notification.FLAG_INSISTENT;
    }
    StatusBarNotification sbn = new StatusBarNotification(mPkg, mPkg, id, mTag, mUid, mPid, mScore, n, mUser, System.currentTimeMillis());
    return new NotificationRecord(getContext(), sbn);
}
Also used : StatusBarNotification(android.service.notification.StatusBarNotification) Builder(android.app.Notification.Builder) Notification(android.app.Notification) StatusBarNotification(android.service.notification.StatusBarNotification)

Example 5 with Builder

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

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)16 Notification (android.app.Notification)10 PendingIntent (android.app.PendingIntent)6 Intent (android.content.Intent)6 StatusBarNotification (android.service.notification.StatusBarNotification)5 RemoteViews (android.widget.RemoteViews)5 SuppressLint (android.annotation.SuppressLint)1 SharedPreferences (android.content.SharedPreferences)1 Bitmap (android.graphics.Bitmap)1 ContactPhotoLoader (com.android.dialer.app.contactinfo.ContactPhotoLoader)1 CallIntentBuilder (com.android.dialer.callintent.CallIntentBuilder)1 ContactInfo (com.android.dialer.phonenumbercache.ContactInfo)1 ChatMsg (com.lingtuan.firefly.vo.ChatMsg)1 Date (java.util.Date)1