Remove Preferences dependency

This commit is contained in:
Jan Berkel 2014-12-12 12:42:48 +00:00
parent 9f16b9f465
commit 6264527abc
5 changed files with 18 additions and 35 deletions

View file

@ -280,22 +280,16 @@ public class ChooseFolder extends K9ListActivity {
mAccount.getInboxFolderName().equalsIgnoreCase(name)))) {
continue;
}
try {
folder.refresh(prefs);
Folder.FolderClass fMode = folder.getDisplayClass();
Folder.FolderClass fMode = folder.getDisplayClass();
if ((aMode == Account.FolderMode.FIRST_CLASS &&
fMode != Folder.FolderClass.FIRST_CLASS) || (
aMode == Account.FolderMode.FIRST_AND_SECOND_CLASS &&
fMode != Folder.FolderClass.FIRST_CLASS &&
fMode != Folder.FolderClass.SECOND_CLASS) || (
aMode == Account.FolderMode.NOT_SECOND_CLASS &&
fMode == Folder.FolderClass.SECOND_CLASS)) {
continue;
}
} catch (MessagingException me) {
Log.e(K9.LOG_TAG, "Couldn't get prefs to check for displayability of folder " +
folder.getName(), me);
if ((aMode == FolderMode.FIRST_CLASS &&
fMode != Folder.FolderClass.FIRST_CLASS) || (
aMode == FolderMode.FIRST_AND_SECOND_CLASS &&
fMode != Folder.FolderClass.FIRST_CLASS &&
fMode != Folder.FolderClass.SECOND_CLASS) || (
aMode == FolderMode.NOT_SECOND_CLASS &&
fMode == Folder.FolderClass.SECOND_CLASS)) {
continue;
}
if (folder.isInTopGroup()) {

View file

@ -749,20 +749,14 @@ public class FolderList extends K9ListActivity {
Account.FolderMode aMode = account.getFolderDisplayMode();
Preferences prefs = Preferences.getPreferences(getApplication().getApplicationContext());
for (Folder folder : folders) {
try {
folder.refresh(prefs);
Folder.FolderClass fMode = folder.getDisplayClass();
Folder.FolderClass fMode = folder.getDisplayClass();
if ((aMode == Account.FolderMode.FIRST_CLASS && fMode != Folder.FolderClass.FIRST_CLASS)
|| (aMode == Account.FolderMode.FIRST_AND_SECOND_CLASS &&
fMode != Folder.FolderClass.FIRST_CLASS &&
fMode != Folder.FolderClass.SECOND_CLASS)
|| (aMode == Account.FolderMode.NOT_SECOND_CLASS && fMode == Folder.FolderClass.SECOND_CLASS)) {
continue;
}
} catch (MessagingException me) {
Log.e(K9.LOG_TAG, "Couldn't get prefs to check for displayability of folder " + folder.getName(), me);
if ((aMode == FolderMode.FIRST_CLASS && fMode != Folder.FolderClass.FIRST_CLASS)
|| (aMode == FolderMode.FIRST_AND_SECOND_CLASS &&
fMode != Folder.FolderClass.FIRST_CLASS &&
fMode != Folder.FolderClass.SECOND_CLASS)
|| (aMode == FolderMode.NOT_SECOND_CLASS && fMode == Folder.FolderClass.SECOND_CLASS)) {
continue;
}
FolderInfoHolder holder = null;

View file

@ -694,6 +694,7 @@ public class MessagingController implements Runnable {
@Override
public void messagesFinished(int number) {}
@Override
public void messageFinished(LocalMessage message, int number, int ofTotal) {
if (!isMessageSuppressed(message)) {
List<LocalMessage> messages = new ArrayList<LocalMessage>();
@ -4391,7 +4392,6 @@ public class MessagingController implements Runnable {
Store localStore = account.getLocalStore();
for (final Folder folder : localStore.getPersonalNamespaces(false)) {
folder.open(Folder.OPEN_MODE_RW);
folder.refresh(prefs);
Folder.FolderClass fDisplayClass = folder.getDisplayClass();
Folder.FolderClass fSyncClass = folder.getSyncClass();
@ -5305,7 +5305,6 @@ public class MessagingController implements Runnable {
continue;
}
folder.open(Folder.OPEN_MODE_RW);
folder.refresh(prefs);
Folder.FolderClass fDisplayClass = folder.getDisplayClass();
Folder.FolderClass fPushClass = folder.getPushClass();

View file

@ -8,7 +8,6 @@ import java.util.Set;
import android.util.Log;
import com.fsck.k9.K9;
import com.fsck.k9.Preferences;
import com.fsck.k9.controller.MessageRetrievalListener;
public abstract class Folder<T extends Message> {
@ -217,10 +216,6 @@ public abstract class Folder<T extends Message> {
return getSyncClass();
}
public void refresh(Preferences preferences) throws MessagingException {
}
public boolean isInTopGroup() {
return false;
}

View file

@ -17,6 +17,7 @@ public interface StoreConfig {
void setSpamFolderName(String name);
void setSentFolderName(String name);
void setAutoExpandFolderName(String name);
void setInboxFolderName(String name);
int getMaximumAutoDownloadMessageSize();