|
|
|
|
@ -7,9 +7,7 @@ import android.view.View; |
|
|
|
|
|
|
|
|
|
import androidx.viewbinding.ViewBinding; |
|
|
|
|
|
|
|
|
|
import com.fongmi.android.tv.App; |
|
|
|
|
import com.fongmi.android.tv.BuildConfig; |
|
|
|
|
import com.fongmi.android.tv.R; |
|
|
|
|
import com.fongmi.android.tv.Setting; |
|
|
|
|
import com.fongmi.android.tv.Updater; |
|
|
|
|
import com.fongmi.android.tv.api.config.LiveConfig; |
|
|
|
|
@ -37,12 +35,9 @@ import com.fongmi.android.tv.ui.dialog.ProxyDialog; |
|
|
|
|
import com.fongmi.android.tv.ui.dialog.SiteDialog; |
|
|
|
|
import com.fongmi.android.tv.utils.FileUtil; |
|
|
|
|
import com.fongmi.android.tv.utils.Notify; |
|
|
|
|
import com.fongmi.android.tv.utils.ResUtil; |
|
|
|
|
import com.fongmi.android.tv.utils.UrlUtil; |
|
|
|
|
import com.github.catvod.bean.Doh; |
|
|
|
|
import com.github.catvod.net.OkHttp; |
|
|
|
|
import com.github.catvod.utils.Shell; |
|
|
|
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder; |
|
|
|
|
import com.permissionx.guolindev.PermissionX; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
@ -52,7 +47,6 @@ public class SettingActivity extends BaseActivity implements ConfigCallback, Sit |
|
|
|
|
|
|
|
|
|
private ActivitySettingBinding mBinding; |
|
|
|
|
private int type; |
|
|
|
|
private String[] configCache; |
|
|
|
|
|
|
|
|
|
public static void start(Activity activity) { |
|
|
|
|
activity.startActivity(new Intent(activity, SettingActivity.class)); |
|
|
|
|
@ -84,7 +78,6 @@ public class SettingActivity extends BaseActivity implements ConfigCallback, Sit |
|
|
|
|
mBinding.versionText.setText(BuildConfig.VERSION_NAME); |
|
|
|
|
mBinding.proxyText.setText(UrlUtil.scheme(Setting.getProxy())); |
|
|
|
|
mBinding.aboutText.setText(BuildConfig.FLAVOR_mode + "-" + BuildConfig.FLAVOR_api + "-" + BuildConfig.FLAVOR_abi); |
|
|
|
|
mBinding.configCacheText.setText((configCache = ResUtil.getStringArray(R.array.select_config_cache))[Setting.getConfigCache()]); |
|
|
|
|
setCacheText(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -122,8 +115,6 @@ public class SettingActivity extends BaseActivity implements ConfigCallback, Sit |
|
|
|
|
mBinding.wallRefresh.setOnClickListener(this::setWallRefresh); |
|
|
|
|
mBinding.custom.setOnClickListener(this::onCustom); |
|
|
|
|
mBinding.doh.setOnClickListener(this::setDoh); |
|
|
|
|
mBinding.configCache.setOnClickListener(this::setConfigCache); |
|
|
|
|
mBinding.reset.setOnClickListener(this::onReset); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@ -289,22 +280,6 @@ public class SettingActivity extends BaseActivity implements ConfigCallback, Sit |
|
|
|
|
SettingCustomActivity.start(this); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setConfigCache(View view) { |
|
|
|
|
int index = Setting.getConfigCache(); |
|
|
|
|
Setting.putConfigCache(index = index == configCache.length - 1 ? 0 : ++index); |
|
|
|
|
mBinding.configCacheText.setText(configCache[index]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void onReset(View view) { |
|
|
|
|
new MaterialAlertDialogBuilder(this).setTitle(R.string.dialog_reset_app).setMessage(R.string.dialog_reset_app_data).setNegativeButton(R.string.dialog_negative, null).setPositiveButton(R.string.dialog_positive, (dialog, which) -> reset()).show(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void reset() { |
|
|
|
|
new Thread(() -> { |
|
|
|
|
Shell.exec("pm clear " + App.get().getPackageName()); |
|
|
|
|
}).start(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setDoh(View view) { |
|
|
|
|
DohDialog.create(this).index(getDohIndex()).show(); |
|
|
|
|
} |
|
|
|
|
|