1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 16:48:50 -05:00

Cleaned up style drift using astyle 1.23

find  src/com/android/email/ -name \*.java|xargs astyle --style=ansi --mode=java  --indent-switches --indent=spaces=4 --convert-tabs --unpad=paren
This commit is contained in:
Jesse Vincent 2009-12-07 00:56:06 +00:00
parent a9283ad435
commit 244bad1115
20 changed files with 297 additions and 295 deletions

View File

@ -831,7 +831,7 @@ public class Account implements Serializable
}
return super.equals(o);
}
@Override
public int hashCode()
{

View File

@ -26,14 +26,14 @@ public class K9Activity extends Activity
private java.text.DateFormat mDateFormat;
private java.text.DateFormat mTimeFormat;
private void setupFormats()
{
mDateFormat = DateFormatter.getDateFormat(this);
mTimeFormat = android.text.format.DateFormat.getTimeFormat(this); // 12/24 date format
}
public java.text.DateFormat getTimeFormat()
{
return mTimeFormat;

View File

@ -15,7 +15,7 @@ public class K9ListActivity extends ListActivity
super.onCreate(icicle);
setupFormats();
}
@Override
public void onResume()
{
@ -25,13 +25,13 @@ public class K9ListActivity extends ListActivity
private java.text.DateFormat mDateFormat;
private java.text.DateFormat mTimeFormat;
private void setupFormats()
{
mDateFormat = DateFormatter.getDateFormat(this);
mTimeFormat = android.text.format.DateFormat.getTimeFormat(this); // 12/24 date format
}
public java.text.DateFormat getTimeFormat()
{
return mTimeFormat;

View File

@ -1214,12 +1214,12 @@ public class MessagingController implements Runnable
{
localFolder.setPushState(newPushState);
}
if (!localMessage.isSet(Flag.X_DOWNLOADED_FULL) && !localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL))
if (!localMessage.isSet(Flag.X_DOWNLOADED_FULL) && !localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL))
{
if (Email.DEBUG)
{
Log.v(Email.LOG_TAG, "Message with uid " + message.getUid()
+ " is not downloaded, even partially; trying again");
Log.v(Email.LOG_TAG, "Message with uid " + message.getUid()
+ " is not downloaded, even partially; trying again");
}
unsyncedMessages.add(message);
}
@ -1892,7 +1892,7 @@ public class MessagingController implements Runnable
}
PendingCommand command = new PendingCommand();
command.command = PENDING_COMMAND_MOVE_OR_COPY_BULK;
int length = 3 + uids.length;
command.arguments = new String[length];
command.arguments[0] = srcFolder;
@ -1927,7 +1927,7 @@ public class MessagingController implements Runnable
String isCopyS = command.arguments[2];
Store remoteStore = Store.getInstance(account.getStoreUri(), mApplication);
remoteSrcFolder = remoteStore.getFolder(srcFolder);
List<Message> messages = new ArrayList<Message>();
for (int i = 3; i < command.arguments.length; i++)
{
@ -1937,13 +1937,13 @@ public class MessagingController implements Runnable
messages.add(remoteSrcFolder.getMessage(uid));
}
}
boolean isCopy = false;
if (isCopyS != null)
{
isCopy = Boolean.parseBoolean(isCopyS);
}
if (!remoteSrcFolder.exists())
{
throw new MessagingException("processingPendingMoveOrCopy: remoteFolder " + srcFolder + " does not exist", true);
@ -1953,7 +1953,7 @@ public class MessagingController implements Runnable
{
throw new MessagingException("processingPendingMoveOrCopy: could not open remoteSrcFolder " + srcFolder + " read/write", true);
}
if (Email.DEBUG)
{
Log.d(Email.LOG_TAG, "processingPendingMoveOrCopy: source folder = " + srcFolder
@ -1970,13 +1970,13 @@ public class MessagingController implements Runnable
else
{
remoteDestFolder = remoteStore.getFolder(destFolder);
remoteDestFolder.open(OpenMode.READ_WRITE);
if (remoteDestFolder.getMode() != OpenMode.READ_WRITE)
{
throw new MessagingException("processingPendingMoveOrCopy: could not open remoteDestFolder " + srcFolder + " read/write", true);
}
if (isCopy)
{
remoteSrcFolder.copyMessages(messages.toArray(new Message[0]), remoteDestFolder);
@ -2002,7 +2002,7 @@ public class MessagingController implements Runnable
}
private void queueSetFlag(Account account, String folderName, String newState, String flag, String[] uids)
{
PendingCommand command = new PendingCommand();
@ -2061,7 +2061,7 @@ public class MessagingController implements Runnable
messages.add(remoteFolder.getMessage(uid));
}
}
if (messages.size() == 0)
{
return;
@ -2074,9 +2074,9 @@ public class MessagingController implements Runnable
{
remoteFolder.close(false);
}
}
}
}
// TODO: This method is obsolete and is only for transition from K-9 2.0 to K-9 2.1
// Eventually, it should be removed
private void processPendingSetFlagOld(PendingCommand command, Account account)
@ -2121,7 +2121,7 @@ public class MessagingController implements Runnable
remoteMessage.setFlag(flag, newState);
}
// TODO: This method is obsolete and is only for transition from K-9 2.0 to K-9 2.1
// Eventually, it should be removed
private void processPendingMoveOrCopyOld(PendingCommand command, Account account)
@ -2170,7 +2170,7 @@ public class MessagingController implements Runnable
if (Email.DEBUG)
{
Log.d(Email.LOG_TAG, "processPendingMoveOrCopyOld: source folder = " + srcFolder
+ ", uid = " + uid + ", destination folder = " + destFolder + ", isCopy = " + isCopy);
+ ", uid = " + uid + ", destination folder = " + destFolder + ", isCopy = " + isCopy);
}
if (isCopy == false && destFolder.equals(account.getTrashFolderName()))
{
@ -2382,13 +2382,13 @@ public class MessagingController implements Runnable
queuePendingCommand(account, command);
processPendingCommands(account);
}
public void setFlag(
final Account account,
final String folderName,
final Message[] messages,
final Flag flag,
final boolean newState)
final Account account,
final String folderName,
final Message[] messages,
final Flag flag,
final boolean newState)
{
String[] uids = new String[messages.length];
for (int i = 0; i < messages.length; i++)
@ -2397,7 +2397,7 @@ public class MessagingController implements Runnable
}
setFlag(account, folderName, uids, flag, newState);
}
public void setFlag(
final Account account,
final String folderName,
@ -2417,7 +2417,7 @@ public class MessagingController implements Runnable
for (int i = 0; i < uids.length; i++)
{
String uid = uids[i];
// Allows for re-allowing sending of messages that could not be sent
// Allows for re-allowing sending of messages that could not be sent
if (flag == Flag.FLAGGED && newState == false
&& uid != null
&& account.getOutboxFolderName().equals(folderName))
@ -2426,9 +2426,9 @@ public class MessagingController implements Runnable
}
messages[i] = localFolder.getMessage(uid);
}
localFolder.setFlags(messages, new Flag[] {flag}, newState);
for (MessagingListener l : getListeners())
{
@ -3199,7 +3199,7 @@ public class MessagingController implements Runnable
putBackground("getAccountUnread:" + account.getDescription(), l, unreadRunnable);
}
public int moveMessages(final Account account, final String srcFolder, final Message[] messages, final String destFolder,
final MessagingListener listener)
{
@ -3280,9 +3280,9 @@ public class MessagingController implements Runnable
return false;
}
}
public int copyMessages(final Account account, final String srcFolder, final Message[] messages, final String destFolder,
final MessagingListener listener)
final MessagingListener listener)
{
int messagesCopied = 0;
for (Message message : messages)
@ -3358,7 +3358,7 @@ public class MessagingController implements Runnable
}
}
queueMoveOrCopy(account, srcFolder, destFolder, isCopy, new String[] { origUid });
processPendingCommands(account);
}
catch (MessagingException me)
@ -3370,13 +3370,13 @@ public class MessagingController implements Runnable
}
public void deleteMessages(final Account account, final String folder, final Message[] messages,
final MessagingListener listener)
final MessagingListener listener)
{
for (Message message : messages)
{
suppressMessage(account, folder, message);
}
put("deleteMessages", null, new Runnable()
{
public void run()
@ -3387,7 +3387,7 @@ public class MessagingController implements Runnable
}
private void deleteMessagesSynchronous(final Account account, final String folder, final Message[] messages,
MessagingListener listener)
MessagingListener listener)
{
Folder localFolder = null;
Folder localTrashFolder = null;
@ -3430,7 +3430,7 @@ public class MessagingController implements Runnable
listener.messageDeleted(account, folder, message);
}
}
for (MessagingListener l : getListeners())
{
l.folderStatusChanged(account, account.getTrashFolderName());
@ -3499,7 +3499,7 @@ public class MessagingController implements Runnable
}
}
}
private String[] getUidsFromMessages(Message[] messages)
{
String[] uids = new String[messages.length];
@ -3954,7 +3954,7 @@ public class MessagingController implements Runnable
boolean isNotifyAccount = thisAccount.isNotifyNewMail();
if (isNotifyAccount)
{
NotificationManager notifMgr =
(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
if (newMailCount > 0 && unreadMessageCount > 0)
@ -4185,11 +4185,11 @@ public class MessagingController implements Runnable
Log.i(Email.LOG_TAG, "Starting pusher for " + account.getDescription() + ":" + folder.getName());
names.add(folder.getName());
}
if (names.size() > 0)
{
PushReceiver receiver = new MessagingControllerPushReceiver(mApplication, account, this);
try
{
Store store = Store.getInstance(account.getStoreUri(), mApplication);
@ -4218,7 +4218,7 @@ public class MessagingController implements Runnable
Log.e(Email.LOG_TAG, "Could not get remote store", e);
return false;
}
return true;
}
else

View File

@ -22,124 +22,124 @@ public class MessagingControllerPushReceiver implements PushReceiver
final Account account;
final MessagingController controller;
final Application mApplication;
public MessagingControllerPushReceiver(Application nApplication, Account nAccount, MessagingController nController)
{
account = nAccount;
controller = nController;
mApplication = nApplication;
}
ThreadLocal<WakeLock> threadWakeLock = new ThreadLocal<WakeLock>();
public void acquireWakeLock()
ThreadLocal<WakeLock> threadWakeLock = new ThreadLocal<WakeLock>();
public void acquireWakeLock()
{
WakeLock wakeLock = threadWakeLock.get();
if (wakeLock == null)
{
WakeLock wakeLock = threadWakeLock.get();
if (wakeLock == null)
{
PowerManager pm = (PowerManager) mApplication.getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Email");
wakeLock.setReferenceCounted(false);
threadWakeLock.set(wakeLock);
}
wakeLock.acquire(Email.PUSH_WAKE_LOCK_TIMEOUT);
if (Email.DEBUG)
{
Log.d(Email.LOG_TAG, "Acquired WakeLock for Pushing for thread " + Thread.currentThread().getName());
}
PowerManager pm = (PowerManager) mApplication.getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Email");
wakeLock.setReferenceCounted(false);
threadWakeLock.set(wakeLock);
}
public void releaseWakeLock()
wakeLock.acquire(Email.PUSH_WAKE_LOCK_TIMEOUT);
if (Email.DEBUG)
{
Log.d(Email.LOG_TAG, "Acquired WakeLock for Pushing for thread " + Thread.currentThread().getName());
}
}
public void releaseWakeLock()
{
if (Email.DEBUG)
{
Log.d(Email.LOG_TAG, "Considering releasing WakeLock for Pushing");
}
WakeLock wakeLock = threadWakeLock.get();
if (wakeLock != null)
{
if (Email.DEBUG)
{
Log.d(Email.LOG_TAG, "Considering releasing WakeLock for Pushing");
Log.d(Email.LOG_TAG, "Releasing WakeLock for Pushing for thread " + Thread.currentThread().getName());
}
WakeLock wakeLock = threadWakeLock.get();
if (wakeLock != null)
{
wakeLock.release();
}
else
{
Log.e(Email.LOG_TAG, "No WakeLock waiting to be released for thread " + Thread.currentThread().getName());
}
}
if (Email.DEBUG)
public void messagesFlagsChanged(Folder folder,
List<Message> messages)
{
controller.messagesArrived(account, folder, messages, true);
}
public void messagesArrived(Folder folder, List<Message> messages)
{
controller.messagesArrived(account, folder, messages, false);
}
public void sleep(long millis)
{
SleepService.sleep(mApplication, millis, threadWakeLock.get(), Email.PUSH_WAKE_LOCK_TIMEOUT);
}
public void pushError(String errorMessage, Exception e)
{
String errMess = errorMessage;
String body = null;
if (errMess == null && e != null)
{
errMess = e.getMessage();
}
body = errMess;
if (e != null)
{
body = e.toString();
}
controller.addErrorMessage(account, errMess, body);
}
public String getPushState(String folderName)
{
LocalFolder localFolder = null;
try
{
LocalStore localStore = (LocalStore) Store.getInstance(account.getLocalStoreUri(), mApplication);
localFolder= (LocalFolder) localStore.getFolder(folderName);
localFolder.open(OpenMode.READ_WRITE);
return localFolder.getPushState();
}
catch (Exception e)
{
Log.e(Email.LOG_TAG, "Unable to get push state from account " + account.getDescription()
+ ", folder " + folderName, e);
return null;
}
finally
{
if (localFolder != null)
{
try
{
Log.d(Email.LOG_TAG, "Releasing WakeLock for Pushing for thread " + Thread.currentThread().getName());
localFolder.close(false);
}
wakeLock.release();
}
else
{
Log.e(Email.LOG_TAG, "No WakeLock waiting to be released for thread " + Thread.currentThread().getName());
}
}
public void messagesFlagsChanged(Folder folder,
List<Message> messages)
{
controller.messagesArrived(account, folder, messages, true);
}
public void messagesArrived(Folder folder, List<Message> messages)
{
controller.messagesArrived(account, folder, messages, false);
}
public void sleep(long millis)
{
SleepService.sleep(mApplication, millis, threadWakeLock.get(), Email.PUSH_WAKE_LOCK_TIMEOUT);
}
public void pushError(String errorMessage, Exception e)
{
String errMess = errorMessage;
String body = null;
if (errMess == null && e != null)
{
errMess = e.getMessage();
}
body = errMess;
if (e != null)
{
body = e.toString();
}
controller.addErrorMessage(account, errMess, body);
}
public String getPushState(String folderName)
{
LocalFolder localFolder = null;
try
{
LocalStore localStore = (LocalStore) Store.getInstance(account.getLocalStoreUri(), mApplication);
localFolder= (LocalFolder) localStore.getFolder(folderName);
localFolder.open(OpenMode.READ_WRITE);
return localFolder.getPushState();
}
catch (Exception e)
{
Log.e(Email.LOG_TAG, "Unable to get push state from account " + account.getDescription()
+ ", folder " + folderName, e);
return null;
}
finally
{
if (localFolder != null)
catch (Exception e)
{
try
{
localFolder.close(false);
}
catch (Exception e)
{
Log.e(Email.LOG_TAG, "Unable to close folder '" + folderName + "' in account " + account.getDescription(), e);
}
Log.e(Email.LOG_TAG, "Unable to close folder '" + folderName + "' in account " + account.getDescription(), e);
}
}
}
}
public void setPushActive(String folderName, boolean enabled)
public void setPushActive(String folderName, boolean enabled)
{
for (MessagingListener l : controller.getListeners())
{
for (MessagingListener l : controller.getListeners())
{
l.setPushActive(account, folderName, enabled);
}
l.setPushActive(account, folderName, enabled);
}
}
}

View File

@ -18,30 +18,30 @@ public class DateFormatter
{
}
private final static Calendar SAMPLE_DATE = Calendar.getInstance();
static
static
{
SAMPLE_DATE.set(SAMPLE_DATE.get(Calendar.YEAR), SAMPLE_DATE.getActualMaximum(Calendar.MONTH), SAMPLE_DATE.getActualMaximum(Calendar.DAY_OF_MONTH));
}
public static final String SHORT_FORMAT = "SHORT";
public static final String MEDIUM_FORMAT = "MEDIUM";
public static final String DEFAULT_FORMAT = SHORT_FORMAT;
public static final String PREF_KEY = "dateFormat";
private static volatile String sChosenFormat = null;
private static volatile String sChosenFormat = null;
public static String getSampleDate(Context context, String formatString)
{
java.text.DateFormat formatter = getDateFormat(context, formatString);
return formatter.format(SAMPLE_DATE.getTime());
}
public static String[] getFormats(Context context)
{
return context.getResources().getStringArray(R.array.date_formats);
return context.getResources().getStringArray(R.array.date_formats);
}
private static ThreadLocal<Map<String, DateFormat>> storedFormats = new ThreadLocal<Map<String, DateFormat>>()
{
@Override
@ -50,18 +50,18 @@ public class DateFormatter
return new HashMap<String, DateFormat>();
}
};
public static DateFormat getDateFormat(Context context, String formatString)
{
java.text.DateFormat dateFormat;
if (SHORT_FORMAT.equals(formatString))
{
dateFormat = android.text.format.DateFormat.getDateFormat(context);
dateFormat = android.text.format.DateFormat.getDateFormat(context);
}
else if (MEDIUM_FORMAT.equals(formatString))
{
dateFormat = android.text.format.DateFormat.getMediumDateFormat(context);
dateFormat = android.text.format.DateFormat.getMediumDateFormat(context);
}
else
{
@ -76,25 +76,25 @@ public class DateFormatter
}
return dateFormat;
}
public static void setDateFormat(Editor editor, String formatString)
{
sChosenFormat = formatString;
editor.putString(PREF_KEY, formatString);
}
public static String getFormat(Context context)
{
if (sChosenFormat == null)
{
Preferences prefs = Preferences.getPreferences(context);
String chosenFormat = prefs.getPreferences().getString(PREF_KEY, DEFAULT_FORMAT);
sChosenFormat = chosenFormat;
}
return sChosenFormat;
}
public static DateFormat getDateFormat(Context context)
{
String formatString = getFormat(context);

View File

@ -1366,7 +1366,7 @@ public class FolderList extends K9ListActivity
this.unreadMessageCount = unreadCount;
folder.close(false);
}
}

