diff --git a/src/com/fsck/k9/Account.java b/src/com/fsck/k9/Account.java index 63d0cd396..06306d834 100644 --- a/src/com/fsck/k9/Account.java +++ b/src/com/fsck/k9/Account.java @@ -17,7 +17,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; -import java.util.Random; +import java.util.Random; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; @@ -35,13 +35,13 @@ public class Account implements BaseAccount public static final int DELETE_POLICY_7DAYS = 1; public static final int DELETE_POLICY_ON_DELETE = 2; public static final int DELETE_POLICY_MARK_AS_READ = 3; - + public static final String TYPE_WIFI = "WIFI"; public static final String TYPE_MOBILE = "MOBILE"; public static final String TYPE_OTHER = "OTHER"; private static String[] networkTypes = { TYPE_WIFI, TYPE_MOBILE, TYPE_OTHER }; - - + + /** *
* 0 - Never (DELETE_POLICY_NEVER) @@ -60,7 +60,7 @@ public class Account implements BaseAccount private String mAlwaysBcc; private int mAutomaticCheckIntervalMinutes; private int mDisplayCount; - private int mChipColor; + private int mChipColor; private long mLastAutomaticCheckTime; private boolean mNotifyNewMail; private boolean mNotifySelfNewMail; @@ -82,7 +82,7 @@ public class Account implements BaseAccount private boolean mIsSignatureBeforeQuotedText; private String mExpungePolicy = EXPUNGE_IMMEDIATELY; private int mMaxPushFolders; - private MapcompressionMap = new ConcurrentHashMap (); + private Map compressionMap = new ConcurrentHashMap (); private Searchable searchableFolders; // Tracks if we have sent a notification for this account for // current set of fetched messages @@ -98,9 +98,9 @@ public class Account implements BaseAccount public enum HideButtons { NEVER, ALWAYS, KEYBOARD_AVAILABLE; - } - - public enum Searchable + } + + public enum Searchable { ALL, DISPLAYABLE, NONE } @@ -128,10 +128,10 @@ public class Account implements BaseAccount mExpungePolicy = EXPUNGE_IMMEDIATELY; mAutoExpandFolderName = "INBOX"; mMaxPushFolders = 10; - mChipColor = 0; - + mChipColor = 0; + searchableFolders = Searchable.ALL; - + identities = new ArrayList (); Identity identity = new Identity(); @@ -182,11 +182,11 @@ public class Account implements BaseAccount mExpungePolicy = preferences.getPreferences().getString(mUuid + ".expungePolicy", EXPUNGE_IMMEDIATELY); mMaxPushFolders = preferences.getPreferences().getInt(mUuid + ".maxPushFolders", 10); - + for (String type : networkTypes) { Boolean useCompression = preferences.getPreferences().getBoolean(mUuid + ".useCompression." + type, - true); + true); compressionMap.put(type, useCompression); } @@ -215,15 +215,15 @@ public class Account implements BaseAccount "INBOX"); mAccountNumber = preferences.getPreferences().getInt(mUuid + ".accountNumber", 0); - - Random random = new Random((long)mAccountNumber+4); - - mChipColor = preferences.getPreferences().getInt(mUuid+".chipColor", - (random.nextInt(0x70) ) + - (random.nextInt(0x70) * 0xff ) + - (random.nextInt(0x70) * 0xffff ) + - 0xff000000); - + + Random random = new Random((long)mAccountNumber+4); + + mChipColor = preferences.getPreferences().getInt(mUuid+".chipColor", + (random.nextInt(0x70)) + + (random.nextInt(0x70) * 0xff) + + (random.nextInt(0x70) * 0xffff) + + 0xff000000); + mVibrate = preferences.getPreferences().getBoolean(mUuid + ".vibrate", false); mRing = preferences.getPreferences().getBoolean(mUuid + ".ring", true); @@ -278,7 +278,7 @@ public class Account implements BaseAccount { mFolderTargetMode = FolderMode.NOT_SECOND_CLASS; } - + try { searchableFolders = Searchable.valueOf(preferences.getPreferences().getString(mUuid + ".searchableFolders", @@ -421,8 +421,8 @@ public class Account implements BaseAccount editor.putString(mUuid + ".expungePolicy", mExpungePolicy); editor.putInt(mUuid + ".maxPushFolders", mMaxPushFolders); editor.putString(mUuid + ".searchableFolders", searchableFolders.name()); - editor.putInt(mUuid + ".chipColor", mChipColor); - + editor.putInt(mUuid + ".chipColor", mChipColor); + for (String type : networkTypes) { Boolean useCompression = compressionMap.get(type); @@ -490,7 +490,7 @@ public class Account implements BaseAccount } unreadMessageCount += folder.getUnreadMessageCount(); flaggedMessageCount += folder.getFlaggedMessageCount(); - + } } long folderEvalEnd = System.currentTimeMillis(); @@ -499,20 +499,22 @@ public class Account implements BaseAccount long endTime = System.currentTimeMillis(); if (K9.DEBUG) Log.d(K9.LOG_TAG, "Account.getStats() on " + getDescription() + " took " + (endTime - startTime) + " ms;" - + " loading " + folders.size() + " took " + (folderLoadEnd - folderLoadStart) + " ms;" - + " evaluating took " + (folderEvalEnd - folderEvalStart) + " ms"); + + " loading " + folders.size() + " took " + (folderLoadEnd - folderLoadStart) + " ms;" + + " evaluating took " + (folderEvalEnd - folderEvalStart) + " ms"); return stats; } - - public void setChipColor(int color) { - mChipColor = color; - } - - public int getChipColor() { - return mChipColor; - } - + + public void setChipColor(int color) + { + mChipColor = color; + } + + public int getChipColor() + { + return mChipColor; + } + public String getUuid() { return mUuid; @@ -615,18 +617,18 @@ public class Account implements BaseAccount - /* Have we sent a new mail notification on this account */ - public boolean isRingNotified() - { - return mRingNotified; - } + /* Have we sent a new mail notification on this account */ + public boolean isRingNotified() + { + return mRingNotified; + } - public void setRingNotified(boolean ringNotified) - { - mRingNotified = ringNotified; - } + public void setRingNotified(boolean ringNotified) + { + mRingNotified = ringNotified; + } - public synchronized String getRingtone() + public synchronized String getRingtone() { return mRingtoneUri; } @@ -662,7 +664,7 @@ public class Account implements BaseAccount int oldInterval = this.mAutomaticCheckIntervalMinutes; int newInterval = automaticCheckIntervalMinutes; this.mAutomaticCheckIntervalMinutes = automaticCheckIntervalMinutes; - + return (oldInterval != newInterval); } @@ -798,7 +800,7 @@ public class Account implements BaseAccount { FolderMode oldSyncMode = mFolderSyncMode; mFolderSyncMode = syncMode; - + if (syncMode == FolderMode.NONE && oldSyncMode != FolderMode.NONE) { return true; @@ -818,7 +820,7 @@ public class Account implements BaseAccount public synchronized boolean setFolderPushMode(FolderMode pushMode) { FolderMode oldPushMode = mFolderPushMode; - + mFolderPushMode = pushMode; return pushMode != oldPushMode; } @@ -907,12 +909,12 @@ public class Account implements BaseAccount public LocalStore getLocalStore() throws MessagingException { - return Store.getLocalInstance(this, K9.app); + return Store.getLocalInstance(this, K9.app); } - + public Store getRemoteStore() throws MessagingException { - return Store.getRemoteInstance(this); + return Store.getRemoteInstance(this); } @Override @@ -920,12 +922,12 @@ public class Account implements BaseAccount { return mDescription; } - + public void setCompression(String networkType, boolean useCompression) { compressionMap.put(networkType, useCompression); } - + public boolean useCompression(String networkType) { Boolean useCompression = compressionMap.get(networkType); @@ -938,7 +940,7 @@ public class Account implements BaseAccount return useCompression; } } - + public boolean useCompression(int type) { String networkType = TYPE_OTHER; @@ -953,7 +955,7 @@ public class Account implements BaseAccount } return useCompression(networkType); } - + @Override public boolean equals(Object o) { diff --git a/src/com/fsck/k9/AccountStats.java b/src/com/fsck/k9/AccountStats.java index a6186c6ee..04815107f 100644 --- a/src/com/fsck/k9/AccountStats.java +++ b/src/com/fsck/k9/AccountStats.java @@ -1,5 +1,5 @@ /** - * + * */ package com.fsck.k9; diff --git a/src/com/fsck/k9/ColorPickerDialog.java b/src/com/fsck/k9/ColorPickerDialog.java index b9500f45c..43bc6e01c 100644 --- a/src/com/fsck/k9/ColorPickerDialog.java +++ b/src/com/fsck/k9/ColorPickerDialog.java @@ -25,25 +25,30 @@ import android.view.MotionEvent; import android.view.View; -public class ColorPickerDialog extends Dialog { +public class ColorPickerDialog extends Dialog +{ - public interface OnColorChangedListener { + public interface OnColorChangedListener + { void colorChanged(int color); } private OnColorChangedListener mListener; private int mInitialColor; - private static class ColorPickerView extends View { + private static class ColorPickerView extends View + { private Paint mPaint; private Paint mCenterPaint; private final int[] mColors; private OnColorChangedListener mListener; - ColorPickerView(Context c, OnColorChangedListener l, int color) { + ColorPickerView(Context c, OnColorChangedListener l, int color) + { super(c); mListener = l; - mColors = new int[] { + mColors = new int[] + { 0xFF800000, 0xFF800080, 0xFF000080, 0xFF008080, 0xFF008000, 0xFF808000, 0xFF800000 }; @@ -63,7 +68,8 @@ public class ColorPickerDialog extends Dialog { private boolean mHighlightCenter; @Override - protected void onDraw(Canvas canvas) { + protected void onDraw(Canvas canvas) + { float r = CENTER_X - mPaint.getStrokeWidth()*0.5f; canvas.translate(CENTER_X, CENTER_X); @@ -71,13 +77,17 @@ public class ColorPickerDialog extends Dialog { canvas.drawOval(new RectF(-r, -r, r, r), mPaint); canvas.drawCircle(0, 0, CENTER_RADIUS, mCenterPaint); - if (mTrackingCenter) { + if (mTrackingCenter) + { int c = mCenterPaint.getColor(); mCenterPaint.setStyle(Paint.Style.STROKE); - if (mHighlightCenter) { + if (mHighlightCenter) + { mCenterPaint.setAlpha(0xFF); - } else { + } + else + { mCenterPaint.setAlpha(0x80); } canvas.drawCircle(0, 0, @@ -90,7 +100,8 @@ public class ColorPickerDialog extends Dialog { } @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) + { setMeasuredDimension(CENTER_X*2, CENTER_Y*2); } @@ -98,28 +109,37 @@ public class ColorPickerDialog extends Dialog { private static final int CENTER_Y = 100; private static final int CENTER_RADIUS = 32; - private int floatToByte(float x) { + private int floatToByte(float x) + { int n = java.lang.Math.round(x); return n; } - private int pinToByte(int n) { - if (n < 0) { + private int pinToByte(int n) + { + if (n < 0) + { n = 0; - } else if (n > 255) { + } + else if (n > 255) + { n = 255; } return n; } - private int ave(int s, int d, float p) { - return s + java.lang.Math.round(p * (d - s)); + private int ave(int s, int d, float p) + { + return s + java.lang.Math.round(p *(d - s)); } - private int interpColor(int colors[], float unit) { - if (unit <= 0) { + private int interpColor(int colors[], float unit) + { + if (unit <= 0) + { return colors[0]; } - if (unit >= 1) { + if (unit >= 1) + { return colors[colors.length - 1]; } @@ -138,7 +158,8 @@ public class ColorPickerDialog extends Dialog { return Color.argb(a, r, g, b); } - private int rotateColor(int color, float rad) { + private int rotateColor(int color, float rad) + { float deg = rad * 180 / 3.1415927f; int r = Color.red(color); int g = Color.green(color); @@ -166,30 +187,38 @@ public class ColorPickerDialog extends Dialog { private static final float PI = 3.1415926f; @Override - public boolean onTouchEvent(MotionEvent event) { + public boolean onTouchEvent(MotionEvent event) + { float x = event.getX() - CENTER_X; float y = event.getY() - CENTER_Y; boolean inCenter = java.lang.Math.sqrt(x*x + y*y) <= CENTER_RADIUS; - switch (event.getAction()) { + switch (event.getAction()) + { case MotionEvent.ACTION_DOWN: mTrackingCenter = inCenter; - if (inCenter) { + if (inCenter) + { mHighlightCenter = true; invalidate(); break; } case MotionEvent.ACTION_MOVE: - if (mTrackingCenter) { - if (mHighlightCenter != inCenter) { + if (mTrackingCenter) + { + if (mHighlightCenter != inCenter) + { mHighlightCenter = inCenter; invalidate(); } - } else { + } + else + { float angle = (float)java.lang.Math.atan2(y, x); // need to turn angle [-PI ... PI] into unit [0....1] float unit = angle/(2*PI); - if (unit < 0) { + if (unit < 0) + { unit += 1; } mCenterPaint.setColor(interpColor(mColors, unit)); @@ -197,8 +226,10 @@ public class ColorPickerDialog extends Dialog { } break; case MotionEvent.ACTION_UP: - if (mTrackingCenter) { - if (inCenter) { + if (mTrackingCenter) + { + if (inCenter) + { mListener.colorChanged(mCenterPaint.getColor()); } mTrackingCenter = false; // so we draw w/o halo @@ -214,7 +245,8 @@ public class ColorPickerDialog extends Dialog { public ColorPickerDialog(Context context, OnColorChangedListener listener, - int initialColor) { + int initialColor) + { super(context); mListener = listener; @@ -222,10 +254,13 @@ public class ColorPickerDialog extends Dialog { } @Override - protected void onCreate(Bundle savedInstanceState) { + protected void onCreate(Bundle savedInstanceState) + { super.onCreate(savedInstanceState); - OnColorChangedListener l = new OnColorChangedListener() { - public void colorChanged(int color) { + OnColorChangedListener l = new OnColorChangedListener() + { + public void colorChanged(int color) + { mListener.colorChanged(color); dismiss(); } diff --git a/src/com/fsck/k9/EmailAddressAdapter.java b/src/com/fsck/k9/EmailAddressAdapter.java index 828a95db9..8c98c9906 100644 --- a/src/com/fsck/k9/EmailAddressAdapter.java +++ b/src/com/fsck/k9/EmailAddressAdapter.java @@ -55,7 +55,7 @@ public abstract class EmailAddressAdapter extends ResourceCursorAdapter try { Class extends EmailAddressAdapter> clazz = - Class.forName(className).asSubclass(EmailAddressAdapter.class); + Class.forName(className).asSubclass(EmailAddressAdapter.class); sInstance = clazz.newInstance(); } catch (Exception e) diff --git a/src/com/fsck/k9/EmailAddressAdapterSdk5.java b/src/com/fsck/k9/EmailAddressAdapterSdk5.java index 1b894308b..7ef5964aa 100644 --- a/src/com/fsck/k9/EmailAddressAdapterSdk5.java +++ b/src/com/fsck/k9/EmailAddressAdapterSdk5.java @@ -34,7 +34,8 @@ public class EmailAddressAdapterSdk5 extends EmailAddressAdapter private static final String SORT_ORDER = Contacts.TIMES_CONTACTED + " DESC, " + Contacts.DISPLAY_NAME; - private static final String[] PROJECTION = { + private static final String[] PROJECTION = + { Data._ID, // 0 Contacts.DISPLAY_NAME, // 1 Email.DATA // 2 diff --git a/src/com/fsck/k9/FontSizes.java b/src/com/fsck/k9/FontSizes.java index 73ff7b696..569619322 100644 --- a/src/com/fsck/k9/FontSizes.java +++ b/src/com/fsck/k9/FontSizes.java @@ -106,7 +106,7 @@ public class FontSizes /** * Font size of the message content in the message view activity. - * + * * Note: The unit is WebSettings.TextSize */ private TextSize messageViewContent = TextSize.NORMAL; @@ -125,7 +125,7 @@ public class FontSizes messageListSubject = SMALL; messageListSender = SMALL; messageListDate = SMALL; - + messageViewSender = SMALL; messageViewTo = FONT_12DIP; messageViewCC = FONT_12DIP; @@ -136,7 +136,7 @@ public class FontSizes /** * Permanently save the font size settings. - * + * * @param editor Used to save the font size settings. */ public void save(SharedPreferences.Editor editor) @@ -162,7 +162,7 @@ public class FontSizes /** * Load the font size settings from permanent storage. - * + * * @param prefs Used to load the font size settings. */ public void load(SharedPreferences prefs) @@ -172,7 +172,7 @@ public class FontSizes folderName = prefs.getInt(FOLDER_NAME, folderName); folderStatus = prefs.getInt(FOLDER_STATUS, folderStatus); - + messageListSubject = prefs.getInt(MESSAGE_LIST_SUBJECT, messageListSubject); messageListSender = prefs.getInt(MESSAGE_LIST_SENDER, messageListSender); messageListDate = prefs.getInt(MESSAGE_LIST_DATE, messageListDate); @@ -325,12 +325,17 @@ public class FontSizes { switch (messageViewContent) { - case SMALLEST: return 1; - case SMALLER: return 2; + case SMALLEST: + return 1; + case SMALLER: + return 2; default: - case NORMAL: return 3; - case LARGER: return 4; - case LARGEST: return 5; + case NORMAL: + return 3; + case LARGER: + return 4; + case LARGEST: + return 5; } } @@ -338,11 +343,21 @@ public class FontSizes { switch (size) { - case 1: messageViewContent = TextSize.SMALLEST; break; - case 2: messageViewContent = TextSize.SMALLER; break; - case 3: messageViewContent = TextSize.NORMAL; break; - case 4: messageViewContent = TextSize.LARGER; break; - case 5: messageViewContent = TextSize.LARGEST; break; + case 1: + messageViewContent = TextSize.SMALLEST; + break; + case 2: + messageViewContent = TextSize.SMALLER; + break; + case 3: + messageViewContent = TextSize.NORMAL; + break; + case 4: + messageViewContent = TextSize.LARGER; + break; + case 5: + messageViewContent = TextSize.LARGEST; + break; } } } diff --git a/src/com/fsck/k9/K9.java b/src/com/fsck/k9/K9.java index 47e6d68ca..34451dfda 100644 --- a/src/com/fsck/k9/K9.java +++ b/src/com/fsck/k9/K9.java @@ -81,7 +81,7 @@ public class K9 extends Application * We use WebSettings.getBlockNetworkLoads() to prevent the WebView that displays email * bodies from loading external resources over the network. Unfortunately this method * isn't exposed via the official Android API. That's why we use reflection to be able - * to call the method. + * to call the method. */ private static final Method mGetBlockNetworkLoads = getMethod(WebSettings.class, "setBlockNetworkLoads"); @@ -441,12 +441,12 @@ public class K9 extends Application { return mGesturesEnabled; } - + public static void setGesturesEnabled(boolean gestures) { mGesturesEnabled = gestures; } - + public static boolean isAnimations() { return mAnimations; @@ -497,12 +497,12 @@ public class K9 extends Application catch (NoSuchMethodException e) { Log.i(K9.LOG_TAG, "Can't get method " + - classObject.toString() + "." + methodName); + classObject.toString() + "." + methodName); } catch (Exception e) { Log.e(K9.LOG_TAG, "Error while using reflection to get method " + - classObject.toString() + "." + methodName, e); + classObject.toString() + "." + methodName, e); } return null; } diff --git a/src/com/fsck/k9/K9Activity.java b/src/com/fsck/k9/K9Activity.java index 25a2785d4..7b7df64ff 100644 --- a/src/com/fsck/k9/K9Activity.java +++ b/src/com/fsck/k9/K9Activity.java @@ -17,7 +17,7 @@ public class K9Activity extends Activity private GestureDetector gestureDetector; protected ScrollView mTopView; - + @Override public void onCreate(Bundle icicle) { @@ -64,7 +64,7 @@ public class K9Activity extends Activity } protected void onNext(boolean animate) { - + } protected void onPrevious(boolean animate) { @@ -76,7 +76,7 @@ public class K9Activity extends Activity private static final float SWIPE_MIN_DISTANCE_DIP = 130.0f; private static final float SWIPE_MAX_OFF_PATH_DIP = 250f; private static final float SWIPE_THRESHOLD_VELOCITY_DIP = 325f; - + @Override public boolean onDoubleTap(MotionEvent ev) { @@ -87,12 +87,12 @@ public class K9Activity extends Activity if (ev.getRawY() < (height/4)) { mTopView.fullScroll(View.FOCUS_UP); - + } else if (ev.getRawY() > (height - height/4)) { mTopView.fullScroll(View.FOCUS_DOWN); - + } } return false; @@ -108,8 +108,8 @@ public class K9Activity extends Activity int min_distance = (int)(SWIPE_MIN_DISTANCE_DIP * mGestureScale + 0.5f); int min_velocity = (int)(SWIPE_THRESHOLD_VELOCITY_DIP * mGestureScale + 0.5f); int max_off_path = (int)(SWIPE_MAX_OFF_PATH_DIP * mGestureScale + 0.5f); - - + + try { if (Math.abs(e1.getY() - e2.getY()) > max_off_path) diff --git a/src/com/fsck/k9/MessagingController.java b/src/com/fsck/k9/MessagingController.java index 54b249c7d..c5bd77e97 100644 --- a/src/com/fsck/k9/MessagingController.java +++ b/src/com/fsck/k9/MessagingController.java @@ -701,10 +701,10 @@ public class MessagingController implements Runnable public void searchLocalMessages(SearchSpecification searchSpecification, final Message[] messages, final MessagingListener listener) { - searchLocalMessages(searchSpecification.getAccountUuids(), searchSpecification.getFolderNames(), messages, - searchSpecification.getQuery(), searchSpecification.isIntegrate(), searchSpecification.getRequiredFlags(), searchSpecification.getForbiddenFlags(), listener); + searchLocalMessages(searchSpecification.getAccountUuids(), searchSpecification.getFolderNames(), messages, + searchSpecification.getQuery(), searchSpecification.isIntegrate(), searchSpecification.getRequiredFlags(), searchSpecification.getForbiddenFlags(), listener); } - + /** * Find all messages in any local account which match the query 'query' @@ -716,22 +716,22 @@ public class MessagingController implements Runnable * @param account * @throws MessagingException */ - public void searchLocalMessages(final String[] accountUuids, final String[] folderNames, final Message[] messages, final String query, final boolean integrate, - final Flag[] requiredFlags, final Flag[] forbiddenFlags, final MessagingListener listener) + public void searchLocalMessages(final String[] accountUuids, final String[] folderNames, final Message[] messages, final String query, final boolean integrate, + final Flag[] requiredFlags, final Flag[] forbiddenFlags, final MessagingListener listener) { if (K9.DEBUG) { - Log.i(K9.LOG_TAG, "searchLocalMessages (" - + "accountUuids=" + Utility.combine(accountUuids, ',') - + ", folderNames = " + Utility.combine(folderNames, ',') - + ", messages.size() = " + (messages != null ? messages.length : null) - + ", query = " + query - + ", integrate = " + integrate - + ", requiredFlags = " + Utility.combine(requiredFlags, ',') - + ", forbiddenFlags = " + Utility.combine(forbiddenFlags, ',') - + ")"); + Log.i(K9.LOG_TAG, "searchLocalMessages (" + + "accountUuids=" + Utility.combine(accountUuids, ',') + + ", folderNames = " + Utility.combine(folderNames, ',') + + ", messages.size() = " + (messages != null ? messages.length : null) + + ", query = " + query + + ", integrate = " + integrate + + ", requiredFlags = " + Utility.combine(requiredFlags, ',') + + ", forbiddenFlags = " + Utility.combine(forbiddenFlags, ',') + + ")"); } - + threadPool.execute(new Runnable() { public void run() @@ -743,7 +743,7 @@ public class MessagingController implements Runnable { for (String accountUuid : accountUuids) { - accountUuidsSet.add(accountUuid); + accountUuidsSet.add(accountUuid); } } final Preferences prefs = Preferences.getPreferences(mApplication.getApplicationContext()); @@ -757,7 +757,7 @@ public class MessagingController implements Runnable { continue; } - + if (accountUuids != null && accountUuidsSet.contains(account.getUuid()) == true) { displayableOnly = true; @@ -773,14 +773,14 @@ public class MessagingController implements Runnable case DISPLAYABLE: displayableOnly = true; break; - + } } if (listener != null) { listener.listLocalMessagesStarted(account, null); } - + if (integrate || displayableOnly || folderNames != null || noSpecialFolders) { List tmpFoldersToSearch = new LinkedList (); @@ -812,17 +812,17 @@ public class MessagingController implements Runnable if (folderNameSet != null) { if (folderNameSet.contains(localFolderName) == false) - + { include = false; } } else if (noSpecialFolders && ( - localFolderName.equals(account.getTrashFolderName()) || - localFolderName.equals(account.getOutboxFolderName()) || - localFolderName.equals(account.getDraftsFolderName()) || - localFolderName.equals(account.getSentFolderName()) || - localFolderName.equals(account.getErrorFolderName()))) + localFolderName.equals(account.getTrashFolderName()) || + localFolderName.equals(account.getOutboxFolderName()) || + localFolderName.equals(account.getDraftsFolderName()) || + localFolderName.equals(account.getSentFolderName()) || + localFolderName.equals(account.getErrorFolderName()))) { include = false; } @@ -831,7 +831,7 @@ public class MessagingController implements Runnable include = false; } } - + if (include) { tmpFoldersToSearch.add(localFolder); @@ -848,9 +848,9 @@ public class MessagingController implements Runnable Log.e(K9.LOG_TAG, "Unable to restrict search folders in Account " + account.getDescription() + ", searching all", me); addErrorMessage(account, null, me); } - + } - + MessageRetrievalListener retrievalListener = new MessageRetrievalListener() { public void messageStarted(String message, int number, int ofTotal) {} @@ -865,11 +865,11 @@ public class MessagingController implements Runnable { listener.listLocalMessagesAddMessages(account, null, messages); } - + } - public void messagesFinished(int number) + public void messagesFinished(int number) { - + } }; @@ -877,7 +877,7 @@ public class MessagingController implements Runnable { LocalStore localStore = account.getLocalStore(); localStore.searchForMessages(retrievalListener, query, foldersToSearch, messages, requiredFlags, forbiddenFlags); - + } catch (Exception e) { @@ -1172,7 +1172,7 @@ public class MessagingController implements Runnable int unreadMessageCount = setLocalUnreadCountToRemote(localFolder, remoteFolder, newMessages); setLocalFlaggedCountToRemote(localFolder, remoteFolder); - + for (MessagingListener l : getListeners()) { @@ -1287,7 +1287,7 @@ public class MessagingController implements Runnable return localFolder.getMessageCount(); } } - + private void setLocalFlaggedCountToRemote(LocalFolder localFolder, Folder remoteFolder) throws MessagingException { int remoteFlaggedMessageCount = remoteFolder.getFlaggedMessageCount(); @@ -1448,7 +1448,7 @@ public class MessagingController implements Runnable { smallMessages.add(message); } - + // And include it in the view if (message.getSubject() != null && message.getFrom() != null) @@ -1476,7 +1476,7 @@ public class MessagingController implements Runnable { newMessages.incrementAndGet(); } - + } } @@ -2723,7 +2723,7 @@ public class MessagingController implements Runnable { @Override public void act(final Account account, final Folder folder, - final List messages) + final List messages) { String[] uids = new String[messages.size()]; for (int i = 0; i < messages.size(); i++) @@ -2732,9 +2732,9 @@ public class MessagingController implements Runnable } setFlag(account, folder.getName(), uids, flag, newState); } - + }); - + } public void setFlag( @@ -2766,7 +2766,7 @@ public class MessagingController implements Runnable Message msg = localFolder.getMessage(uid); if (msg != null) { - messages.add(msg); + messages.add(msg); } } @@ -2977,7 +2977,7 @@ public class MessagingController implements Runnable message }, fp, null); localFolder.close(); - + for (MessagingListener l : getListeners()) { l.loadMessageForViewBodyAvailable(account, folder, uid, message); @@ -3340,14 +3340,14 @@ public class MessagingController implements Runnable account.getSentFolderName()); if (K9.DEBUG) Log.i(K9.LOG_TAG, "Moving sent message to folder '" + account.getSentFolderName() + "' (" + localSentFolder.getId() + ") "); - + localFolder.moveMessages( new Message[] { message }, localSentFolder); - + if (K9.DEBUG) Log.i(K9.LOG_TAG, "Moved sent message to folder '" + account.getSentFolderName() + "' (" + localSentFolder.getId() + ") "); - + PendingCommand command = new PendingCommand(); command.command = PENDING_COMMAND_APPEND; command.arguments = @@ -3359,7 +3359,7 @@ public class MessagingController implements Runnable queuePendingCommand(account, command); processPendingCommands(account); } - + } catch (Exception e) { @@ -3465,7 +3465,7 @@ public class MessagingController implements Runnable } public void getAccountStats(final Context context, final Account account, - final MessagingListener l) + final MessagingListener l) { Runnable unreadRunnable = new Runnable() { @@ -3481,13 +3481,13 @@ public class MessagingController implements Runnable Log.e(K9.LOG_TAG, "Count not get unread count for account " + account.getDescription(), me); } - + } }; put("getAccountStats:" + account.getDescription(), l, unreadRunnable); } - + public void getFolderUnreadMessageCount(final Account account, final String folderName, final MessagingListener l) { @@ -3515,7 +3515,7 @@ public class MessagingController implements Runnable } - + public boolean isMoveCapable(Message message) { if (!message.getUid().startsWith(K9.LOCAL_UID_PREFIX)) @@ -3562,7 +3562,7 @@ public class MessagingController implements Runnable } } public void moveMessages(final Account account, final String srcFolder, final Message[] messages, final String destFolder, - final MessagingListener listener) + final MessagingListener listener) { for (Message message : messages) { @@ -3578,13 +3578,13 @@ public class MessagingController implements Runnable } public void moveMessage(final Account account, final String srcFolder, final Message message, final String destFolder, - final MessagingListener listener) + final MessagingListener listener) { moveMessages(account, srcFolder, new Message[] { message }, destFolder, listener); } public void copyMessages(final Account account, final String srcFolder, final Message[] messages, final String destFolder, - final MessagingListener listener) + final MessagingListener listener) { putBackground("copyMessages", null, new Runnable() { @@ -3595,7 +3595,7 @@ public class MessagingController implements Runnable }); } public void copyMessage(final Account account, final String srcFolder, final Message message, final String destFolder, - final MessagingListener listener) + final MessagingListener listener) { copyMessages(account, srcFolder, new Message[] { message }, destFolder, listener); } @@ -3618,7 +3618,7 @@ public class MessagingController implements Runnable Folder localSrcFolder = localStore.getFolder(srcFolder); Folder localDestFolder = localStore.getFolder(destFolder); - + List uids = new LinkedList (); for (Message message : inMessages) { @@ -3628,17 +3628,17 @@ public class MessagingController implements Runnable uids.add(uid); } } - + Message[] messages = localSrcFolder.getMessages(uids.toArray(new String[0]), null); if (messages.length > 0) { Map origUidMap = new HashMap (); - + for (Message message : messages) { origUidMap.put(message.getUid(), message); } - + if (K9.DEBUG) Log.i(K9.LOG_TAG, "moveOrCopyMessageSynchronous: source folder = " + srcFolder + ", " + messages.length + " messages, " + ", destination folder = " + destFolder + ", isCopy = " + isCopy); @@ -3663,7 +3663,7 @@ public class MessagingController implements Runnable unsuppressMessage(account, srcFolder, origUid); } } - + queueMoveOrCopy(account, srcFolder, destFolder, isCopy, origUidMap.keySet().toArray(new String[0])); } @@ -3687,8 +3687,8 @@ public class MessagingController implements Runnable } }); } - - public void deleteDraft(final Account account, String uid) + + public void deleteDraft(final Account account, String uid) { LocalFolder localFolder = null; try @@ -3722,7 +3722,7 @@ public class MessagingController implements Runnable @Override public void act(final Account account, final Folder folder, - final List messages) + final List messages) { for (Message message : messages) { @@ -3737,9 +3737,9 @@ public class MessagingController implements Runnable } }); } - + }); - + } private void deleteMessagesSynchronous(final Account account, final String folder, final Message[] messages, @@ -3852,7 +3852,7 @@ public class MessagingController implements Runnable } finally { - + if (localFolder != null) { localFolder.close(); @@ -4056,9 +4056,9 @@ public class MessagingController implements Runnable if (K9.DEBUG) Log.i(K9.LOG_TAG, "Synchronizing account " + account.getDescription()); - + account.setRingNotified(false); - + putBackground("sendPending " + account.getDescription(), null, new Runnable() { public void run() @@ -4234,11 +4234,11 @@ public class MessagingController implements Runnable public void run() { if (K9.DEBUG) - Log.v(K9.LOG_TAG, "Clearing notification flag for " + account.getDescription()); + Log.v(K9.LOG_TAG, "Clearing notification flag for " + account.getDescription()); account.setRingNotified(false); } } - ); + ); } @@ -4480,7 +4480,7 @@ public class MessagingController implements Runnable }; queuePendingCommand(account, command); processPendingCommands(account); - + } catch (MessagingException e) { @@ -5067,12 +5067,12 @@ public class MessagingController implements Runnable private void actOnMessages(Message[] messages, MessageActor actor) { Map >> accountMap = new HashMap >>(); - + for (Message message : messages) { Folder folder = message.getFolder(); Account account = folder.getAccount(); - + Map > folderMap = accountMap.get(account); if (folderMap == null) { @@ -5085,7 +5085,7 @@ public class MessagingController implements Runnable messageList = new LinkedList (); folderMap.put(folder, messageList); } - + messageList.add(message); } for (Map.Entry >> entry : accountMap.entrySet()) @@ -5102,8 +5102,8 @@ public class MessagingController implements Runnable } } } - - interface MessageActor + + interface MessageActor { public void act(final Account account, final Folder folder, final List messages); } diff --git a/src/com/fsck/k9/MessagingControllerPushReceiver.java b/src/com/fsck/k9/MessagingControllerPushReceiver.java index 31c27e0d6..0630f25d6 100644 --- a/src/com/fsck/k9/MessagingControllerPushReceiver.java +++ b/src/com/fsck/k9/MessagingControllerPushReceiver.java @@ -75,7 +75,7 @@ public class MessagingControllerPushReceiver implements PushReceiver { controller.messagesArrived(account, folder, messages, false); } - + public void syncFolder(Folder folder) { if (K9.DEBUG) @@ -84,13 +84,13 @@ public class MessagingControllerPushReceiver implements PushReceiver controller.synchronizeMailbox(account, folder.getName(), new MessagingListener() { public void synchronizeMailboxFinished(Account account, String folder, - int totalMessagesInMailbox, int numNewMessages) + int totalMessagesInMailbox, int numNewMessages) { latch.countDown(); } - + public void synchronizeMailboxFailed(Account account, String folder, - String message) + String message) { latch.countDown(); } diff --git a/src/com/fsck/k9/MessagingListener.java b/src/com/fsck/k9/MessagingListener.java index 25a83d953..c3f01c4d1 100644 --- a/src/com/fsck/k9/MessagingListener.java +++ b/src/com/fsck/k9/MessagingListener.java @@ -18,11 +18,11 @@ import java.util.List; public class MessagingListener { public void searchStats(AccountStats stats) {} - + public void accountStatusChanged(BaseAccount account, AccountStats stats) { } - + public void accountSizeChanged(Account account, long oldSize, long newSize) { } diff --git a/src/com/fsck/k9/SearchAccount.java b/src/com/fsck/k9/SearchAccount.java index bdb999f92..231017db5 100644 --- a/src/com/fsck/k9/SearchAccount.java +++ b/src/com/fsck/k9/SearchAccount.java @@ -1,5 +1,5 @@ /** - * + * */ package com.fsck.k9; @@ -22,22 +22,22 @@ public class SearchAccount implements BaseAccount, SearchSpecification, Serializ private boolean builtin = false; private String[] accountUuids = null; private String[] folderNames = null; - + public SearchAccount(Preferences preferences) { - + } protected synchronized void delete(Preferences preferences) { - + } - + public synchronized void save(Preferences preferences) { - + } - - + + public SearchAccount(Context context, boolean nintegrate, Flag[] requiredFlags, Flag[] forbiddenFlags) { mRequiredFlags = requiredFlags; diff --git a/src/com/fsck/k9/SearchSpecification.java b/src/com/fsck/k9/SearchSpecification.java index 4d433645c..6cec76d72 100644 --- a/src/com/fsck/k9/SearchSpecification.java +++ b/src/com/fsck/k9/SearchSpecification.java @@ -5,16 +5,16 @@ import com.fsck.k9.mail.Flag; public interface SearchSpecification { - + public Flag[] getRequiredFlags(); public Flag[] getForbiddenFlags(); - + public boolean isIntegrate(); public String getQuery(); - + public String[] getAccountUuids(); - + public String[] getFolderNames(); } \ No newline at end of file diff --git a/src/com/fsck/k9/activity/Accounts.java b/src/com/fsck/k9/activity/Accounts.java index 65ba1ad93..1dfa33681 100644 --- a/src/com/fsck/k9/activity/Accounts.java +++ b/src/com/fsck/k9/activity/Accounts.java @@ -308,14 +308,14 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC @Override public void onCreate(Bundle icicle) { - unreadAccount = new SearchAccount(this, false, null, null ); + unreadAccount = new SearchAccount(this, false, null, null); unreadAccount.setDescription(getString(R.string.search_all_messages_title)); unreadAccount.setEmail(getString(R.string.search_all_messages_detail)); - + integratedInboxAccount = new SearchAccount(this, true, null, null); integratedInboxAccount.setDescription(getString(R.string.integrated_inbox_title)); integratedInboxAccount.setEmail(getString(R.string.integrated_inbox_detail)); - + super.onCreate(icicle); Account[] accounts = Preferences.getPreferences(this).getAccounts(); @@ -386,19 +386,19 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC private void refresh() { BaseAccount[] accounts = Preferences.getPreferences(this).getAccounts(); - + List newAccounts = new ArrayList (accounts.length + 4); if (accounts.length > 0) { newAccounts.add(integratedInboxAccount); newAccounts.add(unreadAccount); } - + for (BaseAccount account : accounts) { newAccounts.add(account); } - + mAdapter = new AccountsAdapter(newAccounts.toArray(new BaseAccount[0])); getListView().setAdapter(mAdapter); if (newAccounts.size() > 0) @@ -409,7 +409,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC for (BaseAccount account : newAccounts) { - + if (account instanceof Account) { pendingWork.put(account, "true"); @@ -420,7 +420,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC { pendingWork.put(account, "true"); final SearchAccount searchAccount = (SearchAccount)account; - + MessagingController.getInstance(getApplication()).searchLocalMessages(searchAccount, null, new MessagingListener() { @Override @@ -431,7 +431,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC }); } } - + } private void onAddNewAccount() @@ -556,7 +556,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC public void onClick(DialogInterface dialog, int whichButton) { dismissDialog(DIALOG_REMOVE_ACCOUNT); - + if (mSelectedContextAccount instanceof Account) { Account realAccount = (Account)mSelectedContextAccount; @@ -684,7 +684,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC { String appName = getString(R.string.app_name); WebView wv = new WebView(this); - String html = "" + + String html = "" + " " + String.format(getString(R.string.about_title_fmt), "" + appName + "") + "
" + "" + appName + " " + @@ -748,7 +748,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC super.onCreateContextMenu(menu, v, menuInfo); menu.setHeaderTitle(R.string.accounts_context_menu_title); getMenuInflater().inflate(R.menu.accounts_context, menu); - + AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; BaseAccount account = mAdapter.getItem(info.position); if (account instanceof SearchAccount) @@ -799,7 +799,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC view.setTag(holder); } AccountStats stats = accountStats.get(account.getUuid()); - + if (stats != null && account instanceof Account && stats.size >= 0) { holder.email.setText(SizeFormatter.formatSize(Accounts.this, stats.size)); @@ -808,7 +808,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC { holder.email.setText(account.getEmail()); } - + String description = account.getDescription(); if (description == null || description.length() == 0) { @@ -816,25 +816,25 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC } holder.description.setText(description); - + if (account.getEmail().equals(account.getDescription())) { holder.email.setVisibility(View.GONE); } - + Integer unreadMessageCount = null; if (stats != null) { unreadMessageCount = stats.unreadMessageCount; holder.newMessageCount.setText(Integer.toString(unreadMessageCount)); holder.newMessageCount.setVisibility(unreadMessageCount > 0 ? View.VISIBLE : View.GONE); - + holder.flaggedMessageCount.setText(Integer.toString(stats.flaggedMessageCount)); holder.flaggedMessageCount.setVisibility(K9.messageListStars() && stats.flaggedMessageCount > 0 ? View.VISIBLE : View.GONE); - + holder.flaggedMessageCount.setOnClickListener(new AccountClickListener(account, SearchModifier.FLAGGED)); holder.newMessageCount.setOnClickListener(new AccountClickListener(account, SearchModifier.UNREAD)); - + holder.activeIcons.setOnClickListener(new OnClickListener() { public void onClick(View v) @@ -843,7 +843,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC toast.show(); } } - ); + ); } else @@ -912,13 +912,13 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC } return flags.toArray(new Flag[0]); } - + private class AccountClickListener implements OnClickListener { - + final BaseAccount account; final SearchModifier searchModifier; - AccountClickListener(BaseAccount nAccount, SearchModifier nSearchModifier ) + AccountClickListener(BaseAccount nAccount, SearchModifier nSearchModifier) { account = nAccount; searchModifier = nSearchModifier; @@ -930,11 +930,11 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC if (account instanceof SearchAccount) { SearchAccount searchAccount = (SearchAccount)account; - - MessageList.actionHandle(Accounts.this, - description, "", searchAccount.isIntegrate(), - combine(searchAccount.getRequiredFlags(), searchModifier.requiredFlags), - combine(searchAccount.getForbiddenFlags(), searchModifier.forbiddenFlags)); + + MessageList.actionHandle(Accounts.this, + description, "", searchAccount.isIntegrate(), + combine(searchAccount.getRequiredFlags(), searchModifier.requiredFlags), + combine(searchAccount.getForbiddenFlags(), searchModifier.forbiddenFlags)); } else { @@ -975,12 +975,12 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC { return null; } - + }; MessageList.actionHandle(Accounts.this, description, searchSpec); } } - + } - + } diff --git a/src/com/fsck/k9/activity/EditIdentity.java b/src/com/fsck/k9/activity/EditIdentity.java index 491657f8e..e8d1cc6d0 100644 --- a/src/com/fsck/k9/activity/EditIdentity.java +++ b/src/com/fsck/k9/activity/EditIdentity.java @@ -74,7 +74,8 @@ public class EditIdentity extends K9Activity mSignatureUse = (CheckBox)findViewById(R.id.signature_use); mSignatureView = (EditText)findViewById(R.id.signature); mSignatureUse.setChecked(mIdentity.getSignatureUse()); - mSignatureUse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + mSignatureUse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() + { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) diff --git a/src/com/fsck/k9/activity/FolderList.java b/src/com/fsck/k9/activity/FolderList.java index 903454e82..cca259851 100644 --- a/src/com/fsck/k9/activity/FolderList.java +++ b/src/com/fsck/k9/activity/FolderList.java @@ -78,8 +78,8 @@ public class FolderList extends K9ListActivity { public void run() { - String dispString = mAdapter.mListener.formatHeader(FolderList.this, - getString(R.string.folder_list_title, mAccount.getDescription()), mUnreadMessageCount, getTimeFormat()); + String dispString = mAdapter.mListener.formatHeader(FolderList.this, + getString(R.string.folder_list_title, mAccount.getDescription()), mUnreadMessageCount, getTimeFormat()); setTitle(dispString); @@ -269,7 +269,7 @@ public class FolderList extends K9ListActivity } }); registerForContextMenu(mListView); - + mListView.setSaveEnabled(true); mInflater = getLayoutInflater(); @@ -382,7 +382,7 @@ public class FolderList extends K9ListActivity toast.show(); return true; } - + case KeyEvent.KEYCODE_1: { setDisplayMode(FolderMode.FIRST_CLASS); @@ -419,8 +419,8 @@ public class FolderList extends K9ListActivity } onRefresh(false); } - - + + private void onRefresh(final boolean forceRemote) { @@ -1113,14 +1113,14 @@ public class FolderList extends K9ListActivity super.pendingCommandsFinished(account); mHandler.refreshTitle(); } - + @Override public void pendingCommandStarted(Account account, String commandTitle) { super.pendingCommandStarted(account, commandTitle); mHandler.refreshTitle(); } - + @Override public void pendingCommandCompleted(Account account, String commandTitle) { @@ -1249,11 +1249,11 @@ public class FolderList extends K9ListActivity { holder.newMessageCount.setVisibility(View.GONE); } - + if (K9.messageListStars() && folder.flaggedMessageCount > 0) { holder.flaggedMessageCount.setText(Integer - .toString(folder.flaggedMessageCount)); + .toString(folder.flaggedMessageCount)); holder.flaggedMessageCount.setOnClickListener(new FolderClickListener(mAccount, folder.name, folder.displayName, SearchModifier.FLAGGED)); holder.flaggedMessageCount.setVisibility(View.VISIBLE); } @@ -1269,8 +1269,8 @@ public class FolderList extends K9ListActivity toast.show(); } } - ); - + ); + holder.chip.setBackgroundColor(mAccount.getChipColor()); holder.chip.getBackground().setAlpha(folder.unreadMessageCount == 0 ? 127 : 255); @@ -1303,7 +1303,7 @@ public class FolderList extends K9ListActivity public long lastChecked; public int unreadMessageCount; - + public int flaggedMessageCount; public boolean loading; @@ -1325,7 +1325,7 @@ public class FolderList extends K9ListActivity { return this.name.equals(((FolderInfoHolder)o).name); } - + @Override public int hashCode() { @@ -1364,7 +1364,7 @@ public class FolderList extends K9ListActivity try { folder.open(Folder.OpenMode.READ_WRITE); - // unreadCount = folder.getUnreadMessageCount(); + // unreadCount = folder.getUnreadMessageCount(); } catch (MessagingException me) { @@ -1410,7 +1410,7 @@ public class FolderList extends K9ListActivity this.status = mess; this.unreadMessageCount = unreadCount; - + try { this.flaggedMessageCount = folder.getFlaggedMessageCount(); @@ -1438,15 +1438,15 @@ public class FolderList extends K9ListActivity public String rawFolderName; public View chip; } - + private class FolderClickListener implements OnClickListener { - + final BaseAccount account; final String folderName; final String displayName; final SearchModifier searchModifier; - FolderClickListener(BaseAccount nAccount, String folderName, String displayName, SearchModifier nSearchModifier ) + FolderClickListener(BaseAccount nAccount, String folderName, String displayName, SearchModifier nSearchModifier) { account = nAccount; this.folderName = folderName; @@ -1456,10 +1456,10 @@ public class FolderList extends K9ListActivity @Override public void onClick(View v) { - String description = getString(R.string.search_title, - getString(R.string.message_list_title, account.getDescription(), displayName), - getString(searchModifier.resId)); - + String description = getString(R.string.search_title, + getString(R.string.message_list_title, account.getDescription(), displayName), + getString(searchModifier.resId)); + SearchSpecification searchSpec = new SearchSpecification() { @Override @@ -1497,14 +1497,14 @@ public class FolderList extends K9ListActivity { return new String[] { folderName }; } - + }; MessageList.actionHandle(FolderList.this, description, searchSpec); - + } - + } - + } diff --git a/src/com/fsck/k9/activity/MessageCompose.java b/src/com/fsck/k9/activity/MessageCompose.java index 45c7f6b1a..b4d9f50a2 100644 --- a/src/com/fsck/k9/activity/MessageCompose.java +++ b/src/com/fsck/k9/activity/MessageCompose.java @@ -379,7 +379,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc if ("mailto".equals(uri.getScheme())) { initializeFromMailTo(uri.toString()); - } + } else { String toText = uri.getSchemeSpecificPart(); @@ -980,11 +980,13 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc File f = new File(uriString.substring("file://".length())); attachment.size = f.length(); } - else { + else + { Log.v(K9.LOG_TAG, "Not a file: " + uriString); } } - else { + else + { Log.v(K9.LOG_TAG, "old attachment.size: " + attachment.size); } Log.v(K9.LOG_TAG, "new attachment.size: " + attachment.size); @@ -1575,7 +1577,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc mDraftUid = newUid; } } - + if (account.equals(mAccount) && (folder.equals(mFolder))) { if (oldUid.equals(mSourceMessageUid)) @@ -1591,7 +1593,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc } private String decode(String s) - throws UnsupportedEncodingException + throws UnsupportedEncodingException { return URLDecoder.decode(s, "UTF-8"); } @@ -1599,14 +1601,15 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc /** * When we are launched with an intent that includes a mailto: URI, we can actually * gather quite a few of our message fields from it. - * + * * @mailToString the href (which must start with "mailto:"). */ - private void initializeFromMailTo(String mailToString) { - + private void initializeFromMailTo(String mailToString) + { + // Chop up everything between mailto: and ? to find recipients int index = mailToString.indexOf("?"); - int length = "mailto".length() + 1; + int length = "mailto".length() + 1; String to; try { @@ -1614,13 +1617,13 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc if (index == -1) { to = decode(mailToString.substring(length)); - } + } else { to = decode(mailToString.substring(length, index)); } mToView.setText(to); - } + } catch (UnsupportedEncodingException e) { Log.e(K9.LOG_TAG, e.getMessage() + " while decoding '" + mailToString + "'"); @@ -1660,5 +1663,5 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc { mMessageContentView.setText(body.get(0)); } - } + } } diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index e91dd5d56..b229324c0 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -57,7 +57,7 @@ public class MessageList private static final int ACTIVITY_CHOOSE_FOLDER_MOVE = 1; private static final int ACTIVITY_CHOOSE_FOLDER_COPY = 2; - + private static final int ACTIVITY_CHOOSE_FOLDER_MOVE_BATCH = 3; private static final int ACTIVITY_CHOOSE_FOLDER_COPY_BATCH = 4; @@ -67,7 +67,7 @@ public class MessageList private static final String EXTRA_QUERY_FLAGS = "queryFlags"; private static final String EXTRA_FORBIDDEN_FLAGS = "forbiddenFlags"; private static final String EXTRA_INTEGRATE = "integrate"; - private static final String EXTRA_ACCOUNT_UUIDS = "accountUuids"; + private static final String EXTRA_ACCOUNT_UUIDS = "accountUuids"; private static final String EXTRA_FOLDER_NAMES = "folderNames"; private static final String EXTRA_TITLE = "title"; @@ -312,7 +312,7 @@ public class MessageList } return intent; } - + public static void actionHandle(Context context, String title, String queryString, boolean integrate, Flag[] flags, Flag[] forbiddenFlags) { Intent intent = new Intent(context, MessageList.class); @@ -330,7 +330,7 @@ public class MessageList context.startActivity(intent); } - + public static void actionHandle(Context context, String title, SearchSpecification searchSpecification) { Intent intent = new Intent(context, MessageList.class); @@ -348,7 +348,7 @@ public class MessageList intent.putExtra(EXTRA_FOLDER_NAMES, searchSpecification.getFolderNames()); intent.putExtra(EXTRA_TITLE, title); context.startActivity(intent); - + } public void onItemClick(AdapterView> parent, View view, int position, long id) @@ -394,7 +394,7 @@ public class MessageList mAccount = Preferences.getPreferences(this).getAccount(accountUuid); mFolderName = intent.getStringExtra(EXTRA_FOLDER); mQueryString = intent.getStringExtra(EXTRA_QUERY); - + String queryFlags = intent.getStringExtra(EXTRA_QUERY_FLAGS); if (queryFlags != null) { @@ -417,9 +417,9 @@ public class MessageList } mIntegrate = intent.getBooleanExtra(EXTRA_INTEGRATE, false); mAccountUuids = intent.getStringArrayExtra(EXTRA_ACCOUNT_UUIDS); - mFolderNames = intent.getStringArrayExtra(EXTRA_FOLDER_NAMES); + mFolderNames = intent.getStringArrayExtra(EXTRA_FOLDER_NAMES); mTitle = intent.getStringExtra(EXTRA_TITLE); - + // Take the initial folder into account only if we are *not* restoring the // activity already @@ -498,7 +498,7 @@ public class MessageList } - private void initializeLayout () + private void initializeLayout() { requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); requestWindowFeature(Window.FEATURE_PROGRESS); @@ -633,7 +633,7 @@ public class MessageList onDelete(message, position); return true; } - + case KeyEvent.KEYCODE_S: { setSelected(message, !message.selected); @@ -695,7 +695,7 @@ public class MessageList { result = super.onKeyDown(keyCode, event); } - + return result; }//onKeyDown @@ -1087,7 +1087,7 @@ public class MessageList int itemId = item.getItemId(); switch (itemId) { - + case R.id.compose: onCompose(); @@ -1137,7 +1137,7 @@ public class MessageList setAllSelected(false); toggleBatchButtons(); return true; - + case R.id.batch_delete_op: deleteSelected(); return true; @@ -1209,7 +1209,7 @@ public class MessageList onMoveBatch(); return true; - + case R.id.expunge: if (mCurrentFolder != null) { @@ -1243,7 +1243,7 @@ public class MessageList { boolean anySelected = anySelected(); setOpsState(menu, true, anySelected); - + if (mQueryString != null) { menu.findItem(R.id.mark_all_as_read).setVisible(false); @@ -1656,14 +1656,14 @@ public class MessageList { addOrUpdateMessage(account, folder, message); } - + @Override public void searchStats(AccountStats stats) { mUnreadMessageCount = stats.unreadMessageCount; mHandler.refreshTitle(); } - + @Override public void folderStatusChanged(Account account, String folder, int unreadMessageCount) { @@ -2277,7 +2277,7 @@ public class MessageList { return (this.uid.equals(((MessageInfoHolder)o).uid)); } - + @Override public int hashCode() { @@ -2701,7 +2701,7 @@ public class MessageList mSelectedCount = 0; toggleBatchButtons(); } - + private void onMoveBatch() { if (mController.isMoveCapable(mAccount) == false) @@ -2751,7 +2751,7 @@ public class MessageList } } mAdapter.removeMessages(removeHolderList); - + mController.moveMessages(mAccount, mCurrentFolder.name, messageList.toArray(new Message[0]), folderName, null); mSelectedCount = 0; toggleBatchButtons(); @@ -2802,7 +2802,7 @@ public class MessageList messageList.add(holder.message); } } - + mController.copyMessages(mAccount, mCurrentFolder.name, messageList.toArray(new Message[0]), folderName, null); } } diff --git a/src/com/fsck/k9/activity/MessageReference.java b/src/com/fsck/k9/activity/MessageReference.java index c93834576..9d5c391f4 100644 --- a/src/com/fsck/k9/activity/MessageReference.java +++ b/src/com/fsck/k9/activity/MessageReference.java @@ -7,7 +7,7 @@ public class MessageReference implements Serializable String accountUuid; String folderName; String uid; - + public boolean equals(Object o) { if (o instanceof MessageReference == false) @@ -26,9 +26,9 @@ public class MessageReference implements Serializable public String toString() { return "MessageReference{accountUuid = '" + - accountUuid - + "', folderName = '" + folderName - + "', uid = '" + uid - + "'}"; + accountUuid + + "', folderName = '" + folderName + + "', uid = '" + uid + + "'}"; } } diff --git a/src/com/fsck/k9/activity/MessageView.java b/src/com/fsck/k9/activity/MessageView.java index 1ad94853f..9b3478a70 100644 --- a/src/com/fsck/k9/activity/MessageView.java +++ b/src/com/fsck/k9/activity/MessageView.java @@ -279,7 +279,7 @@ public class MessageView extends K9Activity implements OnClickListener mTimeView.setText(time); mToView.setText(to); - mCcContainerView.setVisibility((cc != null && cc.length() > 0 )? View.VISIBLE : View.GONE); + mCcContainerView.setVisibility((cc != null && cc.length() > 0)? View.VISIBLE : View.GONE); mCcView.setText(cc); mAttachmentIcon.setVisibility(hasAttachments ? View.VISIBLE : View.GONE); @@ -451,7 +451,7 @@ public class MessageView extends K9Activity implements OnClickListener mCcContainerView = (LinearLayout)findViewById(R.id.cc_container); mSubjectView = (TextView)findViewById(R.id.subject); defaultSubjectColor = mSubjectView.getCurrentTextColor(); - + chip = findViewById(R.id.chip); mDateView = (TextView)findViewById(R.id.date); @@ -557,12 +557,12 @@ public class MessageView extends K9Activity implements OnClickListener Toast.makeText(this, "Invalid account id: " + accountId, Toast.LENGTH_LONG).show(); return; } - + mMessageReference = new MessageReference(); mMessageReference.accountUuid = mAccount.getUuid(); mMessageReference.folderName = segmentList.get(1); mMessageReference.uid = segmentList.get(2); - + mMessageReferences = new ArrayList
(); } else @@ -631,9 +631,9 @@ public class MessageView extends K9Activity implements OnClickListener mMessageReference = ref; if (K9.DEBUG) Log.d(K9.LOG_TAG, "MessageView displaying message " + mMessageReference); - + mAccount = Preferences.getPreferences(this).getAccount(ref.accountUuid); - + mMessageContentView.getSettings().setBlockNetworkImage(true); K9.setBlockNetworkLoads(mMessageContentView.getSettings(), true); @@ -1052,7 +1052,7 @@ public class MessageView extends K9Activity implements OnClickListener mShowPicturesSection.setVisibility(View.GONE); } - + public void onClick(View view) { switch (view.getId()) @@ -1347,7 +1347,7 @@ public class MessageView extends K9Activity implements OnClickListener public void loadMessageForViewHeadersAvailable(Account account, String folder, String uid, final Message message) { - if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) + if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) || !mMessageReference.accountUuid.equals(account.getUuid())) { return; @@ -1355,7 +1355,7 @@ public class MessageView extends K9Activity implements OnClickListener MessageView.this.mMessage = message; if (!message.isSet(Flag.X_DOWNLOADED_FULL) - && !message.isSet(Flag.X_DOWNLOADED_PARTIAL)) + && !message.isSet(Flag.X_DOWNLOADED_PARTIAL)) { mHandler.post(new Runnable() { @@ -1379,7 +1379,7 @@ public class MessageView extends K9Activity implements OnClickListener public void loadMessageForViewBodyAvailable(Account account, String folder, String uid, Message message) { - if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) + if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) || !mMessageReference.accountUuid.equals(account.getUuid())) { return; @@ -1388,8 +1388,8 @@ public class MessageView extends K9Activity implements OnClickListener try { if (MessageView.this.mMessage!=null - && MessageView.this.mMessage.isSet(Flag.X_DOWNLOADED_PARTIAL) - && message.isSet(Flag.X_DOWNLOADED_FULL)) + && MessageView.this.mMessage.isSet(Flag.X_DOWNLOADED_PARTIAL) + && message.isSet(Flag.X_DOWNLOADED_FULL)) { setHeaders(account, folder, uid, message); @@ -1467,7 +1467,7 @@ public class MessageView extends K9Activity implements OnClickListener public void loadMessageForViewFailed(Account account, String folder, String uid, final Throwable t) { - if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) + if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) || !mMessageReference.accountUuid.equals(account.getUuid())) { return; @@ -1498,7 +1498,7 @@ public class MessageView extends K9Activity implements OnClickListener public void loadMessageForViewFinished(Account account, String folder, String uid, Message message) { - if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) + if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) || !mMessageReference.accountUuid.equals(account.getUuid())) { return; @@ -1516,7 +1516,7 @@ public class MessageView extends K9Activity implements OnClickListener @Override public void loadMessageForViewStarted(Account account, String folder, String uid) { - if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) + if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) || !mMessageReference.accountUuid.equals(account.getUuid())) { return; diff --git a/src/com/fsck/k9/activity/SearchModifier.java b/src/com/fsck/k9/activity/SearchModifier.java index a6c86f878..c9e48ca81 100644 --- a/src/com/fsck/k9/activity/SearchModifier.java +++ b/src/com/fsck/k9/activity/SearchModifier.java @@ -1,5 +1,5 @@ /** - * + * */ package com.fsck.k9.activity; @@ -8,17 +8,17 @@ import com.fsck.k9.mail.Flag; enum SearchModifier { - FLAGGED(R.string.flagged_modifier, new Flag[] { Flag.FLAGGED}, null), UNREAD(R.string.unread_modifier, null, new Flag[] { Flag.SEEN} ); - + FLAGGED(R.string.flagged_modifier, new Flag[] { Flag.FLAGGED}, null), UNREAD(R.string.unread_modifier, null, new Flag[] { Flag.SEEN}); + final int resId; final Flag[] requiredFlags; final Flag[] forbiddenFlags; - + SearchModifier(int nResId, Flag[] nRequiredFlags, Flag[] nForbiddenFlags) { resId = nResId; requiredFlags = nRequiredFlags; forbiddenFlags = nForbiddenFlags; } - + } \ No newline at end of file diff --git a/src/com/fsck/k9/activity/setup/AccountSettings.java b/src/com/fsck/k9/activity/setup/AccountSettings.java index fa353da72..7e9fe82a6 100644 --- a/src/com/fsck/k9/activity/setup/AccountSettings.java +++ b/src/com/fsck/k9/activity/setup/AccountSettings.java @@ -249,7 +249,7 @@ public class AccountSettings extends K9PreferenceActivity return false; } }); - + mSearchableFolders = (ListPreference) findPreference(PREFERENCE_SEARCHABLE_FOLDERS); mSearchableFolders.setValue(mAccount.getSearchableFolders().name()); mSearchableFolders.setSummary(mSearchableFolders.getEntry()); @@ -325,7 +325,8 @@ public class AccountSettings extends K9PreferenceActivity mAutoExpandFolder.setSummary(translateFolder(mAccount.getAutoExpandFolderName())); mAutoExpandFolder.setOnPreferenceClickListener( - new Preference.OnPreferenceClickListener() { + new Preference.OnPreferenceClickListener() + { public boolean onPreferenceClick(Preference preference) { onChooseAutoExpandFolder(); @@ -338,13 +339,14 @@ public class AccountSettings extends K9PreferenceActivity mChipColor = (Preference)findPreference(PREFERENCE_CHIP_COLOR); mChipColor.setOnPreferenceClickListener( - new Preference.OnPreferenceClickListener() { + new Preference.OnPreferenceClickListener() + { public boolean onPreferenceClick(Preference preference) { onChooseChipColor(); return false; } - } + } ); @@ -415,18 +417,18 @@ public class AccountSettings extends K9PreferenceActivity mAccount.setDeletePolicy(Integer.parseInt(mDeletePolicy.getValue())); mAccount.setExpungePolicy(mExpungePolicy.getValue()); mAccount.setSearchableFolders(Account.Searchable.valueOf(mSearchableFolders.getValue())); - + boolean needsRefresh = mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue())); needsRefresh |= mAccount.setFolderSyncMode(Account.FolderMode.valueOf(mSyncMode.getValue())); - + boolean needsPushRestart = mAccount.setFolderPushMode(Account.FolderMode.valueOf(mPushMode.getValue())); if (mAccount.getFolderPushMode() != FolderMode.NONE) { needsPushRestart |= mAccount.setFolderDisplayMode(Account.FolderMode.valueOf(mDisplayMode.getValue())); needsPushRestart |= mAccount.setMaxPushFolders(Integer.parseInt(mPushLimit.getValue())); - needsPushRestart |= mIncomingChanged; + needsPushRestart |= mIncomingChanged; } - + SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences(); String newRingtone = prefs.getString(PREFERENCE_RINGTONE, null); if (newRingtone != null) @@ -509,9 +511,14 @@ public class AccountSettings extends K9PreferenceActivity public void onChooseChipColor() { - new ColorPickerDialog(this, new ColorPickerDialog.OnColorChangedListener () { - public void colorChanged (int color) { mAccount.setChipColor(color); } }, - mAccount.getChipColor()).show(); + new ColorPickerDialog(this, new ColorPickerDialog.OnColorChangedListener() + { + public void colorChanged(int color) + { + mAccount.setChipColor(color); + } + }, + mAccount.getChipColor()).show(); } public void onChooseAutoExpandFolder() diff --git a/src/com/fsck/k9/activity/setup/AccountSetupBasics.java b/src/com/fsck/k9/activity/setup/AccountSetupBasics.java index 9bfc8e0e7..9f4f57f20 100644 --- a/src/com/fsck/k9/activity/setup/AccountSetupBasics.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupBasics.java @@ -237,7 +237,7 @@ public class AccountSetupBasics extends K9Activity URI outgoingUri = null; try { - String userEnc = URLEncoder.encode(user, "UTF-8"); + String userEnc = URLEncoder.encode(user, "UTF-8"); String passwordEnc = URLEncoder.encode(password, "UTF-8"); String incomingUsername = mProvider.incomingUsernameTemplate; @@ -343,7 +343,7 @@ public class AccountSetupBasics extends K9Activity mAccount.setEmail(email); try { - String userEnc = URLEncoder.encode(user, "UTF-8"); + String userEnc = URLEncoder.encode(user, "UTF-8"); String passwordEnc = URLEncoder.encode(password, "UTF-8"); URI uri = new URI("placeholder", userEnc + ":" + passwordEnc, "mail." + domain, -1, null, diff --git a/src/com/fsck/k9/activity/setup/AccountSetupComposition.java b/src/com/fsck/k9/activity/setup/AccountSetupComposition.java index 9fbe27da8..e5f1a9ddd 100644 --- a/src/com/fsck/k9/activity/setup/AccountSetupComposition.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupComposition.java @@ -69,25 +69,26 @@ public class AccountSetupComposition extends K9Activity mAccountAlwaysBcc = (EditText)findViewById(R.id.account_always_bcc); mAccountAlwaysBcc.setText(mAccount.getAlwaysBcc()); - mAccountSignatureLayout = (LinearLayout)findViewById(R.id.account_signature_layout); + mAccountSignatureLayout = (LinearLayout)findViewById(R.id.account_signature_layout); - mAccountSignatureUse = (CheckBox)findViewById(R.id.account_signature_use); + mAccountSignatureUse = (CheckBox)findViewById(R.id.account_signature_use); boolean useSignature = mAccount.getSignatureUse(); mAccountSignatureUse.setChecked(useSignature); - mAccountSignatureUse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + mAccountSignatureUse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() + { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { - mAccountSignatureLayout.setVisibility(View.VISIBLE); - mAccountSignature.setText(mAccount.getSignature()); - boolean isSignatureBeforeQuotedText = mAccount.isSignatureBeforeQuotedText(); - mAccountSignatureBeforeLocation.setChecked(isSignatureBeforeQuotedText); - mAccountSignatureAfterLocation.setChecked(!isSignatureBeforeQuotedText); + mAccountSignatureLayout.setVisibility(View.VISIBLE); + mAccountSignature.setText(mAccount.getSignature()); + boolean isSignatureBeforeQuotedText = mAccount.isSignatureBeforeQuotedText(); + mAccountSignatureBeforeLocation.setChecked(isSignatureBeforeQuotedText); + mAccountSignatureAfterLocation.setChecked(!isSignatureBeforeQuotedText); } else { - mAccountSignatureLayout.setVisibility(View.GONE); + mAccountSignatureLayout.setVisibility(View.GONE); } } }); @@ -107,7 +108,7 @@ public class AccountSetupComposition extends K9Activity } else { - mAccountSignatureLayout.setVisibility(View.GONE); + mAccountSignatureLayout.setVisibility(View.GONE); } } @@ -126,9 +127,9 @@ public class AccountSetupComposition extends K9Activity mAccount.setSignatureUse(mAccountSignatureUse.isChecked()); if (mAccountSignatureUse.isChecked()) { - mAccount.setSignature(mAccountSignature.getText().toString()); - boolean isSignatureBeforeQuotedText = mAccountSignatureBeforeLocation.isChecked(); - mAccount.setSignatureBeforeQuotedText(isSignatureBeforeQuotedText); + mAccount.setSignature(mAccountSignature.getText().toString()); + boolean isSignatureBeforeQuotedText = mAccountSignatureBeforeLocation.isChecked(); + mAccount.setSignatureBeforeQuotedText(isSignatureBeforeQuotedText); } mAccount.save(Preferences.getPreferences(this)); diff --git a/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java b/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java index d22b53d6f..d3d5839fb 100644 --- a/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java @@ -449,8 +449,8 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener */ try { - String usernameEnc = URLEncoder.encode(mUsernameView.getText().toString(), "UTF-8"); - String passwordEnc = URLEncoder.encode(mPasswordView.getText().toString(), "UTF-8"); + String usernameEnc = URLEncoder.encode(mUsernameView.getText().toString(), "UTF-8"); + String passwordEnc = URLEncoder.encode(mPasswordView.getText().toString(), "UTF-8"); URI oldUri = new URI(mAccount.getTransportUri()); URI uri = new URI( oldUri.getScheme(), @@ -502,7 +502,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener final String userInfo; String user = mUsernameView.getText().toString(); String password = mPasswordView.getText().toString(); - String userEnc = URLEncoder.encode(user, "UTF-8"); + String userEnc = URLEncoder.encode(user, "UTF-8"); String passwordEnc = URLEncoder.encode(password, "UTF-8"); if (mAccountSchemes[securityType].startsWith("imap")) diff --git a/src/com/fsck/k9/activity/setup/FolderSettings.java b/src/com/fsck/k9/activity/setup/FolderSettings.java index d1017d3ef..9ebb6c5dc 100644 --- a/src/com/fsck/k9/activity/setup/FolderSettings.java +++ b/src/com/fsck/k9/activity/setup/FolderSettings.java @@ -84,12 +84,12 @@ public class FolderSettings extends K9PreferenceActivity Preference category = findPreference(PREFERENCE_TOP_CATERGORY); category.setTitle(folderName); - + mInTopGroup = (CheckBoxPreference)findPreference(PREFERENCE_IN_TOP_GROUP); mInTopGroup.setChecked(mFolder.isInTopGroup()); mIntegrate = (CheckBoxPreference)findPreference(PREFERENCE_INTEGRATE); mIntegrate.setChecked(mFolder.isIntegrate()); - + mDisplayClass = (ListPreference) findPreference(PREFERENCE_DISPLAY_CLASS); mDisplayClass.setValue(mFolder.getDisplayClass().name()); mDisplayClass.setSummary(mDisplayClass.getEntry()); @@ -161,14 +161,14 @@ public class FolderSettings extends K9PreferenceActivity mFolder.setDisplayClass(FolderClass.valueOf(mDisplayClass.getValue())); mFolder.setSyncClass(FolderClass.valueOf(mSyncClass.getValue())); mFolder.setPushClass(FolderClass.valueOf(mPushClass.getValue())); - + FolderClass newPushClass = mFolder.getPushClass(); FolderClass newDisplayClass = mFolder.getDisplayClass(); - + try { mFolder.save(Preferences.getPreferences(this)); - if (oldPushClass != newPushClass + if (oldPushClass != newPushClass || (newPushClass != FolderClass.NO_CLASS && oldDisplayClass != newDisplayClass)) { MailService.actionRestartPushers(getApplication(), null); diff --git a/src/com/fsck/k9/activity/setup/FontSizeSettings.java b/src/com/fsck/k9/activity/setup/FontSizeSettings.java index 9ecc2b957..59042108b 100644 --- a/src/com/fsck/k9/activity/setup/FontSizeSettings.java +++ b/src/com/fsck/k9/activity/setup/FontSizeSettings.java @@ -13,13 +13,13 @@ import com.fsck.k9.*; /** * Activity to configure the font size of the information displayed in the * account list, folder list, message list and in the message view. - * + * * @see FontSizes */ public class FontSizeSettings extends K9PreferenceActivity { /* - * Keys of the preferences defined in res/xml/font_preferences.xml + * Keys of the preferences defined in res/xml/font_preferences.xml */ private static final String PREFERENCE_ACCOUNT_NAME_FONT = "account_name_font"; private static final String PREFERENCE_ACCOUNT_DESCRIPTION_FONT = "account_description_font"; @@ -54,7 +54,7 @@ public class FontSizeSettings extends K9PreferenceActivity /** * Start the FontSizeSettings activity. - * + * * @param context The application context. */ public static void actionEditSettings(Context context) @@ -134,10 +134,10 @@ public class FontSizeSettings extends K9PreferenceActivity /** * Set up the ListPreference instance identified by key
. - * + * * @param key The key of the ListPreference object. * @param value Initial value for the ListPreference object. - * @return The ListPreference instance identified bykey
. + * @return The ListPreference instance identified bykey
. */ private ListPreference initializeListPreference(String key, int value) { @@ -149,7 +149,7 @@ public class FontSizeSettings extends K9PreferenceActivity } /** - * This class handles value changes of the ListPreference objects. + * This class handles value changes of the ListPreference objects. */ private class PreferenceChangeListener implements Preference.OnPreferenceChangeListener { @@ -161,7 +161,7 @@ public class FontSizeSettings extends K9PreferenceActivity } /** - * Show the preference value in the preference summary field. + * Show the preference value in the preference summary field. */ @Override public boolean onPreferenceChange(Preference preference, Object newValue) diff --git a/src/com/fsck/k9/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java index 40ab89354..c17c29b64 100644 --- a/src/com/fsck/k9/activity/setup/Prefs.java +++ b/src/com/fsck/k9/activity/setup/Prefs.java @@ -82,13 +82,13 @@ public class Prefs extends K9PreferenceActivity findPreference(PREFERENCE_FONT_SIZE).setOnPreferenceClickListener( new Preference.OnPreferenceClickListener() + { + public boolean onPreferenceClick(Preference preference) { - public boolean onPreferenceClick(Preference preference) - { - onFontSizeSettings(); - return true; - } - }); + onFontSizeSettings(); + return true; + } + }); mDateFormat = (ListPreference) findPreference(PREFERENCE_DATE_FORMAT); String[] formats = DateFormatter.getFormats(this); @@ -152,10 +152,10 @@ public class Prefs extends K9PreferenceActivity mTouchable = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_TOUCHABLE); mTouchable.setChecked(K9.messageListTouchable()); - + mMeasureAccounts = (CheckBoxPreference)findPreference(PREFERENCE_MEASURE_ACCOUNTS); mMeasureAccounts.setChecked(K9.measureAccounts()); - + mCountSearch = (CheckBoxPreference)findPreference(PREFERENCE_COUNT_SEARCH); mCountSearch.setChecked(K9.countSearchMessages()); } diff --git a/src/com/fsck/k9/mail/Address.java b/src/com/fsck/k9/mail/Address.java index 6590470bf..245c22ebb 100644 --- a/src/com/fsck/k9/mail/Address.java +++ b/src/com/fsck/k9/mail/Address.java @@ -151,7 +151,7 @@ public class Address } return super.equals(o); } - + @Override public int hashCode() { diff --git a/src/com/fsck/k9/mail/Folder.java b/src/com/fsck/k9/mail/Folder.java index 9fb6e40b5..330a70f12 100644 --- a/src/com/fsck/k9/mail/Folder.java +++ b/src/com/fsck/k9/mail/Folder.java @@ -203,7 +203,7 @@ public abstract class Folder { } - + public boolean isInTopGroup() { return false; diff --git a/src/com/fsck/k9/mail/Multipart.java b/src/com/fsck/k9/mail/Multipart.java index b182c7df1..3c91a107f 100644 --- a/src/com/fsck/k9/mail/Multipart.java +++ b/src/com/fsck/k9/mail/Multipart.java @@ -59,24 +59,24 @@ public abstract class Multipart implements Body this.mParent = parent; } - public void setEncoding(String encoding) - { - for (BodyPart part : mParts) - { - try - { - Body body = part.getBody(); - if (body instanceof TextBody) - { - part.setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, encoding); - ((TextBody)body).setEncoding(encoding); - } - } - catch (MessagingException e) - { - // Ignore - } - } - - } + public void setEncoding(String encoding) + { + for (BodyPart part : mParts) + { + try + { + Body body = part.getBody(); + if (body instanceof TextBody) + { + part.setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, encoding); + ((TextBody)body).setEncoding(encoding); + } + } + catch (MessagingException e) + { + // Ignore + } + } + + } } diff --git a/src/com/fsck/k9/mail/internet/MimeMessage.java b/src/com/fsck/k9/mail/internet/MimeMessage.java index fbe2b773b..802d5801a 100644 --- a/src/com/fsck/k9/mail/internet/MimeMessage.java +++ b/src/com/fsck/k9/mail/internet/MimeMessage.java @@ -457,11 +457,11 @@ public class MimeMessage extends Message @Override public void setEncoding(String encoding) { - if (mBody instanceof Multipart) - { - ((Multipart)mBody).setEncoding(encoding); - } - else if (mBody instanceof TextBody) + if (mBody instanceof Multipart) + { + ((Multipart)mBody).setEncoding(encoding); + } + else if (mBody instanceof TextBody) { setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, encoding); ((TextBody)mBody).setEncoding(encoding); diff --git a/src/com/fsck/k9/mail/internet/TextBody.java b/src/com/fsck/k9/mail/internet/TextBody.java index 9bcac1ab5..a407ea25e 100644 --- a/src/com/fsck/k9/mail/internet/TextBody.java +++ b/src/com/fsck/k9/mail/internet/TextBody.java @@ -71,6 +71,6 @@ public class TextBody implements Body public void setEncoding(String encoding) { - mEncoding = encoding; + mEncoding = encoding; } } diff --git a/src/com/fsck/k9/mail/store/ImapResponseParser.java b/src/com/fsck/k9/mail/store/ImapResponseParser.java index 5aab99244..fbbd99c9d 100644 --- a/src/com/fsck/k9/mail/store/ImapResponseParser.java +++ b/src/com/fsck/k9/mail/store/ImapResponseParser.java @@ -440,14 +440,14 @@ public class ImapResponseParser throw new MessagingException("Unable to parse IMAP datetime", pe); } } - + public boolean containsKey(Object key) { if (key == null) { return false; } - + for (int i = 0, count = size(); i < count; i++) { if (key.equals(get(i))) @@ -457,7 +457,7 @@ public class ImapResponseParser } return false; } - + public int getKeyIndex(Object key) { for (int i = 0, count = size(); i < count; i++) @@ -467,7 +467,7 @@ public class ImapResponseParser return i; } } - + throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection."); } diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index 5549142b5..12ca591a3 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -64,7 +64,7 @@ public class ImapStore extends Store private static final int IDLE_REFRESH_INTERVAL = 20 * 60 * 1000; // 20 minutes private static final int IDLE_FAILURE_COUNT_LIMIT = 10; private static int MAX_DELAY_TIME = 5 * 60 * 1000; // 5 minutes - private static int NORMAL_DELAY_TIME = 5000; + private static int NORMAL_DELAY_TIME = 5000; private static final Flag[] PERMANENT_FLAGS = { Flag.DELETED, Flag.SEEN }; @@ -75,7 +75,7 @@ public class ImapStore extends Store private static final String CAPABILITY_CAPABILITY = "CAPABILITY"; private static final String COMMAND_CAPABILITY = "CAPABILITY"; - + private static final String CAPABILITY_COMPRESS_DEFLATE = "COMPRESS=DEFLATE"; private static final String COMMAND_COMPRESS_DEFLATE = "COMPRESS DEFLATE"; @@ -862,7 +862,7 @@ public class ImapStore extends Store throw ioExceptionHandler(mConnection, ioe); } } - + @Override public int getFlaggedMessageCount() throws MessagingException { @@ -890,7 +890,7 @@ public class ImapStore extends Store throw ioExceptionHandler(mConnection, ioe); } } - + protected int getHighestUid() { try @@ -967,7 +967,7 @@ public class ImapStore extends Store }; return search(searcher, listener); } - + private Message[] search(ImapSearcher searcher, MessageRetrievalListener listener) throws MessagingException { @@ -1274,7 +1274,7 @@ public class ImapStore extends Store if (part != null) { String contentTransferEncoding = part.getHeader( - MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0]; + MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0]; part.setBody(MimeUtility.decodeBody(bodyStream, contentTransferEncoding)); } else @@ -1843,7 +1843,7 @@ public class ImapStore extends Store } return super.equals(o); } - + @Override public int hashCode() { @@ -1882,7 +1882,7 @@ public class ImapStore extends Store { return "conn" + hashCode(); } - + private ListreceiveCapabilities(List responses) { for (ImapResponse response : responses) @@ -1907,7 +1907,7 @@ public class ImapStore extends Store { capabilityList = response; } - + if (capabilityList != null) { if (capabilityList.size() > 0 && capabilityList.get(0).equals(CAPABILITY_CAPABILITY)) @@ -1927,7 +1927,7 @@ public class ImapStore extends Store capabilities.add((String)capability); } } - + } } } @@ -1995,7 +1995,7 @@ public class ImapStore extends Store List nullResponses = new LinkedList (); nullResponses.add(nullResponse); receiveCapabilities(nullResponses); - + if (hasCapability(CAPABILITY_CAPABILITY) == false) { if (K9.DEBUG) @@ -2006,7 +2006,7 @@ public class ImapStore extends Store throw new MessagingException("Invalid CAPABILITY response received"); } } - + if (mConnectionSecurity == CONNECTION_SECURITY_TLS_OPTIONAL || mConnectionSecurity == CONNECTION_SECURITY_TLS_REQUIRED) { @@ -2053,7 +2053,7 @@ public class ImapStore extends Store { throw new MessagingException("Invalid CAPABILITY response received"); } - + } else if (mAuthType == AuthType.PLAIN) { @@ -2078,7 +2078,7 @@ public class ImapStore extends Store { ConnectivityManager connectivityManager = (ConnectivityManager)K9.app.getSystemService(Context.CONNECTIVITY_SERVICE); boolean useCompression = true; - + NetworkInfo netInfo = connectivityManager.getActiveNetworkInfo(); if (netInfo != null) { @@ -2086,7 +2086,7 @@ public class ImapStore extends Store if (K9.DEBUG) Log.d(K9.LOG_TAG, "On network type " + type); useCompression = mAccount.useCompression(type); - + } if (K9.DEBUG) Log.d(K9.LOG_TAG, "useCompression " + useCompression); @@ -2113,8 +2113,8 @@ public class ImapStore extends Store } } } - - + + if (K9.DEBUG) Log.d(K9.LOG_TAG, "NAMESPACE = " + hasCapability(CAPABILITY_NAMESPACE) + ", mPathPrefix = " + mPathPrefix); @@ -2497,7 +2497,7 @@ public class ImapStore extends Store class ImapMessage extends MimeMessage { - ImapMessage(String uid, Folder folder) + ImapMessage(String uid, Folder folder) { this.mUid = uid; this.mFolder = folder; @@ -2572,7 +2572,7 @@ public class ImapStore extends Store { mAlertText = alertText; } - } + } public class ImapFolderPusher extends ImapFolder implements UntaggedHandler { @@ -2668,9 +2668,9 @@ public class ImapStore extends Store receiver.syncFolder(ImapFolderPusher.this); } int startUid = oldUidNext; - + int newUidNext = uidNext; - + if (newUidNext == -1) { if (K9.DEBUG) @@ -2684,11 +2684,11 @@ public class ImapStore extends Store Log.i(K9.LOG_TAG, "highest UID = " + highestUid); newUidNext = highestUid + 1; if (K9.DEBUG) - Log.i(K9.LOG_TAG, "highest UID = " + highestUid - + ", set newUidNext to " + newUidNext); + Log.i(K9.LOG_TAG, "highest UID = " + highestUid + + ", set newUidNext to " + newUidNext); } } - + if (startUid < newUidNext - mAccount.getDisplayCount()) { startUid = newUidNext - mAccount.getDisplayCount(); diff --git a/src/com/fsck/k9/mail/store/LocalStore.java b/src/com/fsck/k9/mail/store/LocalStore.java index ce533c667..491e9398f 100644 --- a/src/com/fsck/k9/mail/store/LocalStore.java +++ b/src/com/fsck/k9/mail/store/LocalStore.java @@ -630,11 +630,11 @@ public class LocalStore extends Store implements Serializable return true; } - public Message[] searchForMessages(MessageRetrievalListener listener, String queryString, - List folders, Message[] messages, final Flag[] requiredFlags, final Flag[] forbiddenFlags) throws MessagingException + public Message[] searchForMessages(MessageRetrievalListener listener, String queryString, + List folders, Message[] messages, final Flag[] requiredFlags, final Flag[] forbiddenFlags) throws MessagingException { List args = new LinkedList (); - + StringBuilder whereClause = new StringBuilder(); if (queryString != null && queryString.length() > 0) { @@ -689,7 +689,7 @@ public class LocalStore extends Store implements Serializable } anyAdded = true; whereClause.append(" flags NOT LIKE ?"); - + args.add("%" + flag.toString() + "%"); } whereClause.append(" )"); @@ -706,12 +706,12 @@ public class LocalStore extends Store implements Serializable } anyAdded = true; whereClause.append(" flags LIKE ?"); - + args.add("%" + flag.toString() + "%"); } whereClause.append(" )"); } - + if (K9.DEBUG) { Log.v(K9.LOG_TAG, "whereClause = " + whereClause.toString()); @@ -993,7 +993,7 @@ public class LocalStore extends Store implements Serializable open(OpenMode.READ_WRITE); return mUnreadMessageCount; } - + @Override public int getFlaggedMessageCount() throws MessagingException { @@ -1008,7 +1008,7 @@ public class LocalStore extends Store implements Serializable mDb.execSQL("UPDATE folders SET unread_count = ? WHERE id = ?", new Object[] { mUnreadMessageCount, mFolderId }); } - + public void setFlaggedMessageCount(int flaggedMessageCount) throws MessagingException { open(OpenMode.READ_WRITE); @@ -1141,7 +1141,7 @@ public class LocalStore extends Store implements Serializable { this.pushClass = pushClass; } - + public boolean isIntegrate() { return mIntegrate; @@ -1150,7 +1150,7 @@ public class LocalStore extends Store implements Serializable { mIntegrate = integrate; } - + private String getPrefId() throws MessagingException { open(OpenMode.READ_WRITE); @@ -1216,15 +1216,15 @@ public class LocalStore extends Store implements Serializable editor.commit(); } - - + + public FolderClass getDisplayClass(Preferences preferences) throws MessagingException { String id = getPrefId(); return FolderClass.valueOf(preferences.getPreferences().getString(id + ".displayMode", - FolderClass.NO_CLASS.name())); + FolderClass.NO_CLASS.name())); } - + @Override public void refresh(Preferences preferences) throws MessagingException { @@ -1586,7 +1586,7 @@ public class LocalStore extends Store implements Serializable setUnreadMessageCount(getUnreadMessageCount() - 1); lDestFolder.setUnreadMessageCount(lDestFolder.getUnreadMessageCount() + 1); } - + if (message.isSet(Flag.FLAGGED)) { setFlaggedMessageCount(getFlaggedMessageCount() - 1); @@ -2075,7 +2075,7 @@ public class LocalStore extends Store implements Serializable Log.e(K9.LOG_TAG, "Unable to fetch all messages from LocalStore", e); } } - + @Override public void delete(boolean recurse) throws MessagingException @@ -2298,7 +2298,7 @@ public class LocalStore extends Store implements Serializable { return inTopGroup; } - + public void setInTopGroup(boolean inTopGroup) { this.inTopGroup = inTopGroup; @@ -2368,14 +2368,14 @@ public class LocalStore extends Store implements Serializable if (flagList != null && flagList.length() > 0) { String[] flags = flagList.split(","); - + for (String flag : flags) { try { this.setFlagInternal(Flag.valueOf(flag), true); } - + catch (Exception e) { if ("X_BAD_FLAG".equals(flag) == false) @@ -2635,7 +2635,7 @@ public class LocalStore extends Store implements Serializable { folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() - 1); } - else + else { folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() + 1); } @@ -2647,7 +2647,7 @@ public class LocalStore extends Store implements Serializable { folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() + 1); } - else + else { folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() - 1); } diff --git a/src/com/fsck/k9/mail/store/Pop3Store.java b/src/com/fsck/k9/mail/store/Pop3Store.java index 6415156fa..91391d916 100644 --- a/src/com/fsck/k9/mail/store/Pop3Store.java +++ b/src/com/fsck/k9/mail/store/Pop3Store.java @@ -525,10 +525,10 @@ public class Pop3Store extends Store /* * At least one server software places a "+OK" in * front of every line in the unique-id listing. - * + * * Fix up the array if we detected this behavior. * See Issue 1237 - */ + */ uidParts[0] = uidParts[1]; uidParts[1] = uidParts[2]; } @@ -1078,7 +1078,7 @@ public class Pop3Store extends Store } return super.equals(o); } - + @Override public int hashCode() { diff --git a/src/com/fsck/k9/mail/store/WebDavStore.java b/src/com/fsck/k9/mail/store/WebDavStore.java index b083b4331..849bc0c27 100644 --- a/src/com/fsck/k9/mail/store/WebDavStore.java +++ b/src/com/fsck/k9/mail/store/WebDavStore.java @@ -1628,7 +1628,7 @@ public class WebDavStore extends Store statusCode > 300) { throw new IOException("Error during with code " + statusCode + " during fetch: " - + response.getStatusLine().toString()); + + response.getStatusLine().toString()); } if (entity != null) @@ -1972,7 +1972,7 @@ public class WebDavStore extends Store subject = ""; } */ - + ByteArrayOutputStream out; try { @@ -1985,7 +1985,7 @@ public class WebDavStore extends Store } open(OpenMode.READ_WRITE); EOLConvertingOutputStream msgOut = new EOLConvertingOutputStream( - new BufferedOutputStream(out, 1024)); + new BufferedOutputStream(out, 1024)); message.writeTo(msgOut); msgOut.flush(); @@ -2018,9 +2018,9 @@ public class WebDavStore extends Store if (statusCode < 200 || statusCode > 300) { - throw new IOException("Error with status code " + statusCode - + " while sending/appending message. Response = " - + response.getStatusLine().toString() + " for message " + messageURL); + throw new IOException("Error with status code " + statusCode + + " while sending/appending message. Response = " + + response.getStatusLine().toString() + " for message " + messageURL); } WebDavMessage retMessage = new WebDavMessage(message.getUid(), this); @@ -2041,7 +2041,7 @@ public class WebDavStore extends Store { return false; } - + @Override public int hashCode() { diff --git a/src/com/fsck/k9/mail/transport/EOLConvertingOutputStream.java b/src/com/fsck/k9/mail/transport/EOLConvertingOutputStream.java index d35cc5e02..1fba2c245 100644 --- a/src/com/fsck/k9/mail/transport/EOLConvertingOutputStream.java +++ b/src/com/fsck/k9/mail/transport/EOLConvertingOutputStream.java @@ -36,7 +36,7 @@ public class EOLConvertingOutputStream extends FilterOutputStream { super.write('\n'); lastChar = '\n'; - + // We have to ignore the next character if it is . Otherwise it // will be expanded to an additional sequence although it // belongs to the one just completed. diff --git a/src/com/fsck/k9/mail/transport/LineWrapOutputStream.java b/src/com/fsck/k9/mail/transport/LineWrapOutputStream.java index 4817b1410..83e94caab 100644 --- a/src/com/fsck/k9/mail/transport/LineWrapOutputStream.java +++ b/src/com/fsck/k9/mail/transport/LineWrapOutputStream.java @@ -26,10 +26,10 @@ public class LineWrapOutputStream extends FilterOutputStream // Buffer full? if (lineLength == buffer.length) { - // Usable word-boundary found earlier? + // Usable word-boundary found earlier? if (endOfLastWord > 0) { - // Yes, so output everything up to that word-boundary + // Yes, so output everything up to that word-boundary out.write(buffer, bufferStart, endOfLastWord - bufferStart); out.write(CRLF); diff --git a/src/com/fsck/k9/mail/transport/SmtpDataStuffing.java b/src/com/fsck/k9/mail/transport/SmtpDataStuffing.java index 110042028..1495f5b1a 100644 --- a/src/com/fsck/k9/mail/transport/SmtpDataStuffing.java +++ b/src/com/fsck/k9/mail/transport/SmtpDataStuffing.java @@ -9,7 +9,7 @@ public class SmtpDataStuffing extends FilterOutputStream private static final int STATE_NORMAL = 0; private static final int STATE_CR = 1; private static final int STATE_CRLF = 2; - + private int state = STATE_NORMAL; public SmtpDataStuffing(OutputStream out) diff --git a/src/com/fsck/k9/mail/transport/SmtpTransport.java b/src/com/fsck/k9/mail/transport/SmtpTransport.java index 65d2288b4..6c912aee8 100644 --- a/src/com/fsck/k9/mail/transport/SmtpTransport.java +++ b/src/com/fsck/k9/mail/transport/SmtpTransport.java @@ -300,7 +300,7 @@ public class SmtpTransport extends Transport boolean possibleSend = false; try { - //TODO: Add BODY=8BITMIME parameter if appropriate? + //TODO: Add BODY=8BITMIME parameter if appropriate? executeSimpleCommand("MAIL FROM: " + "<" + from[0].getAddress() + ">"); for (Address address : message.getRecipients(RecipientType.TO)) { @@ -316,12 +316,12 @@ public class SmtpTransport extends Transport } message.setRecipients(RecipientType.BCC, null); executeSimpleCommand("DATA"); - + EOLConvertingOutputStream msgOut = new EOLConvertingOutputStream( - new SmtpDataStuffing( - new LineWrapOutputStream( - new BufferedOutputStream(mOut, 1024), - 1000))); + new SmtpDataStuffing( + new LineWrapOutputStream( + new BufferedOutputStream(mOut, 1024), + 1000))); message.writeTo(msgOut); diff --git a/src/com/fsck/k9/preferences/Storage.java b/src/com/fsck/k9/preferences/Storage.java index d4101b164..e41dafbd4 100644 --- a/src/com/fsck/k9/preferences/Storage.java +++ b/src/com/fsck/k9/preferences/Storage.java @@ -421,13 +421,13 @@ public class Storage implements SharedPreferences try { cursor = mDb.query( - "preferences_storage", - new String[] {"value"}, - "primkey = ?", - new String[] {key}, - null, - null, - null); + "preferences_storage", + new String[] {"value"}, + "primkey = ?", + new String[] {key}, + null, + null, + null); if (cursor.moveToNext()) { diff --git a/src/com/fsck/k9/provider/AttachmentProvider.java b/src/com/fsck/k9/provider/AttachmentProvider.java index 03e4841fe..0a5e2c5d5 100644 --- a/src/com/fsck/k9/provider/AttachmentProvider.java +++ b/src/com/fsck/k9/provider/AttachmentProvider.java @@ -157,7 +157,7 @@ public class AttachmentProvider extends ContentProvider } private File getFile(String dbName, String id) - throws FileNotFoundException + throws FileNotFoundException { try { @@ -166,7 +166,8 @@ public class AttachmentProvider extends ContentProvider if (!file.exists()) { file = new File("/sdcard" + attachmentsDir.getCanonicalPath().substring("/data".length()), id); - if (!file.exists()) { + if (!file.exists()) + { throw new FileNotFoundException(); } } diff --git a/src/com/fsck/k9/service/CoreService.java b/src/com/fsck/k9/service/CoreService.java index fd1d83c8b..303adc785 100644 --- a/src/com/fsck/k9/service/CoreService.java +++ b/src/com/fsck/k9/service/CoreService.java @@ -22,7 +22,7 @@ public abstract class CoreService extends Service private static AtomicInteger wakeLockSeq = new AtomicInteger(0); private ExecutorService threadPool = null; private final String className = getClass().getName(); - + @Override public void onCreate() { @@ -30,9 +30,9 @@ public abstract class CoreService extends Service Log.i(K9.LOG_TAG, "CoreService: " + className + ".onCreate()"); threadPool = Executors.newFixedThreadPool(1); // Must be single threaded super.onCreate(); - + } - + protected static void addWakeLockId(Intent i, Integer wakeLockId) { if (wakeLockId != null) @@ -53,8 +53,8 @@ public abstract class CoreService extends Service i.putExtra(WAKE_LOCK_ID, tmpWakeLockId); } - - + + @Override public void onStart(Intent intent, int startId) @@ -104,12 +104,12 @@ public abstract class CoreService extends Service public void execute(Context context, final Runnable runner, int wakeLockTime, final Integer startId) { - + PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); final WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "K9"); wakeLock.setReferenceCounted(false); wakeLock.acquire(wakeLockTime); - + Runnable myRunner = new Runnable() { public void run() @@ -137,7 +137,7 @@ public abstract class CoreService extends Service if (threadPool == null) { Log.e(K9.LOG_TAG, "CoreService.execute (" + className + ") called with no threadPool available; running Runnable " + runner.hashCode() + " in calling thread", new Throwable()); - synchronized(this) + synchronized (this) { myRunner.run(); } diff --git a/src/com/fsck/k9/service/MailService.java b/src/com/fsck/k9/service/MailService.java index 174b74828..9bdd67f3f 100644 --- a/src/com/fsck/k9/service/MailService.java +++ b/src/com/fsck/k9/service/MailService.java @@ -38,7 +38,7 @@ public class MailService extends CoreService private static final String CANCEL_CONNECTIVITY_NOTICE = "com.fsck.k9.intent.action.MAIL_SERVICE_CANCEL_CONNECTIVITY_NOTICE"; private static final String HAS_CONNECTIVITY = "com.fsck.k9.intent.action.MAIL_SERVICE_HAS_CONNECTIVITY"; - + private static long nextCheck = -1; public static void actionReset(Context context, Integer wakeLockId) @@ -53,7 +53,7 @@ public class MailService extends CoreService } context.startService(i); } - + public static void actionRestartPushers(Context context, Integer wakeLockId) { Intent i = new Intent(); @@ -66,7 +66,7 @@ public class MailService extends CoreService } context.startService(i); } - + public static void actionReschedulePoll(Context context, Integer wakeLockId) { Intent i = new Intent(); @@ -192,7 +192,7 @@ public class MailService extends CoreService startIdObj = null; } } - else if (CONNECTIVITY_CHANGE.equals(intent.getAction()) ) + else if (CONNECTIVITY_CHANGE.equals(intent.getAction())) { notifyConnectionStatus(hasConnectivity); rescheduleAll(hasConnectivity, doBackground, startIdObj); @@ -220,7 +220,7 @@ public class MailService extends CoreService { reschedulePoll(hasConnectivity, doBackground, null, true); reschedulePushers(hasConnectivity, doBackground, startId); - + } private void notifyConnectionStatus(boolean hasConnectivity) @@ -273,10 +273,10 @@ public class MailService extends CoreService private final static String PREVIOUS_INTERVAL = "MailService.previousInterval"; private final static String LAST_CHECK_END = "MailService.lastCheckEnd"; - + public static void saveLastCheckEnd(Context context) { - + long lastCheckEnd = System.currentTimeMillis(); if (K9.DEBUG) Log.i(K9.LOG_TAG, "Saving lastCheckEnd = " + new Date(lastCheckEnd)); @@ -286,7 +286,7 @@ public class MailService extends CoreService editor.putLong(LAST_CHECK_END, lastCheckEnd); editor.commit(); } - + private void reschedulePoll(final boolean hasConnectivity, final boolean doBackground, Integer startId, final boolean considerLastCheckEnd) { if (hasConnectivity && doBackground) @@ -296,7 +296,7 @@ public class MailService extends CoreService public void run() { int shortestInterval = -1; - + Preferences prefs = Preferences.getPreferences(MailService.this); SharedPreferences sPrefs = prefs.getPreferences(); int previousInterval = sPrefs.getInt(PREVIOUS_INTERVAL, -1); @@ -313,7 +313,7 @@ public class MailService extends CoreService SharedPreferences.Editor editor = sPrefs.edit(); editor.putInt(PREVIOUS_INTERVAL, shortestInterval); editor.commit(); - + if (shortestInterval == -1) { nextCheck = -1; @@ -327,11 +327,11 @@ public class MailService extends CoreService long base = (previousInterval == -1 || lastCheckEnd == -1 || considerLastCheckEnd == false ? System.currentTimeMillis() : lastCheckEnd); long nextTime = base + delay; if (K9.DEBUG) - Log.i(K9.LOG_TAG, - "previousInterval = " + previousInterval - + ", shortestInterval = " + shortestInterval - + ", lastCheckEnd = " + new Date(lastCheckEnd) - + ", considerLastCheckEnd = " + considerLastCheckEnd); + Log.i(K9.LOG_TAG, + "previousInterval = " + previousInterval + + ", shortestInterval = " + shortestInterval + + ", lastCheckEnd = " + new Date(lastCheckEnd) + + ", considerLastCheckEnd = " + considerLastCheckEnd); nextCheck = nextTime; try { @@ -343,12 +343,12 @@ public class MailService extends CoreService // I once got a NullPointerException deep in new Date(); Log.e(K9.LOG_TAG, "Exception while logging", e); } - + Intent i = new Intent(); i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.MailService"); i.setAction(ACTION_CHECK_MAIL); BootReceiver.scheduleIntent(MailService.this, nextTime, i); - + } } } diff --git a/src/com/fsck/k9/service/PollService.java b/src/com/fsck/k9/service/PollService.java index bd3249021..507778ac3 100644 --- a/src/com/fsck/k9/service/PollService.java +++ b/src/com/fsck/k9/service/PollService.java @@ -140,11 +140,11 @@ public class PollService extends CoreService private void release() { - + MessagingController controller = MessagingController.getInstance(getApplication()); controller.setCheckMailListener(null); MailService.saveLastCheckEnd(getApplication()); - + MailService.actionReschedulePoll(PollService.this, null); wakeLockRelease(); if (K9.DEBUG) diff --git a/src/com/fsck/k9/service/RemoteControlService.java b/src/com/fsck/k9/service/RemoteControlService.java index a553a1205..768b06c44 100644 --- a/src/com/fsck/k9/service/RemoteControlService.java +++ b/src/com/fsck/k9/service/RemoteControlService.java @@ -159,7 +159,7 @@ public class RemoteControlService extends CoreService Editor editor = sPrefs.edit(); K9.save(editor); editor.commit(); - + if (needsReschedule) { Intent i = new Intent();