From 0aa513429a2b92a64edbfdf76bb368bd4c7a5306 Mon Sep 17 00:00:00 2001 From: cketti Date: Sat, 31 Dec 2011 02:22:31 +0100 Subject: [PATCH 01/20] Show/hide ListView footer depending on message list type Fixes issue 3946 --- src/com/fsck/k9/activity/MessageList.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index 79db3a7ef..204108c92 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -729,6 +729,9 @@ public class MessageList mCurrentFolder = mAdapter.getFolder(mFolderName, mAccount); } + // Hide "Load up to x more" footer for search views + mFooterView.setVisibility((mQueryString != null) ? View.GONE : View.VISIBLE); + mController = MessagingController.getInstance(getApplication()); mListView.setAdapter(mAdapter); } @@ -2382,9 +2385,6 @@ public class MessageList private View getFooterView(ViewGroup parent) { if (mFooterView == null) { mFooterView = mInflater.inflate(R.layout.message_list_item_footer, parent, false); - if (mQueryString != null) { - mFooterView.setVisibility(View.GONE); - } mFooterView.setId(R.layout.message_list_item_footer); FooterViewHolder holder = new FooterViewHolder(); holder.progress = (ProgressBar) mFooterView.findViewById(R.id.message_list_progress); From 097223601e63bb2f5eb401143c0301e06dd748ff Mon Sep 17 00:00:00 2001 From: cketti Date: Sat, 31 Dec 2011 02:43:08 +0100 Subject: [PATCH 02/20] Updated .classpath because ADT 14+ insists on changing the output folder --- .classpath | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.classpath b/.classpath index 779e2a6be..323d9666c 100644 --- a/.classpath +++ b/.classpath @@ -9,5 +9,5 @@ - + From ff08fdcdf5697755411e7a205e1d5900f560b14e Mon Sep 17 00:00:00 2001 From: cketti Date: Sat, 31 Dec 2011 02:50:00 +0100 Subject: [PATCH 03/20] Updated danish translation (provided by mittaa) --- res/values-da/strings.xml | 50 +++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/res/values-da/strings.xml b/res/values-da/strings.xml index a2b1bdd50..2848f173e 100644 --- a/res/values-da/strings.xml +++ b/res/values-da/strings.xml @@ -40,8 +40,8 @@ \u0020(Behandler %s:%s%s) \u0020%s/%s - \u0020(Næste synk @ %s) - \u0020(Synk deaktiveret) + \u0020(Næste synkronisering @ %s) + \u0020(synkronisering deaktiveret) Næste @@ -118,7 +118,7 @@ Dump indstillinger Tøm papirkurv Ryd helt - Fjern lokalt lagrede meddelelser + Fjern lokalt lagrede mails Vælg sortering Omvendt sortering Om @@ -321,10 +321,10 @@ Velkommen til K-9 Mail opsætning. K-9 er en open source mail klient for Androi Checkbokse for multible valg Vis altid checkbokse for multible valg Touch venlig visning - Rummeligere listning med forhåndsvisning - Linier med forhåndsvisning + Rummeligere listning i forhåndsvisning + Linier i forhåndsvisning Vis afsenders navne - Vis afsenders navne fremfor deres mailaddresser + Vis afsendernavn fremfor deres mailaddresse Vis kontaktnavne Benyt afsendernavne fra eksisterende kontakter Farvelæg kontakter @@ -333,7 +333,7 @@ Velkommen til K-9 Mail opsætning. K-9 er en open source mail klient for Androi Tegnsæt med fast bredde Benyt tegnsæt med fast bredde til visning af mails med ren tekst - Returner til liste efter sletning + Retur til liste efter sletning Returner til mailliste efter sletning af mail Vis næste mail efter sletning Vis som standard næste mail efter sletning af mail @@ -370,7 +370,7 @@ Velkommen til K-9 Mail opsætning. K-9 er en open source mail klient for Androi Kontrollerer indstillinger for indgående server\u2026 Kontrollerer indstillinger for udgående server\u2026 Autentiserer\u2026 - Henter konto indstillinger\u2026 + Henter kontoindstillinger\u2026 Afslutter\u2026 Afbryder\u2026 @@ -472,7 +472,7 @@ Velkommen til K-9 Mail opsætning. K-9 er en open source mail klient for Androi Komprimer Ryd mails (farligt!) - Genskab data (Sidste udvej!) + Genskab data (sidste udvej!) Frekvens for hentning af mail @@ -542,7 +542,7 @@ Velkommen til K-9 Mail opsætning. K-9 er en open source mail klient for Androi Vis besked for mails sendt af mig Klik på besked, viser ulæste mails Søger efter ulæste mails når besked vises - Vis antallet af ulæste mails + Vis antal ulæste mails Vis antallet af ulæste mails i statusbar. Scroll navigations knapper @@ -554,7 +554,7 @@ Velkommen til K-9 Mail opsætning. K-9 er en open source mail klient for Androi Vis Arkiver, Flyt og Spam knapper. Scroll Flyt knapper - Vis altid billeder automatisk + Vis altid billeder Aldrig Kun når afsender findes i Kontakter Fra alle @@ -562,10 +562,10 @@ Velkommen til K-9 Mail opsætning. K-9 er en open source mail klient for Androi Skriv mail Medtag den originale meddelelse i svar - Når du sender svar på mail, vil den oprindelige tekst blive medtaget. + Når du sender svar på mail, vil den oprindelige tekst blive medtaget Svar placeres efter citeret tekst - Når du sender svar på mail, vil den oprindelige tekst blive placeret oven over dit svar. + Når du sender svar på mail, vil den oprindelige tekst blive placeret oven over dit svar Fjern signatur fra citeret svar Når du sender svar på mail, vil evt. signatur i citeret tekst blive fjernet @@ -721,7 +721,7 @@ Velkommen til K-9 Mail opsætning. K-9 er en open source mail klient for Androi Standardindstilling for afsender, Bcc og signatur Håndter identiteter - Opsæt alternativ \'Fra\' addresse og signatur + Opsæt alternativ afsender-addresse og signatur Håndter identiteter @@ -792,10 +792,10 @@ Velkommen til K-9 Mail opsætning. K-9 er en open source mail klient for Androi Kontoen \"%s\" vil blive fjernet fra K-9 Mail. Nulstil konto - Alle mails, vedhæftede filer, mapper og mappe-indstillinger for \"%s\" vil blive fjernet fra K-9 Mail, men konto indstillinger vil blive husket. + Alle mails, vedhæftede filer, mapper og mappe-indstillinger for \"%s\" vil blive fjernet fra K-9 Mail, men kontoindstillinger vil blive husket. Rens konto - Alle mails i \"%s\" vil blive fjernet, men konto indstillinger vil blive husket. + Alle mails i \"%s\" vil blive fjernet, men kontoindstillinger vil blive husket. Kun visse \"Plus\" konti tillader adgang via POP som er nødvendig for at kunne tilgå konto. Hvis du ikke kan logge ind på trods af @@ -827,7 +827,7 @@ Velkommen til K-9 Mail opsætning. K-9 er en open source mail klient for Androi 3 - Vis alle pånær sekundære mapper\u000A 4 - Vis alle mapper\u000A Q - Returner til Konti\u000A - S - Rediger konto indstillinger + S - Rediger kontoindstillinger Mapper Vis alle mapper @@ -862,8 +862,8 @@ Velkommen til K-9 Mail opsætning. K-9 er en open source mail klient for Androi Baggrundssynkronisering Aldrig Altid - Når \'Baggrundsdata\' er aktiveret - Når \'Baggrundsdata\' & \'Auto-sync\' er aktiveret + Når \"Baggrundsdata\" er aktiveret + Når \"Baggrundsdata\" & \"Auto-sync\" er aktiveret Ingen mail valgt @@ -908,14 +908,14 @@ Velkommen til K-9 Mail opsætning. K-9 er en open source mail klient for Androi Benyt gesture kontrol Kompakt layout - Juster layouts så der vises mere på hver side + Juster layout så der vises mere på hver side Volume-knap navigation Skift mellem valg vha. volume-knapper Mail-visning Diverse listevisninger - Håndter \"Tilbageknappen\" + Håndter \"Tilbageknap\" \"Tilbageknap\" går altid et niveau op Start i fælles indbakke @@ -928,7 +928,7 @@ Velkommen til K-9 Mail opsætning. K-9 er en open source mail klient for Androi Deaktiver for hurtigere visning Skjul specialkonti - Skjul fælles indbakke og alle mailkonti + Skjul fælles indbakke og fælles mailkonti %s %s - Stjernemarkerede @@ -972,7 +972,7 @@ Velkommen til K-9 Mail opsætning. K-9 er en open source mail klient for Androi Meddelelse Afsender - Modtagere(Til) + Modtagere (Til) Modtagere (Cc) Yderligere headers Emne @@ -1058,8 +1058,8 @@ Velkommen til K-9 Mail opsætning. K-9 er en open source mail klient for Androi Kunne ikke opnå forbindelse. Import & eksport af indstillinger - Eksport konto indstillinger - Eksport indstillinger og konti + Eksporter kontoindstillinger + Eksporter indstillinger og konti Importer Eksporter Importer indstillinger From daeedc2222668827487a2c92470bccc57f7edf83 Mon Sep 17 00:00:00 2001 From: edpeur Date: Sat, 31 Dec 2011 17:38:41 +0000 Subject: [PATCH 04/20] Close resources properly --- src/com/fsck/k9/helper/Utility.java | 20 ++++++++++------ .../k9/mail/internet/BinaryTempFileBody.java | 7 ++++-- .../fsck/k9/mail/internet/MimeUtility.java | 7 ++++-- src/com/fsck/k9/mail/store/LocalStore.java | 23 +++++++++++++------ .../fsck/k9/provider/AttachmentProvider.java | 9 +++++--- 5 files changed, 45 insertions(+), 21 deletions(-) diff --git a/src/com/fsck/k9/helper/Utility.java b/src/com/fsck/k9/helper/Utility.java index 1c87e31fa..910989ef2 100644 --- a/src/com/fsck/k9/helper/Utility.java +++ b/src/com/fsck/k9/helper/Utility.java @@ -500,14 +500,20 @@ public class Utility { try { FileInputStream in = new FileInputStream(from); - FileOutputStream out = new FileOutputStream(to); - byte[] buffer = new byte[1024]; - int count = -1; - while ((count = in.read(buffer)) > 0) { - out.write(buffer, 0, count); + try { + FileOutputStream out = new FileOutputStream(to); + try { + byte[] buffer = new byte[1024]; + int count = -1; + while ((count = in.read(buffer)) > 0) { + out.write(buffer, 0, count); + } + } finally { + out.close(); + } + } finally { + try { in.close(); } catch (Throwable ignore) {} } - out.close(); - in.close(); from.delete(); return true; } catch (Exception e) { diff --git a/src/com/fsck/k9/mail/internet/BinaryTempFileBody.java b/src/com/fsck/k9/mail/internet/BinaryTempFileBody.java index 4ee161cbc..154776ca1 100644 --- a/src/com/fsck/k9/mail/internet/BinaryTempFileBody.java +++ b/src/com/fsck/k9/mail/internet/BinaryTempFileBody.java @@ -46,8 +46,11 @@ public class BinaryTempFileBody implements Body { public void writeTo(OutputStream out) throws IOException, MessagingException { InputStream in = getInputStream(); Base64OutputStream base64Out = new Base64OutputStream(out); - IOUtils.copy(in, base64Out); - base64Out.close(); + try { + IOUtils.copy(in, base64Out); + } finally { + base64Out.close(); + } mFile.delete(); } diff --git a/src/com/fsck/k9/mail/internet/MimeUtility.java b/src/com/fsck/k9/mail/internet/MimeUtility.java index 33ec8f7f5..d8ad792b2 100644 --- a/src/com/fsck/k9/mail/internet/MimeUtility.java +++ b/src/com/fsck/k9/mail/internet/MimeUtility.java @@ -1092,8 +1092,11 @@ public class MimeUtility { BinaryTempFileBody tempBody = new BinaryTempFileBody(); OutputStream out = tempBody.getOutputStream(); - IOUtils.copy(in, out); - out.close(); + try { + IOUtils.copy(in, out); + } finally { + out.close(); + } return tempBody; } diff --git a/src/com/fsck/k9/mail/store/LocalStore.java b/src/com/fsck/k9/mail/store/LocalStore.java index e7b0def3b..13b4c816e 100644 --- a/src/com/fsck/k9/mail/store/LocalStore.java +++ b/src/com/fsck/k9/mail/store/LocalStore.java @@ -2357,11 +2357,17 @@ public class LocalStore extends Store implements Serializable { * so we copy the data into a cached attachment file. */ InputStream in = attachment.getBody().getInputStream(); - tempAttachmentFile = File.createTempFile("att", null, attachmentDirectory); - FileOutputStream out = new FileOutputStream(tempAttachmentFile); - size = IOUtils.copy(in, out); - in.close(); - out.close(); + try { + tempAttachmentFile = File.createTempFile("att", null, attachmentDirectory); + FileOutputStream out = new FileOutputStream(tempAttachmentFile); + try { + size = IOUtils.copy(in, out); + } finally { + out.close(); + } + } finally { + try { in.close(); } catch (Throwable ignore) {} + } } } @@ -3357,8 +3363,11 @@ public class LocalStore extends Store implements Serializable { public void writeTo(OutputStream out) throws IOException, MessagingException { InputStream in = getInputStream(); Base64OutputStream base64Out = new Base64OutputStream(out); - IOUtils.copy(in, base64Out); - base64Out.close(); + try { + IOUtils.copy(in, base64Out); + } finally { + base64Out.close(); + } } public Uri getContentUri() { diff --git a/src/com/fsck/k9/provider/AttachmentProvider.java b/src/com/fsck/k9/provider/AttachmentProvider.java index 3b5360a21..542beab00 100644 --- a/src/com/fsck/k9/provider/AttachmentProvider.java +++ b/src/com/fsck/k9/provider/AttachmentProvider.java @@ -180,11 +180,14 @@ public class AttachmentProvider extends ContentProvider { if (thumbnail != null) { thumbnail = Bitmap.createScaledBitmap(thumbnail, width, height, true); FileOutputStream out = new FileOutputStream(file); - thumbnail.compress(Bitmap.CompressFormat.PNG, 100, out); - out.close(); + try { + thumbnail.compress(Bitmap.CompressFormat.PNG, 100, out); + } finally { + out.close(); + } } } finally { - in.close(); + try { in.close(); } catch (Throwable ignore) {} } } catch (IOException ioe) { return null; From 71174417ce26c3ca42d683a13fa345bb0150a25d Mon Sep 17 00:00:00 2001 From: cketti Date: Wed, 4 Jan 2012 02:27:51 +0100 Subject: [PATCH 05/20] Clone Message object to avoid ConcurrentModificationExceptions Fixes issue 3953 --- src/com/fsck/k9/activity/MessageView.java | 20 +++++++++-- src/com/fsck/k9/mail/Message.java | 28 +++++++++++++++ src/com/fsck/k9/mail/internet/MimeHeader.java | 13 +++++-- .../fsck/k9/mail/internet/MimeMessage.java | 34 +++++++++++++++++++ src/com/fsck/k9/mail/store/LocalStore.java | 19 +++++++++++ 5 files changed, 110 insertions(+), 4 deletions(-) diff --git a/src/com/fsck/k9/activity/MessageView.java b/src/com/fsck/k9/activity/MessageView.java index c93ca83b5..5e1f912dd 100644 --- a/src/com/fsck/k9/activity/MessageView.java +++ b/src/com/fsck/k9/activity/MessageView.java @@ -1123,12 +1123,28 @@ public class MessageView extends K9Activity implements OnClickListener { return; } MessageView.this.mMessage = message; + + /* + * Clone the message object because the original could be modified by + * MessagingController later. This could lead to a ConcurrentModificationException + * when that same object is accessed by the UI thread (below). + * + * See issue 3953 + * + * This is just an ugly hack to get rid of the most pressing problem. A proper way to + * fix this is to make Message thread-safe. Or, even better, rewriting the UI code to + * access messages via a ContentProvider. + * + */ + final Message clonedMessage = message.clone(); + runOnUiThread(new Runnable() { public void run() { - if (!message.isSet(Flag.X_DOWNLOADED_FULL) && !message.isSet(Flag.X_DOWNLOADED_PARTIAL)) { + if (!clonedMessage.isSet(Flag.X_DOWNLOADED_FULL) && + !clonedMessage.isSet(Flag.X_DOWNLOADED_PARTIAL)) { mMessageView.loadBodyFromUrl("file:///android_asset/downloading.html"); } - mMessageView.setHeaders(message, account); + mMessageView.setHeaders(clonedMessage, account); mMessageView.setOnFlagListener(new OnClickListener() { @Override public void onClick(View v) { diff --git a/src/com/fsck/k9/mail/Message.java b/src/com/fsck/k9/mail/Message.java index 1afa5ba91..2a7cd5efd 100644 --- a/src/com/fsck/k9/mail/Message.java +++ b/src/com/fsck/k9/mail/Message.java @@ -224,4 +224,32 @@ public abstract class Message implements Part, Body { return 0; } + /** + * Copy the contents of this object into another {@code Message} object. + * + * @param destination + * The {@code Message} object to receive the contents of this instance. + */ + protected void copy(Message destination) { + destination.mUid = mUid; + destination.mInternalDate = mInternalDate; + destination.mFolder = mFolder; + destination.mReference = mReference; + + // mFlags contents can change during the object lifetime, so copy the Set + destination.mFlags = new HashSet(mFlags); + } + + /** + * Creates a new {@code Message} object with the same content as this object. + * + *

