style = new NotificationCompat.InboxStyle(); style.setBigContentTitle(getString(R.string.stat_download_done_title)); SparseJBArray stateArray = sItemStateArray; SparseJLArray<String> titleArray = sItemTitleArray; continue; style.addLine(getString(fin ? R.string.stat_download_done_line_succeeded : R.string.stat_download_done_line_failed, title));
.setBigContentTitle(title) .setSummaryText(summary); style.addLine(content.summary);
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); NotificationManager mgr= (NotificationManager)getSystemService(NOTIFICATION_SERVICE); if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.O && mgr.getNotificationChannel(CHANNEL_WHATEVER)==null) { mgr.createNotificationChannel(new NotificationChannel(CHANNEL_WHATEVER, "Whatever", NotificationManager.IMPORTANCE_DEFAULT)); } NotificationCompat.Builder normal=buildNormal(); NotificationCompat.InboxStyle big= new NotificationCompat.InboxStyle(normal); mgr.notify(NOTIFY_ID, big.setSummaryText(getString(R.string.summary)) .addLine(getString(R.string.entry)) .addLine(getString(R.string.another_entry)) .addLine(getString(R.string.third_entry)) .addLine(getString(R.string.yet_another_entry)) .addLine(getString(R.string.low)).build()); finish(); }
inbox = new NotificationCompat.InboxStyle(); try { if(summaryId >= 0) { summaryText = _context.getResources().getQuantityString(summaryId, numNotifs, numNotifs, summaryArg); inbox.setSummaryText(summaryText);
if (inboxStyleCheckBox.isChecked()) { builder.setStyle( new NotificationCompat.InboxStyle() .addLine("line1") .addLine("line2") .addLine("line3") .addLine("line4") .addLine("line5") .addLine("line6") .addLine("line7") .setBigContentTitle("BigContentTitle") .setSummaryText("SummaryText"));
new NotificationCompat.InboxStyle(); inboxStyle.setBigContentTitle(getNotificationTitle(count, contact, channel, message)); inboxStyle.addLine(getSpannedText(getMessageBody(messageString, count, channel, contact))); mBuilder.setContentText(summaryText); inboxStyle.setSummaryText(summaryText); mBuilder.setContentTitle(getNotificationTitle(count, contact, channel, message)); mBuilder.setStyle(inboxStyle);
new NotificationCompat.InboxStyle(); if (legsUpdated == 1){ delayText = generateDelayText(leg.departureDelay, false) + " " + getResources().getString(R.string.notification_stop_name_conector) + " " + getResources().getString(R.string.notification_origin); inboxStyle.addLine(generateDelayText(leg.departureDelay, false) + " " + getResources().getString(R.string.notification_stop_name_conector) + " " + getResources().getString(R.string.notification_origin) + ", " getResources().getString(R.string.notification_stop_name_conector) + " " + getResources().getString(R.string.notification_destination); inboxStyle.addLine(generateDelayText(leg.arrivalDelay, false) + " " + getResources().getString(R.string.notification_stop_name_conector) + " " + getResources().getString(R.string.notification_destination) +", " inboxStyle.addLine(generateDelayText(leg.departureDelay, true)); inboxStyle.addLine(getResources().getString(R.string.notification_stop_name_conector) + " " + getResources().getString(R.string.notification_origin) + "," + " " + leg.from.name); inboxStyle.addLine(getResources().getString(R.string.notification_stop_name_conector) + " " + getResources().getString(R.string.notification_destination) + "," + " " + leg.to.name); getResources().getString(R.string.notification_stop_name_conector) + " " + getResources().getString(R.string.notification_destination); inboxStyle.addLine(generateDelayText(leg.departureDelay, false) + " " + getResources().getString(R.string.notification_stop_name_conector) + " " + leg.from.name); inboxStyle.addLine( generateDelayText(leg.arrivalDelay, false) + " " +
} else if (position == 3) { List<String> messages = Arrays.asList(new String[]{"line 1", "line 2", "line 3"}); mBuilder.setStyle(NotifyUtil.makeInbox(messages).setBigContentTitle("big text title").setSummaryText("big text summary"));
NotificationCompat.InboxStyle inbox = new NotificationCompat.InboxStyle(); inbox.setSummaryText(summary); inbox.addLine(cs[i]); inbox.addLine(newLine);
new NotificationCompat.InboxStyle(); String[] events = {"10","11","12","13","14","15","16","17","18","19"}; inboxStyle.setBigContentTitle("6"); mBuilder.setContentTitle("9"); inboxStyle.setSummaryText("5"); inboxStyle.addLine(events[i]);
NotificationCompat.WearableExtender extensaoWear = new NotificationCompat.WearableExtender().setBackground(imgBackground); NotificationCompat.InboxStyle estilo = new NotificationCompat.InboxStyle() .setBigContentTitle(qtdeDeMensagens) .setSummaryText("seuemail@gmail.com"); for (String msgTitulo : sMensagens) { estilo.addLine(msgTitulo);
notification = builder.build(); } else { NotificationCompat.InboxStyle styled = new NotificationCompat.InboxStyle(builder); for (String row : rows) { styled.addLine(row); styled.setSummaryText(summary); notification = styled.build();
.setContentIntent(contentIntent); NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle(); inboxStyle.setBigContentTitle( context.getString(R.string.downloadAsFileArticleDownloadedDetail, event.getArticle().getTitle().replaceAll("[^a-zA-Z0-9.-]", " ")));
InboxStyle style = new NotificationCompat.InboxStyle(); style.addLine(pair.second.getCondition().getMessage(context, pair.first)); style.addLine("."); // dummy line to show dots style.setSummaryText("+ " + (entitiesAndTriggers.size() - maxDisplayedNotifications) + " more");
/** * 列表型通知 * @param ticker * @param title * @param content * @param smallIcon * @param intent * @param conntents * @param sound * @param vibrate * @param lights */ public void sendListNotification(String ticker, String title, String content, int smallIcon, PendingIntent intent, ArrayList<String> conntents, boolean sound, boolean vibrate, boolean lights) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { Toast.makeText(context, "您的手机低于Android 4.1.2,不支持!!", Toast.LENGTH_SHORT).show(); return; } sample(ticker, title, content, smallIcon, intent, sound, vibrate, lights); NotificationCompat.InboxStyle style=new NotificationCompat.InboxStyle(builder); for (String conntent : conntents) { style.addLine(conntent); } style.setSummaryText(conntents.size()+"条消息"); style.setBigContentTitle(title); Notification notification=style.build(); send(notification); }
public static void createBig(Context context, Intent intent, String contentTitle, String contentText,List<String> lines, int id) { PendingIntent p = getPendingIntent(context, intent, id); // Configura o estilo Inbox int size = lines.size(); NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle(); inboxStyle.setBigContentTitle(contentTitle); for (String s: lines) { inboxStyle.addLine(s); } inboxStyle.setSummaryText(contentText); // Cria a notificação NotificationCompat.Builder b = new NotificationCompat.Builder(context,CHANNEL_ID); b.setDefaults(Notification.DEFAULT_ALL); // Ativa configurações padrão b.setSmallIcon(R.drawable.ic_notification_icon); // Ícone b.setContentTitle(contentTitle); // Título b.setContentText(contentText); // Mensagem b.setContentIntent(p); // Intent que será chamada ao clicar na notificação. b.setAutoCancel(true); // Auto cancela a notificação ao clicar nela b.setNumber(size); // Número para aparecer na notificação b.setStyle(inboxStyle); // Estilo customizado NotificationManagerCompat nm = NotificationManagerCompat.from(context); nm.notify(id, b.build()); }
private void showSmallNotification(NotificationCompat.Builder mBuilder, int icon, String title, String message, String timeStamp, PendingIntent resultPendingIntent, Uri alarmSound) { NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle(); inboxStyle.addLine(message); Notification notification; notification = mBuilder.setSmallIcon(icon).setTicker(title).setWhen(0) .setAutoCancel(true) .setContentTitle(title) .setContentIntent(resultPendingIntent) .setSound(alarmSound) .setStyle(inboxStyle) .setWhen(getTimeMilliSec(timeStamp)) .setSmallIcon(R.mipmap.ic_launcher) .setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), icon)) .setContentText(message) .build(); NotificationManager notificationManager = (NotificationManager) mContext.getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.notify(Constants.NOTIFICATION_ID, notification); }
private void showSmallNotification(NotificationCompat.Builder mBuilder, int icon, String title, String message, String timeStamp, PendingIntent resultPendingIntent, Uri alarmSound) { NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle(); inboxStyle.addLine(message); uniqueInteger = (int) ((new Date().getTime() / 1000L) % Integer.MAX_VALUE); Notification notification; notification = mBuilder.setSmallIcon(icon).setTicker(title).setWhen(0) .setAutoCancel(true) .setContentTitle(title) .setContentIntent(resultPendingIntent) .setSound(alarmSound) .setStyle(inboxStyle) .setWhen(getTimeMilliSec(timeStamp)) .setSmallIcon(R.mipmap.ic_launcher) .setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), icon)) .setContentText(message) .build(); NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(uniqueInteger, notification); }
public static void criarNotificationBig(Context ctx, int idNotificacao) { int numero = 5; NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle(); inboxStyle.setBigContentTitle("Mensagens não lidas:"); for (int i = 1; i <= numero; i++) { inboxStyle.addLine("Mensagem " + i); } inboxStyle.setSummaryText("Clique para exibir"); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(ctx) .setSmallIcon(R.drawable.ic_notificacao) .setColor(Color.RED) .setContentTitle("Notificação") .setContentText("Vários itens pendentes") .setContentIntent(criarPendingIntent(ctx, "Mensagens não lidas", -1)) .setNumber(numero) .setStyle(inboxStyle); NotificationManagerCompat nm = NotificationManagerCompat.from(ctx); nm.notify(idNotificacao, mBuilder.build()); }
@Nullable private NotificationCompat.InboxStyle buildInboxStyle(@Nullable List<String> titleList, float process) { if (titleList != null) { NotificationCompat.InboxStyle inbox = new NotificationCompat.InboxStyle(); inbox.setBigContentTitle(context.getString(R.string.feedback_downloading)); inbox.setSummaryText(((int) process) + "%"); for (int i = 0; i < titleList.size(); i ++) { if (i < 7) { inbox.addLine(titleList.get(i)); } else { inbox.addLine("..."); break; } } return inbox; } else { return null; } } }