Added attribute queryAfterZeroResults to searchables.
As of now we are just reading it from the xml and not acting upon it, that would come in a subsequent change.
This commit is contained in:
@@ -66,6 +66,7 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
private final int mSearchInputType;
|
private final int mSearchInputType;
|
||||||
private final int mSearchImeOptions;
|
private final int mSearchImeOptions;
|
||||||
private final boolean mIncludeInGlobalSearch;
|
private final boolean mIncludeInGlobalSearch;
|
||||||
|
private final boolean mQueryAfterZeroResults;
|
||||||
private final String mSuggestAuthority;
|
private final String mSuggestAuthority;
|
||||||
private final String mSuggestPath;
|
private final String mSuggestPath;
|
||||||
private final String mSuggestSelection;
|
private final String mSuggestSelection;
|
||||||
@@ -276,6 +277,8 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
EditorInfo.IME_ACTION_SEARCH);
|
EditorInfo.IME_ACTION_SEARCH);
|
||||||
mIncludeInGlobalSearch = a.getBoolean(
|
mIncludeInGlobalSearch = a.getBoolean(
|
||||||
com.android.internal.R.styleable.Searchable_includeInGlobalSearch, false);
|
com.android.internal.R.styleable.Searchable_includeInGlobalSearch, false);
|
||||||
|
mQueryAfterZeroResults = a.getBoolean(
|
||||||
|
com.android.internal.R.styleable.Searchable_queryAfterZeroResults, false);
|
||||||
|
|
||||||
mSuggestAuthority = a.getString(
|
mSuggestAuthority = a.getString(
|
||||||
com.android.internal.R.styleable.Searchable_searchSuggestAuthority);
|
com.android.internal.R.styleable.Searchable_searchSuggestAuthority);
|
||||||
@@ -636,6 +639,17 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
return mIncludeInGlobalSearch;
|
return mIncludeInGlobalSearch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether this searchable activity should be invoked after a query returned zero
|
||||||
|
* results.
|
||||||
|
*
|
||||||
|
* @return The value of the <code>queryAfterZeroResults</code> attribute,
|
||||||
|
* or <code>false</code> if the attribute is not set.
|
||||||
|
*/
|
||||||
|
public boolean queryAfterZeroResults() {
|
||||||
|
return mQueryAfterZeroResults;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Support for parcelable and aidl operations.
|
* Support for parcelable and aidl operations.
|
||||||
*/
|
*/
|
||||||
@@ -667,6 +681,7 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
mSearchInputType = in.readInt();
|
mSearchInputType = in.readInt();
|
||||||
mSearchImeOptions = in.readInt();
|
mSearchImeOptions = in.readInt();
|
||||||
mIncludeInGlobalSearch = in.readInt() != 0;
|
mIncludeInGlobalSearch = in.readInt() != 0;
|
||||||
|
mQueryAfterZeroResults = in.readInt() != 0;
|
||||||
|
|
||||||
mSuggestAuthority = in.readString();
|
mSuggestAuthority = in.readString();
|
||||||
mSuggestPath = in.readString();
|
mSuggestPath = in.readString();
|
||||||
@@ -702,6 +717,7 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
dest.writeInt(mSearchInputType);
|
dest.writeInt(mSearchInputType);
|
||||||
dest.writeInt(mSearchImeOptions);
|
dest.writeInt(mSearchImeOptions);
|
||||||
dest.writeInt(mIncludeInGlobalSearch ? 1 : 0);
|
dest.writeInt(mIncludeInGlobalSearch ? 1 : 0);
|
||||||
|
dest.writeInt(mQueryAfterZeroResults ? 1 : 0);
|
||||||
|
|
||||||
dest.writeString(mSuggestAuthority);
|
dest.writeString(mSuggestAuthority);
|
||||||
dest.writeString(mSuggestPath);
|
dest.writeString(mSuggestPath);
|
||||||
|
|||||||
@@ -2849,6 +2849,14 @@
|
|||||||
The default value is <code>false</code>. <i>Optional attribute.</i>. -->
|
The default value is <code>false</code>. <i>Optional attribute.</i>. -->
|
||||||
<attr name="includeInGlobalSearch" format="boolean" />
|
<attr name="includeInGlobalSearch" format="boolean" />
|
||||||
|
|
||||||
|
<!-- If provided and <code>true</code>, this searchable activity will be invoked for all
|
||||||
|
queries in a particular session. If set to <code>false</code> and the activity
|
||||||
|
returned zero results for a query, it will not be invoked again in that session for
|
||||||
|
supersets of that zero-results query. For example, if the activity returned zero
|
||||||
|
results for "bo", it would not be queried again for "bob".
|
||||||
|
The default value is <code>false</code>. <i>Optional attribute.</i>. -->
|
||||||
|
<attr name="queryAfterZeroResults" format="boolean" />
|
||||||
|
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<!-- In order to process special action keys during search, you must define them using
|
<!-- In order to process special action keys during search, you must define them using
|
||||||
|
|||||||
Reference in New Issue
Block a user