Don't display threaded message list for filtered views
This commit is contained in:
parent
c7a2080b34
commit
508e9e8aa6
6 changed files with 32 additions and 16 deletions
|
@ -620,7 +620,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||
private boolean onOpenAccount(BaseAccount account) {
|
||||
if (account instanceof SearchAccount) {
|
||||
SearchAccount searchAccount = (SearchAccount)account;
|
||||
MessageList.actionDisplaySearch(this, searchAccount.getRelatedSearch(), false);
|
||||
MessageList.actionDisplaySearch(this, searchAccount.getRelatedSearch(), false, false);
|
||||
} else {
|
||||
Account realAccount = (Account)account;
|
||||
if (!realAccount.isEnabled()) {
|
||||
|
@ -640,7 +640,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||
LocalSearch search = new LocalSearch(realAccount.getAutoExpandFolderName());
|
||||
search.addAllowedFolder(realAccount.getAutoExpandFolderName());
|
||||
search.addAccountUuid(realAccount.getUuid());
|
||||
MessageList.actionDisplaySearch(this, search, true);}
|
||||
MessageList.actionDisplaySearch(this, search, false, true);}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1797,7 +1797,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||
|
||||
search.allRequiredFlags(searchModifier.requiredFlags);
|
||||
search.allForbiddenFlags(searchModifier.forbiddenFlags);
|
||||
MessageList.actionDisplaySearch(Accounts.this, search, false);
|
||||
MessageList.actionDisplaySearch(Accounts.this, search, true, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -625,7 +625,7 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
|
|||
LocalSearch search = new LocalSearch(folder);
|
||||
search.addAccountUuid(mAccount.getUuid());
|
||||
search.addAllowedFolder(folder);
|
||||
MessageList.actionDisplaySearch(this, search, false);
|
||||
MessageList.actionDisplaySearch(this, search, false, false);
|
||||
}
|
||||
|
||||
private void onCompact(Account account) {
|
||||
|
@ -1276,7 +1276,7 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
|
|||
}
|
||||
search.addAllowedFolder(folderName);
|
||||
search.addAccountUuid(account.getUuid());
|
||||
MessageList.actionDisplaySearch(FolderList.this, search, false);
|
||||
MessageList.actionDisplaySearch(FolderList.this, search, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@ public class LauncherShortcuts extends AccountList {
|
|||
Intent shortcutIntent = null;
|
||||
|
||||
if (account instanceof SearchSpecification) {
|
||||
shortcutIntent = MessageList.intentDisplaySearch(this, (SearchSpecification) account, true, true);
|
||||
shortcutIntent = MessageList.intentDisplaySearch(this, (SearchSpecification) account,
|
||||
false, true, true);
|
||||
} else {
|
||||
shortcutIntent = FolderList.actionHandleAccountIntent(this, (Account) account, null,
|
||||
true);
|
||||
|
|
|
@ -49,22 +49,28 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||
|
||||
// for this activity
|
||||
private static final String EXTRA_SEARCH = "search";
|
||||
private static final String EXTRA_NO_THREADING = "no_threading";
|
||||
|
||||
// used for remote search
|
||||
private static final String EXTRA_SEARCH_ACCOUNT = "com.fsck.k9.search_account";
|
||||
private static final String EXTRA_SEARCH_FOLDER = "com.fsck.k9.search_folder";
|
||||
|
||||
public static void actionDisplaySearch(Context context, SearchSpecification search, boolean newTask) {
|
||||
actionDisplaySearch(context, search, newTask, true);
|
||||
public static void actionDisplaySearch(Context context, SearchSpecification search,
|
||||
boolean noThreading, boolean newTask) {
|
||||
actionDisplaySearch(context, search, noThreading, newTask, true);
|
||||
}
|
||||
|
||||
public static void actionDisplaySearch(Context context, SearchSpecification search, boolean newTask, boolean clearTop) {
|
||||
context.startActivity(intentDisplaySearch(context, search, newTask, clearTop));
|
||||
public static void actionDisplaySearch(Context context, SearchSpecification search,
|
||||
boolean noThreading, boolean newTask, boolean clearTop) {
|
||||
context.startActivity(
|
||||
intentDisplaySearch(context, search, noThreading, newTask, clearTop));
|
||||
}
|
||||
|
||||
public static Intent intentDisplaySearch(Context context, SearchSpecification search, boolean newTask, boolean clearTop) {
|
||||
public static Intent intentDisplaySearch(Context context, SearchSpecification search,
|
||||
boolean noThreading, boolean newTask, boolean clearTop) {
|
||||
Intent intent = new Intent(context, MessageList.class);
|
||||
intent.putExtra(EXTRA_SEARCH, search);
|
||||
intent.putExtra(EXTRA_NO_THREADING, noThreading);
|
||||
|
||||
if (clearTop) {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
|
@ -95,6 +101,13 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||
private boolean mIsRemote;
|
||||
private boolean mThreadViewEnabled = true; //TODO: this should be a setting
|
||||
|
||||
/**
|
||||
* {@code true} if the message list should be displayed as flat list (i.e. no threading)
|
||||
* regardless whether or not message threading was enabled in the settings. This is used for
|
||||
* filtered views, e.g. when only displaying the unread messages in a folder.
|
||||
*/
|
||||
private boolean mNoThreading;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -115,8 +128,8 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||
|
||||
if (mMessageListFragment == null) {
|
||||
FragmentTransaction ft = fragmentManager.beginTransaction();
|
||||
mMessageListFragment = MessageListFragment.newInstance(mSearch, mThreadViewEnabled,
|
||||
mIsRemote);
|
||||
mMessageListFragment = MessageListFragment.newInstance(mSearch,
|
||||
(mThreadViewEnabled && !mNoThreading), mIsRemote);
|
||||
ft.add(R.id.message_list_container, mMessageListFragment);
|
||||
ft.commit();
|
||||
}
|
||||
|
@ -143,6 +156,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||
} else {
|
||||
// regular LocalSearch object was passed
|
||||
mSearch = intent.getParcelableExtra(EXTRA_SEARCH);
|
||||
mNoThreading = intent.getBooleanExtra(EXTRA_NO_THREADING, false);
|
||||
}
|
||||
|
||||
String[] accounts = mSearch.getAccountUuids();
|
||||
|
|
|
@ -3053,7 +3053,7 @@ public class MessagingController implements Runnable {
|
|||
LocalSearch search = new LocalSearch(account.getInboxFolderName());
|
||||
search.addAllowedFolder(account.getInboxFolderName());
|
||||
search.addAccountUuid(account.getUuid());
|
||||
Intent intent = MessageList.intentDisplaySearch(mApplication, search, true, true);
|
||||
Intent intent = MessageList.intentDisplaySearch(mApplication, search, false, true, true);
|
||||
|
||||
PendingIntent pi = PendingIntent.getActivity(mApplication, 0, intent, 0);
|
||||
builder.setContentIntent(pi);
|
||||
|
@ -3139,7 +3139,7 @@ public class MessagingController implements Runnable {
|
|||
LocalSearch search = new LocalSearch(account.getInboxFolderName());
|
||||
search.addAllowedFolder(account.getInboxFolderName());
|
||||
search.addAccountUuid(account.getUuid());
|
||||
Intent intent = MessageList.intentDisplaySearch(mApplication, search, true, true);
|
||||
Intent intent = MessageList.intentDisplaySearch(mApplication, search, false, true, true);
|
||||
|
||||
PendingIntent pi = PendingIntent.getActivity(mApplication, 0, intent, 0);
|
||||
builder.setContentIntent(pi);
|
||||
|
|
|
@ -66,7 +66,8 @@ public class UnreadWidgetProvider extends AppWidgetProvider {
|
|||
LocalSearch search = new LocalSearch(account.getAutoExpandFolderName());
|
||||
search.addAllowedFolder(account.getAutoExpandFolderName());
|
||||
search.addAccountUuid(account.getUuid());
|
||||
clickIntent = MessageList.intentDisplaySearch(context, search, true, true);
|
||||
clickIntent = MessageList.intentDisplaySearch(context, search, false, true,
|
||||
true);
|
||||
}
|
||||
clickIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue