Skip to content

Commit fa9689e

Browse files
icbakershahdDaghash
authored andcommitted
Clarify CommandButton javadoc around iconResId and ICON_UNDEFINED
PiperOrigin-RevId: 701898620 (cherry picked from commit 77d3364)
1 parent f5bbb39 commit fa9689e

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

libraries/session/src/main/java/androidx/media3/session/CommandButton.java

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -548,17 +548,22 @@ public Builder setPlayerCommand(@Player.Command int playerCommand) {
548548

549549
/**
550550
* [will be deprecated] The icon should be defined with the constructor {@link Icon} parameter
551-
* in {@link #Builder(int)} instead. Only in case the existing list of icons is not sufficient,
552-
* use {@link #ICON_UNDEFINED} and set a separate resource id with {@link #setCustomIconResId}.
551+
* in {@link #Builder(int)} instead.
552+
*
553+
* <p>If the existing list of icons is not sufficient, use {@link #ICON_UNDEFINED} for the
554+
* constructor {@link Icon} parameter, and set a separate resource id with {@link
555+
* #setCustomIconResId}.
553556
*/
554557
@CanIgnoreReturnValue
555558
public Builder setIconResId(@DrawableRes int resId) {
556559
return setCustomIconResId(resId);
557560
}
558561

559562
/**
560-
* Sets the resource id of an icon that is used when the predefined {@link Icon} is not
561-
* available or set to {@link #ICON_UNDEFINED}.
563+
* Sets the fallback resource ID of an icon.
564+
*
565+
* <p>This is used when either the predefined {@link #icon} is not available, or it's set to
566+
* {@link #ICON_UNDEFINED}.
562567
*
563568
* @param resId The resource id of a custom icon.
564569
* @return This builder for chaining.
@@ -571,12 +576,13 @@ public Builder setCustomIconResId(@DrawableRes int resId) {
571576
}
572577

573578
/**
574-
* Sets a {@linkplain ContentResolver#SCHEME_CONTENT content} or {@linkplain
579+
* Sets a fallback {@linkplain ContentResolver#SCHEME_CONTENT content} or {@linkplain
575580
* ContentResolver#SCHEME_ANDROID_RESOURCE resource} {@link Uri} for the icon of this button.
576581
*
577-
* <p>Note that this {@link Uri} may be used when the predefined {@link Icon} is not available
578-
* or set to {@link #ICON_UNDEFINED}. It can be used in addition to {@link #setCustomIconResId}
579-
* for consumers that are capable of loading the content or resource {@link Uri}.
582+
* <p>Note that this {@link Uri} may be used when either the predefined {@link
583+
* CommandButton#icon} is not available, or it's set to {@link #ICON_UNDEFINED}. It can be used
584+
* in addition to {@link #setCustomIconResId} for consumers that are capable of loading the
585+
* content or resource {@link Uri}.
580586
*
581587
* @param uri The uri to an icon.
582588
* @return This builder for chaining.
@@ -707,16 +713,23 @@ public CommandButton build() {
707713
@UnstableApi public final @Icon int icon;
708714

709715
/**
710-
* The icon resource id of the button that is used when the predefined {@link #icon} is not
711-
* available or set to {@link #ICON_UNDEFINED}. Can be {@code 0} if not needed.
716+
* The fallback icon resource ID of the button.
717+
*
718+
* <p>This is used when either the predefined {@link #icon} is not available, or it's set to
719+
* {@link #ICON_UNDEFINED}.
720+
*
721+
* <p>Can be {@code 0} if not needed.
712722
*/
713723
@DrawableRes public final int iconResId;
714724

715725
/**
716-
* The {@linkplain ContentResolver#SCHEME_CONTENT content} or {@linkplain
717-
* ContentResolver#SCHEME_ANDROID_RESOURCE resource} {@link Uri} for the icon of the button that
718-
* is used when the predefined {@link #icon} is not available or set to {@link #ICON_UNDEFINED}.
719-
* Can be {@code null}.
726+
* The fallback {@linkplain ContentResolver#SCHEME_CONTENT content} or {@linkplain
727+
* ContentResolver#SCHEME_ANDROID_RESOURCE resource} {@link Uri} for the icon of the button.
728+
*
729+
* <p>This is used when either the predefined {@link #icon} is not available, or it's set to
730+
* {@link #ICON_UNDEFINED}.
731+
*
732+
* <p>Can be {@code null}.
720733
*
721734
* <p>Note that this value can be used in addition to {@link #iconResId} for consumers that are
722735
* capable of loading the content or resource {@link Uri}.

0 commit comments

Comments
 (0)