session-android/src/org/thoughtcrime/securesms/PassphraseRequiredSherlockPreferenceActivity.java
Moxie Marlinspike c2dcf7ae74 Refactor MasterSecret initialization, access, and timeout paths.
1) Consolidate all of the KeyCachingService interaction into a single
   mixin. Activities extend delegates which call through to the mixin.

2) Switch Activity increment/decrement triggers from onStop to onPause
   in order to account for some screen locks that don't stop activities.
2013-02-10 17:30:51 -08:00

49 lines
1019 B
Java

package org.thoughtcrime.securesms;
import android.os.Bundle;
import org.thoughtcrime.securesms.crypto.MasterSecret;
import com.actionbarsherlock.app.SherlockPreferenceActivity;
public abstract class PassphraseRequiredSherlockPreferenceActivity
extends SherlockPreferenceActivity
implements PassphraseRequiredActivity
{
private final PassphraseRequiredMixin delegate = new PassphraseRequiredMixin();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
delegate.onCreate(this, this);
}
@Override
protected void onResume() {
super.onResume();
delegate.onResume(this, this);
}
@Override
protected void onPause() {
super.onPause();
delegate.onPause(this, this);
}
@Override
protected void onDestroy() {
super.onDestroy();
delegate.onDestroy(this, this);
}
@Override
public void onMasterSecretCleared() {
finish();
}
@Override
public void onNewMasterSecret(MasterSecret masterSecret) {}
}