当前位置: 首页>>代码示例>>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;未经允许,请勿转载。