Add comment about broadcast receiver

This commit is contained in:
Stypox 2022-04-14 18:55:23 +02:00
parent 6fb0256997
commit fa25ecf521
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23
2 changed files with 10 additions and 0 deletions

View file

@ -663,6 +663,12 @@ public final class Player implements PlaybackListener, Listener {
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
//region Broadcast receiver //region Broadcast receiver
/**
* This function prepares the broadcast receiver and is called only in the constructor.
* Therefore if you want any PlayerUi to receive a broadcast action, you should add it here,
* even if that player ui might never be added to the player. In that case the received
* broadcast would not do anything.
*/
private void setupBroadcastReceiver() { private void setupBroadcastReceiver() {
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "setupBroadcastReceiver() called"); Log.d(TAG, "setupBroadcastReceiver() called");

View file

@ -55,6 +55,10 @@ public abstract class PlayerUi {
public void onFragmentListenerSet() { public void onFragmentListenerSet() {
} }
/**
* If you want to register new broadcast actions to receive here, add them to
* {@link Player#setupBroadcastReceiver()}.
*/
public void onBroadcastReceived(final Intent intent) { public void onBroadcastReceived(final Intent intent) {
} }