當前位置: 首頁>>代碼示例>>Java>>正文


Java MessageNotifier類代碼示例

本文整理匯總了Java中org.thoughtcrime.securesms.notifications.MessageNotifier的典型用法代碼示例。如果您正苦於以下問題:Java MessageNotifier類的具體用法?Java MessageNotifier怎麽用?Java MessageNotifier使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MessageNotifier類屬於org.thoughtcrime.securesms.notifications包,在下文中一共展示了MessageNotifier類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleSentResult

import org.thoughtcrime.securesms.notifications.MessageNotifier; //導入依賴的package包/類
private void handleSentResult(MasterSecret masterSecret, long messageId, int result) {
  try {
    EncryptingSmsDatabase database = DatabaseFactory.getEncryptingSmsDatabase(context);
    SmsMessageRecord      record   = database.getMessage(masterSecret, messageId);

    switch (result) {
      case Activity.RESULT_OK:
        database.markAsSent(messageId, false);
        break;
      case SmsManager.RESULT_ERROR_NO_SERVICE:
      case SmsManager.RESULT_ERROR_RADIO_OFF:
        Log.w(TAG, "Service connectivity problem, requeuing...");
        ApplicationContext.getInstance(context)
            .getJobManager()
            .add(new SmsSendJob(context, messageId, record.getIndividualRecipient().getNumber()));
        break;
      default:
        database.markAsSentFailed(messageId);
        MessageNotifier.notifyMessageDeliveryFailed(context, record.getRecipients(), record.getThreadId());
    }
  } catch (NoSuchMessageException e) {
    Log.w(TAG, e);
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:25,代碼來源:SmsSentJob.java

示例2: setMasterSecret

import org.thoughtcrime.securesms.notifications.MessageNotifier; //導入依賴的package包/類
public void setMasterSecret(final MasterSecret masterSecret) {
  synchronized (KeyCachingService.class) {
    KeyCachingService.masterSecret = masterSecret;

    foregroundService();
    broadcastNewSecret();
    startTimeoutIfAppropriate();

    if (!TextSecurePreferences.isPasswordDisabled(this)) {
      ApplicationContext.getInstance(this).getJobManager().add(new MasterSecretDecryptJob(this));
    }

    new AsyncTask<Void, Void, Void>() {
      @Override
      protected Void doInBackground(Void... params) {
        if (!DatabaseUpgradeActivity.isUpdate(KeyCachingService.this)) {
          MessageNotifier.updateNotification(KeyCachingService.this, masterSecret);
        }
        return null;
      }
    }.execute();
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:24,代碼來源:KeyCachingService.java

示例3: handleClearKey

import org.thoughtcrime.securesms.notifications.MessageNotifier; //導入依賴的package包/類
private void handleClearKey() {
  Log.w("KeyCachingService", "handleClearKey()");
  KeyCachingService.masterSecret = null;
  stopForeground(true);

  Intent intent = new Intent(CLEAR_KEY_EVENT);
  intent.setPackage(getApplicationContext().getPackageName());

  sendBroadcast(intent, KEY_PERMISSION);

  new AsyncTask<Void, Void, Void>() {
    @Override
    protected Void doInBackground(Void... params) {
      MessageNotifier.updateNotification(KeyCachingService.this, null);
      return null;
    }
  }.execute();
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:19,代碼來源:KeyCachingService.java

示例4: notifyNewUsers

import org.thoughtcrime.securesms.notifications.MessageNotifier; //導入依賴的package包/類
private static void notifyNewUsers(@NonNull  Context context,
                                   @Nullable MasterSecret masterSecret,
                                   @NonNull  List<String> newUsers)
{
  if (!TextSecurePreferences.isNewContactsNotificationEnabled(context)) return;

  for (String newUser : newUsers) {
    if (!SessionUtil.hasSession(context, masterSecret, newUser) && !Util.isOwnNumber(context, newUser)) {
      IncomingJoinedMessage  message      = new IncomingJoinedMessage(newUser);
      Optional<InsertResult> insertResult = DatabaseFactory.getSmsDatabase(context).insertMessageInbox(message);

      if (insertResult.isPresent()) {
        int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
        if (hour >= 9 && hour < 23) {
          MessageNotifier.updateNotification(context, masterSecret, false, insertResult.get().getThreadId(), true);
        } else {
          MessageNotifier.updateNotification(context, masterSecret, false, insertResult.get().getThreadId(), false);
        }
      }
    }
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:23,代碼來源:DirectoryHelper.java

示例5: onResume

import org.thoughtcrime.securesms.notifications.MessageNotifier; //導入依賴的package包/類
@Override
protected void onResume() {
  super.onResume();
  dynamicTheme.onResume(this);
  dynamicLanguage.onResume(this);
  quickAttachmentDrawer.onResume();

  initializeEnabledCheck();
  initializeMmsEnabledCheck();
  composeText.setTransport(sendButton.getSelectedTransport());

  titleView.setTitle(recipients);
  setActionBarColor(recipients.getColor());
  setBlockedUserState(recipients, isSecureText, isDefaultSms);
  calculateCharactersRemaining();

  MessageNotifier.setVisibleThread(threadId);
  markThreadAsRead();

  Log.w(TAG, "onResume() Finished: " + (System.currentTimeMillis() - getIntent().getLongExtra(TIMING_EXTRA, 0)));
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:22,代碼來源:ConversationActivity.java

示例6: sendComplete

import org.thoughtcrime.securesms.notifications.MessageNotifier; //導入依賴的package包/類
protected void sendComplete(long threadId) {
  boolean refreshFragment = (threadId != this.threadId);
  this.threadId = threadId;

  if (fragment == null || !fragment.isVisible() || isFinishing()) {
    return;
  }

  fragment.setLastSeen(0);

  if (refreshFragment) {
    fragment.reload(recipients, threadId);
    MessageNotifier.setVisibleThread(threadId);
  }

  fragment.scrollToBottom();
  attachmentManager.cleanup();
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:19,代碼來源:ConversationActivity.java

示例7: onRun

import org.thoughtcrime.securesms.notifications.MessageNotifier; //導入依賴的package包/類
@Override
public void onRun() throws NoSuchMessageException {

  if (!IdentityKeyUtil.hasIdentityKey(context)) {
    Log.w(TAG, "Skipping job, waiting for migration...");
    MessageNotifier.updateNotification(context, null, true, -2);
    return;
  }

  MasterSecret          masterSecret         = KeyCachingService.getMasterSecret(context);
  PushDatabase          database             = DatabaseFactory.getPushDatabase(context);
  SignalServiceEnvelope envelope             = database.get(messageId);
  Optional<Long>        optionalSmsMessageId = smsMessageId > 0 ? Optional.of(smsMessageId) :
                                                               Optional.<Long>absent();

  MasterSecretUnion masterSecretUnion;

  if (masterSecret == null) masterSecretUnion = new MasterSecretUnion(MasterSecretUtil.getAsymmetricMasterSecret(context, null));
  else                      masterSecretUnion = new MasterSecretUnion(masterSecret);

  handleMessage(masterSecretUnion, envelope, optionalSmsMessageId);
  database.delete(messageId);
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:24,代碼來源:PushDecryptJob.java

示例8: handleInvalidVersionMessage

import org.thoughtcrime.securesms.notifications.MessageNotifier; //導入依賴的package包/類
private void handleInvalidVersionMessage(@NonNull MasterSecretUnion masterSecret,
                                         @NonNull SignalServiceEnvelope envelope,
                                         @NonNull Optional<Long> smsMessageId)
{
  EncryptingSmsDatabase smsDatabase = DatabaseFactory.getEncryptingSmsDatabase(context);

  if (!smsMessageId.isPresent()) {
    Optional<InsertResult> insertResult = insertPlaceholder(envelope);

    if (insertResult.isPresent()) {
      smsDatabase.markAsInvalidVersionKeyExchange(insertResult.get().getMessageId());
      MessageNotifier.updateNotification(context, masterSecret.getMasterSecret().orNull(), insertResult.get().getThreadId());
    }
  } else {
    smsDatabase.markAsInvalidVersionKeyExchange(smsMessageId.get());
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:18,代碼來源:PushDecryptJob.java

示例9: handleCorruptMessage

import org.thoughtcrime.securesms.notifications.MessageNotifier; //導入依賴的package包/類
private void handleCorruptMessage(@NonNull MasterSecretUnion masterSecret,
                                  @NonNull SignalServiceEnvelope envelope,
                                  @NonNull Optional<Long> smsMessageId)
{
  EncryptingSmsDatabase smsDatabase = DatabaseFactory.getEncryptingSmsDatabase(context);

  if (!smsMessageId.isPresent()) {
    Optional<InsertResult> insertResult = insertPlaceholder(envelope);

    if (insertResult.isPresent()) {
      smsDatabase.markAsDecryptFailed(insertResult.get().getMessageId());
      MessageNotifier.updateNotification(context, masterSecret.getMasterSecret().orNull(), insertResult.get().getThreadId());
    }
  } else {
    smsDatabase.markAsDecryptFailed(smsMessageId.get());
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:18,代碼來源:PushDecryptJob.java

示例10: handleNoSessionMessage

import org.thoughtcrime.securesms.notifications.MessageNotifier; //導入依賴的package包/類
private void handleNoSessionMessage(@NonNull MasterSecretUnion masterSecret,
                                    @NonNull SignalServiceEnvelope envelope,
                                    @NonNull Optional<Long> smsMessageId)
{
  EncryptingSmsDatabase smsDatabase = DatabaseFactory.getEncryptingSmsDatabase(context);

  if (!smsMessageId.isPresent()) {
    Optional<InsertResult> insertResult = insertPlaceholder(envelope);

    if (insertResult.isPresent()) {
      smsDatabase.markAsNoSession(insertResult.get().getMessageId());
      MessageNotifier.updateNotification(context, masterSecret.getMasterSecret().orNull(), insertResult.get().getThreadId());
    }
  } else {
    smsDatabase.markAsNoSession(smsMessageId.get());
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:18,代碼來源:PushDecryptJob.java

示例11: handleLegacyMessage

import org.thoughtcrime.securesms.notifications.MessageNotifier; //導入依賴的package包/類
private void handleLegacyMessage(@NonNull MasterSecretUnion masterSecret,
                                 @NonNull SignalServiceEnvelope envelope,
                                 @NonNull Optional<Long> smsMessageId)
{
  EncryptingSmsDatabase smsDatabase = DatabaseFactory.getEncryptingSmsDatabase(context);

  if (!smsMessageId.isPresent()) {
    Optional<InsertResult> insertResult = insertPlaceholder(envelope);

    if (insertResult.isPresent()) {
      smsDatabase.markAsLegacyVersion(insertResult.get().getMessageId());
      MessageNotifier.updateNotification(context, masterSecret.getMasterSecret().orNull(), insertResult.get().getThreadId());
    }
  } else {
    smsDatabase.markAsLegacyVersion(smsMessageId.get());
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:18,代碼來源:PushDecryptJob.java

示例12: onRun

import org.thoughtcrime.securesms.notifications.MessageNotifier; //導入依賴的package包/類
@Override
public void onRun(MasterSecret masterSecret) throws IOException {
  final AttachmentId attachmentId = new AttachmentId(partRowId, partUniqueId);
  final Attachment   attachment   = DatabaseFactory.getAttachmentDatabase(context).getAttachment(attachmentId);

  if (attachment == null) {
    Log.w(TAG, "attachment no longer exists.");
    return;
  }

  if (!attachment.isInProgress()) {
    Log.w(TAG, "Attachment was already downloaded.");
    return;
  }

  Log.w(TAG, "Downloading push part " + attachmentId);

  retrieveAttachment(masterSecret, messageId, attachmentId, attachment);
  MessageNotifier.updateNotification(context, masterSecret);
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:21,代碼來源:AttachmentDownloadJob.java

示例13: notifyNewUsers

import org.thoughtcrime.securesms.notifications.MessageNotifier; //導入依賴的package包/類
private static void notifyNewUsers(@NonNull  Context context,
                                   @Nullable MasterSecret masterSecret,
                                   @NonNull  List<String> newUsers)
{
  if (!TextSecurePreferences.isNewContactsNotificationEnabled(context)) return;

  for (String newUser : newUsers) {
    if (!SessionUtil.hasSession(context, masterSecret, newUser) && !Util.isOwnNumber(context, newUser)) {
      IncomingJoinedMessage  message      = new IncomingJoinedMessage(newUser);
      Optional<InsertResult> insertResult = DatabaseFactory.getSmsDatabase(context).insertMessageInbox(message);

      if (insertResult.isPresent()) {
        int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
        if (hour >= 9 && hour < 23) {
          MessageNotifier.updateNotification(context, masterSecret, insertResult.get().getThreadId(), true);
        } else {
          MessageNotifier.updateNotification(context, masterSecret, insertResult.get().getThreadId(), false);
        }
      }
    }
  }
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:23,代碼來源:DirectoryHelper.java

示例14: onResume

import org.thoughtcrime.securesms.notifications.MessageNotifier; //導入依賴的package包/類
@Override
protected void onResume() {
  super.onResume();
  dynamicTheme.onResume(this);
  dynamicLanguage.onResume(this);
  quickAttachmentDrawer.onResume();

  initializeEnabledCheck();
  initializeMmsEnabledCheck();
  initializeIdentityRecords();
  composeText.setTransport(sendButton.getSelectedTransport());

  titleView.setTitle(recipients);
  setActionBarColor(recipients.getColor());
  setBlockedUserState(recipients, isSecureText, isDefaultSms);
  calculateCharactersRemaining();

  MessageNotifier.setVisibleThread(threadId);
  markThreadAsRead();

  Log.w(TAG, "onResume() Finished: " + (System.currentTimeMillis() - getIntent().getLongExtra(TIMING_EXTRA, 0)));
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:23,代碼來源:ConversationActivity.java

示例15: onRun

import org.thoughtcrime.securesms.notifications.MessageNotifier; //導入依賴的package包/類
@Override
public void onRun(MasterSecret masterSecret) throws IOException {
  final AttachmentId attachmentId = new AttachmentId(partRowId, partUniqueId);
  final Attachment   attachment   = DatabaseFactory.getAttachmentDatabase(context).getAttachment(masterSecret, attachmentId);

  if (attachment == null) {
    Log.w(TAG, "attachment no longer exists.");
    return;
  }

  if (!attachment.isInProgress()) {
    Log.w(TAG, "Attachment was already downloaded.");
    return;
  }

  Log.w(TAG, "Downloading push part " + attachmentId);

  retrieveAttachment(masterSecret, messageId, attachmentId, attachment);
  MessageNotifier.updateNotification(context, masterSecret);
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:21,代碼來源:AttachmentDownloadJob.java


注:本文中的org.thoughtcrime.securesms.notifications.MessageNotifier類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。