1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-26 01:28:50 -05:00

Merge pull request #449 from dnet/cleanup20140215

This commit is contained in:
cketti 2014-02-17 20:03:30 +01:00
commit 1be9272b9b
25 changed files with 65 additions and 88 deletions

View File

@ -619,9 +619,9 @@ public class Account implements BaseAccount {
public static List<Integer> getExistingAccountNumbers(Preferences preferences) { public static List<Integer> getExistingAccountNumbers(Preferences preferences) {
Account[] accounts = preferences.getAccounts(); Account[] accounts = preferences.getAccounts();
List<Integer> accountNumbers = new LinkedList<Integer>(); List<Integer> accountNumbers = new ArrayList<Integer>(accounts.length);
for (int i = 0; i < accounts.length; i++) { for (Account a : accounts) {
accountNumbers.add(accounts[i].getAccountNumber()); accountNumbers.add(a.getAccountNumber());
} }
return accountNumbers; return accountNumbers;
} }

View File

@ -137,7 +137,7 @@ public abstract class AccountList extends K9ListActivity implements OnItemClickL
holder.email.setText(account.getEmail()); holder.email.setText(account.getEmail());
} }
if (description == null || description.length() == 0) { if (description == null || description.isEmpty()) {
description = account.getEmail(); description = account.getEmail();
} }

View File

@ -1735,7 +1735,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
} }
String description = account.getDescription(); String description = account.getDescription();
if (description == null || description.length() == 0) { if (description == null || description.isEmpty()) {
description = account.getEmail(); description = account.getEmail();
} }

View File

