diff --git a/k9mail-library/src/main/java/com/fsck/k9/mail/internet/MessageExtractor.java b/k9mail-library/src/main/java/com/fsck/k9/mail/internet/MessageExtractor.java index ec15f913a..d72368514 100644 --- a/k9mail-library/src/main/java/com/fsck/k9/mail/internet/MessageExtractor.java +++ b/k9mail-library/src/main/java/com/fsck/k9/mail/internet/MessageExtractor.java @@ -452,19 +452,8 @@ public class MessageExtractor { return false; } - if (part.isMimeType("text/html")) { - return true; - } + return part.isMimeType("text/html") || part.isMimeType("text/plain") || part.isMimeType("application/pgp"); - if (part.isMimeType("text/plain")) { - return true; - } - - if (part.isMimeType("application/pgp")) { - return true; - } - - return false; } private static String getContentDisposition(Part part) { diff --git a/k9mail-library/src/main/java/com/fsck/k9/mail/store/webdav/DataSet.java b/k9mail-library/src/main/java/com/fsck/k9/mail/store/webdav/DataSet.java index e0324c9b1..7685ae749 100644 --- a/k9mail-library/src/main/java/com/fsck/k9/mail/store/webdav/DataSet.java +++ b/k9mail-library/src/main/java/com/fsck/k9/mail/store/webdav/DataSet.java @@ -3,6 +3,7 @@ package com.fsck.k9.mail.store.webdav; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -51,11 +52,8 @@ class DataSet { * Returns a hashmap of special folder name => special folder url */ public Map getSpecialFolderToUrl() { - // We return the first (and only) map - for (Map folderMap : mData.values()) { - return folderMap; - } - return new HashMap(); + // We return the first (and only) map, creating one if not present + return mData.isEmpty() ? Collections.emptyMap() : mData.values().iterator().next(); } /** diff --git a/k9mail/src/main/java/com/fsck/k9/activity/Accounts.java b/k9mail/src/main/java/com/fsck/k9/activity/Accounts.java index d6b783f75..20aee4f90 100644 --- a/k9mail/src/main/java/com/fsck/k9/activity/Accounts.java +++ b/k9mail/src/main/java/com/fsck/k9/activity/Accounts.java @@ -1690,7 +1690,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener { ListView listView = ((AlertDialog) dialog).getListView(); SparseBooleanArray pos = listView.getCheckedItemPositions(); - boolean includeGlobals = mImportContents.globalSettings ? pos.get(0) : false; + boolean includeGlobals = mImportContents.globalSettings && pos.get(0); List accountUuids = new ArrayList(); int start = mImportContents.globalSettings ? 1 : 0; for (int i = start, end = listView.getCount(); i < end; i++) { diff --git a/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java b/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java index 39267ab86..8e9dc290d 100644 --- a/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java +++ b/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java @@ -1070,12 +1070,9 @@ public class MessageCompose extends K9Activity implements OnClickListener, if (subjectView.getText().length() != 0) { return true; } - if (!recipientPresenter.getToAddresses().isEmpty() || + return !recipientPresenter.getToAddresses().isEmpty() || !recipientPresenter.getCcAddresses().isEmpty() || - !recipientPresenter.getBccAddresses().isEmpty()) { - return true; - } - return false; + !recipientPresenter.getBccAddresses().isEmpty(); } @Override diff --git a/k9mail/src/main/java/com/fsck/k9/autocrypt/AutocryptHeader.java b/k9mail/src/main/java/com/fsck/k9/autocrypt/AutocryptHeader.java index 686152961..3fd7c473e 100644 --- a/k9mail/src/main/java/com/fsck/k9/autocrypt/AutocryptHeader.java +++ b/k9mail/src/main/java/com/fsck/k9/autocrypt/AutocryptHeader.java @@ -100,20 +100,8 @@ class AutocryptHeader { AutocryptHeader that = (AutocryptHeader) o; - if (isPreferEncryptMutual != that.isPreferEncryptMutual) { - return false; - } - if (!Arrays.equals(keyData, that.keyData)) { - return false; - } - if (!addr.equals(that.addr)) { - return false; - } - if (!parameters.equals(that.parameters)) { - return false; - } - - return true; + return isPreferEncryptMutual == that.isPreferEncryptMutual && Arrays.equals(keyData, that.keyData) + && addr.equals(that.addr) && parameters.equals(that.parameters); } @Override diff --git a/k9mail/src/main/java/com/fsck/k9/controller/MessagingController.java b/k9mail/src/main/java/com/fsck/k9/controller/MessagingController.java index 65eefd479..26cfd8e5e 100644 --- a/k9mail/src/main/java/com/fsck/k9/controller/MessagingController.java +++ b/k9mail/src/main/java/com/fsck/k9/controller/MessagingController.java @@ -3838,18 +3838,14 @@ public class MessagingController { } private boolean modeMismatch(Account.FolderMode aMode, Folder.FolderClass fMode) { - if (aMode == Account.FolderMode.NONE + return aMode == Account.FolderMode.NONE || (aMode == Account.FolderMode.FIRST_CLASS && fMode != Folder.FolderClass.FIRST_CLASS) || (aMode == Account.FolderMode.FIRST_AND_SECOND_CLASS && fMode != Folder.FolderClass.FIRST_CLASS && fMode != Folder.FolderClass.SECOND_CLASS) || (aMode == Account.FolderMode.NOT_SECOND_CLASS && - fMode == Folder.FolderClass.SECOND_CLASS)) { - return true; - } else { - return false; - } + fMode == Folder.FolderClass.SECOND_CLASS); } private static AtomicInteger sequencing = new AtomicInteger(0); diff --git a/k9mail/src/main/java/com/fsck/k9/preferences/IdentitySettings.java b/k9mail/src/main/java/com/fsck/k9/preferences/IdentitySettings.java index 00fc49b42..7d7b6670e 100644 --- a/k9mail/src/main/java/com/fsck/k9/preferences/IdentitySettings.java +++ b/k9mail/src/main/java/com/fsck/k9/preferences/IdentitySettings.java @@ -111,7 +111,7 @@ class IdentitySettings { @Override public String toString(String value) { - return (value != null) ? value : null; + return value; } @Override diff --git a/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.java b/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.java index 900129431..f43490ec1 100644 --- a/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.java +++ b/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.java @@ -611,7 +611,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF } public boolean isMessageRead() { - return (mMessage != null) ? mMessage.isSet(Flag.SEEN) : false; + return (mMessage != null) && mMessage.isSet(Flag.SEEN); } public boolean isCopyCapable() {