Commit 9de4e5d7 by andrewlewis Committed by Oliver Woodman

Make MediaDescriptionAdapter the last argument

If the caller wants to pass an anonymous inner class for the media description
adapter, this results in slightly more readable code.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193666444
parent 400619c1
...@@ -244,17 +244,17 @@ public class PlayerNotificationManager { ...@@ -244,17 +244,17 @@ public class PlayerNotificationManager {
private static final long MAX_POSITION_FOR_SEEK_TO_PREVIOUS = 3000; private static final long MAX_POSITION_FOR_SEEK_TO_PREVIOUS = 3000;
private final Context context; private final Context context;
private final String channelId;
private final int notificationId;
private final MediaDescriptionAdapter mediaDescriptionAdapter;
private final CustomActionReceiver customActionReceiver;
private final Handler mainHandler; private final Handler mainHandler;
private final NotificationManagerCompat notificationManager; private final NotificationManagerCompat notificationManager;
private final IntentFilter intentFilter; private final IntentFilter intentFilter;
private final Player.EventListener playerListener; private final Player.EventListener playerListener;
private final NotificationBroadcastReceiver notificationBroadcastReceiver; private final NotificationBroadcastReceiver notificationBroadcastReceiver;
private final MediaDescriptionAdapter mediaDescriptionAdapter;
private final int notificationId;
private final String channelId;
private final Map<String, NotificationCompat.Action> playbackActions; private final Map<String, NotificationCompat.Action> playbackActions;
private final Map<String, NotificationCompat.Action> customActions; private final Map<String, NotificationCompat.Action> customActions;
private final CustomActionReceiver customActionReceiver;
private Player player; private Player player;
private ControlDispatcher controlDispatcher; private ControlDispatcher controlDispatcher;
...@@ -283,22 +283,22 @@ public class PlayerNotificationManager { ...@@ -283,22 +283,22 @@ public class PlayerNotificationManager {
* {@code channelId} and {@code channelName}. * {@code channelId} and {@code channelName}.
* *
* @param context The {@link Context}. * @param context The {@link Context}.
* @param mediaDescriptionAdapter The {@link MediaDescriptionAdapter}.
* @param channelId The id of the notification channel. * @param channelId The id of the notification channel.
* @param channelName A string resource identifier for the user visible name of the channel. The * @param channelName A string resource identifier for the user visible name of the channel. The
* recommended maximum length is 40 characters; the value may be truncated if it is too long. * recommended maximum length is 40 characters; the value may be truncated if it is too long.
* @param notificationId The id of the notification. * @param notificationId The id of the notification.
* @param mediaDescriptionAdapter The {@link MediaDescriptionAdapter}.
*/ */
public static PlayerNotificationManager createWithNotificationChannel( public static PlayerNotificationManager createWithNotificationChannel(
Context context, Context context,
MediaDescriptionAdapter mediaDescriptionAdapter,
String channelId, String channelId,
@StringRes int channelName, @StringRes int channelName,
int notificationId) { int notificationId,
MediaDescriptionAdapter mediaDescriptionAdapter) {
NotificationUtil.createNotificationChannel( NotificationUtil.createNotificationChannel(
context, channelId, channelName, NotificationUtil.IMPORTANCE_LOW); context, channelId, channelName, NotificationUtil.IMPORTANCE_LOW);
return new PlayerNotificationManager( return new PlayerNotificationManager(
context, mediaDescriptionAdapter, channelId, notificationId); context, channelId, notificationId, mediaDescriptionAdapter);
} }
/** /**
...@@ -306,20 +306,20 @@ public class PlayerNotificationManager { ...@@ -306,20 +306,20 @@ public class PlayerNotificationManager {
* is responsible for creating the notification channel. * is responsible for creating the notification channel.
* *
* @param context The {@link Context}. * @param context The {@link Context}.
* @param mediaDescriptionAdapter The {@link MediaDescriptionAdapter}.
* @param channelId The id of the notification channel. * @param channelId The id of the notification channel.
* @param notificationId The id of the notification. * @param notificationId The id of the notification.
* @param mediaDescriptionAdapter The {@link MediaDescriptionAdapter}.
*/ */
public PlayerNotificationManager( public PlayerNotificationManager(
Context context, Context context,
MediaDescriptionAdapter mediaDescriptionAdapter,
String channelId, String channelId,
int notificationId) { int notificationId,
MediaDescriptionAdapter mediaDescriptionAdapter) {
this( this(
context, context,
mediaDescriptionAdapter,
channelId, channelId,
notificationId, notificationId,
mediaDescriptionAdapter,
/* customActionReceiver= */ null); /* customActionReceiver= */ null);
} }
...@@ -328,22 +328,22 @@ public class PlayerNotificationManager { ...@@ -328,22 +328,22 @@ public class PlayerNotificationManager {
* CustomActionReceiver}. The caller is responsible for creating the notification channel. * CustomActionReceiver}. The caller is responsible for creating the notification channel.
* *
* @param context The {@link Context}. * @param context The {@link Context}.
* @param mediaDescriptionAdapter The {@link MediaDescriptionAdapter}.
* @param channelId The id of the notification channel. * @param channelId The id of the notification channel.
* @param notificationId The id of the notification. * @param notificationId The id of the notification.
* @param mediaDescriptionAdapter The {@link MediaDescriptionAdapter}.
* @param customActionReceiver The {@link CustomActionReceiver}. * @param customActionReceiver The {@link CustomActionReceiver}.
*/ */
public PlayerNotificationManager( public PlayerNotificationManager(
Context context, Context context,
MediaDescriptionAdapter mediaDescriptionAdapter,
String channelId, String channelId,
int notificationId, int notificationId,
MediaDescriptionAdapter mediaDescriptionAdapter,
@Nullable CustomActionReceiver customActionReceiver) { @Nullable CustomActionReceiver customActionReceiver) {
this.context = context.getApplicationContext(); this.context = context.getApplicationContext();
this.mediaDescriptionAdapter = mediaDescriptionAdapter;
this.channelId = channelId; this.channelId = channelId;
this.customActionReceiver = customActionReceiver;
this.notificationId = notificationId; this.notificationId = notificationId;
this.mediaDescriptionAdapter = mediaDescriptionAdapter;
this.customActionReceiver = customActionReceiver;
this.controlDispatcher = new DefaultControlDispatcher(); this.controlDispatcher = new DefaultControlDispatcher();
mainHandler = new Handler(Looper.getMainLooper()); mainHandler = new Handler(Looper.getMainLooper());
notificationManager = NotificationManagerCompat.from(context); notificationManager = NotificationManagerCompat.from(context);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment