Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 02b253b0 authored by williamvds's avatar williamvds
Browse files

Detect and select unified inbox in drawer

parent 58598c07
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.os.Parcelable;

public class LocalSearch implements SearchSpecification {

    private String id;
    private String mName;
    private boolean mPredefined;
    private boolean mManualSearch = false;
@@ -103,6 +104,16 @@ public class LocalSearch implements SearchSpecification {
        this.mName = name;
    }

    /**
     * Set the ID of the search. This is used to identify a unified inbox
     * search
     *
     * @param id ID to set
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * Add a new account to the search. When no accounts are
     * added manually we search all accounts on the device.
@@ -301,6 +312,15 @@ public class LocalSearch implements SearchSpecification {
        return (mName == null) ? "" : mName;
    }

    /**
     * Returns the ID of the search
     *
     * @return The ID of the search
     */
    public String getId() {
        return (id == null) ? "" : id;
    }

    /**
     * Checks if this search was hard coded and shipped with K-9
     *
@@ -364,6 +384,7 @@ public class LocalSearch implements SearchSpecification {

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(id);
        dest.writeString(mName);
        dest.writeByte((byte) (mPredefined ? 1 : 0));
        dest.writeByte((byte) (mManualSearch ? 1 : 0));
@@ -386,6 +407,7 @@ public class LocalSearch implements SearchSpecification {
    };

    public LocalSearch(Parcel in) {
        id = in.readString();
        mName = in.readString();
        mPredefined = (in.readByte() == 1);
        mManualSearch = (in.readByte() == 1);
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ public class SearchAccount implements BaseAccount {
        CoreResourceProvider resourceProvider = DI.get(CoreResourceProvider.class);
        String name = resourceProvider.searchUnifiedInboxTitle();
        LocalSearch tmpSearch = new LocalSearch(name);
        tmpSearch.setId(UNIFIED_INBOX);
        tmpSearch.and(SearchField.INTEGRATE, "1", Attribute.EQUALS);
        return new SearchAccount(UNIFIED_INBOX, tmpSearch, name, resourceProvider.searchUnifiedInboxDetail());
    }
+3 −0
Original line number Diff line number Diff line
@@ -476,6 +476,9 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
            // regular LocalSearch object was passed
            search = intent.hasExtra(EXTRA_SEARCH) ?
                    ParcelableUtil.unmarshall(intent.getByteArrayExtra(EXTRA_SEARCH), LocalSearch.CREATOR) : null;
            if (search.getId().equals(SearchAccount.UNIFIED_INBOX)) {
                drawer.selectUnifiedInbox();
            }
            noThreading = intent.getBooleanExtra(EXTRA_NO_THREADING, false);
        }