From 74a78ea15bbddfe703c13288f61964067b7accf2 Mon Sep 17 00:00:00 2001 From: okjack Date: Tue, 1 Oct 2024 15:35:13 +0800 Subject: [PATCH] Clean code --- .../android/tv/ui/activity/VideoActivity.java | 36 +++++++------------ 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/app/src/mobile/java/com/fongmi/android/tv/ui/activity/VideoActivity.java b/app/src/mobile/java/com/fongmi/android/tv/ui/activity/VideoActivity.java index 7c26c0a80..9a5867fb1 100644 --- a/app/src/mobile/java/com/fongmi/android/tv/ui/activity/VideoActivity.java +++ b/app/src/mobile/java/com/fongmi/android/tv/ui/activity/VideoActivity.java @@ -154,9 +154,9 @@ public class VideoActivity extends BaseActivity implements Clock.Callback, Custo private boolean fullscreen; private boolean initTrack; private boolean initAuto; - private boolean redirect; private boolean autoMode; private boolean useParse; + private boolean redirect; private boolean rotate; private boolean stop; private boolean lock; @@ -1291,20 +1291,10 @@ public class VideoActivity extends BaseActivity implements Clock.Callback, Custo @Subscribe(threadMode = ThreadMode.MAIN) public void onRefreshEvent(RefreshEvent event) { if (isRedirect()) return; - switch (event.getType()) { - case DETAIL: - getDetail(); - break; - case PLAYER: - onRefresh(); - break; - case DANMAKU: - checkDanmu(event.getPath()); - break; - case SUBTITLE: - mPlayers.setSub(Sub.from(event.getPath())); - break; - } + if (event.getType() == RefreshEvent.Type.DETAIL) getDetail(); + else if (event.getType() == RefreshEvent.Type.PLAYER) onRefresh(); + else if (event.getType() == RefreshEvent.Type.DANMAKU) checkDanmu(event.getPath()); + else if (event.getType() == RefreshEvent.Type.SUBTITLE) mPlayers.setSub(Sub.from(event.getPath())); } @Subscribe(threadMode = ThreadMode.MAIN) @@ -1582,14 +1572,6 @@ public class VideoActivity extends BaseActivity implements Clock.Callback, Custo this.initAuto = initAuto; } - public boolean isRedirect() { - return redirect; - } - - public void setRedirect(boolean redirect) { - this.redirect = redirect; - } - private boolean isAutoMode() { return autoMode; } @@ -1606,6 +1588,14 @@ public class VideoActivity extends BaseActivity implements Clock.Callback, Custo this.useParse = useParse; } + public boolean isRedirect() { + return redirect; + } + + public void setRedirect(boolean redirect) { + this.redirect = redirect; + } + public boolean isRotate() { return rotate; }