pull/605/head
jhengazuji 5 months ago
parent a930281bdf
commit e154ad1e26
  1. 4
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/LiveActivity.java
  2. 4
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/SettingActivity.java
  3. 10
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/SettingPlayerActivity.java
  4. 8
      app/src/main/java/com/fongmi/android/tv/App.java
  5. 3
      app/src/main/java/com/fongmi/android/tv/Startup.java
  6. 12
      app/src/main/java/com/fongmi/android/tv/bean/Channel.java
  7. 2
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/LiveActivity.java
  8. 6
      app/src/mobile/java/com/fongmi/android/tv/ui/fragment/SettingPlayerFragment.java
  9. 25
      catvod/src/main/java/com/github/catvod/Startup.java

@ -884,14 +884,14 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
private void prevLine() { private void prevLine() {
if (mChannel == null || mChannel.isOnly()) return; if (mChannel == null || mChannel.isOnly()) return;
mChannel.prevLine(); mChannel.switchLine(false);
showInfo(); showInfo();
fetch(); fetch();
} }
private void nextLine(boolean show) { private void nextLine(boolean show) {
if (mChannel == null || mChannel.isOnly()) return; if (mChannel == null || mChannel.isOnly()) return;
mChannel.nextLine(); mChannel.switchLine(true);
if (show) showInfo(); if (show) showInfo();
else setInfo(); else setInfo();
fetch(); fetch();

@ -269,9 +269,9 @@ public class SettingActivity extends BaseActivity implements ConfigCallback, Sit
} }
private void setSize(View view) { private void setSize(View view) {
int index = Setting.getSize(); int index = (Setting.getSize() + 1) % size.length;
Setting.putSize(index = index == size.length - 1 ? 0 : ++index);
mBinding.sizeText.setText(size[index]); mBinding.sizeText.setText(size[index]);
Setting.putSize(index);
RefreshEvent.size(); RefreshEvent.size();
} }

@ -101,9 +101,9 @@ public class SettingPlayerActivity extends BaseActivity implements UaCallback, B
} }
private void setScale(View view) { private void setScale(View view) {
int index = Setting.getScale(); int index = (Setting.getScale() + 1) % scale.length;
Setting.putScale(index = index == scale.length - 1 ? 0 : ++index);
mBinding.scaleText.setText(scale[index]); mBinding.scaleText.setText(scale[index]);
Setting.putScale(index);
} }
private void onSpeed(View view) { private void onSpeed(View view) {
@ -127,10 +127,10 @@ public class SettingPlayerActivity extends BaseActivity implements UaCallback, B
} }
private void setRender(View view) { private void setRender(View view) {
int index = Setting.getRender(); if (Setting.isTunnel() && Setting.getRender() == 0) setTunnel(view);
Setting.putRender(index = index == render.length - 1 ? 0 : ++index); int index = (Setting.getRender() + 1) % render.length;
mBinding.renderText.setText(render[index]); mBinding.renderText.setText(render[index]);
if (Setting.isTunnel() && Setting.getRender() == 1) setTunnel(view); Setting.putRender(index);
} }
private void setTunnel(View view) { private void setTunnel(View view) {

@ -2,6 +2,7 @@ package com.fongmi.android.tv;
import android.app.Activity; import android.app.Activity;
import android.app.Application; import android.app.Application;
import android.content.Context;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
@ -14,6 +15,7 @@ import androidx.core.os.HandlerCompat;
import com.fongmi.android.tv.utils.Notify; import com.fongmi.android.tv.utils.Notify;
import com.fongmi.hook.Chromium; import com.fongmi.hook.Chromium;
import com.fongmi.hook.Hook; import com.fongmi.hook.Hook;
import com.github.catvod.Init;
import com.google.gson.Gson; import com.google.gson.Gson;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
@ -50,6 +52,12 @@ public class App extends Application implements Application.ActivityLifecycleCal
this.hook = hook; this.hook = hook;
} }
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
Init.set(base);
}
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();

@ -15,6 +15,7 @@ import com.orhanobut.logger.PrettyFormatStrategy;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import java.util.Collections;
import java.util.List; import java.util.List;
import cat.ereza.customactivityoncrash.config.CaocConfig; import cat.ereza.customactivityoncrash.config.CaocConfig;
@ -34,6 +35,6 @@ public class Startup implements Initializer<Void> {
@NonNull @NonNull
@Override @Override
public List<Class<? extends Initializer<?>>> dependencies() { public List<Class<? extends Initializer<?>>> dependencies() {
return List.of(com.github.catvod.Startup.class); return Collections.emptyList();
} }
} }

@ -283,12 +283,12 @@ public class Channel {
ImgUtil.load(getName(), getLogo(), view, false); ImgUtil.load(getName(), getLogo(), view, false);
} }
public void nextLine() { public void switchLine(boolean next) {
setLine(getLine() < getUrls().size() - 1 ? getLine() + 1 : 0); List<?> urls = getUrls();
} if (urls.isEmpty()) return;
int size = urls.size();
public void prevLine() { int step = next ? 1 : -1;
setLine(getLine() > 0 ? getLine() - 1 : getUrls().size() - 1); setLine((getLine() + step + size) % size);
} }
public String getCurrent() { public String getCurrent() {

@ -922,7 +922,7 @@ public class LiveActivity extends BaseActivity implements CustomKeyDown.Listener
private void nextLine(boolean show) { private void nextLine(boolean show) {
if (mChannel == null || mChannel.isOnly()) return; if (mChannel == null || mChannel.isOnly()) return;
mChannel.nextLine(); mChannel.switchLine(true);
if (show) showInfo(); if (show) showInfo();
else setInfo(); else setInfo();
fetch(); fetch();

@ -128,10 +128,10 @@ public class SettingPlayerFragment extends BaseFragment implements UaCallback, B
} }
private void setRender(View view) { private void setRender(View view) {
int index = Setting.getRender(); if (Setting.isTunnel() && Setting.getRender() == 0) setTunnel(view);
Setting.putRender(index = index == render.length - 1 ? 0 : ++index); int index = (Setting.getRender() + 1) % render.length;
mBinding.renderText.setText(render[index]); mBinding.renderText.setText(render[index]);
if (Setting.isTunnel() && Setting.getRender() == 1) setTunnel(view); Setting.putRender(index);
} }
private void setTunnel(View view) { private void setTunnel(View view) {

@ -1,25 +0,0 @@
package com.github.catvod;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.startup.Initializer;
import java.util.Collections;
import java.util.List;
public class Startup implements Initializer<Void> {
@NonNull
@Override
public Void create(@NonNull Context context) {
Init.set(context);
return null;
}
@NonNull
@Override
public List<Class<? extends Initializer<?>>> dependencies() {
return Collections.emptyList();
}
}
Loading…
Cancel
Save