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);
}
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;
}
}
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);
}
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);
}
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;
}
Aggregations