Code style fixes

This commit is contained in:
cketti 2017-01-26 19:17:20 +01:00
parent 9180c2c1e3
commit a357963d32
4 changed files with 68 additions and 69 deletions

View file

@ -114,15 +114,15 @@ public class MessageCompose extends K9Activity implements OnClickListener,
public static final String EXTRA_ACCOUNT = "account";
public static final String EXTRA_MESSAGE_REFERENCE = "message_reference";
public static final String EXTRA_MESSAGE_DECRYPTION_RESULT = "message_decryption_result";
public static final String EXTRA_MESSAGE_DECRYPTION_RESULT = "message_decryption_result";
private static final String STATE_KEY_SOURCE_MESSAGE_PROCED =
"com.fsck.k9.activity.MessageCompose.stateKeySourceMessageProced";
"com.fsck.k9.activity.MessageCompose.stateKeySourceMessageProced";
private static final String STATE_KEY_DRAFT_ID = "com.fsck.k9.activity.MessageCompose.draftId";
private static final String STATE_IDENTITY_CHANGED =
"com.fsck.k9.activity.MessageCompose.identityChanged";
"com.fsck.k9.activity.MessageCompose.identityChanged";
private static final String STATE_IDENTITY =
"com.fsck.k9.activity.MessageCompose.identity";
"com.fsck.k9.activity.MessageCompose.identity";
private static final String STATE_IN_REPLY_TO = "com.fsck.k9.activity.MessageCompose.inReplyTo";
private static final String STATE_REFERENCES = "com.fsck.k9.activity.MessageCompose.references";
private static final String STATE_KEY_READ_RECEIPT = "com.fsck.k9.activity.MessageCompose.messageReadReceipt";
@ -136,10 +136,10 @@ public class MessageCompose extends K9Activity implements OnClickListener,
public static final int MSG_SAVED_DRAFT = 4;
private static final int MSG_DISCARDED_DRAFT = 5;
private static final int REQUEST_MASK_RECIPIENT_PRESENTER = (1<<8);
private static final int REQUEST_MASK_LOADER_HELPER = (1<<9);
private static final int REQUEST_MASK_ATTACHMENT_PRESENTER = (1<<10);
private static final int REQUEST_MASK_MESSAGE_BUILDER = (1<<11);
private static final int REQUEST_MASK_RECIPIENT_PRESENTER = (1 << 8);
private static final int REQUEST_MASK_LOADER_HELPER = (1 << 9);
private static final int REQUEST_MASK_ATTACHMENT_PRESENTER = (1 << 10);
private static final int REQUEST_MASK_MESSAGE_BUILDER = (1 << 11);
/**
* Regular expression to remove the first localized "Re:" prefix in subjects.
@ -236,8 +236,8 @@ public class MessageCompose extends K9Activity implements OnClickListener,
relatedMessageReference = intent.getParcelableExtra(EXTRA_MESSAGE_REFERENCE);
final String accountUuid = (relatedMessageReference != null) ?
relatedMessageReference.getAccountUuid() :
intent.getStringExtra(EXTRA_ACCOUNT);
relatedMessageReference.getAccountUuid() :
intent.getStringExtra(EXTRA_ACCOUNT);
account = Preferences.getPreferences(this).getAccount(accountUuid);
@ -271,17 +271,17 @@ public class MessageCompose extends K9Activity implements OnClickListener,
subjectView = (EditText) findViewById(R.id.subject);
subjectView.getInputExtras(true).putBoolean("allowEmoji", true);
EolConvertingEditText upperSignature = (EolConvertingEditText)findViewById(R.id.upper_signature);
EolConvertingEditText lowerSignature = (EolConvertingEditText)findViewById(R.id.lower_signature);
EolConvertingEditText upperSignature = (EolConvertingEditText) findViewById(R.id.upper_signature);
EolConvertingEditText lowerSignature = (EolConvertingEditText) findViewById(R.id.lower_signature);
QuotedMessageMvpView quotedMessageMvpView = new QuotedMessageMvpView(this);
quotedMessagePresenter = new QuotedMessagePresenter(this, quotedMessageMvpView, account);
attachmentPresenter = new AttachmentPresenter(getApplicationContext(), attachmentMvpView, getLoaderManager());
messageContentView = (EolConvertingEditText)findViewById(R.id.message_content);
messageContentView = (EolConvertingEditText) findViewById(R.id.message_content);
messageContentView.getInputExtras(true).putBoolean("allowEmoji", true);
attachmentsView = (LinearLayout)findViewById(R.id.attachments);
attachmentsView = (LinearLayout) findViewById(R.id.attachments);
TextWatcher draftNeedsChangingTextWatcher = new SimpleTextWatcher() {
@Override
@ -429,8 +429,9 @@ public class MessageCompose extends K9Activity implements OnClickListener,
public void onDestroy() {
super.onDestroy();
if (recipientPresenter != null)
if (recipientPresenter != null) {
recipientPresenter.onActivityDestroy();
}
}
/**
@ -595,7 +596,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
attachmentPresenter.onRestoreInstanceState(savedInstanceState);
draftId = savedInstanceState.getLong(STATE_KEY_DRAFT_ID);
identity = (Identity)savedInstanceState.getSerializable(STATE_IDENTITY);
identity = (Identity) savedInstanceState.getSerializable(STATE_IDENTITY);
identityChanged = savedInstanceState.getBoolean(STATE_IDENTITY_CHANGED);
repliedToMessageId = savedInstanceState.getString(STATE_IN_REPLY_TO);
referencedMessageIds = savedInstanceState.getString(STATE_REFERENCES);
@ -618,7 +619,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
recipientPresenter.updateCryptoStatus();
ComposeCryptoStatus cryptoStatus = recipientPresenter.getCurrentCryptoStatus();
// TODO encrypt drafts for storage
if(!isDraft && cryptoStatus.shouldUsePgpMessageBuilder()) {
if (!isDraft && cryptoStatus.shouldUsePgpMessageBuilder()) {
SendErrorState maybeSendErrorState = cryptoStatus.getSendErrorStateOrNull();
if (maybeSendErrorState != null) {
recipientPresenter.showPgpSendError(maybeSendErrorState);
@ -813,8 +814,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
if (previousDraftId != INVALID_DRAFT_ID) {
if (K9.DEBUG) {
Log.v(K9.LOG_TAG, "Account switch, deleting draft from previous account: "
+ previousDraftId);
Log.v(K9.LOG_TAG, "Account switch, deleting draft from previous account: " + previousDraftId);
}
MessagingController.getInstance(getApplication()).deleteDraft(previousAccount,
previousDraftId);
@ -861,7 +861,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
@Override
public void onFocusChange(View v, boolean hasFocus) {
switch(v.getId()) {
switch (v.getId()) {
case R.id.message_content:
case R.id.subject:
if (hasFocus) {
@ -947,11 +947,11 @@ public class MessageCompose extends K9Activity implements OnClickListener,
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
if (isFinishing()) {
return false;
}
getMenuInflater().inflate(R.menu.message_compose_option, menu);
// Disable the 'Save' menu option if Drafts folder is set to -NONE-
@ -998,49 +998,49 @@ public class MessageCompose extends K9Activity implements OnClickListener,
switch (id) {
case DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE:
return new AlertDialog.Builder(this)
.setTitle(R.string.save_or_discard_draft_message_dlg_title)
.setMessage(R.string.save_or_discard_draft_message_instructions_fmt)
.setPositiveButton(R.string.save_draft_action, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
dismissDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE);
checkToSaveDraftAndSave();
}
})
.setNegativeButton(R.string.discard_action, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
dismissDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE);
onDiscard();
}
})
.create();
.setTitle(R.string.save_or_discard_draft_message_dlg_title)
.setMessage(R.string.save_or_discard_draft_message_instructions_fmt)
.setPositiveButton(R.string.save_draft_action, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
dismissDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE);
checkToSaveDraftAndSave();
}
})
.setNegativeButton(R.string.discard_action, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
dismissDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE);
onDiscard();
}
})
.create();
case DIALOG_CONFIRM_DISCARD_ON_BACK:
return new AlertDialog.Builder(this)
.setTitle(R.string.confirm_discard_draft_message_title)
.setMessage(R.string.confirm_discard_draft_message)
.setPositiveButton(R.string.cancel_action, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
dismissDialog(DIALOG_CONFIRM_DISCARD_ON_BACK);
}
})
.setNegativeButton(R.string.discard_action, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
dismissDialog(DIALOG_CONFIRM_DISCARD_ON_BACK);
Toast.makeText(MessageCompose.this,
getString(R.string.message_discarded_toast),
Toast.LENGTH_LONG).show();
onDiscard();
}
})
.create();
.setTitle(R.string.confirm_discard_draft_message_title)
.setMessage(R.string.confirm_discard_draft_message)
.setPositiveButton(R.string.cancel_action, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
dismissDialog(DIALOG_CONFIRM_DISCARD_ON_BACK);
}
})
.setNegativeButton(R.string.discard_action, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
dismissDialog(DIALOG_CONFIRM_DISCARD_ON_BACK);
Toast.makeText(MessageCompose.this,
getString(R.string.message_discarded_toast),
Toast.LENGTH_LONG).show();
onDiscard();
}
})
.create();
case DIALOG_CHOOSE_IDENTITY:
Context context = new ContextThemeWrapper(this,
(K9.getK9Theme() == K9.Theme.LIGHT) ?
R.style.Theme_K9_Dialog_Light :
R.style.Theme_K9_Dialog_Dark);
R.style.Theme_K9_Dialog_Light :
R.style.Theme_K9_Dialog_Dark);
Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.send_as);
final IdentityAdapter adapter = new IdentityAdapter(context);
@ -1115,7 +1115,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
}
}
} catch (MessagingException me) {
/**
/*
* Let the user continue composing their message even if we have a problem processing
* the source message. Log it as an error, though.
*/
@ -1299,7 +1299,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
final MessageReference messageReference;
SendMessageTask(Context context, Account account, Contacts contacts, Message message,
Long draftId, MessageReference messageReference) {
Long draftId, MessageReference messageReference) {
this.context = context;
this.account = account;
this.contacts = contacts;
@ -1576,7 +1576,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
};
AttachmentMvpView attachmentMvpView = new AttachmentMvpView() {
private HashMap<Uri,View> attachmentViews = new HashMap<>();
private HashMap<Uri, View> attachmentViews = new HashMap<>();
@Override
public void showWaitingForAttachmentDialog(WaitingAction waitingAction) {
@ -1734,5 +1734,4 @@ public class MessageCompose extends K9Activity implements OnClickListener,
return titleResource;
}
}
}

