1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-25 09:08:49 -05:00
This commit is contained in:
Jesse Vincent 2010-12-01 06:32:29 +00:00
parent bf60129f83
commit f5eb6e03af
20 changed files with 142 additions and 83 deletions

View File

@ -81,7 +81,8 @@ public class FolderListFilter<T> extends Filter
final ArrayList<T> newValues = new ArrayList<T>(); final ArrayList<T> newValues = new ArrayList<T>();
for (final T value : values) { for (final T value : values)
{
final String valueText = value.toString().toLowerCase(); final String valueText = value.toString().toLowerCase();
for (int k = 0; k < wordCount; k++) for (int k = 0; k < wordCount; k++)

View File

@ -2090,7 +2090,8 @@ public class MessageView extends K9Activity implements OnClickListener
} }
} }
private Bitmap getPreviewIcon(Attachment attachment) { private Bitmap getPreviewIcon(Attachment attachment)
{
try try
{ {
return BitmapFactory.decodeStream( return BitmapFactory.decodeStream(

View File

@ -140,15 +140,21 @@ public class DomainNameChecker
Collection<?> subjectAltNames = certificate.getSubjectAlternativeNames(); Collection<?> subjectAltNames = certificate.getSubjectAlternativeNames();
if (subjectAltNames != null) if (subjectAltNames != null)
{ {
for (Object subjectAltName : subjectAltNames) { for (Object subjectAltName : subjectAltNames)
{
List<?> altNameEntry = (List<?>) (subjectAltName); 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) { if (altNameType != null)
if (altNameType == ALT_IPA_NAME) { {
if (altNameType == ALT_IPA_NAME)
{
String altName = (String) (altNameEntry.get(1)); String altName = (String) (altNameEntry.get(1));
if (altName != null) { if (altName != null)
if (K9.DEBUG) { {
if (K9.DEBUG)
{
Log.v(K9.LOG_TAG, "alternative IP: " + altName); Log.v(K9.LOG_TAG, "alternative IP: " + altName);
} }
if (thisDomain.equalsIgnoreCase(altName)) if (thisDomain.equalsIgnoreCase(altName))

View File

@ -14,39 +14,48 @@ public abstract class Multipart implements Body
protected String mContentType; protected String mContentType;
public void addBodyPart(BodyPart part) { public void addBodyPart(BodyPart part)
{
mParts.add(part); mParts.add(part);
} }
public void addBodyPart(BodyPart part, int index) { public void addBodyPart(BodyPart part, int index)
{
mParts.add(index, part); mParts.add(index, part);
} }
public BodyPart getBodyPart(int index) { public BodyPart getBodyPart(int index)
{
return mParts.get(index); return mParts.get(index);
} }
public String getContentType() { public String getContentType()
{
return mContentType; return mContentType;
} }
public int getCount() { public int getCount()
{
return mParts.size(); return mParts.size();
} }
public boolean removeBodyPart(BodyPart part) { public boolean removeBodyPart(BodyPart part)
{
return mParts.remove(part); return mParts.remove(part);
} }
public void removeBodyPart(int index) { public void removeBodyPart(int index)
{
mParts.remove(index); mParts.remove(index);
} }
public Part getParent() { public Part getParent()
{
return mParent; return mParent;
} }
public void setParent(Part parent) { public void setParent(Part parent)
{
this.mParent = parent; this.mParent = parent;
} }

View File

@ -538,8 +538,10 @@ public class Base64 implements BinaryEncoder, BinaryDecoder
*/ */
public static boolean isArrayByteBase64(byte[] arrayOctet) public static boolean isArrayByteBase64(byte[] arrayOctet)
{ {
for (byte anArrayOctet : arrayOctet) { for (byte anArrayOctet : arrayOctet)
if (!isBase64(anArrayOctet) && !isWhiteSpace(anArrayOctet)) { {
if (!isBase64(anArrayOctet) && !isWhiteSpace(anArrayOctet))
{
return false; return false;
} }
} }

View File

@ -24,7 +24,8 @@ public class BinaryTempFileBody implements Body
mTempDirectory = tempDirectory; mTempDirectory = tempDirectory;
} }
public BinaryTempFileBody() { public BinaryTempFileBody()
{
if (mTempDirectory == null) if (mTempDirectory == null)
{ {
throw new throw new

View File

@ -39,7 +39,8 @@ public class MimeBodyPart extends BodyPart
setBody(body); setBody(body);
} }
protected String getFirstHeader(String name) { protected String getFirstHeader(String name)
{
return mHeader.getFirstHeader(name); return mHeader.getFirstHeader(name);
} }
@ -63,7 +64,8 @@ public class MimeBodyPart extends BodyPart
mHeader.removeHeader(name); mHeader.removeHeader(name);
} }
public Body getBody() { public Body getBody()
{
return mBody; return mBody;
} }
@ -147,7 +149,8 @@ public class MimeBodyPart extends BodyPart
return getMimeType().equals(mimeType); return getMimeType().equals(mimeType);
} }
public int getSize() { public int getSize()
{
return mSize; return mSize;
} }

View File

@ -111,7 +111,8 @@ public class MimeHeader
mFields.removeAll(removeFields); mFields.removeAll(removeFields);
} }
public void writeTo(OutputStream out) throws IOException { public void writeTo(OutputStream out) throws IOException
{
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out), 1024); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out), 1024);
for (Field field : mFields) for (Field field : mFields)
{ {

View File

@ -121,7 +121,8 @@ public class MimeMessage extends Message
addSentDate(sentDate); addSentDate(sentDate);
} }
public void setInternalSentDate(Date sentDate) { public void setInternalSentDate(Date sentDate)
{
this.mSentDate = sentDate; this.mSentDate = sentDate;
} }
@ -160,7 +161,8 @@ public class MimeMessage extends Message
return MimeUtility.getHeaderParameter(getContentType(), null); return MimeUtility.getHeaderParameter(getContentType(), null);
} }
public int getSize() { public int getSize()
{
return mSize; return mSize;
} }
@ -253,7 +255,8 @@ public class MimeMessage extends Message
* Returns the unfolded, decoded value of the Subject header. * Returns the unfolded, decoded value of the Subject header.
*/ */
@Override @Override
public String getSubject() { public String getSubject()
{
return MimeUtility.unfoldAndDecode(getFirstHeader("Subject")); return MimeUtility.unfoldAndDecode(getFirstHeader("Subject"));
} }
@ -264,7 +267,8 @@ public class MimeMessage extends Message
} }
@Override @Override
public Address[] getFrom() { public Address[] getFrom()
{
if (mFrom == null) if (mFrom == null)
{ {
String list = MimeUtility.unfold(getFirstHeader("From")); String list = MimeUtility.unfold(getFirstHeader("From"));
@ -295,7 +299,8 @@ public class MimeMessage extends Message
} }
@Override @Override
public Address[] getReplyTo() { public Address[] getReplyTo()
{
if (mReplyTo == null) if (mReplyTo == null)
{ {
mReplyTo = Address.parse(MimeUtility.unfold(getFirstHeader("Reply-to"))); mReplyTo = Address.parse(MimeUtility.unfold(getFirstHeader("Reply-to")));
@ -405,7 +410,8 @@ public class MimeMessage extends Message
} }
@Override @Override
public Body getBody() { public Body getBody()
{
return mBody; return mBody;
} }

View File

@ -54,20 +54,24 @@ public class MimeMultipart extends Multipart
return sb.toString().toUpperCase(); return sb.toString().toUpperCase();
} }
public String getPreamble() { public String getPreamble()
{
return mPreamble; return mPreamble;
} }
public void setPreamble(String preamble) { public void setPreamble(String preamble)
{
this.mPreamble = preamble; this.mPreamble = preamble;
} }
@Override @Override
public String getContentType() { public String getContentType()
{
return mContentType; return mContentType;
} }
public void setSubType(String subType) { public void setSubType(String subType)
{
this.mSubType = subType; this.mSubType = subType;
mContentType = String.format("multipart/%s; boundary=\"%s\"", subType, mBoundary); mContentType = String.format("multipart/%s; boundary=\"%s\"", subType, mBoundary);
} }

View File

@ -216,7 +216,8 @@ public class ImapStore extends Store
} }
@Override @Override
public Folder getFolder(String name) { public Folder getFolder(String name)
{
ImapFolder folder; ImapFolder folder;
synchronized (mFolderCache) synchronized (mFolderCache)
{ {
@ -666,7 +667,8 @@ public class ImapStore extends Store
} }
@Override @Override
public OpenMode getMode() { public OpenMode getMode()
{
return mMode; return mMode;
} }
@ -1495,7 +1497,8 @@ public class ImapStore extends Store
} }
@Override @Override
public Flag[] getPermanentFlags() { public Flag[] getPermanentFlags()
{
return PERMANENT_FLAGS; return PERMANENT_FLAGS;
} }
@ -2012,7 +2015,8 @@ public class ImapStore extends Store
} }
} }
private MessagingException ioExceptionHandler(ImapConnection connection, IOException ioe) { private MessagingException ioExceptionHandler(ImapConnection connection, IOException ioe)
{
Log.e(K9.LOG_TAG, "IOException for " + getLogId(), ioe); Log.e(K9.LOG_TAG, "IOException for " + getLogId(), ioe);
if (connection != null) if (connection != null)
{ {
@ -2582,7 +2586,8 @@ public class ImapStore extends Store
return readResponse(null); return readResponse(null);
} }
private ImapResponse readResponse(ImapResponseParser.IImapResponseCallback callback) throws IOException { private ImapResponse readResponse(ImapResponseParser.IImapResponseCallback callback) throws IOException
{
try try
{ {
ImapResponse response = mParser.readResponse(callback); ImapResponse response = mParser.readResponse(callback);

View File

@ -945,7 +945,8 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
} }
@Override @Override
public LocalFolder getFolder(String name) { public LocalFolder getFolder(String name)
{
return new LocalFolder(name); return new LocalFolder(name);
} }
@ -1802,7 +1803,8 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
} }
@Override @Override
public OpenMode getMode() { public OpenMode getMode()
{
return OpenMode.READ_WRITE; return OpenMode.READ_WRITE;
} }
@ -3568,7 +3570,8 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
} }
@Override @Override
public Flag[] getPermanentFlags() { public Flag[] getPermanentFlags()
{
return PERMANENT_FLAGS; return PERMANENT_FLAGS;
} }
@ -5887,7 +5890,8 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
super(body); super(body);
} }
public LocalTextBody(String body, String bodyForDisplay) { public LocalTextBody(String body, String bodyForDisplay)
{
super(body); super(body);
this.mBodyForDisplay = bodyForDisplay; this.mBodyForDisplay = bodyForDisplay;
} }
@ -5925,7 +5929,8 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
{ {
} }
LocalMessage(String uid, Folder folder) { LocalMessage(String uid, Folder folder)
{
this.mUid = uid; this.mUid = uid;
this.mFolder = folder; this.mFolder = folder;
} }
@ -6337,7 +6342,8 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
} }
} }
private void updateFolderCountsOnFlag(Flag flag, boolean set) { private void updateFolderCountsOnFlag(Flag flag, boolean set)
{
/* /*
* Update the unread count on the folder. * Update the unread count on the folder.
*/ */

View File

@ -147,7 +147,8 @@ public class Pop3Store extends Store
} }
@Override @Override
public Folder getFolder(String name) { public Folder getFolder(String name)
{
Folder folder = mFolders.get(name); Folder folder = mFolders.get(name);
if (folder == null) if (folder == null)
{ {
@ -329,7 +330,8 @@ public class Pop3Store extends Store
} }
@Override @Override
public OpenMode getMode() { public OpenMode getMode()
{
return OpenMode.READ_WRITE; return OpenMode.READ_WRITE;
} }
@ -861,7 +863,8 @@ public class Pop3Store extends Store
} }
@Override @Override
public Flag[] getPermanentFlags() { public Flag[] getPermanentFlags()
{
return PERMANENT_FLAGS; return PERMANENT_FLAGS;
} }
@ -982,7 +985,8 @@ public class Pop3Store extends Store
mOut.flush(); mOut.flush();
} }
private Pop3Capabilities getCapabilities() throws IOException { private Pop3Capabilities getCapabilities() throws IOException
{
Pop3Capabilities capabilities = new Pop3Capabilities(); Pop3Capabilities capabilities = new Pop3Capabilities();
try try
{ {
@ -1099,7 +1103,8 @@ public class Pop3Store extends Store
class Pop3Message extends MimeMessage class Pop3Message extends MimeMessage
{ {
public Pop3Message(String uid, Pop3Folder folder) { public Pop3Message(String uid, Pop3Folder folder)
{
mUid = uid; mUid = uid;
mFolder = folder; mFolder = folder;
mSize = -1; mSize = -1;

View File

@ -550,7 +550,8 @@ public class StorageManager
* @return Whether the specified file matches a filesystem root. * @return Whether the specified file matches a filesystem root.
* @throws IOException * @throws IOException
*/ */
public static boolean isMountPoint(final File file) { public static boolean isMountPoint(final File file)
{
for (final File root : File.listRoots()) for (final File root : File.listRoots())
{ {
if (root.equals(file)) if (root.equals(file))

View File

@ -349,7 +349,8 @@ public class WebDavStore extends Store
} }
@Override @Override
public Folder getFolder(String name) { public Folder getFolder(String name)
{
WebDavFolder folder; WebDavFolder folder;
if ((folder = this.mFolderList.get(name)) == null) if ((folder = this.mFolderList.get(name)) == null)
@ -1272,7 +1273,8 @@ public class WebDavStore extends Store
} }
@Override @Override
public OpenMode getMode() { public OpenMode getMode()
{
return OpenMode.READ_WRITE; return OpenMode.READ_WRITE;
} }
@ -1746,7 +1748,8 @@ public class WebDavStore extends Store
} }
@Override @Override
public Flag[] getPermanentFlags() { public Flag[] getPermanentFlags()
{
return PERMANENT_FLAGS; return PERMANENT_FLAGS;
} }
@ -1943,7 +1946,8 @@ public class WebDavStore extends Store
private String mUrl = ""; private String mUrl = "";
WebDavMessage(String uid, Folder folder) { WebDavMessage(String uid, Folder folder)
{
this.mUid = uid; this.mUid = uid;
this.mFolder = folder; this.mFolder = folder;
} }

View File

@ -72,7 +72,8 @@ public class Editor implements android.content.SharedPreferences.Editor
} }
} }
public void commitChanges() { public void commitChanges()
{
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
Log.i(K9.LOG_TAG, "Committing preference changes"); Log.i(K9.LOG_TAG, "Committing preference changes");
Runnable committer = new Runnable() Runnable committer = new Runnable()

View File

@ -982,7 +982,8 @@ public class MessageProvider extends ContentProvider
K9.registerApplicationAware(new K9.ApplicationAware() K9.registerApplicationAware(new K9.ApplicationAware()
{ {
@Override @Override
public void initializeComponent(final K9 application) { public void initializeComponent(final K9 application)
{
Log.v(K9.LOG_TAG, "Registering content resolver notifier"); Log.v(K9.LOG_TAG, "Registering content resolver notifier");
MessagingController.getInstance(application).addListener(new MessagingListener() MessagingController.getInstance(application).addListener(new MessagingListener()

View File

@ -43,8 +43,10 @@ public class AccessibleEmailContentActivity extends ListActivity
String[] rawListItems = parsedHtml.toString().split("\n"); String[] rawListItems = parsedHtml.toString().split("\n");
ArrayList<String> cleanedList = new ArrayList<String>(); ArrayList<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);
} }
} }