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


Java TextSecurePreferences类代码示例

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


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

示例1: constructHttpClient

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入依赖的package包/类
protected CloseableHttpClient constructHttpClient() throws IOException {
  RequestConfig config = RequestConfig.custom()
                                      .setConnectTimeout(20 * 1000)
                                      .setConnectionRequestTimeout(20 * 1000)
                                      .setSocketTimeout(20 * 1000)
                                      .setMaxRedirects(20)
                                      .build();

  URL                 mmsc          = new URL(apn.getMmsc());
  CredentialsProvider credsProvider = new BasicCredentialsProvider();

  if (apn.hasAuthentication()) {
    credsProvider.setCredentials(new AuthScope(mmsc.getHost(), mmsc.getPort() > -1 ? mmsc.getPort() : mmsc.getDefaultPort()),
                                 new UsernamePasswordCredentials(apn.getUsername(), apn.getPassword()));
  }

  return HttpClients.custom()
                    .setConnectionReuseStrategy(new NoConnectionReuseStrategyHC4())
                    .setRedirectStrategy(new LaxRedirectStrategy())
                    .setUserAgent(TextSecurePreferences.getMmsUserAgent(context, USER_AGENT))
                    .setConnectionManager(new BasicHttpClientConnectionManager())
                    .setDefaultRequestConfig(config)
                    .setDefaultCredentialsProvider(credsProvider)
                    .build();
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:26,代码来源:LegacyMmsConnection.java

示例2: updateInviteReminder

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入依赖的package包/类
protected void updateInviteReminder(boolean seenInvite) {
  Log.w(TAG, "updateInviteReminder(" + seenInvite+")");
  if (TextSecurePreferences.isPushRegistered(this)      &&
      TextSecurePreferences.isShowInviteReminders(this) &&
      !isSecureText                                     &&
      !seenInvite                                       &&
      recipients.isSingleRecipient()                    &&
      recipients.getPrimaryRecipient() != null          &&
      recipients.getPrimaryRecipient().getContactUri() != null)
  {
    InviteReminder reminder = new InviteReminder(this, recipients);
    reminder.setOkListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        handleInviteLink();
        reminderView.get().requestDismiss();
      }
    });
    reminderView.get().showReminder(reminder);
  } else if (reminderView.resolved()) {
    reminderView.get().hide();
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:24,代码来源:ConversationActivity.java

示例3: initializeResources

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入依赖的package包/类
private void initializeResources() {
  this.originalPassphrase      = (EditText) findViewById(R.id.old_passphrase      );
  this.newPassphrase           = (EditText) findViewById(R.id.new_passphrase      );
  this.repeatPassphrase        = (EditText) findViewById(R.id.repeat_passphrase   );

  this.okButton                = (Button  ) findViewById(R.id.ok_button           );
  this.cancelButton            = (Button  ) findViewById(R.id.cancel_button       );

  this.okButton.setOnClickListener(new OkButtonClickListener());
  this.cancelButton.setOnClickListener(new CancelButtonClickListener());

  if (TextSecurePreferences.isPasswordDisabled(this)) {
    this.originalPassphrase.setVisibility(View.GONE);
  } else {
    this.originalPassphrase.setVisibility(View.VISIBLE);
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:18,代码来源:PassphraseChangeActivity.java

示例4: createGroup

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入依赖的package包/类
public static @NonNull GroupActionResult createGroup(@NonNull  Context        context,
                                                     @NonNull  MasterSecret   masterSecret,
                                                     @NonNull  Set<Recipient> members,
                                                     @Nullable Bitmap         avatar,
                                                     @Nullable String         name)
    throws InvalidNumberException
{
  final byte[]        avatarBytes       = BitmapUtil.toByteArray(avatar);
  final GroupDatabase groupDatabase     = DatabaseFactory.getGroupDatabase(context);
  final byte[]        groupId           = groupDatabase.allocateGroupId();
  final Set<String>   memberE164Numbers = getE164Numbers(context, members);
  final String        ownerE164Number   = Util.canonicalizeNumber(context,
          TextSecurePreferences.getLocalNumber(context));

  memberE164Numbers.add(TextSecurePreferences.getLocalNumber(context));
  groupDatabase.create(groupId, name, new LinkedList<>(memberE164Numbers), ownerE164Number,
          Collections.<String>emptyList(), null, null);
  groupDatabase.updateAvatar(groupId, avatarBytes);
  return sendGroupUpdate(context, masterSecret, groupId, memberE164Numbers, ownerE164Number,
          Collections.<String>emptySet(), name, avatarBytes, null);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:22,代码来源:GroupManager.java

示例5: onAlarm

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入依赖的package包/类
@Override
protected long onAlarm(Context context, long scheduledTime) {
  Log.w(TAG, "onAlarm...");

  if (scheduledTime != 0 && BuildConfig.PLAY_STORE_DISABLED) {
    Log.w(TAG, "Queueing APK update job...");
    ApplicationContext.getInstance(context)
                      .getJobManager()
                      .add(new UpdateApkJob(context));
  }

  long newTime = System.currentTimeMillis() + INTERVAL;
  TextSecurePreferences.setUpdateApkRefreshTime(context, newTime);

  return newTime;
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:17,代码来源:UpdateApkRefreshListener.java

示例6: onCreate

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入依赖的package包/类
@Override
public void onCreate(Bundle paramBundle) {
  super.onCreate(paramBundle);
  addPreferencesFromResource(R.xml.preferences_app_protection);

  masterSecret      = getArguments().getParcelable("master_secret");
  disablePassphrase = (CheckBoxPreference) this.findPreference("pref_enable_passphrase_temporary");

  this.findPreference(TextSecurePreferences.CHANGE_PASSPHRASE_PREF)
      .setOnPreferenceClickListener(new ChangePassphraseClickListener());
  this.findPreference(TextSecurePreferences.PASSPHRASE_TIMEOUT_INTERVAL_PREF)
      .setOnPreferenceClickListener(new PassphraseIntervalClickListener());
  this.findPreference(PREFERENCE_CATEGORY_BLOCKED)
      .setOnPreferenceClickListener(new BlockedContactsClickListener());
  disablePassphrase
      .setOnPreferenceChangeListener(new DisablePassphraseClickListener());
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:18,代码来源:AppProtectionPreferenceFragment.java

示例7: isRelevant

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入依赖的package包/类
private boolean isRelevant(Context context, Intent intent) {
  if (!ApplicationMigrationService.isDatabaseImported(context)) {
    return false;
  }

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
      Telephony.Sms.Intents.WAP_PUSH_RECEIVED_ACTION.equals(intent.getAction()) &&
      Util.isDefaultSmsProvider(context))
  {
    return false;
  }

  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT &&
      TextSecurePreferences.isInterceptAllMmsEnabled(context))
  {
    return true;
  }

  return false;
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:21,代码来源:MmsListener.java

示例8: onCreate

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入依赖的package包/类
@Override
public void onCreate() {
  Log.w("KeyCachingService", "onCreate()");
  super.onCreate();
  this.pending = PendingIntent.getService(this, 0, new Intent(PASSPHRASE_EXPIRED_EVENT, null,
                                                              this, KeyCachingService.class), 0);

  if (TextSecurePreferences.isPasswordDisabled(this)) {
    try {
      MasterSecret masterSecret = MasterSecretUtil.getMasterSecret(this, MasterSecretUtil.UNENCRYPTED_PASSPHRASE);
      setMasterSecret(masterSecret);
    } catch (InvalidPassphraseException e) {
      Log.w("KeyCachingService", e);
    }
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:17,代码来源:KeyCachingService.java

示例9: setMasterSecret

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入依赖的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

示例10: isPushTextSend

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入依赖的package包/类
private static boolean isPushTextSend(Context context, Recipients recipients, boolean keyExchange) {
  try {
    if (!TextSecurePreferences.isPushRegistered(context)) {
      return false;
    }

    if (keyExchange) {
      return false;
    }

    Recipient recipient   = recipients.getPrimaryRecipient();
    String    destination = Util.canonicalizeNumber(context, recipient.getNumber());

    return isPushDestination(context, destination);
  } catch (InvalidNumberException e) {
    Log.w(TAG, e);
    return false;
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:20,代码来源:MessageSender.java

示例11: onRun

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入依赖的package包/类
@Override
public void onRun(MasterSecret masterSecret) throws IOException {
  if (TextSecurePreferences.isSignedPreKeyRegistered(context)) {
    Log.w(TAG, "Signed prekey already registered...");
    return;
  }

  if (!TextSecurePreferences.isPushRegistered(context)) {
    Log.w(TAG, "Not yet registered...");
    return;
  }

  IdentityKeyPair    identityKeyPair    = IdentityKeyUtil.getIdentityKeyPair(context);
  SignedPreKeyRecord signedPreKeyRecord = PreKeyUtil.generateSignedPreKey(context, identityKeyPair, true);

  accountManager.setSignedPreKey(signedPreKeyRecord);
  TextSecurePreferences.setSignedPreKeyRegistered(context, true);
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:19,代码来源:CreateSignedPreKeyJob.java

示例12: setTransport

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入依赖的package包/类
public void setTransport(TransportOption transport) {
  final boolean useSystemEmoji = TextSecurePreferences.isSystemEmojiPreferred(getContext());

  int imeOptions = (getImeOptions() & ~EditorInfo.IME_MASK_ACTION) | EditorInfo.IME_ACTION_SEND;
  int inputType  = getInputType();

  if (isLandscape()) setImeActionLabel(transport.getComposeHint(), EditorInfo.IME_ACTION_SEND);
  else               setImeActionLabel(null, 0);

  if (useSystemEmoji) {
    inputType = (inputType & ~InputType.TYPE_MASK_VARIATION) | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE;
  }

  setInputType(inputType);
  setImeOptions(imeOptions);
  setHint(transport.getComposeHint(),
          transport.getSimName().isPresent()
              ? getContext().getString(R.string.conversation_activity__from_sim_name, transport.getSimName().get())
              : null);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:21,代码来源:ComposeText.java

示例13: updateGroup

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入依赖的package包/类
public static GroupActionResult updateGroup(@NonNull  Context        context,
                                            @NonNull  MasterSecret   masterSecret,
                                            @NonNull  byte[]         groupId,
                                            @NonNull  Set<Recipient> members,
                                            @Nullable Bitmap         avatar,
                                            @Nullable String         name)
    throws InvalidNumberException
{
  final GroupDatabase groupDatabase     = DatabaseFactory.getGroupDatabase(context);
  final Set<String>   memberE164Numbers = getE164Numbers(context, members);
  final byte[]        avatarBytes       = BitmapUtil.toByteArray(avatar);

  memberE164Numbers.add(TextSecurePreferences.getLocalNumber(context));
  groupDatabase.updateMembers(groupId, new LinkedList<>(memberE164Numbers));
  groupDatabase.updateTitle(groupId, name);
  groupDatabase.updateAvatar(groupId, avatarBytes);

  return sendGroupUpdate(context, masterSecret, groupId, memberE164Numbers, name, avatarBytes);
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:20,代码来源:GroupManager.java

示例14: getExperienceUpgrade

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入依赖的package包/类
public static Optional<ExperienceUpgrade> getExperienceUpgrade(Context context) {
  final int currentVersionCode = Util.getCurrentApkReleaseVersion(context);
  final int lastSeenVersion    = TextSecurePreferences.getLastExperienceVersionCode(context);
  Log.w(TAG, "getExperienceUpgrade(" + lastSeenVersion + ")");

  if (lastSeenVersion >= currentVersionCode) {
    TextSecurePreferences.setLastExperienceVersionCode(context, currentVersionCode);
    return Optional.absent();
  }

  Optional<ExperienceUpgrade> eligibleUpgrade = Optional.absent();
  for (ExperienceUpgrade upgrade : ExperienceUpgrade.values()) {
    if (lastSeenVersion < upgrade.getVersion()) eligibleUpgrade = Optional.of(upgrade);
  }

  return eligibleUpgrade;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:18,代码来源:ExperienceUpgradeActivity.java

示例15: onPreferenceClick

import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入依赖的package包/类
@Override
public boolean onPreferenceClick(Preference preference) {
  final int threadLengthLimit = TextSecurePreferences.getThreadTrimLength(getActivity());
  AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
  builder.setTitle(R.string.ApplicationPreferencesActivity_delete_all_old_messages_now);
  builder.setMessage(getResources().getQuantityString(R.plurals.ApplicationPreferencesActivity_this_will_immediately_trim_all_conversations_to_the_d_most_recent_messages,
                                                      threadLengthLimit, threadLengthLimit));
  builder.setPositiveButton(R.string.ApplicationPreferencesActivity_delete,
    new DialogInterface.OnClickListener() {
      @Override
      public void onClick(DialogInterface dialog, int which) {
        Trimmer.trimAllThreads(getActivity(), threadLengthLimit);
      }
    });

  builder.setNegativeButton(android.R.string.cancel, null);
  builder.show();

  return true;
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:21,代码来源:ChatsPreferenceFragment.java


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