1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -05:00

Simplify many, many boolean conditions with help from IntelliJ

This commit is contained in:
Jesse Vincent 2010-08-29 23:39:26 +00:00
parent 3d27cf220a
commit 4f0bce1569
14 changed files with 113 additions and 113 deletions

View File

@ -81,7 +81,7 @@ public class ChooseIdentity extends K9ListActivity
{
Identity identity = mAccount.getIdentity(position);
String email = identity.getEmail();
if (email != null && email.trim().equals("") == false)
if (email != null && !email.trim().equals(""))
{
Intent intent = new Intent();

View File

@ -918,7 +918,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
text += "\n" + mQuotedText.getText().toString();
}
if (appendSig && mAccount.isSignatureBeforeQuotedText() == false)
if (appendSig && !mAccount.isSignatureBeforeQuotedText())
{
text = appendSignature(text);
}
@ -1666,7 +1666,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
{
final String subject = prefix.matcher(message.getSubject()).replaceFirst("");
if (subject.toLowerCase().startsWith("re:") == false)
if (!subject.toLowerCase().startsWith("re:"))
{
mSubjectView.setText("Re: " + subject);
}

View File

@ -950,12 +950,12 @@ public class MessageList
private void onMove(MessageInfoHolder holder)
{
if (mController.isMoveCapable(holder.message.getFolder().getAccount()) == false)
if (!mController.isMoveCapable(holder.message.getFolder().getAccount()))
{
return;
}
if (mController.isMoveCapable(holder.message) == false)
if (!mController.isMoveCapable(holder.message))
{
Toast toast = Toast.makeText(this, R.string.move_copy_cannot_copy_unsynced_message, Toast.LENGTH_LONG);
toast.show();
@ -974,12 +974,12 @@ public class MessageList
private void onArchive(MessageInfoHolder holder)
{
if (mController.isMoveCapable(holder.message.getFolder().getAccount()) == false)
if (!mController.isMoveCapable(holder.message.getFolder().getAccount()))
{
return;
}
if (mController.isMoveCapable(holder.message) == false)
if (!mController.isMoveCapable(holder.message))
{
Toast toast = Toast.makeText(this, R.string.move_copy_cannot_copy_unsynced_message, Toast.LENGTH_LONG);
toast.show();
@ -991,12 +991,12 @@ public class MessageList
private void onSpam(MessageInfoHolder holder)
{
if (mController.isMoveCapable(holder.message.getFolder().getAccount()) == false)
if (!mController.isMoveCapable(holder.message.getFolder().getAccount()))
{
return;
}
if (mController.isMoveCapable(holder.message) == false)
if (!mController.isMoveCapable(holder.message))
{
Toast toast = Toast.makeText(this, R.string.move_copy_cannot_copy_unsynced_message, Toast.LENGTH_LONG);
toast.show();
@ -1008,12 +1008,12 @@ public class MessageList
private void onCopy(MessageInfoHolder holder)
{
if (mController.isCopyCapable(holder.message.getFolder().getAccount()) == false)
if (!mController.isCopyCapable(holder.message.getFolder().getAccount()))
{
return;
}
if (mController.isCopyCapable(holder.message) == false)
if (!mController.isCopyCapable(holder.message))
{
Toast toast = Toast.makeText(this, R.string.move_copy_cannot_copy_unsynced_message, Toast.LENGTH_LONG);
toast.show();
@ -1092,7 +1092,7 @@ public class MessageList
private void onMoveChosen(MessageInfoHolder holder, String folderName)
{
if (mController.isMoveCapable(holder.message.getFolder().getAccount()) == true && folderName != null)
if (mController.isMoveCapable(holder.message.getFolder().getAccount()) && folderName != null)
{
if (K9.FOLDER_NONE.equalsIgnoreCase(folderName))
{
@ -1105,7 +1105,7 @@ public class MessageList
private void onCopyChosen(MessageInfoHolder holder, String folderName)
{
if (mController.isCopyCapable(holder.message.getFolder().getAccount()) == true && folderName != null)
if (mController.isCopyCapable(holder.message.getFolder().getAccount()) && folderName != null)
{
mController.copyMessage(holder.message.getFolder().getAccount(),
holder.message.getFolder().getName(), holder.message, folderName, null);
@ -1693,12 +1693,12 @@ public class MessageList
}
Account account = message.message.getFolder().getAccount();
if (mController.isCopyCapable(account) == false)
if (!mController.isCopyCapable(account))
{
menu.findItem(R.id.copy).setVisible(false);
}
if (mController.isMoveCapable(account) == false)
if (!mController.isMoveCapable(account))
{
menu.findItem(R.id.move).setVisible(false);
menu.findItem(R.id.archive).setVisible(false);
@ -2255,12 +2255,12 @@ public class MessageList
holder.flagged.setOnClickListener(flagClickListener);
if (mStars == false)
if (!mStars)
{
holder.flagged.setVisibility(View.GONE);
}
if (mCheckboxes == true)
if (mCheckboxes)
{
holder.selected.setVisibility(View.VISIBLE);
}
@ -2440,7 +2440,7 @@ public class MessageList
}
else
{
if (mCurrentFolder.lastCheckFailed == false)
if (!mCurrentFolder.lastCheckFailed)
{
holder.main.setText(String.format(getString(R.string.load_more_messages_fmt), mAccount.getDisplayCount()));
}
@ -2513,7 +2513,7 @@ public class MessageList
message.selected = isChecked;
if (!mCheckboxes)
{
if (isChecked == true)
if (isChecked)
{
selected.setVisibility(View.VISIBLE);
}
@ -2779,7 +2779,7 @@ public class MessageList
private void onMoveBatch()
{
if (mController.isMoveCapable(mAccount) == false)
if (!mController.isMoveCapable(mAccount))
{
return;
}
@ -2791,7 +2791,7 @@ public class MessageList
if (holder.selected)
{
Message message = holder.message;
if (mController.isMoveCapable(message) == false)
if (!mController.isMoveCapable(message))
{
Toast toast = Toast.makeText(this,
R.string.move_copy_cannot_copy_unsynced_message, Toast.LENGTH_LONG);
@ -2812,7 +2812,7 @@ public class MessageList
private void onMoveChosenBatch(String folderName)
{
if (mController.isMoveCapable(mAccount) == false)
if (!mController.isMoveCapable(mAccount))
{
return;
}
@ -2826,7 +2826,7 @@ public class MessageList
if (holder.selected)
{
Message message = holder.message;
if (mController.isMoveCapable(message) == false)
if (!mController.isMoveCapable(message))
{
Toast toast = Toast.makeText(this,
R.string.move_copy_cannot_copy_unsynced_message, Toast.LENGTH_LONG);
@ -2847,7 +2847,7 @@ public class MessageList
private void onArchiveBatch()
{
if (mController.isMoveCapable(mAccount) == false)
if (!mController.isMoveCapable(mAccount))
{
return;
}
@ -2859,7 +2859,7 @@ public class MessageList
if (holder.selected)
{
Message message = holder.message;
if (mController.isMoveCapable(message) == false)
if (!mController.isMoveCapable(message))
{
Toast toast = Toast.makeText(this, R.string.move_copy_cannot_copy_unsynced_message, Toast.LENGTH_LONG);
toast.show();
@ -2879,7 +2879,7 @@ public class MessageList
private void onSpamBatch()
{
if (mController.isMoveCapable(mAccount) == false)
if (!mController.isMoveCapable(mAccount))
{
return;
}
@ -2891,7 +2891,7 @@ public class MessageList
if (holder.selected)
{
Message message = holder.message;
if (mController.isMoveCapable(message) == false)
if (!mController.isMoveCapable(message))
{
Toast toast = Toast.makeText(this, R.string.move_copy_cannot_copy_unsynced_message, Toast.LENGTH_LONG);
toast.show();
@ -2911,7 +2911,7 @@ public class MessageList
private void onCopyBatch()
{
if (mController.isCopyCapable(mAccount) == false)
if (!mController.isCopyCapable(mAccount))
{
return;
}
@ -2923,7 +2923,7 @@ public class MessageList
if (holder.selected)
{
Message message = holder.message;
if (mController.isCopyCapable(message) == false)
if (!mController.isCopyCapable(message))
{
Toast toast = Toast.makeText(this,
R.string.move_copy_cannot_copy_unsynced_message, Toast.LENGTH_LONG);
@ -2944,7 +2944,7 @@ public class MessageList
private void onCopyChosenBatch(String folderName)
{
if (mController.isCopyCapable(mAccount) == false)
if (!mController.isCopyCapable(mAccount))
{
return;
}
@ -2957,7 +2957,7 @@ public class MessageList
if (holder.selected)
{
Message message = holder.message;
if (mController.isCopyCapable(message) == false)
if (!mController.isCopyCapable(message))
{
Toast toast = Toast.makeText(this,
R.string.move_copy_cannot_copy_unsynced_message, Toast.LENGTH_LONG);

View File

@ -203,7 +203,7 @@ public class MessageView extends K9Activity implements OnClickListener
{
ret = onKeyDown(event.getKeyCode(), event);
}
if (ret == false)
if (!ret)
{
ret = super.dispatchKeyEvent(event);
}
@ -1859,11 +1859,11 @@ public class MessageView extends K9Activity implements OnClickListener
getMenuInflater().inflate(R.menu.message_view_option, menu);
optionsMenu = menu;
prepareMenuItems();
if (MessagingController.getInstance(getApplication()).isCopyCapable(mAccount) == false)
if (!MessagingController.getInstance(getApplication()).isCopyCapable(mAccount))
{
menu.findItem(R.id.copy).setVisible(false);
}
if (MessagingController.getInstance(getApplication()).isMoveCapable(mAccount) == false)
if (!MessagingController.getInstance(getApplication()).isMoveCapable(mAccount))
{
menu.findItem(R.id.move).setVisible(false);
menu.findItem(R.id.archive).setVisible(false);
@ -2220,7 +2220,7 @@ public class MessageView extends K9Activity implements OnClickListener
// If the message contains external pictures and the "Show pictures"
// button wasn't already pressed, see if the user's preferences has us
// showing them anyway.
if (hasExternalImages(text) && (mShowPictures == false))
if (hasExternalImages(text) && !mShowPictures)
{
if ((account.getShowPictures() == Account.ShowPictures.ALWAYS) ||
((account.getShowPictures() == Account.ShowPictures.ONLY_FROM_CONTACTS) &&
@ -2558,7 +2558,7 @@ public class MessageView extends K9Activity implements OnClickListener
mCryptoSignatureLayout.setVisibility(View.INVISIBLE);
}
if (!true || ((mMessage == null) && (mPgpData.getDecryptedData() == null)))
if (false || ((mMessage == null) && (mPgpData.getDecryptedData() == null)))
{
mDecryptLayout.setVisibility(View.GONE);
return;

View File

@ -594,7 +594,7 @@ public class MessagingController implements Runnable
public void messageFinished(Message message, int number, int ofTotal)
{
if (isMessageSuppressed(account, folder, message) == false)
if (!isMessageSuppressed(account, folder, message))
{
pendingMessages.add(message);
totalDone++;
@ -717,17 +717,17 @@ public class MessagingController implements Runnable
boolean noSpecialFolders = true;
for (final Account account : accounts)
{
if (accountUuids != null && accountUuidsSet.contains(account.getUuid()) == false)
if (accountUuids != null && !accountUuidsSet.contains(account.getUuid()))
{
continue;
}
if (accountUuids != null && accountUuidsSet.contains(account.getUuid()) == true)
if (accountUuids != null && accountUuidsSet.contains(account.getUuid()))
{
displayableOnly = true;
noSpecialFolders = true;
}
else if (integrate == false && folderNames == null)
else if (!integrate && folderNames == null)
{
Account.Searchable searchableFolders = account.getSearchableFolders();
switch (searchableFolders)
@ -791,7 +791,7 @@ public class MessagingController implements Runnable
{
if (folderNameSet != null)
{
if (folderNameSet.contains(localFolderName) == false)
if (!folderNameSet.contains(localFolderName))
{
include = false;
@ -837,7 +837,7 @@ public class MessagingController implements Runnable
public void messageStarted(String message, int number, int ofTotal) {}
public void messageFinished(Message message, int number, int ofTotal)
{
if (isMessageSuppressed(message.getFolder().getAccount(), message.getFolder().getName(), message) == false)
if (!isMessageSuppressed(message.getFolder().getAccount(), message.getFolder().getName(), message))
{
List<Message> messages = new ArrayList<Message>();
@ -1125,7 +1125,7 @@ public class MessagingController implements Runnable
l.synchronizeMailboxHeadersProgress(account, folder, headerProgress.get(), messageCount);
}
Message localMessage = localUidMap.get(thisMess.getUid());
if (localMessage == null || localMessage.olderThan(earliestDate) == false)
if (localMessage == null || !localMessage.olderThan(earliestDate))
{
remoteMessages.add(thisMess);
remoteUidMap.put(thisMess.getUid(), thisMess);
@ -1303,7 +1303,7 @@ public class MessagingController implements Runnable
Message[] messages = localFolder.getMessages(null, false);
for (Message message : messages)
{
if (message.isSet(Flag.SEEN) == false && message.isSet(Flag.DELETED) == false)
if (!message.isSet(Flag.SEEN) && !message.isSet(Flag.DELETED))
{
unreadCount++;
}
@ -1326,7 +1326,7 @@ public class MessagingController implements Runnable
Message[] messages = localFolder.getMessages(null, false);
for (Message message : messages)
{
if (message.isSet(Flag.FLAGGED) == true && message.isSet(Flag.DELETED) == false)
if (message.isSet(Flag.FLAGGED) && !message.isSet(Flag.DELETED))
{
flaggedCount++;
}
@ -1372,7 +1372,7 @@ public class MessagingController implements Runnable
{
syncFlagMessages.add(message);
}
else if (isMessageSuppressed(account, folder, message) == false)
else if (!isMessageSuppressed(account, folder, message))
{
Message localMessage = localFolder.getMessage(message.getUid());
@ -1411,7 +1411,7 @@ public class MessagingController implements Runnable
}
}
}
else if (localMessage.isSet(Flag.DELETED) == false)
else if (!localMessage.isSet(Flag.DELETED))
{
if (K9.DEBUG)
Log.v(K9.LOG_TAG, "Message with uid " + message.getUid() + " is present in the local store");
@ -1623,7 +1623,7 @@ public class MessagingController implements Runnable
* (POP) may not be able to give us headers for
* ENVELOPE, only size.
*/
if (isMessageSuppressed(account, folder, message) == false)
if (!isMessageSuppressed(account, folder, message))
{
// Store the new message locally
localFolder.appendMessages(new Message[]
@ -1924,7 +1924,7 @@ public class MessagingController implements Runnable
List<Message> undeletedMessages = new LinkedList<Message>();
for (Message message : syncFlagMessages)
{
if (message.isSet(Flag.DELETED) == false)
if (!message.isSet(Flag.DELETED))
{
undeletedMessages.add(message);
}
@ -2406,7 +2406,7 @@ public class MessagingController implements Runnable
Log.d(K9.LOG_TAG, "processingPendingMoveOrCopy: source folder = " + srcFolder
+ ", " + messages.size() + " messages, destination folder = " + destFolder + ", isCopy = " + isCopy);
if (isCopy == false && destFolder.equals(account.getTrashFolderName()))
if (!isCopy && destFolder.equals(account.getTrashFolderName()))
{
if (K9.DEBUG)
Log.d(K9.LOG_TAG, "processingPendingMoveOrCopy doing special case for deleting message");
@ -2431,7 +2431,7 @@ public class MessagingController implements Runnable
remoteSrcFolder.moveMessages(messages.toArray(EMPTY_MESSAGE_ARRAY), remoteDestFolder);
}
}
if (isCopy == false && Account.EXPUNGE_IMMEDIATELY.equals(account.getExpungePolicy()))
if (!isCopy && Account.EXPUNGE_IMMEDIATELY.equals(account.getExpungePolicy()))
{
if (K9.DEBUG)
Log.i(K9.LOG_TAG, "processingPendingMoveOrCopy expunging folder " + account.getDescription() + ":" + srcFolder);
@ -2698,7 +2698,7 @@ public class MessagingController implements Runnable
Log.d(K9.LOG_TAG, "processPendingMoveOrCopyOld: source folder = " + srcFolder
+ ", uid = " + uid + ", destination folder = " + destFolder + ", isCopy = " + isCopy);
if (isCopy == false && destFolder.equals(account.getTrashFolderName()))
if (!isCopy && destFolder.equals(account.getTrashFolderName()))
{
if (K9.DEBUG)
Log.d(K9.LOG_TAG, "processPendingMoveOrCopyOld doing special case for deleting message");
@ -2739,7 +2739,7 @@ public class MessagingController implements Runnable
Message[] messages = localFolder.getMessages(null, false);
for (Message message : messages)
{
if (message.isSet(Flag.SEEN) == false)
if (!message.isSet(Flag.SEEN))
{
message.setFlag(Flag.SEEN, true);
for (MessagingListener l : getListeners())
@ -2797,7 +2797,7 @@ public class MessagingController implements Runnable
static AtomicBoolean loopCatch = new AtomicBoolean();
public void addErrorMessage(Account account, String subject, Throwable t)
{
if (loopCatch.compareAndSet(false, true) == false)
if (!loopCatch.compareAndSet(false, true))
{
return;
}
@ -2832,11 +2832,11 @@ public class MessagingController implements Runnable
public void addErrorMessage(Account account, String subject, String body)
{
if (K9.ENABLE_ERROR_FOLDER == false)
if (!K9.ENABLE_ERROR_FOLDER)
{
return;
}
if (loopCatch.compareAndSet(false, true) == false)
if (!loopCatch.compareAndSet(false, true))
{
return;
}
@ -2937,7 +2937,7 @@ public class MessagingController implements Runnable
for (String uid : uids)
{
// Allows for re-allowing sending of messages that could not be sent
if (flag == Flag.FLAGGED && newState == false
if (flag == Flag.FLAGGED && !newState
&& uid != null
&& account.getOutboxFolderName().equals(folderName))
{
@ -3513,7 +3513,7 @@ public class MessagingController implements Runnable
if (e instanceof MessagingException)
{
MessagingException me = (MessagingException)e;
if (me.isPermanentFailure() == false)
if (!me.isPermanentFailure())
{
// Decrement the counter if the message could not possibly have been sent
int newVal = count.decrementAndGet();
@ -3754,11 +3754,11 @@ public class MessagingController implements Runnable
{
Store localStore = account.getLocalStore();
Store remoteStore = account.getRemoteStore();
if (isCopy == false && (remoteStore.isMoveCapable() == false || localStore.isMoveCapable() == false))
if (!isCopy && (!remoteStore.isMoveCapable() || !localStore.isMoveCapable()))
{
return;
}
if (isCopy == true && (remoteStore.isCopyCapable() == false || localStore.isCopyCapable() == false))
if (isCopy && (!remoteStore.isCopyCapable() || !localStore.isCopyCapable()))
{
return;
}
@ -4195,7 +4195,7 @@ public class MessagingController implements Runnable
for (final Account account : accounts)
{
final long accountInterval = account.getAutomaticCheckIntervalMinutes() * 60 * 1000;
if (ignoreLastCheckedTime == false && accountInterval <= 0)
if (!ignoreLastCheckedTime && accountInterval <= 0)
{
if (K9.DEBUG)
Log.i(K9.LOG_TAG, "Skipping synchronizing account " + account.getDescription());
@ -4287,7 +4287,7 @@ public class MessagingController implements Runnable
Log.v(K9.LOG_TAG, "Folder " + folder.getName() + " was last synced @ " +
new Date(folder.getLastChecked()));
if (ignoreLastCheckedTime == false && folder.getLastChecked() >
if (!ignoreLastCheckedTime && folder.getLastChecked() >
(System.currentTimeMillis() - accountInterval))
{
if (K9.DEBUG)
@ -4310,7 +4310,7 @@ public class MessagingController implements Runnable
tLocalFolder = localStore.getFolder(folder.getName());
tLocalFolder.open(Folder.OpenMode.READ_WRITE);
if (ignoreLastCheckedTime == false && tLocalFolder.getLastChecked() >
if (!ignoreLastCheckedTime && tLocalFolder.getLastChecked() >
(System.currentTimeMillis() - accountInterval))
{
if (K9.DEBUG)
@ -4587,7 +4587,7 @@ public class MessagingController implements Runnable
if (from != null)
{
// Show From: address by default
if (account.isAnIdentity(fromAddrs) == false)
if (!account.isAnIdentity(fromAddrs))
{
messageNotice.append(from + ": " + subject);
}
@ -4792,11 +4792,11 @@ public class MessagingController implements Runnable
@Override
public int compareTo(Command other)
{
if (other.isForeground == true && isForeground == false)
if (other.isForeground && !isForeground)
{
return 1;
}
else if (other.isForeground == false && isForeground == true)
else if (!other.isForeground && isForeground)
{
return -1;
}
@ -4931,7 +4931,7 @@ public class MessagingController implements Runnable
try
{
Store store = account.getRemoteStore();
if (store.isPushCapable() == false)
if (!store.isPushCapable())
{
if (K9.DEBUG)
Log.i(K9.LOG_TAG, "Account " + account.getDescription() + " is not push capable, skipping");

View File

@ -45,7 +45,7 @@ public abstract class Message implements Part, Body
@Override
public boolean equals(Object o)
{
if (o == null || o instanceof Message == false)
if (o == null || !(o instanceof Message))
{
return false;
}

View File

@ -266,7 +266,7 @@ public class ImapStore extends Store
try
{
List<? extends Folder> allFolders = listFolders(connection, false);
if (forceListAll || mAccount.subscribedFoldersOnly() == false)
if (forceListAll || !mAccount.subscribedFoldersOnly())
{
return allFolders;
}
@ -810,7 +810,7 @@ public class ImapStore extends Store
@Override
public void copyMessages(Message[] messages, Folder folder) throws MessagingException
{
if (folder instanceof ImapFolder == false)
if (!(folder instanceof ImapFolder))
{
throw new MessagingException("ImapFolder.copyMessages passed non-ImapFolder");
}
@ -2188,7 +2188,7 @@ public class ImapStore extends Store
nullResponses.add(nullResponse);
receiveCapabilities(nullResponses);
if (hasCapability(CAPABILITY_CAPABILITY) == false)
if (!hasCapability(CAPABILITY_CAPABILITY))
{
if (K9.DEBUG)
Log.i(K9.LOG_TAG, "Did not get capabilities in banner, requesting CAPABILITY for " + getLogId());
@ -2412,7 +2412,7 @@ public class ImapStore extends Store
}
finally
{
if (authSuccess == false)
if (!authSuccess)
{
Log.e(K9.LOG_TAG, "Failed to login, closing connection for " + getLogId());
close();
@ -2696,7 +2696,7 @@ public class ImapStore extends Store
if (K9.DEBUG && K9.DEBUG_PROTOCOL_IMAP)
Log.v(K9.LOG_TAG, getLogId() + "<<<" + response);
if (response.mTag != null && response.mTag.equalsIgnoreCase(tag) == false)
if (response.mTag != null && !response.mTag.equalsIgnoreCase(tag))
{
Log.w(K9.LOG_TAG, "After sending tag " + tag + ", got tag response from previous command " + response + " for " + getLogId());
Iterator<ImapResponse> iter = responses.iterator();
@ -2704,7 +2704,7 @@ public class ImapStore extends Store
{
ImapResponse delResponse = iter.next();
if (delResponse.mTag != null || delResponse.size() < 2
|| (ImapResponseParser.equalsIgnoreCase(delResponse.get(1), "EXISTS") == false && ImapResponseParser.equalsIgnoreCase(delResponse.get(1), "EXPUNGE") == false))
|| (!ImapResponseParser.equalsIgnoreCase(delResponse.get(1), "EXISTS") && !ImapResponseParser.equalsIgnoreCase(delResponse.get(1), "EXPUNGE")))
{
iter.remove();
}
@ -2839,7 +2839,7 @@ public class ImapStore extends Store
private void sendDone() throws IOException, MessagingException
{
if (doneSent.compareAndSet(false, true) == true)
if (doneSent.compareAndSet(false, true))
{
ImapConnection conn = mConnection;
if (conn != null)
@ -2871,7 +2871,7 @@ public class ImapStore extends Store
if (K9.DEBUG)
Log.i(K9.LOG_TAG, "Pusher starting for " + getLogId());
while (stop.get() != true)
while (!stop.get())
{
try
{
@ -2897,14 +2897,14 @@ public class ImapStore extends Store
throw new MessagingException("Could not establish connection for IDLE");
}
if (conn.isIdleCapable() == false)
if (!conn.isIdleCapable())
{
stop.set(true);
receiver.pushError("IMAP server is not IDLE capable: " + conn.toString(), null);
throw new MessagingException("IMAP server is not IDLE capable:" + conn.toString());
}
if (stop.get() != true && mAccount.isPushPollOnConnect() && (conn != oldConnection || needsPoll.getAndSet(false) == true))
if (!stop.get() && mAccount.isPushPollOnConnect() && (conn != oldConnection || needsPoll.getAndSet(false)))
{
List<ImapResponse> untaggedResponses = new ArrayList<ImapResponse>(storedUntaggedResponses);
storedUntaggedResponses.clear();
@ -2915,7 +2915,7 @@ public class ImapStore extends Store
}
receiver.syncFolder(ImapFolderPusher.this);
}
if (stop.get() == true)
if (stop.get())
{
continue;
}
@ -3010,7 +3010,7 @@ public class ImapStore extends Store
{
Log.e(K9.LOG_TAG, "Got exception while closing for exception for " + getLogId(), me);
}
if (stop.get() == true)
if (stop.get())
{
Log.i(K9.LOG_TAG, "Got exception while idling, but stop is set for " + getLogId());
}
@ -3091,7 +3091,7 @@ public class ImapStore extends Store
{
oldMessageCount += processUntaggedResponse(oldMessageCount, response, flagSyncMsgSeqs, removeMsgUids);
}
if (skipSync == false)
if (!skipSync)
{
if (oldMessageCount < 0)
{
@ -3242,7 +3242,7 @@ public class ImapStore extends Store
if (K9.DEBUG)
Log.d(K9.LOG_TAG, "Got untagged FETCH for msgseq " + msgSeq + " for " + getLogId());
if (flagSyncMsgSeqs.contains(msgSeq) == false)
if (!flagSyncMsgSeqs.contains(msgSeq))
{
flagSyncMsgSeqs.add(msgSeq);
}
@ -3366,7 +3366,7 @@ public class ImapStore extends Store
if (K9.DEBUG)
Log.v(K9.LOG_TAG, "Got async response: " + response);
if (stop.get() == true)
if (stop.get())
{
if (K9.DEBUG)
Log.d(K9.LOG_TAG, "Got async untagged response: " + response + ", but stop is set for " + getLogId());
@ -3391,7 +3391,7 @@ public class ImapStore extends Store
if (ImapResponseParser.equalsIgnoreCase(responseType, "EXISTS") || ImapResponseParser.equalsIgnoreCase(responseType, "EXPUNGE") ||
ImapResponseParser.equalsIgnoreCase(responseType,"FETCH"))
{
if (started == false)
if (!started)
{
wakeLock.acquire(K9.PUSH_WAKE_LOCK_TIMEOUT);
started = true;

View File

@ -695,7 +695,7 @@ public class LocalStore extends Store implements Serializable
for (String queryField : queryFields)
{
if (anyAdded == true)
if (anyAdded)
{
whereClause.append(" OR ");
}
@ -713,7 +713,7 @@ public class LocalStore extends Store implements Serializable
boolean anyAdded = false;
for (LocalFolder folder : folders)
{
if (anyAdded == true)
if (anyAdded)
{
whereClause.append(",");
}
@ -729,7 +729,7 @@ public class LocalStore extends Store implements Serializable
boolean anyAdded = false;
for (Message message : messages)
{
if (anyAdded == true)
if (anyAdded)
{
whereClause.append(" OR ");
}
@ -746,7 +746,7 @@ public class LocalStore extends Store implements Serializable
boolean anyAdded = false;
for (Flag flag : forbiddenFlags)
{
if (anyAdded == true)
if (anyAdded)
{
whereClause.append(" AND ");
}
@ -763,7 +763,7 @@ public class LocalStore extends Store implements Serializable
boolean anyAdded = false;
for (Flag flag : requiredFlags)
{
if (anyAdded == true)
if (anyAdded)
{
whereClause.append(" OR ");
}
@ -973,7 +973,7 @@ public class LocalStore extends Store implements Serializable
if (cursor.moveToFirst())
{
int folderId = cursor.getInt(0);
return (folderId > 0) ? true : false;
return (folderId > 0);
}
else
{
@ -1748,11 +1748,11 @@ public class LocalStore extends Store implements Serializable
else
{
Message oldMessage = getMessage(uid);
if (oldMessage != null && oldMessage.isSet(Flag.SEEN) == false)
if (oldMessage != null && !oldMessage.isSet(Flag.SEEN))
{
setUnreadMessageCount(getUnreadMessageCount() - 1);
}
if (oldMessage != null && oldMessage.isSet(Flag.FLAGGED) == true)
if (oldMessage != null && oldMessage.isSet(Flag.FLAGGED))
{
setFlaggedMessageCount(getFlaggedMessageCount() - 1);
}
@ -1831,11 +1831,11 @@ public class LocalStore extends Store implements Serializable
saveAttachment(messageUid, attachment, copy);
}
saveHeaders(messageUid, (MimeMessage)message);
if (message.isSet(Flag.SEEN) == false)
if (!message.isSet(Flag.SEEN))
{
setUnreadMessageCount(getUnreadMessageCount() + 1);
}
if (message.isSet(Flag.FLAGGED) == true)
if (message.isSet(Flag.FLAGGED))
{
setFlaggedMessageCount(getFlaggedMessageCount() + 1);
}
@ -2218,11 +2218,11 @@ public class LocalStore extends Store implements Serializable
Message[] messages = getMessages(null);
for (Message message : messages)
{
if (message.isSet(Flag.SEEN) == false)
if (!message.isSet(Flag.SEEN))
{
newUnread++;
}
if (message.isSet(Flag.FLAGGED) == true)
if (message.isSet(Flag.FLAGGED))
{
newFlagged++;
}
@ -4607,7 +4607,7 @@ public class LocalStore extends Store implements Serializable
catch (Exception e)
{
if ("X_BAD_FLAG".equals(flag) == false)
if (!"X_BAD_FLAG".equals(flag))
{
Log.w(K9.LOG_TAG, "Unable to parse flag " + flag);
}

View File

@ -203,7 +203,7 @@ public class WebDavStore extends Store
}
}
String path = mPath;
if (path.length() > 0 && path.startsWith("/") == false)
if (path.length() > 0 && !path.startsWith("/"))
{
path = "/" + mPath;
}
@ -570,7 +570,7 @@ public class WebDavStore extends Store
{
boolean status = false;
long currentTime = -1;
if (this.mAuthenticated == false)
if (!this.mAuthenticated)
{
status = true;
}
@ -990,7 +990,7 @@ public class WebDavStore extends Store
else
{
if (tryAuth &&
mAuthenticated == false)
!mAuthenticated)
{
doFBA();
sendRequest(url, method, messageBody, headers, false);
@ -1217,7 +1217,7 @@ public class WebDavStore extends Store
encodedName = "Inbox";
}
this.mFolderUrl = WebDavStore.this.mUrl;
if (WebDavStore.this.mUrl.endsWith("/") == false)
if (!WebDavStore.this.mUrl.endsWith("/"))
{
this.mFolderUrl += "/";
}
@ -1994,7 +1994,7 @@ public class WebDavStore extends Store
bodyEntity.setContentType("message/rfc822");
String messageURL = mFolderUrl;
if (messageURL.endsWith("/") == false)
if (!messageURL.endsWith("/"))
{
messageURL += "/";
}
@ -2412,7 +2412,7 @@ public class WebDavStore extends Store
if (readStatus != null &&
!readStatus.equals(""))
{
Boolean value = readStatus.equals("0") ? false : true;
Boolean value = !readStatus.equals("0");
uidToRead.put(uid, value);
}
}
@ -2494,7 +2494,7 @@ public class WebDavStore extends Store
if (header.equals("read"))
{
String read = data.get(header);
Boolean readStatus = read.equals("0") ? false : true;
Boolean readStatus = !read.equals("0");
envelope.setReadStatus(readStatus);
}

View File

@ -247,15 +247,15 @@ public class SmtpTransport extends Transport
boolean authCramMD5Supported = false;
for (String result : results)
{
if (result.matches(".*AUTH.*LOGIN.*$") == true)
if (result.matches(".*AUTH.*LOGIN.*$"))
{
authLoginSupported = true;
}
if (result.matches(".*AUTH.*PLAIN.*$") == true)
if (result.matches(".*AUTH.*PLAIN.*$"))
{
authPlainSupported = true;
}
if (result.matches(".*AUTH.*CRAM-MD5.*$") == true && mAuthType != null && mAuthType.equals("CRAM_MD5"))
if (result.matches(".*AUTH.*CRAM-MD5.*$") && mAuthType != null && mAuthType.equals("CRAM_MD5"))
{
authCramMD5Supported = true;
}

View File

@ -93,7 +93,7 @@ public class Editor implements android.content.SharedPreferences.Editor
String key = entry.getKey();
String newValue = entry.getValue();
String oldValue = snapshot.get(key);
if (removeAll || removals.contains(key) || newValue.equals(oldValue) != true)
if (removeAll || removals.contains(key) || !newValue.equals(oldValue))
{
storage.put(key, newValue);
}

View File

@ -247,7 +247,7 @@ public class Storage implements SharedPreferences
private void keyChange(String key)
{
ArrayList<String> changedKeys = workingChangedKeys.get();
if (changedKeys.contains(key) == false)
if (!changedKeys.contains(key))
{
changedKeys.add(key);
}

View File

@ -247,7 +247,7 @@ public class MailService extends CoreService
if (true) return;
NotificationManager notifMgr =
(NotificationManager)getApplication().getSystemService(Context.NOTIFICATION_SERVICE);
if (hasConnectivity == false)
if (!hasConnectivity)
{
String notice = getApplication().getString(R.string.no_connection_alert);
String header = getApplication().getString(R.string.alert_header);
@ -343,7 +343,7 @@ public class MailService extends CoreService
else
{
long delay = (shortestInterval * (60 * 1000));
long base = (previousInterval == -1 || lastCheckEnd == -1 || considerLastCheckEnd == false ? System.currentTimeMillis() : lastCheckEnd);
long base = (previousInterval == -1 || lastCheckEnd == -1 || !considerLastCheckEnd ? System.currentTimeMillis() : lastCheckEnd);
long nextTime = base + delay;
if (K9.DEBUG)
Log.i(K9.LOG_TAG,

View File

@ -49,7 +49,7 @@ public class SleepService extends CoreService
try
{
boolean countedDown = latch.await(sleepTime, TimeUnit.MILLISECONDS);
if (countedDown == false)
if (!countedDown)
{
if (K9.DEBUG)
Log.d(K9.LOG_TAG, "SleepService latch timed out for id = " + id + ", thread " + Thread.currentThread().getName());
@ -66,7 +66,7 @@ public class SleepService extends CoreService
{
if (K9.DEBUG)
Log.d(K9.LOG_TAG, "SleepService waiting for reacquireLatch for id = " + id + ", thread " + Thread.currentThread().getName());
if (sleepDatum.reacquireLatch.await(5000, TimeUnit.MILLISECONDS) == false)
if (!sleepDatum.reacquireLatch.await(5000, TimeUnit.MILLISECONDS))
{
Log.w(K9.LOG_TAG, "SleepService reacquireLatch timed out for id = " + id + ", thread " + Thread.currentThread().getName());
}