mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 13:12:25 -05:00
Make notification task back stack consistent to activity flow.
Fixes #4956.
This commit is contained in:
parent
195686cbd6
commit
538b81b6ec
@ -4963,15 +4963,22 @@ public class MessagingController implements Runnable {
|
||||
notifMgr.notify(account.getAccountNumber(), builder.build());
|
||||
}
|
||||
|
||||
private TaskStackBuilder buildFolderListBackStack(Context context, Account account) {
|
||||
private TaskStackBuilder buildAccountsBackStack(Context context) {
|
||||
TaskStackBuilder stack = TaskStackBuilder.create(context);
|
||||
stack.addNextIntent(new Intent(context, Accounts.class).putExtra(Accounts.EXTRA_STARTUP, false));
|
||||
if (!skipAccountsInBackStack(context)) {
|
||||
stack.addNextIntent(new Intent(context, Accounts.class).putExtra(Accounts.EXTRA_STARTUP, false));
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
private TaskStackBuilder buildFolderListBackStack(Context context, Account account) {
|
||||
TaskStackBuilder stack = buildAccountsBackStack(context);
|
||||
stack.addNextIntent(FolderList.actionHandleAccountIntent(context, account, false));
|
||||
return stack;
|
||||
}
|
||||
|
||||
private TaskStackBuilder buildUnreadBackStack(Context context, final Account account) {
|
||||
TaskStackBuilder stack = buildFolderListBackStack(context, account);
|
||||
TaskStackBuilder stack = buildAccountsBackStack(context);
|
||||
String description = context.getString(R.string.search_title,
|
||||
account.getDescription(), context.getString(R.string.unread_modifier));
|
||||
LocalSearch search = new LocalSearch(description);
|
||||
@ -4982,7 +4989,10 @@ public class MessagingController implements Runnable {
|
||||
}
|
||||
|
||||
private TaskStackBuilder buildMessageListBackStack(Context context, Account account, String folder) {
|
||||
TaskStackBuilder stack = buildFolderListBackStack(context, account);
|
||||
TaskStackBuilder stack = skipFolderListInBackStack(context, account, folder)
|
||||
? buildAccountsBackStack(context)
|
||||
: buildFolderListBackStack(context, account);
|
||||
|
||||
if (folder != null) {
|
||||
LocalSearch search = new LocalSearch(folder);
|
||||
search.addAllowedFolder(folder);
|
||||
@ -4999,6 +5009,14 @@ public class MessagingController implements Runnable {
|
||||
return stack;
|
||||
}
|
||||
|
||||
private boolean skipFolderListInBackStack(Context context, Account account, String folder) {
|
||||
return folder != null && folder.equals(account.getAutoExpandFolderName());
|
||||
}
|
||||
|
||||
private boolean skipAccountsInBackStack(Context context) {
|
||||
return Preferences.getPreferences(context).getAccounts().length == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the notification sound and LED
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user