View File

@ -71,8 +71,8 @@ import com.android.email.mail.store.LocalStore.LocalMessage;
*/
public class MessageList
extends K9Activity
implements OnClickListener, AdapterView.OnItemClickListener
extends K9Activity
implements OnClickListener, AdapterView.OnItemClickListener
{
private static final int DIALOG_MARK_ALL_AS_READ = 1;
@ -2101,7 +2101,7 @@ public class MessageList
}
class MessageViewHolder
implements OnCheckedChangeListener
implements OnCheckedChangeListener
{
public TextView subject;
public TextView preview;
@ -2252,13 +2252,15 @@ public class MessageList
}
else if (v == mBatchFlagButton)
{
if (!holder.flagged) {
if (!holder.flagged)
{
newState = true;
}
}
else if (v == mBatchReadButton)
{
if (!holder.read) {
if (!holder.read)
{
newState = true;
}
}

View File

@ -81,7 +81,7 @@ import java.util.HashMap;
import java.util.List;
public class MessageView extends K9Activity
implements UrlInterceptHandler, OnClickListener
implements UrlInterceptHandler, OnClickListener
{
private static final String EXTRA_ACCOUNT = "com.android.email.MessageView_account";
private static final String EXTRA_FOLDER = "com.android.email.MessageView_folder";
@ -971,7 +971,7 @@ public class MessageView extends K9Activity
Toast.makeText(this, getString(R.string.end_of_folder), Toast.LENGTH_SHORT).show();
return;
}
mLastDirection = PREVIOUS;
displayMessage(mPreviousMessageUid);
mTopView.startAnimation(inFromRightAnimation());

View File

@ -42,7 +42,7 @@ import com.android.email.Utility;
* AccountSetupAccountType activity.
*/
public class AccountSetupBasics extends K9Activity
implements OnClickListener, TextWatcher
implements OnClickListener, TextWatcher
{
private final static String EXTRA_ACCOUNT = "com.android.email.AccountSetupBasics.account";
private final static int DIALOG_NOTE = 1;

View File

@ -32,7 +32,7 @@ import com.android.email.R;
import com.android.email.Utility;
public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
OnCheckedChangeListener
OnCheckedChangeListener
{
private static final String EXTRA_ACCOUNT = "account";

View File

@ -63,7 +63,7 @@ public class Prefs extends K9PreferenceActivity
return false;
}
});
mDateFormat = (ListPreference) findPreference(PREFERENCE_DATE_FORMAT);
String[] formats = DateFormatter.getFormats(this);
CharSequence[] entries = new CharSequence[formats.length];
@ -75,8 +75,8 @@ public class Prefs extends K9PreferenceActivity
values[i] = format;
}
mDateFormat.setEntries(entries);
mDateFormat.setEntryValues(values);
mDateFormat.setEntryValues(values);
mDateFormat.setValue(DateFormatter.getFormat(this));
mDateFormat.setSummary(mDateFormat.getEntry());
mDateFormat.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()

