Search in sources :

Example 11 with LocalSearch

use of com.fsck.k9.search.LocalSearch in project k-9 by k9mail.

the class LocalStore method getMessagesInThread.

public List<LocalMessage> getMessagesInThread(final long rootId) throws MessagingException {
    String rootIdString = Long.toString(rootId);
    LocalSearch search = new LocalSearch();
    search.and(SearchField.THREAD_ID, rootIdString, Attribute.EQUALS);
    return searchForMessages(null, search);
}
Also used : LocalSearch(com.fsck.k9.search.LocalSearch)

Example 12 with LocalSearch

use of com.fsck.k9.search.LocalSearch in project k-9 by k9mail.

the class NotificationActionCreator method buildUnreadBackStack.

private TaskStackBuilder buildUnreadBackStack(final Account account) {
    TaskStackBuilder stack = buildAccountsBackStack();
    LocalSearch search = Accounts.createUnreadSearch(context, account);
    Intent intent = MessageList.intentDisplaySearch(context, search, true, false, false);
    stack.addNextIntent(intent);
    return stack;
}
Also used : LocalSearch(com.fsck.k9.search.LocalSearch) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) TaskStackBuilder(android.support.v4.app.TaskStackBuilder)

Example 13 with LocalSearch

use of com.fsck.k9.search.LocalSearch in project k-9 by k9mail.

the class NotificationActionCreator method buildMessageListBackStack.

private TaskStackBuilder buildMessageListBackStack(Account account, String folderName) {
    TaskStackBuilder stack = skipFolderListInBackStack(account, folderName) ? buildAccountsBackStack() : buildFolderListBackStack(account);
    LocalSearch search = new LocalSearch(folderName);
    search.addAllowedFolder(folderName);
    search.addAccountUuid(account.getUuid());
    Intent intent = MessageList.intentDisplaySearch(context, search, false, true, true);
    stack.addNextIntent(intent);
    return stack;
}
Also used : LocalSearch(com.fsck.k9.search.LocalSearch) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) TaskStackBuilder(android.support.v4.app.TaskStackBuilder)

Example 14 with LocalSearch

use of com.fsck.k9.search.LocalSearch in project k-9 by k9mail.

the class MessageCompose method openAutoExpandFolder.

private void openAutoExpandFolder() {
    String folder = account.getAutoExpandFolderName();
    LocalSearch search = new LocalSearch(folder);
    search.addAccountUuid(account.getUuid());
    search.addAllowedFolder(folder);
    MessageList.actionDisplaySearch(this, search, false, true);
    finish();
}
Also used : LocalSearch(com.fsck.k9.search.LocalSearch)

Example 15 with LocalSearch

use of com.fsck.k9.search.LocalSearch in project k-9 by k9mail.

the class Accounts method onOpenAccount.

/**
     * Show that account's inbox or folder-list
     * or return false if the account is not available.
     * @param account the account to open ({@link SearchAccount} or {@link Account})
     * @return false if unsuccessful
     */
private boolean onOpenAccount(BaseAccount account) {
    if (account instanceof SearchAccount) {
        SearchAccount searchAccount = (SearchAccount) account;
        MessageList.actionDisplaySearch(this, searchAccount.getRelatedSearch(), false, false);
    } else {
        Account realAccount = (Account) account;
        if (!realAccount.isEnabled()) {
            onActivateAccount(realAccount);
            return false;
        } else if (!realAccount.isAvailable(this)) {
            String toastText = getString(R.string.account_unavailable, account.getDescription());
            Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_SHORT);
            toast.show();
            Timber.i("refusing to open account that is not available");
            return false;
        }
        if (K9.FOLDER_NONE.equals(realAccount.getAutoExpandFolderName())) {
            FolderList.actionHandleAccount(this, realAccount);
        } else {
            LocalSearch search = new LocalSearch(realAccount.getAutoExpandFolderName());
            search.addAllowedFolder(realAccount.getAutoExpandFolderName());
            search.addAccountUuid(realAccount.getUuid());
            MessageList.actionDisplaySearch(this, search, false, true);
        }
    }
    return true;
}
Also used : SearchAccount(com.fsck.k9.search.SearchAccount) Account(com.fsck.k9.Account) BaseAccount(com.fsck.k9.BaseAccount) Toast(android.widget.Toast) LocalSearch(com.fsck.k9.search.LocalSearch) SearchAccount(com.fsck.k9.search.SearchAccount)

Aggregations

LocalSearch (com.fsck.k9.search.LocalSearch)13 Account (com.fsck.k9.Account)6 SearchAccount (com.fsck.k9.search.SearchAccount)6 SearchCondition (com.fsck.k9.search.SearchSpecification.SearchCondition)4 PendingIntent (android.app.PendingIntent)3 Intent (android.content.Intent)3 Uri (android.net.Uri)3 AccountStats (com.fsck.k9.AccountStats)3 BaseAccount (com.fsck.k9.BaseAccount)3 ArrayList (java.util.ArrayList)3 ContentResolver (android.content.ContentResolver)2 Cursor (android.database.Cursor)2 TaskStackBuilder (android.support.v4.app.TaskStackBuilder)2 Preferences (com.fsck.k9.Preferences)2 MessageListFragment (com.fsck.k9.fragment.MessageListFragment)2 LocalStore (com.fsck.k9.mailstore.LocalStore)2 ConditionsTreeNode (com.fsck.k9.search.ConditionsTreeNode)2 SuppressLint (android.annotation.SuppressLint)1 Bundle (android.os.Bundle)1 VisibleForTesting (android.support.annotation.VisibleForTesting)1