Clean up SDK version checks

This commit is contained in:
TacoTheDank 2020-08-27 16:59:29 -04:00 committed by Stypox
parent 6c5ef567ed
commit 06d54ef77e
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23
12 changed files with 16 additions and 28 deletions

View file

@ -310,9 +310,7 @@ public final class MainPlayer extends Service {
setLockScreenThumbnail(builder);
}
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
builder.setPriority(NotificationCompat.PRIORITY_MAX);
}
builder.setPriority(NotificationCompat.PRIORITY_MAX);
return builder;
}

View file

@ -250,7 +250,7 @@ public abstract class VideoPlayer extends BasePlayer
simpleExoPlayer.addTextOutput(cues -> subtitleView.onCues(cues));
// Setup audio session with onboard equalizer
if (Build.VERSION.SDK_INT >= 21) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
trackSelector.setParameters(trackSelector.buildUponParameters()
.setTunnelingAudioSessionId(C.generateAudioSessionIdV21(context)));
}

View file

@ -1925,7 +1925,7 @@ public class VideoPlayerImpl extends VideoPlayer
}
private int popupLayoutParamType() {
return Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O
return Build.VERSION.SDK_INT < Build.VERSION_CODES.O
? WindowManager.LayoutParams.TYPE_PHONE
: WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
}

View file

@ -2,7 +2,6 @@ package org.schabi.newpipe.player.helper;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import androidx.preference.PreferenceManager;
import android.provider.Settings;
import android.view.accessibility.CaptioningManager;
@ -303,10 +302,6 @@ public final class PlayerHelper {
@NonNull
public static CaptionStyleCompat getCaptionStyle(@NonNull final Context context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return CaptionStyleCompat.DEFAULT;
}
final CaptioningManager captioningManager = (CaptioningManager)
context.getSystemService(Context.CAPTIONING_SERVICE);
if (captioningManager == null || !captioningManager.isEnabled()) {
@ -331,10 +326,6 @@ public final class PlayerHelper {
* @return caption scaling
*/
public static float getCaptionScale(@NonNull final Context context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return 1f;
}
final CaptioningManager captioningManager
= (CaptioningManager) context.getSystemService(Context.CAPTIONING_SERVICE);
if (captioningManager == null || !captioningManager.isEnabled()) {