From 93de6cdafeab7e77d0a5ac92ed187bbdf86f687e Mon Sep 17 00:00:00 2001 From: ashley willis Date: Thu, 12 Apr 2012 21:12:22 -0500 Subject: [PATCH 1/2] fixed issue with sort not being remembered at all on unified inbox / all messages (still does not save sort to settings). --- src/com/fsck/k9/K9.java | 26 +++++++++++++++++++++++ src/com/fsck/k9/activity/MessageList.java | 10 +++++++++ 2 files changed, 36 insertions(+) diff --git a/src/com/fsck/k9/K9.java b/src/com/fsck/k9/K9.java index 764f5504f..d2121d9af 100644 --- a/src/com/fsck/k9/K9.java +++ b/src/com/fsck/k9/K9.java @@ -4,6 +4,7 @@ package com.fsck.k9; import java.io.File; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.concurrent.BlockingQueue; import java.util.concurrent.SynchronousQueue; @@ -24,6 +25,7 @@ import android.os.Looper; import android.text.format.Time; import android.util.Log; +import com.fsck.k9.Account.SortType; import com.fsck.k9.activity.MessageCompose; import com.fsck.k9.controller.MessagingController; import com.fsck.k9.controller.MessagingListener; @@ -194,6 +196,8 @@ public class K9 extends Application { private static boolean useGalleryBugWorkaround = false; private static boolean galleryBuggy; + private static SortType mSortType; + private static HashMap mSortAscending = new HashMap(); /** * The MIME type(s) of attachments we're willing to view. @@ -471,6 +475,8 @@ public class K9 extends Application { super.onCreate(); app = this; + mSortType = Account.DEFAULT_SORT_TYPE; + mSortAscending.put(Account.DEFAULT_SORT_TYPE, Account.DEFAULT_SORT_ASCENDING); galleryBuggy = checkForBuggyGallery(); @@ -1119,4 +1125,24 @@ public class K9 extends Application { public static void setAttachmentDefaultPath(String attachmentDefaultPath) { K9.mAttachmentDefaultPath = attachmentDefaultPath; } + + public static synchronized SortType getSortType() { + return mSortType; + } + + public static synchronized void setSortType(SortType sortType) { + mSortType = sortType; + } + + public static synchronized boolean isSortAscending(SortType sortType) { + if (mSortAscending.get(sortType) == null) { + mSortAscending.put(sortType, sortType.isDefaultAscending()); + } + return mSortAscending.get(sortType); + } + + public static synchronized void setSortAscending(SortType sortType, boolean sortAscending) { + mSortAscending.put(sortType, sortAscending); + } + } diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index f88960196..0088e5944 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -831,6 +831,9 @@ public class MessageList } else { Preferences preferences = Preferences.getPreferences(this); accountsWithNotification = preferences.getAccounts(); + mSortType = K9.getSortType(); // ASH + mSortAscending = K9.isSortAscending(mSortType); + mSortDateAscending = K9.isSortAscending(SortType.SORT_DATE); } for (Account accountWithNotification : accountsWithNotification) { @@ -1215,6 +1218,10 @@ public class MessageList mSortAscending = mAccount.isSortAscending(mSortType); mSortDateAscending = mAccount.isSortAscending(SortType.SORT_DATE); mAccount.save(Preferences.getPreferences(this)); + } else { + K9.setSortType(mSortType); + mSortAscending = K9.isSortAscending(mSortType); + mSortDateAscending = K9.isSortAscending(SortType.SORT_DATE); } reSort(); } @@ -1255,6 +1262,9 @@ public class MessageList mAccount.setSortAscending(mSortType, mSortAscending); mSortDateAscending = mAccount.isSortAscending(SortType.SORT_DATE); mAccount.save(Preferences.getPreferences(this)); + } else { + K9.setSortAscending(mSortType, mSortAscending); + mSortDateAscending = K9.isSortAscending(SortType.SORT_DATE); } reSort(); } From 5b7dec3d78307e18b012444f1b2552b6d94b32fa Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sat, 14 Apr 2012 12:01:14 +0800 Subject: [PATCH 2/2] Bumped manifest to 4.115 --- AndroidManifest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 59e3565d7..479196256 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@