1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 10:22:15 -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); super.onRestoreInstanceState(savedInstanceState);
setLoadPictures(savedInstanceState.getBoolean(SHOW_PICTURES)); setLoadPictures(savedInstanceState.getBoolean(SHOW_PICTURES));
mPgpData = (PgpData) savedInstanceState.getSerializable(STATE_PGP_DATA); initializeCrypto((PgpData) savedInstanceState.getSerializable(STATE_PGP_DATA)
initializeCrypto(); );
updateDecryptLayout(); updateDecryptLayout();
} }
@ -1054,8 +1054,7 @@ public class MessageView extends K9Activity implements OnClickListener
mAttachments.removeAllViews(); mAttachments.removeAllViews();
findSurroundingMessagesUid(); findSurroundingMessagesUid();
// start with fresh, empty PGP data // start with fresh, empty PGP data
mPgpData = null; initializeCrypto(null);
initializeCrypto();
mTopView.setVisibility(View.VISIBLE); mTopView.setVisibility(View.VISIBLE);
MessagingController.getInstance(getApplication()).loadMessageForView( MessagingController.getInstance(getApplication()).loadMessageForView(
mAccount, mAccount,
@ -2264,20 +2263,22 @@ public class MessageView extends K9Activity implements OnClickListener
mConnection.disconnect(); 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();
} }
/** /**