+ * Note: + * This method was introduced as a hack to prevent {@code ConcurrentModificationException}s. It + * shouldn't be used unless absolutely necessary. See the comment in + * {@link com.fsck.k9.activity.MessageView.Listener#loadMessageForViewHeadersAvailable(com.fsck.k9.Account, String, String, Message)} + * for more information. + *

+ */ + public abstract Message clone(); } diff --git a/src/com/fsck/k9/mail/internet/MimeHeader.java b/src/com/fsck/k9/mail/internet/MimeHeader.java index 20002feb3..2b87416da 100644 --- a/src/com/fsck/k9/mail/internet/MimeHeader.java +++ b/src/com/fsck/k9/mail/internet/MimeHeader.java @@ -133,9 +133,9 @@ public class MimeHeader { } static class Field { - String name; + final String name; - String value; + final String value; public Field(String name, String value) { this.name = name; @@ -153,4 +153,13 @@ public class MimeHeader { public void setCharset(String charset) { mCharset = charset; } + + public MimeHeader clone() { + MimeHeader header = new MimeHeader(); + header.mCharset = mCharset; + + header.mFields = new ArrayList(mFields); + + return header; + } } diff --git a/src/com/fsck/k9/mail/internet/MimeMessage.java b/src/com/fsck/k9/mail/internet/MimeMessage.java index 92f7b5b4e..0ac949524 100644 --- a/src/com/fsck/k9/mail/internet/MimeMessage.java +++ b/src/com/fsck/k9/mail/internet/MimeMessage.java @@ -553,4 +553,38 @@ public class MimeMessage extends Message { throw new UnsupportedOperationException("Not supported"); } } + + /** + * Copy the contents of this object into another {@code MimeMessage} object. + * + * @param message + * The {@code MimeMessage} object to receive the contents of this instance. + */ + protected void copy(MimeMessage message) { + super.copy(message); + + message.mHeader = mHeader.clone(); + + message.mBody = mBody; + message.mMessageId = mMessageId; + message.mSentDate = mSentDate; + message.mDateFormat = mDateFormat; + message.mSize = mSize; + + // These arrays are not supposed to be modified, so it's okay to reuse the references + message.mFrom = mFrom; + message.mTo = mTo; + message.mCc = mCc; + message.mBcc = mBcc; + message.mReplyTo = mReplyTo; + message.mReferences = mReferences; + message.mInReplyTo = mInReplyTo; + } + + @Override + public MimeMessage clone() { + MimeMessage message = new MimeMessage(); + copy(message); + return message; + } } diff --git a/src/com/fsck/k9/mail/store/LocalStore.java b/src/com/fsck/k9/mail/store/LocalStore.java index 13b4c816e..fbcfafa21 100644 --- a/src/com/fsck/k9/mail/store/LocalStore.java +++ b/src/com/fsck/k9/mail/store/LocalStore.java @@ -3310,6 +3310,25 @@ public class LocalStore extends Store implements Serializable { loadHeaders(); return super.getHeaderNames(); } + + @Override + public LocalMessage clone() { + LocalMessage message = new LocalMessage(); + super.copy(message); + + message.mId = mId; + message.mAttachmentCount = mAttachmentCount; + message.mSubject = mSubject; + message.mPreview = mPreview; + message.mToMeCalculated = mToMeCalculated; + message.mCcMeCalculated = mCcMeCalculated; + message.mToMe = mToMe; + message.mCcMe = mCcMe; + message.mHeadersLoaded = mHeadersLoaded; + message.mMessageDirty = mMessageDirty; + + return message; + } } public static class LocalAttachmentBodyPart extends MimeBodyPart { From fec6434f08279030e59985915cb1d26ee5c5b37f Mon Sep 17 00:00:00 2001 From: cketti Date: Wed, 4 Jan 2012 00:52:48 +0100 Subject: [PATCH 06/20] Removed unused code --- src/com/fsck/k9/activity/MessageView.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/com/fsck/k9/activity/MessageView.java b/src/com/fsck/k9/activity/MessageView.java index 5e1f912dd..fb6afcc60 100644 --- a/src/com/fsck/k9/activity/MessageView.java +++ b/src/com/fsck/k9/activity/MessageView.java @@ -305,16 +305,6 @@ public class MessageView extends K9Activity implements OnClickListener { public void fetchingAttachment() { showToast(getString(R.string.message_view_fetching_attachment_toast), Toast.LENGTH_SHORT); } - - - public void setHeaders(final Message message, final Account account) { - runOnUiThread(new Runnable() { - public void run() { - mMessageView.setHeaders(message, account); - } - }); - } - } public static void actionView(Context context, MessageReference messRef, From 81f0cb510a5dfbf7d6d9c9a086a5a4dab3cf519c Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Tue, 3 Jan 2012 20:34:19 -0800 Subject: [PATCH 07/20] Remove unused date formatter. --- src/com/fsck/k9/activity/K9Activity.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/com/fsck/k9/activity/K9Activity.java b/src/com/fsck/k9/activity/K9Activity.java index 263324671..3bb76c480 100644 --- a/src/com/fsck/k9/activity/K9Activity.java +++ b/src/com/fsck/k9/activity/K9Activity.java @@ -15,7 +15,6 @@ import android.view.animation.AccelerateInterpolator; import android.view.animation.Animation; import android.view.animation.TranslateAnimation; import com.fsck.k9.K9; -import com.fsck.k9.helper.DateFormatter; import com.fsck.k9.view.ToggleScrollView; @@ -70,12 +69,9 @@ public class K9Activity extends Activity { setupFormats(); } - private java.text.DateFormat mDateFormat; private java.text.DateFormat mTimeFormat; private void setupFormats() { - - mDateFormat = DateFormatter.getDateFormat(this); mTimeFormat = android.text.format.DateFormat.getTimeFormat(this); // 12/24 date format } @@ -83,10 +79,6 @@ public class K9Activity extends Activity { return mTimeFormat; } - public java.text.DateFormat getDateFormat() { - return mDateFormat; - } - /** * Called when a swipe from right to left is handled by {@link MyGestureDetector}. See * {@link android.view.GestureDetector.OnGestureListener#onFling(android.view.MotionEvent, android.view.MotionEvent, float, float)} From fc5ea05e48495a21a7ef2043a15ea4c3354b9dec Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Tue, 3 Jan 2012 20:32:05 -0800 Subject: [PATCH 08/20] Issue 3875: Add more debugging lines to figure out what might be wrong with the new swipe algorithm. Fix some variable names. --- src/com/fsck/k9/activity/K9Activity.java | 42 ++++++++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/src/com/fsck/k9/activity/K9Activity.java b/src/com/fsck/k9/activity/K9Activity.java index 3bb76c480..1f45d5fb1 100644 --- a/src/com/fsck/k9/activity/K9Activity.java +++ b/src/com/fsck/k9/activity/K9Activity.java @@ -7,6 +7,7 @@ import android.app.Activity; import android.content.Context; import android.content.res.Configuration; import android.os.Bundle; +import android.util.Log; import android.view.GestureDetector; import android.view.GestureDetector.SimpleOnGestureListener; import android.view.MotionEvent; @@ -164,21 +165,48 @@ public class K9Activity extends Activity { public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { // Do fling-detection if gestures are force-enabled or we have system-wide gestures enabled. if (gesturesEnabled || K9.gesturesEnabled()) { - // Convert the dips to pixels + // Calculate the minimum distance required for this to count as a swipe. + // Convert the constant dips to pixels. final float mGestureScale = getResources().getDisplayMetrics().density; - int min_distance = (int)(SWIPE_MIN_DISTANCE_DIP * mGestureScale + 0.5f); - int min_velocity = (int)(SWIPE_THRESHOLD_VELOCITY_DIP * mGestureScale + 0.5f); - int max_off_path = (int)(SWIPE_MAX_OFF_PATH_DIP * mGestureScale + 0.5f); + final int minDistance = (int)(SWIPE_MIN_DISTANCE_DIP * mGestureScale + 0.5f); + final int minVelocity = (int)(SWIPE_THRESHOLD_VELOCITY_DIP * mGestureScale + 0.5f); + final int maxOffPath = (int)(SWIPE_MAX_OFF_PATH_DIP * mGestureScale + 0.5f); + + // Calculate how much was actually swiped. + final float deltaX = e2.getX() - e1.getX(); + final float deltaY = e2.getY() - e1.getY(); + final boolean movedAcross = (Math.abs(deltaX) > Math.abs(deltaY * 4)); + final boolean steadyHand = (Math.abs(deltaX / deltaY) > 2); + if(K9.DEBUG) { + Log.d(K9.LOG_TAG, "Old swipe algorithm: movedAcross=" + movedAcross + " steadyHand=" + steadyHand + " result=" + (movedAcross && steadyHand)); + Log.d(K9.LOG_TAG, String.format("New swipe algorithm: deltaX=%.2f deltaY=%.2f velocity=%.2f (min=%d)", deltaX, deltaY, velocityX, minVelocity)); + } try { - if (Math.abs(e1.getY() - e2.getY()) > max_off_path) + if (Math.abs(deltaY) > maxOffPath) { + if(K9.DEBUG) + Log.d(K9.LOG_TAG, "New swipe algorithm: Swipe too far off horizontal path."); return false; + } + if(Math.abs(velocityX) < minVelocity) { + if(K9.DEBUG) + Log.d(K9.LOG_TAG, "New swipe algorithm: Swipe too slow."); + return false; + } // right to left swipe - if (e1.getX() - e2.getX() > min_distance && Math.abs(velocityX) > min_velocity) { + if (deltaX < minDistance) { onSwipeRightToLeft(e1, e2); - } else if (e2.getX() - e1.getX() > min_distance && Math.abs(velocityX) > min_velocity) { + if(K9.DEBUG) + Log.d(K9.LOG_TAG, "New swipe algorithm: Right to Left swipe OK."); + } else if (deltaX > minDistance) { onSwipeLeftToRight(e1, e2); + if(K9.DEBUG) + Log.d(K9.LOG_TAG, "New swipe algorithm: Left to Right swipe OK."); + } else { + if(K9.DEBUG) + Log.d(K9.LOG_TAG, "New swipe algorithm: Swipe did not meet minimum distance requirements."); + return false; } } catch (Exception e) { // nothing From 11ebc1b262dfd435d264c91c4264503bec53f525 Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Tue, 3 Jan 2012 21:19:33 -0800 Subject: [PATCH 09/20] Issue 3875: Add a bit more debug data for swiping. --- src/com/fsck/k9/activity/K9Activity.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/fsck/k9/activity/K9Activity.java b/src/com/fsck/k9/activity/K9Activity.java index 1f45d5fb1..25ad80867 100644 --- a/src/com/fsck/k9/activity/K9Activity.java +++ b/src/com/fsck/k9/activity/K9Activity.java @@ -180,7 +180,8 @@ public class K9Activity extends Activity { final boolean steadyHand = (Math.abs(deltaX / deltaY) > 2); if(K9.DEBUG) { Log.d(K9.LOG_TAG, "Old swipe algorithm: movedAcross=" + movedAcross + " steadyHand=" + steadyHand + " result=" + (movedAcross && steadyHand)); - Log.d(K9.LOG_TAG, String.format("New swipe algorithm: deltaX=%.2f deltaY=%.2f velocity=%.2f (min=%d)", deltaX, deltaY, velocityX, minVelocity)); + final int oldMin = (int)Math.abs(deltaY * 4); + Log.d(K9.LOG_TAG, String.format("New swipe algorithm: deltaX=%.2f deltaY=%.2f velocity=%.2f (min=%d, oldMin=%d)", deltaX, deltaY, velocityX, minVelocity, oldMin)); } try { From 93ecf86806a84e02bfc05ed098444ba8473636b1 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Wed, 4 Jan 2012 00:21:51 -0500 Subject: [PATCH 10/20] Bumped manifest to 4.104 --- AndroidManifest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index ffc9e98df..142b098c8 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ Date: Tue, 3 Jan 2012 21:56:20 -0800 Subject: [PATCH 11/20] Issue 3875: Revert to the old way of determining minimum swipe distance. Fix my logic bug when determining left to right vs. right to left. --- src/com/fsck/k9/activity/K9Activity.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/com/fsck/k9/activity/K9Activity.java b/src/com/fsck/k9/activity/K9Activity.java index 25ad80867..4cbca5b09 100644 --- a/src/com/fsck/k9/activity/K9Activity.java +++ b/src/com/fsck/k9/activity/K9Activity.java @@ -141,7 +141,6 @@ public class K9Activity extends Activity { this.gesturesEnabled = gesturesEnabled; } - private static final float SWIPE_MIN_DISTANCE_DIP = 130.0f; private static final float SWIPE_MAX_OFF_PATH_DIP = 250f; private static final float SWIPE_THRESHOLD_VELOCITY_DIP = 325f; @@ -168,20 +167,21 @@ public class K9Activity extends Activity { // Calculate the minimum distance required for this to count as a swipe. // Convert the constant dips to pixels. final float mGestureScale = getResources().getDisplayMetrics().density; - final int minDistance = (int)(SWIPE_MIN_DISTANCE_DIP * mGestureScale + 0.5f); final int minVelocity = (int)(SWIPE_THRESHOLD_VELOCITY_DIP * mGestureScale + 0.5f); final int maxOffPath = (int)(SWIPE_MAX_OFF_PATH_DIP * mGestureScale + 0.5f); // Calculate how much was actually swiped. final float deltaX = e2.getX() - e1.getX(); final float deltaY = e2.getY() - e1.getY(); + + // Calculate the minimum distance required for this to be considered a swipe. + final int minDistance = (int)Math.abs(deltaY * 4); - final boolean movedAcross = (Math.abs(deltaX) > Math.abs(deltaY * 4)); - final boolean steadyHand = (Math.abs(deltaX / deltaY) > 2); if(K9.DEBUG) { - Log.d(K9.LOG_TAG, "Old swipe algorithm: movedAcross=" + movedAcross + " steadyHand=" + steadyHand + " result=" + (movedAcross && steadyHand)); - final int oldMin = (int)Math.abs(deltaY * 4); - Log.d(K9.LOG_TAG, String.format("New swipe algorithm: deltaX=%.2f deltaY=%.2f velocity=%.2f (min=%d, oldMin=%d)", deltaX, deltaY, velocityX, minVelocity, oldMin)); + final boolean movedAcross = (Math.abs(deltaX) > Math.abs(deltaY * 4)); + final boolean steadyHand = (Math.abs(deltaX / deltaY) > 2); + Log.d(K9.LOG_TAG, String.format("Old swipe algorithm: movedAcross=%s steadyHand=%s result=%s", movedAcross, steadyHand, movedAcross && steadyHand)); + Log.d(K9.LOG_TAG, String.format("New swipe algorithm: deltaX=%.2f deltaY=%.2f minDistance=%d velocity=%.2f (min=%d)", deltaX, deltaY, minDistance, velocityX, minVelocity)); } try { @@ -196,7 +196,7 @@ public class K9Activity extends Activity { return false; } // right to left swipe - if (deltaX < minDistance) { + if (deltaX < (minDistance * -1)) { onSwipeRightToLeft(e1, e2); if(K9.DEBUG) Log.d(K9.LOG_TAG, "New swipe algorithm: Right to Left swipe OK."); From d848b434f5e1d0b0e4102cf561afa97793b35399 Mon Sep 17 00:00:00 2001 From: cketti Date: Thu, 5 Jan 2012 03:53:23 +0100 Subject: [PATCH 12/20] Fall back to HELO command if the server doesn't know EHLO (SMTP) Fixes issue 2704 --- .../fsck/k9/mail/transport/SmtpTransport.java | 97 ++++++++++++++++--- 1 file changed, 84 insertions(+), 13 deletions(-) diff --git a/src/com/fsck/k9/mail/transport/SmtpTransport.java b/src/com/fsck/k9/mail/transport/SmtpTransport.java index 3840d362f..2ad4fa38e 100644 --- a/src/com/fsck/k9/mail/transport/SmtpTransport.java +++ b/src/com/fsck/k9/mail/transport/SmtpTransport.java @@ -288,20 +288,11 @@ public class SmtpTransport extends Transport { } } - List results = executeSimpleCommand("EHLO " + localHost); + List results = sendHello(localHost); m8bitEncodingAllowed = results.contains("8BITMIME"); - - /* - * TODO may need to add code to fall back to HELO I switched it from - * using HELO on non STARTTLS connections because of AOL's mail - * server. It won't let you use AUTH without EHLO. - * We should really be paying more attention to the capabilities - * and only attempting auth if it's available, and warning the user - * if not. - */ if (mConnectionSecurity == CONNECTION_SECURITY_TLS_OPTIONAL || mConnectionSecurity == CONNECTION_SECURITY_TLS_REQUIRED) { if (results.contains("STARTTLS")) { @@ -322,7 +313,7 @@ public class SmtpTransport extends Transport { * Now resend the EHLO. Required by RFC2487 Sec. 5.2, and more specifically, * Exim. */ - results = executeSimpleCommand("EHLO " + localHost); + results = sendHello(localHost); } else if (mConnectionSecurity == CONNECTION_SECURITY_TLS_REQUIRED) { throw new MessagingException("TLS not supported but required"); } @@ -408,6 +399,46 @@ public class SmtpTransport extends Transport { } } + /** + * Send the client "identity" using the EHLO or HELO command. + * + *

+ * We first try the EHLO command. If the server sends a negative response, it probably doesn't + * support the EHLO command. So we try the older HELO command that all servers need to support. + * And if that fails, too, we pretend everything is fine and continue unimpressed. + *

+ * + * @param host + * The EHLO/HELO parameter as defined by the RFC. + * + * @return The list of capabilities as returned by the EHLO command or an empty list. + * + * @throws IOException + * In case of a network error. + * @throws MessagingException + * In case of a malformed response. + */ + private List sendHello(String host) throws IOException, MessagingException { + try { + //TODO: We currently assume the extension keywords returned by the server are always + // uppercased. But the RFC allows mixed-case keywords! + + return executeSimpleCommand("EHLO " + host); + } catch (NegativeSmtpReplyException e) { + if (K9.DEBUG) { + Log.v(K9.LOG_TAG, "Server doesn't support the EHLO command. Trying HELO..."); + } + + try { + executeSimpleCommand("HELO " + host); + } catch (NegativeSmtpReplyException e2) { + Log.w(K9.LOG_TAG, "Server doesn't support the HELO command. Continuing anyway."); + } + } + + return new ArrayList(0); + } + @Override public void sendMessage(Message message) throws MessagingException { ArrayList
addresses = new ArrayList
(); @@ -570,12 +601,28 @@ public class SmtpTransport extends Transport { } private void checkLine(String line) throws MessagingException { - if (line.length() < 1) { + int length = line.length(); + if (length < 1) { throw new MessagingException("SMTP response is 0 length"); } + char c = line.charAt(0); if ((c == '4') || (c == '5')) { - throw new MessagingException(line); + int replyCode = -1; + String message = line; + if (length >= 3) { + try { + replyCode = Integer.parseInt(line.substring(0, 3)); + } catch (NumberFormatException e) { /* ignore */ } + + if (length > 4) { + message = line.substring(4); + } else { + message = ""; + } + } + + throw new NegativeSmtpReplyException(replyCode, message); } } @@ -680,4 +727,28 @@ public class SmtpTransport extends Transport { throw new AuthenticationFailedException("Unable to negotiate MD5 CRAM"); } } + + /** + * Exception that is thrown when the server sends a negative reply (reply codes 4xx or 5xx). + */ + static class NegativeSmtpReplyException extends MessagingException { + private static final long serialVersionUID = 8696043577357897135L; + + private final int mReplyCode; + private final String mReplyText; + + public NegativeSmtpReplyException(int replyCode, String replyText) { + super("Negative SMTP reply: " + replyCode + " " + replyText); + mReplyCode = replyCode; + mReplyText = replyText; + } + + public int getReplyCode() { + return mReplyCode; + } + + public String getReplyText() { + return mReplyText; + } + } } From 926406edd3e155bd9bf9273631aa0d7ff629b671 Mon Sep 17 00:00:00 2001 From: cketti Date: Thu, 5 Jan 2012 19:22:35 +0100 Subject: [PATCH 13/20] Be more careful when deleting an account Fixes issue 3954 --- src/com/fsck/k9/Account.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/com/fsck/k9/Account.java b/src/com/fsck/k9/Account.java index c1fc7a482..3d49694b6 100644 --- a/src/com/fsck/k9/Account.java +++ b/src/com/fsck/k9/Account.java @@ -18,6 +18,7 @@ import com.fsck.k9.mail.store.StorageManager; import com.fsck.k9.mail.store.StorageManager.StorageProvider; import com.fsck.k9.view.ColorChip; +import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; @@ -415,18 +416,24 @@ public class Account implements BaseAccount { } protected synchronized void delete(Preferences preferences) { + // Get the list of account UUIDs String[] uuids = preferences.getPreferences().getString("accountUuids", "").split(","); - String[] newUuids = new String[uuids.length - 1]; - int i = 0; + + // Create a list of all account UUIDs excluding this account + List newUuids = new ArrayList(uuids.length); for (String uuid : uuids) { - if (uuid.equals(mUuid) == false) { - newUuids[i++] = uuid; + if (!uuid.equals(mUuid)) { + newUuids.add(uuid); } } - String accountUuids = Utility.combine(newUuids, ','); SharedPreferences.Editor editor = preferences.getPreferences().edit(); - editor.putString("accountUuids", accountUuids); + + // Only change the 'accountUuids' value if this account's UUID was listed before + if (newUuids.size() < uuids.length) { + String accountUuids = Utility.combine(newUuids.toArray(), ','); + editor.putString("accountUuids", accountUuids); + } editor.remove(mUuid + ".storeUri"); editor.remove(mUuid + ".localStoreUri"); From 06175888b9a160361ec0dc2e3d82729d47029c86 Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Thu, 5 Jan 2012 12:25:24 -0800 Subject: [PATCH 14/20] Enable system zoom and disable gestures by default. --- src/com/fsck/k9/K9.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/fsck/k9/K9.java b/src/com/fsck/k9/K9.java index 4ced5af40..d48c79334 100644 --- a/src/com/fsck/k9/K9.java +++ b/src/com/fsck/k9/K9.java @@ -535,7 +535,7 @@ public class K9 extends Application { DEBUG = sprefs.getBoolean("enableDebugLogging", false); DEBUG_SENSITIVE = sprefs.getBoolean("enableSensitiveLogging", false); mAnimations = sprefs.getBoolean("animations", true); - mGesturesEnabled = sprefs.getBoolean("gesturesEnabled", true); + mGesturesEnabled = sprefs.getBoolean("gesturesEnabled", false); mUseVolumeKeysForNavigation = sprefs.getBoolean("useVolumeKeysForNavigation", false); mUseVolumeKeysForListNavigation = sprefs.getBoolean("useVolumeKeysForListNavigation", false); mManageBack = sprefs.getBoolean("manageBack", false); @@ -549,7 +549,7 @@ public class K9 extends Application { mMessageListPreviewLines = sprefs.getInt("messageListPreviewLines", 2); mMobileOptimizedLayout = sprefs.getBoolean("mobileOptimizedLayout", false); - mZoomControlsEnabled = sprefs.getBoolean("zoomControlsEnabled", false); + mZoomControlsEnabled = sprefs.getBoolean("zoomControlsEnabled", true); mQuietTimeEnabled = sprefs.getBoolean("quietTimeEnabled", false); mQuietTimeStarts = sprefs.getString("quietTimeStarts", "21:00"); From 7e8aede93da826af6656bdae73dd6f50a591f295 Mon Sep 17 00:00:00 2001 From: cketti Date: Fri, 6 Jan 2012 01:36:32 +0100 Subject: [PATCH 15/20] Updated settings description with new default values (import/export) --- src/com/fsck/k9/preferences/GlobalSettings.java | 6 ++++-- src/com/fsck/k9/preferences/Settings.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/com/fsck/k9/preferences/GlobalSettings.java b/src/com/fsck/k9/preferences/GlobalSettings.java index 5dcae70bb..96254d0d9 100644 --- a/src/com/fsck/k9/preferences/GlobalSettings.java +++ b/src/com/fsck/k9/preferences/GlobalSettings.java @@ -114,7 +114,8 @@ public class GlobalSettings { new V(1, new FontSizeSetting(FontSizes.FONT_12DIP)) )); s.put("gesturesEnabled", Settings.versions( - new V(1, new BooleanSetting(true)) + new V(1, new BooleanSetting(true)), + new V(4, new BooleanSetting(false)) )); s.put("hideSpecialAccounts", Settings.versions( new V(1, new BooleanSetting(false)) @@ -189,7 +190,8 @@ public class GlobalSettings { new V(1, new BooleanSetting(false)) )); s.put("zoomControlsEnabled", Settings.versions( - new V(1, new BooleanSetting(false)) + new V(1, new BooleanSetting(false)), + new V(4, new BooleanSetting(true)) )); SETTINGS = Collections.unmodifiableMap(s); diff --git a/src/com/fsck/k9/preferences/Settings.java b/src/com/fsck/k9/preferences/Settings.java index 207c63464..7cc1e701c 100644 --- a/src/com/fsck/k9/preferences/Settings.java +++ b/src/com/fsck/k9/preferences/Settings.java @@ -34,7 +34,7 @@ public class Settings { * * @see SettingsExporter */ - public static final int VERSION = 3; + public static final int VERSION = 4; public static Map validate(int version, Map> settings, From beda7beac7936f7978284f40d8e5cb7a6f16e493 Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Thu, 5 Jan 2012 18:41:42 -0800 Subject: [PATCH 16/20] Use a constant for 18 hours. --- src/com/fsck/k9/helper/Utility.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/fsck/k9/helper/Utility.java b/src/com/fsck/k9/helper/Utility.java index 910989ef2..340bfabe1 100644 --- a/src/com/fsck/k9/helper/Utility.java +++ b/src/com/fsck/k9/helper/Utility.java @@ -186,6 +186,7 @@ public class Utility { } } + private static final long MILISECONDS_IN_18_HOURS = 18 * 60 * 60 * 1000; /** * Returns true if the specified date is within 18 hours of "now". Returns false otherwise. * @param date @@ -193,7 +194,7 @@ public class Utility { */ public static boolean isDateToday(Date date) { Date now = new Date(); - if (now.getTime() - 64800000 > date.getTime() || now.getTime() + 64800000 < date.getTime()) { + if (now.getTime() - MILISECONDS_IN_18_HOURS > date.getTime() || now.getTime() + MILISECONDS_IN_18_HOURS < date.getTime()) { return false; } else { return true; From 3d9f9c4ab4fb41301cf0cd4e15265df38baca3af Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Fri, 6 Jan 2012 20:12:40 -0500 Subject: [PATCH 17/20] Don't save account settings until after we save the updated push settings. --- src/com/fsck/k9/activity/setup/AccountSettings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/fsck/k9/activity/setup/AccountSettings.java b/src/com/fsck/k9/activity/setup/AccountSettings.java index 152e86f73..28bd3be23 100644 --- a/src/com/fsck/k9/activity/setup/AccountSettings.java +++ b/src/com/fsck/k9/activity/setup/AccountSettings.java @@ -784,7 +784,6 @@ public class AccountSettings extends K9PreferenceActivity { mAccount.setScrollMessageViewButtons(Account.ScrollButtons.valueOf(mAccountScrollButtons.getValue())); mAccount.setShowPictures(Account.ShowPictures.valueOf(mAccountShowPictures.getValue())); - mAccount.save(Preferences.getPreferences(this)); if (mIsPushCapable) { boolean needsPushRestart = mAccount.setFolderPushMode(Account.FolderMode.valueOf(mPushMode.getValue())); @@ -802,6 +801,7 @@ public class AccountSettings extends K9PreferenceActivity { } } // TODO: refresh folder list here + mAccount.save(Preferences.getPreferences(this)); } @Override From ec78c1e009cfc8a96a2399899c5ea03a76fff01e Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Fri, 6 Jan 2012 20:27:10 -0500 Subject: [PATCH 18/20] Save settings changes "on pause" rather than "on back" so we actually save settings when a user hits home or menu or whatever. --- src/com/fsck/k9/activity/setup/AccountSettings.java | 4 ++-- src/com/fsck/k9/activity/setup/FolderSettings.java | 4 ++-- src/com/fsck/k9/activity/setup/Prefs.java | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/com/fsck/k9/activity/setup/AccountSettings.java b/src/com/fsck/k9/activity/setup/AccountSettings.java index 28bd3be23..17ef87327 100644 --- a/src/com/fsck/k9/activity/setup/AccountSettings.java +++ b/src/com/fsck/k9/activity/setup/AccountSettings.java @@ -817,9 +817,9 @@ public class AccountSettings extends K9PreferenceActivity { } @Override - public void onBackPressed() { + protected void onPause() { saveSettings(); - super.onBackPressed(); + super.onPause(); } private void onCompositionSettings() { diff --git a/src/com/fsck/k9/activity/setup/FolderSettings.java b/src/com/fsck/k9/activity/setup/FolderSettings.java index de0b1f072..2d7c67234 100644 --- a/src/com/fsck/k9/activity/setup/FolderSettings.java +++ b/src/com/fsck/k9/activity/setup/FolderSettings.java @@ -145,13 +145,13 @@ public class FolderSettings extends K9PreferenceActivity { } @Override - public void onBackPressed() { + public void onPause() { try { saveSettings(); } catch (MessagingException e) { Log.e(K9.LOG_TAG, "Saving folder settings failed", e); } - super.onBackPressed(); + super.onPause(); } } diff --git a/src/com/fsck/k9/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java index 7a436c65e..1b359b808 100644 --- a/src/com/fsck/k9/activity/setup/Prefs.java +++ b/src/com/fsck/k9/activity/setup/Prefs.java @@ -403,9 +403,13 @@ public class Prefs extends K9PreferenceActivity { } @Override - public void onBackPressed() { + protected void onPause() { saveSettings(); + super.onPause(); + } + @Override + public void onBackPressed() { if (K9.manageBack()) { Accounts.listAccounts(this); finish(); From ffa77ad28861ac5c0017cae4ec2e7e41dfc2cbb8 Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Sat, 7 Jan 2012 09:27:21 -0800 Subject: [PATCH 19/20] Commit a new default in IntelliJ IDE settings added by IntelliJ 11. --- k9mail.iml | 1 + 1 file changed, 1 insertion(+) diff --git a/k9mail.iml b/k9mail.iml index 7543e9755..1d380b11c 100644 --- a/k9mail.iml +++ b/k9mail.iml @@ -19,6 +19,7 @@