View file

@ -32,7 +32,7 @@ public class AttachmentPresenter {
private static final String LOADER_ARG_ATTACHMENT = "attachment";
private static final int LOADER_ID_MASK = 1 << 6;
private static final int MAX_TOTAL_LOADERS = LOADER_ID_MASK -1;
private static final int MAX_TOTAL_LOADERS = LOADER_ID_MASK - 1;
private static final int REQUEST_CODE_ATTACHMENT_URI = 1;
@ -113,7 +113,8 @@ public class AttachmentPresenter {
}
public void onClickAddAttachment(RecipientPresenter recipientPresenter) {
AttachErrorState maybeAttachErrorState = recipientPresenter.getCurrentCryptoStatus().getAttachErrorStateOrNull();
AttachErrorState maybeAttachErrorState =
recipientPresenter.getCurrentCryptoStatus().getAttachErrorStateOrNull();
if (maybeAttachErrorState != null) {
recipientPresenter.showPgpAttachError(maybeAttachErrorState);
return;

View file

@ -506,7 +506,7 @@ public class RecipientPresenter implements PermissionPingCallback {
return CONTACT_PICKER_BCC;
}
}
throw new AssertionError("Unhandled case: " + type);
}
@ -522,7 +522,7 @@ public class RecipientPresenter implements PermissionPingCallback {
return RecipientType.BCC;
}
}
throw new AssertionError("Unhandled case: " + type);
}

View file

@ -381,5 +381,4 @@ public class QuotedMessagePresenter {
public boolean isQuotedTextText() {
return quotedTextFormat == SimpleMessageFormat.TEXT;
}
}