mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 00:58:50 -05:00
find src/com/fsck/ -name \*.java|xargs astyle --style=ansi --mode=java --indent-switches --indent=spaces=4 --convert-tabs --unpad=paren
This commit is contained in:
parent
2775795abe
commit
8af7f4a7b6
@ -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 };
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 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 Map<String, Boolean> compressionMap = new ConcurrentHashMap<String, Boolean>();
|
||||
private Map<String, Boolean> compressionMap = new ConcurrentHashMap<String, Boolean>();
|
||||
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 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)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
package com.fsck.k9;
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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<LocalFolder> tmpFoldersToSearch = new LinkedList<LocalFolder>();
|
||||
@ -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<Message> messages)
|
||||
final List<Message> 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<String> uids = new LinkedList<String>();
|
||||
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<String, Message> origUidMap = new HashMap<String, Message>();
|
||||
|
||||
|
||||
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<Message> messages)
|
||||
final List<Message> 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<Account, Map<Folder, List<Message>>> accountMap = new HashMap<Account, Map<Folder, List<Message>>>();
|
||||
|
||||
|
||||
for (Message message : messages)
|
||||
{
|
||||
Folder folder = message.getFolder();
|
||||
Account account = folder.getAccount();
|
||||
|
||||
|
||||
Map<Folder, List<Message>> folderMap = accountMap.get(account);
|
||||
if (folderMap == null)
|
||||
{
|
||||
@ -5085,7 +5085,7 @@ public class MessagingController implements Runnable
|
||||
messageList = new LinkedList<Message>();
|
||||
folderMap.put(folder, messageList);
|
||||
}
|
||||
|
||||
|
||||
messageList.add(message);
|
||||
}
|
||||
for (Map.Entry<Account, Map<Folder, List<Message>>> 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<Message> messages);
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
@ -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<BaseAccount> newAccounts = new ArrayList<BaseAccount>(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 = "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />" +
|
||||
String html = "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />" +
|
||||
"<h1>" + String.format(getString(R.string.about_title_fmt),
|
||||
"<a href=\"" + getString(R.string.app_webpage_url) + "\">" + appName + "</a>") + "</h1>" +
|
||||
"<p>" + 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
+ "'}";
|
||||
}
|
||||
}
|
||||
|
@ -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<MessageReference>();
|
||||
}
|
||||
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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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()
|
||||
|
@ -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,
|
||||
|
@ -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));
|
||||
|
@ -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"))
|
||||
|
@ -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);
|
||||
|
@ -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 <code>key</code>.
|
||||
*
|
||||
*
|
||||
* @param key The key of the ListPreference object.
|
||||
* @param value Initial value for the ListPreference object.
|
||||
* @return The ListPreference instance identified by <code>key</code>.
|
||||
* @return The ListPreference instance identified by <code>key</code>.
|
||||
*/
|
||||
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)
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ public class Address
|
||||
}
|
||||
return super.equals(o);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
|
@ -203,7 +203,7 @@ public abstract class Folder
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public boolean isInTopGroup()
|
||||
{
|
||||
return false;
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -71,6 +71,6 @@ public class TextBody implements Body
|
||||
|
||||
public void setEncoding(String encoding)
|
||||
{
|
||||
mEncoding = encoding;
|
||||
mEncoding = encoding;
|
||||
}
|
||||
}
|
||||
|
@ -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.");
|
||||
}
|
||||
|
||||
|
@ -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 List<ImapResponse> receiveCapabilities(List<ImapResponse> 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<ImapResponse> nullResponses = new LinkedList<ImapResponse>();
|
||||
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();
|
||||
|
@ -630,11 +630,11 @@ public class LocalStore extends Store implements Serializable
|
||||
return true;
|
||||
}
|
||||
|
||||
public Message[] searchForMessages(MessageRetrievalListener listener, String queryString,
|
||||
List<LocalFolder> folders, Message[] messages, final Flag[] requiredFlags, final Flag[] forbiddenFlags) throws MessagingException
|
||||
public Message[] searchForMessages(MessageRetrievalListener listener, String queryString,
|
||||
List<LocalFolder> folders, Message[] messages, final Flag[] requiredFlags, final Flag[] forbiddenFlags) throws MessagingException
|
||||
{
|
||||
List<String> args = new LinkedList<String>();
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ public class EOLConvertingOutputStream extends FilterOutputStream
|
||||
{
|
||||
super.write('\n');
|
||||
lastChar = '\n';
|
||||
|
||||
|
||||
// We have to ignore the next character if it is <LF>. Otherwise it
|
||||
// will be expanded to an additional <CR><LF> sequence although it
|
||||
// belongs to the one just completed.
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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())
|
||||
{
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -159,7 +159,7 @@ public class RemoteControlService extends CoreService
|
||||
Editor editor = sPrefs.edit();
|
||||
K9.save(editor);
|
||||
editor.commit();
|
||||
|
||||
|
||||
if (needsReschedule)
|
||||
{
|
||||
Intent i = new Intent();
|
||||
|
Loading…
Reference in New Issue
Block a user