当前位置: 首页>>代码示例>>Java>>正文


Java TextSecurePreferences.getNotificationPrivacy方法代码示例

本文整理汇总了Java中org.thoughtcrime.securesms.util.TextSecurePreferences.getNotificationPrivacy方法的典型用法代码示例。如果您正苦于以下问题:Java TextSecurePreferences.getNotificationPrivacy方法的具体用法?Java TextSecurePreferences.getNotificationPrivacy怎么用?Java TextSecurePreferences.getNotificationPrivacy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.thoughtcrime.securesms.util.TextSecurePreferences的用法示例。


在下文中一共展示了TextSecurePreferences.getNotificationPrivacy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: notifyMessageDeliveryFailed

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入方法依赖的package包/类
public static void notifyMessageDeliveryFailed(Context context, Recipients recipients, long threadId) {
  if (visibleThread == threadId) {
    sendInThreadNotification(context, recipients);
  } else {
    Intent intent = new Intent(context, ConversationActivity.class);
    intent.putExtra(ConversationActivity.RECIPIENTS_EXTRA, recipients.getIds());
    intent.putExtra(ConversationActivity.THREAD_ID_EXTRA, threadId);
    intent.setData((Uri.parse("custom://" + System.currentTimeMillis())));

    FailedNotificationBuilder builder = new FailedNotificationBuilder(context, TextSecurePreferences.getNotificationPrivacy(context), intent);
    ((NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE))
      .notify((int)threadId, builder.build());
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:15,代码来源:MessageNotifier.java

示例2: sendMultipleThreadNotification

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入方法依赖的package包/类
private static void sendMultipleThreadNotification(@NonNull  Context context,
                                                   @NonNull  NotificationState notificationState,
                                                   boolean signal)
{
  MultipleRecipientNotificationBuilder builder       = new MultipleRecipientNotificationBuilder(context, TextSecurePreferences.getNotificationPrivacy(context));
  List<NotificationItem>               notifications = notificationState.getNotifications();

  builder.setMessageCount(notificationState.getMessageCount(), notificationState.getThreadCount());
  builder.setMostRecentSender(notifications.get(0).getIndividualRecipient());
  builder.setGroup(NOTIFICATION_GROUP);

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

  builder.addActions(notificationState.getMarkAsReadIntent(context, SUMMARY_NOTIFICATION_ID));

  ListIterator<NotificationItem> iterator = notifications.listIterator(notifications.size());

  while(iterator.hasPrevious()) {
    NotificationItem item = iterator.previous();
    builder.addMessageBody(item.getIndividualRecipient(), item.getText());
  }

  if (signal) {
    builder.setAlarms(notificationState.getRingtone(), notificationState.getVibrate());
    builder.setTicker(notifications.get(0).getIndividualRecipient(),
                      notifications.get(0).getText());
  }

  NotificationManagerCompat.from(context).notify(SUMMARY_NOTIFICATION_ID, builder.build());
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:32,代码来源:MessageNotifier.java

示例3: notifyMessagesPending

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入方法依赖的package包/类
public static void notifyMessagesPending(Context context) {
  if (!TextSecurePreferences.isNotificationsEnabled(context)) {
    return;
  }

  PendingMessageNotificationBuilder builder = new PendingMessageNotificationBuilder(context, TextSecurePreferences.getNotificationPrivacy(context));
  ServiceUtil.getNotificationManager(context).notify(PENDING_MESSAGES_ID, builder.build());
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:9,代码来源:MessageNotifier.java

示例4: sendMultipleThreadNotification

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入方法依赖的package包/类
private static void sendMultipleThreadNotification(@NonNull  Context context,
                                                   @NonNull  NotificationState notificationState,
                                                   boolean signal)
{
  MultipleRecipientNotificationBuilder builder       = new MultipleRecipientNotificationBuilder(context, TextSecurePreferences.getNotificationPrivacy(context));
  List<NotificationItem>               notifications = notificationState.getNotifications();

  builder.setMessageCount(notificationState.getMessageCount(), notificationState.getThreadCount());
  builder.setMostRecentSender(notifications.get(0).getIndividualRecipient());
  builder.setGroup(NOTIFICATION_GROUP);
  builder.setDeleteIntent(notificationState.getDeleteIntent(context));

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

  builder.addActions(notificationState.getMarkAsReadIntent(context, SUMMARY_NOTIFICATION_ID));

  ListIterator<NotificationItem> iterator = notifications.listIterator(notifications.size());

  while(iterator.hasPrevious()) {
    NotificationItem item = iterator.previous();
    builder.addMessageBody(item.getIndividualRecipient(), item.getText());
  }

  if (signal) {
    builder.setAlarms(notificationState.getRingtone(), notificationState.getVibrate());
    builder.setTicker(notifications.get(0).getIndividualRecipient(),
                      notifications.get(0).getText());
  }

  NotificationManagerCompat.from(context).notify(SUMMARY_NOTIFICATION_ID, builder.build());
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:33,代码来源:MessageNotifier.java

示例5: sendSingleThreadNotification

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入方法依赖的package包/类
private static void sendSingleThreadNotification(@NonNull  Context context,
                                                 @Nullable MasterSecret masterSecret,
                                                 @NonNull  NotificationState notificationState,
                                                 boolean signal, boolean bundled)
{
  if (notificationState.getNotifications().isEmpty()) {
    if (!bundled) cancelActiveNotifications(context);
    return;
  }

  SingleRecipientNotificationBuilder builder        = new SingleRecipientNotificationBuilder(context, masterSecret, TextSecurePreferences.getNotificationPrivacy(context));
  List<NotificationItem>             notifications  = notificationState.getNotifications();
  Recipients                         recipients     = notifications.get(0).getRecipients();
  int                                notificationId = (int) (SUMMARY_NOTIFICATION_ID + (bundled ? notifications.get(0).getThreadId() : 0));


  builder.setThread(notifications.get(0).getRecipients());
  builder.setMessageCount(notificationState.getMessageCount());
  builder.setPrimaryMessageBody(recipients, notifications.get(0).getIndividualRecipient(),
                                notifications.get(0).getText(), notifications.get(0).getSlideDeck());
  builder.setContentIntent(notifications.get(0).getPendingIntent(context));
  builder.setGroup(NOTIFICATION_GROUP);

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

  builder.addActions(masterSecret,
                     notificationState.getMarkAsReadIntent(context, notificationId),
                     notificationState.getQuickReplyIntent(context, notifications.get(0).getRecipients()),
                     notificationState.getRemoteReplyIntent(context, notifications.get(0).getRecipients()));

  builder.addAndroidAutoAction(notificationState.getAndroidAutoReplyIntent(context, notifications.get(0).getRecipients()),
                               notificationState.getAndroidAutoHeardIntent(context, notificationId), notifications.get(0).getTimestamp());

  ListIterator<NotificationItem> iterator = notifications.listIterator(notifications.size());

  while(iterator.hasPrevious()) {
    NotificationItem item = iterator.previous();
    builder.addMessageBody(item.getRecipients(), item.getIndividualRecipient(), item.getText());
  }

  if (signal) {
    builder.setAlarms(notificationState.getRingtone(), notificationState.getVibrate());
    builder.setTicker(notifications.get(0).getIndividualRecipient(),
                      notifications.get(0).getText());
  }

  if (!bundled) {
    builder.setGroupSummary(true);
  }

  NotificationManagerCompat.from(context).notify(notificationId, builder.build());
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:54,代码来源:MessageNotifier.java

示例6: sendSingleThreadNotification

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入方法依赖的package包/类
private static void sendSingleThreadNotification(@NonNull  Context context,
                                                 @Nullable MasterSecret masterSecret,
                                                 @NonNull  NotificationState notificationState,
                                                 boolean signal, boolean bundled)
{
  if (notificationState.getNotifications().isEmpty()) {
    if (!bundled) cancelActiveNotifications(context);
    return;
  }

  SingleRecipientNotificationBuilder builder        = new SingleRecipientNotificationBuilder(context, masterSecret, TextSecurePreferences.getNotificationPrivacy(context));
  List<NotificationItem>             notifications  = notificationState.getNotifications();
  Recipients                         recipients     = notifications.get(0).getRecipients();
  int                                notificationId = (int) (SUMMARY_NOTIFICATION_ID + (bundled ? notifications.get(0).getThreadId() : 0));


  builder.setThread(notifications.get(0).getRecipients());
  builder.setMessageCount(notificationState.getMessageCount());
  builder.setPrimaryMessageBody(recipients, notifications.get(0).getIndividualRecipient(),
                                notifications.get(0).getText(), notifications.get(0).getSlideDeck());
  builder.setContentIntent(notifications.get(0).getPendingIntent(context));
  builder.setGroup(NOTIFICATION_GROUP);
  builder.setDeleteIntent(notificationState.getDeleteIntent(context));

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

  builder.addActions(masterSecret,
                     notificationState.getMarkAsReadIntent(context, notificationId),
                     notificationState.getQuickReplyIntent(context, notifications.get(0).getRecipients()),
                     notificationState.getRemoteReplyIntent(context, notifications.get(0).getRecipients()));

  builder.addAndroidAutoAction(notificationState.getAndroidAutoReplyIntent(context, notifications.get(0).getRecipients()),
                               notificationState.getAndroidAutoHeardIntent(context, notificationId), notifications.get(0).getTimestamp());

  ListIterator<NotificationItem> iterator = notifications.listIterator(notifications.size());

  while(iterator.hasPrevious()) {
    NotificationItem item = iterator.previous();
    builder.addMessageBody(item.getRecipients(), item.getIndividualRecipient(), item.getText());
  }

  if (signal) {
    builder.setAlarms(notificationState.getRingtone(), notificationState.getVibrate());
    builder.setTicker(notifications.get(0).getIndividualRecipient(),
                      notifications.get(0).getText());
  }

  if (!bundled) {
    builder.setGroupSummary(true);
  }

  NotificationManagerCompat.from(context).notify(notificationId, builder.build());
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:55,代码来源:MessageNotifier.java


注:本文中的org.thoughtcrime.securesms.util.TextSecurePreferences.getNotificationPrivacy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。