diff --git a/core/java/android/view/translation/TranslationResponseValue.java b/core/java/android/view/translation/TranslationResponseValue.java index a68ae5658b377..e2ef5d341c828 100644 --- a/core/java/android/view/translation/TranslationResponseValue.java +++ b/core/java/android/view/translation/TranslationResponseValue.java @@ -49,7 +49,24 @@ public final class TranslationResponseValue implements Parcelable { *

The dictionary definitions consists of groups of terms keyed by their corresponding parts * of speech. This map-like structure is stored in a {@link Bundle}. The individual parts of * speech can be traversed by {@link Bundle#keySet()} and used to get the corresponding list - * of terms as {@link CharSequence}s.

+ * of terms as {@link CharSequence}s. + * + * + * + * The set of parts of speech can then be used by + * {@link Bundle#getCharSequenceArrayList(String)} to get the list of terms. + * + * Example: + * + * {@code for (String partOfSpeech : extras.getBundle(EXTRA_DEFINITIONS).keySet()) { + * ArrayList terms = + * extras.getBundle(EXTRA_DEFINITIONS).getCharSequenceArrayList(partOfSpeech); + * ... + * }}

*/ public static final String EXTRA_DEFINITIONS = "android.view.translation.extra.DEFINITIONS"; @@ -70,7 +87,8 @@ public final class TranslationResponseValue implements Parcelable { /** * Extra results associated with the translated text. * - *

The bundle includes {@link #EXTRA_DEFINITIONS}, obtained by {@link Bundle#getBundle}.

+ *

The bundle includes {@link #EXTRA_DEFINITIONS}, obtained by {@link Bundle#getBundle}. + *

*/ @NonNull private final Bundle mExtras; @@ -190,7 +208,8 @@ public final class TranslationResponseValue implements Parcelable { /** * Extra results associated with the translated text. * - *

The bundle includes {@link #EXTRA_DEFINITIONS}, obtained by {@link Bundle#getBundle}.

+ *

The bundle includes {@link #EXTRA_DEFINITIONS}, obtained by {@link Bundle#getBundle}. + *

*/ @DataClass.Generated.Member public @NonNull Bundle getExtras() { @@ -370,7 +389,8 @@ public final class TranslationResponseValue implements Parcelable { /** * Extra results associated with the translated text. * - *

The bundle includes {@link #EXTRA_DEFINITIONS}, obtained by {@link Bundle#getBundle}.

+ *

The bundle includes {@link #EXTRA_DEFINITIONS}, obtained by {@link Bundle#getBundle}. + *

*/ @DataClass.Generated.Member public @NonNull Builder setExtras(@NonNull Bundle value) { @@ -423,7 +443,7 @@ public final class TranslationResponseValue implements Parcelable { } @DataClass.Generated( - time = 1621034223313L, + time = 1621623218037L, codegenVersion = "1.0.23", sourceFile = "frameworks/base/core/java/android/view/translation/TranslationResponseValue.java", inputSignatures = "public static final int STATUS_SUCCESS\npublic static final int STATUS_ERROR\npublic static final java.lang.String EXTRA_DEFINITIONS\nprivate final @android.view.translation.TranslationResponseValue.Status int mStatusCode\nprivate final @android.annotation.Nullable java.lang.CharSequence mText\nprivate final @android.annotation.NonNull android.os.Bundle mExtras\nprivate final @android.annotation.Nullable java.lang.CharSequence mTransliteration\npublic static @android.annotation.NonNull android.view.translation.TranslationResponseValue forError()\nprivate static java.lang.CharSequence defaultText()\nprivate static android.os.Bundle defaultExtras()\nprivate static java.lang.CharSequence defaultTransliteration()\nclass TranslationResponseValue extends java.lang.Object implements [android.os.Parcelable]\nclass BaseBuilder extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genBuilder=true, genToString=true, genEqualsHashCode=true, genHiddenConstDefs=true)\nclass BaseBuilder extends java.lang.Object implements []")