當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。