本文整理汇总了Java中org.thoughtcrime.securesms.util.TextSecurePreferences.isPasswordDisabled方法的典型用法代码示例。如果您正苦于以下问题:Java TextSecurePreferences.isPasswordDisabled方法的具体用法?Java TextSecurePreferences.isPasswordDisabled怎么用?Java TextSecurePreferences.isPasswordDisabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.thoughtcrime.securesms.util.TextSecurePreferences
的用法示例。
在下文中一共展示了TextSecurePreferences.isPasswordDisabled方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
示例2: 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);
}
}
示例3: verifyAndSavePassphrases
import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入方法依赖的package包/类
private void verifyAndSavePassphrases() {
Editable originalText = this.originalPassphrase.getText();
Editable newText = this.newPassphrase.getText();
Editable repeatText = this.repeatPassphrase.getText();
String original = (originalText == null ? "" : originalText.toString());
String passphrase = (newText == null ? "" : newText.toString());
String passphraseRepeat = (repeatText == null ? "" : repeatText.toString());
if (TextSecurePreferences.isPasswordDisabled(this)) {
original = MasterSecretUtil.UNENCRYPTED_PASSPHRASE;
}
if (!passphrase.equals(passphraseRepeat)) {
this.newPassphrase.setText("");
this.repeatPassphrase.setText("");
this.newPassphrase.setError(getString(R.string.PassphraseChangeActivity_passphrases_dont_match_exclamation));
this.newPassphrase.requestFocus();
} else if (passphrase.equals("")) {
this.newPassphrase.setError(getString(R.string.PassphraseChangeActivity_enter_new_passphrase_exclamation));
this.newPassphrase.requestFocus();
} else {
new ChangePassphraseTask(this).execute(original, passphrase);
}
}
示例4: 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();
}
}
示例5: getSummary
import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入方法依赖的package包/类
public static CharSequence getSummary(Context context) {
final int privacySummaryResId = R.string.ApplicationPreferencesActivity_privacy_summary;
final String onRes = context.getString(R.string.ApplicationPreferencesActivity_on);
final String offRes = context.getString(R.string.ApplicationPreferencesActivity_off);
if (TextSecurePreferences.isPasswordDisabled(context)) {
if (TextSecurePreferences.isScreenSecurityEnabled(context)) {
return context.getString(privacySummaryResId, offRes, onRes);
} else {
return context.getString(privacySummaryResId, offRes, offRes);
}
} else {
if (TextSecurePreferences.isScreenSecurityEnabled(context)) {
return context.getString(privacySummaryResId, onRes, onRes);
} else {
return context.getString(privacySummaryResId, onRes, offRes);
}
}
}
示例6: onReceive
import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
if (intent != null && !TextSecurePreferences.isPasswordDisabled(context) &&
"info.guardianproject.panic.action.TRIGGER".equals(intent.getAction()))
{
Intent lockIntent = new Intent(context, KeyCachingService.class);
lockIntent.setAction(KeyCachingService.CLEAR_KEY_ACTION);
context.startService(lockIntent);
}
}
示例7: startTimeoutIfAppropriate
import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入方法依赖的package包/类
private void startTimeoutIfAppropriate() {
boolean timeoutEnabled = TextSecurePreferences.isPassphraseTimeoutEnabled(this);
if ((activitiesRunning == 0) && (KeyCachingService.masterSecret != null) && timeoutEnabled && !TextSecurePreferences.isPasswordDisabled(this)) {
long timeoutMinutes = TextSecurePreferences.getPassphraseTimeoutInterval(this);
long timeoutMillis = TimeUnit.MINUTES.toMillis(timeoutMinutes);
Log.w("KeyCachingService", "Starting timeout: " + timeoutMillis);
AlarmManager alarmManager = (AlarmManager)this.getSystemService(ALARM_SERVICE);
alarmManager.cancel(pending);
alarmManager.set(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() + timeoutMillis, pending);
}
}
示例8: foregroundService
import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入方法依赖的package包/类
private void foregroundService() {
if (TextSecurePreferences.isPasswordDisabled(this)) {
stopForeground(true);
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
foregroundServiceModern();
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
foregroundServiceICS();
} else {
foregroundServiceLegacy();
}
}
示例9: handleDisableService
import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入方法依赖的package包/类
private void handleDisableService() {
if (TextSecurePreferences.isPasswordDisabled(this))
stopForeground(true);
}