From 9de4e5d7ac032f16d4dc5e6e38d0cbca2f589880 Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Fri, 20 Apr 2018 07:41:18 -0700 Subject: [PATCH] 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 --- .../ui/PlayerNotificationManager.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java index 3c71856291..ed523acc25 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java @@ -244,17 +244,17 @@ public class PlayerNotificationManager { private static final long MAX_POSITION_FOR_SEEK_TO_PREVIOUS = 3000; 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 NotificationManagerCompat notificationManager; private final IntentFilter intentFilter; private final Player.EventListener playerListener; private final NotificationBroadcastReceiver notificationBroadcastReceiver; - private final MediaDescriptionAdapter mediaDescriptionAdapter; - private final int notificationId; - private final String channelId; private final Map playbackActions; private final Map customActions; - private final CustomActionReceiver customActionReceiver; private Player player; private ControlDispatcher controlDispatcher; @@ -283,22 +283,22 @@ public class PlayerNotificationManager { * {@code channelId} and {@code channelName}. * * @param context The {@link Context}. - * @param mediaDescriptionAdapter The {@link MediaDescriptionAdapter}. * @param channelId The id of the notification channel. * @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. * @param notificationId The id of the notification. + * @param mediaDescriptionAdapter The {@link MediaDescriptionAdapter}. */ public static PlayerNotificationManager createWithNotificationChannel( Context context, - MediaDescriptionAdapter mediaDescriptionAdapter, String channelId, @StringRes int channelName, - int notificationId) { + int notificationId, + MediaDescriptionAdapter mediaDescriptionAdapter) { NotificationUtil.createNotificationChannel( context, channelId, channelName, NotificationUtil.IMPORTANCE_LOW); return new PlayerNotificationManager( - context, mediaDescriptionAdapter, channelId, notificationId); + context, channelId, notificationId, mediaDescriptionAdapter); } /** @@ -306,20 +306,20 @@ public class PlayerNotificationManager { * is responsible for creating the notification channel. * * @param context The {@link Context}. - * @param mediaDescriptionAdapter The {@link MediaDescriptionAdapter}. * @param channelId The id of the notification channel. * @param notificationId The id of the notification. + * @param mediaDescriptionAdapter The {@link MediaDescriptionAdapter}. */ public PlayerNotificationManager( Context context, - MediaDescriptionAdapter mediaDescriptionAdapter, String channelId, - int notificationId) { + int notificationId, + MediaDescriptionAdapter mediaDescriptionAdapter) { this( context, - mediaDescriptionAdapter, channelId, notificationId, + mediaDescriptionAdapter, /* customActionReceiver= */ null); } @@ -328,22 +328,22 @@ public class PlayerNotificationManager { * CustomActionReceiver}. The caller is responsible for creating the notification channel. * * @param context The {@link Context}. - * @param mediaDescriptionAdapter The {@link MediaDescriptionAdapter}. * @param channelId The id of the notification channel. * @param notificationId The id of the notification. + * @param mediaDescriptionAdapter The {@link MediaDescriptionAdapter}. * @param customActionReceiver The {@link CustomActionReceiver}. */ public PlayerNotificationManager( Context context, - MediaDescriptionAdapter mediaDescriptionAdapter, String channelId, int notificationId, + MediaDescriptionAdapter mediaDescriptionAdapter, @Nullable CustomActionReceiver customActionReceiver) { this.context = context.getApplicationContext(); - this.mediaDescriptionAdapter = mediaDescriptionAdapter; this.channelId = channelId; - this.customActionReceiver = customActionReceiver; this.notificationId = notificationId; + this.mediaDescriptionAdapter = mediaDescriptionAdapter; + this.customActionReceiver = customActionReceiver; this.controlDispatcher = new DefaultControlDispatcher(); mainHandler = new Handler(Looper.getMainLooper()); notificationManager = NotificationManagerCompat.from(context);