lift some gpg code into the crypto initializer

This commit is contained in:
Jesse Vincent 2010-12-28 09:08:58 +00:00
parent 3ffa28fa02
commit 8116a0f39f

View file

@ -1034,8 +1034,8 @@ public class MessageView extends K9Activity implements OnClickListener
{
super.onRestoreInstanceState(savedInstanceState);
setLoadPictures(savedInstanceState.getBoolean(SHOW_PICTURES));
mPgpData = (PgpData) savedInstanceState.getSerializable(STATE_PGP_DATA);
initializeCrypto();
initializeCrypto((PgpData) savedInstanceState.getSerializable(STATE_PGP_DATA)
);
updateDecryptLayout();
}
@ -1054,8 +1054,7 @@ public class MessageView extends K9Activity implements OnClickListener
mAttachments.removeAllViews();
findSurroundingMessagesUid();
// start with fresh, empty PGP data
mPgpData = null;
initializeCrypto();
initializeCrypto(null);
mTopView.setVisibility(View.VISIBLE);
MessagingController.getInstance(getApplication()).loadMessageForView(
mAccount,
@ -2264,20 +2263,22 @@ public class MessageView extends K9Activity implements OnClickListener
mConnection.disconnect();
}
}
}
private void initializeCrypto()
private void initializeCrypto(PgpData data)
{
if (mPgpData != null)
if (data == null)
{
return;
if (mAccount == null)
{
mAccount = Preferences.getPreferences(this).getAccount(mMessageReference.accountUuid);
}
mPgpData = new PgpData();
}
if (mAccount == null)
else
{
mAccount = Preferences.getPreferences(this).getAccount(mMessageReference.accountUuid);
mPgpData = data;
}
mPgpData = new PgpData();
}
/**