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

Cleanup and Optimize ( no need to prepare some layout when it is never used )

This commit is contained in:
ligi 2015-01-29 16:24:44 +01:00
parent ba79779758
commit 4075b72b72

View File

@ -301,7 +301,6 @@ public class MessageCompose extends K9Activity implements OnClickListener,
private EolConvertingEditText mQuotedText; private EolConvertingEditText mQuotedText;
private MessageWebView mQuotedHTML; private MessageWebView mQuotedHTML;
private InsertableHtmlContent mQuotedHtmlContent; // Container for HTML reply as it's being built. private InsertableHtmlContent mQuotedHtmlContent; // Container for HTML reply as it's being built.
private View mEncryptLayout;
private CheckBox mCryptoSignatureCheckbox; private CheckBox mCryptoSignatureCheckbox;
private CheckBox mEncryptCheckbox; private CheckBox mEncryptCheckbox;
private TextView mCryptoSignatureUserId; private TextView mCryptoSignatureUserId;
@ -521,8 +520,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
// theme the whole content according to the theme (except the action bar) // theme the whole content according to the theme (except the action bar)
mThemeContext = new ContextThemeWrapper(this, mThemeContext = new ContextThemeWrapper(this,
K9.getK9ThemeResourceId(K9.getK9ComposerTheme())); K9.getK9ThemeResourceId(K9.getK9ComposerTheme()));
View v = ((LayoutInflater) mThemeContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE)). View v = LayoutInflater.from(mThemeContext).inflate(R.layout.message_compose, null);
inflate(R.layout.message_compose, null);
TypedValue outValue = new TypedValue(); TypedValue outValue = new TypedValue();
// background color needs to be forced // background color needs to be forced
mThemeContext.getTheme().resolveAttribute(R.attr.messageViewHeaderBackgroundColor, outValue, true); mThemeContext.getTheme().resolveAttribute(R.attr.messageViewHeaderBackgroundColor, outValue, true);
@ -675,7 +673,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
mMessageContentView.addTextChangedListener(watcher); mMessageContentView.addTextChangedListener(watcher);
mQuotedText.addTextChangedListener(watcher); mQuotedText.addTextChangedListener(watcher);
/* Yes, there really are poeple who ship versions of android without a contact picker */ /* Yes, there really are people who ship versions of android without a contact picker */
if (mContacts.hasContactPicker()) { if (mContacts.hasContactPicker()) {
mAddToFromContacts.setOnClickListener(new OnClickListener() { mAddToFromContacts.setOnClickListener(new OnClickListener() {
@Override public void onClick(View v) { @Override public void onClick(View v) {
@ -813,34 +811,31 @@ public class MessageCompose extends K9Activity implements OnClickListener,
mMessageReference.flag = Flag.FORWARDED; mMessageReference.flag = Flag.FORWARDED;
} }
mEncryptLayout = findViewById(R.id.layout_encrypt); final View mEncryptLayout = findViewById(R.id.layout_encrypt);
mCryptoSignatureCheckbox = (CheckBox)findViewById(R.id.cb_crypto_signature);
mCryptoSignatureCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
updateMessageFormat();
}
});
mCryptoSignatureUserId = (TextView)findViewById(R.id.userId);
mCryptoSignatureUserIdRest = (TextView)findViewById(R.id.userIdRest);
mEncryptCheckbox = (CheckBox)findViewById(R.id.cb_encrypt);
mEncryptCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
updateMessageFormat();
}
});
if (mSourceMessageBody != null) {
// mSourceMessageBody is set to something when replying to and forwarding decrypted
// messages, so the sender probably wants the message to be encrypted.
mEncryptCheckbox.setChecked(true);
}
initializeCrypto(); initializeCrypto();
mOpenPgpProvider = mAccount.getOpenPgpProvider(); mOpenPgpProvider = mAccount.getOpenPgpProvider();
if (mOpenPgpProvider != null) { if (mOpenPgpProvider != null) {
mCryptoSignatureCheckbox = (CheckBox)findViewById(R.id.cb_crypto_signature);
final OnCheckedChangeListener updateListener = new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
updateMessageFormat();
}
};
mCryptoSignatureCheckbox.setOnCheckedChangeListener(updateListener);
mCryptoSignatureUserId = (TextView)findViewById(R.id.userId);
mCryptoSignatureUserIdRest = (TextView)findViewById(R.id.userIdRest);
mEncryptCheckbox = (CheckBox)findViewById(R.id.cb_encrypt);
mEncryptCheckbox.setOnCheckedChangeListener(updateListener);
if (mSourceMessageBody != null) {
// mSourceMessageBody is set to something when replying to and forwarding decrypted
// messages, so the sender probably wants the message to be encrypted.
mEncryptCheckbox.setChecked(true);
}
// New OpenPGP Provider API // New OpenPGP Provider API
// bind to service // bind to service
@ -3984,5 +3979,6 @@ public class MessageCompose extends K9Activity implements OnClickListener,
public void setCharacters(CharSequence text) { public void setCharacters(CharSequence text) {
setText(text.toString().replace("\r\n", "\n")); setText(text.toString().replace("\r\n", "\n"));
} }
} }
} }