1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

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,21 +2263,23 @@ 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();
}
else
{
mPgpData = data;
}
}
/**
* Fill the decrypt layout with signature data, if known, make controls visible, if