修一个t4 ext参数相关的bug;更改一处盒子/手机的判断条件

main
jun 2 months ago
parent 49e6314378
commit 022bad8027
  1. 8
      app/build.gradle
  2. 5
      app/src/main/java/com/github/tvbox/osc/ui/dialog/GridFilterDialog.java
  3. 2
      app/src/main/java/com/github/tvbox/osc/util/OkGoHelper.java
  4. 148
      app/src/main/java/com/github/tvbox/osc/viewmodel/SourceViewModel.java

@ -54,6 +54,14 @@ android {
}
}
}
// ABI
splits {
abi {
enable false // ABI
}
}
applicationVariants.configureEach { variant ->
variant.outputs.configureEach { output ->
def flavorNames = variant.productFlavors.collect { it.name == "normal" ? "java" : it.name }.join('-')

@ -130,7 +130,10 @@ public class GridFilterDialog extends BaseDialog {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) {
return false;
}
// SDK <= Android 9 直接认为是 TV / 机顶盒
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
return true;
}
PackageManager pm = context.getPackageManager();
UiModeManager uiMode = (UiModeManager) context.getSystemService(Context.UI_MODE_SERVICE);

@ -176,7 +176,7 @@ public class OkGoHelper {
// if (!dohUrl.isEmpty()) is_doh = true;
// LOG.i("echo-initDnsOverHttps dohUrl:"+dohUrl);
// LOG.i("echo-initDnsOverHttps ips:"+ips);
dnsOverHttps = new DnsOverHttps.Builder().client(dohClient).url(dohUrl.isEmpty() ? null : HttpUrl.get(dohUrl)).bootstrapDnsHosts(ips!=null?DohIps(ips):null).build();
dnsOverHttps = new DnsOverHttps.Builder().client(dohClient).url(dohUrl.isEmpty() ? null : HttpUrl.get(dohUrl)).bootstrapDnsHosts((ips!=null && !dohUrl.equals("https://doh.pub/dns-query"))?DohIps(ips):null).build();
}
// 自定义 DNS 解析器

@ -36,6 +36,7 @@ import com.google.gson.reflect.TypeToken;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.AbsCallback;
import com.lzy.okgo.model.Response;
import com.lzy.okgo.request.GetRequest;
import com.orhanobut.hawk.Hawk;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
@ -238,11 +239,14 @@ public class SourceViewModel extends ViewModel {
String extend=sourceBean.getExt();
extend=getFixUrl(extend);
if(URLEncoder.encode(extend).length()<1000){
OkGo.<String>get(sourceBean.getApi())
GetRequest<String> request = OkGo.<String>get(sourceBean.getApi())
.tag(sourceBean.getKey() + "_sort")
.params("filter", "true")
.params("extend", extend)
.execute(new AbsCallback<String>() {
.params("filter", "true");
// 当 extend 不为空且非空字符串时添加参数
if (extend != null && !extend.isEmpty()) {
request.params("extend", extend);
}
request.execute(new AbsCallback<String>() {
@Override
public String convertResponse(okhttp3.Response response) throws Throwable {
if (response.body() != null) {
@ -292,7 +296,9 @@ public class SourceViewModel extends ViewModel {
try {
Map<String, String> params = new HashMap<>();
params.put("filter","true");
params.put("extend",extend);
if (extend != null && !extend.isEmpty()) {
params.put("extend",extend);
}
RemoteTVBox.post(sourceBean.getApi(), params, new okhttp3.Callback() {
@Override
public void onFailure(@NonNull Call call, IOException e) {
@ -337,7 +343,7 @@ public class SourceViewModel extends ViewModel {
try {
Spider sp = ApiConfig.get().getCSP(homeSourceBean);
String json = sp.categoryContent(sortData.id, page + "", true, sortData.filterSelect);
LOG.i("categoryContent:"+json);
LOG.i("echo-categoryContent:"+json);
json(listResult, json,homeSourceBean.getKey());
} catch (Throwable th) {
th.printStackTrace();
@ -394,37 +400,47 @@ public class SourceViewModel extends ViewModel {
}else {
ext = Base64.encodeToString("{}".getBytes(), Base64.DEFAULT | Base64.NO_WRAP);
}
OkGo.<String>get(homeSourceBean.getApi())
.tag(homeSourceBean.getApi())
.params("ac", "detail")
.params("filter", "true")
.params("t", sortData.id)
.params("pg", page)
.params("ext", ext)
.params("extend", extend)
.execute(new AbsCallback<String>() {
@Override
public String convertResponse(okhttp3.Response response) throws Throwable {
if (response.body() != null) {
return response.body().string();
} else {
throw new IllegalStateException("网络请求错误");
GetRequest<String> request = OkGo.<String>get(homeSourceBean.getApi())
.tag(homeSourceBean.getApi())
.params("ac", "detail")
.params("filter", "true")
.params("t", sortData.id)
.params("pg", page)
.params("ext", ext);
// 当 extend 不为空且非空字符串时添加参数
if (extend != null && !extend.isEmpty()) {
request.params("extend", extend);
}
request.execute(new AbsCallback<String>() {
@Override
public String convertResponse(okhttp3.Response response) throws Throwable {
try {
if (response.body() != null) {
return response.body().string();
} else {
throw new IllegalStateException("网络请求错误,response body 为 null");
}
} catch (Exception e) {
LOG.i("echo-list: convertResponse error"+ e.getMessage());
throw e; // 重新抛出异常
}
}
}
@Override
public void onSuccess(Response<String> response) {
String json = response.body();
LOG.i("echo-list:"+json);
json(listResult, json, homeSourceBean.getKey());
}
@Override
public void onSuccess(Response<String> response) {
String json = response.body();
LOG.i("echo-list: " + json);
json(listResult, json, homeSourceBean.getKey());
}
@Override
public void onError(Response<String> response) {
super.onError(response);
listResult.postValue(null);
}
});
@Override
public void onError(Response<String> response) {
super.onError(response);
listResult.postValue(null);
}
});
} else {
listResult.postValue(null);
}
@ -577,12 +593,16 @@ public class SourceViewModel extends ViewModel {
} else if (type == 0 || type == 1|| type == 4) {
String extend=sourceBean.getExt();
extend=getFixUrl(extend);
OkGo.<String>get(sourceBean.getApi())
GetRequest<String> request = OkGo.<String>get(sourceBean.getApi())
.tag("detail")
.params("ac", type == 0 ? "videolist" : "detail")
.params("ids", id)
.params("extend", extend)
.execute(new AbsCallback<String>() {
.params("ids", id);
// 当 extend 不为空且非空字符串时添加参数
if (extend != null && !extend.isEmpty()) {
request.params("extend", extend);
}
request.execute(new AbsCallback<String>() {
@Override
public String convertResponse(okhttp3.Response response) throws Throwable {
@ -673,13 +693,17 @@ public class SourceViewModel extends ViewModel {
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
OkGo.<String>get(sourceBean.getApi())
.params("wd", wd)
.params("ac" ,"detail")
.params("quick" ,"false")
.params("extend" ,extend)
.tag("search")
.execute(new AbsCallback<String>() {
GetRequest<String> request = OkGo.<String>get(sourceBean.getApi())
.tag("search")
.params("wd", wd)
.params("ac" ,"detail")
.params("quick" ,"false");
// 当 extend 不为空且非空字符串时添加参数
if (extend != null && !extend.isEmpty()) {
request.params("extend", extend);
}
request.execute(new AbsCallback<String>() {
@Override
public String convertResponse(okhttp3.Response response) throws Throwable {
if (response.body() != null) {
@ -756,13 +780,17 @@ public class SourceViewModel extends ViewModel {
}else if (type == 4) {
String extend=sourceBean.getExt();
extend=getFixUrl(extend);
OkGo.<String>get(sourceBean.getApi())
.params("wd", wd)
.params("ac" ,"detail")
.params("quick" ,"true")
.params("extend" ,extend)
.tag("search")
.execute(new AbsCallback<String>() {
GetRequest<String> request = OkGo.<String>get(sourceBean.getApi())
.tag("search")
.params("wd", wd)
.params("ac" ,"detail")
.params("quick" ,"true");
// 当 extend 不为空且非空字符串时添加参数
if (extend != null && !extend.isEmpty()) {
request.params("extend", extend);
}
request.execute(new AbsCallback<String>() {
@Override
public String convertResponse(okhttp3.Response response) throws Throwable {
if (response.body() != null) {
@ -866,12 +894,16 @@ public class SourceViewModel extends ViewModel {
} else if (type == 4) {
String extend=sourceBean.getExt();
extend=getFixUrl(extend);
OkGo.<String>get(sourceBean.getApi())
.params("play", url)
.params("flag" ,playFlag)
.params("extend", extend)
.tag("play")
.execute(new AbsCallback<String>() {
GetRequest<String> request = OkGo.<String>get(sourceBean.getApi())
.tag("play")
.params("play", url)
.params("flag" ,playFlag);
// 当 extend 不为空且非空字符串时添加参数
if (extend != null && !extend.isEmpty()) {
request.params("extend", extend);
}
request.execute(new AbsCallback<String>() {
@Override
public String convertResponse(okhttp3.Response response) throws Throwable {
if (response.body() != null) {

Loading…
Cancel
Save