Commit 84eaa580 by ibaker Committed by Ian Baker

Switch the main demo app to use Guava's Preconditions

ExoPlayer's internal Assertions class will not be part of the stable
API.

PiperOrigin-RevId: 437008634
parent 40c8dae5
...@@ -15,8 +15,7 @@ ...@@ -15,8 +15,7 @@
*/ */
package com.google.android.exoplayer2.demo; package com.google.android.exoplayer2.demo;
import static com.google.android.exoplayer2.util.Assertions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.android.exoplayer2.util.Assertions.checkStateNotNull;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
...@@ -85,8 +84,7 @@ public class DownloadTracker { ...@@ -85,8 +84,7 @@ public class DownloadTracker {
} }
public void addListener(Listener listener) { public void addListener(Listener listener) {
checkNotNull(listener); listeners.add(checkNotNull(listener));
listeners.add(listener);
} }
public void removeListener(Listener listener) { public void removeListener(Listener listener) {
...@@ -402,7 +400,7 @@ public class DownloadTracker { ...@@ -402,7 +400,7 @@ public class DownloadTracker {
if (drmSessionException != null) { if (drmSessionException != null) {
dialogHelper.onOfflineLicenseFetchedError(drmSessionException); dialogHelper.onOfflineLicenseFetchedError(drmSessionException);
} else { } else {
dialogHelper.onOfflineLicenseFetched(downloadHelper, checkStateNotNull(keySetId)); dialogHelper.onOfflineLicenseFetched(downloadHelper, checkNotNull(keySetId));
} }
} }
} }
......
...@@ -15,8 +15,9 @@ ...@@ -15,8 +15,9 @@
*/ */
package com.google.android.exoplayer2.demo; package com.google.android.exoplayer2.demo;
import static com.google.android.exoplayer2.util.Assertions.checkNotNull; import static com.google.common.base.Preconditions.checkArgument;
import static com.google.android.exoplayer2.util.Assertions.checkState; import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
...@@ -26,7 +27,6 @@ import com.google.android.exoplayer2.MediaItem; ...@@ -26,7 +27,6 @@ import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.MediaItem.ClippingConfiguration; import com.google.android.exoplayer2.MediaItem.ClippingConfiguration;
import com.google.android.exoplayer2.MediaItem.SubtitleConfiguration; import com.google.android.exoplayer2.MediaItem.SubtitleConfiguration;
import com.google.android.exoplayer2.MediaMetadata; import com.google.android.exoplayer2.MediaMetadata;
import com.google.android.exoplayer2.util.Assertions;
import com.google.android.exoplayer2.util.Util; import com.google.android.exoplayer2.util.Util;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -87,7 +87,7 @@ public class IntentUtil { ...@@ -87,7 +87,7 @@ public class IntentUtil {
/** Populates the intent with the given list of {@link MediaItem media items}. */ /** Populates the intent with the given list of {@link MediaItem media items}. */
public static void addToIntent(List<MediaItem> mediaItems, Intent intent) { public static void addToIntent(List<MediaItem> mediaItems, Intent intent) {
Assertions.checkArgument(!mediaItems.isEmpty()); checkArgument(!mediaItems.isEmpty());
if (mediaItems.size() == 1) { if (mediaItems.size() == 1) {
MediaItem mediaItem = mediaItems.get(0); MediaItem mediaItem = mediaItems.get(0);
MediaItem.LocalConfiguration localConfiguration = checkNotNull(mediaItem.localConfiguration); MediaItem.LocalConfiguration localConfiguration = checkNotNull(mediaItem.localConfiguration);
...@@ -242,7 +242,7 @@ public class IntentUtil { ...@@ -242,7 +242,7 @@ public class IntentUtil {
drmConfiguration.forcedSessionTrackTypes; drmConfiguration.forcedSessionTrackTypes;
if (!forcedDrmSessionTrackTypes.isEmpty()) { if (!forcedDrmSessionTrackTypes.isEmpty()) {
// Only video and audio together are supported. // Only video and audio together are supported.
Assertions.checkState( checkState(
forcedDrmSessionTrackTypes.size() == 2 forcedDrmSessionTrackTypes.size() == 2
&& forcedDrmSessionTrackTypes.contains(C.TRACK_TYPE_VIDEO) && forcedDrmSessionTrackTypes.contains(C.TRACK_TYPE_VIDEO)
&& forcedDrmSessionTrackTypes.contains(C.TRACK_TYPE_AUDIO)); && forcedDrmSessionTrackTypes.contains(C.TRACK_TYPE_AUDIO));
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
*/ */
package com.google.android.exoplayer2.demo; package com.google.android.exoplayer2.demo;
import static com.google.android.exoplayer2.util.Assertions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static com.google.android.exoplayer2.util.Assertions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.android.exoplayer2.util.Assertions.checkState; import static com.google.common.base.Preconditions.checkState;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
......
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