mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -05:00
fixed issue with sort not being remembered at all on unified inbox / all messages (still does not save sort to settings).
This commit is contained in:
parent
f0c22510e2
commit
93de6cdafe
@ -4,6 +4,7 @@ package com.fsck.k9;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
import java.util.concurrent.SynchronousQueue;
|
import java.util.concurrent.SynchronousQueue;
|
||||||
@ -24,6 +25,7 @@ import android.os.Looper;
|
|||||||
import android.text.format.Time;
|
import android.text.format.Time;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.fsck.k9.Account.SortType;
|
||||||
import com.fsck.k9.activity.MessageCompose;
|
import com.fsck.k9.activity.MessageCompose;
|
||||||
import com.fsck.k9.controller.MessagingController;
|
import com.fsck.k9.controller.MessagingController;
|
||||||
import com.fsck.k9.controller.MessagingListener;
|
import com.fsck.k9.controller.MessagingListener;
|
||||||
@ -194,6 +196,8 @@ public class K9 extends Application {
|
|||||||
private static boolean useGalleryBugWorkaround = false;
|
private static boolean useGalleryBugWorkaround = false;
|
||||||
private static boolean galleryBuggy;
|
private static boolean galleryBuggy;
|
||||||
|
|
||||||
|
private static SortType mSortType;
|
||||||
|
private static HashMap<SortType, Boolean> mSortAscending = new HashMap<SortType, Boolean>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The MIME type(s) of attachments we're willing to view.
|
* The MIME type(s) of attachments we're willing to view.
|
||||||
@ -471,6 +475,8 @@ public class K9 extends Application {
|
|||||||
super.onCreate();
|
super.onCreate();
|
||||||
app = this;
|
app = this;
|
||||||
|
|
||||||
|
mSortType = Account.DEFAULT_SORT_TYPE;
|
||||||
|
mSortAscending.put(Account.DEFAULT_SORT_TYPE, Account.DEFAULT_SORT_ASCENDING);
|
||||||
|
|
||||||
galleryBuggy = checkForBuggyGallery();
|
galleryBuggy = checkForBuggyGallery();
|
||||||
|
|
||||||
@ -1119,4 +1125,24 @@ public class K9 extends Application {
|
|||||||
public static void setAttachmentDefaultPath(String attachmentDefaultPath) {
|
public static void setAttachmentDefaultPath(String attachmentDefaultPath) {
|
||||||
K9.mAttachmentDefaultPath = 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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -831,6 +831,9 @@ public class MessageList
|
|||||||
} else {
|
} else {
|
||||||
Preferences preferences = Preferences.getPreferences(this);
|
Preferences preferences = Preferences.getPreferences(this);
|
||||||
accountsWithNotification = preferences.getAccounts();
|
accountsWithNotification = preferences.getAccounts();
|
||||||
|
mSortType = K9.getSortType(); // ASH
|
||||||
|
mSortAscending = K9.isSortAscending(mSortType);
|
||||||
|
mSortDateAscending = K9.isSortAscending(SortType.SORT_DATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Account accountWithNotification : accountsWithNotification) {
|
for (Account accountWithNotification : accountsWithNotification) {
|
||||||
@ -1215,6 +1218,10 @@ public class MessageList
|
|||||||
mSortAscending = mAccount.isSortAscending(mSortType);
|
mSortAscending = mAccount.isSortAscending(mSortType);
|
||||||
mSortDateAscending = mAccount.isSortAscending(SortType.SORT_DATE);
|
mSortDateAscending = mAccount.isSortAscending(SortType.SORT_DATE);
|
||||||
mAccount.save(Preferences.getPreferences(this));
|
mAccount.save(Preferences.getPreferences(this));
|
||||||
|
} else {
|
||||||
|
K9.setSortType(mSortType);
|
||||||
|
mSortAscending = K9.isSortAscending(mSortType);
|
||||||
|
mSortDateAscending = K9.isSortAscending(SortType.SORT_DATE);
|
||||||
}
|
}
|
||||||
reSort();
|
reSort();
|
||||||
}
|
}
|
||||||
@ -1255,6 +1262,9 @@ public class MessageList
|
|||||||
mAccount.setSortAscending(mSortType, mSortAscending);
|
mAccount.setSortAscending(mSortType, mSortAscending);
|
||||||
mSortDateAscending = mAccount.isSortAscending(SortType.SORT_DATE);
|
mSortDateAscending = mAccount.isSortAscending(SortType.SORT_DATE);
|
||||||
mAccount.save(Preferences.getPreferences(this));
|
mAccount.save(Preferences.getPreferences(this));
|
||||||
|
} else {
|
||||||
|
K9.setSortAscending(mSortType, mSortAscending);
|
||||||
|
mSortDateAscending = K9.isSortAscending(SortType.SORT_DATE);
|
||||||
}
|
}
|
||||||
reSort();
|
reSort();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user