微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.support.v4.app.NotificationCompat.InboxStyle的实例源码

项目:intellij-ce-playground    文件NotificationGenerator.java   
private static void generateStyle(NotificationCompat.Builder builder) {
    Integer styleValue = STYLE.getValueInt();

    if (STYLE_BIG_PICTURE.equals(styleValue)) {
        BigPictureStyle bigPicture = new NotificationCompat.BigPictureStyle();
        if (PICTURE.hasValue())
            bigPicture.bigPicture(PICTURE.getValueBitmap());
        if (BIG_CONTENT_TITLE.hasValue())
            bigPicture.setBigContentTitle(BIG_CONTENT_TITLE.getValueString());
        if (SUMMARY_TEXT.hasValue())
            bigPicture.setSummaryText(SUMMARY_TEXT.getValueString());
        builder.setStyle(bigPicture);
    } else if (STYLE_BIG_TEXT.equals(styleValue)) {
        BigTextStyle bigText = new NotificationCompat.BigTextStyle();
        if (BIG_TEXT.hasValue())
            bigText.bigText(BIG_TEXT.getValueString());
        if (BIG_CONTENT_TITLE.hasValue())
            bigText.setBigContentTitle(BIG_CONTENT_TITLE.getValueString());
        if (SUMMARY_TEXT.hasValue())
            bigText.setSummaryText(SUMMARY_TEXT.getValueString());
        builder.setStyle(bigText);
    } else if (STYLE_INBox.equals(styleValue)) {
        InBoxStyle inBoxStyle = new NotificationCompat.InBoxStyle();
        if (LInes.hasValue()) {
            for (String line : LInes.getValueString().split("\\n")) {
                inBoxStyle.addLine(line);
            }
        }
        if (BIG_CONTENT_TITLE.hasValue())
            inBoxStyle.setBigContentTitle(BIG_CONTENT_TITLE.getValueString());
        if (SUMMARY_TEXT.hasValue())
            inBoxStyle.setSummaryText(SUMMARY_TEXT.getValueString());
        builder.setStyle(inBoxStyle);
    }
}
项目:BioStar2Android    文件GcmbroadcastReceiver.java   
private void Notification(PushNotification noti,Context context) {
        NotificationDBProvider dbProvider = NotificationDBProvider.getInstance(context);
        PendingIntent pendingIntent = getPendingIntent(context,DummyActivity.class);

        ArrayList<String> messages = dbProvider.getUnReadMessageTitle6();
        int count = dbProvider.getUnReadMessageCount();
        Builder builder = new NotificationCompat.Builder(context);
        if (count > 1) {
            if (count > 9999) {
                builder.setContentTitle("9999+" + context.getString(R.string.new_notification));
            } else {
                builder.setContentTitle(String.valueOf(count) + context.getString(R.string.new_notification));
            }
            InBoxStyle style = new InBoxStyle(builder);
            if (count > messages.size()) {
                count = messages.size();
            }
            for (int i = 0; i < count; i++) {
                style.addLine(messages.get(i));
            }
//          style.setSummaryText("+ more");
            builder.setStyle(style);
        } else {
            builder.setContentTitle(noti.title);
            builder.setContentText(noti.message);
        }
        commonBuilder(builder,pendingIntent,noti.message);
        notificationmanager notifyManager = (notificationmanager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        notifyManager.notify(0,builder.build());

        Intent intentBoradCast = new Intent(Setting.broADCAST_ALARM_UPDATE);
        LocalbroadcastManager.getInstance(context).sendbroadcast(intentBoradCast);
    }
项目:nevolution    文件StackDecorator.java   
private RemoteViews buildBigContentView(final String pkg,final CharSequence title,final List<CharSequence> lines) {
//      final Bitmap large_icon = evolved_extras.getParcelable(NotificationCompat.EXTRA_LARGE_ICON);
        Context context; try { context = createPackageContext(pkg,0); }    // This ensure the correct display of the small icon
        catch (final PackageManager.NameNotFoundException e) { context = this; }
        final Builder builder = new Builder(context)/*.setSmallIcon(evolved_n.icon).setLargeIcon(large_icon)*/;
        final InBoxStyle inBox = new NotificationCompat.InBoxStyle(builder).setBigContentTitle(title);
        for (final CharSequence line : lines) inBox.addLine(line);

        return inBox.build().bigContentView;
    }
项目:Klyph    文件KlyphNotification.java   
public static void setInBoxStyle(Builder builder,String title,List<String> lines)
{
    builder.setNumber(lines.size());
    InBoxStyle inBoxStyle = new InBoxStyle();

    inBoxStyle.setBigContentTitle(title);

    for (String line : lines)
    {
        inBoxStyle.addLine(line);
    }

    builder.setStyle(inBoxStyle);
}
项目:KlyphMessenger    文件KlyphMessengerNotification.java   
public static void setInBoxStyle(Builder builder,List<String> lines)
{
    builder.setNumber(lines.size());
    InBoxStyle inBoxStyle = new InBoxStyle();

    inBoxStyle.setBigContentTitle(title);

    for (String line : lines)
    {
        inBoxStyle.addLine(line);
    }

    builder.setStyle(inBoxStyle);
}
项目:moVirt    文件NotificationHelper.java   
public <E extends BaseEntity<?>> void showTriggersNotification(
        MovirtAccount account,List<Pair<E,Trigger>> entitiesAndTriggers,Context context,PendingIntent resultPendingIntent
) {
    Log.d(TAG,"displaying notification " + notificationCount);
    if (entitiesAndTriggers.size() == 1) { // one entity displays in full format
        Pair<E,Trigger> entityAndTrigger = entitiesAndTriggers.get(0);
        showTriggerNotification(account,entityAndTrigger.second,entityAndTrigger.first,context,resultPendingIntent);
        return;
    }

    boolean critical = false;
    InBoxStyle style = new NotificationCompat.InBoxStyle();

    for (int i = 0; i < entitiesAndTriggers.size(); i++) {
        Pair<E,Trigger> pair = entitiesAndTriggers.get(i);

        if (!critical && pair.second.getNotificationType() == Trigger.NotificationType.CRITICAL) {
            critical = true;
        }

        if (i < maxdisplayednotifications) {
            style.addLine(pair.second.getCondition().getMessage(context,pair.first));
        }
    }

    if (entitiesAndTriggers.size() > maxdisplayednotifications) {
        style.addLine("."); // dummy line to show dots
        style.setSummaryText("+ " + (entitiesAndTriggers.size() - maxdisplayednotifications) + " more");
    }

    Notification notification = prepareNotification(context,resultPendingIntent,System.currentTimeMillis(),getEventTitle(account,critical))
            .setStyle(style)
            .build();
    notificationmanager.notify(notificationCount++,notification);
    if (critical) {
        vibrator.vibrate(vibrationDuration);
    }
}
项目:Onosendai    文件Notifications.java   
private static Style makePreview (final List<Tweet> tweets,final int count) {
    if (tweets == null || tweets.size() < 1) return null;

    if (tweets.size() == 1) return new NotificationCompat.BigTextStyle()
            .bigText(tweetToSpanable(tweets.iterator().next()));

    final InBoxStyle inBoxStyle = new NotificationCompat.InBoxStyle();
    for (final Tweet tweet : tweets) {
        inBoxStyle.addLine(tweetToSpanable(tweet));
    }
    if (tweets.size() < count) {
        inBoxStyle.setSummaryText(String.format("+%s more",count - tweets.size()));
    }
    return inBoxStyle;
}
项目:q-mail    文件DeviceNotifications.java   
protected InBoxStyle createInBoxStyle(Builder builder) {
    return new InBoxStyle(builder);
}
项目:q-mail    文件DeviceNotificationsTest.java   
@Override
protected InBoxStyle createInBoxStyle(Builder builder) {
    return inBoxStyle;
}
项目:K9-MailClient    文件DeviceNotifications.java   
protected InBoxStyle createInBoxStyle(Builder builder) {
    return new InBoxStyle(builder);
}
项目:K9-MailClient    文件DeviceNotificationsTest.java   
@Override
protected InBoxStyle createInBoxStyle(Builder builder) {
    return inBoxStyle;
}
项目:TextSecure    文件MessageNotifier.java   
private static void sendMultipleThreadNotification(Context context,MasterSecret masterSecret,NotificationState notificationState,boolean signal)
{
  List<NotificationItem> notifications = notificationState.getNotifications();
  NotificationCompat.Builder builder   = new NotificationCompat.Builder(context);

  builder.setSmallIcon(R.drawable.icon_notification);
  builder.setLargeIcon(BitmapFactory.decodeResource(context.getResources(),R.drawable.icon_notification));
  builder.setContentTitle(String.format(context.getString(R.string.MessageNotifier_d_new_messages),notificationState.getMessageCount()));
  builder.setContentText(String.format(context.getString(R.string.MessageNotifier_most_recent_from_s),notifications.get(0).getIndividualRecipientName()));
  builder.setContentIntent(PendingIntent.getActivity(context,new Intent(context,RoutingActivity.class),0));

  builder.setContentInfo(String.valueOf(notificationState.getMessageCount()));
  builder.setNumber(notificationState.getMessageCount());

  builder.setDeleteIntent(PendingIntent.getbroadcast(context,new Intent(DeleteReceiver.DELETE_REMINDER_ACTION),0));

  if (masterSecret != null) {
    builder.addAction(R.drawable.check,context.getString(R.string.MessageNotifier_mark_all_as_read),notificationState.getMarkAsReadIntent(context,masterSecret));
  }

  InBoxStyle style = new InBoxStyle();

  ListIterator<NotificationItem> iterator = notifications.listIterator(notifications.size());
  while(iterator.hasPrevIoUs()) {
    NotificationItem item = iterator.prevIoUs();
    style.addLine(item.getTickerText());
  }

  builder.setStyle(style);

  setNotificationAlarms(context,builder,signal);

  if (signal) {
    builder.setTicker(notifications.get(0).getTickerText());
  }

  ((notificationmanager)context.getSystemService(Context.NOTIFICATION_SERVICE))
    .notify(NOTIFICATION_ID,builder.build());
}
项目:TextSecureSMP    文件MessageNotifier.java   
private static void sendMultipleThreadNotification(Context context,boolean signal)
{
  List<NotificationItem> notifications = notificationState.getNotifications();
  NotificationCompat.Builder builder   = new NotificationCompat.Builder(context);

  builder.setColor(context.getResources().getColor(R.color.textsecure_primary));
  builder.setSmallIcon(R.drawable.icon_notification);
  builder.setContentTitle(context.getString(R.string.app_name));
  builder.setSubText(context.getString(R.string.MessageNotifier_d_messages_in_d_conversations,notificationState.getMessageCount(),notificationState.getThreadCount()));
  builder.setContentText(context.getString(R.string.MessageNotifier_most_recent_from_s,ConversationListActivity.class),0));

  builder.setContentInfo(String.valueOf(notificationState.getMessageCount()));
  builder.setNumber(notificationState.getMessageCount());
  builder.setCategory(NotificationCompat.CATEGORY_MESSAGE);

  long timestamp = notifications.get(0).getTimestamp();
  if (timestamp != 0) builder.setWhen(timestamp);

  builder.setDeleteIntent(PendingIntent.getbroadcast(context,0));

  if (masterSecret != null) {
     Action markAllAsReadAction = new Action(R.drawable.check,masterSecret));
     builder.addAction(markAllAsReadAction);
     builder.extend(new NotificationCompat.WearableExtender().addAction(markAllAsReadAction));
  }

  InBoxStyle style = new InBoxStyle();

  ListIterator<NotificationItem> iterator = notifications.listIterator(notifications.size());
  while(iterator.hasPrevIoUs()) {
    NotificationItem item = iterator.prevIoUs();
    style.addLine(item.getTickerText());
    if (item.getIndividualRecipient().getContactUri() != null) {
      builder.addPerson(item.getIndividualRecipient().getContactUri().toString());
    }
  }

  builder.setStyle(style);

  setNotificationAlarms(context,signal,notificationState.getringtone(),notificationState.getVibrate());

  if (signal) {
    builder.setTicker(notifications.get(0).getTickerText());
  }

  ((notificationmanager)context.getSystemService(Context.NOTIFICATION_SERVICE))
    .notify(NOTIFICATION_ID,builder.build());
}
项目:Securecom-Messaging    文件MessageNotifier.java   
private static void sendMultipleThreadNotification(Context context,0));

  builder.setContentInfo(String.valueOf(notificationState.getMessageCount()));
  builder.setNumber(notificationState.getMessageCount());

  if (masterSecret != null) {
    builder.addAction(R.drawable.check,masterSecret));
  }

  InBoxStyle style = new InBoxStyle();

  for (NotificationItem item : notifications) {
    style.addLine(item.getTickerText());
  }

  builder.setStyle(style);

  setNotificationAlarms(context,builder.build());
}
项目:Securecom-Text    文件MessageNotifier.java   
private static void sendMultipleThreadNotification(Context context,builder.build());
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。