正在查看: Top浏览器 v4.6.16 应用的 BrowserFragment.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Top浏览器 v4.6.16 应用的 BrowserFragment.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.pocket.topbrowser.browser;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.animation.Animation;
import android.webkit.MimeTypeMap;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.VideoView;
import androidx.activity.OnBackPressedCallback;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import androidx.core.view.ViewGroupKt;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModel;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import c.t.a.u.a;
import c.t.a.w.n0;
import c.t.a.w.r0;
import c.t.c.j.f1.e.k0;
import c.t.c.j.q1.o;
import c.t.c.j.x0;
import c.t.c.j.z0;
import com.google.android.material.snackbar.Snackbar;
import com.pocket.common.base.BackViewModelFragment;
import com.pocket.common.base.BaseFragment;
import com.pocket.common.base.DataBindingFragment;
import com.pocket.common.db.subscribe.SubscribeEntity;
import com.pocket.common.dialog.confirm.ConfirmDialog;
import com.pocket.common.dialog.list.ListDialog;
import com.pocket.common.lifecycle.SingleLiveEvent;
import com.pocket.common.provider.ReadBookFragmentProvider;
import com.pocket.common.provider.ReaderSkillsProvider;
import com.pocket.common.provider.subscribe.Subscribe;
import com.pocket.common.view.video.TopVideoView;
import com.pocket.topbrowser.browser.BrowserFragment;
import com.pocket.topbrowser.browser.BrowserViewModel;
import com.pocket.topbrowser.browser.activity.BookChapterResult;
import com.pocket.topbrowser.browser.av.DLNACastActivity;
import com.pocket.topbrowser.browser.av.SnifferVideoInfo;
import com.pocket.topbrowser.browser.av.VideoActivity;
import com.pocket.topbrowser.browser.dialog.FoundVideoDialog;
import com.pocket.topbrowser.browser.dialog.tool.MenuDialog;
import com.pocket.topbrowser.browser.search.SearchFragment;
import com.pocket.topbrowser.browser.sniffing.VideoCatalogueEntity;
import com.pocket.topbrowser.browser.view.PageFindView;
import com.pocket.topbrowser.browser.view.WebContainerLayout;
import com.pocket.topbrowser.browser.view.progress.AnimatedProgressBar;
import com.pocket.topbrowser.browser.view.webview.WebViewNav;
import com.pocket.topbrowser.browser.view.webview.WebViewToolbar;
import com.pocket.topbrowser.browser.view.webview.YaWebView;
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.SortedMap;
import org.adblockplus.libadblockplus.android.settings.Utils;
public final class BrowserFragment extends BackViewModelFragment implements c.t.c.j.r1.z.r {
private static final int FILE_CHOOSER_REQUEST_CODE = 1111;
private static final int FLOAT_REQUEST_CODE = 2222;
public static final String INTENT_PANIC_TRIGGER = "info.guardianproject.panic.action.TRIGGER";
private static final String SEARCH_WORD = "search_word";
private final ActivityResultLauncher<c.t.c.j.a1.a> bookChapterActivity;
private c.t.c.j.q1.h browserAnimatorHelper;
private BrowserViewModel browserViewModel;
private String cameraPhotoPath;
private z0 controller;
private String currentTitle;
private String currentUrl;
private View customView;
private WebChromeClient.CustomViewCallback customViewCallback;
private EditSubscribeDialog editSubscribeDialog;
private ValueCallback<Uri[]> filePathCallback;
private FrameLayout fullscreenContainerView;
private long lastEnterAVTime;
private long lastEnterReadTime;
private int originalOrientation;
private PageFindView pageFindView;
private Animation readerViewHide;
private Animation readerViewIn;
private Animation readerViewOut;
private c.t.c.j.h1.d.d.b scriptBrowser;
private String searchText;
private String searchWord;
private String sniffingVideoUrl;
private Snackbar subscribeHint;
private String subscribeNodeRule;
private ValueCallback<Uri> uploadMessageCallback;
private VideoView videoView;
public static final a Companion = new a(null);
private static final FrameLayout.LayoutParams COVER_SCREEN_PARAMS = new FrameLayout.LayoutParams(-1, -1);
private boolean readerViewShow = true;
private final List<String> pagerLoadUrlList = Collections.synchronizedList(new ArrayList());
private Map<String, String> searchMap = new LinkedHashMap();
private final ReaderSkillsProvider readerSkillsProvider = (ReaderSkillsProvider) c.a.a.a.d.a.c().g(ReaderSkillsProvider.class);
private final Map<String, c.t.a.j.a.b> readerUrlMap = new LinkedHashMap();
public static final class a {
public a() {
}
public a(h.b0.d.g gVar) {
this();
}
public static BrowserFragment b(a aVar, String str, boolean z, int i2, Object obj) {
if ((i2 & 1) != 0) {
str = null;
}
if ((i2 & 2) != 0) {
z = false;
}
return aVar.a(str, z);
}
public final BrowserFragment a(String str, boolean z) {
c.o.a.a.a("pop_all_back_stack").b("");
BrowserFragment browserFragment = new BrowserFragment();
Bundle bundle = new Bundle();
bundle.putString(BrowserFragment.SEARCH_WORD, str);
browserFragment.setArguments(bundle);
return browserFragment;
}
}
public final class b implements MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener {
public final BrowserFragment a;
public b(BrowserFragment browserFragment) {
h.b0.d.l.f(browserFragment, "this$0");
this.a = browserFragment;
}
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
h.b0.d.l.f(mediaPlayer, "mp");
this.a.onHideCustomView();
}
@Override
public boolean onError(MediaPlayer mediaPlayer, int i2, int i3) {
h.b0.d.l.f(mediaPlayer, "mp");
return false;
}
}
public static final class c implements ReaderSkillsProvider.b {
public final c.t.a.j.a.b b;
public c(c.t.a.j.a.b bVar) {
this.b = bVar;
}
public void a(String str, String str2, String str3) {
h.b0.d.l.f(str, "webUrl");
boolean z = false;
if (str2 != null) {
if (str2.length() > 0) {
z = true;
}
}
if (z) {
z0 z0Var = BrowserFragment.this.controller;
BrowserViewModel browserViewModel = null;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
if (TextUtils.equals(str, z0Var.h())) {
this.b.c(str2);
BrowserFragment.this.readerUrlMap.put(str, this.b);
BrowserFragment.this.readerViewIn();
if (c.h.b.i.c.b("open_auto_reader", true) && BrowserFragment.this.isCurrWindow()) {
c.h.b.b.a.b.d("top_auto_reader_model");
BrowserViewModel browserViewModel2 = BrowserFragment.this.browserViewModel;
if (browserViewModel2 == null) {
h.b0.d.l.u("browserViewModel");
} else {
browserViewModel = browserViewModel2;
}
browserViewModel.z(str2);
}
}
}
}
}
public static final class d implements ReaderSkillsProvider.b {
public d() {
}
public void a(java.lang.String r7, java.lang.String r8, java.lang.String r9) {
throw new UnsupportedOperationException("Method not decompiled: com.pocket.topbrowser.browser.BrowserFragment.d.a(java.lang.String, java.lang.String, java.lang.String):void");
}
}
public static final class e extends c.t.a.w.g {
public e() {
}
public void onAnimationEnd(Animation animation) {
BrowserFragment.this.readerViewShow = true;
}
}
public static final class f extends c.t.a.w.g {
public f() {
}
public void onAnimationEnd(Animation animation) {
BrowserFragment.this.readerViewShow = false;
View view = BrowserFragment.this.getView();
View findViewById = view == null ? null : view.findViewById(R$id.cv_reader);
h.b0.d.l.e(findViewById, "cv_reader");
c.t.a.k.n.e(findViewById);
}
}
public static final class g extends c.t.a.w.g {
public g() {
}
public void onAnimationEnd(Animation animation) {
BrowserFragment.this.readerViewShow = false;
View view = BrowserFragment.this.getView();
View findViewById = view == null ? null : view.findViewById(R$id.cv_reader);
h.b0.d.l.e(findViewById, "cv_reader");
c.t.a.k.n.e(findViewById);
}
}
public static final class h extends h.b0.d.m implements h.b0.c.l<Integer, h.u> {
public h() {
super(1);
}
public final void a(int i2) {
z0 z0Var = BrowserFragment.this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
z0Var.p();
}
@Override
public h.u invoke(Integer num) {
a(num.intValue());
return h.u.a;
}
}
public static final class i extends h.b0.d.m implements h.b0.c.l<Integer, h.u> {
public static final i a = new i();
public i() {
super(1);
}
public final void a(int i2) {
}
@Override
public h.u invoke(Integer num) {
a(num.intValue());
return h.u.a;
}
}
public static final class j extends h.b0.d.m implements h.b0.c.l<c.t.a.j.a.b, h.u> {
public j() {
super(1);
}
public final void a(c.t.a.j.a.b bVar) {
h.b0.d.l.f(bVar, "it");
BrowserFragment.this.autoReaderModel(bVar);
}
@Override
public h.u invoke(c.t.a.j.a.b bVar) {
a(bVar);
return h.u.a;
}
}
public static final class k extends h.b0.d.m implements h.b0.c.l<String, h.u> {
public k() {
super(1);
}
public final void a(String str) {
h.b0.d.l.f(str, "it");
Snackbar snackbar = BrowserFragment.this.subscribeHint;
if (snackbar != null) {
snackbar.dismiss();
}
BrowserFragment.this.subscribeNodeRule = str;
}
@Override
public h.u invoke(String str) {
a(str);
return h.u.a;
}
}
public static final class l extends h.b0.d.m implements h.b0.c.l<c.t.a.x.i.t, h.u> {
public l() {
super(1);
}
public final void a(c.t.a.x.i.t tVar) {
h.b0.d.l.f(tVar, "videoInfo");
z0 z0Var = BrowserFragment.this.controller;
Object obj = null;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
Iterator<T> it2 = z0Var.i().iterator();
while (true) {
if (!it2.hasNext()) {
break;
}
Object next = it2.next();
if (h.b0.d.l.b(((YaWebView) next).getUrl(), tVar.g())) {
obj = next;
break;
}
}
YaWebView yaWebView = (YaWebView) obj;
if (yaWebView == null) {
return;
}
tVar.i(yaWebView.getTitle());
yaWebView.replaceVideo(tVar);
}
@Override
public h.u invoke(c.t.a.x.i.t tVar) {
a(tVar);
return h.u.a;
}
}
public static final class m extends h.b0.d.m implements h.b0.c.l<Integer, h.u> {
public static final m a = new m();
public m() {
super(1);
}
public final void a(int i2) {
}
@Override
public h.u invoke(Integer num) {
a(num.intValue());
return h.u.a;
}
}
public static final class n extends h.b0.d.m implements h.b0.c.a<h.u> {
public n() {
super(0);
}
@Override
public h.u invoke() {
invoke2();
return h.u.a;
}
public final void invoke2() {
BrowserFragment.this.back();
}
}
public static final class o extends h.b0.d.m implements h.b0.c.a<h.u> {
public o() {
super(0);
}
@Override
public h.u invoke() {
invoke2();
return h.u.a;
}
public final void invoke2() {
BrowserFragment.this.forward();
}
}
public static final class p implements WebViewNav.a {
public p() {
}
@Override
public void a() {
c.h.b.c.a.a("open_multi_window").h(0);
}
@Override
public void b() {
BrowserFragment.this.toggleWebViewState(true, true);
FragmentActivity g2 = c.h.b.o.a.h().g();
if (g2 instanceof FragmentActivity) {
List fragments = g2.getSupportFragmentManager().getFragments();
h.b0.d.l.e(fragments, "mainActivity.supportFragmentManager.fragments");
ArrayList arrayList = new ArrayList();
for (Object obj : fragments) {
if (h.b0.d.l.b(((Fragment) obj).getClass().getCanonicalName(), "com.pocket.topbrowser.home.main.MainFragment")) {
arrayList.add(obj);
}
}
int indexOf = arrayList.indexOf(BrowserFragment.this.getParentFragment());
if (indexOf >= 0) {
c.o.a.a.a("delete_curr_web_info").b(Integer.valueOf(indexOf));
}
}
c.h.b.c.a.a("go_home").h(1);
}
@Override
public void c() {
BrowserFragment.this.forward();
}
@Override
public void d() {
BrowserFragment.this.showMenuDialog();
}
@Override
public void e() {
if (((DataBindingFragment) BrowserFragment.this).mActivity.getRequestedOrientation() == 1) {
c.o.a.a.a("new_tab").b(new c.t.a.j.a.a("type_new_window_open", ""));
}
}
@Override
public void goBack() {
BrowserFragment.this.back();
}
}
public static final class q implements WebViewToolbar.a {
public static final class a implements c.t.b.a.k.a {
public final BrowserFragment a;
public a(BrowserFragment browserFragment) {
this.a = browserFragment;
}
public static final void d(BrowserFragment browserFragment) {
h.b0.d.l.f(browserFragment, "this$0");
if (browserFragment.isAdded()) {
View view = browserFragment.getView();
((WebViewToolbar) (view == null ? null : view.findViewById(R$id.toolbar))).j(true);
}
}
public static final void e(BrowserFragment browserFragment) {
h.b0.d.l.f(browserFragment, "this$0");
if (browserFragment.isAdded()) {
View view = browserFragment.getView();
((WebViewToolbar) (view == null ? null : view.findViewById(R$id.toolbar))).j(true);
}
}
public void a(String str) {
h.b0.d.l.f(str, Utils.SUBSCRIPTION_FIELD_URL);
this.a.hideLoadingDialog();
final BrowserFragment browserFragment = this.a;
c.h.b.o.i.c(new Runnable() {
@Override
public final void run() {
BrowserFragment.q.a.d(BrowserFragment.this);
}
}, 100L);
}
public void onSuccess(String str) {
this.a.hideLoadingDialog();
View view = this.a.getView();
if ((view == null ? null : view.findViewById(R$id.toolbar)) == null) {
return;
}
View view2 = this.a.getView();
((WebViewToolbar) (view2 == null ? null : view2.findViewById(R$id.toolbar))).j(true);
if (this.a.isAdded()) {
View view3 = this.a.getView();
if (((WebViewToolbar) (view3 == null ? null : view3.findViewById(R$id.toolbar))).getSubscribe()) {
this.a.subscribeOrCancel("", true, null);
return;
}
if (str == null || str.length() == 0) {
this.a.showDisableSubscribeDialog();
} else {
this.a.subscribeOrCancel(str, true, null);
}
final BrowserFragment browserFragment = this.a;
c.h.b.o.i.c(new Runnable() {
@Override
public final void run() {
BrowserFragment.q.a.e(BrowserFragment.this);
}
}, 100L);
}
}
}
public q() {
}
@Override
public void a() {
Map map = BrowserFragment.this.searchMap;
z0 z0Var = BrowserFragment.this.controller;
z0 z0Var2 = null;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
String str = (String) map.get(z0Var.h());
if (!TextUtils.isEmpty(str) && !c.t.a.i.e0.d.d(str)) {
c.t.a.w.t0.a f2 = c.t.a.w.t0.a.f();
FragmentManager parentFragmentManager = BrowserFragment.this.getParentFragmentManager();
SearchFragment.a aVar = SearchFragment.a;
String fragment = BrowserFragment.this.toString();
h.b0.d.l.e(fragment, "[email protected]()");
f2.c(parentFragmentManager, SearchFragment.a.b(aVar, fragment, str, null, 4, null));
return;
}
z0 z0Var3 = BrowserFragment.this.controller;
if (z0Var3 == null) {
h.b0.d.l.u("controller");
z0Var3 = null;
}
String h2 = z0Var3.h();
z0 z0Var4 = BrowserFragment.this.controller;
if (z0Var4 == null) {
h.b0.d.l.u("controller");
} else {
z0Var2 = z0Var4;
}
String f3 = z0Var2.f();
c.t.a.w.t0.a f4 = c.t.a.w.t0.a.f();
FragmentManager parentFragmentManager2 = BrowserFragment.this.getParentFragmentManager();
SearchFragment.a aVar2 = SearchFragment.a;
String fragment2 = BrowserFragment.this.toString();
h.b0.d.l.e(fragment2, "[email protected]()");
f4.c(parentFragmentManager2, aVar2.a(fragment2, f3, h2));
}
@Override
public void b() {
z0 z0Var = BrowserFragment.this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
String h2 = z0Var.h();
if (h2 == null) {
return;
}
BrowserFragment browserFragment = BrowserFragment.this;
View view = browserFragment.getView();
WebViewToolbar webViewToolbar = (WebViewToolbar) (view == null ? null : view.findViewById(R$id.toolbar));
boolean z = false;
if (webViewToolbar != null && webViewToolbar.getSubscribe()) {
z = true;
}
if (z) {
browserFragment.subscribeOrCancel("", true, null);
} else {
browserFragment.showLoadingDialog();
c.t.b.a.i.a.m(h2, (String) null, new a(browserFragment));
}
}
@Override
public void onRefresh() {
boolean z;
z0 z0Var = BrowserFragment.this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
z0Var.o();
Snackbar snackbar = BrowserFragment.this.subscribeHint;
boolean z2 = true;
if (snackbar != null && snackbar.isShown()) {
Snackbar snackbar2 = BrowserFragment.this.subscribeHint;
if (snackbar2 != null) {
snackbar2.dismiss();
}
z = true;
} else {
z = false;
}
View view = BrowserFragment.this.getView();
View findViewById = view == null ? null : view.findViewById(R$id.v_subscribe_menu);
h.b0.d.l.e(findViewById, "v_subscribe_menu");
ViewGroup.LayoutParams layoutParams = findViewById.getLayoutParams();
ViewGroup.MarginLayoutParams marginLayoutParams = layoutParams instanceof ViewGroup.MarginLayoutParams ? (ViewGroup.MarginLayoutParams) layoutParams : null;
if ((marginLayoutParams != null ? marginLayoutParams.bottomMargin : 0) == 0) {
BrowserFragment.this.cancelManualSubscribe();
} else {
z2 = z;
}
if (z2) {
}
}
}
public static final class r implements c.t.b.a.k.a {
public r() {
}
public static final void d(BrowserFragment browserFragment) {
h.b0.d.l.f(browserFragment, "this$0");
if (browserFragment.isAdded()) {
View view = browserFragment.getView();
((WebViewToolbar) (view == null ? null : view.findViewById(R$id.toolbar))).j(true);
}
}
public static final void e(BrowserFragment browserFragment) {
h.b0.d.l.f(browserFragment, "this$0");
if (browserFragment.isAdded()) {
View view = browserFragment.getView();
((WebViewToolbar) (view == null ? null : view.findViewById(R$id.toolbar))).j(true);
}
}
public void a(String str) {
h.b0.d.l.f(str, Utils.SUBSCRIPTION_FIELD_URL);
BrowserFragment.this.hideLoadingDialog();
final BrowserFragment browserFragment = BrowserFragment.this;
c.h.b.o.i.c(new Runnable() {
@Override
public final void run() {
BrowserFragment.r.d(BrowserFragment.this);
}
}, 100L);
}
public void onSuccess(String str) {
BrowserFragment.this.hideLoadingDialog();
if (BrowserFragment.this.isAdded()) {
if (str == null || str.length() == 0) {
BrowserFragment.this.cancelManualSubscribe();
BrowserFragment.this.showToast("暂不支持该站点");
} else {
BrowserFragment browserFragment = BrowserFragment.this;
browserFragment.subscribeOrCancel(str, false, browserFragment.subscribeNodeRule);
}
final BrowserFragment browserFragment2 = BrowserFragment.this;
c.h.b.o.i.c(new Runnable() {
@Override
public final void run() {
BrowserFragment.r.e(BrowserFragment.this);
}
}, 100L);
}
}
}
public static final class s extends h.b0.d.m implements h.b0.c.l<Integer, h.u> {
public s() {
super(1);
}
public final void a(int i2) {
BrowserFragment.this.resetThemeColor();
}
@Override
public h.u invoke(Integer num) {
a(num.intValue());
return h.u.a;
}
}
public static final class t extends h.b0.d.m implements h.b0.c.l<Integer, h.u> {
public static final t a = new t();
public t() {
super(1);
}
public final void a(int i2) {
Activity g2 = c.h.b.o.a.h().g();
Object invoke = g2.getClass().getMethod("getCurrMainFragment", new Class[0]).invoke(g2, new Object[0]);
Objects.requireNonNull(invoke, "null cannot be cast to non-null type androidx.fragment.app.Fragment");
List fragments = ((Fragment) invoke).getChildFragmentManager().getFragments();
h.b0.d.l.e(fragments, "currMainFragment.childFragmentManager.fragments");
BrowserFragment browserFragment = (Fragment) fragments.get(fragments.size() - 1);
if (browserFragment instanceof BrowserFragment) {
BrowserFragment.toggleWebViewState$default(browserFragment, false, false, 2, null);
}
}
@Override
public h.u invoke(Integer num) {
a(num.intValue());
return h.u.a;
}
}
public static final class u extends h.b0.d.m implements h.b0.c.l<Boolean, h.u> {
public u() {
super(1);
}
public final void a(boolean z) {
View view = BrowserFragment.this.getView();
((WebContainerLayout) (view == null ? null : view.findViewById(R$id.fl_web_container))).setGestureEnable(z);
}
@Override
public h.u invoke(Boolean bool) {
a(bool.booleanValue());
return h.u.a;
}
}
public static final class v extends h.b0.d.m implements h.b0.c.a<h.u> {
public v() {
super(0);
}
public static final void a(BrowserFragment browserFragment, Boolean bool) {
h.b0.d.l.f(browserFragment, "this$0");
h.b0.d.l.e(bool, "success");
if (bool.booleanValue()) {
browserFragment.showToast("申请支持成功");
} else {
browserFragment.showToast("申请支持失败");
}
}
@Override
public h.u invoke() {
invoke2();
return h.u.a;
}
public final void invoke2() {
z0 z0Var = BrowserFragment.this.controller;
BrowserViewModel browserViewModel = null;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
String h2 = z0Var.h();
if (h2 == null) {
return;
}
final BrowserFragment browserFragment = BrowserFragment.this;
BrowserViewModel browserViewModel2 = browserFragment.browserViewModel;
if (browserViewModel2 == null) {
h.b0.d.l.u("browserViewModel");
} else {
browserViewModel = browserViewModel2;
}
browserViewModel.p(h2).observe(browserFragment, new Observer() {
public final void onChanged(Object obj) {
BrowserFragment.v.a(BrowserFragment.this, (Boolean) obj);
}
});
}
}
public static final class w extends h.b0.d.m implements h.b0.c.a<h.u> {
public w() {
super(0);
}
@Override
public h.u invoke() {
invoke2();
return h.u.a;
}
public final void invoke2() {
BrowserFragment.this.manualSubscribe();
}
}
public static final class x implements k0 {
public static final class a implements PageFindView.b {
public final BrowserFragment a;
public a(BrowserFragment browserFragment) {
this.a = browserFragment;
}
public static final void e(BrowserFragment browserFragment, int i2, int i3, boolean z) {
h.b0.d.l.f(browserFragment, "this$0");
PageFindView pageFindView = browserFragment.pageFindView;
if (pageFindView == null) {
return;
}
pageFindView.e(i2 + 1, i3);
}
@Override
public void a() {
z0 z0Var = this.a.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
YaWebView g2 = z0Var.g();
if (g2 == null) {
return;
}
g2.findNext(true);
}
@Override
public void b() {
z0 z0Var = this.a.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
YaWebView g2 = z0Var.g();
if (g2 == null) {
return;
}
g2.findNext(false);
}
@Override
public void c(String str) {
h.b0.d.l.f(str, "keyword");
z0 z0Var = this.a.controller;
z0 z0Var2 = null;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
YaWebView g2 = z0Var.g();
if (g2 != null) {
final BrowserFragment browserFragment = this.a;
g2.setFindListener(new WebView.FindListener() {
@Override
public final void onFindResultReceived(int i2, int i3, boolean z) {
BrowserFragment.x.a.e(BrowserFragment.this, i2, i3, z);
}
});
}
z0 z0Var3 = this.a.controller;
if (z0Var3 == null) {
h.b0.d.l.u("controller");
} else {
z0Var2 = z0Var3;
}
YaWebView g3 = z0Var2.g();
if (g3 == null) {
return;
}
g3.findAllAsync(str);
}
@Override
public void onClose() {
z0 z0Var = this.a.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
YaWebView g2 = z0Var.g();
if (g2 == null) {
return;
}
g2.findAllAsync("");
}
}
public static final class b extends h.b0.d.m implements h.b0.c.a<h.u> {
public final BrowserFragment a;
public final String b;
public static final class a implements o.b {
public final BrowserFragment a;
public a(BrowserFragment browserFragment) {
this.a = browserFragment;
}
public static final void d(String str) {
h.b0.d.l.f(str, "$path");
c.h.b.d.d dVar = c.h.b.d.d.a;
List list = (List) dVar.b("offline_page");
if (list == null) {
list = new ArrayList();
}
list.add(str);
dVar.c("offline_page", list);
}
@Override
public void a(final String str) {
h.b0.d.l.f(str, "path");
this.a.showToast("保存网页成功");
c.h.b.n.b.g().f(new Runnable() {
@Override
public final void run() {
BrowserFragment.x.b.a.d(str);
}
});
}
@Override
public void b() {
this.a.showToast("保存网页失败");
}
}
public b(BrowserFragment browserFragment, String str) {
super(0);
this.a = browserFragment;
this.b = str;
}
@Override
public h.u invoke() {
invoke2();
return h.u.a;
}
public final void invoke2() {
z0 z0Var = this.a.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
YaWebView g2 = z0Var.g();
if (g2 == null) {
return;
}
BrowserFragment browserFragment = this.a;
String str = this.b;
Activity activity = browserFragment.getActivity();
if (activity == null) {
return;
}
new c.t.c.j.q1.o().e(activity, g2, h.b0.d.l.m(str, ".pdf"), new a(browserFragment));
}
}
public static final class c extends h.b0.d.m implements h.b0.c.a<h.u> {
public final BrowserFragment a;
public final String b;
public c(BrowserFragment browserFragment, String str) {
super(0);
this.a = browserFragment;
this.b = str;
}
public static final void a(String str) {
h.b0.d.l.f(str, "$path");
c.h.b.d.d dVar = c.h.b.d.d.a;
List list = (List) dVar.b("offline_page");
if (list == null) {
list = new ArrayList();
}
list.add(h.b0.d.l.m(str, ".mht"));
dVar.c("offline_page", list);
}
@Override
public h.u invoke() {
invoke2();
return h.u.a;
}
public final void invoke2() {
z0 z0Var = this.a.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
YaWebView g2 = z0Var.g();
if (g2 == null) {
return;
}
final String str = this.b;
BrowserFragment browserFragment = this.a;
g2.saveWebArchive(h.b0.d.l.m(str, ".mht"));
browserFragment.showToast("保存网页成功");
c.h.b.n.b.g().f(new Runnable() {
@Override
public final void run() {
BrowserFragment.x.c.a(str);
}
});
}
}
public x() {
}
@Override
public void a() {
z0 z0Var = BrowserFragment.this.controller;
z0 z0Var2 = null;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
z0Var.q();
z0 z0Var3 = BrowserFragment.this.controller;
if (z0Var3 == null) {
h.b0.d.l.u("controller");
} else {
z0Var2 = z0Var3;
}
z0Var2.o();
}
@Override
public void b() {
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -2);
layoutParams.addRule(12);
BrowserFragment browserFragment = BrowserFragment.this;
View view = BrowserFragment.this.getView();
Context context = ((RelativeLayout) (view == null ? null : view.findViewById(R$id.rl_container))).getContext();
h.b0.d.l.e(context, "rl_container.context");
browserFragment.pageFindView = new PageFindView(context, null, 0, 6, null);
PageFindView pageFindView = BrowserFragment.this.pageFindView;
if (pageFindView != null) {
pageFindView.setPageFindListener(new a(BrowserFragment.this));
}
View view2 = BrowserFragment.this.getView();
((RelativeLayout) (view2 != null ? view2.findViewById(R$id.rl_container) : null)).addView(BrowserFragment.this.pageFindView, layoutParams);
}
@Override
public void c() {
z0 z0Var = BrowserFragment.this.controller;
z0 z0Var2 = null;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
String h2 = z0Var.h();
String a2 = h2 == null ? null : n0.a.a(h2);
if (a2 == null) {
return;
}
z0 z0Var3 = BrowserFragment.this.controller;
if (z0Var3 == null) {
h.b0.d.l.u("controller");
} else {
z0Var2 = z0Var3;
}
YaWebView g2 = z0Var2.g();
if (g2 == null) {
return;
}
g2.loadUrl("javascript:(function(){ var objs = document.getElementsByTagName(\"img\"); var array=new Array(); array = []; for(var j=0;j<objs.length;j++) { array[j]=objs[j].src; } window.imageListener.extractImage(array, \"" + a2 + "\"); })()");
}
@Override
public void d() {
StringBuilder sb = new StringBuilder();
sb.append(c.h.b.o.b.b().getFilesDir().getPath());
sb.append('/');
z0 z0Var = BrowserFragment.this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
String f2 = z0Var.f();
if (f2 == null) {
f2 = String.valueOf(System.currentTimeMillis());
}
sb.append(f2);
String sb2 = sb.toString();
new ListDialog.a().a("保存为PDF", new b(BrowserFragment.this, sb2)).a("保存为离线网页", new c(BrowserFragment.this, sb2)).d().q(BrowserFragment.this.getParentFragmentManager());
}
@Override
public void e() {
z0 z0Var;
z0 z0Var2 = BrowserFragment.this.controller;
if (z0Var2 == null) {
h.b0.d.l.u("controller");
z0Var2 = null;
}
String h2 = z0Var2.h();
if (h2 == null) {
return;
}
z0 z0Var3 = BrowserFragment.this.controller;
if (z0Var3 == null) {
h.b0.d.l.u("controller");
z0Var = null;
} else {
z0Var = z0Var3;
}
z0.n(z0Var, h.b0.d.l.m("view-source:", h2), null, false, 6, null);
}
@Override
public void f() {
String a2 = c.t.c.j.q1.j.a.a();
if (a2 == null) {
return;
}
z0 z0Var = BrowserFragment.this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
YaWebView g2 = z0Var.g();
if (g2 == null) {
return;
}
g2.evaluateJavascript(a2, null);
}
@Override
public void g() {
String str = BrowserFragment.this.currentTitle;
boolean z = true;
z0 z0Var = null;
if (!(str == null || str.length() == 0)) {
List c2 = c.t.a.w.r.b().c();
h.b0.d.l.e(c2, "getInstance().titleWhiteList()");
BrowserFragment browserFragment = BrowserFragment.this;
ArrayList arrayList = new ArrayList();
for (Object obj : c2) {
String str2 = (String) obj;
String str3 = browserFragment.currentTitle;
h.b0.d.l.d(str3);
h.b0.d.l.e(str2, "it");
if (h.i0.t.L(str3, str2, false, 2, null)) {
arrayList.add(obj);
}
}
z = arrayList.isEmpty();
}
if (!z) {
BrowserFragment.this.showToast("应版权方要求,该视频禁止进入影音模式");
return;
}
z0 z0Var2 = BrowserFragment.this.controller;
if (z0Var2 == null) {
h.b0.d.l.u("controller");
} else {
z0Var = z0Var2;
}
YaWebView g2 = z0Var.g();
if (g2 == null) {
return;
}
g2.reload();
}
@Override
public void h() {
z0 z0Var = BrowserFragment.this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
z0Var.l();
}
@Override
public void i() {
BrowserFragment.this.hideActionBar();
}
@Override
public void j() {
BrowserFragment.this.clickReaderModel();
}
@Override
public void refresh() {
z0 z0Var = BrowserFragment.this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
z0Var.o();
}
}
public static final class y extends h.b0.d.m implements h.b0.c.a<h.u> {
public y() {
super(0);
}
public static final void a(BrowserFragment browserFragment, Boolean bool) {
h.b0.d.l.f(browserFragment, "this$0");
h.b0.d.l.e(bool, "it");
if (bool.booleanValue()) {
View view = browserFragment.getView();
WebViewToolbar webViewToolbar = (WebViewToolbar) (view == null ? null : view.findViewById(R$id.toolbar));
if (webViewToolbar != null) {
webViewToolbar.setSubscribe(false);
}
c.h.b.c.a.a("update_subscribe_home").h(0);
}
}
@Override
public h.u invoke() {
invoke2();
return h.u.a;
}
public final void invoke2() {
BrowserViewModel browserViewModel = BrowserFragment.this.browserViewModel;
BrowserViewModel browserViewModel2 = null;
if (browserViewModel == null) {
h.b0.d.l.u("browserViewModel");
browserViewModel = null;
}
SubscribeEntity subscribeEntity = (SubscribeEntity) browserViewModel.x().get();
if (subscribeEntity == null) {
return;
}
final BrowserFragment browserFragment = BrowserFragment.this;
BrowserViewModel browserViewModel3 = browserFragment.browserViewModel;
if (browserViewModel3 == null) {
h.b0.d.l.u("browserViewModel");
} else {
browserViewModel2 = browserViewModel3;
}
browserViewModel2.q(subscribeEntity.getId()).observe(browserFragment, new Observer() {
public final void onChanged(Object obj) {
BrowserFragment.y.a(BrowserFragment.this, (Boolean) obj);
}
});
}
}
public static final class z implements c.t.a.q.a.a {
public final String b;
public z(String str) {
this.b = str;
}
public static final void a(BrowserFragment browserFragment, Boolean bool) {
h.b0.d.l.f(browserFragment, "this$0");
browserFragment.cancelManualSubscribe();
h.b0.d.l.e(bool, "it");
if (bool.booleanValue()) {
browserFragment.showLongToast(browserFragment.getString(R$string.browser_subscribe_success));
View view = browserFragment.getView();
WebViewToolbar webViewToolbar = (WebViewToolbar) (view == null ? null : view.findViewById(R$id.toolbar));
if (webViewToolbar != null) {
webViewToolbar.setSubscribe(true);
}
c.h.b.c.a.a("update_subscribe_home").h(0);
} else {
browserFragment.showLongToast(browserFragment.getString(R$string.browser_subscribe_failure));
}
EditSubscribeDialog editSubscribeDialog = browserFragment.editSubscribeDialog;
h.b0.d.l.d(editSubscribeDialog);
editSubscribeDialog.dismiss();
}
public void D(Subscribe subscribe) {
h.b0.d.l.f(subscribe, "subscribe");
c.t.b.a.j.a aVar = new c.t.b.a.j.a();
aVar.d(subscribe.a());
aVar.e(subscribe.c());
BrowserViewModel browserViewModel = BrowserFragment.this.browserViewModel;
if (browserViewModel == null) {
h.b0.d.l.u("browserViewModel");
browserViewModel = null;
}
SingleLiveEvent<Boolean> l2 = browserViewModel.l(subscribe.d(), subscribe.b(), this.b, aVar);
final BrowserFragment browserFragment = BrowserFragment.this;
l2.observe(browserFragment, new Observer() {
public final void onChanged(Object obj) {
BrowserFragment.z.a(BrowserFragment.this, (Boolean) obj);
}
});
}
public void w0() {
BrowserFragment.this.manualSubscribe();
}
}
public BrowserFragment() {
ActivityResultLauncher<c.t.c.j.a1.a> registerForActivityResult = registerForActivityResult(new BookChapterResult(), new ActivityResultCallback() {
public final void onActivityResult(Object obj) {
BrowserFragment.m2bookChapterActivity$lambda1(BrowserFragment.this, (String) obj);
}
});
h.b0.d.l.e(registerForActivityResult, "registerForActivityResul…)\n }\n }");
this.bookChapterActivity = registerForActivityResult;
this.sniffingVideoUrl = "";
}
public final void autoReaderModel(c.t.a.j.a.b bVar) {
c.t.a.j.a.b bVar2 = this.readerUrlMap.get(bVar.b());
BrowserViewModel browserViewModel = null;
String b2 = bVar2 == null ? null : bVar2.b();
if (b2 == null || b2.length() == 0) {
this.readerSkillsProvider.f(bVar.b(), bVar.a(), new c(bVar));
return;
}
if (c.h.b.i.c.b("open_auto_reader", true)) {
c.h.b.b.a.b.d("top_auto_reader_model");
BrowserViewModel browserViewModel2 = this.browserViewModel;
if (browserViewModel2 == null) {
h.b0.d.l.u("browserViewModel");
} else {
browserViewModel = browserViewModel2;
}
c.t.a.j.a.b bVar3 = this.readerUrlMap.get(bVar.b());
h.b0.d.l.d(bVar3);
browserViewModel.z(bVar3.b());
}
readerViewIn();
}
public static final void m1back$lambda28$lambda27(BrowserFragment browserFragment, Boolean bool) {
h.b0.d.l.f(browserFragment, "this$0");
View view = browserFragment.getView();
WebViewToolbar webViewToolbar = (WebViewToolbar) (view == null ? null : view.findViewById(R$id.toolbar));
if (webViewToolbar == null) {
return;
}
h.b0.d.l.e(bool, "subscribe");
webViewToolbar.setSubscribe(bool.booleanValue());
}
public static final void m2bookChapterActivity$lambda1(BrowserFragment browserFragment, String str) {
h.b0.d.l.f(browserFragment, "this$0");
if (str == null) {
return;
}
browserFragment.openReader(str);
}
public final void cancelManualSubscribe() {
View view = getView();
z0 z0Var = null;
if ((view == null ? null : view.findViewById(R$id.v_subscribe_menu)) == null) {
return;
}
View view2 = getView();
ViewGroup.LayoutParams layoutParams = ((ConstraintLayout) (view2 == null ? null : view2.findViewById(R$id.v_subscribe_menu))).getLayoutParams();
Objects.requireNonNull(layoutParams, "null cannot be cast to non-null type android.widget.RelativeLayout.LayoutParams");
final RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) layoutParams;
if (layoutParams2.bottomMargin <= c.t.a.k.f.a(-60)) {
return;
}
this.subscribeNodeRule = null;
ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
ofFloat.setDuration(300L);
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
BrowserFragment.m3cancelManualSubscribe$lambda20(BrowserFragment.this, layoutParams2, valueAnimator);
}
});
ofFloat.start();
z0 z0Var2 = this.controller;
if (z0Var2 == null) {
h.b0.d.l.u("controller");
} else {
z0Var = z0Var2;
}
YaWebView g2 = z0Var.g();
if (g2 == null) {
return;
}
g2.loadUrl("javascript:cancelSubscribeNode()");
}
public static final void m3cancelManualSubscribe$lambda20(BrowserFragment browserFragment, RelativeLayout.LayoutParams layoutParams, ValueAnimator valueAnimator) {
h.b0.d.l.f(browserFragment, "this$0");
h.b0.d.l.f(layoutParams, "$layoutParams");
View view = browserFragment.getView();
if ((view == null ? null : view.findViewById(R$id.v_subscribe_menu)) != null) {
Object animatedValue = valueAnimator.getAnimatedValue();
Objects.requireNonNull(animatedValue, "null cannot be cast to non-null type kotlin.Float");
layoutParams.bottomMargin = (int) (c.t.a.k.f.a(-60) * ((Float) animatedValue).floatValue());
View view2 = browserFragment.getView();
((ConstraintLayout) (view2 != null ? view2.findViewById(R$id.v_subscribe_menu) : null)).setLayoutParams(layoutParams);
}
}
public final void clickReaderModel() {
z0 z0Var = this.controller;
BrowserViewModel browserViewModel = null;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
String h2 = z0Var.h();
if (h2 == null) {
return;
}
c.t.a.j.a.b bVar = this.readerUrlMap.get(h2);
String b2 = bVar == null ? null : bVar.b();
if (b2 == null || b2.length() == 0) {
showLoadingDialog();
this.readerSkillsProvider.f(h2, (String) null, new d());
return;
}
BrowserViewModel browserViewModel2 = this.browserViewModel;
if (browserViewModel2 == null) {
h.b0.d.l.u("browserViewModel");
} else {
browserViewModel = browserViewModel2;
}
c.t.a.j.a.b bVar2 = this.readerUrlMap.get(h2);
h.b0.d.l.d(bVar2);
browserViewModel.z(bVar2.b());
readerViewIn();
}
private final void closePageFind() {
PageFindView pageFindView = this.pageFindView;
if (pageFindView == null) {
return;
}
h.b0.d.l.d(pageFindView);
if (pageFindView.getParent() != null) {
View view = getView();
((RelativeLayout) (view == null ? null : view.findViewById(R$id.rl_container))).removeView(this.pageFindView);
}
}
private final void fileAction(String str, String str2) {
File file = new File(str);
if (file.exists()) {
String mimeType = getMimeType(str);
if (TextUtils.isEmpty(mimeType)) {
return;
}
Intent intent = new Intent(str2);
if (Build.VERSION.SDK_INT >= 24) {
intent.setFlags(1);
intent.addFlags(268435456);
try {
intent.setDataAndType(FileProvider.getUriForFile(((DataBindingFragment) this).mActivity.getApplication(), "com.pocket.topbrowser.fileprovider", file), mimeType);
} catch (Exception e2) {
e2.printStackTrace();
}
} else {
intent.addFlags(268468224);
intent.setDataAndType(Uri.fromFile(file), mimeType);
}
try {
((DataBindingFragment) this).mActivity.startActivity(intent);
} catch (ActivityNotFoundException unused) {
showToast("不支持该格式打开");
}
}
}
public final void forward() {
c.t.a.p.a.e().i(false);
closePageFind();
z0 z0Var = this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
if (z0Var.b()) {
toggleWebViewState$default(this, true, false, 2, null);
z0 z0Var2 = this.controller;
if (z0Var2 == null) {
h.b0.d.l.u("controller");
z0Var2 = null;
}
z0Var2.k();
View view = getView();
WebViewNav webViewNav = (WebViewNav) (view == null ? null : view.findViewById(R$id.nav));
z0 z0Var3 = this.controller;
if (z0Var3 == null) {
h.b0.d.l.u("controller");
z0Var3 = null;
}
webViewNav.setCanGoForward(z0Var3.b());
z0 z0Var4 = this.controller;
if (z0Var4 == null) {
h.b0.d.l.u("controller");
z0Var4 = null;
}
String f2 = z0Var4.f();
if (f2 != null) {
View view2 = getView();
((WebViewToolbar) (view2 == null ? null : view2.findViewById(R$id.toolbar))).setTitleText(f2);
this.currentTitle = f2;
z0 z0Var5 = this.controller;
if (z0Var5 == null) {
h.b0.d.l.u("controller");
z0Var5 = null;
}
String h2 = z0Var5.h();
if (h2 != null) {
saveCurrWebInfo(h2, f2);
}
}
z0 z0Var6 = this.controller;
if (z0Var6 == null) {
h.b0.d.l.u("controller");
z0Var6 = null;
}
String h3 = z0Var6.h();
if (h3 != null) {
this.currentUrl = h3;
BrowserViewModel browserViewModel = this.browserViewModel;
if (browserViewModel == null) {
h.b0.d.l.u("browserViewModel");
browserViewModel = null;
}
browserViewModel.K(h3).observe(this, new Observer() {
public final void onChanged(Object obj) {
BrowserFragment.m4forward$lambda34$lambda33(BrowserFragment.this, (Boolean) obj);
}
});
}
toggleWebViewState$default(this, false, false, 2, null);
}
c.t.a.p.a.e().i(true);
}
public static final void m4forward$lambda34$lambda33(BrowserFragment browserFragment, Boolean bool) {
h.b0.d.l.f(browserFragment, "this$0");
View view = browserFragment.getView();
WebViewToolbar webViewToolbar = (WebViewToolbar) (view == null ? null : view.findViewById(R$id.toolbar));
if (webViewToolbar == null) {
return;
}
h.b0.d.l.e(bool, "subscribe");
webViewToolbar.setSubscribe(bool.booleanValue());
}
private final void initAnim() {
c.t.a.w.i iVar = c.t.a.w.i.a;
AppCompatActivity appCompatActivity = ((DataBindingFragment) this).mActivity;
h.b0.d.l.e(appCompatActivity, "mActivity");
Animation a2 = iVar.a(appCompatActivity, R$anim.anim_reader_in);
this.readerViewIn = a2;
Animation animation = null;
if (a2 == null) {
h.b0.d.l.u("readerViewIn");
a2 = null;
}
a2.setAnimationListener(new e());
AppCompatActivity appCompatActivity2 = ((DataBindingFragment) this).mActivity;
h.b0.d.l.e(appCompatActivity2, "mActivity");
Animation a3 = iVar.a(appCompatActivity2, R$anim.anim_reader_out);
this.readerViewOut = a3;
if (a3 == null) {
h.b0.d.l.u("readerViewOut");
a3 = null;
}
a3.setAnimationListener(new f());
AppCompatActivity appCompatActivity3 = ((DataBindingFragment) this).mActivity;
h.b0.d.l.e(appCompatActivity3, "mActivity");
Animation a4 = iVar.a(appCompatActivity3, R$anim.anim_reader_hide);
this.readerViewHide = a4;
if (a4 == null) {
h.b0.d.l.u("readerViewHide");
} else {
animation = a4;
}
animation.setAnimationListener(new g());
readerViewHide();
}
public final boolean isCurrWindow() {
Fragment parentFragment = getParentFragment();
if (parentFragment == null || !h.b0.d.l.b(parentFragment.getClass().getCanonicalName(), "com.pocket.topbrowser.home.main.MainFragment")) {
return false;
}
Object invoke = parentFragment.getClass().getMethod("isCurrWindow", new Class[0]).invoke(parentFragment, new Object[0]);
Objects.requireNonNull(invoke, "null cannot be cast to non-null type kotlin.Boolean");
return ((Boolean) invoke).booleanValue();
}
public final void manualSubscribe() {
z0 z0Var = this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
YaWebView g2 = z0Var.g();
if (g2 != null) {
g2.loadUrl("javascript:selectSubscribeNodeListener()");
}
this.subscribeHint = c.t.a.x.f.a("点击页面可更新的元素,如更新时间,章节列表,最新章节等,即可添加订阅。", -2);
ValueAnimator ofFloat = ValueAnimator.ofFloat(1.0f, 0.0f);
ofFloat.setDuration(300L);
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
BrowserFragment.m5manualSubscribe$lambda21(BrowserFragment.this, valueAnimator);
}
});
ofFloat.start();
}
public static final void m5manualSubscribe$lambda21(BrowserFragment browserFragment, ValueAnimator valueAnimator) {
h.b0.d.l.f(browserFragment, "this$0");
Object animatedValue = valueAnimator.getAnimatedValue();
Objects.requireNonNull(animatedValue, "null cannot be cast to non-null type kotlin.Float");
float floatValue = ((Float) animatedValue).floatValue();
View view = browserFragment.getView();
ViewGroup.LayoutParams layoutParams = ((ConstraintLayout) (view == null ? null : view.findViewById(R$id.v_subscribe_menu))).getLayoutParams();
Objects.requireNonNull(layoutParams, "null cannot be cast to non-null type android.widget.RelativeLayout.LayoutParams");
RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) layoutParams;
layoutParams2.bottomMargin = (int) (c.t.a.k.f.a(-60) * floatValue);
View view2 = browserFragment.getView();
((ConstraintLayout) (view2 != null ? view2.findViewById(R$id.v_subscribe_menu) : null)).setLayoutParams(layoutParams2);
}
public static final void m6onPageStarted$lambda40$lambda39(BrowserFragment browserFragment, Boolean bool) {
h.b0.d.l.f(browserFragment, "this$0");
View view = browserFragment.getView();
WebViewToolbar webViewToolbar = (WebViewToolbar) (view == null ? null : view.findViewById(R$id.toolbar));
if (webViewToolbar == null) {
return;
}
h.b0.d.l.e(bool, "subscribe");
webViewToolbar.setSubscribe(bool.booleanValue());
}
public static final void m7onUrlLoad$lambda37(BrowserFragment browserFragment, String str) {
h.b0.d.l.f(browserFragment, "this$0");
h.b0.d.l.f(str, "$url");
c.t.a.s.h.f().a(browserFragment.currentUrl, str, browserFragment.currentTitle);
}
public static final void m8onViewCreated$lambda10(BrowserFragment browserFragment) {
h.b0.d.l.f(browserFragment, "this$0");
z0 z0Var = browserFragment.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
z0Var.o();
View view = browserFragment.getView();
((SwipeRefreshLayout) (view != null ? view.findViewById(R$id.swipe_refresh_layout) : null)).setRefreshing(false);
}
public static final void m9onViewCreated$lambda11(BrowserFragment browserFragment, View view) {
h.b0.d.l.f(browserFragment, "this$0");
browserFragment.clickReaderModel();
}
public static final void m10onViewCreated$lambda13(BrowserFragment browserFragment, View view) {
h.b0.d.l.f(browserFragment, "this$0");
browserFragment.showLoadingDialog();
z0 z0Var = browserFragment.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
String h2 = z0Var.h();
if (h2 == null) {
return;
}
c.t.b.a.i.a.m(h2, browserFragment.subscribeNodeRule, browserFragment.new r());
}
public static final void m11onViewCreated$lambda14(BrowserFragment browserFragment, View view) {
h.b0.d.l.f(browserFragment, "this$0");
browserFragment.cancelManualSubscribe();
}
public static final void m12onViewCreated$lambda2(BrowserFragment browserFragment, Integer num) {
h.b0.d.l.f(browserFragment, "this$0");
OnBackPressedCallback onBackPressedCallback = ((BackViewModelFragment) browserFragment).onBackPressedCallback;
if (onBackPressedCallback == null) {
return;
}
onBackPressedCallback.setEnabled(false);
}
public static final void m13onViewCreated$lambda3(BrowserFragment browserFragment, Integer num) {
h.b0.d.l.f(browserFragment, "this$0");
browserFragment.searchText = new c.t.c.j.n1.n().a().getUrl();
}
public static final void m14onViewCreated$lambda4(BrowserFragment browserFragment, Integer num) {
h.b0.d.l.f(browserFragment, "this$0");
View view = browserFragment.getView();
Object findViewById = view == null ? null : view.findViewById(R$id.nav);
h.b0.d.l.e(num, "it");
((WebViewNav) findViewById).setWindowNumView(num.intValue());
}
public static final void m15onViewCreated$lambda5(BrowserFragment browserFragment, c.t.c.j.n1.m mVar) {
h.b0.d.l.f(browserFragment, "this$0");
browserFragment.toString();
throw null;
}
public static final void m16onViewCreated$lambda6(Integer num) {
}
public static final void m17onViewCreated$lambda7(BrowserFragment browserFragment, String str) {
h.b0.d.l.f(browserFragment, "this$0");
z0 z0Var = browserFragment.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
z0.n(z0Var, str, null, false, 6, null);
}
public static final void m18onViewCreated$lambda8(BrowserFragment browserFragment, BrowserViewModel.a aVar) {
h.b0.d.l.f(browserFragment, "this$0");
if (!aVar.a()) {
if (browserFragment.lastEnterReadTime <= 0 || System.currentTimeMillis() - browserFragment.lastEnterReadTime >= 500) {
browserFragment.lastEnterReadTime = System.currentTimeMillis();
if (TextUtils.equals("com.pocket.topbrowser.reader.activity.BookChapterActivity", c.h.b.o.a.h().i(false).getClass().getCanonicalName())) {
return;
}
browserFragment.bookChapterActivity.launch(new c.t.c.j.a1.a(aVar.b(), false));
return;
}
return;
}
if (browserFragment.lastEnterReadTime <= 0 || System.currentTimeMillis() - browserFragment.lastEnterReadTime >= 500) {
browserFragment.lastEnterReadTime = System.currentTimeMillis();
List fragments = browserFragment.getParentFragmentManager().getFragments();
h.b0.d.l.e(fragments, "parentFragmentManager.fragments");
Fragment fragment = (Fragment) h.w.s.K(fragments);
if (h.b0.d.l.b("com.pocket.topbrowser.reader.ReadBookFragment", fragment.getClass().getCanonicalName()) || !h.b0.d.l.b(BrowserFragment.class.getCanonicalName(), fragment.getClass().getCanonicalName()) || TextUtils.equals("com.pocket.topbrowser.reader.activity.BookChapterActivity", c.h.b.o.a.h().i(false).getClass().getCanonicalName())) {
return;
}
browserFragment.openReader(aVar.b());
}
}
public static final void m19onViewCreated$lambda9(BrowserFragment browserFragment, View view) {
h.b0.d.l.f(browserFragment, "this$0");
FoundVideoDialog.a aVar = FoundVideoDialog.p;
SnifferVideoInfo snifferVideoInfo = c.t.c.j.b1.k0.a;
h.b0.d.l.e(snifferVideoInfo, "snifferVideoInfo");
aVar.a(snifferVideoInfo).q(browserFragment.getChildFragmentManager());
}
private final void openAVModelActivity() {
if (this.lastEnterAVTime <= 0 || System.currentTimeMillis() - this.lastEnterAVTime >= 800) {
this.lastEnterAVTime = System.currentTimeMillis();
Class<?> cls = c.h.b.o.a.h().i(false).getClass();
if (h.b0.d.l.b(VideoActivity.class, cls) || h.b0.d.l.b(DLNACastActivity.class, cls)) {
return;
}
VideoActivity.a aVar = VideoActivity.a;
AppCompatActivity appCompatActivity = ((DataBindingFragment) this).mActivity;
h.b0.d.l.e(appCompatActivity, "mActivity");
aVar.a(appCompatActivity);
String g2 = c.t.c.j.q1.j.a.g();
if (g2 == null || g2.length() == 0) {
return;
}
z0 z0Var = this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
YaWebView g3 = z0Var.g();
if (g3 == null) {
return;
}
g3.evaluateJavascript(g2, null);
}
}
private final void openReader(String str) {
c.t.a.w.t0.a.f().c(getParentFragmentManager(), ((ReadBookFragmentProvider) c.a.a.a.d.a.c().g(ReadBookFragmentProvider.class)).j(str, true));
}
private final void readerViewHide() {
if (this.readerViewShow) {
View view = getView();
CardView cardView = (CardView) (view == null ? null : view.findViewById(R$id.cv_reader));
if (cardView != null) {
Animation animation = this.readerViewHide;
if (animation == null) {
h.b0.d.l.u("readerViewHide");
animation = null;
}
cardView.startAnimation(animation);
}
View view2 = getView();
TextView textView = (TextView) (view2 != null ? view2.findViewById(R$id.tv_reader) : null);
if (textView == null) {
return;
}
textView.setEnabled(false);
}
}
public final void readerViewIn() {
if (this.readerViewShow) {
return;
}
Map<String, c.t.a.j.a.b> map = this.readerUrlMap;
z0 z0Var = this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
c.t.a.j.a.b bVar = map.get(z0Var.h());
String b2 = bVar == null ? null : bVar.b();
if (b2 == null || b2.length() == 0) {
return;
}
View view = getView();
CardView cardView = (CardView) (view == null ? null : view.findViewById(R$id.cv_reader));
if (cardView != null) {
c.t.a.k.n.i(cardView);
}
View view2 = getView();
CardView cardView2 = (CardView) (view2 == null ? null : view2.findViewById(R$id.cv_reader));
if (cardView2 != null) {
Animation animation = this.readerViewIn;
if (animation == null) {
h.b0.d.l.u("readerViewIn");
animation = null;
}
cardView2.startAnimation(animation);
}
View view3 = getView();
TextView textView = (TextView) (view3 != null ? view3.findViewById(R$id.tv_reader) : null);
if (textView == null) {
return;
}
textView.setEnabled(true);
}
private final void readerViewOut() {
if (this.readerViewShow) {
View view = getView();
CardView cardView = (CardView) (view == null ? null : view.findViewById(R$id.cv_reader));
if (cardView != null) {
Animation animation = this.readerViewOut;
if (animation == null) {
h.b0.d.l.u("readerViewOut");
animation = null;
}
cardView.startAnimation(animation);
}
View view2 = getView();
TextView textView = (TextView) (view2 != null ? view2.findViewById(R$id.tv_reader) : null);
if (textView == null) {
return;
}
textView.setEnabled(false);
}
}
public final void resetThemeColor() {
z0 z0Var = this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
z0Var.r();
TypedValue typedValue = new TypedValue();
TypedValue typedValue2 = new TypedValue();
requireActivity().getTheme().resolveAttribute(R$attr.yaBackground, typedValue, true);
requireActivity().getTheme().resolveAttribute(R$attr.yaTextPrimary, typedValue2, true);
View view = getView();
((RelativeLayout) (view == null ? null : view.findViewById(R$id.rl_container))).setBackgroundResource(typedValue.resourceId);
View view2 = getView();
((WebViewToolbar) (view2 == null ? null : view2.findViewById(R$id.toolbar))).i(typedValue.resourceId, typedValue2.resourceId);
View view3 = getView();
((WebViewNav) (view3 != null ? view3.findViewById(R$id.nav) : null)).setIconColor(r0.a.b(typedValue2.resourceId));
}
private final void saveCurrWebInfo(String str, String str2) {
FragmentActivity g2 = c.h.b.o.a.h().g();
if (g2 instanceof FragmentActivity) {
List fragments = g2.getSupportFragmentManager().getFragments();
h.b0.d.l.e(fragments, "mainActivity.supportFragmentManager.fragments");
ArrayList arrayList = new ArrayList();
for (Object obj : fragments) {
if (h.b0.d.l.b(((Fragment) obj).getClass().getCanonicalName(), "com.pocket.topbrowser.home.main.MainFragment")) {
arrayList.add(obj);
}
}
int indexOf = arrayList.indexOf(getParentFragment());
if (indexOf >= 0) {
c.o.a.a.a("save_curr_web_info").b(new c.t.a.j.a.c(indexOf, str, str2));
}
}
}
private final void search(String str) {
z0 z0Var;
if (str.length() == 0) {
return;
}
if (h.i0.s.G(str, "view-source:", false, 2, null)) {
this.currentUrl = str;
Map<String, String> map = this.searchMap;
h.b0.d.l.d(str);
String str2 = this.currentUrl;
h.b0.d.l.d(str2);
map.put(str, str2);
} else {
String str3 = this.searchText;
if (str3 == null || str3.length() == 0) {
this.searchText = new c.t.c.j.n1.n().a().getUrl();
}
String valueOf = c.t.c.j.q1.p.a.a.y() == 6 ? String.valueOf(this.searchText) : h.b0.d.l.m(this.searchText, "%s");
Objects.requireNonNull(str, "null cannot be cast to non-null type kotlin.CharSequence");
this.currentUrl = c.t.c.j.q1.m.a(h.i0.t.M0(str).toString(), true, valueOf);
String a2 = c.t.c.j.q1.m.a(h.i0.t.M0(str).toString(), false, valueOf);
if (TextUtils.equals(str, a2)) {
Map<String, String> map2 = this.searchMap;
String str4 = this.currentUrl;
h.b0.d.l.d(str4);
map2.put(str4, a2);
}
}
z0 z0Var2 = this.controller;
if (z0Var2 == null) {
h.b0.d.l.u("controller");
z0Var = null;
} else {
z0Var = z0Var2;
}
String str5 = this.currentUrl;
h.b0.d.l.d(str5);
z0.n(z0Var, str5, null, false, 6, null);
}
private final void setFoundVideoView(int i2, int i3) {
View view = getView();
if ((view == null ? null : view.findViewById(R$id.rl_sniffing)) != null) {
View view2 = getView();
((RelativeLayout) (view2 == null ? null : view2.findViewById(R$id.rl_sniffing))).setVisibility(i2);
View view3 = getView();
((TextView) (view3 == null ? null : view3.findViewById(R$id.tv_sniffing_num))).setVisibility(i2);
if (i3 > 0) {
View view4 = getView();
((TextView) (view4 != null ? view4.findViewById(R$id.tv_sniffing_num) : null)).setText(String.valueOf(i3));
openAVModelActivity();
}
}
}
public static void setFoundVideoView$default(BrowserFragment browserFragment, int i2, int i3, int i4, Object obj) {
if ((i4 & 2) != 0) {
i3 = 0;
}
browserFragment.setFoundVideoView(i2, i3);
}
private final void showApplySupportDialog() {
new ConfirmDialog.a().v("订阅失败").r("请确认是在小说、影视、漫画等详情页进行订阅").n("确定申请").m(new v()).a().q(getChildFragmentManager());
}
public final void showDisableSubscribeDialog() {
new ConfirmDialog.a().v("添加订阅").r("页面上没有更新时间,请手动抓取订说").n("手动抓取订阅").m(new w()).a().q(getChildFragmentManager());
}
public final void showMenuDialog() {
MenuDialog.a aVar = MenuDialog.Companion;
z0 z0Var = this.controller;
z0 z0Var2 = null;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
String h2 = z0Var.h();
z0 z0Var3 = this.controller;
if (z0Var3 == null) {
h.b0.d.l.u("controller");
} else {
z0Var2 = z0Var3;
}
MenuDialog a2 = aVar.a(h2, z0Var2.f());
a2.setListener(new x());
a2.show(getChildFragmentManager(), "menu");
}
public static final void m20sniffingSuccess$lambda17(SnifferVideoInfo snifferVideoInfo, BrowserFragment browserFragment) {
h.b0.d.l.f(snifferVideoInfo, "$videoInfo");
h.b0.d.l.f(browserFragment, "this$0");
c.t.c.j.b1.k0.a = snifferVideoInfo;
browserFragment.setFoundVideoView(0, snifferVideoInfo.getUrlList().size());
}
public static final void m21startVideoActivity$lambda19(SnifferVideoInfo snifferVideoInfo, BrowserFragment browserFragment) {
h.b0.d.l.f(snifferVideoInfo, "$videoInfo");
h.b0.d.l.f(browserFragment, "this$0");
c.t.c.j.b1.k0.a = snifferVideoInfo;
browserFragment.setFoundVideoView(0, snifferVideoInfo.getUrlList().size());
}
public final void subscribeOrCancel(String str, boolean z2, String str2) {
z0 z0Var = this.controller;
BrowserViewModel browserViewModel = null;
z0 z0Var2 = null;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
String h2 = z0Var.h();
if (h2 == null) {
return;
}
View view = getView();
WebViewToolbar webViewToolbar = (WebViewToolbar) (view == null ? null : view.findViewById(R$id.toolbar));
boolean z3 = false;
if (webViewToolbar != null && webViewToolbar.getSubscribe()) {
z3 = true;
}
if (z3) {
new ConfirmDialog.a().v("取消该页面订阅").m(new y()).a().q(getChildFragmentManager());
return;
}
BrowserViewModel browserViewModel2 = this.browserViewModel;
if (browserViewModel2 == null) {
h.b0.d.l.u("browserViewModel");
browserViewModel2 = null;
}
SubscribeEntity subscribeEntity = (SubscribeEntity) browserViewModel2.x().get();
if (subscribeEntity != null) {
BrowserViewModel browserViewModel3 = this.browserViewModel;
if (browserViewModel3 == null) {
h.b0.d.l.u("browserViewModel");
} else {
browserViewModel = browserViewModel3;
}
browserViewModel.k(subscribeEntity).observe(this, new Observer() {
public final void onChanged(Object obj) {
BrowserFragment.m22subscribeOrCancel$lambda23$lambda22(BrowserFragment.this, (Boolean) obj);
}
});
return;
}
z0 z0Var3 = this.controller;
if (z0Var3 == null) {
h.b0.d.l.u("controller");
} else {
z0Var2 = z0Var3;
}
EditSubscribeDialog a2 = EditSubscribeDialog.p.a(true, z2, new Subscribe(h2, z0Var2.f(), "", str));
this.editSubscribeDialog = a2;
h.b0.d.l.d(a2);
a2.L(new z(str2));
EditSubscribeDialog editSubscribeDialog = this.editSubscribeDialog;
h.b0.d.l.d(editSubscribeDialog);
editSubscribeDialog.q(getChildFragmentManager());
}
public static final void m22subscribeOrCancel$lambda23$lambda22(BrowserFragment browserFragment, Boolean bool) {
h.b0.d.l.f(browserFragment, "this$0");
h.b0.d.l.e(bool, "it");
if (bool.booleanValue()) {
View view = browserFragment.getView();
WebViewToolbar webViewToolbar = (WebViewToolbar) (view == null ? null : view.findViewById(R$id.toolbar));
if (webViewToolbar != null) {
webViewToolbar.setSubscribe(true);
}
browserFragment.showLongToast(browserFragment.getString(R$string.browser_subscribe_success));
}
}
public static void toggleWebViewState$default(BrowserFragment browserFragment, boolean z2, boolean z3, int i2, Object obj) {
if ((i2 & 2) != 0) {
z3 = false;
}
browserFragment.toggleWebViewState(z2, z3);
}
public void _$_clearFindViewByIdCache() {
}
public final void back() {
boolean z2;
int i2;
setFoundVideoView(8, 0);
c.t.a.p.a.e().i(false);
Snackbar snackbar = this.subscribeHint;
if (snackbar != null && snackbar.isShown()) {
Snackbar snackbar2 = this.subscribeHint;
if (snackbar2 != null) {
snackbar2.dismiss();
}
z2 = true;
} else {
z2 = false;
}
View view = getView();
View findViewById = view == null ? null : view.findViewById(R$id.v_subscribe_menu);
h.b0.d.l.e(findViewById, "v_subscribe_menu");
ViewGroup.LayoutParams layoutParams = findViewById.getLayoutParams();
ViewGroup.MarginLayoutParams marginLayoutParams = layoutParams instanceof ViewGroup.MarginLayoutParams ? (ViewGroup.MarginLayoutParams) layoutParams : null;
if ((marginLayoutParams == null ? 0 : marginLayoutParams.bottomMargin) == 0) {
cancelManualSubscribe();
z2 = true;
}
if (z2) {
return;
}
closePageFind();
c.t.a.s.h.f().d();
z0 z0Var = this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
if (z0Var.a()) {
z0 z0Var2 = this.controller;
if (z0Var2 == null) {
h.b0.d.l.u("controller");
z0Var2 = null;
}
z0Var2.j();
z0 z0Var3 = this.controller;
if (z0Var3 == null) {
h.b0.d.l.u("controller");
z0Var3 = null;
}
String f2 = z0Var3.f();
if (f2 != null) {
View view2 = getView();
((WebViewToolbar) (view2 == null ? null : view2.findViewById(R$id.toolbar))).setTitleText(f2);
this.currentTitle = f2;
z0 z0Var4 = this.controller;
if (z0Var4 == null) {
h.b0.d.l.u("controller");
z0Var4 = null;
}
String h2 = z0Var4.h();
if (h2 != null) {
saveCurrWebInfo(h2, f2);
}
}
z0 z0Var5 = this.controller;
if (z0Var5 == null) {
h.b0.d.l.u("controller");
z0Var5 = null;
}
String h3 = z0Var5.h();
if (h3 != null) {
this.currentUrl = h3;
BrowserViewModel browserViewModel = this.browserViewModel;
if (browserViewModel == null) {
h.b0.d.l.u("browserViewModel");
browserViewModel = null;
}
browserViewModel.K(h3).observe(this, new Observer() {
public final void onChanged(Object obj) {
BrowserFragment.m1back$lambda28$lambda27(BrowserFragment.this, (Boolean) obj);
}
});
}
View view3 = getView();
AnimatedProgressBar animatedProgressBar = (AnimatedProgressBar) (view3 == null ? null : view3.findViewById(R$id.progress_bar));
if (animatedProgressBar != null) {
animatedProgressBar.setProgress(100);
}
toggleWebViewState$default(this, false, false, 2, null);
View view4 = getView();
((WebViewNav) (view4 == null ? null : view4.findViewById(R$id.nav))).setCanGoForward(true);
} else {
List fragments = getParentFragmentManager().getFragments();
h.b0.d.l.e(fragments, "parentFragmentManager.fragments");
if ((fragments instanceof Collection) && fragments.isEmpty()) {
i2 = 0;
} else {
Iterator it2 = fragments.iterator();
i2 = 0;
while (it2.hasNext()) {
String canonicalName = ((Fragment) it2.next()).getClass().getCanonicalName();
if ((((canonicalName == null || canonicalName.length() == 0) || canonicalName.equals("com.pocket.topbrowser.home.navigation.NavigationFragment") || canonicalName.equals("com.pocket.topbrowser.home.subscribe.SubscribeFragment") || canonicalName.equals("com.pocket.topbrowser.home.personal.PersonalFragment")) ? false : true) && (i2 = i2 + 1) < 0) {
h.w.k.o();
}
}
}
if (i2 > 1) {
z0 z0Var6 = this.controller;
if (z0Var6 == null) {
h.b0.d.l.u("controller");
z0Var6 = null;
}
z0Var6.j();
finish();
} else {
FragmentActivity g2 = c.h.b.o.a.h().g();
if (g2 instanceof FragmentActivity) {
List fragments2 = g2.getSupportFragmentManager().getFragments();
h.b0.d.l.e(fragments2, "mainActivity.supportFragmentManager.fragments");
ArrayList arrayList = new ArrayList();
for (Object obj : fragments2) {
if (h.b0.d.l.b(((Fragment) obj).getClass().getCanonicalName(), "com.pocket.topbrowser.home.main.MainFragment")) {
arrayList.add(obj);
}
}
int indexOf = arrayList.indexOf(getParentFragment());
if (indexOf >= 0) {
c.o.a.a.a("delete_curr_web_info").b(Integer.valueOf(indexOf));
}
}
z0 z0Var7 = this.controller;
if (z0Var7 == null) {
h.b0.d.l.u("controller");
z0Var7 = null;
}
z0Var7.j();
c.h.b.c.a.a("go_home").h(0);
}
}
Map<String, c.t.a.j.a.b> map = this.readerUrlMap;
z0 z0Var8 = this.controller;
if (z0Var8 == null) {
h.b0.d.l.u("controller");
z0Var8 = null;
}
c.t.a.j.a.b bVar = map.get(z0Var8.h());
String b2 = bVar != null ? bVar.b() : null;
if (b2 == null || b2.length() == 0) {
readerViewHide();
} else {
readerViewIn();
}
c.t.a.p.a.e().i(true);
}
public final String getCurrTitle() {
z0 z0Var = this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
return z0Var.f();
}
public final String getCurrUrl() {
z0 z0Var = this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
return z0Var.h();
}
public c.t.a.d.n getDataBindingConfig() {
int i2 = R$layout.browser_fragment;
int i3 = x0.f126c;
ViewModel viewModel = this.browserViewModel;
if (viewModel == null) {
h.b0.d.l.u("browserViewModel");
viewModel = null;
}
return new c.t.a.d.n(i2, i3, viewModel);
}
public final String getMimeType(String str) {
h.b0.d.l.f(str, "filePath");
Uri fromFile = Uri.fromFile(new File(str));
h.b0.d.l.e(fromFile, "fromFile(File(filePath))");
if (h.b0.d.l.b(fromFile.getScheme(), "content")) {
ContentResolver contentResolver = ((DataBindingFragment) this).mActivity.getContentResolver();
h.b0.d.l.e(contentResolver, "mActivity.contentResolver");
return contentResolver.getType(fromFile);
}
String fileExtensionFromUrl = MimeTypeMap.getFileExtensionFromUrl(fromFile.toString());
MimeTypeMap singleton = MimeTypeMap.getSingleton();
h.b0.d.l.e(fileExtensionFromUrl, "fileExtension");
Locale locale = Locale.ROOT;
h.b0.d.l.e(locale, "ROOT");
String lowerCase = fileExtensionFromUrl.toLowerCase(locale);
h.b0.d.l.e(lowerCase, "(this as java.lang.String).toLowerCase(locale)");
return singleton.getMimeTypeFromExtension(lowerCase);
}
public OnBackPressedCallback getOnBackPressedCallback() {
return new OnBackPressedCallback() {
{
super(true);
}
public void handleOnBackPressed() {
BrowserFragment.this.back();
}
};
}
@Override
public void hideActionBar() {
View view = getView();
c.t.c.j.q1.h hVar = null;
if (((WebViewToolbar) (view == null ? null : view.findViewById(R$id.toolbar))).getTranslationY() == 0.0f) {
if (c.t.c.j.q1.p.a.a.l()) {
c.t.c.j.q1.h hVar2 = this.browserAnimatorHelper;
if (hVar2 == null) {
h.b0.d.l.u("browserAnimatorHelper");
} else {
hVar = hVar2;
}
hVar.a();
} else {
c.t.c.j.q1.h hVar3 = this.browserAnimatorHelper;
if (hVar3 == null) {
h.b0.d.l.u("browserAnimatorHelper");
} else {
hVar = hVar3;
}
hVar.c();
}
readerViewOut();
}
}
public void initViewModel() {
BrowserViewModel fragmentScopeViewModel = getFragmentScopeViewModel(BrowserViewModel.class);
h.b0.d.l.e(fragmentScopeViewModel, "getFragmentScopeViewMode…serViewModel::class.java)");
this.browserViewModel = fragmentScopeViewModel;
}
@Override
public void loadUrl(String str, Map<String, String> map) {
z0 z0Var = this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
z0.n(z0Var, str, map, false, 4, null);
}
public void onActivityResult(int r4, int r5, android.content.Intent r6) {
throw new UnsupportedOperationException("Method not decompiled: com.pocket.topbrowser.browser.BrowserFragment.onActivityResult(int, int, android.content.Intent):void");
}
public void onCreate(Bundle bundle) {
super/*com.pocket.common.base.DataBindingFragment*/.onCreate(bundle);
a.b bVar = c.t.a.u.a.a;
AppCompatActivity appCompatActivity = ((DataBindingFragment) this).mActivity;
h.b0.d.l.e(appCompatActivity, "mActivity");
bVar.c(appCompatActivity);
}
public void onDestroy() {
super/*com.pocket.common.base.BaseViewModelFragment*/.onDestroy();
OnBackPressedCallback onBackPressedCallback = ((BackViewModelFragment) this).onBackPressedCallback;
if (onBackPressedCallback != null) {
onBackPressedCallback.setEnabled(false);
}
c.t.a.s.h.f().i();
}
@Override
@SuppressLint({"SourceLockedOrientationActivity"})
public void onHideCustomView() {
if (this.customView == null || this.customViewCallback == null) {
WebChromeClient.CustomViewCallback customViewCallback = this.customViewCallback;
if (customViewCallback != null) {
if (customViewCallback != null) {
try {
customViewCallback.onCustomViewHidden();
} catch (Exception e2) {
c.h.b.j.e.d(((BaseFragment) this).TAG, new Object[]{"Error hiding custom view", e2});
}
}
this.customViewCallback = null;
return;
}
return;
}
c.h.b.j.e.d(((BaseFragment) this).TAG, new Object[]{"onHideCustomView"});
try {
View view = this.customView;
if (view != null) {
view.setKeepScreenOn(false);
}
} catch (SecurityException unused) {
c.h.b.j.e.d(((BaseFragment) this).TAG, new Object[]{"WebView is not allowed to keep the screen on"});
}
FrameLayout frameLayout = this.fullscreenContainerView;
if (frameLayout != null) {
ViewParent parent = frameLayout == null ? null : frameLayout.getParent();
Objects.requireNonNull(parent, "null cannot be cast to non-null type android.view.ViewGroup");
((ViewGroup) parent).removeView(this.fullscreenContainerView);
FrameLayout frameLayout2 = this.fullscreenContainerView;
if (frameLayout2 != null) {
frameLayout2.removeAllViews();
}
}
this.fullscreenContainerView = null;
this.customView = null;
c.h.b.j.e.d(((BaseFragment) this).TAG, new Object[]{"VideoView is being stopped"});
VideoView videoView = this.videoView;
if (videoView != null) {
videoView.stopPlayback();
}
VideoView videoView2 = this.videoView;
if (videoView2 != null) {
videoView2.setOnErrorListener(null);
}
VideoView videoView3 = this.videoView;
if (videoView3 != null) {
videoView3.setOnCompletionListener(null);
}
this.videoView = null;
try {
WebChromeClient.CustomViewCallback customViewCallback2 = this.customViewCallback;
if (customViewCallback2 != null) {
customViewCallback2.onCustomViewHidden();
}
} catch (Exception e3) {
c.h.b.j.e.d(((BaseFragment) this).TAG, new Object[]{"Error hiding custom view", e3});
}
this.customViewCallback = null;
((DataBindingFragment) this).mActivity.setRequestedOrientation(1);
((DataBindingFragment) this).mActivity.getWindow().clearFlags(WXMediaMessage.DESCRIPTION_LENGTH_LIMIT);
}
@Override
public void onPageFinished(WebView webView, String str) {
h.b0.d.l.f(webView, "view");
String b2 = c.h.b.o.l.b(((DataBindingFragment) this).mActivity, "remember_account_password.js");
z0 z0Var = this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
YaWebView g2 = z0Var.g();
if (g2 == null) {
return;
}
g2.loadUrl(h.b0.d.l.m("javascript:", b2));
}
@Override
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
String title;
setFoundVideoView$default(this, 8, 0, 2, null);
this.currentUrl = str;
if (webView instanceof YaWebView) {
for (TopVideoView topVideoView : ViewGroupKt.getChildren(webView)) {
if (topVideoView instanceof TopVideoView) {
TopVideoView topVideoView2 = topVideoView;
if (h.b0.d.l.b(topVideoView2.getWebVideoInfoEntity().g(), str)) {
topVideoView2.resume();
topVideoView.setVisibility(0);
} else {
topVideoView2.pause();
topVideoView.setVisibility(8);
}
}
}
}
cancelManualSubscribe();
showActionBar();
readerViewHide();
closePageFind();
if (str != null) {
BrowserViewModel browserViewModel = this.browserViewModel;
if (browserViewModel == null) {
h.b0.d.l.u("browserViewModel");
browserViewModel = null;
}
browserViewModel.K(str).observe(this, new Observer() {
public final void onChanged(Object obj) {
BrowserFragment.m6onPageStarted$lambda40$lambda39(BrowserFragment.this, (Boolean) obj);
}
});
String str2 = "";
if (webView != null && (title = webView.getTitle()) != null) {
str2 = title;
}
saveCurrWebInfo(str, str2);
}
this.pagerLoadUrlList.clear();
if (str != null) {
this.pagerLoadUrlList.add(str);
}
String str3 = this.currentTitle;
boolean z2 = true;
if (!(str3 == null || str3.length() == 0)) {
List c2 = c.t.a.w.r.b().c();
h.b0.d.l.e(c2, "getInstance().titleWhiteList()");
ArrayList arrayList = new ArrayList();
for (Object obj : c2) {
String str4 = (String) obj;
String str5 = this.currentTitle;
h.b0.d.l.d(str5);
h.b0.d.l.e(str4, "it");
if (h.i0.t.L(str5, str4, false, 2, null)) {
arrayList.add(obj);
}
}
z2 = arrayList.isEmpty();
}
if (z2 && c.h.b.i.c.b("open_av_model", false) && isCurrWindow()) {
c.t.a.s.h.f().h();
}
}
@Override
public void onProgressChanged(int i2) {
View view = getView();
AnimatedProgressBar animatedProgressBar = (AnimatedProgressBar) (view == null ? null : view.findViewById(R$id.progress_bar));
if (animatedProgressBar == null) {
return;
}
animatedProgressBar.setProgress(i2 <= 50 ? i2 * 2 : 100);
}
@Override
public void onReceivedIcon(Bitmap bitmap) {
h.b0.d.l.f(bitmap, "icon");
}
@Override
public void onReceivedTitle(String str, String str2) {
h.b0.d.l.f(str, Utils.SUBSCRIPTION_FIELD_URL);
h.b0.d.l.f(str2, Utils.SUBSCRIPTION_FIELD_TITLE);
this.currentTitle = str2;
View view = getView();
BrowserViewModel browserViewModel = null;
WebViewToolbar webViewToolbar = (WebViewToolbar) (view == null ? null : view.findViewById(R$id.toolbar));
if (webViewToolbar != null) {
webViewToolbar.setTitleText(str2);
}
if (c.t.c.j.q1.p.a.a.o()) {
return;
}
BrowserViewModel browserViewModel2 = this.browserViewModel;
if (browserViewModel2 == null) {
h.b0.d.l.u("browserViewModel");
} else {
browserViewModel = browserViewModel2;
}
browserViewModel.g(str, str2);
}
@Override
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback customViewCallback) {
h.b0.d.l.f(view, "view");
h.b0.d.l.f(customViewCallback, "callback");
try {
view.setKeepScreenOn(true);
} catch (SecurityException unused) {
c.h.b.j.e.d(((BaseFragment) this).TAG, new Object[]{"WebView is not allowed to keep the screen on"});
}
this.originalOrientation = ((DataBindingFragment) this).mActivity.getRequestedOrientation();
this.customViewCallback = customViewCallback;
this.customView = view;
((DataBindingFragment) this).mActivity.setRequestedOrientation(0);
FrameLayout frameLayout = (FrameLayout) ((DataBindingFragment) this).mActivity.getWindow().getDecorView();
FrameLayout frameLayout2 = new FrameLayout(((DataBindingFragment) this).mActivity);
this.fullscreenContainerView = frameLayout2;
if (frameLayout2 != null) {
frameLayout2.setBackgroundColor(ContextCompat.getColor(((DataBindingFragment) this).mActivity, R$color.black));
}
if (view instanceof FrameLayout) {
View focusedChild = ((FrameLayout) view).getFocusedChild();
if (focusedChild instanceof VideoView) {
VideoView videoView = (VideoView) focusedChild;
this.videoView = videoView;
videoView.setOnErrorListener(new b(this));
videoView.setOnCompletionListener(new b(this));
}
} else if (view instanceof VideoView) {
VideoView videoView2 = (VideoView) view;
this.videoView = videoView2;
videoView2.setOnErrorListener(new b(this));
videoView2.setOnCompletionListener(new b(this));
}
FrameLayout frameLayout3 = this.fullscreenContainerView;
FrameLayout.LayoutParams layoutParams = COVER_SCREEN_PARAMS;
frameLayout.addView(frameLayout3, layoutParams);
FrameLayout frameLayout4 = this.fullscreenContainerView;
if (frameLayout4 != null) {
frameLayout4.addView(this.customView, layoutParams);
}
frameLayout.requestLayout();
((DataBindingFragment) this).mActivity.getWindow().addFlags(WXMediaMessage.DESCRIPTION_LENGTH_LIMIT);
}
public void onStart() {
super/*androidx.fragment.app.Fragment*/.onStart();
Activity g2 = c.h.b.o.a.h().g();
if (g2 == null || !h.b0.d.l.b(g2.getClass().getName(), "MainActivity")) {
return;
}
Object invoke = g2.getClass().getMethod("getCurrMainFragment", new Class[0]).invoke(g2, new Object[0]);
Objects.requireNonNull(invoke, "null cannot be cast to non-null type androidx.fragment.app.Fragment");
List fragments = ((Fragment) invoke).getChildFragmentManager().getFragments();
h.b0.d.l.e(fragments, "currMainFragment.childFragmentManager.fragments");
Fragment fragment = (Fragment) fragments.get(fragments.size() - 1);
if ((fragment instanceof BrowserFragment) && h.b0.d.l.b(fragment, this)) {
z0 z0Var = this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
YaWebView g3 = z0Var.g();
if (g3 == null) {
return;
}
g3.resumeTopVideo();
}
}
public void onStop() {
super/*androidx.fragment.app.Fragment*/.onStop();
z0 z0Var = this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
YaWebView g2 = z0Var.g();
if (g2 == null) {
return;
}
g2.pauseTopVideo();
}
@Override
public void onUrlLoad(final java.lang.String r12) {
throw new UnsupportedOperationException("Method not decompiled: com.pocket.topbrowser.browser.BrowserFragment.onUrlLoad(java.lang.String):void");
}
public void onViewCreated(android.view.View r9, android.os.Bundle r10) {
throw new UnsupportedOperationException("Method not decompiled: com.pocket.topbrowser.browser.BrowserFragment.onViewCreated(android.view.View, android.os.Bundle):void");
}
public void openFileChooser(ValueCallback<Uri> valueCallback) {
h.b0.d.l.f(valueCallback, "uploadMsg");
this.uploadMessageCallback = valueCallback;
Intent intent = new Intent("android.intent.action.GET_CONTENT");
intent.addCategory("android.intent.category.OPENABLE");
intent.setType("*/*");
h.u uVar = h.u.a;
startActivityForResult(Intent.createChooser(intent, getString(R$string.browser_title_file_chooser)), FILE_CHOOSER_REQUEST_CODE);
}
@Override
public boolean shouldOverrideUrlLoading(String str) {
c.t.c.j.h1.d.d.b bVar = this.scriptBrowser;
if (bVar == null) {
h.b0.d.l.u("scriptBrowser");
bVar = null;
}
return bVar.a(str);
}
@Override
public void showActionBar() {
View view = getView();
c.t.c.j.q1.h hVar = null;
ConstraintLayout constraintLayout = (WebViewToolbar) (view == null ? null : view.findViewById(R$id.toolbar));
if (!h.b0.d.l.a(constraintLayout == null ? null : Float.valueOf(constraintLayout.getTranslationY()), 0.0f)) {
if (c.t.c.j.q1.p.a.a.l()) {
c.t.c.j.q1.h hVar2 = this.browserAnimatorHelper;
if (hVar2 == null) {
h.b0.d.l.u("browserAnimatorHelper");
} else {
hVar = hVar2;
}
hVar.i();
} else {
c.t.c.j.q1.h hVar3 = this.browserAnimatorHelper;
if (hVar3 == null) {
h.b0.d.l.u("browserAnimatorHelper");
} else {
hVar = hVar3;
}
hVar.k();
}
}
readerViewIn();
}
@Override
public void showFileChooser(ValueCallback<Uri[]> valueCallback) {
Intent[] intentArr;
h.b0.d.l.f(valueCallback, "filePathCallback");
ValueCallback<Uri[]> valueCallback2 = this.filePathCallback;
if (valueCallback2 != null) {
valueCallback2.onReceiveValue(null);
}
this.filePathCallback = valueCallback;
try {
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
intent.putExtra("PhotoPath", this.cameraPhotoPath);
File a2 = c.t.c.j.q1.n.a();
this.cameraPhotoPath = h.b0.d.l.m("file:", a2.getAbsolutePath());
h.u uVar = h.u.a;
intent.putExtra("output", Uri.fromFile(a2));
intentArr = new Intent[]{intent};
} catch (IOException e2) {
c.h.b.j.e.d(((BaseFragment) this).TAG, new Object[]{"Unable to create Image File", e2});
intentArr = new Intent[0];
}
Intent intent2 = new Intent("android.intent.action.CHOOSER");
Intent intent3 = new Intent("android.intent.action.GET_CONTENT");
intent3.addCategory("android.intent.category.OPENABLE");
intent3.setType("*/*");
h.u uVar2 = h.u.a;
intent2.putExtra("android.intent.extra.INTENT", intent3);
intent2.putExtra("android.intent.extra.TITLE", "Image Chooser");
intent2.putExtra("android.intent.extra.INITIAL_INTENTS", intentArr);
startActivityForResult(intent2, FILE_CHOOSER_REQUEST_CODE);
}
public final void sniffingSuccess() {
z0 z0Var = this.controller;
z0 z0Var2 = null;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
if (z0Var.g() == null) {
return;
}
ArrayList arrayList = new ArrayList();
SortedMap e2 = c.t.a.s.h.f().e();
h.b0.d.l.e(e2, "foundVideoInfoMap");
if (!e2.isEmpty()) {
Set<Map.Entry> entrySet = e2.entrySet();
h.b0.d.l.e(entrySet, "foundVideoInfoMap.entries");
String str = "";
for (Map.Entry entry : entrySet) {
if ((str.length() == 0) && (str = ((c.t.a.s.f) entry.getValue()).c()) == null) {
str = "";
}
String e3 = ((c.t.a.s.f) entry.getValue()).e();
h.b0.d.l.e(e3, "it.value.url");
arrayList.add(e3);
}
List A = h.w.s.A(arrayList);
z0 z0Var3 = this.controller;
if (z0Var3 == null) {
h.b0.d.l.u("controller");
} else {
z0Var2 = z0Var3;
}
final SnifferVideoInfo snifferVideoInfo = new SnifferVideoInfo(str, z0Var2.h(), A, new VideoCatalogueEntity());
if (arrayList.isEmpty()) {
return;
}
c.h.b.o.i.c(new Runnable() {
@Override
public final void run() {
BrowserFragment.m20sniffingSuccess$lambda17(SnifferVideoInfo.this, this);
}
}, 100L);
}
}
public final void startVideoActivity(VideoCatalogueEntity videoCatalogueEntity) {
h.b0.d.l.f(videoCatalogueEntity, "entity");
ArrayList arrayList = new ArrayList();
SortedMap e2 = c.t.a.s.h.f().e();
h.b0.d.l.e(e2, "foundVideoInfoMap");
if (!e2.isEmpty()) {
Set<Map.Entry> entrySet = e2.entrySet();
h.b0.d.l.e(entrySet, "foundVideoInfoMap.entries");
String str = "";
for (Map.Entry entry : entrySet) {
if ((str.length() == 0) && (str = ((c.t.a.s.f) entry.getValue()).c()) == null) {
str = "";
}
String e3 = ((c.t.a.s.f) entry.getValue()).e();
h.b0.d.l.e(e3, "it.value.url");
arrayList.add(e3);
}
List A = h.w.s.A(arrayList);
z0 z0Var = this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
final SnifferVideoInfo snifferVideoInfo = new SnifferVideoInfo(str, z0Var.h(), A, videoCatalogueEntity);
if (arrayList.isEmpty()) {
return;
}
c.h.b.o.i.c(new Runnable() {
@Override
public final void run() {
BrowserFragment.m21startVideoActivity$lambda19(SnifferVideoInfo.this, this);
}
}, 100L);
}
}
public final void toggleWebViewState(boolean z2, boolean z3) {
z0 z0Var = this.controller;
if (z0Var == null) {
h.b0.d.l.u("controller");
z0Var = null;
}
z0Var.s(z2, z3);
}
}