mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-22 19:12:45 +01:00
code cleanup
mainly removes throw statements automated using Android Studio, staged by hand BUILD SUCCESSFUL in 52s 39 actionable tasks: 37 executed, 2 up-to-date
This commit is contained in:
parent
784e01347c
commit
27fbe69033
@ -106,7 +106,7 @@ public class App extends Application {
|
||||
// https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling
|
||||
RxJavaPlugins.setErrorHandler(new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(@NonNull Throwable throwable) throws Exception {
|
||||
public void accept(@NonNull Throwable throwable) {
|
||||
Log.e(TAG, "RxJavaPlugins.ErrorHandler called with -> : " +
|
||||
"throwable = [" + throwable.getClass().getName() + "]");
|
||||
|
||||
|
@ -58,7 +58,7 @@ public abstract class PlaylistDialog extends DialogFragment implements StateSave
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readFrom(@NonNull Queue<Object> savedObjects) throws Exception {
|
||||
public void readFrom(@NonNull Queue<Object> savedObjects) {
|
||||
streamEntities = (List<StreamEntity>) savedObjects.poll();
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ public class SubscriptionService {
|
||||
public Completable updateChannelInfo(final ChannelInfo info) {
|
||||
final Function<List<SubscriptionEntity>, CompletableSource> update = new Function<List<SubscriptionEntity>, CompletableSource>() {
|
||||
@Override
|
||||
public CompletableSource apply(@NonNull List<SubscriptionEntity> subscriptionEntities) throws Exception {
|
||||
public CompletableSource apply(@NonNull List<SubscriptionEntity> subscriptionEntities) {
|
||||
if (DEBUG) Log.d(TAG, "updateChannelInfo() called with: subscriptionEntities = [" + subscriptionEntities + "]");
|
||||
if (subscriptionEntities.size() == 1) {
|
||||
SubscriptionEntity subscription = subscriptionEntities.get(0);
|
||||
|
@ -79,7 +79,7 @@ public class PlayQueueNavigator implements MediaSessionConnector.QueueNavigator
|
||||
|
||||
private void publishFloatingQueueWindow() {
|
||||
if (callback.getQueueSize() == 0) {
|
||||
mediaSession.setQueue(Collections.<MediaSessionCompat.QueueItem>emptyList());
|
||||
mediaSession.setQueue(Collections.emptyList());
|
||||
activeQueueItemId = MediaSessionCompat.QueueItem.UNKNOWN_ID;
|
||||
return;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class CustomTrackSelector extends DefaultTrackSelector {
|
||||
/** @see DefaultTrackSelector#selectTextTrack(TrackGroupArray, int[][], Parameters) */
|
||||
@Override
|
||||
protected TrackSelection selectTextTrack(TrackGroupArray groups, int[][] formatSupport,
|
||||
Parameters params) throws ExoPlaybackException {
|
||||
Parameters params) {
|
||||
TrackGroup selectedGroup = null;
|
||||
int selectedTrackIndex = 0;
|
||||
int selectedTrackScore = 0;
|
||||
|
@ -26,7 +26,7 @@ abstract class AbstractInfoPlayQueue<T extends ListInfo, U extends InfoItem> ext
|
||||
transient Disposable fetchReactor;
|
||||
|
||||
AbstractInfoPlayQueue(final U item) {
|
||||
this(item.getServiceId(), item.getUrl(), null, Collections.<StreamInfoItem>emptyList(), 0);
|
||||
this(item.getServiceId(), item.getUrl(), null, Collections.emptyList(), 0);
|
||||
}
|
||||
|
||||
AbstractInfoPlayQueue(final int serviceId,
|
||||
|
@ -31,7 +31,7 @@ import org.schabi.newpipe.R;
|
||||
public class AcraReportSender implements ReportSender {
|
||||
|
||||
@Override
|
||||
public void send(@NonNull Context context, @NonNull CrashReportData report) throws ReportSenderException {
|
||||
public void send(@NonNull Context context, @NonNull CrashReportData report) {
|
||||
ErrorActivity.reportError(context, report,
|
||||
ErrorActivity.ErrorInfo.make(UserAction.UI_ERROR,"none",
|
||||
"App crash, UI failure", R.string.app_ui_crash));
|
||||
|
@ -89,7 +89,7 @@ public class SelectChannelFragment extends DialogFragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.select_channel_fragment, container, false);
|
||||
recyclerView = (RecyclerView) v.findViewById(R.id.items_list);
|
||||
recyclerView = v.findViewById(R.id.items_list);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
channelAdapter = new SelectChannelAdapter();
|
||||
recyclerView.setAdapter(channelAdapter);
|
||||
|
@ -75,7 +75,7 @@ public class SelectKioskFragment extends DialogFragment {
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.select_kiosk_fragment, container, false);
|
||||
recyclerView = (RecyclerView) v.findViewById(R.id.items_list);
|
||||
recyclerView = v.findViewById(R.id.items_list);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
try {
|
||||
selectKioskAdapter = new SelectKioskAdapter();
|
||||
|
@ -183,7 +183,7 @@ public final class ExtractorHelper {
|
||||
cache.removeInfo(serviceId, url);
|
||||
load = loadFromNetwork;
|
||||
} else {
|
||||
load = Maybe.concat(ExtractorHelper.<I>loadFromCache(serviceId, url),
|
||||
load = Maybe.concat(ExtractorHelper.loadFromCache(serviceId, url),
|
||||
loadFromNetwork.toMaybe())
|
||||
.firstElement() //Take the first valid
|
||||
.toSingle();
|
||||
|
@ -27,7 +27,7 @@ public class ImportExportJsonHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidSource() throws Exception {
|
||||
public void testInvalidSource() {
|
||||
List<String> invalidList = Arrays.asList(
|
||||
"{}",
|
||||
"",
|
||||
|
@ -15,7 +15,7 @@ import static org.junit.Assert.assertNull;
|
||||
*/
|
||||
public class ErrorActivityTest {
|
||||
@Test
|
||||
public void getReturnActivity() throws Exception {
|
||||
public void getReturnActivity() {
|
||||
Class<? extends Activity> returnActivity;
|
||||
returnActivity = ErrorActivity.getReturnActivity(MainActivity.class);
|
||||
assertEquals(MainActivity.class, returnActivity);
|
||||
|
@ -45,7 +45,7 @@ public class ListHelperTest {
|
||||
new VideoStream("", MediaFormat.MPEG_4, /**/ "1080p60", true));
|
||||
|
||||
@Test
|
||||
public void getSortedStreamVideosListTest() throws Exception {
|
||||
public void getSortedStreamVideosListTest() {
|
||||
List<VideoStream> result = ListHelper.getSortedStreamVideosList(MediaFormat.MPEG_4, true, videoStreamsTestList, videoOnlyStreamsTestList, true);
|
||||
|
||||
List<String> expected = Arrays.asList("144p", "240p", "360p", "480p", "720p", "720p60", "1080p", "1080p60", "1440p60", "2160p", "2160p60");
|
||||
@ -67,7 +67,7 @@ public class ListHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSortedStreamVideosExceptHighResolutionsTest() throws Exception {
|
||||
public void getSortedStreamVideosExceptHighResolutionsTest() {
|
||||
////////////////////////////////////
|
||||
// Don't show Higher resolutions //
|
||||
//////////////////////////////////
|
||||
@ -79,7 +79,7 @@ public class ListHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getDefaultResolutionTest() throws Exception {
|
||||
public void getDefaultResolutionTest() {
|
||||
List<VideoStream> testList = Arrays.asList(
|
||||
new VideoStream("", MediaFormat.MPEG_4, /**/ "720p"),
|
||||
new VideoStream("", MediaFormat.v3GPP, /**/ "240p"),
|
||||
@ -130,7 +130,7 @@ public class ListHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getHighestQualityAudioFormatTest() throws Exception {
|
||||
public void getHighestQualityAudioFormatTest() {
|
||||
AudioStream stream = audioStreamsTestList.get(ListHelper.getHighestQualityAudioIndex(MediaFormat.M4A, audioStreamsTestList));
|
||||
assertEquals(320, stream.average_bitrate);
|
||||
assertEquals(MediaFormat.M4A, stream.getFormat());
|
||||
@ -145,7 +145,7 @@ public class ListHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getHighestQualityAudioFormatPreferredAbsent() throws Exception {
|
||||
public void getHighestQualityAudioFormatPreferredAbsent() {
|
||||
|
||||
//////////////////////////////////////////
|
||||
// Doesn't contain the preferred format //
|
||||
@ -186,13 +186,13 @@ public class ListHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getHighestQualityAudioNull() throws Exception {
|
||||
public void getHighestQualityAudioNull() {
|
||||
assertEquals(-1, ListHelper.getHighestQualityAudioIndex(null, null));
|
||||
assertEquals(-1, ListHelper.getHighestQualityAudioIndex(null, new ArrayList<AudioStream>()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getLowestQualityAudioFormatTest() throws Exception {
|
||||
public void getLowestQualityAudioFormatTest() {
|
||||
AudioStream stream = audioStreamsTestList.get(ListHelper.getMostCompactAudioIndex(MediaFormat.M4A, audioStreamsTestList));
|
||||
assertEquals(128, stream.average_bitrate);
|
||||
assertEquals(MediaFormat.M4A, stream.getFormat());
|
||||
@ -207,7 +207,7 @@ public class ListHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getLowestQualityAudioFormatPreferredAbsent() throws Exception {
|
||||
public void getLowestQualityAudioFormatPreferredAbsent() {
|
||||
|
||||
//////////////////////////////////////////
|
||||
// Doesn't contain the preferred format //
|
||||
@ -250,13 +250,13 @@ public class ListHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getLowestQualityAudioNull() throws Exception {
|
||||
public void getLowestQualityAudioNull() {
|
||||
assertEquals(-1, ListHelper.getMostCompactAudioIndex(null, null));
|
||||
assertEquals(-1, ListHelper.getMostCompactAudioIndex(null, new ArrayList<AudioStream>()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getVideoDefaultStreamIndexCombinations() throws Exception {
|
||||
public void getVideoDefaultStreamIndexCombinations() {
|
||||
List<VideoStream> testList = Arrays.asList(
|
||||
new VideoStream("", MediaFormat.MPEG_4, /**/ "1080p"),
|
||||
new VideoStream("", MediaFormat.MPEG_4, /**/ "720p60"),
|
||||
|
@ -11,25 +11,25 @@ public class QuadraticSliderStrategyTest {
|
||||
private final SliderStrategy.Quadratic standard =
|
||||
new SliderStrategy.Quadratic(0f, 100f, 50f, STEP);
|
||||
@Test
|
||||
public void testLeftBound() throws Exception {
|
||||
public void testLeftBound() {
|
||||
assertEquals(standard.progressOf(0), 0);
|
||||
assertEquals(standard.valueOf(0), 0f, DELTA);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCenter() throws Exception {
|
||||
public void testCenter() {
|
||||
assertEquals(standard.progressOf(50), 50);
|
||||
assertEquals(standard.valueOf(50), 50f, DELTA);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRightBound() throws Exception {
|
||||
public void testRightBound() {
|
||||
assertEquals(standard.progressOf(100), 100);
|
||||
assertEquals(standard.valueOf(100), 100f, DELTA);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLeftRegion() throws Exception {
|
||||
public void testLeftRegion() {
|
||||
final int leftProgress = standard.progressOf(25);
|
||||
final double leftValue = standard.valueOf(25);
|
||||
assertTrue(leftProgress > 0 && leftProgress < 50);
|
||||
@ -37,7 +37,7 @@ public class QuadraticSliderStrategyTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRightRegion() throws Exception {
|
||||
public void testRightRegion() {
|
||||
final int leftProgress = standard.progressOf(75);
|
||||
final double leftValue = standard.valueOf(75);
|
||||
assertTrue(leftProgress > 50 && leftProgress < 100);
|
||||
@ -45,7 +45,7 @@ public class QuadraticSliderStrategyTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConversion() throws Exception {
|
||||
public void testConversion() {
|
||||
assertEquals(standard.progressOf(standard.valueOf(0)), 0);
|
||||
assertEquals(standard.progressOf(standard.valueOf(25)), 25);
|
||||
assertEquals(standard.progressOf(standard.valueOf(50)), 50);
|
||||
@ -54,7 +54,7 @@ public class QuadraticSliderStrategyTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReverseConversion() throws Exception {
|
||||
public void testReverseConversion() {
|
||||
// Need a larger delta since step size / granularity is too small and causes
|
||||
// floating point round-off errors during conversion
|
||||
final float largeDelta = 1f;
|
||||
@ -67,7 +67,7 @@ public class QuadraticSliderStrategyTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQuadraticPropertyLeftRegion() throws Exception {
|
||||
public void testQuadraticPropertyLeftRegion() {
|
||||
final double differenceCloserToCenter =
|
||||
Math.abs(standard.valueOf(40) - standard.valueOf(45));
|
||||
final double differenceFurtherFromCenter =
|
||||
@ -76,7 +76,7 @@ public class QuadraticSliderStrategyTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQuadraticPropertyRightRegion() throws Exception {
|
||||
public void testQuadraticPropertyRightRegion() {
|
||||
final double differenceCloserToCenter =
|
||||
Math.abs(standard.valueOf(75) - standard.valueOf(70));
|
||||
final double differenceFurtherFromCenter =
|
||||
|
@ -110,7 +110,7 @@ public class DownloadManagerImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resumeMission() throws Exception {
|
||||
public void resumeMission() {
|
||||
DownloadMission mission = missions.get(0);
|
||||
mission.running = true;
|
||||
verify(mission, never()).start();
|
||||
@ -122,7 +122,7 @@ public class DownloadManagerImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pauseMission() throws Exception {
|
||||
public void pauseMission() {
|
||||
DownloadMission mission = missions.get(0);
|
||||
mission.running = false;
|
||||
downloadManager.pauseMission(0);
|
||||
@ -133,7 +133,7 @@ public class DownloadManagerImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deleteMission() throws Exception {
|
||||
public void deleteMission() {
|
||||
DownloadMission mission = missions.get(0);
|
||||
assertEquals(mission, downloadManager.getMission(0));
|
||||
downloadManager.deleteMission(0);
|
||||
@ -143,18 +143,18 @@ public class DownloadManagerImplTest {
|
||||
}
|
||||
|
||||
@Test(expected = RuntimeException.class)
|
||||
public void getMissionWithNegativeIndex() throws Exception {
|
||||
public void getMissionWithNegativeIndex() {
|
||||
downloadManager.getMission(-1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getMission() throws Exception {
|
||||
public void getMission() {
|
||||
assertSame(missions.get(0), downloadManager.getMission(0));
|
||||
assertSame(missions.get(1), downloadManager.getMission(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sortByTimestamp() throws Exception {
|
||||
public void sortByTimestamp() {
|
||||
ArrayList<DownloadMission> downloadMissions = new ArrayList<>();
|
||||
DownloadMission mission = new DownloadMission();
|
||||
mission.timestamp = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user