From 35379abd46b68a4efa20035c6c8b9d1faceb4dcc Mon Sep 17 00:00:00 2001 From: Satish Sampath Date: Thu, 11 Jun 2009 14:05:51 +0100 Subject: [PATCH] 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. --- .../android/server/search/SearchableInfo.java | 16 ++++++++++++++++ core/res/res/values/attrs.xml | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/core/java/android/server/search/SearchableInfo.java b/core/java/android/server/search/SearchableInfo.java index c08314272d505..4df7368141513 100644 --- a/core/java/android/server/search/SearchableInfo.java +++ b/core/java/android/server/search/SearchableInfo.java @@ -66,6 +66,7 @@ public final class SearchableInfo implements Parcelable { private final int mSearchInputType; private final int mSearchImeOptions; private final boolean mIncludeInGlobalSearch; + private final boolean mQueryAfterZeroResults; private final String mSuggestAuthority; private final String mSuggestPath; private final String mSuggestSelection; @@ -276,6 +277,8 @@ public final class SearchableInfo implements Parcelable { EditorInfo.IME_ACTION_SEARCH); mIncludeInGlobalSearch = a.getBoolean( com.android.internal.R.styleable.Searchable_includeInGlobalSearch, false); + mQueryAfterZeroResults = a.getBoolean( + com.android.internal.R.styleable.Searchable_queryAfterZeroResults, false); mSuggestAuthority = a.getString( com.android.internal.R.styleable.Searchable_searchSuggestAuthority); @@ -636,6 +639,17 @@ public final class SearchableInfo implements Parcelable { return mIncludeInGlobalSearch; } + /** + * Checks whether this searchable activity should be invoked after a query returned zero + * results. + * + * @return The value of the queryAfterZeroResults attribute, + * or false if the attribute is not set. + */ + public boolean queryAfterZeroResults() { + return mQueryAfterZeroResults; + } + /** * Support for parcelable and aidl operations. */ @@ -667,6 +681,7 @@ public final class SearchableInfo implements Parcelable { mSearchInputType = in.readInt(); mSearchImeOptions = in.readInt(); mIncludeInGlobalSearch = in.readInt() != 0; + mQueryAfterZeroResults = in.readInt() != 0; mSuggestAuthority = in.readString(); mSuggestPath = in.readString(); @@ -702,6 +717,7 @@ public final class SearchableInfo implements Parcelable { dest.writeInt(mSearchInputType); dest.writeInt(mSearchImeOptions); dest.writeInt(mIncludeInGlobalSearch ? 1 : 0); + dest.writeInt(mQueryAfterZeroResults ? 1 : 0); dest.writeString(mSuggestAuthority); dest.writeString(mSuggestPath); diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index c13bf775c6fd4..99fe9c8ecfe8d 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -2849,6 +2849,14 @@ The default value is false. Optional attribute.. --> + + +