From 280889bc4a5b7ddc1b1c9fe15e222cad7f2e548a Mon Sep 17 00:00:00 2001 From: ibaker Date: Thu, 19 Jan 2023 16:56:32 +0000 Subject: [PATCH] Explicitly document most Player.Listener methods in terms of getters This makes it implicitly clear that if the value of a getter changes due to a change in command availability then the listener will be invoked, without needing to explicitly document every command on every listener method. #minor-release PiperOrigin-RevId: 503178383 --- .../java/androidx/media3/common/Player.java | 51 +++++++++---------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/libraries/common/src/main/java/androidx/media3/common/Player.java b/libraries/common/src/main/java/androidx/media3/common/Player.java index 611c5fa2b9..1dffe24e42 100644 --- a/libraries/common/src/main/java/androidx/media3/common/Player.java +++ b/libraries/common/src/main/java/androidx/media3/common/Player.java @@ -605,9 +605,15 @@ public interface Player { } /** - * Listener of all changes in the Player. + * Listener for changes in a {@link Player}. * *

All methods have no-op default implementations to allow selective overrides. + * + *

If the return value of a {@link Player} getter changes due to a change in {@linkplain + * #onAvailableCommandsChanged(Commands) command availability}, the corresponding listener + * method(s) will be invoked. If the return value of a {@link Player} getter does not change + * because the corresponding command is {@linkplain #onAvailableCommandsChanged(Commands) not + * available}, the corresponding listener method will not be invoked. */ interface Listener { @@ -617,9 +623,6 @@ public interface Player { *

State changes and events that happen within one {@link Looper} message queue iteration are * reported together and only after all individual callbacks were triggered. * - *

Only state changes represented by {@linkplain Event events} are reported through this - * method. - * *

Listeners should prefer this method over individual callbacks in the following cases: * *