Comply with Checkstyle rules
This commit is contained in:
parent
ac5571a363
commit
53b3bda909
13 changed files with 75 additions and 49 deletions
|
|
@ -78,10 +78,8 @@ import org.schabi.newpipe.util.SerializedCache;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.disposables.SerialDisposable;
|
||||
|
|
@ -90,6 +88,8 @@ import static com.google.android.exoplayer2.Player.DISCONTINUITY_REASON_INTERNAL
|
|||
import static com.google.android.exoplayer2.Player.DISCONTINUITY_REASON_PERIOD_TRANSITION;
|
||||
import static com.google.android.exoplayer2.Player.DISCONTINUITY_REASON_SEEK;
|
||||
import static com.google.android.exoplayer2.Player.DISCONTINUITY_REASON_SEEK_ADJUSTMENT;
|
||||
import static io.reactivex.android.schedulers.AndroidSchedulers.mainThread;
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
|
||||
/**
|
||||
* Base for the players, joining the common properties.
|
||||
|
|
@ -304,7 +304,7 @@ public abstract class BasePlayer implements
|
|||
final PlayQueueItem item = queue.getItem();
|
||||
if (item != null && item.getRecoveryPosition() == PlayQueueItem.RECOVERY_UNSET) {
|
||||
stateLoader = recordManager.loadStreamState(item)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.observeOn(mainThread())
|
||||
.doFinally(() -> initPlayback(queue, repeatMode, playbackSpeed,
|
||||
playbackPitch, playbackSkipSilence, true, isMuted))
|
||||
.subscribe(
|
||||
|
|
@ -655,8 +655,8 @@ public abstract class BasePlayer implements
|
|||
}
|
||||
|
||||
private Disposable getProgressReactor() {
|
||||
return Observable.interval(PROGRESS_LOOP_INTERVAL_MILLIS, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
return Observable.interval(PROGRESS_LOOP_INTERVAL_MILLIS, MILLISECONDS, mainThread())
|
||||
.observeOn(mainThread())
|
||||
.subscribe(ignored -> triggerProgressUpdate(),
|
||||
error -> Log.e(TAG, "Progress update failure: ", error));
|
||||
}
|
||||
|
|
@ -1261,7 +1261,7 @@ public abstract class BasePlayer implements
|
|||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
if (prefs.getBoolean(context.getString(R.string.enable_watch_history_key), true)) {
|
||||
final Disposable stateSaver = recordManager.saveStreamState(info, progress)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.observeOn(mainThread())
|
||||
.doOnError((e) -> {
|
||||
if (DEBUG) {
|
||||
e.printStackTrace();
|
||||
|
|
@ -1281,7 +1281,7 @@ public abstract class BasePlayer implements
|
|||
if (prefs.getBoolean(context.getString(R.string.enable_watch_history_key), true)) {
|
||||
final Disposable stateSaver = queueItem.getStream()
|
||||
.flatMapCompletable(info -> recordManager.saveStreamState(info, 0))
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.observeOn(mainThread())
|
||||
.doOnError((e) -> {
|
||||
if (DEBUG) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -176,8 +176,10 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||
public void onChange(final boolean selfChange) {
|
||||
super.onChange(selfChange);
|
||||
if (globalScreenOrientationLocked()) {
|
||||
final String orientKey = getString(R.string.last_orientation_landscape_key);
|
||||
|
||||
final boolean lastOrientationWasLandscape = defaultPreferences
|
||||
.getBoolean(getString(R.string.last_orientation_landscape_key), AndroidTvUtils.isTv());
|
||||
.getBoolean(orientKey, AndroidTvUtils.isTv());
|
||||
setLandscape(lastOrientationWasLandscape);
|
||||
} else {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
|
||||
|
|
@ -216,7 +218,7 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
public boolean onKeyDown(final int keyCode, final KeyEvent event) {
|
||||
switch (event.getKeyCode()) {
|
||||
default:
|
||||
break;
|
||||
|
|
@ -258,8 +260,10 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||
super.onResume();
|
||||
|
||||
if (globalScreenOrientationLocked()) {
|
||||
final String orientKey = getString(R.string.last_orientation_landscape_key);
|
||||
|
||||
boolean lastOrientationWasLandscape = defaultPreferences
|
||||
.getBoolean(getString(R.string.last_orientation_landscape_key), AndroidTvUtils.isTv());
|
||||
.getBoolean(orientKey, AndroidTvUtils.isTv());
|
||||
setLandscape(lastOrientationWasLandscape);
|
||||
}
|
||||
|
||||
|
|
@ -1077,7 +1081,7 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||
}
|
||||
|
||||
@Override
|
||||
public void safeHideControls(long duration, final long delay) {
|
||||
public void safeHideControls(final long duration, final long delay) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "safeHideControls() called with: delay = [" + delay + "]");
|
||||
}
|
||||
|
|
@ -1085,8 +1089,9 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||
View controlsRoot = getControlsRoot();
|
||||
if (controlsRoot.isInTouchMode()) {
|
||||
getControlsVisibilityHandler().removeCallbacksAndMessages(null);
|
||||
getControlsVisibilityHandler().postDelayed(
|
||||
() -> animateView(controlsRoot, false, duration, 0, MainVideoPlayer.this::hideSystemUi), delay);
|
||||
getControlsVisibilityHandler().postDelayed(() ->
|
||||
animateView(controlsRoot, false, duration, 0,
|
||||
MainVideoPlayer.this::hideSystemUi), delay);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -969,7 +969,9 @@ public abstract class VideoPlayer extends BasePlayer
|
|||
Log.d(TAG, "showControlsThenHide() called");
|
||||
}
|
||||
|
||||
final int hideTime = controlsRoot.isInTouchMode() ? DEFAULT_CONTROLS_HIDE_TIME : DPAD_CONTROLS_HIDE_TIME;
|
||||
final int hideTime = controlsRoot.isInTouchMode()
|
||||
? DEFAULT_CONTROLS_HIDE_TIME
|
||||
: DPAD_CONTROLS_HIDE_TIME;
|
||||
|
||||
animateView(controlsRoot, true, DEFAULT_CONTROLS_DURATION, 0,
|
||||
() -> hideControls(DEFAULT_CONTROLS_DURATION, hideTime));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue