mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-24 08:38:51 -05:00
Reduce MessageCompos LOC
This commit is contained in:
parent
828a580eb8
commit
a51b608e5e
@ -88,6 +88,7 @@ import com.fsck.k9.crypto.PgpData;
|
||||
import com.fsck.k9.fragment.ProgressDialogFragment;
|
||||
import com.fsck.k9.helper.ContactItem;
|
||||
import com.fsck.k9.helper.Contacts;
|
||||
import com.fsck.k9.helper.SimpleTextWatcher;
|
||||
import com.fsck.k9.mail.filter.Base64;
|
||||
import com.fsck.k9.helper.HtmlConverter;
|
||||
import com.fsck.k9.helper.IdentityHelper;
|
||||
@ -615,63 +616,28 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
}
|
||||
});
|
||||
|
||||
TextWatcher watcher = new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int before, int after) {
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
TextWatcher draftNeedsChangingTextWatcher = new SimpleTextWatcher() {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
mDraftNeedsSaving = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(android.text.Editable s) { /* do nothing */ }
|
||||
};
|
||||
|
||||
// For watching changes to the To:, Cc:, and Bcc: fields for auto-encryption on a matching
|
||||
// address.
|
||||
TextWatcher recipientWatcher = new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int before, int after) {
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
mDraftNeedsSaving = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(android.text.Editable s) {
|
||||
/* do nothing */
|
||||
}
|
||||
};
|
||||
|
||||
TextWatcher sigwatcher = new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int before, int after) {
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
TextWatcher signTextWatcher = new SimpleTextWatcher() {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
mDraftNeedsSaving = true;
|
||||
mSignatureChanged = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(android.text.Editable s) { /* do nothing */ }
|
||||
};
|
||||
|
||||
mToView.addTextChangedListener(recipientWatcher);
|
||||
mCcView.addTextChangedListener(recipientWatcher);
|
||||
mBccView.addTextChangedListener(recipientWatcher);
|
||||
mSubjectView.addTextChangedListener(watcher);
|
||||
mToView.addTextChangedListener(draftNeedsChangingTextWatcher);
|
||||
mCcView.addTextChangedListener(draftNeedsChangingTextWatcher);
|
||||
mBccView.addTextChangedListener(draftNeedsChangingTextWatcher);
|
||||
mSubjectView.addTextChangedListener(draftNeedsChangingTextWatcher);
|
||||
|
||||
mMessageContentView.addTextChangedListener(watcher);
|
||||
mQuotedText.addTextChangedListener(watcher);
|
||||
mMessageContentView.addTextChangedListener(draftNeedsChangingTextWatcher);
|
||||
mQuotedText.addTextChangedListener(draftNeedsChangingTextWatcher);
|
||||
|
||||
/* Yes, there really are people who ship versions of android without a contact picker */
|
||||
if (mContacts.hasContactPicker()) {
|
||||
@ -759,7 +725,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
mSignatureView = lowerSignature;
|
||||
upperSignature.setVisibility(View.GONE);
|
||||
}
|
||||
mSignatureView.addTextChangedListener(sigwatcher);
|
||||
mSignatureView.addTextChangedListener(signTextWatcher);
|
||||
|
||||
if (!mIdentity.getSignatureUse()) {
|
||||
mSignatureView.setVisibility(View.GONE);
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.fsck.k9.helper;
|
||||
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
|
||||
/**
|
||||
* all methods empty - but this way we can have TextWatchers with less boilder-plate where
|
||||
* we just override the methods we want and not always al 3
|
||||
*/
|
||||
public class SimpleTextWatcher implements TextWatcher {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user