提升用户体验

pull/144/head
于俊 1 year ago
parent ca6cba6abb
commit b3e160dbe1
  1. 40
      app/src/main/java/com/github/tvbox/osc/ui/activity/HomeActivity.java
  2. 2
      app/src/main/java/com/github/tvbox/osc/ui/fragment/ModelSettingFragment.java
  3. 2
      app/src/main/java/com/github/tvbox/osc/util/Proxy.java
  4. 4
      app/src/main/java/com/github/tvbox/osc/util/parser/SuperParse.java

@ -663,27 +663,27 @@ public class HomeActivity extends BaseActivity {
ViewGroup.LayoutParams clp = cl_root.getLayoutParams();
clp.width = AutoSizeUtils.mm2px(mSiteSwitchDialog.getContext(), 380 + 200 * spanCount);
mSiteSwitchDialog.setTip("请选择首页数据源");
mSiteSwitchDialog.setAdapter(new SelectDialogAdapter.SelectDialogInterface<SourceBean>() {
@Override
public void click(SourceBean value, int pos) {
ApiConfig.get().setSourceBean(value);
refreshHome();
}
@Override
public String getDisplay(SourceBean val) {
return val.getName();
}
}, new DiffUtil.ItemCallback<SourceBean>() {
@Override
public boolean areItemsTheSame(@NonNull SourceBean oldItem, @NonNull SourceBean newItem) {
return oldItem == newItem;
}
@Override
public boolean areContentsTheSame(@NonNull SourceBean oldItem, @NonNull SourceBean newItem) {
return oldItem.getKey().equals(newItem.getKey());
}
}, sites, select);
}
mSiteSwitchDialog.setAdapter(new SelectDialogAdapter.SelectDialogInterface<SourceBean>() {
@Override
public void click(SourceBean value, int pos) {
ApiConfig.get().setSourceBean(value);
refreshHome();
}
@Override
public String getDisplay(SourceBean val) {
return val.getName();
}
}, new DiffUtil.ItemCallback<SourceBean>() {
@Override
public boolean areItemsTheSame(@NonNull SourceBean oldItem, @NonNull SourceBean newItem) {
return oldItem == newItem;
}
@Override
public boolean areContentsTheSame(@NonNull SourceBean oldItem, @NonNull SourceBean newItem) {
return oldItem.getKey().equals(newItem.getKey());
}
}, sites, select);
mSiteSwitchDialog.show();
}

@ -746,7 +746,6 @@ public class ModelSettingFragment extends BaseLazyFragment {
try {
if(cacheDir.exists())FileUtils.cleanDirectory(cacheDir);
if(cspCacheDir.exists()){
ApiConfig.get().clearJarLoader();
FileUtils.cleanDirectory(cspCacheDir);
}
} catch (Exception e) {
@ -754,7 +753,6 @@ public class ModelSettingFragment extends BaseLazyFragment {
}
}).start();
Toast.makeText(getContext(), "播放&JAR缓存已清空", Toast.LENGTH_LONG).show();
return;
}

@ -30,7 +30,7 @@ public class Proxy {
//TODO
return null;
}
else if (what.equals("MixWeb")) {
else if (what.equals("SuperParse")) {
return SuperParse.loadHtml(params.get("flag"), params.get("url"));
}

@ -114,10 +114,10 @@ public class SuperParse {
}
}
}
// 缓存 webview 解析的地址
if (!webJx.isEmpty()) {
flagWebJx.put(flag, webJx);
}
//同时进行json和web
ExecutorService exec = Executors.newFixedThreadPool(2);
CompletionService<JSONObject> cs = new ExecutorCompletionService<>(exec);
List<Future<JSONObject>> tasks = new ArrayList<>();
@ -136,7 +136,7 @@ public class SuperParse {
String encodedUrl = Base64.encodeToString(url.getBytes(),
Base64.DEFAULT | Base64.URL_SAFE | Base64.NO_WRAP);
try {
webResult.put("url", "proxy://go=MixWeb&flag=" + flag + "&url=" + encodedUrl);
webResult.put("url", "proxy://go=SuperParse&flag=" + flag + "&url=" + encodedUrl);
webResult.put("parse", 1);
webResult.put("ua", Utils.UaWinChrome);
} catch (Exception e) {

Loading…
Cancel
Save