1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

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 mNotifySync;
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 boolean mIsSignatureBeforeQuotedText;
private String mExpungePolicy = EXPUNGE_IMMEDIATELY;

View File

@ -5,6 +5,7 @@ import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.SynchronousQueue;
@ -263,7 +264,7 @@ public class K9 extends Application {
private static boolean mHideTimeZone = false;
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 sThreadedViewEnabled = true;

View File

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

View File

@ -13,6 +13,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import android.app.ActionBar;
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.controller.MessagingController;
import com.fsck.k9.helper.SizeFormatter;
import com.fsck.k9.helper.Utility;
import com.fsck.k9.mail.AuthType;
import com.fsck.k9.mail.ServerSettings;
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_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 int mUnreadMessageCount = 0;
@ -495,7 +497,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
outState.putString(SELECTED_CONTEXT_ACCOUNT, mSelectedContextAccount.getUuid());
}
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() {

View File

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

View File

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

View File

@ -1013,7 +1013,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
addAttachment(stream, type);
}
} else {
ArrayList<Parcelable> list = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
List<Parcelable> list = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
if (list != null) {
for (Parcelable parcelable : list) {
Uri stream = (Uri) parcelable;
@ -1155,7 +1155,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
@Override
protected void onSaveInstanceState(Bundle 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++) {
View view = mAttachments.getChildAt(i);
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.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_BCC_SHOWN, mBccWrapper.getVisibility() == View.VISIBLE);
outState.putSerializable(STATE_KEY_QUOTED_TEXT_MODE, mQuotedTextMode);
@ -1199,7 +1199,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
"\" 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) {
addAttachmentView(attachment);
if (attachment.loaderId > mMaxLoaderId) {
@ -1808,7 +1808,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
String[] emailsArray = null;
if (mEncryptCheckbox.isChecked()) {
// get emails as array
ArrayList<String> emails = new ArrayList<String>();
List<String> emails = new ArrayList<String>();
for (Address address : getRecipientAddresses()) {
emails.add(address.getAddress());

View File

@ -1,6 +1,7 @@
package com.fsck.k9.activity;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.app.AlertDialog;
@ -14,6 +15,7 @@ import com.fsck.k9.Account;
import com.fsck.k9.K9;
import com.fsck.k9.Preferences;
import com.fsck.k9.R;
import com.fsck.k9.helper.Utility;
import com.fsck.k9.service.NotificationActionService;
public class NotificationDeleteConfirmation extends Activity {
@ -23,12 +25,12 @@ public class NotificationDeleteConfirmation extends Activity {
private final static int DIALOG_CONFIRM = 1;
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);
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);
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
*/
public ArrayList<MessageReference> getAllMessageRefs() {
ArrayList<MessageReference> refs = new ArrayList<MessageReference>();
public List<MessageReference> getAllMessageRefs() {
List<MessageReference> refs = new ArrayList<MessageReference>();
for (Message m : messages) {
refs.add(m.makeMessageReference());
}
@ -993,7 +993,7 @@ public class MessagingController implements Runnable {
localFolder.open(Folder.OPEN_MODE_RW);
localFolder.updateLastUid();
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) {
localUidMap.put(message.getUid(), message);
}
@ -1059,8 +1059,8 @@ public class MessagingController implements Runnable {
}
Message[] remoteMessageArray = EMPTY_MESSAGE_ARRAY;
final ArrayList<Message> remoteMessages = new ArrayList<Message>();
HashMap<String, Message> remoteUidMap = new HashMap<String, Message>();
final List<Message> remoteMessages = new ArrayList<Message>();
Map<String, Message> remoteUidMap = new HashMap<String, Message>();
if (K9.DEBUG)
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
*/
if (account.syncRemoteDeletions()) {
ArrayList<Message> destroyMessages = new ArrayList<Message>();
List<Message> destroyMessages = new ArrayList<Message>();
for (Message localMessage : localMessages) {
if (remoteUidMap.get(localMessage.getUid()) == null) {
destroyMessages.add(localMessage);
@ -1280,7 +1280,7 @@ public class MessagingController implements Runnable {
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>();
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");
messages.clear();
final ArrayList<Message> largeMessages = new ArrayList<Message>();
final ArrayList<Message> smallMessages = new ArrayList<Message>();
final List<Message> largeMessages = new ArrayList<Message>();
final List<Message> smallMessages = new ArrayList<Message>();
if (!unsyncedMessages.isEmpty()) {
/*
@ -1416,7 +1416,7 @@ public class MessagingController implements Runnable {
final Folder remoteFolder,
final Account account,
final List<Message> unsyncedMessages,
final ArrayList<Message> syncFlagMessages,
final List<Message> syncFlagMessages,
boolean flagSyncOnly) throws MessagingException {
if (message.isSet(Flag.DELETED)) {
syncFlagMessages.add(message);
@ -1475,8 +1475,8 @@ public class MessagingController implements Runnable {
private void fetchUnsyncedMessages(final Account account, final Folder remoteFolder,
final LocalFolder localFolder,
List<Message> unsyncedMessages,
final ArrayList<Message> smallMessages,
final ArrayList<Message> largeMessages,
final List<Message> smallMessages,
final List<Message> largeMessages,
final AtomicInteger progress,
final int todo,
FetchProfile fp) throws MessagingException {
@ -1611,7 +1611,7 @@ public class MessagingController implements Runnable {
private void downloadSmallMessages(final Account account, final Folder remoteFolder,
final LocalFolder localFolder,
ArrayList<Message> smallMessages,
List<Message> smallMessages,
final AtomicInteger progress,
final int unreadBeforeStart,
final AtomicInteger newMessages,
@ -1690,7 +1690,7 @@ public class MessagingController implements Runnable {
private void downloadLargeMessages(final Account account, final Folder remoteFolder,
final LocalFolder localFolder,
ArrayList<Message> largeMessages,
List<Message> largeMessages,
final AtomicInteger progress,
final int unreadBeforeStart,
final AtomicInteger newMessages,
@ -1815,7 +1815,7 @@ public class MessagingController implements Runnable {
private void refreshLocalMessageFlags(final Account account, final Folder remoteFolder,
final LocalFolder localFolder,
ArrayList<Message> syncFlagMessages,
List<Message> syncFlagMessages,
final AtomicInteger progress,
final int todo
) throws MessagingException {
@ -1952,7 +1952,7 @@ public class MessagingController implements Runnable {
private void processPendingCommandsSynchronous(Account account) throws MessagingException {
LocalStore localStore = account.getLocalStore();
ArrayList<PendingCommand> commands = localStore.getPendingCommands();
List<PendingCommand> commands = localStore.getPendingCommands();
int progress = 0;
int todo = commands.size();
@ -4863,7 +4863,7 @@ public class MessagingController implements Runnable {
String accountDescr = (account.getDescription() != null) ?
account.getDescription() : account.getEmail();
final ArrayList<MessageReference> allRefs = data.getAllMessageRefs();
final List<MessageReference> allRefs = data.getAllMessageRefs();
if (platformSupportsExtendedNotifications() && !privacyModeEnabled) {
if (newMessages > 1) {
@ -5424,7 +5424,7 @@ public class MessagingController implements Runnable {
return taccount.getDescription() + ":" + tfolderName;
}
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 memory = memories.get(getMemoryKey(account, folderName));

View File

@ -2995,8 +2995,8 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
super.onStop();
}
public ArrayList<MessageReference> getMessageReferences() {
ArrayList<MessageReference> messageRefs = new ArrayList<MessageReference>();
public List<MessageReference> getMessageReferences() {
List<MessageReference> messageRefs = new ArrayList<MessageReference>();
for (int i = 0, len = mAdapter.getCount(); i < len; 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 java.util.ArrayList;
import java.util.List;
/**
* Helper class to access the contacts stored on the device.
@ -276,7 +277,7 @@ public class Contacts {
*/
public ContactItem extractInfoFromContactPickerIntent(final Intent intent) {
Cursor cursor = null;
ArrayList<String> email = new ArrayList<String>();
List<String> email = new ArrayList<String>();
try {
Uri result = intent.getData();

View File

@ -20,10 +20,13 @@ import com.fsck.k9.mail.filter.Base64;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.Serializable;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -704,4 +707,23 @@ public class Utility {
}
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) {
return new Address[] { };
}
ArrayList<Address> addresses = new ArrayList<Address>();
List<Address> addresses = new ArrayList<Address>();
int length = addressList.length();
int pairStartIndex = 0;
int pairEndIndex = 0;

View File

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

View File

@ -3,7 +3,9 @@ package com.fsck.k9.mail;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import android.app.Application;
import android.content.Context;
@ -33,19 +35,19 @@ public abstract class Store {
/**
* 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.
*/
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.
*
* @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.

View File

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

View File

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

View File

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

View File

@ -293,7 +293,7 @@ public class WebDavStore extends Store {
private String mCachedLoginUrl;
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 {
@ -363,7 +363,7 @@ public class WebDavStore extends Store {
@Override
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
*/
@ -373,13 +373,13 @@ public class WebDavStore extends Store {
* Firstly we get the "special" folders list (inbox, outbox, etc)
* 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();
headers.put("Depth", "0");
headers.put("Brief", "t");
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));
if (folderName != null) {
mAccount.setAutoExpandFolderName(folderName);
@ -825,7 +825,7 @@ public class WebDavStore extends Store {
request.setMethod("POST");
// 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("username", mUsername));
pairs.add(new BasicNameValuePair("password", mPassword));
@ -1037,7 +1037,7 @@ public class WebDavStore extends Store {
}
private InputStream sendRequest(String url, String method, StringEntity messageBody,
HashMap<String, String> headers, boolean tryAuth)
Map<String, String> headers, boolean tryAuth)
throws MessagingException {
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
* 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 {
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)
throws MessagingException {
DataSet dataset = new DataSet();
@ -1294,8 +1294,8 @@ public class WebDavStore extends Store {
uids[i] = messages[i].getUid();
}
String messageBody = "";
HashMap<String, String> headers = new HashMap<String, String>();
HashMap<String, String> uidToUrl = getMessageUrls(uids);
Map<String, String> headers = new HashMap<String, String>();
Map<String, String> uidToUrl = getMessageUrls(uids);
String[] urls = new String[uids.length];
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 {
String isRead;
int messageCount = 0;
HashMap<String, String> headers = new HashMap<String, String>();
Map<String, String> headers = new HashMap<String, String>();
String messageBody;
if (read) {
@ -1406,9 +1406,9 @@ public class WebDavStore extends Store {
@Override
public Message[] getMessages(int start, int end, Date earliestDate, MessageRetrievalListener listener)
throws MessagingException {
ArrayList<Message> messages = new ArrayList<Message>();
List<Message> messages = new ArrayList<Message>();
String[] uids;
HashMap<String, String> headers = new HashMap<String, String>();
Map<String, String> headers = new HashMap<String, String>();
int uidsLength = -1;
String messageBody;
@ -1434,7 +1434,7 @@ public class WebDavStore extends Store {
DataSet dataset = processRequest(this.mFolderUrl, "SEARCH", messageBody, headers);
uids = dataset.getUids();
HashMap<String, String> uidToUrl = dataset.getUidToUrl();
Map<String, String> uidToUrl = dataset.getUidToUrl();
uidsLength = uids.length;
for (int i = 0; i < uidsLength; i++) {
@ -1460,7 +1460,7 @@ public class WebDavStore extends Store {
@Override
public Message[] getMessages(String[] uids, MessageRetrievalListener listener) throws MessagingException {
ArrayList<Message> messageList = new ArrayList<Message>();
List<Message> messageList = new ArrayList<Message>();
Message[] messages;
if (uids == null ||
@ -1485,8 +1485,8 @@ public class WebDavStore extends Store {
return messages;
}
private HashMap<String, String> getMessageUrls(String[] uids) throws MessagingException {
HashMap<String, String> headers = new HashMap<String, String>();
private Map<String, String> getMessageUrls(String[] uids) throws MessagingException {
Map<String, String> headers = new HashMap<String, String>();
String messageBody;
/** Retrieve and parse the XML entity for our messages */
@ -1494,7 +1494,7 @@ public class WebDavStore extends Store {
headers.put("Brief", "t");
DataSet dataset = processRequest(this.mFolderUrl, "SEARCH", messageBody, headers);
HashMap<String, String> uidToUrl = dataset.getUidToUrl();
Map<String, String> uidToUrl = dataset.getUidToUrl();
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.
*/
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 = "";
Message[] messages = new Message[20];
String[] uids;
@ -1689,7 +1689,7 @@ public class WebDavStore extends Store {
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++) {
if (!(messages[i] instanceof WebDavMessage)) {
@ -1720,7 +1720,7 @@ public class WebDavStore extends Store {
*/
private void fetchEnvelope(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[] uids;
Message[] messages = new Message[10];
@ -1802,8 +1802,8 @@ public class WebDavStore extends Store {
private void markServerMessagesRead(String[] uids, boolean read) throws MessagingException {
String messageBody = "";
HashMap<String, String> headers = new HashMap<String, String>();
HashMap<String, String> uidToUrl = getMessageUrls(uids);
Map<String, String> headers = new HashMap<String, String>();
Map<String, String> uidToUrl = getMessageUrls(uids);
String[] urls = new String[uids.length];
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 {
HashMap<String, String> uidToUrl = getMessageUrls(uids);
Map<String, String> uidToUrl = getMessageUrls(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 destinationUrl = generateDeleteUrl(url);
@ -2005,7 +2005,7 @@ public class WebDavStore extends Store {
public void setNewHeaders(ParsedMessageEnvelope envelope) throws MessagingException {
String[] headers = envelope.getHeaderList();
HashMap<String, String> messageHeaders = envelope.getMessageHeaders();
Map<String, String> messageHeaders = envelope.getMessageHeaders();
for (String header : headers) {
String headerValue = messageHeaders.get(header);
@ -2107,8 +2107,8 @@ public class WebDavStore extends Store {
private boolean mReadStatus = false;
private String mUid = "";
private HashMap<String, String> mMessageHeaders = new HashMap<String, String>();
private ArrayList<String> mHeaders = new ArrayList<String>();
private Map<String, String> mMessageHeaders = new HashMap<String, String>();
private List<String> mHeaders = new ArrayList<String>();
public void addHeader(String field, String value) {
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;
}
@ -2151,9 +2151,9 @@ public class WebDavStore extends Store {
* depending on the accessor calls made.
*/
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 HashMap<String, String> mTempData = new HashMap<String, String>();
private Map<String, String> mTempData = new HashMap<String, String>();
public void addValue(String value, String tagName) {
if (tagName.equals("uid")) {
@ -2185,9 +2185,9 @@ public class WebDavStore extends Store {
/**
* 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
for (HashMap<String, String> folderMap : mData.values()) {
for (Map<String, String> folderMap : mData.values()) {
return folderMap;
}
return new HashMap<String, String>();
@ -2196,11 +2196,11 @@ public class WebDavStore extends Store {
/**
* Returns a hashmap of Message UID => Message Url
*/
public HashMap<String, String> getUidToUrl() {
HashMap<String, String> uidToUrl = new HashMap<String, String>();
public Map<String, String> getUidToUrl() {
Map<String, String> uidToUrl = new HashMap<String, String>();
for (String uid : mData.keySet()) {
HashMap<String, String> data = mData.get(uid);
Map<String, String> data = mData.get(uid);
String value = data.get("href");
if (value != null &&
!value.equals("")) {
@ -2214,11 +2214,11 @@ public class WebDavStore extends Store {
/**
* Returns a hashmap of Message UID => Read Status
*/
public HashMap<String, Boolean> getUidToRead() {
HashMap<String, Boolean> uidToRead = new HashMap<String, Boolean>();
public Map<String, Boolean> getUidToRead() {
Map<String, Boolean> uidToRead = new HashMap<String, Boolean>();
for (String uid : mData.keySet()) {
HashMap<String, String> data = mData.get(uid);
Map<String, String> data = mData.get(uid);
String readStatus = data.get("read");
if (readStatus != null && !readStatus.equals("")) {
Boolean value = !readStatus.equals("0");
@ -2238,10 +2238,10 @@ public class WebDavStore extends Store {
* Returns an array of all hrefs (urls) that were received
*/
public String[] getHrefs() {
ArrayList<String> hrefs = new ArrayList<String>();
List<String> hrefs = new ArrayList<String>();
for (String uid : mData.keySet()) {
HashMap<String, String> data = mData.get(uid);
Map<String, String> data = mData.get(uid);
String href = data.get("href");
hrefs.add(href);
}
@ -2253,7 +2253,7 @@ public class WebDavStore extends Store {
* Return an array of all Message UIDs that were received
*/
public String[] getUids() {
ArrayList<String> uids = new ArrayList<String>();
List<String> uids = new ArrayList<String>();
for (String uid : mData.keySet()) {
uids.add(uid);
@ -2274,7 +2274,7 @@ public class WebDavStore extends Store {
int messageCount = 0;
for (String uid : mData.keySet()) {
HashMap<String, String> data = mData.get(uid);
Map<String, String> data = mData.get(uid);
String count = data.get("visiblecount");
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() {
HashMap<String, ParsedMessageEnvelope> envelopes = new HashMap<String, ParsedMessageEnvelope>();
public Map<String, ParsedMessageEnvelope> getMessageEnvelopes() {
Map<String, ParsedMessageEnvelope> envelopes = new HashMap<String, ParsedMessageEnvelope>();
for (String uid : mData.keySet()) {
ParsedMessageEnvelope envelope = new ParsedMessageEnvelope();
HashMap<String, String> data = mData.get(uid);
Map<String, String> data = mData.get(uid);
if (data != null) {
for (Map.Entry<String, String> entry : data.entrySet()) {

View File

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

View File

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

View File

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

View File

@ -425,10 +425,10 @@ public class LocalStore extends Store implements Serializable {
});
}
public ArrayList<PendingCommand> getPendingCommands() throws UnavailableStorageException {
return database.execute(false, new DbCallback<ArrayList<PendingCommand>>() {
public List<PendingCommand> getPendingCommands() throws UnavailableStorageException {
return database.execute(false, new DbCallback<List<PendingCommand>>() {
@Override
public ArrayList<PendingCommand> doDbWork(final SQLiteDatabase db) throws WrappedException {
public List<PendingCommand> doDbWork(final SQLiteDatabase db) throws WrappedException {
Cursor cursor = null;
try {
cursor = db.query("pending_commands",
@ -438,7 +438,7 @@ public class LocalStore extends Store implements Serializable {
null,
null,
"id ASC");
ArrayList<PendingCommand> commands = new ArrayList<PendingCommand>();
List<PendingCommand> commands = new ArrayList<PendingCommand>();
while (cursor.moveToNext()) {
PendingCommand command = new PendingCommand();
command.mId = cursor.getLong(0);
@ -559,7 +559,7 @@ public class LocalStore extends Store implements Serializable {
final LocalFolder folder,
final String queryString, final String[] placeHolders
) 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>() {
@Override
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");
@ -419,7 +419,7 @@ public class SmtpTransport extends Transport {
* @param host
* 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
*
* @throws IOException
@ -427,8 +427,8 @@ public class SmtpTransport extends Transport {
* @throws MessagingException
* In case of a malformed response.
*/
private HashMap<String,String> sendHello(String host) throws IOException, MessagingException {
HashMap<String, String> extensions = new HashMap<String, String>();
private Map<String,String> sendHello(String host) throws IOException, MessagingException {
Map<String, String> extensions = new HashMap<String, String>();
try {
List<String> results = executeSimpleCommand("EHLO " + host);
// Remove the EHLO greeting response
@ -453,7 +453,7 @@ public class SmtpTransport extends Transport {
@Override
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.CC)));
@ -461,12 +461,12 @@ public class SmtpTransport extends Transport {
}
message.setRecipients(RecipientType.BCC, null);
HashMap<String, ArrayList<String>> charsetAddressesMap =
new HashMap<String, ArrayList<String>>();
Map<String, List<String>> charsetAddressesMap =
new HashMap<String, List<String>>();
for (Address address : addresses) {
String addressString = address.getAddress();
String charset = MimeUtility.getCharsetFromAddress(addressString);
ArrayList<String> addressesOfCharset = charsetAddressesMap.get(charset);
List<String> addressesOfCharset = charsetAddressesMap.get(charset);
if (addressesOfCharset == null) {
addressesOfCharset = new ArrayList<String>();
charsetAddressesMap.put(charset, addressesOfCharset);
@ -474,16 +474,16 @@ public class SmtpTransport extends Transport {
addressesOfCharset.add(addressString);
}
for (Map.Entry<String, ArrayList<String>> charsetAddressesMapEntry :
for (Map.Entry<String, List<String>> charsetAddressesMapEntry :
charsetAddressesMap.entrySet()) {
String charset = charsetAddressesMapEntry.getKey();
ArrayList<String> addressesOfCharset = charsetAddressesMapEntry.getValue();
List<String> addressesOfCharset = charsetAddressesMapEntry.getValue();
message.setCharset(charset);
sendMessageTo(addressesOfCharset, message);
}
}
private void sendMessageTo(ArrayList<String> addresses, Message message)
private void sendMessageTo(List<String> addresses, Message message)
throws MessagingException {
boolean possibleSend = false;

View File

@ -5,14 +5,15 @@ import com.fsck.k9.K9;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
public class Editor implements android.content.SharedPreferences.Editor {
private Storage storage;
private HashMap<String, String> changes = new HashMap<String, String>();
private ArrayList<String> removals = new ArrayList<String>();
private Map<String, String> changes = new HashMap<String, String>();
private List<String> removals = new ArrayList<String>();
private boolean removeAll = false;
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.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArrayList;
public class Storage implements SharedPreferences {
private static ConcurrentHashMap<Context, Storage> storages =
private static ConcurrentMap<Context, Storage> storages =
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 =
new CopyOnWriteArrayList<OnSharedPreferenceChangeListener>();
@ -32,11 +34,11 @@ public class Storage implements SharedPreferences {
private int DB_VERSION = 2;
private String DB_NAME = "preferences_storage";
private ThreadLocal<ConcurrentHashMap<String, String>> workingStorage
= new ThreadLocal<ConcurrentHashMap<String, String>>();
private ThreadLocal<ConcurrentMap<String, String>> workingStorage
= new ThreadLocal<ConcurrentMap<String, String>>();
private ThreadLocal<SQLiteDatabase> workingDB =
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;
@ -202,7 +204,7 @@ public class Storage implements SharedPreferences {
}
private void keyChange(String key) {
ArrayList<String> changedKeys = workingChangedKeys.get();
List<String> changedKeys = workingChangedKeys.get();
if (!changedKeys.contains(key)) {
changedKeys.add(key);
}
@ -259,14 +261,14 @@ public class Storage implements SharedPreferences {
}
protected void doInTransaction(Runnable dbWork) {
ConcurrentHashMap<String, String> newStorage = new ConcurrentHashMap<String, String>();
ConcurrentMap<String, String> newStorage = new ConcurrentHashMap<String, String>();
newStorage.putAll(storage);
workingStorage.set(newStorage);
SQLiteDatabase mDb = openDB();
workingDB.set(mDb);
ArrayList<String> changedKeys = new ArrayList<String>();
List<String> changedKeys = new ArrayList<String>();
workingChangedKeys.set(changedKeys);
mDb.beginTransaction();
@ -294,7 +296,11 @@ public class Storage implements SharedPreferences {
//@Override
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

View File

@ -256,7 +256,7 @@ public class ConditionsTreeNode implements Parcelable {
* @return List of all nodes in subtree in preorder.
*/
public List<ConditionsTreeNode> preorder() {
ArrayList<ConditionsTreeNode> result = new ArrayList<ConditionsTreeNode>();
List<ConditionsTreeNode> result = new ArrayList<ConditionsTreeNode>();
Stack<ConditionsTreeNode> stack = new Stack<ConditionsTreeNode>();
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.
*/
public List<String> getFolderNames() {
ArrayList<String> results = new ArrayList<String>();
List<String> results = new ArrayList<String>();
for (ConditionsTreeNode node : mLeafSet) {
if (node.mCondition.field == Searchfield.FOLDER &&
node.mCondition.attribute == Attribute.EQUALS) {

View File

@ -1,6 +1,7 @@
package com.fsck.k9.service;
import java.util.ArrayList;
import java.util.List;
import com.fsck.k9.Account;
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.MessageReference;
import com.fsck.k9.controller.MessagingController;
import com.fsck.k9.helper.Utility;
import com.fsck.k9.mail.Flag;
import com.fsck.k9.mail.Message;
@ -36,12 +38,12 @@ public class NotificationActionService extends CoreService {
}
public static PendingIntent getReadAllMessagesIntent(Context context, final Account account,
final ArrayList<MessageReference> refs) {
final List<MessageReference> refs) {
Intent i = new Intent(context, NotificationActionService.class);
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);
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,
final ArrayList<MessageReference> refs) {
final List<MessageReference> refs) {
Intent i = new Intent(context, NotificationActionService.class);
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);
return i;
@ -77,7 +79,7 @@ public class NotificationActionService extends CoreService {
if (K9.DEBUG)
Log.i(K9.LOG_TAG, "NotificationActionService marking messages as read");
ArrayList<MessageReference> refs =
List<MessageReference> refs =
intent.getParcelableArrayListExtra(EXTRA_MESSAGE_LIST);
for (MessageReference ref : refs) {
controller.setFlag(account, ref.folderName, ref.uid, Flag.SEEN, true);
@ -86,9 +88,9 @@ public class NotificationActionService extends CoreService {
if (K9.DEBUG)
Log.i(K9.LOG_TAG, "NotificationActionService deleting messages");
ArrayList<MessageReference> refs =
List<MessageReference> refs =
intent.getParcelableArrayListExtra(EXTRA_MESSAGE_LIST);
ArrayList<Message> messages = new ArrayList<Message>();
List<Message> messages = new ArrayList<Message>();
for (MessageReference ref : refs) {
Message m = ref.restoreToLocalMessage(this);
@ -121,7 +123,7 @@ public class NotificationActionService extends CoreService {
} else {
Log.w(K9.LOG_TAG, "Could not find account for notification action.");
}
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 java.util.HashMap;
import java.util.Map;
public class PollService extends CoreService {
private static String START_SERVICE = "com.fsck.k9.service.PollService.startService";
@ -77,7 +78,7 @@ public class PollService extends CoreService {
}
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 int startId = -1;

View File

@ -28,6 +28,7 @@ import android.webkit.WebView;
import android.widget.ScrollView;
import java.util.ArrayList;
import java.util.List;
/**
* 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.
*/
private final ArrayList<View> mChildrenNeedingAllTouches = new ArrayList<View>();
private final List<View> mChildrenNeedingAllTouches = new ArrayList<View>();
private boolean mSkipWebViewScroll = true;
@ -122,7 +123,7 @@ public class NonLockingScrollView extends ScrollView {
}
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 float x = ev.getX(actionIndex) + getScrollX();
final float y = ev.getY(actionIndex) + getScrollY();