mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 08:30:44 +00:00
Fix a few SonarLint warnings
This commit is contained in:
parent
433c6dc33b
commit
4d51ebc37a
@ -16,7 +16,7 @@ import leakcanary.AppWatcher;
|
||||
|
||||
public abstract class BaseFragment extends Fragment {
|
||||
protected final String TAG = getClass().getSimpleName() + "@" + Integer.toHexString(hashCode());
|
||||
protected final boolean DEBUG = MainActivity.DEBUG;
|
||||
protected static final boolean DEBUG = MainActivity.DEBUG;
|
||||
protected AppCompatActivity activity;
|
||||
//These values are used for controlling fragments when they are part of the frontpage
|
||||
@State
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.schabi.newpipe.error;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
@ -66,6 +67,7 @@ public class ReCaptchaActivity extends AppCompatActivity {
|
||||
private ActivityRecaptchaBinding recaptchaBinding;
|
||||
private String foundCookies = "";
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
ThemeHelper.setTheme(this);
|
||||
|
@ -614,7 +614,7 @@ public final class Player implements
|
||||
playQueue.append(newQueue.getStreams());
|
||||
|
||||
if ((intent.getBooleanExtra(SELECT_ON_APPEND, false)
|
||||
|| currentState == STATE_COMPLETED) && newQueue.getStreams().size() > 0) {
|
||||
|| currentState == STATE_COMPLETED) && !newQueue.getStreams().isEmpty()) {
|
||||
playQueue.setIndex(sizeBeforeAppend);
|
||||
}
|
||||
|
||||
@ -2326,7 +2326,7 @@ public final class Player implements
|
||||
Log.d(TAG, "ExoPlayer - onRepeatModeChanged() called with: "
|
||||
+ "repeatMode = [" + repeatMode + "]");
|
||||
}
|
||||
setRepeatModeButton(((AppCompatImageButton) binding.repeatButton), repeatMode);
|
||||
setRepeatModeButton(binding.repeatButton, repeatMode);
|
||||
onShuffleOrRepeatModeChanged();
|
||||
}
|
||||
|
||||
@ -3189,7 +3189,7 @@ public final class Player implements
|
||||
private StreamSegmentAdapter.StreamSegmentListener getStreamSegmentListener() {
|
||||
return (item, seconds) -> {
|
||||
segmentAdapter.selectSegment(item);
|
||||
seekTo(seconds * 1000);
|
||||
seekTo(seconds * 1000L);
|
||||
triggerProgressUpdate();
|
||||
};
|
||||
}
|
||||
@ -3199,7 +3199,7 @@ public final class Player implements
|
||||
final List<StreamSegment> segments = currentMetadata.getMetadata().getStreamSegments();
|
||||
|
||||
for (int i = 0; i < segments.size(); i++) {
|
||||
if (segments.get(i).getStartTimeSeconds() * 1000 > playbackPosition) {
|
||||
if (segments.get(i).getStartTimeSeconds() * 1000L > playbackPosition) {
|
||||
break;
|
||||
}
|
||||
nearestPosition++;
|
||||
|
@ -360,7 +360,7 @@ public final class NavigationHelper {
|
||||
autoPlay = false;
|
||||
}
|
||||
|
||||
final RunnableWithVideoDetailFragment onVideoDetailFragmentReady = (detailFragment) -> {
|
||||
final RunnableWithVideoDetailFragment onVideoDetailFragmentReady = detailFragment -> {
|
||||
expandMainPlayer(detailFragment.requireActivity());
|
||||
detailFragment.setAutoPlay(autoPlay);
|
||||
if (switchingPlayers) {
|
||||
|
@ -119,7 +119,7 @@ public final class PermissionHelper {
|
||||
|
||||
public static boolean isPopupEnabled(final Context context) {
|
||||
return Build.VERSION.SDK_INT < Build.VERSION_CODES.M
|
||||
|| PermissionHelper.checkSystemAlertWindowPermission(context);
|
||||
|| checkSystemAlertWindowPermission(context);
|
||||
}
|
||||
|
||||
public static void showPopupEnablementToast(final Context context) {
|
||||
|
@ -101,7 +101,12 @@ public final class InternalUrlsHandler {
|
||||
return false;
|
||||
}
|
||||
final String matchedUrl = matcher.group(1);
|
||||
final int seconds = Integer.parseInt(matcher.group(2));
|
||||
final int seconds;
|
||||
if (matcher.group(2) == null) {
|
||||
seconds = -1;
|
||||
} else {
|
||||
seconds = Integer.parseInt(matcher.group(2));
|
||||
}
|
||||
|
||||
final StreamingService service;
|
||||
final StreamingService.LinkType linkType;
|
||||
@ -154,7 +159,7 @@ public final class InternalUrlsHandler {
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(info -> {
|
||||
final PlayQueue playQueue
|
||||
= new SinglePlayQueue(info, seconds * 1000);
|
||||
= new SinglePlayQueue(info, seconds * 1000L);
|
||||
NavigationHelper.playOnPopupPlayer(context, playQueue, false);
|
||||
}, throwable -> {
|
||||
if (DEBUG) {
|
||||
|
Loading…
Reference in New Issue
Block a user