@ -59,7 +59,7 @@ public class ChooseIdentity extends K9ListActivity {
identities = mAccount.getIdentities(); identities = mAccount.getIdentities();
for (Identity identity : identities) { for (Identity identity : identities) {
String description = identity.getDescription(); String description = identity.getDescription();
if (description == null || description.trim().length() == 0) { if (description == null || description.trim().isEmpty()) {
description = getString(R.string.message_view_from_format, identity.getName(), identity.getEmail()); description = getString(R.string.message_view_from_format, identity.getName(), identity.getEmail());
} }
adapter.add(description); adapter.add(description);

View File

@ -40,7 +40,7 @@ public class LauncherShortcuts extends AccountList {
Intent intent = new Intent(); Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
String description = account.getDescription(); String description = account.getDescription();
if (description == null || description.length() == 0) { if (description == null || description.isEmpty()) {
description = account.getEmail(); description = account.getEmail();
} }
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, description); intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, description);

View File

@ -18,6 +18,7 @@ import android.os.Handler;
import android.os.Parcelable; import android.os.Parcelable;
import android.support.v4.app.LoaderManager; import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader; import android.support.v4.content.Loader;
import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.text.util.Rfc822Tokenizer; import android.text.util.Rfc822Tokenizer;
import android.util.AttributeSet; import android.util.AttributeSet;
@ -2776,12 +2777,9 @@ public class MessageCompose extends K9Activity implements OnClickListener,
if (message.getMessageId() != null && message.getMessageId().length() > 0) { if (message.getMessageId() != null && message.getMessageId().length() > 0) {
mInReplyTo = message.getMessageId(); mInReplyTo = message.getMessageId();
if (message.getReferences() != null && message.getReferences().length > 0) { String[] refs = message.getReferences();
StringBuilder buffy = new StringBuilder(); if (refs != null && refs.length > 0) {
for (int i = 0; i < message.getReferences().length; i++) mReferences = TextUtils.join("", refs) + " " + mInReplyTo;
buffy.append(message.getReferences()[i]);
mReferences = buffy.toString() + " " + mInReplyTo;
} else { } else {
mReferences = mInReplyTo; mReferences = mInReplyTo;
} }

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@ -168,7 +169,7 @@ public class Prefs extends K9PreferenceActivity {
List<CharSequence> entryVector = new ArrayList<CharSequence>(Arrays.asList(mLanguage.getEntries())); List<CharSequence> entryVector = new ArrayList<CharSequence>(Arrays.asList(mLanguage.getEntries()));
List<CharSequence> entryValueVector = new ArrayList<CharSequence>(Arrays.asList(mLanguage.getEntryValues())); List<CharSequence> entryValueVector = new ArrayList<CharSequence>(Arrays.asList(mLanguage.getEntryValues()));
String supportedLanguages[] = getResources().getStringArray(R.array.supported_languages); String supportedLanguages[] = getResources().getStringArray(R.array.supported_languages);
HashSet<String> supportedLanguageSet = new HashSet<String>(Arrays.asList(supportedLanguages)); Set<String> supportedLanguageSet = new HashSet<String>(Arrays.asList(supportedLanguages));
for (int i = entryVector.size() - 1; i > -1; --i) { for (int i = entryVector.size() - 1; i > -1; --i) {
if (!supportedLanguageSet.contains(entryValueVector.get(i))) { if (!supportedLanguageSet.contains(entryValueVector.get(i))) {
entryVector.remove(i); entryVector.remove(i);

View File

@ -616,11 +616,11 @@ public class MessagingController implements Runnable {
List <? extends Folder > remoteFolders = store.getPersonalNamespaces(false); List <? extends Folder > remoteFolders = store.getPersonalNamespaces(false);
LocalStore localStore = account.getLocalStore(); LocalStore localStore = account.getLocalStore();
HashSet<String> remoteFolderNames = new HashSet<String>(); Set<String> remoteFolderNames = new HashSet<String>();
List<LocalFolder> foldersToCreate = new LinkedList<LocalFolder>(); List<LocalFolder> foldersToCreate = new LinkedList<LocalFolder>();
localFolders = localStore.getPersonalNamespaces(false); localFolders = localStore.getPersonalNamespaces(false);
HashSet<String> localFolderNames = new HashSet<String>(); Set<String> localFolderNames = new HashSet<String>();
for (Folder localFolder : localFolders) { for (Folder localFolder : localFolders) {
localFolderNames.add(localFolder.getName()); localFolderNames.add(localFolder.getName());
} }
@ -693,7 +693,7 @@ public class MessagingController implements Runnable {
public void searchLocalMessagesSynchronous(final LocalSearch search, final MessagingListener listener) { public void searchLocalMessagesSynchronous(final LocalSearch search, final MessagingListener listener) {
final AccountStats stats = new AccountStats(); final AccountStats stats = new AccountStats();
final HashSet<String> uuidSet = new HashSet<String>(Arrays.asList(search.getAccountUuids())); final Set<String> uuidSet = new HashSet<String>(Arrays.asList(search.getAccountUuids()));
Account[] accounts = Preferences.getPreferences(mApplication.getApplicationContext()).getAccounts(); Account[] accounts = Preferences.getPreferences(mApplication.getApplicationContext()).getAccounts();
boolean allAccounts = uuidSet.contains(SearchSpecification.ALL_ACCOUNTS); boolean allAccounts = uuidSet.contains(SearchSpecification.ALL_ACCOUNTS);
@ -2344,14 +2344,10 @@ public class MessagingController implements Runnable {
/* /*
* This next part is used to bring the local UIDs of the local destination folder * This next part is used to bring the local UIDs of the local destination folder
* upto speed with the remote UIDs of remote destionation folder. * upto speed with the remote UIDs of remote destination folder.
*/ */
if (!localUidMap.isEmpty() && remoteUidMap != null && !remoteUidMap.isEmpty()) { if (!localUidMap.isEmpty() && remoteUidMap != null && !remoteUidMap.isEmpty()) {
Set<Map.Entry<String, String>> remoteSrcEntries = remoteUidMap.entrySet(); for (Map.Entry<String, String> entry : remoteUidMap.entrySet()) {
Iterator<Map.Entry<String, String>> remoteSrcEntriesIterator = remoteSrcEntries.iterator();
while (remoteSrcEntriesIterator.hasNext()) {
Map.Entry<String, String> entry = remoteSrcEntriesIterator.next();
String remoteSrcUid = entry.getKey(); String remoteSrcUid = entry.getKey();
String localDestUid = localUidMap.get(remoteSrcUid); String localDestUid = localUidMap.get(remoteSrcUid);
String newUid = entry.getValue(); String newUid = entry.getValue();

View File

@ -895,7 +895,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
long[] selected = new long[mSelected.size()]; long[] selected = new long[mSelected.size()];
int i = 0; int i = 0;
for (Long id : mSelected) { for (Long id : mSelected) {
selected[i++] = Long.valueOf(id); selected[i++] = id;
} }
outState.putLongArray(STATE_SELECTED_MESSAGES, selected); outState.putLongArray(STATE_SELECTED_MESSAGES, selected);
} }
@ -2667,8 +2667,9 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
outMessages.add(message); outMessages.add(message);
} }
for (String folderName : folderMap.keySet()) { for (Map.Entry<String, List<Message>> entry : folderMap.entrySet()) {
List<Message> outMessages = folderMap.get(folderName); String folderName = entry.getKey();
List<Message> outMessages = entry.getValue();
Account account = outMessages.get(0).getFolder().getAccount(); Account account = outMessages.get(0).getFolder().getAccount();
if (operation == FolderOperation.MOVE) { if (operation == FolderOperation.MOVE) {
@ -3461,12 +3462,13 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
return false; return false;
} }
boolean loadFinished = true; for (boolean cursorValid : mCursorValid) {
for (int i = 0; i < mCursorValid.length; i++) { if (!cursorValid) {
loadFinished &= mCursorValid[i]; return false;
}
} }
return loadFinished; return true;
} }
/** /**

View File

@ -57,7 +57,7 @@ public class DomainNameChecker {
*/ */
public static boolean match(X509Certificate certificate, String thisDomain) { public static boolean match(X509Certificate certificate, String thisDomain) {
if ((certificate == null) || (thisDomain == null) if ((certificate == null) || (thisDomain == null)
|| (thisDomain.length() == 0)) { || thisDomain.isEmpty()) {
return false; return false;
} }
@ -73,7 +73,7 @@ public class DomainNameChecker {
* @return True iff the domain name is specified as an IP address * @return True iff the domain name is specified as an IP address
*/ */
private static boolean isIpAddress(String domain) { private static boolean isIpAddress(String domain) {
if ((domain == null) || (domain.length() == 0)) { if ((domain == null) || domain.isEmpty()) {
return false; return false;
} }
@ -118,10 +118,9 @@ public class DomainNameChecker {
} }
try { try {
Collection<?> subjectAltNames = certificate.getSubjectAlternativeNames(); Collection<List<?>> subjectAltNames = certificate.getSubjectAlternativeNames();
if (subjectAltNames != null) { if (subjectAltNames != null) {
for (Object subjectAltName : subjectAltNames) { for (List<?> altNameEntry : subjectAltNames) {
List<?> altNameEntry = (List<?>)(subjectAltName);
if ((altNameEntry != null) && (2 <= altNameEntry.size())) { if ((altNameEntry != null) && (2 <= altNameEntry.size())) {
Integer altNameType = (Integer)(altNameEntry.get(0)); Integer altNameType = (Integer)(altNameEntry.get(0));
if (altNameType != null && altNameType.intValue() == ALT_IPA_NAME) { if (altNameType != null && altNameType.intValue() == ALT_IPA_NAME) {
@ -157,11 +156,9 @@ public class DomainNameChecker {
private static boolean matchDns(X509Certificate certificate, String thisDomain) { private static boolean matchDns(X509Certificate certificate, String thisDomain) {
boolean hasDns = false; boolean hasDns = false;
try { try {
Collection<?> subjectAltNames = certificate.getSubjectAlternativeNames(); Collection<List<?>> subjectAltNames = certificate.getSubjectAlternativeNames();
if (subjectAltNames != null) { if (subjectAltNames != null) {
Iterator<?> i = subjectAltNames.iterator(); for (List<?> altNameEntry : subjectAltNames) {
while (i.hasNext()) {
List<?> altNameEntry = (List<?>)(i.next());
if ((altNameEntry != null) && (2 <= altNameEntry.size())) { if ((altNameEntry != null) && (2 <= altNameEntry.size())) {
Integer altNameType = (Integer)(altNameEntry.get(0)); Integer altNameType = (Integer)(altNameEntry.get(0));
if (altNameType != null && altNameType.intValue() == ALT_DNS_NAME) { if (altNameType != null && altNameType.intValue() == ALT_DNS_NAME) {
@ -213,8 +210,8 @@ public class DomainNameChecker {
+ thatDomain); + thatDomain);
} }
if ((thisDomain == null) || (thisDomain.length() == 0) if ((thisDomain == null) || thisDomain.isEmpty()
|| (thatDomain == null) || (thatDomain.length() == 0)) { || (thatDomain == null) || thatDomain.isEmpty()) {
return false; return false;
} }

View File

@ -3,7 +3,7 @@ package com.fsck.k9.helper;
public final class StringUtils { public final class StringUtils {
public static boolean isNullOrEmpty(String string){ public static boolean isNullOrEmpty(String string){
return string == null || string.length() == 0; return string == null || string.isEmpty();
} }
public static boolean containsAny(String haystack, String[] needles) { public static boolean containsAny(String haystack, String[] needles) {

View File

@ -11,6 +11,7 @@ import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.text.Editable; import android.text.Editable;
import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
@ -99,18 +100,8 @@ public class Utility {
public static String combine(Object[] parts, char separator) { public static String combine(Object[] parts, char separator) {
if (parts == null) { if (parts == null) {
return null; return null;
} else if (parts.length == 0) {
return "";
} else if (parts.length == 1) {
return parts[0].toString();
} }
StringBuilder sb = new StringBuilder(); return TextUtils.join(String.valueOf(separator), parts);
sb.append(parts[0]);
for (int i = 1; i < parts.length; ++i) {
sb.append(separator);
sb.append(parts[i]);
}
return sb.toString();
} }
public static String base64Decode(String encoded) { public static String base64Decode(String encoded) {

View File

@ -14,6 +14,7 @@ import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
import android.text.TextUtils;
import android.text.util.Rfc822Token; import android.text.util.Rfc822Token;
import android.text.util.Rfc822Tokenizer; import android.text.util.Rfc822Tokenizer;
import android.util.Log; import android.util.Log;
@ -198,14 +199,7 @@ public class Address {
if (addresses == null) { if (addresses == null) {
return null; return null;
} }
StringBuilder sb = new StringBuilder(); return TextUtils.join(", ", addresses);
for (int i = 0; i < addresses.length; i++) {
sb.append(addresses[i].toString());
if (i < addresses.length - 1) {
sb.append(", ");
}
}
return sb.toString();
} }
public String toEncodedString() { public String toEncodedString() {

View File

@ -26,7 +26,7 @@ public abstract class Message implements Part, CompositeBody {
protected String mUid; protected String mUid;
protected HashSet<Flag> mFlags = new HashSet<Flag>(); protected Set<Flag> mFlags = new HashSet<Flag>();
protected Date mInternalDate; protected Date mInternalDate;

View File

@ -176,7 +176,7 @@ public class DecoderUtil {
return null; return null;
} }
if (encodedText.length() == 0) { if (encodedText.isEmpty()) {
Log.w(K9.LOG_TAG, "Missing encoded text in encoded word: '" + body.substring(begin, end) + "'"); Log.w(K9.LOG_TAG, "Missing encoded text in encoded word: '" + body.substring(begin, end) + "'");
return null; return null;
} }

View File

@ -130,8 +130,8 @@ public class EncoderUtil {
private static int qEncodedLength(byte[] bytes) { private static int qEncodedLength(byte[] bytes) {
int count = 0; int count = 0;
for (int idx = 0; idx < bytes.length; idx++) { for (byte b : bytes) {
int v = bytes[idx] & 0xff; int v = b & 0xff;
if (v == 32) { if (v == 32) {
count++; count++;
} else if (!Q_RESTRICTED_CHARS.get(v)) { } else if (!Q_RESTRICTED_CHARS.get(v)) {

View File

@ -1059,7 +1059,7 @@ public class MimeUtility {
in.read(buf, 0, buf.length); in.read(buf, 0, buf.length);
String str = new String(buf, "US-ASCII"); String str = new String(buf, "US-ASCII");
if (str.length() == 0) { if (str.isEmpty()) {
return ""; return "";
} }
Pattern p = Pattern.compile("<meta http-equiv=\"?Content-Type\"? content=\"text/html; charset=(.+?)\">", Pattern.CASE_INSENSITIVE); Pattern p = Pattern.compile("<meta http-equiv=\"?Content-Type\"? content=\"text/html; charset=(.+?)\">", Pattern.CASE_INSENSITIVE);
@ -3426,9 +3426,9 @@ public class MimeUtility {
BodyPart bodyPart = multipart.getBodyPart(i); BodyPart bodyPart = multipart.getBodyPart(i);
String bodyText = getTextFromPart(bodyPart); String bodyText = getTextFromPart(bodyPart);
if (bodyText != null) { if (bodyText != null) {
if (text.length() == 0 && bodyPart.isMimeType("text/plain")) { if (text.isEmpty() && bodyPart.isMimeType("text/plain")) {
text = bodyText; text = bodyText;
} else if (html.length() == 0 && bodyPart.isMimeType("text/html")) { } else if (html.isEmpty() && bodyPart.isMimeType("text/html")) {
html = bodyText; html = bodyText;
} }
} }

View File

@ -531,7 +531,7 @@ public class ImapStore extends Store {
return allFolders; return allFolders;
} else { } else {
List<Folder> resultFolders = new LinkedList<Folder>(); List<Folder> resultFolders = new LinkedList<Folder>();
HashSet<String> subscribedFolderNames = new HashSet<String>(); Set<String> subscribedFolderNames = new HashSet<String>();
List <? extends Folder > subscribedFolders = listFolders(connection, true); List <? extends Folder > subscribedFolders = listFolders(connection, true);
for (Folder subscribedFolder : subscribedFolders) { for (Folder subscribedFolder : subscribedFolders) {
subscribedFolderNames.add(subscribedFolder.getName()); subscribedFolderNames.add(subscribedFolder.getName());
@ -1476,11 +1476,10 @@ 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>(); HashMap<String, Message> messageMap = new HashMap<String, Message>();
for (int i = 0, count = messages.length; i < count; i++) { for (Message msg : messages) {
String uid = msg.getUid();
String uid = messages[i].getUid();
uids.add(uid); uids.add(uid);
messageMap.put(uid, messages[i]); messageMap.put(uid, msg);
} }
/* /*
@ -1489,7 +1488,7 @@ public class ImapStore extends Store {
* Envelope - UID FETCH ([FLAGS] INTERNALDATE UID RFC822.SIZE FLAGS BODY.PEEK[HEADER.FIELDS (date subject from content-type to cc)]) * Envelope - UID FETCH ([FLAGS] INTERNALDATE UID RFC822.SIZE FLAGS BODY.PEEK[HEADER.FIELDS (date subject from content-type to cc)])
* *
*/ */
LinkedHashSet<String> fetchFields = new LinkedHashSet<String>(); Set<String> fetchFields = new LinkedHashSet<String>();
fetchFields.add("UID"); fetchFields.add("UID");
if (fp.contains(FetchProfile.Item.FLAGS)) { if (fp.contains(FetchProfile.Item.FLAGS)) {
fetchFields.add("FLAGS"); fetchFields.add("FLAGS");

View File

@ -27,6 +27,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
public class Pop3Store extends Store { public class Pop3Store extends Store {
public static final String STORE_TYPE = "POP3"; public static final String STORE_TYPE = "POP3";
@ -628,7 +629,7 @@ public class Pop3Store extends Store {
private void indexUids(ArrayList<String> uids) private void indexUids(ArrayList<String> uids)
throws MessagingException, IOException { throws MessagingException, IOException {
HashSet<String> unindexedUids = new HashSet<String>(); Set<String> unindexedUids = new HashSet<String>();
for (String uid : uids) { for (String uid : uids) {
if (mUidToMsgMap.get(uid) == null) { if (mUidToMsgMap.get(uid) == null) {
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3) { if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3) {
@ -801,7 +802,7 @@ public class Pop3Store extends Store {
} }
} }
} else { } else {
HashSet<String> msgUidIndex = new HashSet<String>(); Set<String> msgUidIndex = new HashSet<String>();
for (Message message : messages) { for (Message message : messages) {
msgUidIndex.add(message.getUid()); msgUidIndex.add(message.getUid());
} }

View File

@ -560,7 +560,7 @@ public class StorageManager {
*/ */
public String getDefaultProviderId() { public String getDefaultProviderId() {
// assume there is at least 1 provider defined // assume there is at least 1 provider defined
return mProviders.entrySet().iterator().next().getKey(); return mProviders.keySet().iterator().next();
} }
/** /**

View File

@ -463,8 +463,7 @@ public class WebDavStore extends Store {
dataset = processRequest(this.mUrl, "SEARCH", getFolderListXml(), headers); dataset = processRequest(this.mUrl, "SEARCH", getFolderListXml(), headers);
String[] folderUrls = dataset.getHrefs(); String[] folderUrls = dataset.getHrefs();
for (int i = 0; i < folderUrls.length; i++) { for (String tempUrl : folderUrls) {
String tempUrl = folderUrls[i];
WebDavFolder folder = createFolder(tempUrl); WebDavFolder folder = createFolder(tempUrl);
if (folder != null) if (folder != null)
folderList.add(folder); folderList.add(folder);

View File

@ -183,7 +183,6 @@ public class SmtpTransport extends Transport {
} }
Account mAccount;
String mHost; String mHost;
int mPort; int mPort;
String mUsername; String mUsername;
@ -204,7 +203,6 @@ public class SmtpTransport extends Transport {
throw new MessagingException("Error while decoding transport URI", e); throw new MessagingException("Error while decoding transport URI", e);
} }
mAccount = account;
mHost = settings.host; mHost = settings.host;
mPort = settings.port; mPort = settings.port;

View File

@ -380,7 +380,7 @@ public class SettingsImporter {
// Mark account as disabled if the settings file didn't contain a password // Mark account as disabled if the settings file didn't contain a password
boolean createAccountDisabled = (incoming.password == null || boolean createAccountDisabled = (incoming.password == null ||
incoming.password.length() == 0); incoming.password.isEmpty());
if (account.outgoing == null && !WebDavStore.STORE_TYPE.equals(account.incoming.type)) { if (account.outgoing == null && !WebDavStore.STORE_TYPE.equals(account.incoming.type)) {
// All account types except WebDAV need to provide outgoing server settings // All account types except WebDAV need to provide outgoing server settings
@ -394,7 +394,7 @@ public class SettingsImporter {
putString(editor, accountKeyPrefix + Account.TRANSPORT_URI_KEY, Utility.base64Encode(transportUri)); putString(editor, accountKeyPrefix + Account.TRANSPORT_URI_KEY, Utility.base64Encode(transportUri));
// Mark account as disabled if the settings file didn't contain a password // Mark account as disabled if the settings file didn't contain a password
if (outgoing.password == null || outgoing.password.length() == 0) { if (outgoing.password == null || outgoing.password.isEmpty()) {
createAccountDisabled = true; createAccountDisabled = true;
} }
} }

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
import java.util.Set;
import android.database.Cursor; import android.database.Cursor;
import android.os.Parcel; import android.os.Parcel;
@ -243,8 +244,8 @@ public class ConditionsTreeNode implements Parcelable {
* Get a set of all the leaves in the tree. * Get a set of all the leaves in the tree.
* @return Set of all the leaves. * @return Set of all the leaves.
*/ */
public HashSet<ConditionsTreeNode> getLeafSet() { public Set<ConditionsTreeNode> getLeafSet() {
HashSet<ConditionsTreeNode> leafSet = new HashSet<ConditionsTreeNode>(); Set<ConditionsTreeNode> leafSet = new HashSet<ConditionsTreeNode>();
return getLeafSet(leafSet); return getLeafSet(leafSet);
} }
@ -338,7 +339,7 @@ public class ConditionsTreeNode implements Parcelable {
* @param leafSet Leafset that's being built. * @param leafSet Leafset that's being built.
* @return Set of leaves being completed. * @return Set of leaves being completed.
*/ */
private HashSet<ConditionsTreeNode> getLeafSet(HashSet<ConditionsTreeNode> leafSet) { private Set<ConditionsTreeNode> getLeafSet(Set<ConditionsTreeNode> leafSet) {
if (mLeft == null && mRight == null) { if (mLeft == null && mRight == null) {
// if we ended up in a leaf, add ourself and return // if we ended up in a leaf, add ourself and return
leafSet.add(this); leafSet.add(this);

View File

@ -28,9 +28,9 @@ public class LocalSearch implements SearchSpecification {
private boolean mManualSearch = false; private boolean mManualSearch = false;
// since the uuid isn't in the message table it's not in the tree neither // since the uuid isn't in the message table it's not in the tree neither
private HashSet<String> mAccountUuids = new HashSet<String>(); private Set<String> mAccountUuids = new HashSet<String>();
private ConditionsTreeNode mConditions = null; private ConditionsTreeNode mConditions = null;
private HashSet<ConditionsTreeNode> mLeafSet = new HashSet<ConditionsTreeNode>(); private Set<ConditionsTreeNode> mLeafSet = new HashSet<ConditionsTreeNode>();
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////