正在查看: Top浏览器 v4.6.16 应用的 MenuDialog.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Top浏览器 v4.6.16 应用的 MenuDialog.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.pocket.topbrowser.browser.dialog.tool;
import android.animation.ObjectAnimator;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.FrameLayout;
import android.widget.ImageView;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentViewModelLazyKt;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.ViewModelStoreOwner;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import c.t.a.u.a;
import c.t.a.w.i0;
import c.t.a.w.n0;
import c.t.c.j.f1.e.j0;
import c.t.c.j.f1.e.k0;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.google.android.material.R;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import com.pocket.common.base.UserInfoViewModel;
import com.pocket.common.db.bookmark.BookmarkEntity;
import com.pocket.common.db.navwebsite.NavWebsiteEntity;
import com.pocket.common.dialog.confirm.ConfirmDialog;
import com.pocket.common.dialog.list.ListSelectDialog;
import com.pocket.common.http.bean.NullType;
import com.pocket.common.http.bean.UserInfo;
import com.pocket.common.provider.SubscribeFragmentProvider;
import com.pocket.common.utils.viewbindingdelegate.ViewBindingProperty;
import com.pocket.topbrowser.browser.BrowserFragment;
import com.pocket.topbrowser.browser.R$array;
import com.pocket.topbrowser.browser.R$drawable;
import com.pocket.topbrowser.browser.R$id;
import com.pocket.topbrowser.browser.R$layout;
import com.pocket.topbrowser.browser.R$mipmap;
import com.pocket.topbrowser.browser.R$string;
import com.pocket.topbrowser.browser.R$style;
import com.pocket.topbrowser.browser.api.BrowserApi;
import com.pocket.topbrowser.browser.bookmark.BookmarkBean;
import com.pocket.topbrowser.browser.bookmark.BookmarkEditDialog;
import com.pocket.topbrowser.browser.bookmark.BookmarkFragment;
import com.pocket.topbrowser.browser.databinding.BrowserTool2DialogBinding;
import com.pocket.topbrowser.browser.dialog.tool.MenuDialog;
import com.pocket.topbrowser.browser.dialog.ua.UADialog;
import com.pocket.topbrowser.browser.gm.page.JavaScriptFragment;
import com.pocket.topbrowser.browser.history.HistoryFragment;
import com.pocket.topbrowser.browser.setting.SettingFragment;
import com.umeng.analytics.pro.ak;
import h.b0.c.r;
import h.b0.d.m;
import h.b0.d.s;
import h.b0.d.v;
import h.b0.d.w;
import h.b0.d.z;
import h.i0.t;
import h.u;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.adblockplus.libadblockplus.android.settings.AdblockHelper;
import org.adblockplus.libadblockplus.android.webview.AdblockWebView;
public final class MenuDialog extends BottomSheetDialogFragment {
private static final String EDIT_HINT_HAVE_SHOW = "edit_hint_have_show";
private static final String HAVE_MORE_FUN_JUMP_SHOW = "have_more_fun_jump_show";
private static final String TITLE = "title";
private static final String URL = "url";
private MenuAdapter adapter;
private View bottomView;
private BrowserFragment browserFragment;
private String[] fontSize;
private ListSelectDialog fontSizeDialog;
private boolean isUrl;
private boolean isWhiteList;
private k0 listener;
private String title;
private String url;
public static final h.g0.h<Object>[] $$delegatedProperties = {z.e(new s(MenuDialog.class, "binding", "getBinding()Lcom/pocket/topbrowser/browser/databinding/BrowserTool2DialogBinding;", 0))};
public static final a Companion = new a(null);
private static final List<String> checkEnableFunction = h.w.k.j("refresh", "addBookmark", "addNavigation", "avMode", "cartoonMode", "readMode", "translate", "imageExtract", "openSC", "pageFind", "saveWebArchive");
private static final List<String> whiteFunction = h.w.k.j("avMode", "readMode", "cartoonMode");
private static final Map<String, Boolean> selectedFunction = new LinkedHashMap();
private final ViewBindingProperty binding$delegate = c.t.a.w.u0.d.a(this, new f());
private final h.f viewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, z.b(MenuViewModel.class), new h(new g(this)), (h.b0.c.a) null);
private final h.f userInfoViewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, z.b(UserInfoViewModel.class), new j(new i(this)), (h.b0.c.a) null);
public static final class a {
public a() {
}
public a(h.b0.d.g gVar) {
this();
}
public final MenuDialog a(String str, String str2) {
MenuDialog menuDialog = new MenuDialog();
Bundle bundle = new Bundle();
bundle.putString("url", str);
bundle.putString("title", str2);
menuDialog.setArguments(bundle);
return menuDialog;
}
}
public static final class b extends m implements r<String, String, Long, String, u> {
public b() {
super(4);
}
public final void a(String str, String str2, long j2, String str3) {
h.b0.d.l.f(str, "name");
h.b0.d.l.f(str2, "url");
h.b0.d.l.f(str3, "folderName");
MenuDialog.this.getViewModel().f(new BookmarkEntity(str, (String) null, str2, j2, str3, System.currentTimeMillis(), 2, (h.b0.d.g) null));
}
@Override
public u invoke(String str, String str2, Long l2, String str3) {
a(str, str2, l2.longValue(), str3);
return u.a;
}
}
public static final class c extends m implements h.b0.c.l<Integer, u> {
public c() {
super(1);
}
public final void a(int i2) {
c.t.c.j.q1.p.a.a.e0(i2);
ListSelectDialog listSelectDialog = MenuDialog.this.fontSizeDialog;
if (listSelectDialog == null) {
return;
}
listSelectDialog.dismiss();
}
@Override
public u invoke(Integer num) {
a(num.intValue());
return u.a;
}
}
public static final class d extends BottomSheetBehavior.BottomSheetCallback {
public final w a;
public final MenuDialog b;
public final v f1198c;
public d(w wVar, MenuDialog menuDialog, v vVar) {
this.a = wVar;
this.b = menuDialog;
this.f1198c = vVar;
}
public void onSlide(View view, float f2) {
h.b0.d.l.f(view, "bottomSheet");
View view2 = this.b.bottomView;
if (view2 != null) {
view2.setAlpha(1 - f2);
}
if (this.f1198c.a - f2 > 0.0f && f2 <= 0.6f && this.a.a != 1) {
this.b.dismiss();
}
this.f1198c.a = f2;
}
public void onStateChanged(View view, int i2) {
h.b0.d.l.f(view, "bottomSheet");
this.a.a = i2;
if (i2 != 3) {
return;
}
View view2 = this.b.getView();
((ImageView) (view2 == null ? null : view2.findViewById(R$id.v_handle))).setImageResource(R$mipmap.browser_ic_menu_handle_up);
}
}
public static final class e implements c.f.a.a.a.g.e {
public void a(RecyclerView.ViewHolder viewHolder, int i2) {
}
public void b(RecyclerView.ViewHolder viewHolder, int i2, RecyclerView.ViewHolder viewHolder2, int i3) {
}
public void c(RecyclerView.ViewHolder viewHolder, int i2) {
}
}
public static final class f extends m implements h.b0.c.l<MenuDialog, BrowserTool2DialogBinding> {
public f() {
super(1);
}
@Override
public final BrowserTool2DialogBinding invoke(MenuDialog menuDialog) {
h.b0.d.l.f(menuDialog, "fragment");
return BrowserTool2DialogBinding.a(menuDialog.requireView());
}
}
public static final class g extends m implements h.b0.c.a<Fragment> {
public final Fragment a;
public g(Fragment fragment) {
super(0);
this.a = fragment;
}
@Override
public final Fragment invoke() {
return this.a;
}
}
public static final class h extends m implements h.b0.c.a<ViewModelStore> {
public final h.b0.c.a a;
public h(h.b0.c.a aVar) {
super(0);
this.a = aVar;
}
@Override
public final ViewModelStore invoke() {
ViewModelStore viewModelStore = ((ViewModelStoreOwner) this.a.invoke()).getViewModelStore();
h.b0.d.l.c(viewModelStore, "ownerProducer().viewModelStore");
return viewModelStore;
}
}
public static final class i extends m implements h.b0.c.a<Fragment> {
public final Fragment a;
public i(Fragment fragment) {
super(0);
this.a = fragment;
}
@Override
public final Fragment invoke() {
return this.a;
}
}
public static final class j extends m implements h.b0.c.a<ViewModelStore> {
public final h.b0.c.a a;
public j(h.b0.c.a aVar) {
super(0);
this.a = aVar;
}
@Override
public final ViewModelStore invoke() {
ViewModelStore viewModelStore = ((ViewModelStoreOwner) this.a.invoke()).getViewModelStore();
h.b0.d.l.c(viewModelStore, "ownerProducer().viewModelStore");
return viewModelStore;
}
}
public static final class k extends m implements h.b0.c.a<u> {
public final String a;
public final MenuDialog b;
public static final class a implements c.h.b.l.d<NullType> {
public final MenuDialog a;
public a(MenuDialog menuDialog) {
this.a = menuDialog;
}
public void a(Throwable th) {
h.b0.d.l.f(th, ak.aH);
c.h.a.e.d.c("反馈失败,请重新反馈");
this.a.dismiss();
}
public void b(c.h.b.l.h<NullType> hVar) {
h.b0.d.l.f(hVar, "resp");
if (hVar.e()) {
c.h.a.e.d.c("反馈成功");
} else {
c.h.a.e.d.c("反馈失败,请重新反馈");
}
this.a.dismiss();
}
}
public k(String str, MenuDialog menuDialog) {
super(0);
this.a = str;
this.b = menuDialog;
}
@Override
public u invoke() {
invoke2();
return u.a;
}
public final void invoke2() {
((BrowserApi) c.t.a.m.a.b().a(BrowserApi.class)).reportAd(this.a).a(new a(this.b));
}
}
public static final class l extends m implements h.b0.c.a<u> {
public l() {
super(0);
}
@Override
public u invoke() {
invoke2();
return u.a;
}
public final void invoke2() {
k0 listener = MenuDialog.this.getListener();
if (listener == null) {
return;
}
listener.a();
}
}
private final void adBlock() {
c.t.c.j.q1.p.a aVar = c.t.c.j.q1.p.a.a;
boolean z = !aVar.a();
if (z) {
c.h.a.e.d.c("广告拦截已开启");
} else {
c.h.a.e.d.c("广告拦截已关闭");
}
if (AdblockHelper.get().isInit() || AdblockHelper.get().getProvider() != null) {
AdblockHelper.get().getProvider().getEngine().setEnabled(z);
}
aVar.F(z);
c.h.b.c.a.a("ad_block_switch").g(0);
dismiss();
}
private final void addBookmark() {
String str;
if (TextUtils.isEmpty(this.url)) {
return;
}
c.h.b.b.a.b.d("tool_add_bookmark");
if (h.b0.d.l.b(selectedFunction.get("addBookmark"), Boolean.TRUE)) {
getViewModel().k();
return;
}
FragmentManager fm = getFM();
if (fm == null || (str = this.title) == null) {
return;
}
String str2 = this.url;
h.b0.d.l.d(str2);
BookmarkEditDialog a2 = BookmarkEditDialog.p.a(new BookmarkBean(0L, str, str2, null, null, null, System.currentTimeMillis(), true, false, 312, null));
a2.B(new b());
a2.q(fm);
}
private final void addNavigation() {
if (TextUtils.isEmpty(this.url)) {
return;
}
c.h.b.b.a.b.d("tool_add_nav");
if (h.b0.d.l.b(selectedFunction.get("addNavigation"), Boolean.TRUE)) {
getViewModel().n();
return;
}
if (TextUtils.isEmpty(this.title)) {
c.h.a.e.d.c("添加失败");
return;
}
MenuViewModel viewModel = getViewModel();
String str = this.title;
h.b0.d.l.d(str);
String str2 = this.url;
h.b0.d.l.d(str2);
viewModel.j(new NavWebsiteEntity(str, (String) null, str2, System.currentTimeMillis(), 2, (h.b0.d.g) null));
}
private final void avMode() {
c.h.b.b.a.b.d("tool_video");
k0 k0Var = this.listener;
if (k0Var != null) {
k0Var.g();
}
dismiss();
}
private final void bookmark() {
FragmentManager fm = getFM();
if (fm == null) {
return;
}
BrowserFragment browserFragment = getBrowserFragment();
if (browserFragment != null) {
BrowserFragment.toggleWebViewState$default(browserFragment, true, false, 2, null);
}
c.t.a.w.t0.a.f().c(fm, new BookmarkFragment());
dismiss();
c.h.b.b.a.b.d("tool_bookmark");
}
private final void cartoonMode() {
c.h.b.b.a.b.d("tool_cartoon_mode");
k0 k0Var = this.listener;
if (k0Var != null) {
k0Var.f();
}
dismiss();
}
private final void desktopMode() {
c.h.b.b.a.b.d("tool_zoom");
c.t.c.j.q1.p.a.a.P(!r0.j());
dismiss();
}
private final void downloadManager() {
c.h.b.b.a.b.d("tool_download_manager");
c.t.a.r.a.c(c.t.a.r.a.a, getContext(), (Bundle) null, "/browser/download_manager", 0, 10, (Object) null);
dismiss();
}
private final void fontSize() {
FragmentManager fm = getFM();
if (fm != null) {
if (this.fontSizeDialog == null) {
ListSelectDialog.a aVar = new ListSelectDialog.a();
float f2 = 0.8f;
for (String str : getFontSize()) {
SpannableStringBuilder b2 = i0.a(str).e(f2).b();
h.b0.d.l.e(b2, "getBuilder(it).setProportion(startP).create()");
aVar.a(b2);
f2 += 0.1f;
}
this.fontSizeDialog = aVar.q(getString(R$string.browser_font_size)).m(c.t.c.j.q1.p.a.a.B()).k(new c()).b();
}
ListSelectDialog listSelectDialog = this.fontSizeDialog;
h.b0.d.l.d(listSelectDialog);
listSelectDialog.q(fm);
}
dismiss();
}
private final void fullScreen() {
c.h.b.b.a.b.d("tool_full_screen");
c.t.c.j.q1.p.a aVar = c.t.c.j.q1.p.a.a;
aVar.R(!aVar.l());
if (TextUtils.isEmpty(this.url) && aVar.l()) {
c.h.a.e.d.c("网页全屏模式已开启");
}
k0 k0Var = this.listener;
if (k0Var != null) {
k0Var.i();
}
dismiss();
}
private final BrowserTool2DialogBinding getBinding() {
return this.binding$delegate.d(this, $$delegatedProperties[0]);
}
private final FragmentManager getFM() {
if (!(getParentFragment() instanceof BrowserFragment)) {
return getParentFragmentManager();
}
Fragment parentFragment = getParentFragment();
if (parentFragment == null) {
return null;
}
return parentFragment.getParentFragmentManager();
}
private final String[] getFontSize() {
if (this.fontSize == null) {
this.fontSize = getResources().getStringArray(R$array.font_size);
}
String[] strArr = this.fontSize;
h.b0.d.l.d(strArr);
return strArr;
}
private final UserInfoViewModel getUserInfoViewModel() {
return (UserInfoViewModel) this.userInfoViewModel$delegate.getValue();
}
public final MenuViewModel getViewModel() {
return (MenuViewModel) this.viewModel$delegate.getValue();
}
private final void history() {
c.h.b.b.a.b.d("tool_history_record");
FragmentManager fm = getFM();
if (fm != null) {
BrowserFragment browserFragment = getBrowserFragment();
if (browserFragment != null) {
BrowserFragment.toggleWebViewState$default(browserFragment, true, false, 2, null);
}
c.t.a.w.t0.a.f().c(fm, new HistoryFragment());
}
dismiss();
}
private final void imageExtract() {
c.h.b.b.a.b.d("tool_image_extract");
k0 k0Var = this.listener;
if (k0Var != null) {
k0Var.c();
}
dismiss();
}
private final void javaScript() {
c.h.b.b.a.b.d("tool_java_script");
FragmentManager fm = getFM();
if (fm != null) {
BrowserFragment browserFragment = getBrowserFragment();
if (browserFragment != null) {
BrowserFragment.toggleWebViewState$default(browserFragment, true, false, 2, null);
}
c.t.a.w.t0.a.f().c(fm, new JavaScriptFragment());
}
dismiss();
}
private final void login() {
c.t.c.n.b bVar = c.t.c.n.b.a;
if (bVar.c()) {
c.t.a.r.a.c(c.t.a.r.a.a, getActivity(), (Bundle) null, "/home/info", 0, 10, (Object) null);
} else {
bVar.d(getActivity(), new Observer() {
public final void onChanged(Object obj) {
MenuDialog.m24login$lambda27(MenuDialog.this, (Boolean) obj);
}
});
}
}
public static final void m24login$lambda27(MenuDialog menuDialog, Boolean bool) {
h.b0.d.l.f(menuDialog, "this$0");
h.b0.d.l.e(bool, "it");
if (bool.booleanValue() && menuDialog.isAdded()) {
menuDialog.getUserInfoViewModel().e();
menuDialog.getViewModel().U();
}
}
private final void nightMode() {
c.h.b.b.a.b.d("tool_night_mode");
int d2 = c.h.b.i.c.d("dark_mode");
char c2 = d2 != -1 ? (d2 == 1 || d2 != 2) ? (char) 0 : (char) 1 : (char) 2;
if (c2 == 0) {
c.h.b.i.c.k("dark_mode", 2);
} else if (c2 == 1) {
c.h.b.i.c.k("dark_mode", 1);
}
FragmentActivity activity = getActivity();
if (activity != null) {
if (c.t.a.u.a.a.b()) {
activity.setTheme(R$style.NightTheme);
} else {
activity.setTheme(R$style.DayTheme);
}
}
c.o.a.a.a("update_theme").b(0);
dismiss();
}
private final void noPicModel() {
c.h.b.b.a.b.d("tool_no_pic_model");
c.t.c.j.q1.p.a.a.G(!r0.b());
c.o.a.a.a("block_images_model").b(0);
dismiss();
}
private final void nonTraceMode() {
c.h.b.b.a.b.d("tool_non_trace_mode");
c.t.c.j.q1.p.a aVar = c.t.c.j.q1.p.a.a;
boolean z = !aVar.o();
aVar.U(z);
c.h.a.e.d.c(getString(z ? R$string.browser_non_trace_mode_tips : R$string.browser_close_non_trace_mode_tips));
dismiss();
}
private final void observeLiveData() {
getUserInfoViewModel().c.observe(this, new Observer() {
public final void onChanged(Object obj) {
MenuDialog.m25observeLiveData$lambda18(MenuDialog.this, (UserInfo) obj);
}
});
getViewModel().A().observe(this, new Observer() {
public final void onChanged(Object obj) {
MenuDialog.m26observeLiveData$lambda19(MenuDialog.this, (List) obj);
}
});
getViewModel().z().observe(this, new Observer() {
public final void onChanged(Object obj) {
MenuDialog.m27observeLiveData$lambda20((Boolean) obj);
}
});
getViewModel().x().observe(this, new Observer() {
public final void onChanged(Object obj) {
MenuDialog.m28observeLiveData$lambda21(MenuDialog.this, (NavWebsiteEntity) obj);
}
});
getViewModel().p().observe(this, new Observer() {
public final void onChanged(Object obj) {
MenuDialog.m29observeLiveData$lambda22(MenuDialog.this, (NavWebsiteEntity) obj);
}
});
getViewModel().u().observe(this, new Observer() {
public final void onChanged(Object obj) {
MenuDialog.m30observeLiveData$lambda23(MenuDialog.this, (Long) obj);
}
});
getViewModel().s().observe(this, new Observer() {
public final void onChanged(Object obj) {
MenuDialog.m31observeLiveData$lambda24(MenuDialog.this, (BookmarkEntity) obj);
}
});
getViewModel().o().observe(this, new Observer() {
public final void onChanged(Object obj) {
MenuDialog.m32observeLiveData$lambda25(MenuDialog.this, (Boolean) obj);
}
});
getViewModel().t().observe(this, new Observer() {
public final void onChanged(Object obj) {
MenuDialog.m33observeLiveData$lambda26(MenuDialog.this, (Boolean) obj);
}
});
}
public static final void m25observeLiveData$lambda18(MenuDialog menuDialog, UserInfo userInfo) {
h.b0.d.l.f(menuDialog, "this$0");
if (userInfo != null) {
menuDialog.getBinding().n.setText(userInfo.getNickname());
if (TextUtils.isEmpty(userInfo.getAvatar_url())) {
c.h.b.h.c.a(menuDialog.getBinding().a.getContext(), menuDialog.getBinding().a, Integer.valueOf(R$mipmap.common_default_avatar));
} else {
c.h.b.h.c.a(menuDialog.getBinding().a.getContext(), menuDialog.getBinding().a, userInfo.getAvatar_url());
}
if (TextUtils.isEmpty(userInfo.getAvatar_frame_url())) {
return;
}
c.h.b.h.c.a(menuDialog.getBinding().a.getContext(), menuDialog.getBinding().b, userInfo.getAvatar_frame_url());
}
}
public static final void m26observeLiveData$lambda19(MenuDialog menuDialog, List list) {
h.b0.d.l.f(menuDialog, "this$0");
MenuAdapter menuAdapter = menuDialog.adapter;
if (menuAdapter == null) {
h.b0.d.l.u("adapter");
menuAdapter = null;
}
menuAdapter.o0(list);
}
public static final void m27observeLiveData$lambda20(Boolean bool) {
h.b0.d.l.e(bool, "it");
if (bool.booleanValue()) {
c.h.b.c.a.a("login").h(0);
}
}
public static final void m28observeLiveData$lambda21(MenuDialog menuDialog, NavWebsiteEntity navWebsiteEntity) {
h.b0.d.l.f(menuDialog, "this$0");
selectedFunction.put("addNavigation", Boolean.TRUE);
RecyclerView.Adapter adapter = menuDialog.adapter;
if (adapter == null) {
h.b0.d.l.u("adapter");
adapter = null;
}
adapter.notifyDataSetChanged();
}
public static final void m29observeLiveData$lambda22(MenuDialog menuDialog, NavWebsiteEntity navWebsiteEntity) {
h.b0.d.l.f(menuDialog, "this$0");
c.h.a.e.d.c("已添加到导航");
c.h.b.c.a.a("add_website").h(navWebsiteEntity);
menuDialog.dismiss();
}
public static final void m30observeLiveData$lambda23(MenuDialog menuDialog, Long l2) {
h.b0.d.l.f(menuDialog, "this$0");
c.h.a.e.d.c("已从到导航移除");
menuDialog.dismiss();
c.h.b.c.a.a("del_website").h(l2);
}
public static final void m31observeLiveData$lambda24(MenuDialog menuDialog, BookmarkEntity bookmarkEntity) {
h.b0.d.l.f(menuDialog, "this$0");
selectedFunction.put("addBookmark", Boolean.TRUE);
RecyclerView.Adapter adapter = menuDialog.adapter;
if (adapter == null) {
h.b0.d.l.u("adapter");
adapter = null;
}
adapter.notifyDataSetChanged();
}
public static final void m32observeLiveData$lambda25(MenuDialog menuDialog, Boolean bool) {
h.b0.d.l.f(menuDialog, "this$0");
h.b0.d.l.e(bool, "success");
if (bool.booleanValue()) {
c.h.a.e.d.c("已添加到书签");
menuDialog.dismiss();
c.o.a.a.a("bookmark_refresh_data").b(1);
c.h.b.c.a.a("bookmark_update").h(0);
}
}
public static final void m33observeLiveData$lambda26(MenuDialog menuDialog, Boolean bool) {
h.b0.d.l.f(menuDialog, "this$0");
if (h.b0.d.l.b(bool, Boolean.TRUE)) {
c.h.a.e.d.c("已从到书签移除");
menuDialog.dismiss();
c.h.b.c.a.a("bookmark_update").h(0);
}
}
public static final void m34onActivityCreated$lambda1(MenuDialog menuDialog) {
View findViewById;
h.b0.d.l.f(menuDialog, "this$0");
Dialog dialog = menuDialog.getDialog();
if (dialog == null || (findViewById = dialog.findViewById(R.id.design_bottom_sheet)) == null) {
return;
}
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(findViewById, "translationY", 0.0f, -50.0f, -50.0f, 0.0f);
h.b0.d.l.e(ofFloat, "ofFloat(bottomSheet, \"tr…onY\", 0f, -50f, -50f, 0f)");
ofFloat.setDuration(1000L);
ofFloat.start();
}
public static final void m35onViewCreated$lambda4(View view) {
h.b0.d.l.f(view, "$view");
Context context = view.getContext();
h.b0.d.l.e(context, "view.context");
new j0(context).showAsDropDown(view, 0, c.t.a.k.f.a(-52));
}
public static final void m36onViewCreated$lambda6(MenuDialog menuDialog, BaseQuickAdapter baseQuickAdapter, View view, int i2) {
h.b0.d.l.f(menuDialog, "this$0");
h.b0.d.l.f(baseQuickAdapter, "$noName_0");
h.b0.d.l.f(view, "$noName_1");
MenuAdapter menuAdapter = menuDialog.adapter;
if (menuAdapter == null) {
h.b0.d.l.u("adapter");
menuAdapter = null;
}
String functionName = ((MenuItem) menuAdapter.getItem(i2)).getFunctionName();
if (whiteFunction.contains(functionName) && menuDialog.isWhiteList) {
c.h.a.e.d.c("该网站在白名单中,禁止使用此功能");
return;
}
if (!checkEnableFunction.contains(functionName) || menuDialog.isUrl) {
try {
menuDialog.getClass().getDeclaredMethod(functionName, new Class[0]).invoke(menuDialog, new Object[0]);
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
private final void openSC() {
c.h.b.b.a.b.d("tool_sc");
k0 k0Var = this.listener;
if (k0Var != null) {
k0Var.e();
}
dismiss();
}
private final void pageFind() {
c.h.b.b.a.b.d("tool_page_find");
k0 k0Var = this.listener;
if (k0Var != null) {
k0Var.b();
}
dismiss();
}
private final void readMode() {
c.h.b.b.a.b.d("tool_read_mode");
k0 k0Var = this.listener;
if (k0Var != null) {
k0Var.j();
}
dismiss();
}
private final void refresh() {
c.h.b.b.a.b.d("tool_refresh");
k0 k0Var = this.listener;
if (k0Var != null) {
k0Var.refresh();
}
dismiss();
}
private final void saveWebArchive() {
k0 k0Var = this.listener;
if (k0Var != null) {
k0Var.d();
}
dismiss();
}
private final void screenRotate() {
c.h.b.b.a.b.d("tool_rotate");
boolean z = !c.h.b.i.c.b("screen_rotate", false);
c.h.b.i.c.n("screen_rotate", z);
if (z) {
FragmentActivity activity = getActivity();
if (activity != null) {
activity.setRequestedOrientation(-1);
}
} else {
FragmentActivity activity2 = getActivity();
if (activity2 != null) {
activity2.setRequestedOrientation(1);
}
}
dismiss();
}
private final void setEditModelView(boolean z) {
getBinding().a.setVisibility(z ? 4 : 0);
getBinding().n.setVisibility(z ? 8 : 0);
getBinding().f1176j.setVisibility(z ? 8 : 0);
getBinding().f1169c.setVisibility(z ? 8 : 0);
getBinding().f1179m.setVisibility(z ? 0 : 8);
getBinding().f1178l.setVisibility(z ? 0 : 8);
getBinding().f1170d.setVisibility(z ? 0 : 8);
getBinding().f1172f.setVisibility(z ? 0 : 8);
MenuAdapter menuAdapter = this.adapter;
MenuAdapter menuAdapter2 = null;
if (menuAdapter == null) {
h.b0.d.l.u("adapter");
menuAdapter = null;
}
menuAdapter.C().r(z);
MenuAdapter menuAdapter3 = this.adapter;
if (menuAdapter3 == null) {
h.b0.d.l.u("adapter");
menuAdapter3 = null;
}
menuAdapter3.C().s(z);
RecyclerView recyclerView = getBinding().f1177k;
RecyclerView.Adapter adapter = this.adapter;
if (adapter == null) {
h.b0.d.l.u("adapter");
adapter = null;
}
recyclerView.setAdapter(adapter);
MenuAdapter menuAdapter4 = this.adapter;
if (menuAdapter4 == null) {
h.b0.d.l.u("adapter");
} else {
menuAdapter2 = menuAdapter4;
}
menuAdapter2.w0(z);
}
private final void shutdown() {
c.h.b.b.a.b.d("tool_shutdown");
c.o.a.a.a("clear_last_web_info").b(0);
c.h.b.o.a.h().f();
dismiss();
}
private final void subscribe() {
c.h.b.b.a.b.d("tool_subscribe");
FragmentManager fm = getFM();
if (fm != null) {
c.t.a.w.t0.a.f().c(fm, ((SubscribeFragmentProvider) c.a.a.a.d.a.c().g(SubscribeFragmentProvider.class)).a());
}
dismiss();
}
private final void touchEventListener() {
getBinding().a.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MenuDialog.m43touchEventListener$lambda8(MenuDialog.this, view);
}
});
getBinding().n.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MenuDialog.m44touchEventListener$lambda9(MenuDialog.this, view);
}
});
getBinding().f1171e.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MenuDialog.m37touchEventListener$lambda11(MenuDialog.this, view);
}
});
getBinding().f1174h.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MenuDialog.m38touchEventListener$lambda12(MenuDialog.this, view);
}
});
getBinding().f1173g.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MenuDialog.m39touchEventListener$lambda14(MenuDialog.this, view);
}
});
getBinding().f1169c.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MenuDialog.m40touchEventListener$lambda15(MenuDialog.this, view);
}
});
getBinding().f1170d.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MenuDialog.m41touchEventListener$lambda16(MenuDialog.this, view);
}
});
getBinding().f1172f.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MenuDialog.m42touchEventListener$lambda17(MenuDialog.this, view);
}
});
}
public static final void m37touchEventListener$lambda11(MenuDialog menuDialog, View view) {
h.b0.d.l.f(menuDialog, "this$0");
String str = menuDialog.url;
if (str == null) {
return;
}
new ConfirmDialog.a().v("反馈").r("该网站有不良广告,反馈拦截(不是点击广告后的跳转网站)").n("提交反馈").m(new k(str, menuDialog)).a().q(menuDialog.requireActivity().getSupportFragmentManager());
}
public static final void m38touchEventListener$lambda12(MenuDialog menuDialog, View view) {
String str;
h.b0.d.l.f(menuDialog, "this$0");
c.h.b.b.a.b.d("tool_share");
Intent intent = new Intent("android.intent.action.SEND");
intent.setType(AdblockWebView.WebResponseResult.RESPONSE_MIME_TYPE);
String str2 = menuDialog.title;
if (str2 != null) {
intent.putExtra("android.intent.extra.SUBJECT", str2);
}
String str3 = menuDialog.url;
if (str3 == null || str3.length() == 0) {
str = "top浏览器 #追剧追小说 #https://www.topc1.com";
} else {
str = ((Object) menuDialog.title) + '\n' + ((Object) menuDialog.url) + "\n#Top浏览器";
}
intent.putExtra("android.intent.extra.TEXT", str);
FragmentActivity activity = menuDialog.getActivity();
if (activity == null) {
return;
}
activity.startActivity(Intent.createChooser(intent, "分享此页面"));
}
public static final void m39touchEventListener$lambda14(MenuDialog menuDialog, View view) {
h.b0.d.l.f(menuDialog, "this$0");
c.h.b.b.a.b.d("tool_setting");
FragmentManager fm = menuDialog.getFM();
if (fm != null) {
BrowserFragment browserFragment = menuDialog.getBrowserFragment();
if (browserFragment != null) {
BrowserFragment.toggleWebViewState$default(browserFragment, true, false, 2, null);
}
c.t.a.w.t0.a.f().c(fm, new SettingFragment());
}
menuDialog.dismiss();
}
public static final void m40touchEventListener$lambda15(MenuDialog menuDialog, View view) {
h.b0.d.l.f(menuDialog, "this$0");
menuDialog.getBinding().f1175i.setVisibility(8);
c.h.b.i.c.n(EDIT_HINT_HAVE_SHOW, true);
menuDialog.setEditModelView(true);
}
public static final void m41touchEventListener$lambda16(MenuDialog menuDialog, View view) {
h.b0.d.l.f(menuDialog, "this$0");
menuDialog.setEditModelView(false);
}
public static final void m42touchEventListener$lambda17(MenuDialog menuDialog, View view) {
h.b0.d.l.f(menuDialog, "this$0");
MenuViewModel viewModel = menuDialog.getViewModel();
MenuAdapter menuAdapter = menuDialog.adapter;
if (menuAdapter == null) {
h.b0.d.l.u("adapter");
menuAdapter = null;
}
viewModel.S(menuAdapter.z());
menuDialog.setEditModelView(false);
}
public static final void m43touchEventListener$lambda8(MenuDialog menuDialog, View view) {
h.b0.d.l.f(menuDialog, "this$0");
menuDialog.login();
}
public static final void m44touchEventListener$lambda9(MenuDialog menuDialog, View view) {
h.b0.d.l.f(menuDialog, "this$0");
menuDialog.login();
}
private final void translate() {
c.h.b.b.a.b.d("tool_translate");
k0 k0Var = this.listener;
if (k0Var != null) {
k0Var.h();
}
dismiss();
}
private final void uaSetting() {
c.h.b.b.a.b.d("tool_ua");
UADialog uADialog = new UADialog();
uADialog.K(new l());
uADialog.q(getParentFragmentManager());
dismiss();
}
private final void wallPage() {
startActivity(new Intent((Context) getActivity(), Class.forName("com.pocket.topbrowser.home.individuation.IndividuationActivity")));
dismiss();
}
public void _$_clearFindViewByIdCache() {
}
public final BrowserFragment getBrowserFragment() {
return this.browserFragment;
}
public final k0 getListener() {
return this.listener;
}
public void onActivityCreated(@Nullable Bundle bundle) {
super/*androidx.fragment.app.Fragment*/.onActivityCreated(bundle);
if (c.h.b.i.c.b(HAVE_MORE_FUN_JUMP_SHOW, false)) {
return;
}
c.h.b.o.i.c(new Runnable() {
@Override
public final void run() {
MenuDialog.m34onActivityCreated$lambda1(MenuDialog.this);
}
}, 500L);
c.h.b.i.c.n(HAVE_MORE_FUN_JUMP_SHOW, true);
}
public void onCreate(Bundle bundle) {
super/*androidx.fragment.app.DialogFragment*/.onCreate(bundle);
setStyle(0, R$style.AppBottomSheet);
}
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
h.b0.d.l.f(layoutInflater, "inflater");
return layoutInflater.inflate(R$layout.browser_tool_2_dialog, viewGroup, false);
}
public void onViewCreated(final View view, Bundle bundle) {
Window window;
Window window2;
h.b0.d.l.f(view, "view");
super/*androidx.fragment.app.Fragment*/.onViewCreated(view, bundle);
Dialog dialog = getDialog();
RecyclerView.Adapter adapter = null;
View findViewById = (dialog == null || (window = dialog.getWindow()) == null) ? null : window.findViewById(R.id.design_bottom_sheet);
Dialog dialog2 = getDialog();
FrameLayout frameLayout = (dialog2 == null || (window2 = dialog2.getWindow()) == null) ? null : (FrameLayout) window2.findViewById(R.id.container);
if (frameLayout != null) {
View view2 = new View(view.getContext());
this.bottomView = view2;
h.b0.d.l.d(view2);
view2.setBackgroundResource(c.t.a.u.a.a.b() ? R$drawable.browser_bg_menu_bottom_n : R$drawable.browser_bg_menu_bottom);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, c.t.a.k.f.a(45));
layoutParams.gravity = 80;
View view3 = this.bottomView;
h.b0.d.l.d(view3);
view3.setLayoutParams(layoutParams);
frameLayout.addView(this.bottomView);
}
if (findViewById != null) {
BottomSheetBehavior.from(findViewById).setPeekHeight(c.t.a.k.f.a(290));
}
boolean z = true;
if (!c.h.b.i.c.b("haveShowMenuHint", false)) {
c.h.b.i.c.n("haveShowMenuHint", true);
c.h.b.o.i.c(new Runnable() {
@Override
public final void run() {
MenuDialog.m35onViewCreated$lambda4(view);
}
}, 100L);
}
v vVar = new v();
w wVar = new w();
BottomSheetDialog dialog3 = getDialog();
Objects.requireNonNull(dialog3, "null cannot be cast to non-null type com.google.android.material.bottomsheet.BottomSheetDialog");
dialog3.getBehavior().addBottomSheetCallback(new d(wVar, this, vVar));
Bundle arguments = getArguments();
this.url = arguments == null ? null : arguments.getString("url");
Bundle arguments2 = getArguments();
this.title = arguments2 == null ? null : arguments2.getString("title");
String str = this.url;
this.isUrl = !(str == null || str.length() == 0);
Map<String, Boolean> map = selectedFunction;
c.t.c.j.q1.p.a aVar = c.t.c.j.q1.p.a.a;
map.put("nonTraceMode", Boolean.valueOf(aVar.o()));
map.put("fullScreen", Boolean.valueOf(aVar.l()));
map.put("nightMode", Boolean.valueOf(c.h.b.i.c.b("night_mode", false)));
map.put("screenRotate", Boolean.valueOf(c.h.b.i.c.b("screen_rotate", false)));
map.put("noPicModel", Boolean.valueOf(aVar.b()));
map.put("adBlock", Boolean.valueOf(aVar.a()));
map.put("desktopMode", Boolean.valueOf(aVar.j()));
Boolean bool = Boolean.FALSE;
map.put("addBookmark", bool);
map.put("addNavigation", bool);
map.put("nightMode", Boolean.valueOf(c.h.b.i.c.d("dark_mode") == 2));
touchEventListener();
observeLiveData();
c.d.a.c.v(this).u(Integer.valueOf(R$drawable.common_ic_report)).c1(getBinding().f1171e);
c.d.a.c.v(this).u(Integer.valueOf(R$drawable.common_ic_share)).c1(getBinding().f1174h);
c.d.a.c.v(this).u(Integer.valueOf(R$drawable.common_ic_setting)).c1(getBinding().f1173g);
List<String> e2 = c.h.b.f.f.b.a().e("ad_white_list", "domain", String.class);
if (!TextUtils.isEmpty(this.url)) {
n0 n0Var = n0.a;
String str2 = this.url;
h.b0.d.l.d(str2);
String d2 = n0Var.d(str2);
if (!TextUtils.isEmpty(d2) && e2 != null) {
for (String str3 : e2) {
h.b0.d.l.d(d2);
if (t.L(str3, d2, false, 2, null)) {
this.isWhiteList = true;
}
}
}
}
if (c.t.c.n.b.a.c()) {
getUserInfoViewModel().e();
}
ImageView imageView = getBinding().f1171e;
String str4 = this.url;
if (str4 != null && str4.length() != 0) {
z = false;
}
imageView.setVisibility(z ? 8 : 0);
ImageView imageView2 = getBinding().f1169c;
a.b bVar = c.t.a.u.a.a;
imageView2.setBackgroundResource(bVar.b() ? R$drawable.browser_bg_r22_252531 : R$drawable.browser_bg_r22_f8);
getBinding().f1176j.setBackgroundResource(bVar.b() ? R$drawable.browser_bg_r17_252531 : R$drawable.browser_bg_r17_f8);
getBinding().f1175i.setVisibility(c.h.b.i.c.b(EDIT_HINT_HAVE_SHOW, false) ? 8 : 0);
MenuAdapter menuAdapter = new MenuAdapter(checkEnableFunction, selectedFunction, this.isUrl);
this.adapter = menuAdapter;
menuAdapter.C().t(R$id.ll_container);
MenuAdapter menuAdapter2 = this.adapter;
if (menuAdapter2 == null) {
h.b0.d.l.u("adapter");
menuAdapter2 = null;
}
menuAdapter2.C().r(false);
MenuAdapter menuAdapter3 = this.adapter;
if (menuAdapter3 == null) {
h.b0.d.l.u("adapter");
menuAdapter3 = null;
}
menuAdapter3.C().s(false);
MenuAdapter menuAdapter4 = this.adapter;
if (menuAdapter4 == null) {
h.b0.d.l.u("adapter");
menuAdapter4 = null;
}
menuAdapter4.C().setOnItemDragListener(new e());
MenuAdapter menuAdapter5 = this.adapter;
if (menuAdapter5 == null) {
h.b0.d.l.u("adapter");
menuAdapter5 = null;
}
menuAdapter5.setOnItemClickListener(new c.f.a.a.a.g.d() {
public final void a(BaseQuickAdapter baseQuickAdapter, View view4, int i2) {
MenuDialog.m36onViewCreated$lambda6(MenuDialog.this, baseQuickAdapter, view4, i2);
}
});
getBinding().f1177k.setLayoutManager(new GridLayoutManager(getContext(), 5));
RecyclerView recyclerView = getBinding().f1177k;
RecyclerView.Adapter adapter2 = this.adapter;
if (adapter2 == null) {
h.b0.d.l.u("adapter");
} else {
adapter = adapter2;
}
recyclerView.setAdapter(adapter);
getViewModel().B();
String str5 = this.url;
if (str5 == null) {
return;
}
getViewModel().v(str5);
getViewModel().q(str5);
}
public final void setBrowserFragment(BrowserFragment browserFragment) {
this.browserFragment = browserFragment;
}
public final void setListener(k0 k0Var) {
this.listener = k0Var;
}
}