|
|
|
|
@ -43,6 +43,9 @@ import com.github.catvod.bean.Doh; |
|
|
|
|
import com.github.catvod.net.OkHttp; |
|
|
|
|
import com.github.catvod.utils.Path; |
|
|
|
|
|
|
|
|
|
import org.greenrobot.eventbus.Subscribe; |
|
|
|
|
import org.greenrobot.eventbus.ThreadMode; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
@ -140,18 +143,15 @@ public class SettingActivity extends BaseActivity implements ConfigCallback, Sit |
|
|
|
|
case 0: |
|
|
|
|
Notify.progress(this); |
|
|
|
|
VodConfig.load(config, getCallback(0)); |
|
|
|
|
mBinding.vodUrl.setText(config.getDesc()); |
|
|
|
|
break; |
|
|
|
|
case 1: |
|
|
|
|
Notify.progress(this); |
|
|
|
|
LiveConfig.load(config, getCallback(1)); |
|
|
|
|
mBinding.liveUrl.setText(config.getDesc()); |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
Setting.putWall(0); |
|
|
|
|
Notify.progress(this); |
|
|
|
|
WallConfig.load(config, getCallback(2)); |
|
|
|
|
mBinding.wallUrl.setText(config.getDesc()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -177,29 +177,12 @@ public class SettingActivity extends BaseActivity implements ConfigCallback, Sit |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setConfig(int type) { |
|
|
|
|
switch (type) { |
|
|
|
|
case 0: |
|
|
|
|
setCacheText(); |
|
|
|
|
Notify.dismiss(); |
|
|
|
|
RefreshEvent.video(); |
|
|
|
|
RefreshEvent.config(); |
|
|
|
|
RefreshEvent.history(); |
|
|
|
|
mBinding.vodUrl.setText(VodConfig.getDesc()); |
|
|
|
|
mBinding.liveUrl.setText(LiveConfig.getDesc()); |
|
|
|
|
mBinding.wallUrl.setText(WallConfig.getDesc()); |
|
|
|
|
break; |
|
|
|
|
case 1: |
|
|
|
|
setCacheText(); |
|
|
|
|
Notify.dismiss(); |
|
|
|
|
RefreshEvent.config(); |
|
|
|
|
mBinding.liveUrl.setText(LiveConfig.getDesc()); |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
setCacheText(); |
|
|
|
|
Notify.dismiss(); |
|
|
|
|
mBinding.wallUrl.setText(WallConfig.getDesc()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
setCacheText(); |
|
|
|
|
Notify.dismiss(); |
|
|
|
|
RefreshEvent.config(); |
|
|
|
|
if (type != 0) return; |
|
|
|
|
RefreshEvent.video(); |
|
|
|
|
RefreshEvent.history(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@ -352,6 +335,14 @@ public class SettingActivity extends BaseActivity implements ConfigCallback, Sit |
|
|
|
|
VodConfig.get().init().load(getCallback(0)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN) |
|
|
|
|
public void onRefreshEvent(RefreshEvent event) { |
|
|
|
|
if (event.getType() != RefreshEvent.Type.CONFIG) return; |
|
|
|
|
mBinding.vodUrl.setText(VodConfig.getDesc()); |
|
|
|
|
mBinding.liveUrl.setText(LiveConfig.getDesc()); |
|
|
|
|
mBinding.wallUrl.setText(WallConfig.getDesc()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private final ActivityResultLauncher<Intent> launcher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> { |
|
|
|
|
if (result.getResultCode() != RESULT_OK || result.getData() == null || result.getData().getData() == null) return; |
|
|
|
|
setConfig(Config.find("file:/" + FileChooser.getPathFromUri(result.getData().getData()).replace(Path.rootPath(), ""), type)); |
|
|
|
|
|