mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-31 15:20:09 -05:00
Don't display threaded message list for filtered views
This commit is contained in:
parent
c7a2080b34
commit
508e9e8aa6
@ -620,7 +620,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||||||
private boolean onOpenAccount(BaseAccount account) {
|
private boolean onOpenAccount(BaseAccount account) {
|
||||||
if (account instanceof SearchAccount) {
|
if (account instanceof SearchAccount) {
|
||||||
SearchAccount searchAccount = (SearchAccount)account;
|
SearchAccount searchAccount = (SearchAccount)account;
|
||||||
MessageList.actionDisplaySearch(this, searchAccount.getRelatedSearch(), false);
|
MessageList.actionDisplaySearch(this, searchAccount.getRelatedSearch(), false, false);
|
||||||
} else {
|
} else {
|
||||||
Account realAccount = (Account)account;
|
Account realAccount = (Account)account;
|
||||||
if (!realAccount.isEnabled()) {
|
if (!realAccount.isEnabled()) {
|
||||||
@ -640,7 +640,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||||||
LocalSearch search = new LocalSearch(realAccount.getAutoExpandFolderName());
|
LocalSearch search = new LocalSearch(realAccount.getAutoExpandFolderName());
|
||||||
search.addAllowedFolder(realAccount.getAutoExpandFolderName());
|
search.addAllowedFolder(realAccount.getAutoExpandFolderName());
|
||||||
search.addAccountUuid(realAccount.getUuid());
|
search.addAccountUuid(realAccount.getUuid());
|
||||||
MessageList.actionDisplaySearch(this, search, true);}
|
MessageList.actionDisplaySearch(this, search, false, true);}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1797,7 +1797,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||||||
|
|
||||||
search.allRequiredFlags(searchModifier.requiredFlags);
|
search.allRequiredFlags(searchModifier.requiredFlags);
|
||||||
search.allForbiddenFlags(searchModifier.forbiddenFlags);
|
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);
|
LocalSearch search = new LocalSearch(folder);
|
||||||
search.addAccountUuid(mAccount.getUuid());
|
search.addAccountUuid(mAccount.getUuid());
|
||||||
search.addAllowedFolder(folder);
|
search.addAllowedFolder(folder);
|
||||||
MessageList.actionDisplaySearch(this, search, false);
|
MessageList.actionDisplaySearch(this, search, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onCompact(Account account) {
|
private void onCompact(Account account) {
|
||||||
@ -1276,7 +1276,7 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
|
|||||||
}
|
}
|
||||||
search.addAllowedFolder(folderName);
|
search.addAllowedFolder(folderName);
|
||||||
search.addAccountUuid(account.getUuid());
|
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;
|
Intent shortcutIntent = null;
|
||||||
|
|
||||||
if (account instanceof SearchSpecification) {
|
if (account instanceof SearchSpecification) {
|
||||||
shortcutIntent = MessageList.intentDisplaySearch(this, (SearchSpecification) account, true, true);
|
shortcutIntent = MessageList.intentDisplaySearch(this, (SearchSpecification) account,
|
||||||
|
false, true, true);
|
||||||
} else {
|
} else {
|
||||||
shortcutIntent = FolderList.actionHandleAccountIntent(this, (Account) account, null,
|
shortcutIntent = FolderList.actionHandleAccountIntent(this, (Account) account, null,
|
||||||
true);
|
true);
|
||||||
|
@ -49,22 +49,28 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||||||
|
|
||||||
// for this activity
|
// for this activity
|
||||||
private static final String EXTRA_SEARCH = "search";
|
private static final String EXTRA_SEARCH = "search";
|
||||||
|
private static final String EXTRA_NO_THREADING = "no_threading";
|
||||||
|
|
||||||
// used for remote search
|
// used for remote search
|
||||||
private static final String EXTRA_SEARCH_ACCOUNT = "com.fsck.k9.search_account";
|
private static final String EXTRA_SEARCH_ACCOUNT = "com.fsck.k9.search_account";
|
||||||
private static final String EXTRA_SEARCH_FOLDER = "com.fsck.k9.search_folder";
|
private static final String EXTRA_SEARCH_FOLDER = "com.fsck.k9.search_folder";
|
||||||
|
|
||||||
public static void actionDisplaySearch(Context context, SearchSpecification search, boolean newTask) {
|
public static void actionDisplaySearch(Context context, SearchSpecification search,
|
||||||
actionDisplaySearch(context, search, newTask, true);
|
boolean noThreading, boolean newTask) {
|
||||||
|
actionDisplaySearch(context, search, noThreading, newTask, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void actionDisplaySearch(Context context, SearchSpecification search, boolean newTask, boolean clearTop) {
|
public static void actionDisplaySearch(Context context, SearchSpecification search,
|
||||||
context.startActivity(intentDisplaySearch(context, search, newTask, clearTop));
|
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 intent = new Intent(context, MessageList.class);
|
||||||
intent.putExtra(EXTRA_SEARCH, search);
|
intent.putExtra(EXTRA_SEARCH, search);
|
||||||
|
intent.putExtra(EXTRA_NO_THREADING, noThreading);
|
||||||
|
|
||||||
if (clearTop) {
|
if (clearTop) {
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
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 mIsRemote;
|
||||||
private boolean mThreadViewEnabled = true; //TODO: this should be a setting
|
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
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -115,8 +128,8 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||||||
|
|
||||||
if (mMessageListFragment == null) {
|
if (mMessageListFragment == null) {
|
||||||
FragmentTransaction ft = fragmentManager.beginTransaction();
|
FragmentTransaction ft = fragmentManager.beginTransaction();
|
||||||
mMessageListFragment = MessageListFragment.newInstance(mSearch, mThreadViewEnabled,
|
mMessageListFragment = MessageListFragment.newInstance(mSearch,
|
||||||
mIsRemote);
|
(mThreadViewEnabled && !mNoThreading), mIsRemote);
|
||||||
ft.add(R.id.message_list_container, mMessageListFragment);
|
ft.add(R.id.message_list_container, mMessageListFragment);
|
||||||
ft.commit();
|
ft.commit();
|
||||||
}
|
}
|
||||||
@ -143,6 +156,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||||||
} else {
|
} else {
|
||||||
// regular LocalSearch object was passed
|
// regular LocalSearch object was passed
|
||||||
mSearch = intent.getParcelableExtra(EXTRA_SEARCH);
|
mSearch = intent.getParcelableExtra(EXTRA_SEARCH);
|
||||||
|
mNoThreading = intent.getBooleanExtra(EXTRA_NO_THREADING, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] accounts = mSearch.getAccountUuids();
|
String[] accounts = mSearch.getAccountUuids();
|
||||||
|
@ -3053,7 +3053,7 @@ public class MessagingController implements Runnable {
|
|||||||
LocalSearch search = new LocalSearch(account.getInboxFolderName());
|
LocalSearch search = new LocalSearch(account.getInboxFolderName());
|
||||||
search.addAllowedFolder(account.getInboxFolderName());
|
search.addAllowedFolder(account.getInboxFolderName());
|
||||||
search.addAccountUuid(account.getUuid());
|
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);
|
PendingIntent pi = PendingIntent.getActivity(mApplication, 0, intent, 0);
|
||||||
builder.setContentIntent(pi);
|
builder.setContentIntent(pi);
|
||||||
@ -3139,7 +3139,7 @@ public class MessagingController implements Runnable {
|
|||||||
LocalSearch search = new LocalSearch(account.getInboxFolderName());
|
LocalSearch search = new LocalSearch(account.getInboxFolderName());
|
||||||
search.addAllowedFolder(account.getInboxFolderName());
|
search.addAllowedFolder(account.getInboxFolderName());
|
||||||
search.addAccountUuid(account.getUuid());
|
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);
|
PendingIntent pi = PendingIntent.getActivity(mApplication, 0, intent, 0);
|
||||||
builder.setContentIntent(pi);
|
builder.setContentIntent(pi);
|
||||||
|
@ -66,7 +66,8 @@ public class UnreadWidgetProvider extends AppWidgetProvider {
|
|||||||
LocalSearch search = new LocalSearch(account.getAutoExpandFolderName());
|
LocalSearch search = new LocalSearch(account.getAutoExpandFolderName());
|
||||||
search.addAllowedFolder(account.getAutoExpandFolderName());
|
search.addAllowedFolder(account.getAutoExpandFolderName());
|
||||||
search.addAccountUuid(account.getUuid());
|
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);
|
clickIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user