kopia lustrzana https://github.com/TeamNewPipe/NewPipe
Use List.of().
rodzic
c53143ef4f
commit
ca26fcb0eb
|
@ -14,7 +14,6 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|||
import org.schabi.newpipe.R;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
// See https://stackoverflow.com/questions/56849221#57997489
|
||||
|
@ -27,7 +26,7 @@ public final class FlingBehavior extends AppBarLayout.Behavior {
|
|||
|
||||
private boolean allowScroll = true;
|
||||
private final Rect globalRect = new Rect();
|
||||
private final List<Integer> skipInterceptionOfElements = Arrays.asList(
|
||||
private final List<Integer> skipInterceptionOfElements = List.of(
|
||||
R.id.itemsListPanel, R.id.playbackSeekBar,
|
||||
R.id.playPauseButton, R.id.playPreviousButton, R.id.playNextButton);
|
||||
|
||||
|
@ -67,7 +66,7 @@ public final class FlingBehavior extends AppBarLayout.Behavior {
|
|||
public boolean onInterceptTouchEvent(@NonNull final CoordinatorLayout parent,
|
||||
@NonNull final AppBarLayout child,
|
||||
@NonNull final MotionEvent ev) {
|
||||
for (final Integer element : skipInterceptionOfElements) {
|
||||
for (final int element : skipInterceptionOfElements) {
|
||||
final View view = child.findViewById(element);
|
||||
if (view != null) {
|
||||
final boolean visible = view.getGlobalVisibleRect(globalRect);
|
||||
|
|
|
@ -27,9 +27,8 @@ import org.schabi.newpipe.util.StateSaver;
|
|||
import java.io.IOException;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.net.SocketException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.reactivex.rxjava3.exceptions.CompositeException;
|
||||
import io.reactivex.rxjava3.exceptions.MissingBackpressureException;
|
||||
|
@ -140,7 +139,7 @@ public class App extends Application {
|
|||
if (throwable instanceof UndeliverableException) {
|
||||
// As UndeliverableException is a wrapper,
|
||||
// get the cause of it to get the "real" exception
|
||||
actualThrowable = throwable.getCause();
|
||||
actualThrowable = Objects.requireNonNull(throwable.getCause());
|
||||
} else {
|
||||
actualThrowable = throwable;
|
||||
}
|
||||
|
@ -149,7 +148,7 @@ public class App extends Application {
|
|||
if (actualThrowable instanceof CompositeException) {
|
||||
errors = ((CompositeException) actualThrowable).getExceptions();
|
||||
} else {
|
||||
errors = Collections.singletonList(actualThrowable);
|
||||
errors = List.of(actualThrowable);
|
||||
}
|
||||
|
||||
for (final Throwable error : errors) {
|
||||
|
@ -213,41 +212,37 @@ public class App extends Application {
|
|||
private void initNotificationChannels() {
|
||||
// Keep the importance below DEFAULT to avoid making noise on every notification update for
|
||||
// the main and update channels
|
||||
final List<NotificationChannelCompat> notificationChannelCompats = new ArrayList<>();
|
||||
notificationChannelCompats.add(new NotificationChannelCompat
|
||||
.Builder(getString(R.string.notification_channel_id),
|
||||
final List<NotificationChannelCompat> notificationChannelCompats = List.of(
|
||||
new NotificationChannelCompat.Builder(getString(R.string.notification_channel_id),
|
||||
NotificationManagerCompat.IMPORTANCE_LOW)
|
||||
.setName(getString(R.string.notification_channel_name))
|
||||
.setDescription(getString(R.string.notification_channel_description))
|
||||
.build());
|
||||
|
||||
notificationChannelCompats.add(new NotificationChannelCompat
|
||||
.Builder(getString(R.string.app_update_notification_channel_id),
|
||||
.setName(getString(R.string.notification_channel_name))
|
||||
.setDescription(getString(R.string.notification_channel_description))
|
||||
.build(),
|
||||
new NotificationChannelCompat
|
||||
.Builder(getString(R.string.app_update_notification_channel_id),
|
||||
NotificationManagerCompat.IMPORTANCE_LOW)
|
||||
.setName(getString(R.string.app_update_notification_channel_name))
|
||||
.setDescription(getString(R.string.app_update_notification_channel_description))
|
||||
.build());
|
||||
|
||||
notificationChannelCompats.add(new NotificationChannelCompat
|
||||
.Builder(getString(R.string.hash_channel_id),
|
||||
.setName(getString(R.string.app_update_notification_channel_name))
|
||||
.setDescription(
|
||||
getString(R.string.app_update_notification_channel_description))
|
||||
.build(),
|
||||
new NotificationChannelCompat.Builder(getString(R.string.hash_channel_id),
|
||||
NotificationManagerCompat.IMPORTANCE_HIGH)
|
||||
.setName(getString(R.string.hash_channel_name))
|
||||
.setDescription(getString(R.string.hash_channel_description))
|
||||
.build());
|
||||
|
||||
notificationChannelCompats.add(new NotificationChannelCompat
|
||||
.Builder(getString(R.string.error_report_channel_id),
|
||||
.setName(getString(R.string.hash_channel_name))
|
||||
.setDescription(getString(R.string.hash_channel_description))
|
||||
.build(),
|
||||
new NotificationChannelCompat.Builder(getString(R.string.error_report_channel_id),
|
||||
NotificationManagerCompat.IMPORTANCE_LOW)
|
||||
.setName(getString(R.string.error_report_channel_name))
|
||||
.setDescription(getString(R.string.error_report_channel_description))
|
||||
.build());
|
||||
|
||||
notificationChannelCompats.add(new NotificationChannelCompat
|
||||
.Builder(getString(R.string.streams_notification_channel_id),
|
||||
NotificationManagerCompat.IMPORTANCE_DEFAULT)
|
||||
.setName(getString(R.string.streams_notification_channel_name))
|
||||
.setDescription(getString(R.string.streams_notification_channel_description))
|
||||
.build());
|
||||
.setName(getString(R.string.error_report_channel_name))
|
||||
.setDescription(getString(R.string.error_report_channel_description))
|
||||
.build(),
|
||||
new NotificationChannelCompat
|
||||
.Builder(getString(R.string.streams_notification_channel_id),
|
||||
NotificationManagerCompat.IMPORTANCE_DEFAULT)
|
||||
.setName(getString(R.string.streams_notification_channel_name))
|
||||
.setDescription(
|
||||
getString(R.string.streams_notification_channel_description))
|
||||
.build()
|
||||
);
|
||||
|
||||
final NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
|
||||
notificationManager.createNotificationChannelsCompat(notificationChannelCompats);
|
||||
|
|
|
@ -16,7 +16,7 @@ import org.schabi.newpipe.player.playqueue.PlayQueueItem;
|
|||
import org.schabi.newpipe.util.NavigationHelper;
|
||||
import org.schabi.newpipe.util.SparseItemUtil;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public final class QueueItemMenuUtil {
|
||||
private QueueItemMenuUtil() {
|
||||
|
@ -53,7 +53,7 @@ public final class QueueItemMenuUtil {
|
|||
case R.id.menu_item_append_playlist:
|
||||
PlaylistDialog.createCorrespondingDialog(
|
||||
context,
|
||||
Collections.singletonList(new StreamEntity(item)),
|
||||
List.of(new StreamEntity(item)),
|
||||
dialog -> dialog.show(
|
||||
fragmentManager,
|
||||
"QueueItemMenuUtil@append_playlist"
|
||||
|
|
|
@ -81,7 +81,6 @@ import org.schabi.newpipe.views.FocusOverlayView;
|
|||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import icepick.Icepick;
|
||||
|
@ -649,7 +648,7 @@ public class RouterActivity extends AppCompatActivity {
|
|||
.subscribe(
|
||||
info -> PlaylistDialog.createCorrespondingDialog(
|
||||
getThemeWrapperContext(),
|
||||
Collections.singletonList(new StreamEntity(info)),
|
||||
List.of(new StreamEntity(info)),
|
||||
playlistDialog -> {
|
||||
playlistDialog.setOnDismissListener(dialog -> finish());
|
||||
|
||||
|
|
|
@ -114,7 +114,6 @@ import org.schabi.newpipe.util.external_communication.KoreUtils;
|
|||
import org.schabi.newpipe.util.external_communication.ShareUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -453,7 +452,7 @@ public final class VideoDetailFragment
|
|||
disposables.add(
|
||||
PlaylistDialog.createCorrespondingDialog(
|
||||
getContext(),
|
||||
Collections.singletonList(new StreamEntity(currentInfo)),
|
||||
List.of(new StreamEntity(currentInfo)),
|
||||
dialog -> dialog.show(getFM(), TAG)
|
||||
)
|
||||
);
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.schabi.newpipe.util.NavigationHelper;
|
|||
import org.schabi.newpipe.util.external_communication.KoreUtils;
|
||||
import org.schabi.newpipe.util.external_communication.ShareUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
|
||||
|
@ -89,7 +89,7 @@ public enum StreamDialogDefaultEntry {
|
|||
APPEND_PLAYLIST(R.string.add_to_playlist, (fragment, item) ->
|
||||
PlaylistDialog.createCorrespondingDialog(
|
||||
fragment.getContext(),
|
||||
Collections.singletonList(new StreamEntity(item)),
|
||||
List.of(new StreamEntity(item)),
|
||||
dialog -> dialog.show(
|
||||
fragment.getParentFragmentManager(),
|
||||
"StreamDialogEntry@"
|
||||
|
|
|
@ -14,7 +14,6 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
|||
|
||||
import org.schabi.newpipe.R;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class CustomBottomSheetBehavior extends BottomSheetBehavior<FrameLayout> {
|
||||
|
@ -25,7 +24,7 @@ public class CustomBottomSheetBehavior extends BottomSheetBehavior<FrameLayout>
|
|||
|
||||
Rect globalRect = new Rect();
|
||||
private boolean skippingInterception = false;
|
||||
private final List<Integer> skipInterceptionOfElements = Arrays.asList(
|
||||
private final List<Integer> skipInterceptionOfElements = List.of(
|
||||
R.id.detail_content_root_layout, R.id.relatedItemsLayout,
|
||||
R.id.itemsListPanel, R.id.view_pager, R.id.tab_layout, R.id.bottomControls,
|
||||
R.id.playPauseButton, R.id.playPreviousButton, R.id.playNextButton);
|
||||
|
@ -57,7 +56,7 @@ public class CustomBottomSheetBehavior extends BottomSheetBehavior<FrameLayout>
|
|||
if (getState() == BottomSheetBehavior.STATE_EXPANDED
|
||||
&& event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
// Without overriding scrolling will not work when user touches these elements
|
||||
for (final Integer element : skipInterceptionOfElements) {
|
||||
for (final int element : skipInterceptionOfElements) {
|
||||
final View view = child.findViewById(element);
|
||||
if (view != null) {
|
||||
final boolean visible = view.getGlobalVisibleRect(globalRect);
|
||||
|
|
|
@ -16,7 +16,7 @@ import org.schabi.newpipe.player.mediaitem.ExceptionTag;
|
|||
import org.schabi.newpipe.player.playqueue.PlayQueueItem;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
@ -56,9 +56,7 @@ public class FailedMediaSource extends BaseMediaSource implements ManagedMediaSo
|
|||
this.playQueueItem = playQueueItem;
|
||||
this.error = error;
|
||||
this.retryTimestamp = retryTimestamp;
|
||||
this.mediaItem = ExceptionTag
|
||||
.of(playQueueItem, Collections.singletonList(error))
|
||||
.withExtras(this)
|
||||
this.mediaItem = ExceptionTag.of(playQueueItem, List.of(error)).withExtras(this)
|
||||
.asMediaItem();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.schabi.newpipe.player.playqueue.events.SelectEvent;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
@ -264,7 +263,7 @@ public abstract class PlayQueue implements Serializable {
|
|||
* @param items {@link PlayQueueItem}s to append
|
||||
*/
|
||||
public synchronized void append(@NonNull final PlayQueueItem... items) {
|
||||
append(Arrays.asList(items));
|
||||
append(List.of(items));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,20 +4,19 @@ import org.schabi.newpipe.extractor.stream.StreamInfo;
|
|||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public final class SinglePlayQueue extends PlayQueue {
|
||||
public SinglePlayQueue(final StreamInfoItem item) {
|
||||
super(0, Collections.singletonList(new PlayQueueItem(item)));
|
||||
super(0, List.of(new PlayQueueItem(item)));
|
||||
}
|
||||
|
||||
public SinglePlayQueue(final StreamInfo info) {
|
||||
super(0, Collections.singletonList(new PlayQueueItem(info)));
|
||||
super(0, List.of(new PlayQueueItem(info)));
|
||||
}
|
||||
|
||||
public SinglePlayQueue(final StreamInfo info, final long startPosition) {
|
||||
super(0, Collections.singletonList(new PlayQueueItem(info)));
|
||||
super(0, List.of(new PlayQueueItem(info)));
|
||||
getItem().setRecoveryPosition(startPosition);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@ package org.schabi.newpipe.settings.preferencesearch;
|
|||
import androidx.preference.PreferenceCategory;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
@ -12,9 +10,9 @@ import java.util.stream.Stream;
|
|||
public class PreferenceSearchConfiguration {
|
||||
private PreferenceSearchFunction searcher = new PreferenceFuzzySearchFunction();
|
||||
|
||||
private final List<String> parserIgnoreElements = Collections.singletonList(
|
||||
PreferenceCategory.class.getSimpleName());
|
||||
private final List<String> parserContainerElements = Arrays.asList(
|
||||
private final List<String> parserIgnoreElements = List.of(PreferenceCategory.class
|
||||
.getSimpleName());
|
||||
private final List<String> parserContainerElements = List.of(
|
||||
PreferenceCategory.class.getSimpleName(),
|
||||
PreferenceScreen.class.getSimpleName());
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.schabi.newpipe.settings.preferencesearch;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.XmlRes;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -92,11 +91,7 @@ public class PreferenceSearchItem {
|
|||
}
|
||||
|
||||
public List<String> getAllRelevantSearchFields() {
|
||||
return Arrays.asList(
|
||||
getTitle(),
|
||||
getSummary(),
|
||||
getEntries(),
|
||||
getBreadcrumbs());
|
||||
return List.of(getTitle(), getSummary(), getEntries(), getBreadcrumbs());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
|
@ -10,8 +10,6 @@ import com.grack.nanojson.JsonStringWriter;
|
|||
import com.grack.nanojson.JsonWriter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -20,11 +18,9 @@ import java.util.List;
|
|||
public final class TabsJsonHelper {
|
||||
private static final String JSON_TABS_ARRAY_KEY = "tabs";
|
||||
|
||||
private static final List<Tab> FALLBACK_INITIAL_TABS_LIST = Collections.unmodifiableList(
|
||||
Arrays.asList(
|
||||
Tab.Type.DEFAULT_KIOSK.getTab(),
|
||||
Tab.Type.SUBSCRIPTIONS.getTab(),
|
||||
Tab.Type.BOOKMARKS.getTab()));
|
||||
private static final List<Tab> FALLBACK_INITIAL_TABS_LIST = List.of(
|
||||
Tab.Type.DEFAULT_KIOSK.getTab(), Tab.Type.SUBSCRIPTIONS.getTab(),
|
||||
Tab.Type.BOOKMARKS.getTab());
|
||||
|
||||
private TabsJsonHelper() { }
|
||||
|
||||
|
|
|
@ -31,14 +31,14 @@ import java.util.stream.Collectors;
|
|||
public final class ListHelper {
|
||||
// Video format in order of quality. 0=lowest quality, n=highest quality
|
||||
private static final List<MediaFormat> VIDEO_FORMAT_QUALITY_RANKING =
|
||||
Arrays.asList(MediaFormat.v3GPP, MediaFormat.WEBM, MediaFormat.MPEG_4);
|
||||
List.of(MediaFormat.v3GPP, MediaFormat.WEBM, MediaFormat.MPEG_4);
|
||||
|
||||
// Audio format in order of quality. 0=lowest quality, n=highest quality
|
||||
private static final List<MediaFormat> AUDIO_FORMAT_QUALITY_RANKING =
|
||||
Arrays.asList(MediaFormat.MP3, MediaFormat.WEBMA, MediaFormat.M4A);
|
||||
List.of(MediaFormat.MP3, MediaFormat.WEBMA, MediaFormat.M4A);
|
||||
// Audio format in order of efficiency. 0=most efficient, n=least efficient
|
||||
private static final List<MediaFormat> AUDIO_FORMAT_EFFICIENCY_RANKING =
|
||||
Arrays.asList(MediaFormat.WEBMA, MediaFormat.M4A, MediaFormat.MP3);
|
||||
List.of(MediaFormat.WEBMA, MediaFormat.M4A, MediaFormat.MP3);
|
||||
// Use a Set for better performance
|
||||
private static final Set<String> HIGH_RESOLUTION_LIST = Set.of("1440p", "2160p");
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.schabi.newpipe.extractor.ServiceList;
|
|||
import org.schabi.newpipe.extractor.services.peertube.PeertubeInstance;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public final class PeertubeHelper {
|
||||
|
@ -29,7 +28,7 @@ public final class PeertubeHelper {
|
|||
final String savedInstanceListKey = context.getString(R.string.peertube_instance_list_key);
|
||||
final String savedJson = sharedPreferences.getString(savedInstanceListKey, null);
|
||||
if (null == savedJson) {
|
||||
return Collections.singletonList(getCurrentInstance());
|
||||
return List.of(getCurrentInstance());
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -45,9 +44,8 @@ public final class PeertubeHelper {
|
|||
}
|
||||
return result;
|
||||
} catch (final JsonParserException e) {
|
||||
return Collections.singletonList(getCurrentInstance());
|
||||
return List.of(getCurrentInstance());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static PeertubeInstance selectInstance(final PeertubeInstance instance,
|
||||
|
|
|
@ -153,7 +153,7 @@ public class PlayQueueTest {
|
|||
@Test
|
||||
public void itemsAreNotCloned() {
|
||||
final PlayQueueItem item = makeItemWithUrl("A url");
|
||||
final PlayQueue playQueue = makePlayQueue(0, Collections.singletonList(item));
|
||||
final PlayQueue playQueue = makePlayQueue(0, List.of(item));
|
||||
|
||||
// make sure that items are not cloned when added to the queue
|
||||
assertSame(playQueue.getItem(), item);
|
||||
|
|
|
@ -6,7 +6,6 @@ import org.schabi.newpipe.extractor.stream.AudioStream;
|
|||
import org.schabi.newpipe.extractor.stream.VideoStream;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
@ -18,7 +17,7 @@ import androidx.annotation.Nullable;
|
|||
|
||||
public class ListHelperTest {
|
||||
private static final String BEST_RESOLUTION_KEY = "best_resolution";
|
||||
private static final List<AudioStream> AUDIO_STREAMS_TEST_LIST = Arrays.asList(
|
||||
private static final List<AudioStream> AUDIO_STREAMS_TEST_LIST = List.of(
|
||||
generateAudioStream("m4a-128-1", MediaFormat.M4A, 128),
|
||||
generateAudioStream("webma-192", MediaFormat.WEBMA, 192),
|
||||
generateAudioStream("mp3-64", MediaFormat.MP3, 64),
|
||||
|
@ -30,7 +29,7 @@ public class ListHelperTest {
|
|||
generateAudioStream("mp3-192", MediaFormat.MP3, 192),
|
||||
generateAudioStream("webma-320", MediaFormat.WEBMA, 320));
|
||||
|
||||
private static final List<VideoStream> VIDEO_STREAMS_TEST_LIST = Arrays.asList(
|
||||
private static final List<VideoStream> VIDEO_STREAMS_TEST_LIST = List.of(
|
||||
generateVideoStream("mpeg_4-720", MediaFormat.MPEG_4, "720p", false),
|
||||
generateVideoStream("v3gpp-240", MediaFormat.v3GPP, "240p", false),
|
||||
generateVideoStream("webm-480", MediaFormat.WEBM, "480p", false),
|
||||
|
@ -38,7 +37,7 @@ public class ListHelperTest {
|
|||
generateVideoStream("mpeg_4-360", MediaFormat.MPEG_4, "360p", false),
|
||||
generateVideoStream("webm-360", MediaFormat.WEBM, "360p", false));
|
||||
|
||||
private static final List<VideoStream> VIDEO_ONLY_STREAMS_TEST_LIST = Arrays.asList(
|
||||
private static final List<VideoStream> VIDEO_ONLY_STREAMS_TEST_LIST = List.of(
|
||||
generateVideoStream("mpeg_4-720-1", MediaFormat.MPEG_4, "720p", true),
|
||||
generateVideoStream("mpeg_4-720-2", MediaFormat.MPEG_4, "720p", true),
|
||||
generateVideoStream("mpeg_4-2160", MediaFormat.MPEG_4, "2160p", true),
|
||||
|
@ -54,7 +53,7 @@ public class ListHelperTest {
|
|||
List<VideoStream> result = ListHelper.getSortedStreamVideosList(MediaFormat.MPEG_4, true,
|
||||
VIDEO_STREAMS_TEST_LIST, VIDEO_ONLY_STREAMS_TEST_LIST, true, false);
|
||||
|
||||
List<String> expected = Arrays.asList("144p", "240p", "360p", "480p", "720p", "720p60",
|
||||
List<String> expected = List.of("144p", "240p", "360p", "480p", "720p", "720p60",
|
||||
"1080p", "1080p60", "1440p60", "2160p", "2160p60");
|
||||
|
||||
assertEquals(expected.size(), result.size());
|
||||
|
@ -69,7 +68,7 @@ public class ListHelperTest {
|
|||
|
||||
result = ListHelper.getSortedStreamVideosList(MediaFormat.MPEG_4, true,
|
||||
VIDEO_STREAMS_TEST_LIST, VIDEO_ONLY_STREAMS_TEST_LIST, false, false);
|
||||
expected = Arrays.asList("2160p60", "2160p", "1440p60", "1080p60", "1080p", "720p60",
|
||||
expected = List.of("2160p60", "2160p", "1440p60", "1080p60", "1080p", "720p60",
|
||||
"720p", "480p", "360p", "240p", "144p");
|
||||
assertEquals(expected.size(), result.size());
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
|
@ -83,7 +82,7 @@ public class ListHelperTest {
|
|||
null, VIDEO_ONLY_STREAMS_TEST_LIST, true, true);
|
||||
|
||||
List<String> expected =
|
||||
Arrays.asList("720p", "720p60", "1080p", "1080p60", "1440p60", "2160p", "2160p60");
|
||||
List.of("720p", "720p60", "1080p", "1080p60", "1440p60", "2160p", "2160p60");
|
||||
|
||||
assertEquals(expected.size(), result.size());
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
|
@ -97,7 +96,7 @@ public class ListHelperTest {
|
|||
|
||||
result = ListHelper.getSortedStreamVideosList(MediaFormat.MPEG_4, true,
|
||||
VIDEO_STREAMS_TEST_LIST, null, false, true);
|
||||
expected = Arrays.asList("720p", "480p", "360p", "240p", "144p");
|
||||
expected = List.of("720p", "480p", "360p", "240p", "144p");
|
||||
assertEquals(expected.size(), result.size());
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
assertEquals(expected.get(i), result.get(i).getResolution());
|
||||
|
@ -110,10 +109,10 @@ public class ListHelperTest {
|
|||
|
||||
result = ListHelper.getSortedStreamVideosList(MediaFormat.MPEG_4, true,
|
||||
VIDEO_STREAMS_TEST_LIST, VIDEO_ONLY_STREAMS_TEST_LIST, true, true);
|
||||
expected = Arrays.asList("144p", "240p", "360p", "480p", "720p", "720p60",
|
||||
expected = List.of("144p", "240p", "360p", "480p", "720p", "720p60",
|
||||
"1080p", "1080p60", "1440p60", "2160p", "2160p60");
|
||||
final List<String> expectedVideoOnly =
|
||||
Arrays.asList("720p", "720p60", "1080p", "1080p60", "1440p60", "2160p", "2160p60");
|
||||
List.of("720p", "720p60", "1080p", "1080p60", "1440p60", "2160p", "2160p60");
|
||||
|
||||
assertEquals(expected.size(), result.size());
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
|
@ -131,7 +130,7 @@ public class ListHelperTest {
|
|||
|
||||
final List<VideoStream> result = ListHelper.getSortedStreamVideosList(MediaFormat.MPEG_4,
|
||||
false, VIDEO_STREAMS_TEST_LIST, VIDEO_ONLY_STREAMS_TEST_LIST, false, false);
|
||||
final List<String> expected = Arrays.asList(
|
||||
final List<String> expected = List.of(
|
||||
"1080p60", "1080p", "720p60", "720p", "480p", "360p", "240p", "144p");
|
||||
assertEquals(expected.size(), result.size());
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
|
@ -141,7 +140,7 @@ public class ListHelperTest {
|
|||
|
||||
@Test
|
||||
public void getDefaultResolutionTest() {
|
||||
final List<VideoStream> testList = Arrays.asList(
|
||||
final List<VideoStream> testList = List.of(
|
||||
generateVideoStream("mpeg_4-720", MediaFormat.MPEG_4, "720p", false),
|
||||
generateVideoStream("v3gpp-240", MediaFormat.v3GPP, "240p", false),
|
||||
generateVideoStream("webm-480", MediaFormat.WEBM, "480p", false),
|
||||
|
@ -223,7 +222,7 @@ public class ListHelperTest {
|
|||
// Doesn't contain the preferred format //
|
||||
////////////////////////////////////////
|
||||
|
||||
List<AudioStream> testList = Arrays.asList(
|
||||
List<AudioStream> testList = List.of(
|
||||
generateAudioStream("m4a-128", MediaFormat.M4A, 128),
|
||||
generateAudioStream("webma-192", MediaFormat.WEBMA, 192));
|
||||
// List doesn't contains this format
|
||||
|
@ -237,7 +236,7 @@ public class ListHelperTest {
|
|||
// Multiple not-preferred-formats and equal bitrates //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
testList = new ArrayList<>(Arrays.asList(
|
||||
testList = new ArrayList<>(List.of(
|
||||
generateAudioStream("webma-192-1", MediaFormat.WEBMA, 192),
|
||||
generateAudioStream("m4a-192-1", MediaFormat.M4A, 192),
|
||||
generateAudioStream("webma-192-2", MediaFormat.WEBMA, 192),
|
||||
|
@ -290,7 +289,7 @@ public class ListHelperTest {
|
|||
// Doesn't contain the preferred format //
|
||||
////////////////////////////////////////
|
||||
|
||||
List<AudioStream> testList = new ArrayList<>(Arrays.asList(
|
||||
List<AudioStream> testList = new ArrayList<>(List.of(
|
||||
generateAudioStream("m4a-128", MediaFormat.M4A, 128),
|
||||
generateAudioStream("webma-192-1", MediaFormat.WEBMA, 192)));
|
||||
// List doesn't contains this format
|
||||
|
@ -310,7 +309,7 @@ public class ListHelperTest {
|
|||
// Multiple not-preferred-formats and equal bitrates //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
testList = new ArrayList<>(Arrays.asList(
|
||||
testList = new ArrayList<>(List.of(
|
||||
generateAudioStream("webma-192-1", MediaFormat.WEBMA, 192),
|
||||
generateAudioStream("m4a-192-1", MediaFormat.M4A, 192),
|
||||
generateAudioStream("webma-256", MediaFormat.WEBMA, 256),
|
||||
|
@ -337,7 +336,7 @@ public class ListHelperTest {
|
|||
|
||||
@Test
|
||||
public void getVideoDefaultStreamIndexCombinations() {
|
||||
final List<VideoStream> testList = Arrays.asList(
|
||||
final List<VideoStream> testList = List.of(
|
||||
generateVideoStream("mpeg_4-1080", MediaFormat.MPEG_4, "1080p", false),
|
||||
generateVideoStream("mpeg_4-720_60", MediaFormat.MPEG_4, "720p60", false),
|
||||
generateVideoStream("mpeg_4-720", MediaFormat.MPEG_4, "720p", false),
|
||||
|
|
Ładowanie…
Reference in New Issue