1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-25 09:08:49 -05:00

Don't show ALL unread messages for "notification opens unread messages"

This commit is contained in:
cketti 2013-04-18 22:06:33 +02:00
parent 0d80dd8fe1
commit e15409bafa
2 changed files with 29 additions and 27 deletions

View File

@ -344,6 +344,29 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
context.startActivity(intent);
}
public static LocalSearch createUnreadSearch(Context context, BaseAccount account) {
String searchTitle = context.getString(R.string.search_title, account.getDescription(),
context.getString(R.string.unread_modifier));
LocalSearch search;
if (account instanceof SearchAccount) {
search = ((SearchAccount) account).getRelatedSearch().clone();
search.setName(searchTitle);
} else {
search = new LocalSearch(searchTitle);
search.addAccountUuid(account.getUuid());
Account realAccount = (Account) account;
realAccount.excludeSpecialFolders(search);
realAccount.limitToDisplayableFolders(search);
}
search.and(Searchfield.READ, "1", Attribute.NOT_EQUALS);
return search;
}
@Override
public void onNewIntent(Intent intent) {
Uri uri = intent.getData();
@ -1720,8 +1743,8 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
holder.flaggedMessageCount.setText(Integer.toString(stats.flaggedMessageCount));
holder.flaggedMessageCountWrapper.setVisibility(stats.flaggedMessageCount > 0 ? View.VISIBLE : View.GONE);
holder.flaggedMessageCountWrapper.setOnClickListener(createFlaggedSearch(account));
holder.newMessageCountWrapper.setOnClickListener(createUnreadSearch(account));
holder.flaggedMessageCountWrapper.setOnClickListener(createFlaggedSearchListener(account));
holder.newMessageCountWrapper.setOnClickListener(createUnreadSearchListener(account));
holder.activeIcons.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
@ -1778,7 +1801,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
}
private OnClickListener createFlaggedSearch(BaseAccount account) {
private OnClickListener createFlaggedSearchListener(BaseAccount account) {
String searchTitle = getString(R.string.search_title, account.getDescription(),
getString(R.string.flagged_modifier));
@ -1800,25 +1823,8 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
return new AccountClickListener(search);
}
private OnClickListener createUnreadSearch(BaseAccount account) {
String searchTitle = getString(R.string.search_title, account.getDescription(),
getString(R.string.unread_modifier));
LocalSearch search;
if (account instanceof SearchAccount) {
search = ((SearchAccount) account).getRelatedSearch().clone();
search.setName(searchTitle);
} else {
search = new LocalSearch(searchTitle);
search.addAccountUuid(account.getUuid());
Account realAccount = (Account) account;
realAccount.excludeSpecialFolders(search);
realAccount.limitToDisplayableFolders(search);
}
search.and(Searchfield.READ, "1", Attribute.NOT_EQUALS);
private OnClickListener createUnreadSearchListener(BaseAccount account) {
LocalSearch search = createUnreadSearch(Accounts.this, account);
return new AccountClickListener(search);
}

View File

@ -4989,11 +4989,7 @@ public class MessagingController implements Runnable {
private TaskStackBuilder buildUnreadBackStack(Context context, final Account 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);
search.addAccountUuid(account.getUuid());
search.and(Searchfield.READ, "1", Attribute.NOT_EQUALS);
LocalSearch search = Accounts.createUnreadSearch(context, account);
stack.addNextIntent(MessageList.intentDisplaySearch(context, search, true, false, false));
return stack;
}