pull/605/head
jhengazuki 5 months ago
parent c760d2546f
commit 20ab32948e
  1. 7
      app/src/main/java/com/fongmi/android/tv/App.java
  2. 2
      app/src/main/java/com/fongmi/android/tv/player/ParseJob.java

@ -44,6 +44,7 @@ public class App extends Application {
private Activity activity;
private final Gson gson;
private final long time;
private boolean sniff;
private Hook hook;
public App() {
@ -104,6 +105,10 @@ public class App extends Application {
for (Runnable r : runnable) get().handler.removeCallbacks(r);
}
public void setSniff(boolean sniff) {
this.sniff = sniff;
}
public void setHook(Hook hook) {
this.hook = hook;
}
@ -175,6 +180,6 @@ public class App extends Application {
@Override
public String getPackageName() {
return hook != null ? hook.getPackageName() : Chromium.find() ? Chromium.PKG : getBaseContext().getPackageName();
return hook != null ? hook.getPackageName() : sniff && Chromium.find() ? Chromium.PKG : getBaseContext().getPackageName();
}
}

@ -186,6 +186,7 @@ public class ParseJob implements ParseCallback {
private void startWeb(String key, String from, Map<String, String> headers, String url, String click) {
App.post(() -> webViews.add(CustomWebView.create(App.get()).start(key, from, headers, url, click, this, !url.contains("player/?url="))));
App.get().setSniff(true);
}
private Map<String, String> getHeader(JsonObject object) {
@ -215,6 +216,7 @@ public class ParseJob implements ParseCallback {
for (CustomWebView webView : webViews) webView.stop(false);
for (CustomWebView webView : webViews) webView.destroy();
if (!webViews.isEmpty()) webViews.clear();
App.get().setSniff(false);
}
public void stop() {

Loading…
Cancel
Save