View File

@ -102,7 +102,7 @@ public abstract class Folder
public void copyMessages(Message[] msgs, Folder folder) throws MessagingException {} ;
public void moveMessages(Message[] msgs, Folder folder) throws MessagingException {} ;
public void delete(Message[] msgs, String trashFolderName) throws MessagingException
{
for (Message message : msgs)

View File

@ -62,9 +62,9 @@ public abstract class Message implements Part, Body
public void setRecipient(RecipientType type, Address address) throws MessagingException
{
setRecipients(type, new Address[]
{
address
});
{
address
});
}
public abstract Address[] getFrom() throws MessagingException;

View File

@ -100,7 +100,7 @@ public class ImapStore extends Store
private static final int IDLE_REFRESH_INTERVAL = 20 * 60 * 1000; // 20 minutes
private static final Flag[] PERMANENT_FLAGS = { Flag.DELETED, Flag.SEEN };
private static final String CAPABILITY_IDLE = "IDLE";
private static final String COMMAND_IDLE = "IDLE";
private static final String CAPABILITY_NAMESPACE = "NAMESPACE";
@ -264,7 +264,7 @@ public class ImapStore extends Store
try
{
ArrayList<Folder> folders = new ArrayList<Folder>();
List<ImapResponse> responses =
connection.executeSimpleCommand(String.format("LIST \"\" \"%s*\"",
getCombinedPrefix()));
@ -288,7 +288,7 @@ public class ImapStore extends Store
}
else
{
if (getCombinedPrefix().length() > 0)
{
if (folder.length() >= getCombinedPrefix().length())
@ -444,7 +444,7 @@ public class ImapStore extends Store
return true;
}
class ImapFolder extends Folder
{
private String mName;
@ -525,7 +525,7 @@ public class ImapStore extends Store
// 2 OK [READ-WRITE] Select completed.
try
{
if (mPathDelimeter == null)
{
List<ImapResponse> nameResponses =
@ -768,7 +768,7 @@ public class ImapStore extends Store
copyMessages(messages, folder);
setFlags(messages, new Flag[] { Flag.DELETED }, true);
}
public void delete(Message[] messages, String trashFolderName) throws MessagingException
{
if (getName().equals(trashFolderName))
@ -1238,7 +1238,7 @@ public class ImapStore extends Store
}
return responses;
}
protected void handlePossibleUidNext(ImapResponse response)
{
if (response.get(0).equals("OK") && response.size() > 1)
@ -1288,7 +1288,7 @@ public class ImapStore extends Store
}
}
handlePossibleUidNext(response);
if (response.get(1).equals("EXPUNGE") && mMessageCount > 0)
{
mMessageCount--;
@ -1951,8 +1951,8 @@ public class ImapStore extends Store
}
if (Email.DEBUG)
{
Log.d(Email.LOG_TAG, "NAMESPACE = " + hasCapability(CAPABILITY_NAMESPACE)
+ ", mPathPrefix = " + mPathPrefix);
Log.d(Email.LOG_TAG, "NAMESPACE = " + hasCapability(CAPABILITY_NAMESPACE)
+ ", mPathPrefix = " + mPathPrefix);
}
if (mPathPrefix == null)
{
@ -1969,7 +1969,7 @@ public class ImapStore extends Store
{
Log.d(Email.LOG_TAG, "Got NAMESPACE response " + response + " on " + getLogId());
}
Object personalNamespaces = response.get(1);
if (personalNamespaces != null && personalNamespaces instanceof ImapList)
{
@ -2003,7 +2003,7 @@ public class ImapStore extends Store
Log.i(Email.LOG_TAG, "mPathPrefix is unset but server does not have NAMESPACE capability");
mPathPrefix = "";
}
}
}
}
catch (SSLException e)
{
@ -2055,7 +2055,7 @@ public class ImapStore extends Store
}
return capabilities.contains(CAPABILITY_IDLE);
}
protected boolean hasCapability(String capability)
{
return capabilities.contains(capability);
@ -2385,7 +2385,7 @@ public class ImapStore extends Store
}
}
public void start()
public void start()
{
Runnable runner = new Runnable()
{
@ -2760,7 +2760,7 @@ public class ImapStore extends Store
catch (Exception e)
{
Log.e(Email.LOG_TAG, "Exception while sending DONE for " + getLogId(), e);
}
}
}
else
{
@ -2817,7 +2817,7 @@ public class ImapStore extends Store
{
final ImapStore mStore;
final PushReceiver mReceiver;
HashMap<String, ImapFolderPusher> folderPushers = new HashMap<String, ImapFolderPusher>();
public ImapPusher(ImapStore store, PushReceiver receiver)
@ -2825,11 +2825,11 @@ public class ImapStore extends Store
mStore = store;
mReceiver = receiver;
}
public void start(List<String> folderNames)
{
stop();
synchronized(folderPushers)
synchronized (folderPushers)
{
for (String folderName : folderNames)
{
@ -2846,7 +2846,7 @@ public class ImapStore extends Store
public void refresh()
{
synchronized(folderPushers)
synchronized (folderPushers)
{
for (ImapFolderPusher folderPusher : folderPushers.values())
{
@ -2861,11 +2861,11 @@ public class ImapStore extends Store
}
}
}
public void stop()
{
Log.i(Email.LOG_TAG, "Requested stop of IMAP pusher");
synchronized(folderPushers)
synchronized (folderPushers)
{
for (ImapFolderPusher folderPusher : folderPushers.values())
{

View File

@ -630,9 +630,9 @@ public class LocalStore extends Store implements Serializable
cursor = mDb.rawQuery("SELECT id, unread_count, visible_limit, last_updated, status, push_state, last_pushed FROM folders "
+ "where folders.name = ?",
new String[]
{
mName
});
{
mName
});
if (cursor.moveToFirst())
{
@ -725,10 +725,10 @@ public class LocalStore extends Store implements Serializable
throw new MessagingException("Folder " + mName + " already exists.");
}
mDb.execSQL("INSERT INTO folders (name, visible_limit) VALUES (?, ?)", new Object[]
{
mName,
Email.DEFAULT_VISIBLE_LIMIT
});
{
mName,
Email.DEFAULT_VISIBLE_LIMIT
});
return true;
}
@ -739,10 +739,10 @@ public class LocalStore extends Store implements Serializable
throw new MessagingException("Folder " + mName + " already exists.");
}
mDb.execSQL("INSERT INTO folders (name, visible_limit) VALUES (?, ?)", new Object[]
{
mName,
visibleLimit
});
{
mName,
visibleLimit
});
return true;
}
@ -772,9 +772,9 @@ public class LocalStore extends Store implements Serializable
{
cursor = mDb.rawQuery("SELECT COUNT(*) FROM messages WHERE messages.folder_id = ?",
new String[]
{
Long.toString(mFolderId)
});
{
Long.toString(mFolderId)
});
cursor.moveToFirst();
int messageCount = cursor.getInt(0);
return messageCount;
@ -1102,19 +1102,19 @@ public class LocalStore extends Store implements Serializable
cursor = mDb.query(
"attachments",
new String[]
{
"id",
"size",
"name",
"mime_type",
"store_data",
"content_uri"
},
"message_id = ?",
new String[] { Long.toString(localMessage.mId) },
null,
null,
null);
{
"id",
"size",
"name",
"mime_type",
"store_data",
"content_uri"
},
"message_id = ?",
new String[] { Long.toString(localMessage.mId) },
null,
null,
null);
while (cursor.moveToNext())
{
@ -1270,9 +1270,9 @@ public class LocalStore extends Store implements Serializable
+ "bcc_list, reply_to_list, attachment_count, internal_date, message_id "
+ "FROM messages " + "WHERE uid = ? " + "AND folder_id = ?",
new String[]
{
message.getUid(), Long.toString(mFolderId)
});
{
message.getUid(), Long.toString(mFolderId)
});
if (!cursor.moveToNext())
{
return null;
@ -1315,9 +1315,9 @@ public class LocalStore extends Store implements Serializable
+ (includeDeleted ? "" : "deleted = 0 AND ")
+ " folder_id = ? ORDER BY date DESC"
, new String[]
{
Long.toString(mFolderId)
});
{
Long.toString(mFolderId)
});
int i = 0;
@ -1412,11 +1412,11 @@ public class LocalStore extends Store implements Serializable
message.setUid(Email.LOCAL_UID_PREFIX + UUID.randomUUID().toString());
mDb.execSQL("UPDATE messages " + "SET folder_id = ?, uid = ? " + "WHERE id = ?", new Object[]
{
lDestFolder.getId(),
message.getUid(),
lMessage.getId()
});
{
lDestFolder.getId(),
message.getUid(),
lMessage.getId()
});
LocalMessage placeHolder = new LocalMessage(oldUID, this);
placeHolder.setFlagInternal(Flag.DELETED, true);
@ -1605,27 +1605,27 @@ public class LocalStore extends Store implements Serializable
+ "html_content = ?, text_content = ?, reply_to_list = ?, "
+ "attachment_count = ? WHERE id = ?",
new Object[]
{
message.getUid(),
message.getSubject(),
Address.pack(message.getFrom()),
message.getSentDate() == null ? System
.currentTimeMillis() : message.getSentDate()
.getTime(),
Utility.combine(message.getFlags(), ',').toUpperCase(),
mFolderId,
Address.pack(message
.getRecipients(RecipientType.TO)),
Address.pack(message
.getRecipients(RecipientType.CC)),
Address.pack(message
.getRecipients(RecipientType.BCC)),
html.length() > 0 ? html : null,
text.length() > 0 ? text : null,
Address.pack(message.getReplyTo()),
attachments.size(),
message.mId
});
{
message.getUid(),
message.getSubject(),
Address.pack(message.getFrom()),
message.getSentDate() == null ? System
.currentTimeMillis() : message.getSentDate()
.getTime(),
Utility.combine(message.getFlags(), ',').toUpperCase(),
mFolderId,
Address.pack(message
.getRecipients(RecipientType.TO)),
Address.pack(message
.getRecipients(RecipientType.CC)),
Address.pack(message
.getRecipients(RecipientType.BCC)),
html.length() > 0 ? html : null,
text.length() > 0 ? text : null,
Address.pack(message.getReplyTo()),
attachments.size(),
message.mId
});
for (int i = 0, count = attachments.size(); i < count; i++)
{
@ -1665,9 +1665,9 @@ public class LocalStore extends Store implements Serializable
{
mDb.execSQL("DELETE FROM headers WHERE id = ?",
new Object[]
{
id
});
{
id
});
}
/**
@ -1846,9 +1846,9 @@ public class LocalStore extends Store implements Serializable
{
open(OpenMode.READ_ONLY);
mDb.execSQL("DELETE FROM messages WHERE folder_id = ? and date < ?", new Object[]
{
Long.toString(mFolderId), new Long(cutoff)
});
{
Long.toString(mFolderId), new Long(cutoff)
});
resetUnreadCount();
}
@ -1884,9 +1884,9 @@ public class LocalStore extends Store implements Serializable
deleteAttachments(message.getUid());
}
mDb.execSQL("DELETE FROM folders WHERE id = ?", new Object[]
{
Long.toString(mFolderId),
});
{
Long.toString(mFolderId),
});
}
@Override
@ -2233,18 +2233,18 @@ public class LocalStore extends Store implements Serializable
"reply_to_list = NULL " +
"WHERE id = ?",
new Object[]
{
mId
});
{
mId
});
/*
* Delete all of the messages' attachments to save space.
*/
mDb.execSQL("DELETE FROM attachments WHERE id = ?",
new Object[]
{
mId
});
{
mId
});
((LocalFolder)mFolder).deleteHeaders(mId);
@ -2288,9 +2288,9 @@ public class LocalStore extends Store implements Serializable
* Set the flags on the message.
*/
mDb.execSQL("UPDATE messages " + "SET flags = ? " + " WHERE id = ?", new Object[]
{
Utility.combine(getFlags(), ',').toUpperCase(), mId
});
{
Utility.combine(getFlags(), ',').toUpperCase(), mId
});
}
}

