From 104f8053370f9e01ac2e8e23bc31d128e5fcc00b Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Fri, 28 Oct 2016 11:20:20 -0700 Subject: [PATCH] App Shortcut: Clarify which attributes must be resources Test: javadoc only -- m -j32 offline-sdk-docs Bug 32495737 Change-Id: I4c3884172761b128d07f1c2948ab7ccc53951a7e --- .../android/content/pm/ShortcutManager.java | 21 +++++++++++++++---- docs/html/guide/topics/ui/settings.jd | 4 +++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/core/java/android/content/pm/ShortcutManager.java b/core/java/android/content/pm/ShortcutManager.java index a93870ece823a..f7c4d592b3a92 100644 --- a/core/java/android/content/pm/ShortcutManager.java +++ b/core/java/android/content/pm/ShortcutManager.java @@ -193,7 +193,11 @@ import java.util.List; * The following list includes descriptions for the different attributes within a static shortcut: *
*
{@code android:shortcutId}
- *
Mandatory shortcut ID
+ *
Mandatory shortcut ID. + *

+ * This must be a string literal. + * A resource string, such as @string/foo, cannot be used. + *

* *
{@code android:enabled}
*
Default is {@code true}. Can be set to {@code false} in order @@ -206,15 +210,24 @@ import java.util.List; * *
{@code android:shortcutShortLabel}
*
Mandatory shortcut short label. - * See {@link ShortcutInfo.Builder#setShortLabel(CharSequence)}.
+ * See {@link ShortcutInfo.Builder#setShortLabel(CharSequence)}. + *

+ * This must be a resource string, such as @string/shortcut_label. + * * *

{@code android:shortcutLongLabel}
*
Shortcut long label. - * See {@link ShortcutInfo.Builder#setLongLabel(CharSequence)}.
+ * See {@link ShortcutInfo.Builder#setLongLabel(CharSequence)}. + *

+ * This must be a resource string, such as @string/shortcut_long_label. + * * *

{@code android:shortcutDisabledMessage}
*
When {@code android:enabled} is set to - * {@code false}, this attribute is used to display a custom disabled message.
+ * {@code false}, this attribute is used to display a custom disabled message. + *

+ * This must be a resource string, such as @string/shortcut_disabled_message. + * * *

{@code intent}
*
Intent to launch when the user selects the shortcut. diff --git a/docs/html/guide/topics/ui/settings.jd b/docs/html/guide/topics/ui/settings.jd index 619fd268aef90..b51e6d97ae0a1 100644 --- a/docs/html/guide/topics/ui/settings.jd +++ b/docs/html/guide/topics/ui/settings.jd @@ -390,7 +390,9 @@ setComponent()} method.
The package part of the component name, as per the {@link android.content.Intent#setComponent setComponent()} method.
- +

Note: You must use string literals as the values for these +intent attributes. You cannot use resource strings, such as @string/foo, to define the attributes. +

Creating a Preference Activity