use interfaces, not implementions

This commit is contained in:
Art O Cathain 2014-10-04 11:45:45 +01:00
parent dadf5e0865
commit 203dcfe2c3
31 changed files with 205 additions and 161 deletions

View File

@ -181,7 +181,7 @@ public class Account implements BaseAccount {
private boolean mPushPollOnConnect; private boolean mPushPollOnConnect;
private boolean mNotifySync; private boolean mNotifySync;
private SortType mSortType; private SortType mSortType;
private HashMap<SortType, Boolean> mSortAscending = new HashMap<SortType, Boolean>(); private Map<SortType, Boolean> mSortAscending = new HashMap<SortType, Boolean>();
private ShowPictures mShowPictures; private ShowPictures mShowPictures;
private boolean mIsSignatureBeforeQuotedText; private boolean mIsSignatureBeforeQuotedText;
private String mExpungePolicy = EXPUNGE_IMMEDIATELY; private String mExpungePolicy = EXPUNGE_IMMEDIATELY;

View File

@ -5,6 +5,7 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.concurrent.SynchronousQueue; import java.util.concurrent.SynchronousQueue;
@ -263,7 +264,7 @@ public class K9 extends Application {
private static boolean mHideTimeZone = false; private static boolean mHideTimeZone = false;
private static SortType mSortType; private static SortType mSortType;
private static HashMap<SortType, Boolean> mSortAscending = new HashMap<SortType, Boolean>(); private static Map<SortType, Boolean> mSortAscending = new HashMap<SortType, Boolean>();
private static boolean sUseBackgroundAsUnreadIndicator = true; private static boolean sUseBackgroundAsUnreadIndicator = true;
private static boolean sThreadedViewEnabled = true; private static boolean sThreadedViewEnabled = true;

View File

@ -17,6 +17,8 @@
package com.fsck.k9.activity; package com.fsck.k9.activity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import android.app.ListActivity; import android.app.ListActivity;
import android.os.Bundle; import android.os.Bundle;
import android.text.Html; import android.text.Html;
@ -40,7 +42,7 @@ public class AccessibleEmailContentActivity extends ListActivity {
Spanned parsedHtml = Html.fromHtml(htmlSource, null, null); Spanned parsedHtml = Html.fromHtml(htmlSource, null, null);
String[] rawListItems = parsedHtml.toString().split("\n"); String[] rawListItems = parsedHtml.toString().split("\n");
ArrayList<String> cleanedList = new ArrayList<String>(); List<String> cleanedList = new ArrayList<String>();
for (String rawListItem : rawListItems) { for (String rawListItem : rawListItems) {
if (rawListItem.trim().length() > 0) { if (rawListItem.trim().length() > 0) {
addToCleanedList(cleanedList, rawListItem); addToCleanedList(cleanedList, rawListItem);
@ -53,7 +55,7 @@ public class AccessibleEmailContentActivity extends ListActivity {
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, listItems)); setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, listItems));
} }
private void addToCleanedList(ArrayList<String> cleanedList, String line) { private void addToCleanedList(List<String> cleanedList, String line) {
if (line.length() < 80) { if (line.length() < 80) {
cleanedList.add(line); cleanedList.add(line);
} else { } else {

View File

@ -13,6 +13,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import android.app.ActionBar; import android.app.ActionBar;
import android.app.Activity; import android.app.Activity;
@ -75,6 +76,7 @@ import com.fsck.k9.activity.setup.Prefs;
import com.fsck.k9.activity.setup.WelcomeMessage; import com.fsck.k9.activity.setup.WelcomeMessage;
import com.fsck.k9.controller.MessagingController; import com.fsck.k9.controller.MessagingController;
import com.fsck.k9.helper.SizeFormatter; import com.fsck.k9.helper.SizeFormatter;
import com.fsck.k9.helper.Utility;
import com.fsck.k9.mail.AuthType; import com.fsck.k9.mail.AuthType;
import com.fsck.k9.mail.ServerSettings; import com.fsck.k9.mail.ServerSettings;
import com.fsck.k9.mail.Store; import com.fsck.k9.mail.Store;
@ -120,9 +122,9 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
private static final int DIALOG_RECREATE_ACCOUNT = 3; private static final int DIALOG_RECREATE_ACCOUNT = 3;
private static final int DIALOG_NO_FILE_MANAGER = 4; private static final int DIALOG_NO_FILE_MANAGER = 4;
private ConcurrentHashMap<String, AccountStats> accountStats = new ConcurrentHashMap<String, AccountStats>(); private ConcurrentMap<String, AccountStats> accountStats = new ConcurrentHashMap<String, AccountStats>();
private ConcurrentHashMap<BaseAccount, String> pendingWork = new ConcurrentHashMap<BaseAccount, String>(); private ConcurrentMap<BaseAccount, String> pendingWork = new ConcurrentHashMap<BaseAccount, String>();
private BaseAccount mSelectedContextAccount; private BaseAccount mSelectedContextAccount;
private int mUnreadMessageCount = 0; private int mUnreadMessageCount = 0;
@ -495,7 +497,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
outState.putString(SELECTED_CONTEXT_ACCOUNT, mSelectedContextAccount.getUuid()); outState.putString(SELECTED_CONTEXT_ACCOUNT, mSelectedContextAccount.getUuid());
} }
outState.putSerializable(STATE_UNREAD_COUNT, mUnreadMessageCount); outState.putSerializable(STATE_UNREAD_COUNT, mUnreadMessageCount);
outState.putSerializable(ACCOUNT_STATS, accountStats); outState.putSerializable(ACCOUNT_STATS, Utility.toSerializableConcurrentMap(accountStats));
} }
private StorageManager.StorageListener storageListener = new StorageManager.StorageListener() { private StorageManager.StorageListener storageListener = new StorageManager.StorageListener() {

View File

@ -660,7 +660,7 @@ public class FolderList extends K9ListActivity {
} }
class FolderListAdapter extends BaseAdapter implements Filterable { class FolderListAdapter extends BaseAdapter implements Filterable {
private ArrayList<FolderInfoHolder> mFolders = new ArrayList<FolderInfoHolder>(); private List<FolderInfoHolder> mFolders = new ArrayList<FolderInfoHolder>();
private List<FolderInfoHolder> mFilteredFolders = Collections.unmodifiableList(mFolders); private List<FolderInfoHolder> mFilteredFolders = Collections.unmodifiableList(mFolders);
private Filter mFilter = new FolderListFilter(); private Filter mFilter = new FolderListFilter();
@ -1176,7 +1176,7 @@ public class FolderList extends K9ListActivity {
Locale locale = Locale.getDefault(); Locale locale = Locale.getDefault();
if ((searchTerm == null) || (searchTerm.length() == 0)) { if ((searchTerm == null) || (searchTerm.length() == 0)) {
ArrayList<FolderInfoHolder> list = new ArrayList<FolderInfoHolder>(mFolders); List<FolderInfoHolder> list = new ArrayList<FolderInfoHolder>(mFolders);
results.values = list; results.values = list;
results.count = list.size(); results.count = list.size();
} else { } else {
@ -1184,7 +1184,7 @@ public class FolderList extends K9ListActivity {
final String[] words = searchTermString.split(" "); final String[] words = searchTermString.split(" ");
final int wordCount = words.length; final int wordCount = words.length;
final ArrayList<FolderInfoHolder> newValues = new ArrayList<FolderInfoHolder>(); final List<FolderInfoHolder> newValues = new ArrayList<FolderInfoHolder>();
for (final FolderInfoHolder value : mFolders) { for (final FolderInfoHolder value : mFolders) {
if (value.displayName == null) { if (value.displayName == null) {

View File

@ -29,7 +29,7 @@ public class FolderListFilter<T> extends Filter {
/** /**
* All folders. * All folders.
*/ */
private ArrayList<T> mOriginalValues = null; private List<T> mOriginalValues = null;
/** /**
* Create a filter for a list of folders. * Create a filter for a list of folders.
@ -62,7 +62,7 @@ public class FolderListFilter<T> extends Filter {
Locale locale = Locale.getDefault(); Locale locale = Locale.getDefault();
if ((searchTerm == null) || (searchTerm.length() == 0)) { if ((searchTerm == null) || (searchTerm.length() == 0)) {
ArrayList<T> list = new ArrayList<T>(mOriginalValues); List<T> list = new ArrayList<T>(mOriginalValues);
results.values = list; results.values = list;
results.count = list.size(); results.count = list.size();
} else { } else {
@ -70,9 +70,9 @@ public class FolderListFilter<T> extends Filter {
final String[] words = searchTermString.split(" "); final String[] words = searchTermString.split(" ");
final int wordCount = words.length; final int wordCount = words.length;
final ArrayList<T> values = mOriginalValues; final List<T> values = mOriginalValues;
final ArrayList<T> newValues = new ArrayList<T>(); final List<T> newValues = new ArrayList<T>();
for (final T value : values) { for (final T value : values) {
final String valueText = value.toString().toLowerCase(locale); final String valueText = value.toString().toLowerCase(locale);

View File

@ -1013,7 +1013,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
addAttachment(stream, type); addAttachment(stream, type);
} }
} else { } else {
ArrayList<Parcelable> list = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM); List<Parcelable> list = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
if (list != null) { if (list != null) {
for (Parcelable parcelable : list) { for (Parcelable parcelable : list) {
Uri stream = (Uri) parcelable; Uri stream = (Uri) parcelable;
@ -1155,7 +1155,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
@Override @Override
protected void onSaveInstanceState(Bundle outState) { protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
ArrayList<Attachment> attachments = new ArrayList<Attachment>(); List<Attachment> attachments = new ArrayList<Attachment>();
for (int i = 0, count = mAttachments.getChildCount(); i < count; i++) { for (int i = 0, count = mAttachments.getChildCount(); i < count; i++) {
View view = mAttachments.getChildAt(i); View view = mAttachments.getChildAt(i);
Attachment attachment = (Attachment) view.getTag(); Attachment attachment = (Attachment) view.getTag();
@ -1164,7 +1164,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
outState.putInt(STATE_KEY_NUM_ATTACHMENTS_LOADING, mNumAttachmentsLoading); outState.putInt(STATE_KEY_NUM_ATTACHMENTS_LOADING, mNumAttachmentsLoading);
outState.putString(STATE_KEY_WAITING_FOR_ATTACHMENTS, mWaitingForAttachments.name()); outState.putString(STATE_KEY_WAITING_FOR_ATTACHMENTS, mWaitingForAttachments.name());
outState.putParcelableArrayList(STATE_KEY_ATTACHMENTS, attachments); outState.putParcelableArrayList(STATE_KEY_ATTACHMENTS, Utility.toArrayList(attachments));
outState.putBoolean(STATE_KEY_CC_SHOWN, mCcWrapper.getVisibility() == View.VISIBLE); outState.putBoolean(STATE_KEY_CC_SHOWN, mCcWrapper.getVisibility() == View.VISIBLE);
outState.putBoolean(STATE_KEY_BCC_SHOWN, mBccWrapper.getVisibility() == View.VISIBLE); outState.putBoolean(STATE_KEY_BCC_SHOWN, mBccWrapper.getVisibility() == View.VISIBLE);
outState.putSerializable(STATE_KEY_QUOTED_TEXT_MODE, mQuotedTextMode); outState.putSerializable(STATE_KEY_QUOTED_TEXT_MODE, mQuotedTextMode);
@ -1199,7 +1199,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
"\" from saved instance state", e); "\" from saved instance state", e);
} }
ArrayList<Attachment> attachments = savedInstanceState.getParcelableArrayList(STATE_KEY_ATTACHMENTS); List<Attachment> attachments = savedInstanceState.getParcelableArrayList(STATE_KEY_ATTACHMENTS);
for (Attachment attachment : attachments) { for (Attachment attachment : attachments) {
addAttachmentView(attachment); addAttachmentView(attachment);
if (attachment.loaderId > mMaxLoaderId) { if (attachment.loaderId > mMaxLoaderId) {
@ -1808,7 +1808,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
String[] emailsArray = null; String[] emailsArray = null;
if (mEncryptCheckbox.isChecked()) { if (mEncryptCheckbox.isChecked()) {
// get emails as array // get emails as array
ArrayList<String> emails = new ArrayList<String>(); List<String> emails = new ArrayList<String>();
for (Address address : getRecipientAddresses()) { for (Address address : getRecipientAddresses()) {
emails.add(address.getAddress()); emails.add(address.getAddress());

View File

@ -1,6 +1,7 @@
package com.fsck.k9.activity; package com.fsck.k9.activity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
@ -14,6 +15,7 @@ import com.fsck.k9.Account;
import com.fsck.k9.K9; import com.fsck.k9.K9;
import com.fsck.k9.Preferences; import com.fsck.k9.Preferences;
import com.fsck.k9.R; import com.fsck.k9.R;
import com.fsck.k9.helper.Utility;
import com.fsck.k9.service.NotificationActionService; import com.fsck.k9.service.NotificationActionService;
public class NotificationDeleteConfirmation extends Activity { public class NotificationDeleteConfirmation extends Activity {
@ -23,12 +25,12 @@ public class NotificationDeleteConfirmation extends Activity {
private final static int DIALOG_CONFIRM = 1; private final static int DIALOG_CONFIRM = 1;
private Account mAccount; private Account mAccount;
private ArrayList<MessageReference> mMessageRefs; private List<MessageReference> mMessageRefs;
public static PendingIntent getIntent(Context context, final Account account, final ArrayList<MessageReference> refs) { public static PendingIntent getIntent(Context context, final Account account, final List<MessageReference> refs) {
Intent i = new Intent(context, NotificationDeleteConfirmation.class); Intent i = new Intent(context, NotificationDeleteConfirmation.class);
i.putExtra(EXTRA_ACCOUNT, account.getUuid()); i.putExtra(EXTRA_ACCOUNT, account.getUuid());
i.putExtra(EXTRA_MESSAGE_LIST, refs); i.putExtra(EXTRA_MESSAGE_LIST, Utility.toSerializableList(refs));
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
return PendingIntent.getActivity(context, account.getAccountNumber(), i, PendingIntent.FLAG_UPDATE_CURRENT); return PendingIntent.getActivity(context, account.getAccountNumber(), i, PendingIntent.FLAG_UPDATE_CURRENT);

View File

@ -299,8 +299,8 @@ public class MessagingController implements Runnable {
* *
* @return Message reference list * @return Message reference list
*/ */
public ArrayList<MessageReference> getAllMessageRefs() { public List<MessageReference> getAllMessageRefs() {
ArrayList<MessageReference> refs = new ArrayList<MessageReference>(); List<MessageReference> refs = new ArrayList<MessageReference>();
for (Message m : messages) { for (Message m : messages) {
refs.add(m.makeMessageReference()); refs.add(m.makeMessageReference());
} }
@ -993,7 +993,7 @@ public class MessagingController implements Runnable {
localFolder.open(Folder.OPEN_MODE_RW); localFolder.open(Folder.OPEN_MODE_RW);
localFolder.updateLastUid(); localFolder.updateLastUid();
Message[] localMessages = localFolder.getMessages(null); Message[] localMessages = localFolder.getMessages(null);
HashMap<String, Message> localUidMap = new HashMap<String, Message>(); Map<String, Message> localUidMap = new HashMap<String, Message>();
for (Message message : localMessages) { for (Message message : localMessages) {
localUidMap.put(message.getUid(), message); localUidMap.put(message.getUid(), message);
} }
@ -1059,8 +1059,8 @@ public class MessagingController implements Runnable {
} }
Message[] remoteMessageArray = EMPTY_MESSAGE_ARRAY; Message[] remoteMessageArray = EMPTY_MESSAGE_ARRAY;
final ArrayList<Message> remoteMessages = new ArrayList<Message>(); final List<Message> remoteMessages = new ArrayList<Message>();
HashMap<String, Message> remoteUidMap = new HashMap<String, Message>(); Map<String, Message> remoteUidMap = new HashMap<String, Message>();
if (K9.DEBUG) if (K9.DEBUG)
Log.v(K9.LOG_TAG, "SYNC: Remote message count for folder " + folder + " is " + remoteMessageCount); Log.v(K9.LOG_TAG, "SYNC: Remote message count for folder " + folder + " is " + remoteMessageCount);
@ -1117,7 +1117,7 @@ public class MessagingController implements Runnable {
* Remove any messages that are in the local store but no longer on the remote store or are too old * Remove any messages that are in the local store but no longer on the remote store or are too old
*/ */
if (account.syncRemoteDeletions()) { if (account.syncRemoteDeletions()) {
ArrayList<Message> destroyMessages = new ArrayList<Message>(); List<Message> destroyMessages = new ArrayList<Message>();
for (Message localMessage : localMessages) { for (Message localMessage : localMessages) {
if (remoteUidMap.get(localMessage.getUid()) == null) { if (remoteUidMap.get(localMessage.getUid()) == null) {
destroyMessages.add(localMessage); destroyMessages.add(localMessage);
@ -1280,7 +1280,7 @@ public class MessagingController implements Runnable {
Log.e(K9.LOG_TAG, "Unable to getUnreadMessageCount for account: " + account, e); Log.e(K9.LOG_TAG, "Unable to getUnreadMessageCount for account: " + account, e);
} }
ArrayList<Message> syncFlagMessages = new ArrayList<Message>(); List<Message> syncFlagMessages = new ArrayList<Message>();
List<Message> unsyncedMessages = new ArrayList<Message>(); List<Message> unsyncedMessages = new ArrayList<Message>();
final AtomicInteger newMessages = new AtomicInteger(0); final AtomicInteger newMessages = new AtomicInteger(0);
@ -1300,8 +1300,8 @@ public class MessagingController implements Runnable {
Log.d(K9.LOG_TAG, "SYNC: Have " + unsyncedMessages.size() + " unsynced messages"); Log.d(K9.LOG_TAG, "SYNC: Have " + unsyncedMessages.size() + " unsynced messages");
messages.clear(); messages.clear();
final ArrayList<Message> largeMessages = new ArrayList<Message>(); final List<Message> largeMessages = new ArrayList<Message>();
final ArrayList<Message> smallMessages = new ArrayList<Message>(); final List<Message> smallMessages = new ArrayList<Message>();
if (!unsyncedMessages.isEmpty()) { if (!unsyncedMessages.isEmpty()) {
/* /*
@ -1416,7 +1416,7 @@ public class MessagingController implements Runnable {
final Folder remoteFolder, final Folder remoteFolder,
final Account account, final Account account,
final List<Message> unsyncedMessages, final List<Message> unsyncedMessages,
final ArrayList<Message> syncFlagMessages, final List<Message> syncFlagMessages,
boolean flagSyncOnly) throws MessagingException { boolean flagSyncOnly) throws MessagingException {
if (message.isSet(Flag.DELETED)) { if (message.isSet(Flag.DELETED)) {
syncFlagMessages.add(message); syncFlagMessages.add(message);
@ -1475,8 +1475,8 @@ public class MessagingController implements Runnable {
private void fetchUnsyncedMessages(final Account account, final Folder remoteFolder, private void fetchUnsyncedMessages(final Account account, final Folder remoteFolder,
final LocalFolder localFolder, final LocalFolder localFolder,
List<Message> unsyncedMessages, List<Message> unsyncedMessages,
final ArrayList<Message> smallMessages, final List<Message> smallMessages,
final ArrayList<Message> largeMessages, final List<Message> largeMessages,
final AtomicInteger progress, final AtomicInteger progress,
final int todo, final int todo,
FetchProfile fp) throws MessagingException { FetchProfile fp) throws MessagingException {
@ -1611,7 +1611,7 @@ public class MessagingController implements Runnable {
private void downloadSmallMessages(final Account account, final Folder remoteFolder, private void downloadSmallMessages(final Account account, final Folder remoteFolder,
final LocalFolder localFolder, final LocalFolder localFolder,
ArrayList<Message> smallMessages, List<Message> smallMessages,
final AtomicInteger progress, final AtomicInteger progress,
final int unreadBeforeStart, final int unreadBeforeStart,
final AtomicInteger newMessages, final AtomicInteger newMessages,
@ -1690,7 +1690,7 @@ public class MessagingController implements Runnable {
private void downloadLargeMessages(final Account account, final Folder remoteFolder, private void downloadLargeMessages(final Account account, final Folder remoteFolder,
final LocalFolder localFolder, final LocalFolder localFolder,
ArrayList<Message> largeMessages, List<Message> largeMessages,
final AtomicInteger progress, final AtomicInteger progress,
final int unreadBeforeStart, final int unreadBeforeStart,
final AtomicInteger newMessages, final AtomicInteger newMessages,
@ -1815,7 +1815,7 @@ public class MessagingController implements Runnable {
private void refreshLocalMessageFlags(final Account account, final Folder remoteFolder, private void refreshLocalMessageFlags(final Account account, final Folder remoteFolder,
final LocalFolder localFolder, final LocalFolder localFolder,
ArrayList<Message> syncFlagMessages, List<Message> syncFlagMessages,
final AtomicInteger progress, final AtomicInteger progress,
final int todo final int todo
) throws MessagingException { ) throws MessagingException {
@ -1952,7 +1952,7 @@ public class MessagingController implements Runnable {
private void processPendingCommandsSynchronous(Account account) throws MessagingException { private void processPendingCommandsSynchronous(Account account) throws MessagingException {
LocalStore localStore = account.getLocalStore(); LocalStore localStore = account.getLocalStore();
ArrayList<PendingCommand> commands = localStore.getPendingCommands(); List<PendingCommand> commands = localStore.getPendingCommands();
int progress = 0; int progress = 0;
int todo = commands.size(); int todo = commands.size();
@ -4863,7 +4863,7 @@ public class MessagingController implements Runnable {
String accountDescr = (account.getDescription() != null) ? String accountDescr = (account.getDescription() != null) ?
account.getDescription() : account.getEmail(); account.getDescription() : account.getEmail();
final ArrayList<MessageReference> allRefs = data.getAllMessageRefs(); final List<MessageReference> allRefs = data.getAllMessageRefs();
if (platformSupportsExtendedNotifications() && !privacyModeEnabled) { if (platformSupportsExtendedNotifications() && !privacyModeEnabled) {
if (newMessages > 1) { if (newMessages > 1) {
@ -5424,7 +5424,7 @@ public class MessagingController implements Runnable {
return taccount.getDescription() + ":" + tfolderName; return taccount.getDescription() + ":" + tfolderName;
} }
static class MemorizingListener extends MessagingListener { static class MemorizingListener extends MessagingListener {
HashMap<String, Memory> memories = new HashMap<String, Memory>(31); Map<String, Memory> memories = new HashMap<String, Memory>(31);
Memory getMemory(Account account, String folderName) { Memory getMemory(Account account, String folderName) {
Memory memory = memories.get(getMemoryKey(account, folderName)); Memory memory = memories.get(getMemoryKey(account, folderName));

View File

@ -2995,8 +2995,8 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
super.onStop(); super.onStop();
} }
public ArrayList<MessageReference> getMessageReferences() { public List<MessageReference> getMessageReferences() {
ArrayList<MessageReference> messageRefs = new ArrayList<MessageReference>(); List<MessageReference> messageRefs = new ArrayList<MessageReference>();
for (int i = 0, len = mAdapter.getCount(); i < len; i++) { for (int i = 0, len = mAdapter.getCount(); i < len; i++) {
Cursor cursor = (Cursor) mAdapter.getItem(i); Cursor cursor = (Cursor) mAdapter.getItem(i);

View File

@ -13,6 +13,7 @@ import com.fsck.k9.K9;
import com.fsck.k9.mail.Address; import com.fsck.k9.mail.Address;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
/** /**
* Helper class to access the contacts stored on the device. * Helper class to access the contacts stored on the device.
@ -276,7 +277,7 @@ public class Contacts {
*/ */
public ContactItem extractInfoFromContactPickerIntent(final Intent intent) { public ContactItem extractInfoFromContactPickerIntent(final Intent intent) {
Cursor cursor = null; Cursor cursor = null;
ArrayList<String> email = new ArrayList<String>(); List<String> email = new ArrayList<String>();
try { try {
Uri result = intent.getData(); Uri result = intent.getData();

View File

@ -20,10 +20,13 @@ import com.fsck.k9.mail.filter.Base64;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.Serializable;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -704,4 +707,23 @@ public class Utility {
} }
return sMainThreadHandler; return sMainThreadHandler;
} }
public static <T> Serializable toSerializableList(List<T> list) {
return list instanceof Serializable ?
(Serializable) list :
new ArrayList<T>(list);
}
public static <T> ArrayList<T> toArrayList(List<T> list) {
return list instanceof ArrayList ?
(ArrayList<T>) list :
new ArrayList<T>(list);
}
public static <T,U> Serializable toSerializableConcurrentMap(ConcurrentMap<T,U> list) {
return list instanceof ConcurrentHashMap ?
(ConcurrentHashMap<T,U>) list :
new ConcurrentHashMap<T,U>(list);
}
} }

View File

@ -315,7 +315,7 @@ public class Address {
if (addressList == null) { if (addressList == null) {
return new Address[] { }; return new Address[] { };
} }
ArrayList<Address> addresses = new ArrayList<Address>(); List<Address> addresses = new ArrayList<Address>();
int length = addressList.length(); int length = addressList.length();
int pairStartIndex = 0; int pairStartIndex = 0;
int pairEndIndex = 0; int pairEndIndex = 0;

View File

@ -13,7 +13,7 @@ import com.fsck.k9.mail.internet.TextBody;
public abstract class Multipart implements CompositeBody { public abstract class Multipart implements CompositeBody {
private Part mParent; private Part mParent;
private final ArrayList<BodyPart> mParts = new ArrayList<BodyPart>(); private final List<BodyPart> mParts = new ArrayList<BodyPart>();
private String mContentType; private String mContentType;

View File

@ -3,7 +3,9 @@ package com.fsck.k9.mail;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
@ -33,19 +35,19 @@ public abstract class Store {
/** /**
* Remote stores indexed by Uri. * Remote stores indexed by Uri.
*/ */
private static HashMap<String, Store> sStores = new HashMap<String, Store>(); private static Map<String, Store> sStores = new HashMap<String, Store>();
/** /**
* Local stores indexed by UUID because the Uri may change due to migration to/from SD-card. * Local stores indexed by UUID because the Uri may change due to migration to/from SD-card.
*/ */
private static ConcurrentHashMap<String, Store> sLocalStores = new ConcurrentHashMap<String, Store>(); private static ConcurrentMap<String, Store> sLocalStores = new ConcurrentHashMap<String, Store>();
/** /**
* Lock objects indexed by account UUID. * Lock objects indexed by account UUID.
* *
* @see #getLocalInstance(Account, Application) * @see #getLocalInstance(Account, Application)
*/ */
private static ConcurrentHashMap<String, Object> sAccountLocks = new ConcurrentHashMap<String, Object>(); private static ConcurrentMap<String, Object> sAccountLocks = new ConcurrentHashMap<String, Object>();
/** /**
* Get an instance of a remote mail store. * Get an instance of a remote mail store.

View File

@ -36,7 +36,7 @@ public class MimeHeader {
HEADER_ANDROID_ATTACHMENT_STORE_DATA HEADER_ANDROID_ATTACHMENT_STORE_DATA
}; };
private ArrayList<Field> mFields = new ArrayList<Field>(); private List<Field> mFields = new ArrayList<Field>();
private String mCharset = null; private String mCharset = null;
public void clear() { public void clear() {
@ -72,7 +72,7 @@ public class MimeHeader {
} }
public String[] getHeader(String name) { public String[] getHeader(String name) {
ArrayList<String> values = new ArrayList<String>(); List<String> values = new ArrayList<String>();
for (Field field : mFields) { for (Field field : mFields) {
if (field.name.equalsIgnoreCase(name)) { if (field.name.equalsIgnoreCase(name)) {
values.add(field.value); values.add(field.value);
@ -85,7 +85,7 @@ public class MimeHeader {
} }
public void removeHeader(String name) { public void removeHeader(String name) {
ArrayList<Field> removeFields = new ArrayList<Field>(); List<Field> removeFields = new ArrayList<Field>();
for (Field field : mFields) { for (Field field : mFields) {
if (field.name.equalsIgnoreCase(name)) { if (field.name.equalsIgnoreCase(name)) {
removeFields.add(field); removeFields.add(field);

View File

@ -1356,9 +1356,9 @@ public class ImapStore extends Store {
private List<Message> search(ImapSearcher searcher, MessageRetrievalListener listener) throws MessagingException { private List<Message> search(ImapSearcher searcher, MessageRetrievalListener listener) throws MessagingException {
checkOpen(); //only need READ access checkOpen(); //only need READ access
ArrayList<Message> messages = new ArrayList<Message>(); List<Message> messages = new ArrayList<Message>();
try { try {
ArrayList<Long> uids = new ArrayList<Long>(); List<Long> uids = new ArrayList<Long>();
List<ImapResponse> responses = searcher.search(); // List<ImapResponse> responses = searcher.search(); //
for (ImapResponse response : responses) { for (ImapResponse response : responses) {
if (response.mTag == null) { if (response.mTag == null) {
@ -1403,11 +1403,11 @@ public class ImapStore extends Store {
public Message[] getMessages(String[] uids, MessageRetrievalListener listener) public Message[] getMessages(String[] uids, MessageRetrievalListener listener)
throws MessagingException { throws MessagingException {
checkOpen(); //only need READ access checkOpen(); //only need READ access
ArrayList<Message> messages = new ArrayList<Message>(); List<Message> messages = new ArrayList<Message>();
try { try {
if (uids == null) { if (uids == null) {
List<ImapResponse> responses = executeSimpleCommand("UID SEARCH 1:* NOT DELETED"); List<ImapResponse> responses = executeSimpleCommand("UID SEARCH 1:* NOT DELETED");
ArrayList<String> tempUids = new ArrayList<String>(); List<String> tempUids = new ArrayList<String>();
for (ImapResponse response : responses) { for (ImapResponse response : responses) {
if (ImapResponseParser.equalsIgnoreCase(response.get(0), "SEARCH")) { if (ImapResponseParser.equalsIgnoreCase(response.get(0), "SEARCH")) {
for (int i = 1, count = response.size(); i < count; i++) { for (int i = 1, count = response.size(); i < count; i++) {
@ -1441,7 +1441,7 @@ public class ImapStore extends Store {
} }
checkOpen(); //only need READ access checkOpen(); //only need READ access
List<String> uids = new ArrayList<String>(messages.length); List<String> uids = new ArrayList<String>(messages.length);
HashMap<String, Message> messageMap = new HashMap<String, Message>(); Map<String, Message> messageMap = new HashMap<String, Message>();
for (Message msg : messages) { for (Message msg : messages) {
String uid = msg.getUid(); String uid = msg.getUid();
uids.add(uid); uids.add(uid);
@ -2089,7 +2089,7 @@ public class ImapStore extends Store {
} }
private String combineFlags(Flag[] flags) { private String combineFlags(Flag[] flags) {
ArrayList<String> flagNames = new ArrayList<String>(); List<String> flagNames = new ArrayList<String>();
for (Flag flag : flags) { for (Flag flag : flags) {
if (flag == Flag.SEEN) { if (flag == Flag.SEEN) {
flagNames.add("\\Seen"); flagNames.add("\\Seen");
@ -2733,10 +2733,10 @@ public class ImapStore extends Store {
return response; return response;
} }
protected ArrayList<ImapResponse> readStatusResponse(String tag, protected List<ImapResponse> readStatusResponse(String tag,
String commandToLog, UntaggedHandler untaggedHandler) String commandToLog, UntaggedHandler untaggedHandler)
throws IOException, MessagingException { throws IOException, MessagingException {
ArrayList<ImapResponse> responses = new ArrayList<ImapResponse>(); List<ImapResponse> responses = new ArrayList<ImapResponse>();
ImapResponse response; ImapResponse response;
do { do {
response = mParser.readResponse(); response = mParser.readResponse();
@ -3552,9 +3552,9 @@ public class ImapStore extends Store {
} }
private static class FetchBodyCallback implements ImapResponseParser.IImapResponseCallback { private static class FetchBodyCallback implements ImapResponseParser.IImapResponseCallback {
private HashMap<String, Message> mMessageMap; private Map<String, Message> mMessageMap;
FetchBodyCallback(HashMap<String, Message> mesageMap) { FetchBodyCallback(Map<String, Message> mesageMap) {
mMessageMap = mesageMap; mMessageMap = mesageMap;
} }

View File

@ -196,7 +196,7 @@ public class Pop3Store extends Store {
private String mClientCertificateAlias; private String mClientCertificateAlias;
private AuthType mAuthType; private AuthType mAuthType;
private ConnectionSecurity mConnectionSecurity; private ConnectionSecurity mConnectionSecurity;
private HashMap<String, Folder> mFolders = new HashMap<String, Folder>(); private Map<String, Folder> mFolders = new HashMap<String, Folder>();
private Pop3Capabilities mCapabilities; private Pop3Capabilities mCapabilities;
/** /**
@ -274,9 +274,9 @@ public class Pop3Store extends Store {
private Socket mSocket; private Socket mSocket;
private InputStream mIn; private InputStream mIn;
private OutputStream mOut; private OutputStream mOut;
private HashMap<String, Pop3Message> mUidToMsgMap = new HashMap<String, Pop3Message>(); private Map<String, Pop3Message> mUidToMsgMap = new HashMap<String, Pop3Message>();
private HashMap<Integer, Pop3Message> mMsgNumToMsgMap = new HashMap<Integer, Pop3Message>(); private Map<Integer, Pop3Message> mMsgNumToMsgMap = new HashMap<Integer, Pop3Message>();
private HashMap<String, Integer> mUidToMsgNumMap = new HashMap<String, Integer>(); private Map<String, Integer> mUidToMsgNumMap = new HashMap<String, Integer>();
private String mName; private String mName;
private int mMessageCount; private int mMessageCount;
@ -577,7 +577,7 @@ public class Pop3Store extends Store {
} catch (IOException ioe) { } catch (IOException ioe) {
throw new MessagingException("getMessages", ioe); throw new MessagingException("getMessages", ioe);
} }
ArrayList<Message> messages = new ArrayList<Message>(); List<Message> messages = new ArrayList<Message>();
int i = 0; int i = 0;
for (int msgNum = start; msgNum <= end; msgNum++) { for (int msgNum = start; msgNum <= end; msgNum++) {
Pop3Message message = mMsgNumToMsgMap.get(msgNum); Pop3Message message = mMsgNumToMsgMap.get(msgNum);
@ -686,7 +686,7 @@ public class Pop3Store extends Store {
} }
} }
private void indexUids(ArrayList<String> uids) private void indexUids(List<String> uids)
throws MessagingException, IOException { throws MessagingException, IOException {
Set<String> unindexedUids = new HashSet<String>(); Set<String> unindexedUids = new HashSet<String>();
for (String uid : uids) { for (String uid : uids) {
@ -764,7 +764,7 @@ public class Pop3Store extends Store {
if (messages == null || messages.length == 0) { if (messages == null || messages.length == 0) {
return; return;
} }
ArrayList<String> uids = new ArrayList<String>(); List<String> uids = new ArrayList<String>();
for (Message message : messages) { for (Message message : messages) {
uids.add(message.getUid()); uids.add(message.getUid());
} }
@ -988,7 +988,7 @@ public class Pop3Store extends Store {
*/ */
return; return;
} }
ArrayList<String> uids = new ArrayList<String>(); List<String> uids = new ArrayList<String>();
try { try {
for (Message message : messages) { for (Message message : messages) {
uids.add(message.getUid()); uids.add(message.getUid());

View File

@ -293,7 +293,7 @@ public class WebDavStore extends Store {
private String mCachedLoginUrl; private String mCachedLoginUrl;
private Folder mSendFolder = null; private Folder mSendFolder = null;
private HashMap<String, WebDavFolder> mFolderList = new HashMap<String, WebDavFolder>(); private Map<String, WebDavFolder> mFolderList = new HashMap<String, WebDavFolder>();
public WebDavStore(Account account) throws MessagingException { public WebDavStore(Account account) throws MessagingException {
@ -363,7 +363,7 @@ public class WebDavStore extends Store {
@Override @Override
public List <? extends Folder > getPersonalNamespaces(boolean forceListAll) throws MessagingException { public List <? extends Folder > getPersonalNamespaces(boolean forceListAll) throws MessagingException {
LinkedList<Folder> folderList = new LinkedList<Folder>(); List<Folder> folderList = new LinkedList<Folder>();
/** /**
* We have to check authentication here so we have the proper URL stored * We have to check authentication here so we have the proper URL stored
*/ */
@ -373,13 +373,13 @@ public class WebDavStore extends Store {
* Firstly we get the "special" folders list (inbox, outbox, etc) * Firstly we get the "special" folders list (inbox, outbox, etc)
* and setup the account accordingly * and setup the account accordingly
*/ */
HashMap<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
DataSet dataset = new DataSet(); DataSet dataset = new DataSet();
headers.put("Depth", "0"); headers.put("Depth", "0");
headers.put("Brief", "t"); headers.put("Brief", "t");
dataset = processRequest(this.mUrl, "PROPFIND", getSpecialFoldersList(), headers); dataset = processRequest(this.mUrl, "PROPFIND", getSpecialFoldersList(), headers);
HashMap<String, String> specialFoldersMap = dataset.getSpecialFolderToUrl(); Map<String, String> specialFoldersMap = dataset.getSpecialFolderToUrl();
String folderName = getFolderName(specialFoldersMap.get(DAV_MAIL_INBOX_FOLDER)); String folderName = getFolderName(specialFoldersMap.get(DAV_MAIL_INBOX_FOLDER));
if (folderName != null) { if (folderName != null) {
mAccount.setAutoExpandFolderName(folderName); mAccount.setAutoExpandFolderName(folderName);
@ -825,7 +825,7 @@ public class WebDavStore extends Store {
request.setMethod("POST"); request.setMethod("POST");
// Build the POST data. // Build the POST data.
ArrayList<BasicNameValuePair> pairs = new ArrayList<BasicNameValuePair>(); List<BasicNameValuePair> pairs = new ArrayList<BasicNameValuePair>();
pairs.add(new BasicNameValuePair("destination", mUrl)); pairs.add(new BasicNameValuePair("destination", mUrl));
pairs.add(new BasicNameValuePair("username", mUsername)); pairs.add(new BasicNameValuePair("username", mUsername));
pairs.add(new BasicNameValuePair("password", mPassword)); pairs.add(new BasicNameValuePair("password", mPassword));
@ -1037,7 +1037,7 @@ public class WebDavStore extends Store {
} }
private InputStream sendRequest(String url, String method, StringEntity messageBody, private InputStream sendRequest(String url, String method, StringEntity messageBody,
HashMap<String, String> headers, boolean tryAuth) Map<String, String> headers, boolean tryAuth)
throws MessagingException { throws MessagingException {
InputStream istream = null; InputStream istream = null;
@ -1115,12 +1115,12 @@ public class WebDavStore extends Store {
* not all requests will need them. There are two signatures to support calls that don't require parsing of the * not all requests will need them. There are two signatures to support calls that don't require parsing of the
* response. * response.
*/ */
private DataSet processRequest(String url, String method, String messageBody, HashMap<String, String> headers) private DataSet processRequest(String url, String method, String messageBody, Map<String, String> headers)
throws MessagingException { throws MessagingException {
return processRequest(url, method, messageBody, headers, true); return processRequest(url, method, messageBody, headers, true);
} }
private DataSet processRequest(String url, String method, String messageBody, HashMap<String, String> headers, private DataSet processRequest(String url, String method, String messageBody, Map<String, String> headers,
boolean needsParsing) boolean needsParsing)
throws MessagingException { throws MessagingException {
DataSet dataset = new DataSet(); DataSet dataset = new DataSet();
@ -1294,8 +1294,8 @@ public class WebDavStore extends Store {
uids[i] = messages[i].getUid(); uids[i] = messages[i].getUid();
} }
String messageBody = ""; String messageBody = "";
HashMap<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
HashMap<String, String> uidToUrl = getMessageUrls(uids); Map<String, String> uidToUrl = getMessageUrls(uids);
String[] urls = new String[uids.length]; String[] urls = new String[uids.length];
for (int i = 0, count = uids.length; i < count; i++) { for (int i = 0, count = uids.length; i < count; i++) {
@ -1320,7 +1320,7 @@ public class WebDavStore extends Store {
private int getMessageCount(boolean read) throws MessagingException { private int getMessageCount(boolean read) throws MessagingException {
String isRead; String isRead;
int messageCount = 0; int messageCount = 0;
HashMap<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
String messageBody; String messageBody;
if (read) { if (read) {
@ -1406,9 +1406,9 @@ public class WebDavStore extends Store {
@Override @Override
public Message[] getMessages(int start, int end, Date earliestDate, MessageRetrievalListener listener) public Message[] getMessages(int start, int end, Date earliestDate, MessageRetrievalListener listener)
throws MessagingException { throws MessagingException {
ArrayList<Message> messages = new ArrayList<Message>(); List<Message> messages = new ArrayList<Message>();
String[] uids; String[] uids;
HashMap<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
int uidsLength = -1; int uidsLength = -1;
String messageBody; String messageBody;
@ -1434,7 +1434,7 @@ public class WebDavStore extends Store {
DataSet dataset = processRequest(this.mFolderUrl, "SEARCH", messageBody, headers); DataSet dataset = processRequest(this.mFolderUrl, "SEARCH", messageBody, headers);
uids = dataset.getUids(); uids = dataset.getUids();
HashMap<String, String> uidToUrl = dataset.getUidToUrl(); Map<String, String> uidToUrl = dataset.getUidToUrl();
uidsLength = uids.length; uidsLength = uids.length;
for (int i = 0; i < uidsLength; i++) { for (int i = 0; i < uidsLength; i++) {
@ -1460,7 +1460,7 @@ public class WebDavStore extends Store {
@Override @Override
public Message[] getMessages(String[] uids, MessageRetrievalListener listener) throws MessagingException { public Message[] getMessages(String[] uids, MessageRetrievalListener listener) throws MessagingException {
ArrayList<Message> messageList = new ArrayList<Message>(); List<Message> messageList = new ArrayList<Message>();
Message[] messages; Message[] messages;
if (uids == null || if (uids == null ||
@ -1485,8 +1485,8 @@ public class WebDavStore extends Store {
return messages; return messages;
} }
private HashMap<String, String> getMessageUrls(String[] uids) throws MessagingException { private Map<String, String> getMessageUrls(String[] uids) throws MessagingException {
HashMap<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
String messageBody; String messageBody;
/** Retrieve and parse the XML entity for our messages */ /** Retrieve and parse the XML entity for our messages */
@ -1494,7 +1494,7 @@ public class WebDavStore extends Store {
headers.put("Brief", "t"); headers.put("Brief", "t");
DataSet dataset = processRequest(this.mFolderUrl, "SEARCH", messageBody, headers); DataSet dataset = processRequest(this.mFolderUrl, "SEARCH", messageBody, headers);
HashMap<String, String> uidToUrl = dataset.getUidToUrl(); Map<String, String> uidToUrl = dataset.getUidToUrl();
return uidToUrl; return uidToUrl;
} }
@ -1650,7 +1650,7 @@ public class WebDavStore extends Store {
* we do a series of medium calls instead of one large massive call or a large number of smaller calls. * we do a series of medium calls instead of one large massive call or a large number of smaller calls.
*/ */
private void fetchFlags(Message[] startMessages, MessageRetrievalListener listener) throws MessagingException { private void fetchFlags(Message[] startMessages, MessageRetrievalListener listener) throws MessagingException {
HashMap<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
String messageBody = ""; String messageBody = "";
Message[] messages = new Message[20]; Message[] messages = new Message[20];
String[] uids; String[] uids;
@ -1689,7 +1689,7 @@ public class WebDavStore extends Store {
throw new MessagingException("Data Set from request was null"); throw new MessagingException("Data Set from request was null");
} }
HashMap<String, Boolean> uidToReadStatus = dataset.getUidToRead(); Map<String, Boolean> uidToReadStatus = dataset.getUidToRead();
for (int i = 0, count = messages.length; i < count; i++) { for (int i = 0, count = messages.length; i < count; i++) {
if (!(messages[i] instanceof WebDavMessage)) { if (!(messages[i] instanceof WebDavMessage)) {
@ -1720,7 +1720,7 @@ public class WebDavStore extends Store {
*/ */
private void fetchEnvelope(Message[] startMessages, MessageRetrievalListener listener) private void fetchEnvelope(Message[] startMessages, MessageRetrievalListener listener)
throws MessagingException { throws MessagingException {
HashMap<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
String messageBody = ""; String messageBody = "";
String[] uids; String[] uids;
Message[] messages = new Message[10]; Message[] messages = new Message[10];
@ -1802,8 +1802,8 @@ public class WebDavStore extends Store {
private void markServerMessagesRead(String[] uids, boolean read) throws MessagingException { private void markServerMessagesRead(String[] uids, boolean read) throws MessagingException {
String messageBody = ""; String messageBody = "";
HashMap<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
HashMap<String, String> uidToUrl = getMessageUrls(uids); Map<String, String> uidToUrl = getMessageUrls(uids);
String[] urls = new String[uids.length]; String[] urls = new String[uids.length];
for (int i = 0, count = uids.length; i < count; i++) { for (int i = 0, count = uids.length; i < count; i++) {
@ -1818,10 +1818,10 @@ public class WebDavStore extends Store {
} }
private void deleteServerMessages(String[] uids) throws MessagingException { private void deleteServerMessages(String[] uids) throws MessagingException {
HashMap<String, String> uidToUrl = getMessageUrls(uids); Map<String, String> uidToUrl = getMessageUrls(uids);
for (String uid : uids) { for (String uid : uids) {
HashMap<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
String url = uidToUrl.get(uid); String url = uidToUrl.get(uid);
String destinationUrl = generateDeleteUrl(url); String destinationUrl = generateDeleteUrl(url);
@ -2005,7 +2005,7 @@ public class WebDavStore extends Store {
public void setNewHeaders(ParsedMessageEnvelope envelope) throws MessagingException { public void setNewHeaders(ParsedMessageEnvelope envelope) throws MessagingException {
String[] headers = envelope.getHeaderList(); String[] headers = envelope.getHeaderList();
HashMap<String, String> messageHeaders = envelope.getMessageHeaders(); Map<String, String> messageHeaders = envelope.getMessageHeaders();
for (String header : headers) { for (String header : headers) {
String headerValue = messageHeaders.get(header); String headerValue = messageHeaders.get(header);
@ -2107,8 +2107,8 @@ public class WebDavStore extends Store {
private boolean mReadStatus = false; private boolean mReadStatus = false;
private String mUid = ""; private String mUid = "";
private HashMap<String, String> mMessageHeaders = new HashMap<String, String>(); private Map<String, String> mMessageHeaders = new HashMap<String, String>();
private ArrayList<String> mHeaders = new ArrayList<String>(); private List<String> mHeaders = new ArrayList<String>();
public void addHeader(String field, String value) { public void addHeader(String field, String value) {
String headerName = HEADER_MAPPINGS.get(field); String headerName = HEADER_MAPPINGS.get(field);
@ -2119,7 +2119,7 @@ public class WebDavStore extends Store {
} }
} }
public HashMap<String, String> getMessageHeaders() { public Map<String, String> getMessageHeaders() {
return this.mMessageHeaders; return this.mMessageHeaders;
} }
@ -2151,9 +2151,9 @@ public class WebDavStore extends Store {
* depending on the accessor calls made. * depending on the accessor calls made.
*/ */
public class DataSet { public class DataSet {
private HashMap<String, HashMap<String, String>> mData = new HashMap<String, HashMap<String, String>>(); private Map<String, Map<String, String>> mData = new HashMap<String, Map<String, String>>();
private StringBuilder mUid = new StringBuilder(); private StringBuilder mUid = new StringBuilder();
private HashMap<String, String> mTempData = new HashMap<String, String>(); private Map<String, String> mTempData = new HashMap<String, String>();
public void addValue(String value, String tagName) { public void addValue(String value, String tagName) {
if (tagName.equals("uid")) { if (tagName.equals("uid")) {
@ -2185,9 +2185,9 @@ public class WebDavStore extends Store {
/** /**
* Returns a hashmap of special folder name => special folder url * Returns a hashmap of special folder name => special folder url
*/ */
public HashMap<String, String> getSpecialFolderToUrl() { public Map<String, String> getSpecialFolderToUrl() {
// We return the first (and only) map // We return the first (and only) map
for (HashMap<String, String> folderMap : mData.values()) { for (Map<String, String> folderMap : mData.values()) {
return folderMap; return folderMap;
} }
return new HashMap<String, String>(); return new HashMap<String, String>();
@ -2196,11 +2196,11 @@ public class WebDavStore extends Store {
/** /**
* Returns a hashmap of Message UID => Message Url * Returns a hashmap of Message UID => Message Url
*/ */
public HashMap<String, String> getUidToUrl() { public Map<String, String> getUidToUrl() {
HashMap<String, String> uidToUrl = new HashMap<String, String>(); Map<String, String> uidToUrl = new HashMap<String, String>();
for (String uid : mData.keySet()) { for (String uid : mData.keySet()) {
HashMap<String, String> data = mData.get(uid); Map<String, String> data = mData.get(uid);
String value = data.get("href"); String value = data.get("href");
if (value != null && if (value != null &&
!value.equals("")) { !value.equals("")) {
@ -2214,11 +2214,11 @@ public class WebDavStore extends Store {
/** /**
* Returns a hashmap of Message UID => Read Status * Returns a hashmap of Message UID => Read Status
*/ */
public HashMap<String, Boolean> getUidToRead() { public Map<String, Boolean> getUidToRead() {
HashMap<String, Boolean> uidToRead = new HashMap<String, Boolean>(); Map<String, Boolean> uidToRead = new HashMap<String, Boolean>();
for (String uid : mData.keySet()) { for (String uid : mData.keySet()) {
HashMap<String, String> data = mData.get(uid); Map<String, String> data = mData.get(uid);
String readStatus = data.get("read"); String readStatus = data.get("read");
if (readStatus != null && !readStatus.equals("")) { if (readStatus != null && !readStatus.equals("")) {
Boolean value = !readStatus.equals("0"); Boolean value = !readStatus.equals("0");
@ -2238,10 +2238,10 @@ public class WebDavStore extends Store {
* Returns an array of all hrefs (urls) that were received * Returns an array of all hrefs (urls) that were received
*/ */
public String[] getHrefs() { public String[] getHrefs() {
ArrayList<String> hrefs = new ArrayList<String>(); List<String> hrefs = new ArrayList<String>();
for (String uid : mData.keySet()) { for (String uid : mData.keySet()) {
HashMap<String, String> data = mData.get(uid); Map<String, String> data = mData.get(uid);
String href = data.get("href"); String href = data.get("href");
hrefs.add(href); hrefs.add(href);
} }
@ -2253,7 +2253,7 @@ public class WebDavStore extends Store {
* Return an array of all Message UIDs that were received * Return an array of all Message UIDs that were received
*/ */
public String[] getUids() { public String[] getUids() {
ArrayList<String> uids = new ArrayList<String>(); List<String> uids = new ArrayList<String>();
for (String uid : mData.keySet()) { for (String uid : mData.keySet()) {
uids.add(uid); uids.add(uid);
@ -2274,7 +2274,7 @@ public class WebDavStore extends Store {
int messageCount = 0; int messageCount = 0;
for (String uid : mData.keySet()) { for (String uid : mData.keySet()) {
HashMap<String, String> data = mData.get(uid); Map<String, String> data = mData.get(uid);
String count = data.get("visiblecount"); String count = data.get("visiblecount");
if (count != null && if (count != null &&
@ -2288,14 +2288,14 @@ public class WebDavStore extends Store {
} }
/** /**
* Returns a HashMap of message UID => ParsedMessageEnvelope * Returns a Map of message UID => ParsedMessageEnvelope
*/ */
public HashMap<String, ParsedMessageEnvelope> getMessageEnvelopes() { public Map<String, ParsedMessageEnvelope> getMessageEnvelopes() {
HashMap<String, ParsedMessageEnvelope> envelopes = new HashMap<String, ParsedMessageEnvelope>(); Map<String, ParsedMessageEnvelope> envelopes = new HashMap<String, ParsedMessageEnvelope>();
for (String uid : mData.keySet()) { for (String uid : mData.keySet()) {
ParsedMessageEnvelope envelope = new ParsedMessageEnvelope(); ParsedMessageEnvelope envelope = new ParsedMessageEnvelope();
HashMap<String, String> data = mData.get(uid); Map<String, String> data = mData.get(uid);
if (data != null) { if (data != null) {
for (Map.Entry<String, String> entry : data.entrySet()) { for (Map.Entry<String, String> entry : data.entrySet()) {

View File

@ -48,7 +48,7 @@ public class ImapUtility {
* list is returned. * list is returned.
*/ */
public static List<String> getImapSequenceValues(String set) { public static List<String> getImapSequenceValues(String set) {
ArrayList<String> list = new ArrayList<String>(); List<String> list = new ArrayList<String>();
if (set != null) { if (set != null) {
String[] setItems = set.split(","); String[] setItems = set.split(",");
for (String item : setItems) { for (String item : setItems) {
@ -83,7 +83,7 @@ public class ImapUtility {
* is returned. * is returned.
*/ */
public static List<String> getImapRangeValues(String range) { public static List<String> getImapRangeValues(String range) {
ArrayList<String> list = new ArrayList<String>(); List<String> list = new ArrayList<String>();
try { try {
if (range != null) { if (range != null) {
int colonPos = range.indexOf(':'); int colonPos = range.indexOf(':');

View File

@ -971,7 +971,7 @@ public class LocalFolder extends Folder implements Serializable {
if (uids == null) { if (uids == null) {
return getMessages(listener); return getMessages(listener);
} }
ArrayList<Message> messages = new ArrayList<Message>(); List<Message> messages = new ArrayList<Message>();
for (String uid : uids) { for (String uid : uids) {
Message message = getMessage(uid); Message message = getMessage(uid);
if (message != null) { if (message != null) {

View File

@ -4,6 +4,7 @@ import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Set; import java.util.Set;
import android.content.ContentValues; import android.content.ContentValues;
@ -492,7 +493,7 @@ public class LocalMessage extends MimeMessage {
} }
private void loadHeaders() throws UnavailableStorageException { private void loadHeaders() throws UnavailableStorageException {
ArrayList<LocalMessage> messages = new ArrayList<LocalMessage>(); List<LocalMessage> messages = new ArrayList<LocalMessage>();
messages.add(this); messages.add(this);
mHeadersLoaded = true; // set true before calling populate headers to stop recursion mHeadersLoaded = true; // set true before calling populate headers to stop recursion
((LocalFolder) mFolder).populateHeaders(messages); ((LocalFolder) mFolder).populateHeaders(messages);

View File

@ -425,10 +425,10 @@ public class LocalStore extends Store implements Serializable {
}); });
} }
public ArrayList<PendingCommand> getPendingCommands() throws UnavailableStorageException { public List<PendingCommand> getPendingCommands() throws UnavailableStorageException {
return database.execute(false, new DbCallback<ArrayList<PendingCommand>>() { return database.execute(false, new DbCallback<List<PendingCommand>>() {
@Override @Override
public ArrayList<PendingCommand> doDbWork(final SQLiteDatabase db) throws WrappedException { public List<PendingCommand> doDbWork(final SQLiteDatabase db) throws WrappedException {
Cursor cursor = null; Cursor cursor = null;
try { try {
cursor = db.query("pending_commands", cursor = db.query("pending_commands",
@ -438,7 +438,7 @@ public class LocalStore extends Store implements Serializable {
null, null,
null, null,
"id ASC"); "id ASC");
ArrayList<PendingCommand> commands = new ArrayList<PendingCommand>(); List<PendingCommand> commands = new ArrayList<PendingCommand>();
while (cursor.moveToNext()) { while (cursor.moveToNext()) {
PendingCommand command = new PendingCommand(); PendingCommand command = new PendingCommand();
command.mId = cursor.getLong(0); command.mId = cursor.getLong(0);
@ -559,7 +559,7 @@ public class LocalStore extends Store implements Serializable {
final LocalFolder folder, final LocalFolder folder,
final String queryString, final String[] placeHolders final String queryString, final String[] placeHolders
) throws MessagingException { ) throws MessagingException {
final ArrayList<LocalMessage> messages = new ArrayList<LocalMessage>(); final List<LocalMessage> messages = new ArrayList<LocalMessage>();
final int j = database.execute(false, new DbCallback<Integer>() { final int j = database.execute(false, new DbCallback<Integer>() {
@Override @Override
public Integer doDbWork(final SQLiteDatabase db) throws WrappedException { public Integer doDbWork(final SQLiteDatabase db) throws WrappedException {

View File

@ -256,7 +256,7 @@ public class SmtpTransport extends Transport {
} }
} }
HashMap<String,String> extensions = sendHello(localHost); Map<String,String> extensions = sendHello(localHost);
m8bitEncodingAllowed = extensions.containsKey("8BITMIME"); m8bitEncodingAllowed = extensions.containsKey("8BITMIME");
@ -419,7 +419,7 @@ public class SmtpTransport extends Transport {
* @param host * @param host
* The EHLO/HELO parameter as defined by the RFC. * The EHLO/HELO parameter as defined by the RFC.
* *
* @return A (possibly empty) {@code HashMap<String,String>} of extensions (upper case) and * @return A (possibly empty) {@code Map<String,String>} of extensions (upper case) and
* their parameters (possibly 0 length) as returned by the EHLO command * their parameters (possibly 0 length) as returned by the EHLO command
* *
* @throws IOException * @throws IOException
@ -427,8 +427,8 @@ public class SmtpTransport extends Transport {
* @throws MessagingException * @throws MessagingException
* In case of a malformed response. * In case of a malformed response.
*/ */
private HashMap<String,String> sendHello(String host) throws IOException, MessagingException { private Map<String,String> sendHello(String host) throws IOException, MessagingException {
HashMap<String, String> extensions = new HashMap<String, String>(); Map<String, String> extensions = new HashMap<String, String>();
try { try {
List<String> results = executeSimpleCommand("EHLO " + host); List<String> results = executeSimpleCommand("EHLO " + host);
// Remove the EHLO greeting response // Remove the EHLO greeting response
@ -453,7 +453,7 @@ public class SmtpTransport extends Transport {
@Override @Override
public void sendMessage(Message message) throws MessagingException { public void sendMessage(Message message) throws MessagingException {
ArrayList<Address> addresses = new ArrayList<Address>(); List<Address> addresses = new ArrayList<Address>();
{ {
addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO)));
addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC)));
@ -461,12 +461,12 @@ public class SmtpTransport extends Transport {
} }
message.setRecipients(RecipientType.BCC, null); message.setRecipients(RecipientType.BCC, null);
HashMap<String, ArrayList<String>> charsetAddressesMap = Map<String, List<String>> charsetAddressesMap =
new HashMap<String, ArrayList<String>>(); new HashMap<String, List<String>>();
for (Address address : addresses) { for (Address address : addresses) {
String addressString = address.getAddress(); String addressString = address.getAddress();
String charset = MimeUtility.getCharsetFromAddress(addressString); String charset = MimeUtility.getCharsetFromAddress(addressString);
ArrayList<String> addressesOfCharset = charsetAddressesMap.get(charset); List<String> addressesOfCharset = charsetAddressesMap.get(charset);
if (addressesOfCharset == null) { if (addressesOfCharset == null) {
addressesOfCharset = new ArrayList<String>(); addressesOfCharset = new ArrayList<String>();
charsetAddressesMap.put(charset, addressesOfCharset); charsetAddressesMap.put(charset, addressesOfCharset);
@ -474,16 +474,16 @@ public class SmtpTransport extends Transport {
addressesOfCharset.add(addressString); addressesOfCharset.add(addressString);
} }
for (Map.Entry<String, ArrayList<String>> charsetAddressesMapEntry : for (Map.Entry<String, List<String>> charsetAddressesMapEntry :
charsetAddressesMap.entrySet()) { charsetAddressesMap.entrySet()) {
String charset = charsetAddressesMapEntry.getKey(); String charset = charsetAddressesMapEntry.getKey();
ArrayList<String> addressesOfCharset = charsetAddressesMapEntry.getValue(); List<String> addressesOfCharset = charsetAddressesMapEntry.getValue();
message.setCharset(charset); message.setCharset(charset);
sendMessageTo(addressesOfCharset, message); sendMessageTo(addressesOfCharset, message);
} }
} }
private void sendMessageTo(ArrayList<String> addresses, Message message) private void sendMessageTo(List<String> addresses, Message message)
throws MessagingException { throws MessagingException {
boolean possibleSend = false; boolean possibleSend = false;

View File

@ -5,14 +5,15 @@ import com.fsck.k9.K9;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
public class Editor implements android.content.SharedPreferences.Editor { public class Editor implements android.content.SharedPreferences.Editor {
private Storage storage; private Storage storage;
private HashMap<String, String> changes = new HashMap<String, String>(); private Map<String, String> changes = new HashMap<String, String>();
private ArrayList<String> removals = new ArrayList<String>(); private List<String> removals = new ArrayList<String>();
private boolean removeAll = false; private boolean removeAll = false;
Map<String, String> snapshot = new HashMap<String, String>(); Map<String, String> snapshot = new HashMap<String, String>();

View File

@ -15,16 +15,18 @@ import com.fsck.k9.helper.Utility;
import java.net.URI; import java.net.URI;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
public class Storage implements SharedPreferences { public class Storage implements SharedPreferences {
private static ConcurrentHashMap<Context, Storage> storages = private static ConcurrentMap<Context, Storage> storages =
new ConcurrentHashMap<Context, Storage>(); new ConcurrentHashMap<Context, Storage>();
private volatile ConcurrentHashMap<String, String> storage = new ConcurrentHashMap<String, String>(); private volatile ConcurrentMap<String, String> storage = new ConcurrentHashMap<String, String>();
private CopyOnWriteArrayList<OnSharedPreferenceChangeListener> listeners = private CopyOnWriteArrayList<OnSharedPreferenceChangeListener> listeners =
new CopyOnWriteArrayList<OnSharedPreferenceChangeListener>(); new CopyOnWriteArrayList<OnSharedPreferenceChangeListener>();
@ -32,11 +34,11 @@ public class Storage implements SharedPreferences {
private int DB_VERSION = 2; private int DB_VERSION = 2;
private String DB_NAME = "preferences_storage"; private String DB_NAME = "preferences_storage";
private ThreadLocal<ConcurrentHashMap<String, String>> workingStorage private ThreadLocal<ConcurrentMap<String, String>> workingStorage
= new ThreadLocal<ConcurrentHashMap<String, String>>(); = new ThreadLocal<ConcurrentMap<String, String>>();
private ThreadLocal<SQLiteDatabase> workingDB = private ThreadLocal<SQLiteDatabase> workingDB =
new ThreadLocal<SQLiteDatabase>(); new ThreadLocal<SQLiteDatabase>();
private ThreadLocal<ArrayList<String>> workingChangedKeys = new ThreadLocal<ArrayList<String>>(); private ThreadLocal<List<String>> workingChangedKeys = new ThreadLocal<List<String>>();
private Context context = null; private Context context = null;
@ -202,7 +204,7 @@ public class Storage implements SharedPreferences {
} }
private void keyChange(String key) { private void keyChange(String key) {
ArrayList<String> changedKeys = workingChangedKeys.get(); List<String> changedKeys = workingChangedKeys.get();
if (!changedKeys.contains(key)) { if (!changedKeys.contains(key)) {
changedKeys.add(key); changedKeys.add(key);
} }
@ -259,14 +261,14 @@ public class Storage implements SharedPreferences {
} }
protected void doInTransaction(Runnable dbWork) { protected void doInTransaction(Runnable dbWork) {
ConcurrentHashMap<String, String> newStorage = new ConcurrentHashMap<String, String>(); ConcurrentMap<String, String> newStorage = new ConcurrentHashMap<String, String>();
newStorage.putAll(storage); newStorage.putAll(storage);
workingStorage.set(newStorage); workingStorage.set(newStorage);
SQLiteDatabase mDb = openDB(); SQLiteDatabase mDb = openDB();
workingDB.set(mDb); workingDB.set(mDb);
ArrayList<String> changedKeys = new ArrayList<String>(); List<String> changedKeys = new ArrayList<String>();
workingChangedKeys.set(changedKeys); workingChangedKeys.set(changedKeys);
mDb.beginTransaction(); mDb.beginTransaction();
@ -294,7 +296,11 @@ public class Storage implements SharedPreferences {
//@Override //@Override
public boolean contains(String key) { public boolean contains(String key) {
return storage.contains(key); // TODO this used to be ConcurrentHashMap#contains which is
// actually containsValue. But looking at the usage of this method,
// it's clear that containsKey is what's intended. Investigate if this
// was a bug previously. Looks like it was only used once, when upgrading
return storage.containsKey(key);
} }
//@Override //@Override

View File

@ -256,7 +256,7 @@ public class ConditionsTreeNode implements Parcelable {
* @return List of all nodes in subtree in preorder. * @return List of all nodes in subtree in preorder.
*/ */
public List<ConditionsTreeNode> preorder() { public List<ConditionsTreeNode> preorder() {
ArrayList<ConditionsTreeNode> result = new ArrayList<ConditionsTreeNode>(); List<ConditionsTreeNode> result = new ArrayList<ConditionsTreeNode>();
Stack<ConditionsTreeNode> stack = new Stack<ConditionsTreeNode>(); Stack<ConditionsTreeNode> stack = new Stack<ConditionsTreeNode>();
stack.push(this); stack.push(this);

View File

@ -252,7 +252,7 @@ public class LocalSearch implements SearchSpecification {
* real searches because of possible extra conditions to a folder requirement. * real searches because of possible extra conditions to a folder requirement.
*/ */
public List<String> getFolderNames() { public List<String> getFolderNames() {
ArrayList<String> results = new ArrayList<String>(); List<String> results = new ArrayList<String>();
for (ConditionsTreeNode node : mLeafSet) { for (ConditionsTreeNode node : mLeafSet) {
if (node.mCondition.field == Searchfield.FOLDER && if (node.mCondition.field == Searchfield.FOLDER &&
node.mCondition.attribute == Attribute.EQUALS) { node.mCondition.attribute == Attribute.EQUALS) {

View File

@ -1,6 +1,7 @@
package com.fsck.k9.service; package com.fsck.k9.service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import com.fsck.k9.Account; import com.fsck.k9.Account;
import com.fsck.k9.K9; import com.fsck.k9.K9;
@ -8,6 +9,7 @@ import com.fsck.k9.Preferences;
import com.fsck.k9.activity.MessageCompose; import com.fsck.k9.activity.MessageCompose;
import com.fsck.k9.activity.MessageReference; import com.fsck.k9.activity.MessageReference;
import com.fsck.k9.controller.MessagingController; import com.fsck.k9.controller.MessagingController;
import com.fsck.k9.helper.Utility;
import com.fsck.k9.mail.Flag; import com.fsck.k9.mail.Flag;
import com.fsck.k9.mail.Message; import com.fsck.k9.mail.Message;
@ -36,12 +38,12 @@ public class NotificationActionService extends CoreService {
} }
public static PendingIntent getReadAllMessagesIntent(Context context, final Account account, public static PendingIntent getReadAllMessagesIntent(Context context, final Account account,
final ArrayList<MessageReference> refs) { final List<MessageReference> refs) {
Intent i = new Intent(context, NotificationActionService.class); Intent i = new Intent(context, NotificationActionService.class);
i.putExtra(EXTRA_ACCOUNT, account.getUuid()); i.putExtra(EXTRA_ACCOUNT, account.getUuid());
i.putExtra(EXTRA_MESSAGE_LIST, refs); i.putExtra(EXTRA_MESSAGE_LIST, Utility.toSerializableList(refs));
i.setAction(READ_ALL_ACTION); i.setAction(READ_ALL_ACTION);
return PendingIntent.getService(context, account.getAccountNumber(), i, PendingIntent.FLAG_UPDATE_CURRENT); return PendingIntent.getService(context, account.getAccountNumber(), i, PendingIntent.FLAG_UPDATE_CURRENT);
} }
@ -54,10 +56,10 @@ public class NotificationActionService extends CoreService {
} }
public static Intent getDeleteAllMessagesIntent(Context context, final Account account, public static Intent getDeleteAllMessagesIntent(Context context, final Account account,
final ArrayList<MessageReference> refs) { final List<MessageReference> refs) {
Intent i = new Intent(context, NotificationActionService.class); Intent i = new Intent(context, NotificationActionService.class);
i.putExtra(EXTRA_ACCOUNT, account.getUuid()); i.putExtra(EXTRA_ACCOUNT, account.getUuid());
i.putExtra(EXTRA_MESSAGE_LIST, refs); i.putExtra(EXTRA_MESSAGE_LIST, Utility.toSerializableList(refs));
i.setAction(DELETE_ALL_ACTION); i.setAction(DELETE_ALL_ACTION);
return i; return i;
@ -77,7 +79,7 @@ public class NotificationActionService extends CoreService {
if (K9.DEBUG) if (K9.DEBUG)
Log.i(K9.LOG_TAG, "NotificationActionService marking messages as read"); Log.i(K9.LOG_TAG, "NotificationActionService marking messages as read");
ArrayList<MessageReference> refs = List<MessageReference> refs =
intent.getParcelableArrayListExtra(EXTRA_MESSAGE_LIST); intent.getParcelableArrayListExtra(EXTRA_MESSAGE_LIST);
for (MessageReference ref : refs) { for (MessageReference ref : refs) {
controller.setFlag(account, ref.folderName, ref.uid, Flag.SEEN, true); controller.setFlag(account, ref.folderName, ref.uid, Flag.SEEN, true);
@ -86,9 +88,9 @@ public class NotificationActionService extends CoreService {
if (K9.DEBUG) if (K9.DEBUG)
Log.i(K9.LOG_TAG, "NotificationActionService deleting messages"); Log.i(K9.LOG_TAG, "NotificationActionService deleting messages");
ArrayList<MessageReference> refs = List<MessageReference> refs =
intent.getParcelableArrayListExtra(EXTRA_MESSAGE_LIST); intent.getParcelableArrayListExtra(EXTRA_MESSAGE_LIST);
ArrayList<Message> messages = new ArrayList<Message>(); List<Message> messages = new ArrayList<Message>();
for (MessageReference ref : refs) { for (MessageReference ref : refs) {
Message m = ref.restoreToLocalMessage(this); Message m = ref.restoreToLocalMessage(this);
@ -121,7 +123,7 @@ public class NotificationActionService extends CoreService {
} else { } else {
Log.w(K9.LOG_TAG, "Could not find account for notification action."); Log.w(K9.LOG_TAG, "Could not find account for notification action.");
} }
return START_NOT_STICKY; return START_NOT_STICKY;
} }
} }

View File

@ -12,6 +12,7 @@ import com.fsck.k9.helper.power.TracingPowerManager;
import com.fsck.k9.helper.power.TracingPowerManager.TracingWakeLock; import com.fsck.k9.helper.power.TracingPowerManager.TracingWakeLock;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
public class PollService extends CoreService { public class PollService extends CoreService {
private static String START_SERVICE = "com.fsck.k9.service.PollService.startService"; private static String START_SERVICE = "com.fsck.k9.service.PollService.startService";
@ -77,7 +78,7 @@ public class PollService extends CoreService {
} }
class Listener extends MessagingListener { class Listener extends MessagingListener {
HashMap<String, Integer> accountsChecked = new HashMap<String, Integer>(); Map<String, Integer> accountsChecked = new HashMap<String, Integer>();
private TracingWakeLock wakeLock = null; private TracingWakeLock wakeLock = null;
private int startId = -1; private int startId = -1;

View File

@ -28,6 +28,7 @@ import android.webkit.WebView;
import android.widget.ScrollView; import android.widget.ScrollView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
/** /**
* A {@link ScrollView} that will never lock scrolling in a particular direction. * A {@link ScrollView} that will never lock scrolling in a particular direction.
@ -59,7 +60,7 @@ public class NonLockingScrollView extends ScrollView {
/** /**
* The list of children who should always receive touch events, and not have them intercepted. * The list of children who should always receive touch events, and not have them intercepted.
*/ */
private final ArrayList<View> mChildrenNeedingAllTouches = new ArrayList<View>(); private final List<View> mChildrenNeedingAllTouches = new ArrayList<View>();
private boolean mSkipWebViewScroll = true; private boolean mSkipWebViewScroll = true;
@ -122,7 +123,7 @@ public class NonLockingScrollView extends ScrollView {
} }
private final Rect sHitFrame = new Rect(); private final Rect sHitFrame = new Rect();
private boolean isEventOverChild(MotionEvent ev, ArrayList<View> children) { private boolean isEventOverChild(MotionEvent ev, List<View> children) {
final int actionIndex = ev.getActionIndex(); final int actionIndex = ev.getActionIndex();
final float x = ev.getX(actionIndex) + getScrollX(); final float x = ev.getX(actionIndex) + getScrollX();
final float y = ev.getY(actionIndex) + getScrollY(); final float y = ev.getY(actionIndex) + getScrollY();