pull/123/head
FongMi 3 years ago
parent 3db976b11e
commit 1a6111b7d1
  1. 3
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/DetailActivity.java
  2. 2
      app/src/main/java/com/fongmi/android/tv/player/ParseTask.java
  3. 1
      app/src/main/java/com/fongmi/android/tv/player/Players.java
  4. 16
      app/src/main/java/com/fongmi/android/tv/ui/custom/CustomWebView.java

@ -800,6 +800,7 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
private void onError(String msg) {
showError(msg);
hideProgress();
mPlayers.reset();
App.removeCallbacks(mR4);
Clock.get().setCallback(null);
checkNext(mBinding.flag.getSelectedPosition());
@ -807,10 +808,8 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
private void checkNext(int position) {
if (position == mFlagAdapter.size() - 1) {
mPlayers.stop();
checkSearch();
} else {
mPlayers.reset();
nextFlag(position);
}
}

@ -128,7 +128,7 @@ public class ParseTask {
public void cancel() {
if (executor != null) executor.shutdownNow();
if (webView != null) webView.stop(false);
if (webView != null) webView.stop();
executor = null;
callback = null;
webView = null;

@ -109,6 +109,7 @@ public class Players implements Player.Listener, IMediaPlayer.OnInfoListener, IM
public void reset() {
this.errorCode = 0;
this.retry = 0;
stopParse();
}
public int getRetry() {

@ -115,26 +115,18 @@ public class CustomWebView extends WebView {
String cookie = CookieManager.getInstance().getCookie(url);
if (!TextUtils.isEmpty(cookie)) news.put("cookie", cookie);
for (String key : headers.keySet()) if (keys.contains(key.toLowerCase())) news.put(key, headers.get(key));
App.post(() -> {
onSuccess(news, url);
stop(false);
});
App.post(() -> onSuccess(news, url));
}
public void stop(boolean error) {
public void stop() {
stopLoading();
loadUrl("about:blank");
if (error) App.post(this::onError);
else callback = null;
callback = null;
}
private void onSuccess(Map<String, String> news, String url) {
if (callback != null) callback.onParseSuccess(news, url, "");
callback = null;
}
private void onError() {
if (callback != null) callback.onParseError();
callback = null;
stop();
}
}

Loading…
Cancel
Save