Clean up SearchableInfo API, JavaDoc and formatting
This change cleans up the JavaDoc in SearchableInfo, removes trailing whitespace, fixes an if-statement style violoation, and re-hides some things that were exposed for Froyo that query deprecated or discouraged attributes: SearchableInfo.getSearchButtonText() SearchableInfo.getLabelId() SearchableInfo.getIconlId() class SearchableInfo.ActionKeyInfo SearchableInfo.findActionKey() Bug http://b/issue?id=2553524 Change-Id: Iee5521c844f74137166730e523d29ba07ef1856b
This commit is contained in:
127
api/current.xml
127
api/current.xml
@@ -24544,19 +24544,6 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</method>
|
</method>
|
||||||
<method name="findActionKey"
|
|
||||||
return="android.app.SearchableInfo.ActionKeyInfo"
|
|
||||||
abstract="false"
|
|
||||||
native="false"
|
|
||||||
synchronized="false"
|
|
||||||
static="false"
|
|
||||||
final="false"
|
|
||||||
deprecated="not deprecated"
|
|
||||||
visibility="public"
|
|
||||||
>
|
|
||||||
<parameter name="keyCode" type="int">
|
|
||||||
</parameter>
|
|
||||||
</method>
|
|
||||||
<method name="getHintId"
|
<method name="getHintId"
|
||||||
return="int"
|
return="int"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
@@ -24568,17 +24555,6 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</method>
|
</method>
|
||||||
<method name="getIconId"
|
|
||||||
return="int"
|
|
||||||
abstract="false"
|
|
||||||
native="false"
|
|
||||||
synchronized="false"
|
|
||||||
static="false"
|
|
||||||
final="false"
|
|
||||||
deprecated="not deprecated"
|
|
||||||
visibility="public"
|
|
||||||
>
|
|
||||||
</method>
|
|
||||||
<method name="getImeOptions"
|
<method name="getImeOptions"
|
||||||
return="int"
|
return="int"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
@@ -24601,17 +24577,6 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</method>
|
</method>
|
||||||
<method name="getLabelId"
|
|
||||||
return="int"
|
|
||||||
abstract="false"
|
|
||||||
native="false"
|
|
||||||
synchronized="false"
|
|
||||||
static="false"
|
|
||||||
final="false"
|
|
||||||
deprecated="not deprecated"
|
|
||||||
visibility="public"
|
|
||||||
>
|
|
||||||
</method>
|
|
||||||
<method name="getSearchActivity"
|
<method name="getSearchActivity"
|
||||||
return="android.content.ComponentName"
|
return="android.content.ComponentName"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
@@ -24623,17 +24588,6 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</method>
|
</method>
|
||||||
<method name="getSearchButtonText"
|
|
||||||
return="int"
|
|
||||||
abstract="false"
|
|
||||||
native="false"
|
|
||||||
synchronized="false"
|
|
||||||
static="false"
|
|
||||||
final="false"
|
|
||||||
deprecated="not deprecated"
|
|
||||||
visibility="public"
|
|
||||||
>
|
|
||||||
</method>
|
|
||||||
<method name="getSettingsDescriptionId"
|
<method name="getSettingsDescriptionId"
|
||||||
return="int"
|
return="int"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
@@ -24869,87 +24823,6 @@
|
|||||||
>
|
>
|
||||||
</field>
|
</field>
|
||||||
</class>
|
</class>
|
||||||
<class name="SearchableInfo.ActionKeyInfo"
|
|
||||||
extends="java.lang.Object"
|
|
||||||
abstract="false"
|
|
||||||
static="true"
|
|
||||||
final="false"
|
|
||||||
deprecated="not deprecated"
|
|
||||||
visibility="public"
|
|
||||||
>
|
|
||||||
<implements name="android.os.Parcelable">
|
|
||||||
</implements>
|
|
||||||
<method name="describeContents"
|
|
||||||
return="int"
|
|
||||||
abstract="false"
|
|
||||||
native="false"
|
|
||||||
synchronized="false"
|
|
||||||
static="false"
|
|
||||||
final="false"
|
|
||||||
deprecated="not deprecated"
|
|
||||||
visibility="public"
|
|
||||||
>
|
|
||||||
</method>
|
|
||||||
<method name="getKeyCode"
|
|
||||||
return="int"
|
|
||||||
abstract="false"
|
|
||||||
native="false"
|
|
||||||
synchronized="false"
|
|
||||||
static="false"
|
|
||||||
final="false"
|
|
||||||
deprecated="not deprecated"
|
|
||||||
visibility="public"
|
|
||||||
>
|
|
||||||
</method>
|
|
||||||
<method name="getQueryActionMsg"
|
|
||||||
return="java.lang.String"
|
|
||||||
abstract="false"
|
|
||||||
native="false"
|
|
||||||
synchronized="false"
|
|
||||||
static="false"
|
|
||||||
final="false"
|
|
||||||
deprecated="not deprecated"
|
|
||||||
visibility="public"
|
|
||||||
>
|
|
||||||
</method>
|
|
||||||
<method name="getSuggestActionMsg"
|
|
||||||
return="java.lang.String"
|
|
||||||
abstract="false"
|
|
||||||
native="false"
|
|
||||||
synchronized="false"
|
|
||||||
static="false"
|
|
||||||
final="false"
|
|
||||||
deprecated="not deprecated"
|
|
||||||
visibility="public"
|
|
||||||
>
|
|
||||||
</method>
|
|
||||||
<method name="getSuggestActionMsgColumn"
|
|
||||||
return="java.lang.String"
|
|
||||||
abstract="false"
|
|
||||||
native="false"
|
|
||||||
synchronized="false"
|
|
||||||
static="false"
|
|
||||||
final="false"
|
|
||||||
deprecated="not deprecated"
|
|
||||||
visibility="public"
|
|
||||||
>
|
|
||||||
</method>
|
|
||||||
<method name="writeToParcel"
|
|
||||||
return="void"
|
|
||||||
abstract="false"
|
|
||||||
native="false"
|
|
||||||
synchronized="false"
|
|
||||||
static="false"
|
|
||||||
final="false"
|
|
||||||
deprecated="not deprecated"
|
|
||||||
visibility="public"
|
|
||||||
>
|
|
||||||
<parameter name="dest" type="android.os.Parcel">
|
|
||||||
</parameter>
|
|
||||||
<parameter name="flags" type="int">
|
|
||||||
</parameter>
|
|
||||||
</method>
|
|
||||||
</class>
|
|
||||||
<class name="Service"
|
<class name="Service"
|
||||||
extends="android.content.ContextWrapper"
|
extends="android.content.ContextWrapper"
|
||||||
abstract="true"
|
abstract="true"
|
||||||
|
|||||||
@@ -38,9 +38,13 @@ import java.io.IOException;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searchability meta-data for an activity.
|
* Searchability meta-data for an activity. Only applications that search other applications
|
||||||
* See <a href="SearchManager.html#SearchabilityMetadata">Searchability meta-data</a>
|
* should need to use this class.
|
||||||
* for more information.
|
* See <a href="{@docRoot}guide/topics/search/searchable-config.html">Searchable Configuration</a>
|
||||||
|
* for more information about declaring searchability meta-data for your application.
|
||||||
|
*
|
||||||
|
* @see SearchManager#getSearchableInfo(ComponentName)
|
||||||
|
* @see SearchManager#getSearchablesInGlobalSearch()
|
||||||
*/
|
*/
|
||||||
public final class SearchableInfo implements Parcelable {
|
public final class SearchableInfo implements Parcelable {
|
||||||
|
|
||||||
@@ -54,13 +58,13 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
private static final String MD_LABEL_SEARCHABLE = "android.app.searchable";
|
private static final String MD_LABEL_SEARCHABLE = "android.app.searchable";
|
||||||
private static final String MD_XML_ELEMENT_SEARCHABLE = "searchable";
|
private static final String MD_XML_ELEMENT_SEARCHABLE = "searchable";
|
||||||
private static final String MD_XML_ELEMENT_SEARCHABLE_ACTION_KEY = "actionkey";
|
private static final String MD_XML_ELEMENT_SEARCHABLE_ACTION_KEY = "actionkey";
|
||||||
|
|
||||||
// flags in the searchMode attribute
|
// flags in the searchMode attribute
|
||||||
private static final int SEARCH_MODE_BADGE_LABEL = 0x04;
|
private static final int SEARCH_MODE_BADGE_LABEL = 0x04;
|
||||||
private static final int SEARCH_MODE_BADGE_ICON = 0x08;
|
private static final int SEARCH_MODE_BADGE_ICON = 0x08;
|
||||||
private static final int SEARCH_MODE_QUERY_REWRITE_FROM_DATA = 0x10;
|
private static final int SEARCH_MODE_QUERY_REWRITE_FROM_DATA = 0x10;
|
||||||
private static final int SEARCH_MODE_QUERY_REWRITE_FROM_TEXT = 0x20;
|
private static final int SEARCH_MODE_QUERY_REWRITE_FROM_TEXT = 0x20;
|
||||||
|
|
||||||
// true member variables - what we know about the searchability
|
// true member variables - what we know about the searchability
|
||||||
private final int mLabelId;
|
private final int mLabelId;
|
||||||
private final ComponentName mSearchActivity;
|
private final ComponentName mSearchActivity;
|
||||||
@@ -86,7 +90,7 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
// This is not final, to allow lazy initialization.
|
// This is not final, to allow lazy initialization.
|
||||||
private HashMap<Integer,ActionKeyInfo> mActionKeys = null;
|
private HashMap<Integer,ActionKeyInfo> mActionKeys = null;
|
||||||
private final String mSuggestProviderPackage;
|
private final String mSuggestProviderPackage;
|
||||||
|
|
||||||
// Flag values for Searchable_voiceSearchMode
|
// Flag values for Searchable_voiceSearchMode
|
||||||
private static final int VOICE_SEARCH_SHOW_BUTTON = 1;
|
private static final int VOICE_SEARCH_SHOW_BUTTON = 1;
|
||||||
private static final int VOICE_SEARCH_LAUNCH_WEB_SEARCH = 2;
|
private static final int VOICE_SEARCH_LAUNCH_WEB_SEARCH = 2;
|
||||||
@@ -97,11 +101,11 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
private final int mVoiceLanguageId; // voiceLanguage
|
private final int mVoiceLanguageId; // voiceLanguage
|
||||||
private final int mVoiceMaxResults; // voiceMaxResults
|
private final int mVoiceMaxResults; // voiceMaxResults
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the authority for obtaining search suggestions.
|
* Gets the search suggestion content provider authority.
|
||||||
*
|
*
|
||||||
* @return Returns a string containing the suggestions authority.
|
* @return The search suggestions authority, or {@code null} if not set.
|
||||||
|
* @see android.R.styleable#Searchable_searchSuggestAuthority
|
||||||
*/
|
*/
|
||||||
public String getSuggestAuthority() {
|
public String getSuggestAuthority() {
|
||||||
return mSuggestAuthority;
|
return mSuggestAuthority;
|
||||||
@@ -117,6 +121,8 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the component name of the searchable activity.
|
* Gets the component name of the searchable activity.
|
||||||
|
*
|
||||||
|
* @return A component name, never {@code null}.
|
||||||
*/
|
*/
|
||||||
public ComponentName getSearchActivity() {
|
public ComponentName getSearchActivity() {
|
||||||
return mSearchActivity;
|
return mSearchActivity;
|
||||||
@@ -125,6 +131,8 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Checks whether the badge should be a text label.
|
* Checks whether the badge should be a text label.
|
||||||
*
|
*
|
||||||
|
* @see android.R.styleable#Searchable_searchMode
|
||||||
|
*
|
||||||
* @hide This feature is deprecated, no need to add it to the API.
|
* @hide This feature is deprecated, no need to add it to the API.
|
||||||
*/
|
*/
|
||||||
public boolean useBadgeLabel() {
|
public boolean useBadgeLabel() {
|
||||||
@@ -134,6 +142,8 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Checks whether the badge should be an icon.
|
* Checks whether the badge should be an icon.
|
||||||
*
|
*
|
||||||
|
* @see android.R.styleable#Searchable_searchMode
|
||||||
|
*
|
||||||
* @hide This feature is deprecated, no need to add it to the API.
|
* @hide This feature is deprecated, no need to add it to the API.
|
||||||
*/
|
*/
|
||||||
public boolean useBadgeIcon() {
|
public boolean useBadgeIcon() {
|
||||||
@@ -142,6 +152,8 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the text in the query field should come from the suggestion intent data.
|
* Checks whether the text in the query field should come from the suggestion intent data.
|
||||||
|
*
|
||||||
|
* @see android.R.styleable#Searchable_searchMode
|
||||||
*/
|
*/
|
||||||
public boolean shouldRewriteQueryFromData() {
|
public boolean shouldRewriteQueryFromData() {
|
||||||
return 0 != (mSearchMode & SEARCH_MODE_QUERY_REWRITE_FROM_DATA);
|
return 0 != (mSearchMode & SEARCH_MODE_QUERY_REWRITE_FROM_DATA);
|
||||||
@@ -149,80 +161,87 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the text in the query field should come from the suggestion title.
|
* Checks whether the text in the query field should come from the suggestion title.
|
||||||
|
*
|
||||||
|
* @see android.R.styleable#Searchable_searchMode
|
||||||
*/
|
*/
|
||||||
public boolean shouldRewriteQueryFromText() {
|
public boolean shouldRewriteQueryFromText() {
|
||||||
return 0 != (mSearchMode & SEARCH_MODE_QUERY_REWRITE_FROM_TEXT);
|
return 0 != (mSearchMode & SEARCH_MODE_QUERY_REWRITE_FROM_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the resource ID of the description string to use for this source in system search
|
* Gets the resource id of the description string to use for this source in system search
|
||||||
* settings, or {@code 0} if none has been specified.
|
* settings, or {@code 0} if none has been specified.
|
||||||
|
*
|
||||||
|
* @see android.R.styleable#Searchable_searchSettingsDescription
|
||||||
*/
|
*/
|
||||||
public int getSettingsDescriptionId() {
|
public int getSettingsDescriptionId() {
|
||||||
return mSettingsDescriptionId;
|
return mSettingsDescriptionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the path for obtaining search suggestions.
|
* Gets the content provider path for obtaining search suggestions.
|
||||||
*
|
*
|
||||||
* @return Returns a string containing the suggestions path, or null if not provided.
|
* @return The suggestion path, or {@code null} if not set.
|
||||||
|
* @see android.R.styleable#Searchable_searchSuggestPath
|
||||||
*/
|
*/
|
||||||
public String getSuggestPath() {
|
public String getSuggestPath() {
|
||||||
return mSuggestPath;
|
return mSuggestPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the selection pattern for obtaining search suggestions. This must
|
* Gets the selection for obtaining search suggestions.
|
||||||
* include a single ? which will be used for the user-typed characters.
|
*
|
||||||
*
|
* @see android.R.styleable#Searchable_searchSuggestSelection
|
||||||
* @return Returns a string containing the suggestions authority.
|
|
||||||
*/
|
*/
|
||||||
public String getSuggestSelection() {
|
public String getSuggestSelection() {
|
||||||
return mSuggestSelection;
|
return mSuggestSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the (optional) intent action for use with these suggestions. This is
|
* Gets the optional intent action for use with these suggestions. This is
|
||||||
* useful if all intents will have the same action (e.g. "android.intent.action.VIEW").
|
* useful if all intents will have the same action
|
||||||
*
|
* (e.g. {@link android.content.Intent#ACTION_VIEW})
|
||||||
* Can be overriden in any given suggestion via the AUTOSUGGEST_COLUMN_INTENT_ACTION column.
|
*
|
||||||
*
|
* This can be overriden in any given suggestion using the column
|
||||||
* @return Returns a string containing the default intent action.
|
* {@link SearchManager#SUGGEST_COLUMN_INTENT_ACTION}.
|
||||||
|
*
|
||||||
|
* @return The default intent action, or {@code null} if not set.
|
||||||
|
* @see android.R.styleable#Searchable_searchSuggestIntentAction
|
||||||
*/
|
*/
|
||||||
public String getSuggestIntentAction() {
|
public String getSuggestIntentAction() {
|
||||||
return mSuggestIntentAction;
|
return mSuggestIntentAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the (optional) intent data for use with these suggestions. This is
|
* Gets the optional intent data for use with these suggestions. This is
|
||||||
* useful if all intents will have similar data URIs (e.g. "android.intent.action.VIEW"),
|
* useful if all intents will have similar data URIs,
|
||||||
* but you'll likely need to provide a specific ID as well via the column
|
* but you'll likely need to provide a specific ID as well via the column
|
||||||
* AUTOSUGGEST_COLUMN_INTENT_DATA_ID, which will be appended to the intent data URI.
|
* {@link SearchManager#SUGGEST_COLUMN_INTENT_DATA_ID}, which will be appended to the
|
||||||
|
* intent data URI.
|
||||||
*
|
*
|
||||||
* Can be overriden in any given suggestion via the AUTOSUGGEST_COLUMN_INTENT_DATA column.
|
* This can be overriden in any given suggestion using the column
|
||||||
|
* {@link SearchManager#SUGGEST_COLUMN_INTENT_DATA}.
|
||||||
*
|
*
|
||||||
* @return Returns a string containing the default intent data.
|
* @return The default intent data, or {@code null} if not set.
|
||||||
|
* @see android.R.styleable#Searchable_searchSuggestIntentData
|
||||||
*/
|
*/
|
||||||
public String getSuggestIntentData() {
|
public String getSuggestIntentData() {
|
||||||
return mSuggestIntentData;
|
return mSuggestIntentData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the suggestion threshold for use with these suggestions.
|
* Gets the suggestion threshold.
|
||||||
*
|
*
|
||||||
* @return The value of the <code>searchSuggestThreshold</code> attribute,
|
* @return The suggestion threshold, or {@code 0} if not set.
|
||||||
* or 0 if the attribute is not set.
|
* @see android.R.styleable#Searchable_searchSuggestThreshold
|
||||||
*/
|
*/
|
||||||
public int getSuggestThreshold() {
|
public int getSuggestThreshold() {
|
||||||
return mSuggestThreshold;
|
return mSuggestThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the context for the searchable activity.
|
* Get the context for the searchable activity.
|
||||||
*
|
*
|
||||||
* This is fairly expensive so do it on the original scan, or when an app is
|
|
||||||
* selected, but don't hang on to the result forever.
|
|
||||||
*
|
|
||||||
* @param context You need to supply a context to start with
|
* @param context You need to supply a context to start with
|
||||||
* @return Returns a context related to the searchable activity
|
* @return Returns a context related to the searchable activity
|
||||||
* @hide
|
* @hide
|
||||||
@@ -230,7 +249,7 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
public Context getActivityContext(Context context) {
|
public Context getActivityContext(Context context) {
|
||||||
return createActivityContext(context, mSearchActivity);
|
return createActivityContext(context, mSearchActivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a context for another activity.
|
* Creates a context for another activity.
|
||||||
*/
|
*/
|
||||||
@@ -246,17 +265,14 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
|
|
||||||
return theirContext;
|
return theirContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the context for the suggestions provider.
|
* Get the context for the suggestions provider.
|
||||||
*
|
*
|
||||||
* This is fairly expensive so do it on the original scan, or when an app is
|
|
||||||
* selected, but don't hang on to the result forever.
|
|
||||||
*
|
|
||||||
* @param context You need to supply a context to start with
|
* @param context You need to supply a context to start with
|
||||||
* @param activityContext If we can determine that the provider and the activity are the
|
* @param activityContext If we can determine that the provider and the activity are the
|
||||||
* same, we'll just return this one.
|
* same, we'll just return this one.
|
||||||
* @return Returns a context related to the context provider
|
* @return Returns a context related to the suggestion provider
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public Context getProviderContext(Context context, Context activityContext) {
|
public Context getProviderContext(Context context, Context activityContext) {
|
||||||
@@ -264,18 +280,18 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
if (mSearchActivity.getPackageName().equals(mSuggestProviderPackage)) {
|
if (mSearchActivity.getPackageName().equals(mSuggestProviderPackage)) {
|
||||||
return activityContext;
|
return activityContext;
|
||||||
}
|
}
|
||||||
if (mSuggestProviderPackage != null)
|
if (mSuggestProviderPackage != null) {
|
||||||
try {
|
try {
|
||||||
theirContext = context.createPackageContext(mSuggestProviderPackage, 0);
|
theirContext = context.createPackageContext(mSuggestProviderPackage, 0);
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
// unexpected, but we deal with this by null-checking theirContext
|
// unexpected, but we deal with this by null-checking theirContext
|
||||||
} catch (java.lang.SecurityException e) {
|
} catch (java.lang.SecurityException e) {
|
||||||
// unexpected, but we deal with this by null-checking theirContext
|
// unexpected, but we deal with this by null-checking theirContext
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return theirContext;
|
return theirContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@@ -356,21 +372,22 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
throw new IllegalArgumentException("Search label must be a resource reference.");
|
throw new IllegalArgumentException("Search label must be a resource reference.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information about an action key in searchability meta-data.
|
* Information about an action key in searchability meta-data.
|
||||||
* See <a href="SearchManager.html#SearchabilityMetadata">Searchability meta-data</a>
|
|
||||||
* for more information.
|
|
||||||
*
|
*
|
||||||
* @see SearchableInfo#findActionKey(int)
|
* @see SearchableInfo#findActionKey(int)
|
||||||
|
*
|
||||||
|
* @hide This feature is used very little, and on many devices there are no reasonable
|
||||||
|
* keys to use for actions.
|
||||||
*/
|
*/
|
||||||
public static class ActionKeyInfo implements Parcelable {
|
public static class ActionKeyInfo implements Parcelable {
|
||||||
|
|
||||||
private final int mKeyCode;
|
private final int mKeyCode;
|
||||||
private final String mQueryActionMsg;
|
private final String mQueryActionMsg;
|
||||||
private final String mSuggestActionMsg;
|
private final String mSuggestActionMsg;
|
||||||
private final String mSuggestActionMsgColumn;
|
private final String mSuggestActionMsgColumn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create one object using attributeset as input data.
|
* Create one object using attributeset as input data.
|
||||||
* @param activityContext runtime context of the activity that the action key information
|
* @param activityContext runtime context of the activity that the action key information
|
||||||
@@ -417,18 +434,34 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
mSuggestActionMsgColumn = in.readString();
|
mSuggestActionMsgColumn = in.readString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the key code that this action key info is for.
|
||||||
|
* @see android.R.styleable#SearchableActionKey_keycode
|
||||||
|
*/
|
||||||
public int getKeyCode() {
|
public int getKeyCode() {
|
||||||
return mKeyCode;
|
return mKeyCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the action message to use for queries.
|
||||||
|
* @see android.R.styleable#SearchableActionKey_queryActionMsg
|
||||||
|
*/
|
||||||
public String getQueryActionMsg() {
|
public String getQueryActionMsg() {
|
||||||
return mQueryActionMsg;
|
return mQueryActionMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the action message to use for suggestions.
|
||||||
|
* @see android.R.styleable#SearchableActionKey_suggestActionMsg
|
||||||
|
*/
|
||||||
public String getSuggestActionMsg() {
|
public String getSuggestActionMsg() {
|
||||||
return mSuggestActionMsg;
|
return mSuggestActionMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the name of the column to get the suggestion action message from.
|
||||||
|
* @see android.R.styleable#SearchableActionKey_suggestActionMsgColumn
|
||||||
|
*/
|
||||||
public String getSuggestActionMsgColumn() {
|
public String getSuggestActionMsgColumn() {
|
||||||
return mSuggestActionMsgColumn;
|
return mSuggestActionMsgColumn;
|
||||||
}
|
}
|
||||||
@@ -444,12 +477,14 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
dest.writeString(mSuggestActionMsgColumn);
|
dest.writeString(mSuggestActionMsgColumn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If any action keys were defined for this searchable activity, look up and return.
|
* If any action keys were defined for this searchable activity, look up and return.
|
||||||
*
|
*
|
||||||
* @param keyCode The key that was pressed
|
* @param keyCode The key that was pressed
|
||||||
* @return Returns the ActionKeyInfo record, or null if none defined
|
* @return Returns the action key info, or {@code null} if none defined.
|
||||||
|
*
|
||||||
|
* @hide ActionKeyInfo is hidden
|
||||||
*/
|
*/
|
||||||
public ActionKeyInfo findActionKey(int keyCode) {
|
public ActionKeyInfo findActionKey(int keyCode) {
|
||||||
if (mActionKeys == null) {
|
if (mActionKeys == null) {
|
||||||
@@ -503,7 +538,7 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
return searchable;
|
return searchable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the metadata for a given activity
|
* Get the metadata for a given activity
|
||||||
*
|
*
|
||||||
@@ -566,147 +601,170 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the "label" (user-visible name) of this searchable context. This must be
|
* Gets the "label" (user-visible name) of this searchable context. This must be
|
||||||
* accessed using the target (searchable) Activity's resources, not simply the context of the
|
* read using the searchable Activity's resources.
|
||||||
* caller.
|
|
||||||
*
|
*
|
||||||
* @return Returns the resource Id
|
* @return A resource id, or {@code 0} if no label was specified.
|
||||||
|
* @see android.R.styleable#Searchable_label
|
||||||
|
*
|
||||||
|
* @hide deprecated functionality
|
||||||
*/
|
*/
|
||||||
public int getLabelId() {
|
public int getLabelId() {
|
||||||
return mLabelId;
|
return mLabelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the resource Id of the hint text. This must be
|
* Gets the resource id of the hint text. This must be
|
||||||
* accessed using the target (searchable) Activity's resources, not simply the context of the
|
* read using the searchable Activity's resources.
|
||||||
* caller.
|
|
||||||
*
|
*
|
||||||
* @return Returns the resource Id, or 0 if not specified by this package.
|
* @return A resource id, or {@code 0} if no hint was specified.
|
||||||
|
* @see android.R.styleable#Searchable_hint
|
||||||
*/
|
*/
|
||||||
public int getHintId() {
|
public int getHintId() {
|
||||||
return mHintId;
|
return mHintId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the icon Id specified by the Searchable_icon meta-data entry. This must be
|
* Gets the icon id specified by the Searchable_icon meta-data entry. This must be
|
||||||
* accessed using the target (searchable) Activity's resources, not simply the context of the
|
* read using the searchable Activity's resources.
|
||||||
* caller.
|
|
||||||
*
|
*
|
||||||
* @return Returns the resource id.
|
* @return A resource id, or {@code 0} if no icon was specified.
|
||||||
|
* @see android.R.styleable#Searchable_icon
|
||||||
|
*
|
||||||
|
* @hide deprecated functionality
|
||||||
*/
|
*/
|
||||||
public int getIconId() {
|
public int getIconId() {
|
||||||
return mIconId;
|
return mIconId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if android:voiceSearchMode="showVoiceSearchButton"
|
* Checks if the searchable activity wants the voice search button to be shown.
|
||||||
|
*
|
||||||
|
* @see android.R.styleable#Searchable_voiceSearchMode
|
||||||
*/
|
*/
|
||||||
public boolean getVoiceSearchEnabled() {
|
public boolean getVoiceSearchEnabled() {
|
||||||
return 0 != (mVoiceSearchMode & VOICE_SEARCH_SHOW_BUTTON);
|
return 0 != (mVoiceSearchMode & VOICE_SEARCH_SHOW_BUTTON);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if android:voiceSearchMode="launchWebSearch"
|
* Checks if voice search should start web search.
|
||||||
|
*
|
||||||
|
* @see android.R.styleable#Searchable_voiceSearchMode
|
||||||
*/
|
*/
|
||||||
public boolean getVoiceSearchLaunchWebSearch() {
|
public boolean getVoiceSearchLaunchWebSearch() {
|
||||||
return 0 != (mVoiceSearchMode & VOICE_SEARCH_LAUNCH_WEB_SEARCH);
|
return 0 != (mVoiceSearchMode & VOICE_SEARCH_LAUNCH_WEB_SEARCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if android:voiceSearchMode="launchRecognizer"
|
* Checks if voice search should start in-app search.
|
||||||
|
*
|
||||||
|
* @see android.R.styleable#Searchable_voiceSearchMode
|
||||||
*/
|
*/
|
||||||
public boolean getVoiceSearchLaunchRecognizer() {
|
public boolean getVoiceSearchLaunchRecognizer() {
|
||||||
return 0 != (mVoiceSearchMode & VOICE_SEARCH_LAUNCH_RECOGNIZER);
|
return 0 != (mVoiceSearchMode & VOICE_SEARCH_LAUNCH_RECOGNIZER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the resource Id of the language model string, if specified in the searchable
|
* Gets the resource id of the voice search language model string.
|
||||||
* activity's metadata, or 0 if not specified.
|
*
|
||||||
|
* @return A resource id, or {@code 0} if no language model was specified.
|
||||||
|
* @see android.R.styleable#Searchable_voiceLanguageModel
|
||||||
*/
|
*/
|
||||||
public int getVoiceLanguageModeId() {
|
public int getVoiceLanguageModeId() {
|
||||||
return mVoiceLanguageModeId;
|
return mVoiceLanguageModeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the resource Id of the voice prompt text string, if specified in the searchable
|
* Gets the resource id of the voice prompt text string.
|
||||||
* activity's metadata, or 0 if not specified.
|
*
|
||||||
|
* @return A resource id, or {@code 0} if no voice prompt text was specified.
|
||||||
|
* @see android.R.styleable#Searchable_voicePromptText
|
||||||
*/
|
*/
|
||||||
public int getVoicePromptTextId() {
|
public int getVoicePromptTextId() {
|
||||||
return mVoicePromptTextId;
|
return mVoicePromptTextId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the resource Id of the spoken langauge, if specified in the searchable
|
* Gets the resource id of the spoken language to recognize in voice search.
|
||||||
* activity's metadata, or 0 if not specified.
|
*
|
||||||
|
* @return A resource id, or {@code 0} if no language was specified.
|
||||||
|
* @see android.R.styleable#Searchable_voiceLanguage
|
||||||
*/
|
*/
|
||||||
public int getVoiceLanguageId() {
|
public int getVoiceLanguageId() {
|
||||||
return mVoiceLanguageId;
|
return mVoiceLanguageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The maximum number of voice recognition results to return.
|
||||||
|
*
|
||||||
* @return the max results count, if specified in the searchable
|
* @return the max results count, if specified in the searchable
|
||||||
* activity's metadata, or 0 if not specified.
|
* activity's metadata, or {@code 0} if not specified.
|
||||||
|
* @see android.R.styleable#Searchable_voiceMaxResults
|
||||||
*/
|
*/
|
||||||
public int getVoiceMaxResults() {
|
public int getVoiceMaxResults() {
|
||||||
return mVoiceMaxResults;
|
return mVoiceMaxResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the resource Id of replacement text for the "Search" button.
|
* Gets the resource id of replacement text for the "Search" button.
|
||||||
*
|
*
|
||||||
* @return Returns the resource Id, or 0 if not specified by this package.
|
* @return A resource id, or {@code 0} if no replacement text was specified.
|
||||||
|
* @see android.R.styleable#Searchable_searchButtonText
|
||||||
|
* @hide This feature is deprecated, no need to add it to the API.
|
||||||
*/
|
*/
|
||||||
public int getSearchButtonText() {
|
public int getSearchButtonText() {
|
||||||
return mSearchButtonText;
|
return mSearchButtonText;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the input type as specified in the searchable attributes. This will default to
|
* Gets the input type as specified in the searchable attributes. This will default to
|
||||||
* InputType.TYPE_CLASS_TEXT if not specified (which is appropriate for free text input).
|
* {@link InputType#TYPE_CLASS_TEXT} if not specified (which is appropriate
|
||||||
|
* for free text input).
|
||||||
*
|
*
|
||||||
* @return the input type
|
* @return the input type
|
||||||
|
* @see android.R.styleable#Searchable_inputType
|
||||||
*/
|
*/
|
||||||
public int getInputType() {
|
public int getInputType() {
|
||||||
return mSearchInputType;
|
return mSearchInputType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the input method options specified in the searchable attributes.
|
* Gets the input method options specified in the searchable attributes.
|
||||||
* This will default to EditorInfo.ACTION_GO if not specified (which is
|
* This will default to {@link EditorInfo#IME_ACTION_GO} if not specified (which is
|
||||||
* appropriate for a search box).
|
* appropriate for a search box).
|
||||||
*
|
*
|
||||||
* @return the input type
|
* @return the input type
|
||||||
|
* @see android.R.styleable#Searchable_imeOptions
|
||||||
*/
|
*/
|
||||||
public int getImeOptions() {
|
public int getImeOptions() {
|
||||||
return mSearchImeOptions;
|
return mSearchImeOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the searchable is exported.
|
* Checks whether the searchable should be included in global search.
|
||||||
*
|
*
|
||||||
* @return The value of the <code>exported</code> attribute,
|
* @return The value of the {@link android.R.styleable#Searchable_includeInGlobalSearch}
|
||||||
* or <code>false</code> if the attribute is not set.
|
* attribute, or {@code false} if the attribute is not set.
|
||||||
|
* @see android.R.styleable#Searchable_includeInGlobalSearch
|
||||||
*/
|
*/
|
||||||
public boolean shouldIncludeInGlobalSearch() {
|
public boolean shouldIncludeInGlobalSearch() {
|
||||||
return mIncludeInGlobalSearch;
|
return mIncludeInGlobalSearch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this searchable activity should be invoked after a query returned zero
|
* Checks whether this searchable activity should be queried for suggestions if a prefix
|
||||||
* results.
|
* of the query has returned no results.
|
||||||
*
|
*
|
||||||
* @return The value of the <code>queryAfterZeroResults</code> attribute,
|
* @see android.R.styleable#Searchable_queryAfterZeroResults
|
||||||
* or <code>false</code> if the attribute is not set.
|
|
||||||
*/
|
*/
|
||||||
public boolean queryAfterZeroResults() {
|
public boolean queryAfterZeroResults() {
|
||||||
return mQueryAfterZeroResults;
|
return mQueryAfterZeroResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this searchable activity has auto URL detect turned on.
|
* Checks whether this searchable activity has auto URL detection turned on.
|
||||||
*
|
*
|
||||||
* @return The value of the <code>autoUrlDetect</code> attribute,
|
* @see android.R.styleable#Searchable_autoUrlDetect
|
||||||
* or <code>false</code> if the attribute is not set.
|
|
||||||
*/
|
*/
|
||||||
public boolean autoUrlDetect() {
|
public boolean autoUrlDetect() {
|
||||||
return mAutoUrlDetect;
|
return mAutoUrlDetect;
|
||||||
@@ -727,7 +785,7 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiate a new SearchableInfo from the data in a Parcel that was
|
* Instantiates a new SearchableInfo from the data in a Parcel that was
|
||||||
* previously written with {@link #writeToParcel(Parcel, int)}.
|
* previously written with {@link #writeToParcel(Parcel, int)}.
|
||||||
*
|
*
|
||||||
* @param in The Parcel containing the previously written SearchableInfo,
|
* @param in The Parcel containing the previously written SearchableInfo,
|
||||||
|
|||||||
Reference in New Issue
Block a user