fix nullpointer in encrypttextactivity. fixes #1267

This commit is contained in:
Vincent Breitmoser 2015-05-27 18:10:18 +02:00
parent e378c47814
commit e03e1e5cfc

View File

@ -59,22 +59,7 @@ public class EncryptTextActivity extends BaseActivity implements
} }
}, false); }, false);
// Handle intent actions Intent intent = getIntent();
handleActions(getIntent(), savedInstanceState);
}
@Override
protected void initLayout() {
setContentView(R.layout.encrypt_text_activity);
}
/**
* Handles all actions with this intent
*
* @param intent
*/
private void handleActions(Intent intent, Bundle savedInstanceState) {
String action = intent.getAction(); String action = intent.getAction();
Bundle extras = intent.getExtras(); Bundle extras = intent.getExtras();
String type = intent.getType(); String type = intent.getType();
@ -83,10 +68,6 @@ public class EncryptTextActivity extends BaseActivity implements
extras = new Bundle(); extras = new Bundle();
} }
/*
* Android's Action
*/
// When sending to OpenKeychain Encrypt via share menu // When sending to OpenKeychain Encrypt via share menu
if (Intent.ACTION_SEND.equals(action) && type != null) { if (Intent.ACTION_SEND.equals(action) && type != null) {
Log.logDebugBundle(extras, "extras"); Log.logDebugBundle(extras, "extras");
@ -127,6 +108,11 @@ public class EncryptTextActivity extends BaseActivity implements
} }
} }
@Override
protected void initLayout() {
setContentView(R.layout.encrypt_text_activity);
}
@Override @Override
public void onModeChanged(boolean symmetric) { public void onModeChanged(boolean symmetric) {
// switch fragments // switch fragments
@ -142,21 +128,29 @@ public class EncryptTextActivity extends BaseActivity implements
@Override @Override
public void onSignatureKeyIdChanged(long signatureKeyId) { public void onSignatureKeyIdChanged(long signatureKeyId) {
if (mEncryptFragment != null) {
mEncryptFragment.setSigningKeyId(signatureKeyId); mEncryptFragment.setSigningKeyId(signatureKeyId);
} }
}
@Override @Override
public void onEncryptionKeyIdsChanged(long[] encryptionKeyIds) { public void onEncryptionKeyIdsChanged(long[] encryptionKeyIds) {
if (mEncryptFragment != null) {
mEncryptFragment.setEncryptionKeyIds(encryptionKeyIds); mEncryptFragment.setEncryptionKeyIds(encryptionKeyIds);
} }
}
@Override @Override
public void onEncryptionUserIdsChanged(String[] encryptionUserIds) { public void onEncryptionUserIdsChanged(String[] encryptionUserIds) {
if (mEncryptFragment != null) {
mEncryptFragment.setEncryptionUserIds(encryptionUserIds); mEncryptFragment.setEncryptionUserIds(encryptionUserIds);
} }
}
@Override @Override
public void onPassphraseChanged(Passphrase passphrase) { public void onPassphraseChanged(Passphrase passphrase) {
if (mEncryptFragment != null) {
mEncryptFragment.setSymmetricPassphrase(passphrase); mEncryptFragment.setSymmetricPassphrase(passphrase);
} }
} }
}