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

ant astyle

This commit is contained in:
Jesse Vincent 2011-06-01 16:03:56 -04:00
parent 0c2e06133c
commit 3d583da450
12 changed files with 156 additions and 161 deletions

View File

@ -34,7 +34,7 @@ public class ActivityListener extends MessagingListener {
if (mLoadingFolderName != null || mLoadingHeaderFolderName != null) {
String displayName = mLoadingFolderName;
if ((mAccount != null) && (mAccount.getInboxFolderName()!= null) && mAccount.getInboxFolderName().equalsIgnoreCase(displayName)) {
if ((mAccount != null) && (mAccount.getInboxFolderName() != null) && mAccount.getInboxFolderName().equalsIgnoreCase(displayName)) {
displayName = context.getString(R.string.special_mailbox_name_inbox);
} else if ((mAccount != null) && mAccount.getOutboxFolderName().equals(displayName)) {
displayName = context.getString(R.string.special_mailbox_name_outbox);

View File

@ -1713,22 +1713,19 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
mQuotedText.setVisibility(View.GONE);
mQuotedHTML.setVisibility(View.GONE);
mQuotedTextEdit.setVisibility(View.GONE);
}
else if (mQuotedTextMode == QuotedTextMode.SHOW) {
} else if (mQuotedTextMode == QuotedTextMode.SHOW) {
mQuotedTextShow.setVisibility(View.GONE);
mQuotedTextBar.setVisibility(View.VISIBLE);
if (mMessageFormat == MessageFormat.HTML){
if (mMessageFormat == MessageFormat.HTML) {
mQuotedText.setVisibility(View.GONE);
mQuotedHTML.setVisibility(View.VISIBLE);
mQuotedTextEdit.setVisibility(View.VISIBLE);
}
else {
} else {
mQuotedText.setVisibility(View.VISIBLE);
mQuotedHTML.setVisibility(View.GONE);
mQuotedTextEdit.setVisibility(View.GONE);
}
}
else if (mQuotedTextMode == QuotedTextMode.HIDE) {
} else if (mQuotedTextMode == QuotedTextMode.HIDE) {
mQuotedTextShow.setVisibility(View.VISIBLE);
mQuotedTextBar.setVisibility(View.GONE);
@ -2106,10 +2103,10 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
}
int cursorPosition = 0;
if(k9identity.containsKey(IdentityField.CURSOR_POSITION)) {
if (k9identity.containsKey(IdentityField.CURSOR_POSITION)) {
try {
cursorPosition = Integer.valueOf(k9identity.get(IdentityField.CURSOR_POSITION)).intValue();
} catch(Exception e) {
} catch (Exception e) {
Log.e(K9.LOG_TAG, "Could not parse cursor position for MessageCompose; continuing.", e);
}
}
@ -2193,7 +2190,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
// Set the cursor position if we have it.
try {
mMessageContentView.setSelection(cursorPosition);
} catch(Exception e) {
} catch (Exception e) {
Log.e(K9.LOG_TAG, "Could not set cursor position in MessageCompose; ignoring.", e);
}
@ -2205,8 +2202,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
* the source message. Log it as an error, though.
*/
Log.e(K9.LOG_TAG, "Error while processing source message: ", me);
}
finally {
} finally {
mSourceMessageProcessed = true;
mDraftNeedsSaving = false;
}
@ -2236,8 +2232,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
if (shown) {
showOrHideQuotedText(QuotedTextMode.SHOW);
}
else {
} else {
showOrHideQuotedText(QuotedTextMode.HIDE);
}
}

View File

@ -252,7 +252,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
}
for (int i = 0; i < chain.length; i++) {
// display certificate chain information
//TODO: localize this strings
//TODO: localize this strings
chainInfo.append("Certificate chain[" + i + "]:\n");
chainInfo.append("Subject: " + chain[i].getSubjectDN().toString() + "\n");
@ -261,68 +261,68 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
// by a subjectDN not matching the server even though a
// SubjectAltName matches)
try {
final Collection<List<?>> subjectAlternativeNames = chain[i].getSubjectAlternativeNames();
if (subjectAlternativeNames != null) {
// The list of SubjectAltNames may be very long
//TODO: localize this string
StringBuffer altNamesText = new StringBuffer("Subject has " + subjectAlternativeNames.size() + " alternative names\n");
final Collection < List<? >> subjectAlternativeNames = chain[i].getSubjectAlternativeNames();
if (subjectAlternativeNames != null) {
// The list of SubjectAltNames may be very long
//TODO: localize this string
StringBuffer altNamesText = new StringBuffer("Subject has " + subjectAlternativeNames.size() + " alternative names\n");
// we need these for matching
String storeURIHost = (Uri.parse(mAccount.getStoreUri())).getHost();
String transportURIHost = (Uri.parse(mAccount.getTransportUri())).getHost();
// we need these for matching
String storeURIHost = (Uri.parse(mAccount.getStoreUri())).getHost();
String transportURIHost = (Uri.parse(mAccount.getTransportUri())).getHost();
for (List<?> subjectAlternativeName : subjectAlternativeNames) {
Integer type = (Integer)subjectAlternativeName.get(0);
Object value = subjectAlternativeName.get(1);
String name = "";
switch (type.intValue()) {
case 0:
Log.w(K9.LOG_TAG, "SubjectAltName of type OtherName not supported.");
continue;
case 1: // RFC822Name
name = (String)value;
break;
case 2: // DNSName
name = (String)value;
break;
case 3:
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of type x400Address");
continue;
case 4:
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of type directoryName");
continue;
case 5:
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of type ediPartyName");
continue;
case 6: // Uri
name = (String)value;
break;
case 7: // ip-address
name = (String)value;
break;
default:
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of unknown type");
continue;
}
for (List<?> subjectAlternativeName : subjectAlternativeNames) {
Integer type = (Integer)subjectAlternativeName.get(0);
Object value = subjectAlternativeName.get(1);
String name = "";
switch (type.intValue()) {
case 0:
Log.w(K9.LOG_TAG, "SubjectAltName of type OtherName not supported.");
continue;
case 1: // RFC822Name
name = (String)value;
break;
case 2: // DNSName
name = (String)value;
break;
case 3:
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of type x400Address");
continue;
case 4:
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of type directoryName");
continue;
case 5:
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of type ediPartyName");
continue;
case 6: // Uri
name = (String)value;
break;
case 7: // ip-address
name = (String)value;
break;
default:
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of unknown type");
continue;
}
// if some of the SubjectAltNames match the store or transport -host,
// display them
if (name.equalsIgnoreCase(storeURIHost) || name.equalsIgnoreCase(transportURIHost)) {
//TODO: localize this string
altNamesText.append("Subject(alt): " + name + ",...\n");
} else if (name.startsWith("*.")) {
if (storeURIHost.endsWith(name.substring(2)) || transportURIHost.endsWith(name.substring(2))) {
//TODO: localize this string
altNamesText.append("Subject(alt): " + name + ",...\n");
}
}
}
chainInfo.append(altNamesText);
}
} catch (Exception e1) {
// don't fail just because of subjectAltNames
Log.w(K9.LOG_TAG, "cannot display SubjectAltNames in dialog", e1);
}
// if some of the SubjectAltNames match the store or transport -host,
// display them
if (name.equalsIgnoreCase(storeURIHost) || name.equalsIgnoreCase(transportURIHost)) {
//TODO: localize this string
altNamesText.append("Subject(alt): " + name + ",...\n");
} else if (name.startsWith("*.")) {
if (storeURIHost.endsWith(name.substring(2)) || transportURIHost.endsWith(name.substring(2))) {
//TODO: localize this string
altNamesText.append("Subject(alt): " + name + ",...\n");
}
}
}
chainInfo.append(altNamesText);
}
} catch (Exception e1) {
// don't fail just because of subjectAltNames
Log.w(K9.LOG_TAG, "cannot display SubjectAltNames in dialog", e1);
}
chainInfo.append("Issuer: " + chain[i].getIssuerDN().toString() + "\n");
if (sha1 != null) {

View File

@ -3930,7 +3930,7 @@ public class MessagingController implements Runnable {
if (messageUid <= localFolder.getLastUid()) {
if (K9.DEBUG)
Log.d(K9.LOG_TAG, "Message uid is " + messageUid + ", max message uid is " +
localFolder.getLastUid() + ". Skipping notification.");
localFolder.getLastUid() + ". Skipping notification.");
return false;
}
} catch (NumberFormatException e) {
@ -3953,7 +3953,7 @@ public class MessagingController implements Runnable {
* Creates a notification of a newly received message.
*/
private void notifyAccount(Context context, Account account, Message message,
int previousUnreadMessageCount, AtomicInteger newMessageCount) {
int previousUnreadMessageCount, AtomicInteger newMessageCount) {
// If we have a message, set the notification to "<From>: <Subject>"
StringBuilder messageNotice = new StringBuilder();

View File

@ -19,11 +19,12 @@ public class FileBrowserHelper {
* A string array that specifies the name of the intent to use, and the scheme to use with it
* when setting the data for the intent.
*/
private static final String[][] PICK_DIRECTORY_INTENTS =
{ { "org.openintents.action.PICK_DIRECTORY", "file://" }, // OI File Manager (maybe others)
{ "com.estrongs.action.PICK_DIRECTORY", "file://" }, // ES File Explorer
{ Intent.ACTION_PICK, "folder://" }, // Blackmoon File Browser (maybe others)
{ "com.androidworkz.action.PICK_DIRECTORY", "file://" }}; // SystemExplorer
private static final String[][] PICK_DIRECTORY_INTENTS = {
{ "org.openintents.action.PICK_DIRECTORY", "file://" }, // OI File Manager (maybe others)
{ "com.estrongs.action.PICK_DIRECTORY", "file://" }, // ES File Explorer
{ Intent.ACTION_PICK, "folder://" }, // Blackmoon File Browser (maybe others)
{ "com.androidworkz.action.PICK_DIRECTORY", "file://" }
}; // SystemExplorer
private static FileBrowserHelper sInstance;
@ -82,15 +83,15 @@ public class FileBrowserHelper {
do {
String intentAction = PICK_DIRECTORY_INTENTS[listIndex][0];
String uriPrefix = PICK_DIRECTORY_INTENTS[listIndex][1];
Intent intent = new Intent(intentAction);
intent.setData(Uri.parse(uriPrefix + startPath.getPath()));
Intent intent = new Intent(intentAction);
intent.setData(Uri.parse(uriPrefix + startPath.getPath()));
try {
try {
c.startActivityForResult(intent, requestcode);
success = true;
} catch (ActivityNotFoundException e) {
// Try the next intent in the list
listIndex++;
// Try the next intent in the list
listIndex++;
};
} while (!success && (listIndex < PICK_DIRECTORY_INTENTS.length));

View File

@ -382,7 +382,7 @@ public class ImapStore extends Store {
decodedFolderName = decodeFolderName(response.getString(3));
} catch (CharacterCodingException e) {
Log.w(K9.LOG_TAG, "Folder name not correctly encoded with the UTF-7 variant " +
"as defined by RFC 3501: " + response.getString(3), e);
"as defined by RFC 3501: " + response.getString(3), e);
//TODO: Use the raw name returned by the server for all commands that require
// a folder name. Use the decoded name only for showing it to the user.

View File

@ -505,53 +505,53 @@ public class LocalStore extends Store implements Serializable {
// Always count messages in the INBOX but exclude special folders and possibly
// more (depending on the folder display mode)
String baseQuery = "SELECT SUM(unread_count), SUM(flagged_count) " +
"FROM folders " +
"WHERE (name = ?)" + /* INBOX */
" OR (" +
"name NOT IN (?, ?, ?, ?, ?)" + /* special folders */
"%s)"; /* placeholder for additional constraints */
"FROM folders " +
"WHERE (name = ?)" + /* INBOX */
" OR (" +
"name NOT IN (?, ?, ?, ?, ?)" + /* special folders */
"%s)"; /* placeholder for additional constraints */
List<String> queryParam = new ArrayList<String>();
queryParam.add(mAccount.getInboxFolderName());
queryParam.add((mAccount.getTrashFolderName() != null) ?
mAccount.getTrashFolderName() : "");
mAccount.getTrashFolderName() : "");
queryParam.add((mAccount.getDraftsFolderName() != null) ?
mAccount.getDraftsFolderName() : "");
mAccount.getDraftsFolderName() : "");
queryParam.add((mAccount.getSpamFolderName() != null) ?
mAccount.getSpamFolderName() : "");
mAccount.getSpamFolderName() : "");
queryParam.add((mAccount.getOutboxFolderName() != null) ?
mAccount.getOutboxFolderName() : "");
mAccount.getOutboxFolderName() : "");
queryParam.add((mAccount.getSentFolderName() != null) ?
mAccount.getSentFolderName() : "");
mAccount.getSentFolderName() : "");
final String extraWhere;
switch (displayMode) {
case FIRST_CLASS:
// Count messages in the INBOX and non-special first class folders
extraWhere = " AND (display_class = ?)";
queryParam.add(Folder.FolderClass.FIRST_CLASS.name());
break;
case FIRST_AND_SECOND_CLASS:
// Count messages in the INBOX and non-special first and second class folders
extraWhere = " AND (display_class IN (?, ?))";
queryParam.add(Folder.FolderClass.FIRST_CLASS.name());
queryParam.add(Folder.FolderClass.SECOND_CLASS.name());
break;
case NOT_SECOND_CLASS:
// Count messages in the INBOX and non-special non-second-class folders
extraWhere = " AND (display_class != ?)";
queryParam.add(Folder.FolderClass.SECOND_CLASS.name());
break;
case ALL:
// Count messages in the INBOX and non-special folders
extraWhere = "";
break;
default:
Log.e(K9.LOG_TAG, "asked to compute account statistics for an impossible folder mode " + displayMode);
stats.unreadMessageCount = 0;
stats.flaggedMessageCount = 0;
return null;
case FIRST_CLASS:
// Count messages in the INBOX and non-special first class folders
extraWhere = " AND (display_class = ?)";
queryParam.add(Folder.FolderClass.FIRST_CLASS.name());
break;
case FIRST_AND_SECOND_CLASS:
// Count messages in the INBOX and non-special first and second class folders
extraWhere = " AND (display_class IN (?, ?))";
queryParam.add(Folder.FolderClass.FIRST_CLASS.name());
queryParam.add(Folder.FolderClass.SECOND_CLASS.name());
break;
case NOT_SECOND_CLASS:
// Count messages in the INBOX and non-special non-second-class folders
extraWhere = " AND (display_class != ?)";
queryParam.add(Folder.FolderClass.SECOND_CLASS.name());
break;
case ALL:
// Count messages in the INBOX and non-special folders
extraWhere = "";
break;
default:
Log.e(K9.LOG_TAG, "asked to compute account statistics for an impossible folder mode " + displayMode);
stats.unreadMessageCount = 0;
stats.flaggedMessageCount = 0;
return null;
}
String query = String.format(Locale.US, baseQuery, extraWhere);
@ -1671,7 +1671,7 @@ public class LocalStore extends Store implements Serializable {
bp.setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64");
if (name != null) {
String encoded_name = EncoderUtil.encodeIfNecessary(name,
EncoderUtil.Usage.WORD_ENTITY, 7);
EncoderUtil.Usage.WORD_ENTITY, 7);
bp.setHeader(MimeHeader.HEADER_CONTENT_TYPE,
String.format("%s;\n name=\"%s\"",
@ -2444,8 +2444,8 @@ public class LocalStore extends Store implements Serializable {
if (htmlContent != null) {
String newHtmlContent = htmlContent.replaceAll(
Pattern.quote("cid:" + contentId),
contentUri.toString());
Pattern.quote("cid:" + contentId),
contentUri.toString());
ContentValues cv = new ContentValues();
cv.put("html_content", newHtmlContent);

View File

@ -681,11 +681,11 @@ public class Pop3Store extends Store {
try {
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3 && !mCapabilities.top) {
Log.d(K9.LOG_TAG, "This server doesn't support the CAPA command. " +
"Checking to see if the TOP command is supported nevertheless.");
"Checking to see if the TOP command is supported nevertheless.");
}
response = executeSimpleCommand(String.format("TOP %d %d",
mUidToMsgNumMap.get(message.getUid()), lines));
mUidToMsgNumMap.get(message.getUid()), lines));
// TOP command is supported. Remember this for the next time.
mCapabilities.top = true;
@ -696,7 +696,7 @@ public class Pop3Store extends Store {
} else {
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3) {
Log.d(K9.LOG_TAG, "The server really doesn't support the TOP " +
"command. Using RETR instead.");
"command. Using RETR instead.");
}
// Don't try to use the TOP command again.

View File

@ -265,17 +265,17 @@ public class SmtpTransport extends Transport {
if (useAuthCramMD5 || (useAutomaticAuth && authCramMD5Supported)) {
if (!authCramMD5Supported && K9.DEBUG && K9.DEBUG_PROTOCOL_SMTP) {
Log.d(K9.LOG_TAG, "Using CRAM_MD5 as authentication method although the " +
"server didn't advertise support for it in EHLO response.");
"server didn't advertise support for it in EHLO response.");
}
saslAuthCramMD5(mUsername, mPassword);
} else if (useAuthPlain || (useAutomaticAuth && authPlainSupported)) {
if (!authPlainSupported && K9.DEBUG && K9.DEBUG_PROTOCOL_SMTP) {
Log.d(K9.LOG_TAG, "Using PLAIN as authentication method although the " +
"server didn't advertise support for it in EHLO response.");
"server didn't advertise support for it in EHLO response.");
}
try {
saslAuthPlain(mUsername, mPassword);
} catch(MessagingException ex) {
} catch (MessagingException ex) {
// PLAIN is a special case. Historically, PLAIN has represented both PLAIN and LOGIN; only the
// protocol being advertised by the server would be used, with PLAIN taking precedence. Instead
// of using only the requested protocol, we'll try PLAIN and then try LOGIN.
@ -292,7 +292,7 @@ public class SmtpTransport extends Transport {
} else if (useAuthLogin || (useAutomaticAuth && authLoginSupported)) {
if (!authPlainSupported && K9.DEBUG && K9.DEBUG_PROTOCOL_SMTP) {
Log.d(K9.LOG_TAG, "Using LOGIN as authentication method although the " +
"server didn't advertise support for it in EHLO response.");
"server didn't advertise support for it in EHLO response.");
}
saslAuthLogin(mUsername, mPassword);
} else {
@ -352,20 +352,20 @@ public class SmtpTransport extends Transport {
// If the message has attachments and our server has told us about a limit on
// the size of messages, count the message's size before sending it
if (mLargestAcceptableMessage > 0 && ((LocalMessage)message).hasAttachments()) {
if (K9.DEBUG_PROTOCOL_SMTP) {
Log.d(K9.LOG_TAG, "calculating message size");
}
close(); // (prevent timeouts while calculating the size)
if (K9.DEBUG_PROTOCOL_SMTP) {
Log.d(K9.LOG_TAG, "calculating message size");
}
close(); // (prevent timeouts while calculating the size)
final long calculatedSize = message.calculateSize();
if (calculatedSize > mLargestAcceptableMessage) {
if (calculatedSize > mLargestAcceptableMessage) {
MessagingException me = new MessagingException("Message too large for server");
me.setPermanentFailure(possibleSend);
throw me;
}
open(); // (prevent timeouts while calculating the size)
if (K9.DEBUG_PROTOCOL_SMTP) {
Log.d(K9.LOG_TAG, "calculating message size DONE size=" + calculatedSize + " max allowed=" + mLargestAcceptableMessage);
}
open(); // (prevent timeouts while calculating the size)
if (K9.DEBUG_PROTOCOL_SMTP) {
Log.d(K9.LOG_TAG, "calculating message size DONE size=" + calculatedSize + " max allowed=" + mLargestAcceptableMessage);
}
}
Address[] from = message.getFrom();
@ -396,8 +396,8 @@ public class SmtpTransport extends Transport {
// "5xx text" -responses are permanent failures
String msg = e.getMessage();
if (msg != null && msg.startsWith("5")) {
Log.w(K9.LOG_TAG, "handling 5xx SMTP error code as a permanent failure");
possibleSend=false;
Log.w(K9.LOG_TAG, "handling 5xx SMTP error code as a permanent failure");
possibleSend = false;
}
me.setPermanentFailure(possibleSend);

View File

@ -53,7 +53,7 @@ public class TimePickerPreference extends DialogPreference implements
* @param defStyle
*/
public TimePickerPreference(final Context context, final AttributeSet attrs,
final int defStyle) {
final int defStyle) {
super(context, attrs, defStyle);
initialize();
}
@ -78,8 +78,7 @@ public class TimePickerPreference extends DialogPreference implements
tp.setOnTimeChangedListener(this);
originalHour = getHour();
originalMinute = getMinute();
if (originalHour >= 0 && originalMinute >= 0)
{
if (originalHour >= 0 && originalMinute >= 0) {
tp.setCurrentHour(originalHour);
tp.setCurrentMinute(originalMinute);
}
@ -104,14 +103,14 @@ public class TimePickerPreference extends DialogPreference implements
* before going to super.onDialogClosed(positiveResult).
*/
@Override
protected void onDialogClosed(boolean positiveResult) {
protected void onDialogClosed(boolean positiveResult) {
if (!positiveResult) {
persistString(String.format("%02d:%02d", originalHour, originalMinute));
callChangeListener(String.format("%02d:%02d", originalHour, originalMinute));
}
super.onDialogClosed(positiveResult);
}
if (!positiveResult) {
persistString(String.format("%02d:%02d", originalHour, originalMinute));
callChangeListener(String.format("%02d:%02d", originalHour, originalMinute));
}
super.onDialogClosed(positiveResult);
}
/**
* @see android.preference.Preference#setDefaultValue(java.lang.Object)

View File

@ -74,12 +74,12 @@ public class AttachmentProvider extends ContentProvider {
*/
final File cacheDir = getContext().getCacheDir();
if (cacheDir == null) {
return true;
return true;
}
File[] files = cacheDir.listFiles();
if (files == null) {
return true;
}
File[] files = cacheDir.listFiles();
if (files == null) {
return true;
}
for (File file : files) {
if (file.getName().endsWith(".tmp")) {
file.delete();