View File

@ -167,9 +167,9 @@ public class Pop3Store extends Store
public Folder[] getPersonalNamespaces() throws MessagingException
{
return new Folder[]
{
getFolder("INBOX"),
};
{
getFolder("INBOX"),
};
}
@Override
@ -236,9 +236,9 @@ public class Pop3Store extends Store
SSLContext sslContext = SSLContext.getInstance("TLS");
final boolean secure = mConnectionSecurity == CONNECTION_SECURITY_SSL_REQUIRED;
sslContext.init(null, new TrustManager[]
{
TrustManagerFactory.get(mHost, secure)
}, new SecureRandom());
{
TrustManagerFactory.get(mHost, secure)
}, new SecureRandom());
mSocket = sslContext.getSocketFactory().createSocket();
mSocket.connect(socketAddress, SOCKET_CONNECT_TIMEOUT);
mIn = new BufferedInputStream(mSocket.getInputStream(), 1024);
@ -273,9 +273,9 @@ public class Pop3Store extends Store
SSLContext sslContext = SSLContext.getInstance("TLS");
boolean secure = mConnectionSecurity == CONNECTION_SECURITY_TLS_REQUIRED;
sslContext.init(null, new TrustManager[]
{
TrustManagerFactory.get(mHost, secure)
}, new SecureRandom());
{
TrustManagerFactory.get(mHost, secure)
}, new SecureRandom());
mSocket = sslContext.getSocketFactory().createSocket(mSocket, mHost, mPort,
true);
mSocket.setSoTimeout(Store.SOCKET_READ_TIMEOUT);
@ -845,7 +845,7 @@ public class Pop3Store extends Store
public void delete(boolean recurse) throws MessagingException
{
}
public void delete(Message[] msgs, String trashFolderName) throws MessagingException
{
setFlags(msgs, new Flag[] { Flag.DELETED }, true);

View File

@ -1262,7 +1262,7 @@ public class WebDavStore extends Store
{
moveOrCopyMessages(messages, folder.getName(), true);
}
@Override
public void delete(Message[] msgs, String trashFolderName) throws MessagingException
{
@ -1375,7 +1375,7 @@ public class WebDavStore extends Store
}
@Override
public void close(boolean expunge)
public void close(boolean expunge)
{
this.mMessageCount = 0;
this.mUnreadMessageCount = 0;

View File

@ -147,9 +147,9 @@ public class SmtpTransport extends Transport
SSLContext sslContext = SSLContext.getInstance("TLS");
boolean secure = mConnectionSecurity == CONNECTION_SECURITY_SSL_REQUIRED;
sslContext.init(null, new TrustManager[]
{
TrustManagerFactory.get(mHost, secure)
}, new SecureRandom());
{
TrustManagerFactory.get(mHost, secure)
}, new SecureRandom());
mSocket = sslContext.getSocketFactory().createSocket();
mSocket.connect(socketAddress, SOCKET_CONNECT_TIMEOUT);
mSecure = true;
@ -210,9 +210,9 @@ public class SmtpTransport extends Transport
SSLContext sslContext = SSLContext.getInstance("TLS");
boolean secure = mConnectionSecurity == CONNECTION_SECURITY_TLS_REQUIRED;
sslContext.init(null, new TrustManager[]
{
TrustManagerFactory.get(mHost, secure)
}, new SecureRandom());
{
TrustManagerFactory.get(mHost, secure)
}, new SecureRandom());
mSocket = sslContext.getSocketFactory().createSocket(mSocket, mHost, mPort,
true);
mIn = new PeekableInputStream(new BufferedInputStream(mSocket.getInputStream(),

View File

@ -28,9 +28,9 @@ public class TrustedSocketFactory implements LayeredSocketFactory
{
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, new TrustManager[]
{
TrustManagerFactory.get(host, secure)
}, new SecureRandom());
{
TrustManagerFactory.get(host, secure)
}, new SecureRandom());
mSocketFactory = sslContext.getSocketFactory();
mSchemeSocketFactory = org.apache.http.conn.ssl.SSLSocketFactory.getSocketFactory();
mSchemeSocketFactory.setHostnameVerifier(