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
This commit is contained in:
parent
2a363ac3fc
commit
a11adbc08c
@ -15,8 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.demo.main;
|
package androidx.media3.demo.main;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Assertions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static androidx.media3.common.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 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
|||||||
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 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.demo.main;
|
package androidx.media3.demo.main;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Assertions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static androidx.media3.common.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 androidx.media3.common.MediaItem;
|
|||||||
import androidx.media3.common.MediaItem.ClippingConfiguration;
|
import androidx.media3.common.MediaItem.ClippingConfiguration;
|
||||||
import androidx.media3.common.MediaItem.SubtitleConfiguration;
|
import androidx.media3.common.MediaItem.SubtitleConfiguration;
|
||||||
import androidx.media3.common.MediaMetadata;
|
import androidx.media3.common.MediaMetadata;
|
||||||
import androidx.media3.common.util.Assertions;
|
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -86,7 +86,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);
|
||||||
@ -241,7 +241,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 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.demo.main;
|
package androidx.media3.demo.main;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Assertions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static androidx.media3.common.util.Assertions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static androidx.media3.common.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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user