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

Commit c6e3de9e authored by The Android Open Source Project's avatar The Android Open Source Project
Browse files

am 203464af: Add searchSuggestThreshold to searchable meta-data.

parents adf431b5 203464af
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -472,7 +472,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
        closeSuggestionsAdapter();
        
        mSearchAutoComplete.setDropDownAnimationStyle(0); // no animation
        mSearchAutoComplete.setThreshold(0);  // always allow zero-query suggestions
        mSearchAutoComplete.setThreshold(mSearchable.getSuggestThreshold());

        if (mGlobalSearchMode) {
            mSearchAutoComplete.setDropDownAlwaysVisible(true);  // fill space until results come in
+15 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ public final class SearchableInfo implements Parcelable {
    private String mSuggestSelection = null;
    private String mSuggestIntentAction = null;
    private String mSuggestIntentData = null;
    private int mSuggestThreshold = 0;
    private ActionKeyInfo mActionKeyList = null;
    private String mSuggestProviderPackage = null;
    
@@ -139,6 +140,16 @@ public final class SearchableInfo implements Parcelable {
        return mSuggestIntentData;
    }
    
    /**
     * Gets the suggestion threshold for use with these suggestions. 
     * 
     * @return The value of the <code>searchSuggestThreshold</code> attribute, 
     *         or 0 if the attribute is not set.
     */
    public int getSuggestThreshold() {
        return mSuggestThreshold;
    }
    
    /**
     * Get the context for the searchable activity.  
     * 
@@ -238,6 +249,8 @@ public final class SearchableInfo implements Parcelable {
                    com.android.internal.R.styleable.Searchable_searchSuggestIntentAction);
            mSuggestIntentData = a.getString(
                    com.android.internal.R.styleable.Searchable_searchSuggestIntentData);
            mSuggestThreshold = a.getInt(
                    com.android.internal.R.styleable.Searchable_searchSuggestThreshold, 0);
        }
        mVoiceSearchMode = 
            a.getInt(com.android.internal.R.styleable.Searchable_voiceSearchMode, 0);
@@ -600,6 +613,7 @@ public final class SearchableInfo implements Parcelable {
        mSuggestSelection = in.readString();
        mSuggestIntentAction = in.readString();
        mSuggestIntentData = in.readString();
        mSuggestThreshold = in.readInt();

        mActionKeyList = null;
        int count = in.readInt();
@@ -636,6 +650,7 @@ public final class SearchableInfo implements Parcelable {
        dest.writeString(mSuggestSelection);
        dest.writeString(mSuggestIntentAction);
        dest.writeString(mSuggestIntentData);
        dest.writeInt(mSuggestThreshold);

        // This is usually a very short linked list so we'll just pre-count it
        ActionKeyInfo nextKeyInfo = mActionKeyList;
+5 −1
Original line number Diff line number Diff line
@@ -2781,6 +2781,10 @@
            when the user clicks a suggestion.  <i>Optional attribute.</i> -->
        <attr name="searchSuggestIntentData" format="string" />
        
        <!-- If provided, this is the minimun number of characters needed to trigger
             search suggestions. The default value is 0. <i>Optional attribute.</i> -->
        <attr name="searchSuggestThreshold" format="integer" />
        
    </declare-styleable>

    <!-- In order to process special action keys during search, you must define them using