搜书大师 v23.2版本的 MD5 值为:5ee433f6456b6278bd6e80a5d44df55e
以下内容为反编译后的 ActivityMain.java 源代码,内容仅作参考
package com.flyersoft.seekbooks;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.ParcelFileDescriptor;
import android.os.SystemClock;
import android.text.ClipboardManager;
import android.text.Html;
import android.util.SparseArray;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.animation.TranslateAnimation;
import android.webkit.DownloadListener;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.SwitchCompat;
import androidx.appcompat.widget.Toolbar;
import androidx.cardview.widget.CardView;
import androidx.core.app.ActivityOptionsCompat;
import androidx.core.view.InputDeviceCompat;
import androidx.core.view.ViewCompat;
import androidx.documentfile.provider.DocumentFile;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.alibaba.android.arouter.launcher.ARouter;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.facebook.drawee.view.SimpleDraweeView;
import com.flyersoft.WB.AboutAct;
import com.flyersoft.WB.BrowserAct;
import com.flyersoft.WB.Constants;
import com.flyersoft.WB.DownloadTask;
import com.flyersoft.WB.DownloadTaskAsync;
import com.flyersoft.WB.DownloadTaskBrowser;
import com.flyersoft.WB.IntroActivity;
import com.flyersoft.WB.S;
import com.flyersoft.WB.SelectFileAct;
import com.flyersoft.WB.ShelfManageAct;
import com.flyersoft.WB.SplashActivity;
import com.flyersoft.WB.UserInfoAct;
import com.flyersoft.WB.WB;
import com.flyersoft.WB.WebBookDetailAct;
import com.flyersoft.WB.WebCacheAct;
import com.flyersoft.WB.WebSearchAct;
import com.flyersoft.WB.WebSitesAct;
import com.flyersoft.baseapplication.BaseFragment;
import com.flyersoft.baseapplication.ad.ZKAD;
import com.flyersoft.baseapplication.config.ARouterPath;
import com.flyersoft.baseapplication.login.AccountData;
import com.flyersoft.baseapplication.refreshlayout.PullRefreshLayout;
import com.flyersoft.baseapplication.tablayout.TabLayout;
import com.flyersoft.baseapplication.z2;
import com.flyersoft.baseapplication.zhou.ZhouBase;
import com.flyersoft.components.ClearableEditText;
import com.flyersoft.components.ShelfImageView;
import com.flyersoft.components.m;
import com.flyersoft.components.q;
import com.flyersoft.discuss.ForumMainFragment;
import com.flyersoft.discuss.TS;
import com.flyersoft.discuss.config.DataConfig;
import com.flyersoft.discuss.main.BoardControler;
import com.flyersoft.discuss.source.source.SourceManagerLayout;
import com.flyersoft.discuss.tools.AnimalTools;
import com.flyersoft.discuss.tools.StringTools;
import com.flyersoft.discuss.z;
import com.flyersoft.seekbooks.b;
import com.flyersoft.seekbooks.c;
import com.flyersoft.seekbooks.wwutil.StoreWebView;
import com.flyersoft.source.MoonEngine;
import com.flyersoft.source.bean.BookSource;
import com.flyersoft.source.bean.DiscoveryBean;
import com.flyersoft.source.dao.SourceController;
import com.flyersoft.source.manager.DiscoveryModel;
import com.flyersoft.source.service.web.RequestCallback;
import com.flyersoft.source.service.web.ServiceControll;
import com.flyersoft.source.service.web.WebService;
import com.flyersoft.source.service.web.event.WebServicerBookEvent;
import com.flyersoft.source.service.web.event.WebServicerEvent;
import com.flyersoft.source.service.web.response.BookSourceAll;
import com.flyersoft.source.service.web.response.BooksAndBookShelfs;
import com.flyersoft.source.service.web.response.ChapterResponse;
import com.flyersoft.source.service.web.response.DevicesInfo;
import com.flyersoft.source.service.web.utils.ReturnData;
import com.flyersoft.source.utils.JsonUtils;
import com.flyersoft.source.yuedu3.FileUtils;
import com.flyersoft.wwtools.config.ThirdConfig;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.bottomnavigation.BottomNavigationItemView;
import com.google.android.material.bottomnavigation.BottomNavigationMenuView;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.snackbar.Snackbar;
import com.lygame.aaa.bf0;
import com.lygame.aaa.e50;
import com.lygame.aaa.f50;
import com.lygame.aaa.g50;
import com.lygame.aaa.gy;
import com.lygame.aaa.h43;
import com.lygame.aaa.j50;
import com.lygame.aaa.my;
import com.lygame.aaa.n63;
import com.lygame.aaa.o50;
import com.lygame.aaa.py;
import com.lygame.aaa.q50;
import com.lygame.aaa.rv;
import com.qadsdk.s1.s5;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
public class ActivityMain extends BaseActivity implements View.OnClickListener, ServiceControll {
public static final int A0 = 3041;
public static final int B0 = 3042;
public static final int C0 = 3043;
public static final int D0 = 3044;
public static final int E0 = 3046;
public static final int F0 = 4000;
public static long G0 = 0;
public static long H0 = 0;
public static long I0 = 0;
public static int J0 = 0;
public static final int a = 0;
public static boolean a0 = false;
public static final int b = 1;
public static View b0 = null;
public static final int c = 2;
private static boolean c0 = e50.w2;
public static final int d = 3;
public static String d0 = null;
public static ActivityMain e = null;
public static boolean e0 = false;
public static ActivityMain f = null;
public static final int f0 = 1005;
public static boolean g = false;
public static final int g0 = 1007;
public static final int h0 = 1008;
public static final int i0 = 1010;
public static final int j0 = 1011;
public static final int k0 = 1012;
public static final int l0 = 1013;
public static final int m0 = 1014;
public static final int n0 = 1015;
public static final int o0 = 10171;
public static final int p0 = 1018;
public static final int q0 = 1019;
public static final int r0 = 1020;
public static final int s0 = 1021;
public static final int t0 = 1022;
public static final int u0 = 10222;
public static final int v0 = 1023;
public static final int w0 = 10232;
public static final int x0 = 1030;
public static final int y0 = 3030;
public static final int z0 = 3040;
S.WebBook A1;
public ViewPager A2;
ArrayList<S.WebChapter> B1;
TabLayout B2;
boolean C1;
View C2;
View D1;
View E1;
View F1;
View G1;
ViewGroup G2;
ImageView H1;
public ShelfImageView I1;
boolean I2;
TextView J1;
boolean J2;
public ViewPager K0;
ImageView K1;
private Disposable K2;
private Toolbar L0;
ViewGroup L1;
public Context L2;
private View M0;
ViewGroup M1;
f50 M2;
private View N0;
ViewGroup N1;
String N2;
private View O0;
SwitchCompat O1;
private View P0;
TextView P1;
private View Q0;
public boolean Q1;
private View R0;
public boolean R1;
ImageView S0;
public boolean S1;
ImageView T0;
public boolean T1;
TextView U0;
m.c U1;
TextView V0;
boolean V1;
private BottomNavigationView W0;
int W1;
ForumMainFragment X0;
int X1;
boolean Y0;
int Y1;
String Z0;
String a1;
View b1;
long b2;
View c1;
ItemTouchHelper c2;
View d1;
boolean d2;
AppBarLayout e1;
boolean e2;
LayoutInflater f1;
ViewGroup g1;
com.flyersoft.components.m g2;
public ViewGroup h1;
boolean h2;
public ViewGroup i1;
public ViewGroup j1;
ArrayList<String> j2;
public RecyclerView k1;
ArrayList<String> k2;
public RecyclerView l1;
ProgressDialog l2;
public RecyclerView m1;
public RecyclerView n1;
boolean n2;
List<DiscoveryBean> o1;
public StoreWebView p1;
View q1;
ViewGroup r1;
ViewGroup s1;
boolean s2;
TextView t1;
boolean t2;
ImageView u1;
public HashMap<String, Integer> u2;
String v1;
HashMap<String, Integer> v2;
boolean w1;
DownloadTaskBrowser.CacheWebView x1;
DownloadTaskBrowser.CacheWebView y1;
boolean y2;
HashMap<String, Integer> z1;
boolean z2;
int Z1 = -1;
int a2 = -1;
ArrayList<g50.e> f2 = new ArrayList<>();
View.OnClickListener i2 = new z();
public Handler m2 = new i0(Looper.getMainLooper());
final String o2 = "○ 手机: 读取手机状态以搜索书籍";
final String p2 = "○ 存储空间: 缓存书籍相关文件";
View.OnClickListener q2 = new k0();
ArrayList<String> r2 = new ArrayList<>();
ArrayList<String> w2 = new ArrayList<>();
View.OnClickListener x2 = new v0();
SparseArray<View> D2 = new SparseArray<>();
SparseArray<PullRefreshLayout> E2 = new SparseArray<>();
SparseArray<RecyclerView> F2 = new SparseArray<>();
int H2 = 0;
public static class DashMainFragment extends BaseFragment {
@Override
public ViewGroup initView() {
return ActivityMain.e.p2(false);
}
}
public static class DiscoveryMainFragment extends BaseFragment {
@Override
public ViewGroup initView() {
return ActivityMain.e.q2(false);
}
}
public class MainActivityFragmentAdapter extends FragmentPagerAdapter {
public final String[] a;
private List<Fragment> b;
public MainActivityFragmentAdapter(FragmentManager fm) {
super(fm);
this.a = new String[]{"书架", "书城", "论坛", "我的"};
this.b = new ArrayList();
ForumMainFragment forumMainFragment = new ForumMainFragment();
ActivityMain.this.X0 = forumMainFragment;
forumMainFragment.ready = e50.l2 == 2;
this.b.add(new ShelfMainFragment());
this.b.add(new DiscoveryMainFragment());
this.b.add(ActivityMain.this.X0);
this.b.add(new DashMainFragment());
}
@Override
public int getCount() {
return this.b.size();
}
@Override
public Fragment getItem(int position) {
return this.b.get(position);
}
@Override
public CharSequence getPageTitle(int position) {
return this.a[position];
}
}
public static class ShelfMainFragment extends BaseFragment {
@Override
public ViewGroup initView() {
return ActivityMain.e.r2(false);
}
}
public class ShelfPagerAdapter extends PagerAdapter {
public ShelfPagerAdapter() {
}
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
}
@Override
public int getCount() {
return e50.A3().size();
}
@Override
public CharSequence getPageTitle(int position) {
return e50.A3().get(position);
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
ActivityMain activityMain = ActivityMain.this;
activityMain.G2 = container;
return activityMain.s2(position, false);
}
@Override
public boolean isViewFromObject(View arg0, Object arg1) {
return arg0.equals(arg1);
}
}
public class a implements View.OnLongClickListener {
a() {
}
@Override
public boolean onLongClick(View v) {
ActivityMain.this.N1();
return true;
}
}
class a0 implements m.d {
a0() {
}
@Override
public void onClick(int which) {
if (which == 0) {
if (e50.k7(ActivityMain.this, "请注意, 创建书单需要应用获取本地存储空间的权限以读取书籍信息, 是否进行权限设置?")) {
com.flyersoft.discuss.z.createShudan();
}
} else if (which == 1) {
com.flyersoft.discuss.z.createHuaTi();
} else if (which == 2) {
com.flyersoft.discuss.z.createShuHuang();
} else {
if (which != 3) {
return;
}
com.flyersoft.discuss.z.createShuPing();
}
}
}
public class a1 implements DialogInterface.OnClickListener {
final Activity a;
final String b;
a1(final Activity val$act, final String val$filename) {
this.a = val$act;
this.b = val$filename;
}
@Override
public void onClick(DialogInterface dialog, int which) {
ActivityMain.v1(this.a, this.b);
}
}
public class a2 implements View.OnClickListener {
class a implements DialogInterface.OnClickListener {
final CheckBox a;
a(final CheckBox val$cb) {
this.a = val$cb;
}
@Override
public void onClick(DialogInterface dialog, int which) {
e50.x2 = this.a.isChecked();
ActivityMain activityMain = ActivityMain.this;
activityMain.j0(activityMain.t1, false);
}
}
a2() {
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.back2:
if (!ActivityMain.this.p1.canGoBack()) {
ActivityMain.this.b1();
return;
} else {
ActivityMain.this.p1.goBack();
return;
}
case R.id.favorite:
ActivityMain.this.L0();
return;
case R.id.forward2:
if (ActivityMain.this.p1.canGoForward()) {
ActivityMain.this.p1.goForward();
return;
} else {
ActivityMain.this.p1.reload();
return;
}
case R.id.home2:
ActivityMain activityMain = ActivityMain.this;
activityMain.w1 = true;
activityMain.b1();
return;
case R.id.outer:
ActivityMain activityMain2 = ActivityMain.this;
o50.b2(activityMain2, activityMain2.v1);
return;
case R.id.progress2:
ActivityMain.this.p1.stopLoading();
ActivityMain.this.q1.setVisibility(8);
return;
case R.id.read2:
if (!e50.x2) {
boolean unused = ActivityMain.c0 = true;
ScrollView scrollView = (ScrollView) LayoutInflater.from(ActivityMain.this).inflate(R.layout.do_event_confirm, (ViewGroup) null);
TextView textView = (TextView) scrollView.findViewById(R.id.ofTextView);
CheckBox checkBox = (CheckBox) scrollView.findViewById(R.id.ofNeverAskAgain);
textView.setText(Html.fromHtml(e50.s1("关于优化阅读.htm")));
checkBox.setChecked(true);
new m.c(ActivityMain.this).B(scrollView).v(R.string.ok, new a(checkBox)).o(R.string.cancel, null).C();
return;
}
ActivityMain activityMain3 = ActivityMain.this;
activityMain3.j0(activityMain3.t1, false);
return;
default:
return;
}
}
}
public class b extends StoreWebView.e {
b() {
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
ActivityMain.this.q1.setVisibility(8);
ActivityMain.this.v2(url);
ActivityMain.this.n2(url);
ActivityMain activityMain = ActivityMain.this;
if (activityMain.w1) {
activityMain.w1 = false;
view.clearHistory();
}
ActivityMain.this.e1.setExpanded(false, true);
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
ActivityMain.this.q1.setVisibility(0);
ActivityMain.this.v2(url);
ActivityMain.this.t1.setVisibility(4);
if (ActivityMain.this.w1) {
view.clearHistory();
}
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
e50.N5("#url : " + url);
if (S.openAppInWebView(ActivityMain.this, url, true)) {
return true;
}
if (url.endsWith(".txt")) {
ActivityMain activityMain = ActivityMain.this;
BrowserAct.downloadBook(activityMain, activityMain.m2, activityMain.q1, url, null, null);
return true;
}
if (ActivityMain.this.w1) {
view.clearHistory();
}
if (ThirdConfig.isYueWenUrl(url)) {
return super.shouldOverrideUrlLoading(view, url);
}
view.loadUrl(url);
return true;
}
}
class b0 implements m.d {
b0() {
}
@Override
public void onClick(int which) {
if (which == 0) {
if (e50.k7(ActivityMain.this, "请注意, 阅读书籍需要应用获取本地存储空间的权限以读取书籍信息, 是否进行权限设置?")) {
if (o50.A1(e50.V1)) {
ActivityMain.v1(ActivityMain.this, e50.V1);
return;
} else {
o50.p2(ActivityMain.this, e50.W0("没有找到上次阅读的书籍."));
return;
}
}
return;
}
if (which == 7) {
ActivityMain.this.X1();
return;
}
if (which == 2) {
ActivityMain.this.z1();
return;
}
if (which == 3) {
ActivityMain.this.startActivityForResult(new Intent(ActivityMain.this, (Class<?>) WebCacheAct.class), 101);
return;
}
if (which != 4) {
if (which != 5) {
return;
}
ActivityMain.this.startActivity(new Intent(ActivityMain.this, (Class<?>) AboutAct.class));
} else if (e50.k7(ActivityMain.this, "请注意, 管理本地书籍需要应用获取本地存储空间的权限, 是否进行权限设置?")) {
ActivityMain.this.y1();
}
}
}
public class b1 extends Thread {
b1() {
}
@Override
public void run() {
o50.P(o50.b1(com.flyersoft.seekbooks.q.G().getHeadPic()), com.flyersoft.seekbooks.q.s());
}
}
class b2 {
String a;
String b;
b2() {
}
public String a() {
return this.a;
}
public void b(String text) {
this.a = text;
}
}
public class c implements DownloadListener {
c() {
}
@Override
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
e50.N5("*onDownloadStart : " + url);
ActivityMain activityMain = ActivityMain.this;
BrowserAct.downloadBook(activityMain, activityMain.m2, activityMain.d1.findViewById(R.id.progress), url, null, null);
}
}
class c0 implements m.d {
class a implements DialogInterface.OnClickListener {
class ViewOnClickListenerC0924a implements View.OnClickListener {
ViewOnClickListenerC0924a() {
}
@Override
public void onClick(View v) {
e50.H2().addAll(ActivityMain.this.j2);
e50.q6();
ActivityMain activityMain = ActivityMain.this;
activityMain.p1(activityMain.l1);
}
}
a() {
}
@Override
public void onClick(DialogInterface dialog, int which) {
ActivityMain.this.j2 = (ArrayList) e50.H2().clone();
e50.H2().clear();
e50.q6();
ActivityMain activityMain = ActivityMain.this;
activityMain.p1(activityMain.l1);
Snackbar.make(ActivityMain.this.b1, Html.fromHtml("<font color=\"#ffffff\">最近阅读已清空</font>"), 0).setAction("撤销", new ViewOnClickListenerC0924a()).setActionTextColor(InputDeviceCompat.SOURCE_ANY).show();
}
}
c0() {
}
@Override
public void onClick(int which) {
new m.c(ActivityMain.this).m(ActivityMain.this.getString(R.string.qingkongzujijinyd)).w("是", new a()).p("否", null).C();
}
}
public class c1 implements View.OnAttachStateChangeListener {
c1() {
}
@Override
public void onViewAttachedToWindow(View v) {
e50.I(ActivityMain.this);
}
@Override
public void onViewDetachedFromWindow(View v) {
}
}
public class c2 extends RecyclerView.Adapter {
RecyclerView.ViewHolder a;
c2() {
}
@Override
public int getItemCount() {
return 1;
}
@Override
public int getItemViewType(int position) {
return 0;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
holder.setIsRecyclable(false);
if (this.a == null) {
this.a = holder;
ActivityMain.this.k1(((d2) holder).a);
}
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
RecyclerView.ViewHolder viewHolder = this.a;
if (viewHolder != null) {
return viewHolder;
}
return new d2(LayoutInflater.from(ActivityMain.this).inflate(R.layout.main_dash_top, (ViewGroup) null));
}
}
public class d implements DialogInterface.OnClickListener {
final boolean a;
d(final boolean val$canRead) {
this.a = val$canRead;
}
@Override
public void onClick(DialogInterface dialog, int which) {
if (this.a) {
ActivityMain activityMain = ActivityMain.this;
activityMain.j0(activityMain.t1, true);
}
}
}
public class d0 implements DialogInterface.OnClickListener {
final EditText a;
d0(final EditText val$et) {
this.a = val$et;
}
@Override
public void onClick(DialogInterface dialog, int which) {
String trim = this.a.getText().toString().trim();
e50.O7 = trim;
ActivityMain.this.F0(trim);
}
}
public class d1 implements Runnable {
d1() {
}
private boolean b(String url_str) {
try {
URLConnection openConnection = new URL(url_str).openConnection();
openConnection.connect();
long date = openConnection.getDate();
e50.N5("remote: " + o50.r(Long.valueOf(date)));
if (a(date)) {
com.flyersoft.seekbooks.q.l = Long.valueOf(date);
if (Math.abs(date - System.currentTimeMillis()) < o50.B(2L)) {
ActivityMain.this.m2.sendEmptyMessage(ActivityMain.u0);
return true;
}
}
} catch (Exception e) {
e50.S0(e);
}
return false;
}
boolean a(long t) {
return t > o50.c0(2018, 5, 1) && t < o50.c0(2048, 5, 1);
}
@Override
public void run() {
e50.N5("local: " + o50.r(Long.valueOf(System.currentTimeMillis())));
if (!b("http://www.baidu.com") && !b("http://www.163.com") && b("http://www.qq.com")) {
}
}
}
class d2 extends RecyclerView.ViewHolder {
View a;
public d2(View itemView) {
super(itemView);
this.a = itemView;
itemView.setLayoutParams(new RecyclerView.LayoutParams(-1, -2));
}
}
public class e implements DialogInterface.OnClickListener {
e() {
}
@Override
public void onClick(DialogInterface dialog, int which) {
ActivityMain.this.N1();
}
}
public class e0 implements DialogInterface.OnClickListener {
final Activity a;
final String b;
e0(final Activity val$act, final String val$targetFile) {
this.a = val$act;
this.b = val$targetFile;
}
@Override
public void onClick(DialogInterface dialog, int which) {
o50.Y1(this.a, this.b);
}
}
class e1 extends Thread {
e1() {
}
@Override
public void run() {
try {
e50.N5("start download hot books");
S.suggestFreeBooks = null;
o50.t1(o50.d1(S.HOT_BOOKS_URL), e50.R1 + "/freebooks.zip");
e50.N5("finish download hot books");
com.flyersoft.components.q b = com.flyersoft.components.q.b(e50.R1 + "/freebooks.zip");
Iterator<q.a> it = b.d().iterator();
if (it.hasNext()) {
S.suggestFreeBooks = q50.I(o50.u1(b.g(it.next().h)));
}
} catch (Throwable th) {
e50.T0(th, false);
}
}
}
public class e2 extends RecyclerView.Adapter {
View.OnClickListener a = new a();
View.OnClickListener b = new b();
View.OnClickListener c = new c();
class a implements View.OnClickListener {
a() {
}
@Override
public void onClick(View v) {
S.LinkSite linkSite = (S.LinkSite) v.getTag();
ActivityMain.this.n1(linkSite.categoryUrl, linkSite.userAgent);
}
}
class b implements View.OnClickListener {
b() {
}
@Override
public void onClick(View v) {
S.LinkSite linkSite = (S.LinkSite) v.getTag();
ActivityMain.this.n1(linkSite.rankUrl, linkSite.userAgent);
}
}
class c implements View.OnClickListener {
class a implements View.OnClickListener {
final int a;
final S.FavLink b;
a(final int val$position, final S.FavLink val$link) {
this.a = val$position;
this.b = val$link;
}
@Override
public void onClick(View v) {
S.getFavLinks().add(this.a, this.b);
S.saveFavLinks();
e2.this.notifyDataSetChanged();
}
}
c() {
}
@Override
public void onClick(View v) {
S.FavLink favLink = (S.FavLink) v.getTag();
int favLinkId = S.favLinkId(favLink.url);
S.deleteFavLink(favLink.url);
e2.this.notifyDataSetChanged();
Snackbar action = Snackbar.make(ActivityMain.this.b1, Html.fromHtml("<font color=\"#ffffff\">" + ActivityMain.this.getString(R.string.yishanchu) + favLink.name + "</font>"), 0).setAction(R.string.chexiao, new a(favLinkId, favLink));
TextView textView = (TextView) action.getView().findViewById(R.id.snackbar_text);
if (textView != null) {
textView.setLines(1);
}
action.setActionTextColor(InputDeviceCompat.SOURCE_ANY).show();
}
}
e2() {
}
@Override
public int getItemCount() {
int Q0 = ActivityMain.this.Q0();
return S.getLinkSites() == null ? Q0 : S.getLinkSites().size() + Q0 + S.getFavLinks().size();
}
@Override
public int getItemViewType(int pos) {
return pos == 0 ? 0 : 1;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, @SuppressLint({"RecyclerView"}) int pos) {
f2 f2Var = (f2) holder;
f2Var.a = pos;
int size = S.getLinkSites().size();
if (pos < size) {
S.LinkSite linkSite = S.getLinkSites().get(pos);
f2Var.d.setText(e50.W0(linkSite.name()));
f2Var.d.setTextSize(14.5f);
String str = linkSite.icon;
if (o50.F1(str)) {
f2Var.a0.setImageURI(Uri.parse("asset:///cnweb2/webpage2.png"));
} else {
f2Var.a0.setImageURI(Uri.parse("asset:///cnweb2/" + str));
}
f2Var.d.getLayoutParams().height = e50.k0(64.0f);
f2Var.c.setVisibility(8);
f2Var.e.setVisibility(o50.F1(linkSite.categoryUrl) ? 8 : 0);
f2Var.e.setTag(linkSite);
f2Var.e.setOnClickListener(this.a);
f2Var.f.setVisibility(o50.F1(linkSite.rankUrl) ? 8 : 0);
f2Var.f.setTag(linkSite);
f2Var.f.setOnClickListener(this.b);
f2Var.g.setVisibility((o50.F1(linkSite.categoryUrl) || o50.F1(linkSite.rankUrl)) ? 8 : 0);
return;
}
try {
int Q0 = ActivityMain.this.Q0();
if (Q0 > 0 && pos < size + Q0) {
f2Var.d.setText(ActivityMain.this.o1.get(pos - size).getName());
f2Var.d.setTextSize(14.5f);
f2Var.a0.setImageURI(Uri.parse("asset:///cnweb2/discovery.png"));
f2Var.d.getLayoutParams().height = e50.k0(64.0f);
f2Var.c.setVisibility(8);
f2Var.e.setVisibility(8);
f2Var.f.setVisibility(8);
f2Var.g.setVisibility(8);
} else {
int i = (pos - size) - Q0;
f2Var.d.setText(S.getFavLinks().get(i).name);
f2Var.d.setTextSize(13.0f);
f2Var.a0.setImageURI(Uri.parse("asset:///cnweb2/webpage.png"));
f2Var.d.getLayoutParams().height = e50.k0(44.0f);
f2Var.c.setVisibility(0);
f2Var.e.setVisibility(8);
f2Var.f.setVisibility(8);
f2Var.g.setVisibility(8);
f2Var.c.setTag(S.getFavLinks().get(i));
f2Var.c.setOnClickListener(this.c);
}
} catch (Exception e) {
e50.S0(e);
}
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new f2(LayoutInflater.from(ActivityMain.this).inflate(R.layout.web_discovery_item, (ViewGroup) null), viewType);
}
}
public class f implements DialogInterface.OnClickListener {
final boolean a;
final EditText b;
f(final boolean val$inFav, final EditText val$et) {
this.a = val$inFav;
this.b = val$et;
}
@Override
public void onClick(DialogInterface dialog, int which) {
if (this.a) {
S.deleteFavLink(ActivityMain.this.v1);
ActivityMain.this.u1.setImageResource(R.drawable.ic_menu_star);
ActivityMain activityMain = ActivityMain.this;
o50.p2(activityMain, activityMain.getString(R.string.yiyichushuqian));
return;
}
S.addFavLink(this.b.getText().toString(), ActivityMain.this.v1);
ActivityMain.this.u1.setImageResource(R.drawable.ic_menu_star2);
ActivityMain activityMain2 = ActivityMain.this;
o50.s2(activityMain2, activityMain2.getString(R.string.xinjianshuqian), this.b.getText().toString(), 0);
}
}
public class f0 implements DialogInterface.OnClickListener {
final Activity a;
final String b;
final int c;
f0(final Activity val$act, final String val$filename, final int val$requestCode) {
this.a = val$act;
this.b = val$filename;
this.c = val$requestCode;
}
@Override
public void onClick(DialogInterface dialog, int which) {
ActivityMain.x1(this.a, this.b, this.c);
}
}
public class f1 implements ViewPager.OnPageChangeListener {
f1() {
}
@Override
public void onPageScrollStateChanged(int i) {
}
@Override
public void onPageScrolled(int i, float v, int i1) {
}
@Override
public void onPageSelected(int position) {
e50.E6(position);
ActivityMain.this.s2(position, false);
ActivityMain activityMain = ActivityMain.this;
activityMain.m1 = activityMain.F2.get(position);
if (ActivityMain.this.f2.size() > 0) {
ActivityMain.this.f2.clear();
ActivityMain.this.c2(false);
ActivityMain activityMain2 = ActivityMain.this;
activityMain2.p1(activityMain2.m1);
}
}
}
class f2 extends RecyclerView.ViewHolder implements View.OnClickListener {
int a;
SimpleDraweeView a0;
View b;
View c;
TextView d;
TextView e;
TextView f;
TextView g;
public f2(View v, int viewType) {
super(v);
this.b = v;
this.d = (TextView) v.findViewById(R.id.title);
this.e = (TextView) this.b.findViewById(R.id.category);
this.f = (TextView) this.b.findViewById(R.id.rank);
this.g = (TextView) this.b.findViewById(R.id.split);
this.f.setTypeface(e50.i4("ziti", 0));
this.e.setTypeface(e50.i4("ziti", 0));
this.d.setTextColor(e50.M2());
this.a0 = (SimpleDraweeView) this.b.findViewById(R.id.image);
this.c = this.b.findViewById(R.id.iv);
this.b.findViewById(R.id.padding).setVisibility(viewType != 0 ? 8 : 0);
this.b.findViewById(R.id.padding).setBackgroundColor(com.flyersoft.discuss.z.getToolbarBackColor());
this.b.findViewById(R.id.info).setBackgroundColor(com.flyersoft.discuss.z.getItemBackColor());
this.b.setLayoutParams(new RecyclerView.LayoutParams(-1, -2));
this.b.setOnClickListener(this);
this.a0.getHierarchy().R(py.d(90.0f).y(py.a.BITMAP_ONLY));
}
@Override
public void onClick(View v) {
int i;
int i2;
int i3;
int size = S.getLinkSites().size();
int Q0 = ActivityMain.this.Q0();
if (Q0 > 0 && (i3 = this.a) >= size && i3 < size + Q0) {
TS.openDiscoverySource(ActivityMain.this, ActivityMain.this.o1.get(i3 - size));
return;
}
S.LinkSite linkSite = this.a < size ? S.getLinkSites().get(this.a) : null;
String str = linkSite != null ? linkSite.url : S.getFavLinks().get((this.a - size) - Q0).url;
if (str == null) {
return;
}
String str2 = linkSite != null ? linkSite.userAgent : null;
if (str2 == null) {
str2 = S.getLinkUserAgent(str);
}
if (linkSite != null && !o50.F1(linkSite.specialTip) && (i = linkSite.tipShowedTimes) < 2 && (i2 = e50.n2) < 24) {
e50.n2 = i2 + 1;
linkSite.tipShowedTimes = i + 1;
o50.q2(ActivityMain.this, linkSite.specialTip, 1);
}
if (linkSite != null && linkSite.primary()) {
e50.l6 = linkSite.siteTag;
}
ActivityMain.this.n1(str, str2);
}
}
public class g implements View.OnClickListener {
final EditText a;
g(final EditText val$edit) {
this.a = val$edit;
}
@Override
public void onClick(View v) {
com.flyersoft.seekbooks.c.i(ActivityMain.this, this.a, null);
}
}
public class g0 implements BottomNavigationView.OnNavigationItemSelectedListener {
g0() {
}
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
ActivityMain.this.K0.setCurrentItem(menuItem.getOrder());
return true;
}
}
public class g1 implements TabLayout.OnTabSelectedListener {
g1() {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
if (System.currentTimeMillis() - ActivityMain.I0 < 1000) {
return;
}
ActivityMain.I0 = System.currentTimeMillis();
ActivityMain.this.m1.smoothScrollToPosition(0);
}
@Override
public void onTabSelected(TabLayout.Tab tab) {
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
}
public class g2 {
String a;
int b;
int c;
int d;
g2() {
}
}
public class h implements DialogInterface.OnClickListener {
final EditText a;
final S.BookSite b;
final String c;
final String d;
h(final EditText val$edit, final S.BookSite val$site, final String val$id, final String val$url) {
this.a = val$edit;
this.b = val$site;
this.c = val$id;
this.d = val$url;
}
@Override
public void onClick(DialogInterface dialog, int which) {
String trim = this.a.getText().toString().trim();
if (trim.length() > 0) {
ActivityMain.this.C1(this.b, this.c, this.d, trim);
}
}
}
public class h0 implements DialogInterface.OnDismissListener {
h0() {
}
@Override
public void onDismiss(DialogInterface dialog) {
ActivityMain activityMain = ActivityMain.this;
activityMain.l2 = null;
DownloadTaskBrowser.CacheWebView cacheWebView = activityMain.x1;
if (cacheWebView != null) {
cacheWebView.stopLoading();
}
DownloadTaskBrowser.CacheWebView cacheWebView2 = ActivityMain.this.y1;
if (cacheWebView2 != null) {
cacheWebView2.stopLoading();
}
}
}
public class h1 implements PullRefreshLayout.OnRefreshListener {
h1() {
}
@Override
public void onRefresh() {
ActivityMain.this.F1();
}
}
public interface h2 {
void afterDelete(boolean all);
}
public class i implements Runnable {
final S.BookSite a;
final String b;
final String c;
final String d;
i(final S.BookSite val$site, final String val$id, final String val$webUrl, final String val$toShelf) {
this.a = val$site;
this.b = val$id;
this.c = val$webUrl;
this.d = val$toShelf;
}
@Override
public void run() {
ActivityMain.this.D1(this.a, this.b, this.c, this.d);
}
}
class i0 extends Handler {
class a implements DialogInterface.OnClickListener {
a() {
}
@Override
public void onClick(DialogInterface dialog, int which) {
o50.b2(ActivityMain.this, e50.o1());
int i = S.forceUpdateApp;
if (i > 1) {
ActivityMain.this.U1 = null;
}
if (i > 3) {
ActivityMain.this.finish();
}
}
}
class b implements DialogInterface.OnClickListener {
b() {
}
@Override
public void onClick(DialogInterface dialog, int which) {
try {
ActivityMain.this.startActivityForResult(new Intent("android.intent.action.VIEW", Uri.parse("market://details?id=" + ActivityMain.this.getPackageName())), ActivityMain.D0);
} catch (Exception e) {
e50.S0(e);
}
int i = S.forceUpdateApp;
if (i > 1) {
ActivityMain.this.U1 = null;
}
if (i > 3) {
ActivityMain.this.finish();
}
}
}
class c implements DialogInterface.OnClickListener {
c() {
}
@Override
public void onClick(DialogInterface dialog, int which) {
if (S.forceUpdateApp > 1) {
ActivityMain.this.U1 = null;
}
}
}
i0(Looper looper) {
super(looper);
}
@Override
public void handleMessage(Message msg) {
if (ActivityMain.this.isFinishing()) {
return;
}
if (msg.what == 4000) {
ActivityMain activityMain = ActivityMain.this;
if (activityMain.A2 != null) {
activityMain.i1(true);
}
}
if (msg.what == 3046) {
ActivityMain.this.R1(2);
}
if (msg.what == 3040) {
S.startHotBookAct(ActivityMain.this, ActivityMain.A0);
}
if (msg.what == 1022 && com.flyersoft.seekbooks.q.d()) {
ActivityMain.this.T0();
ActivityMain.this.e1();
ActivityMain.this.m2.sendEmptyMessage(ActivityMain.v0);
}
if (msg.what == 10222) {
com.flyersoft.seekbooks.q.g();
}
if (msg.what == 1023) {
ActivityMain.this.m2.removeMessages(ActivityMain.v0);
ShelfImageView shelfImageView = ActivityMain.this.I1;
if (shelfImageView != null && shelfImageView.getTag() == null) {
ActivityMain.this.showUserInfo();
}
}
if (msg.what == 10232) {
ActivityMain.this.m2.removeMessages(ActivityMain.w0);
ActivityMain activityMain2 = ActivityMain.this;
if (activityMain2.I1 != null) {
activityMain2.showUserInfo();
}
}
if (msg.what == 1005) {
ActivityMain.this.u0();
}
if (msg.what == 2100) {
WebBookDetailAct.doOnFinish((DownloadTask.Result) msg.obj);
}
if (msg.what == 2101) {
WebBookDetailAct.doOnError((DownloadTask.Result) msg.obj);
}
if (msg.what == 2102) {
ActivityMain.this.clearCachedWebViews();
}
if (msg.what == 1010) {
ActivityMain.this.A0((DownloadTask.Result) msg.obj);
}
if (msg.what == 1011) {
ActivityMain.this.z0((DownloadTask.Result) msg.obj);
}
if (msg.what == 1012) {
ActivityMain.v0(ActivityMain.this, msg.obj);
}
if (msg.what == 1013) {
if (!S.inited) {
ActivityMain.this.m2.sendEmptyMessageDelayed(1013, 50L);
} else {
ActivityMain activityMain3 = ActivityMain.this;
if (!activityMain3.n2) {
activityMain3.n2 = true;
activityMain3.u2(false);
ActivityMain.this.l2();
}
}
}
if (msg.what == 1014) {
ActivityMain activityMain4 = ActivityMain.this;
activityMain4.p1(activityMain4.m1);
}
if (msg.what == 1015) {
if (S.inited) {
ActivityMain.this.r0();
} else {
ActivityMain.this.m2.sendEmptyMessageDelayed(1015, 50L);
}
}
if (msg.what == 10171) {
BrowserAct.downloadBook2();
}
if (msg.what == 1018) {
ActivityMain.this.I1();
}
if (msg.what == 1019 && o50.D1(ActivityTxt.a)) {
WB.searchClipboardBook(ActivityMain.this);
}
if (msg.what == 1020) {
ActivityMain.this.x0((String) msg.obj, null, null, true, 0, false, null);
}
if (msg.what == 1021) {
if (((Boolean) msg.obj).booleanValue()) {
for (int i = 0; i < ActivityMain.this.F2.size(); i++) {
SparseArray<RecyclerView> sparseArray = ActivityMain.this.F2;
RecyclerView recyclerView = sparseArray.get(sparseArray.keyAt(i));
if (recyclerView != null && recyclerView.getTag() != null && recyclerView.getAdapter() != null) {
((l2) recyclerView.getAdapter()).c(true);
}
}
} else {
RecyclerView recyclerView2 = ActivityMain.this.m1;
if (recyclerView2 != null) {
((l2) recyclerView2.getAdapter()).c(true);
}
}
}
if (msg.what == 45003) {
com.flyersoft.seekbooks.q.C(ActivityMain.this, msg.arg1, msg.arg2);
}
int i2 = msg.what;
}
}
public class i1 implements Runnable {
class a implements Runnable {
a() {
}
@Override
public void run() {
ActivityMain.this.l2();
}
}
i1() {
}
@Override
public void run() {
for (int i = 0; i < ActivityMain.this.E2.size(); i++) {
SparseArray<PullRefreshLayout> sparseArray = ActivityMain.this.E2;
sparseArray.get(sparseArray.keyAt(i)).setRefreshing(false);
}
ActivityMain.this.m2.postDelayed(new a(), 300L);
}
}
public interface i2 {
void afterSelect(String siteName, String url);
}
public class j implements DownloadTask.Callback {
final S.BookSite a;
final String b;
final String c;
final String d;
j(final S.BookSite val$site, final String val$bookId, final String val$webUrl, final String val$toShelf) {
this.a = val$site;
this.b = val$bookId;
this.c = val$webUrl;
this.d = val$toShelf;
}
@Override
public void onCancel() {
}
@Override
public void onError(DownloadTask.Result result, String err) {
ActivityMain.this.Z1(err);
}
@Override
public void onFinish(DownloadTask.Result result) {
ActivityMain activityMain = ActivityMain.this;
if (activityMain.l2 == null) {
return;
}
S.BookSite bookSite = this.a;
bookSite.last_url = result.final_url;
activityMain.A1 = S.getBookInfo(result.html, bookSite, bookSite.bookTags, false, true);
S.WebBook webBook = ActivityMain.this.A1;
webBook.url = result.final_url;
if (S.isBookOk(this.a, webBook, false)) {
S.BookSite bookSite2 = this.a;
if (bookSite2.chapterPageUrl.equals(bookSite2.bookPageUrl)) {
ActivityMain.this.B1 = S.getChapterList(result.html, this.a);
if (o50.G1(ActivityMain.this.B1)) {
ActivityMain.this.Z1(null);
return;
}
}
ActivityMain.this.B0(this.a, this.b, this.c, this.d);
return;
}
ActivityMain activityMain2 = ActivityMain.this;
if (activityMain2.C1) {
return;
}
activityMain2.c1(activityMain2.x1, true);
if (DownloadTaskBrowser.reloadCacheWB(result.cacheWB, result.url, ActivityMain.this.z1, 1000)) {
return;
}
ActivityMain.this.Z1(null);
}
@Override
public void onProgress(DownloadTask.Result result, int progress, int total) {
}
}
public class j0 implements DialogInterface.OnClickListener {
final List a;
j0(final List val$lackedPermission) {
this.a = val$lackedPermission;
}
@Override
public void onClick(DialogInterface dialog, int which) {
String[] strArr = new String[this.a.size()];
this.a.toArray(strArr);
if (Build.VERSION.SDK_INT >= 23) {
ActivityMain.this.requestPermissions(strArr, 200);
}
}
}
public class j1 implements Runnable {
class a implements Runnable {
a() {
}
@Override
public void run() {
ActivityMain.this.l2();
}
}
j1() {
}
@Override
public void run() {
ActivityMain.this.X0().setRefreshing(false);
ActivityMain.this.m2.postDelayed(new a(), 300L);
}
}
public class j2 extends RecyclerView.Adapter {
j2() {
}
@Override
public int getItemCount() {
return e50.H2().size() + 1;
}
@Override
public int getItemViewType(int position) {
return position;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
k2 k2Var = (k2) holder;
k2Var.a = position;
if (position < e50.H2().size()) {
((ViewGroup.MarginLayoutParams) ((RecyclerView.LayoutParams) k2Var.b.getLayoutParams())).leftMargin = position == 0 ? e50.k0(14.0f) : 0;
String str = e50.H2().get(position);
g50.e I = g50.I(str);
k2Var.d.setText(e50.W0(ActivityMain.this.P0(str, I)));
ActivityMain.this.J0(k2Var.f, str, I, true, false, k2Var.e);
k2Var.d.setTag(str);
k2Var.d.setOnClickListener(ActivityMain.this.x2);
k2Var.c.setTag(str);
k2Var.c.setOnClickListener(ActivityMain.this.x2);
k2Var.c.setVisibility(0);
return;
}
k2Var.d.setText("");
k2Var.e.setVisibility(8);
k2Var.f.setImageResource(R.drawable.add_book);
k2Var.d.setOnClickListener(null);
k2Var.c.setVisibility(8);
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new k2(LayoutInflater.from(ActivityMain.this).inflate(R.layout.web_dash_book, (ViewGroup) null));
}
}
class k implements View.OnClickListener {
k() {
}
@Override
public void onClick(View v) {
ARouter.getInstance().build("/app/search_activity").navigation();
}
}
class k0 implements View.OnClickListener {
k0() {
}
@Override
public void onClick(View v) {
String str = (String) v.getTag();
if ((ActivityMain.this.u2.containsKey(str) ? ActivityMain.this.u2.get(str).intValue() : 0) != 2 && !ActivityMain.this.v2.containsKey(str)) {
if (!S.inited || ActivityMain.this.m1()) {
return;
}
ActivityMain.this.t2 = true;
((View) v.getParent()).findViewById(R.id.refresh).setVisibility(8);
((View) v.getParent()).findViewById(R.id.progress).setVisibility(0);
ActivityMain.this.x0(str, null, null, true, 0, false, null);
return;
}
ActivityMain.this.H1(str);
if (e50.E7) {
if (!e50.D7) {
((l2) ActivityMain.this.m1.getAdapter()).c(true);
return;
} else {
((l2) ActivityMain.this.m1.getAdapter()).d(true);
return;
}
}
if (!ActivityMain.this.m1()) {
((ImageView) v).setImageResource(R.drawable.refresh);
} else {
v.setVisibility(8);
}
}
}
public class k1 extends RecyclerView.ItemDecoration {
k1() {
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
int childAdapterPosition = parent.getChildAdapterPosition(view);
if (ActivityMain.this.m1()) {
float f = 20.0f;
if (childAdapterPosition < ActivityMain.this.W1) {
if (e50.o8) {
f = 40.0f;
}
} else if (!e50.o8) {
f = 10.0f;
}
outRect.top = e50.k0(f);
return;
}
outRect.top = childAdapterPosition == 0 ? e50.k0(6.0f) : 0;
}
}
class k2 extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
int a;
View b;
View c;
TextView d;
TextView e;
ShelfImageView f;
public k2(View itemView) {
super(itemView);
this.b = itemView;
TextView textView = (TextView) itemView.findViewById(R.id.title);
this.d = textView;
textView.setTextColor(e50.M2());
if (e50.o8) {
this.d.setTextSize(12.0f);
}
this.c = this.b.findViewById(R.id.overflow1);
this.e = (TextView) this.b.findViewById(R.id.nameTv);
this.f = (ShelfImageView) this.b.findViewById(R.id.cover);
ActivityMain.this.P1(this.b.findViewById(R.id.cardView), e50.k0(e50.o8 ? 77.0f : 56.0f));
this.d.setTextSize(e50.o8 ? 13.0f : 11.0f);
this.e.setTextSize(e50.o8 ? 11.0f : 9.0f);
((ViewGroup.MarginLayoutParams) this.e.getLayoutParams()).topMargin = !e50.o8 ? 0 : e50.k0(12.0f);
this.b.setLayoutParams(new RecyclerView.LayoutParams(e50.k0(e50.o8 ? 136.0f : 96.0f), -2));
this.b.setOnClickListener(this);
this.b.setOnLongClickListener(this);
}
@Override
public void onClick(View v) {
if (this.a >= e50.H2().size()) {
ActivityMain.this.y1();
} else if (ActivityMain.this.z2(e50.H2().get(this.a))) {
ActivityMain.b0 = v.findViewById(R.id.cover);
ActivityMain.v1(ActivityMain.this, e50.H2().get(this.a));
}
}
@Override
public boolean onLongClick(View v) {
if (this.a >= e50.H2().size()) {
return false;
}
ActivityMain.this.x2.onClick(this.d);
return true;
}
}
public class l implements DownloadTask.Callback {
final S.BookSite a;
final String b;
final String c;
final String d;
l(final S.BookSite val$site, final String val$bookId, final String val$webUrl, final String val$toShelf) {
this.a = val$site;
this.b = val$bookId;
this.c = val$webUrl;
this.d = val$toShelf;
}
@Override
public void onCancel() {
}
@Override
public void onError(DownloadTask.Result result, String err) {
ActivityMain.this.Z1(err);
}
@Override
public void onFinish(DownloadTask.Result result) {
ActivityMain activityMain = ActivityMain.this;
if (activityMain.l2 == null) {
return;
}
S.BookSite bookSite = this.a;
bookSite.last_url = result.final_url;
bookSite.firstExecute = false;
activityMain.B1 = S.getChapterList(result.html, bookSite);
if (ActivityMain.this.B1.size() != 0) {
ActivityMain.this.B0(this.a, this.b, this.c, this.d);
return;
}
ActivityMain activityMain2 = ActivityMain.this;
if (activityMain2.C1) {
return;
}
activityMain2.c1(activityMain2.y1, true);
if (!DownloadTaskBrowser.reloadCacheWB(result.cacheWB, result.url, ActivityMain.this.z1, TTAdConstant.STYLE_SIZE_RADIO_3_2)) {
ActivityMain.this.Z1(null);
} else {
ActivityMain.this.B1 = null;
}
}
@Override
public void onProgress(DownloadTask.Result result, int progress, int total) {
}
}
public class l0 implements i2 {
final String a;
l0(final String val$filename) {
this.a = val$filename;
}
@Override
public void afterSelect(String siteTag, String url) {
ActivityMain.this.x0(this.a, siteTag, url, true, 0, true, null);
}
}
public class l1 extends RecyclerView.OnScrollListener {
final RecyclerView a;
l1(final RecyclerView val$rv) {
this.a = val$rv;
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
try {
e50.w7 = ActivityMain.this.m1() ? ((GridLayoutManager) this.a.getLayoutManager()).findFirstVisibleItemPosition() : ((LinearLayoutManager) this.a.getLayoutManager()).findFirstVisibleItemPosition();
} catch (Exception e) {
e50.S0(e);
}
}
}
public class l2 extends RecyclerView.Adapter {
SharedPreferences a;
ArrayList<g50.e> b;
int c;
String d;
public ArrayList<n2> e = new ArrayList<>();
public class a implements Comparator<g50.e> {
a() {
}
@Override
public int compare(g50.e bi1, g50.e bi2) {
int intValue = ActivityMain.this.u2.containsKey(bi1.b) ? ActivityMain.this.u2.get(bi1.b).intValue() : 0;
int intValue2 = ActivityMain.this.u2.containsKey(bi2.b) ? ActivityMain.this.u2.get(bi2.b).intValue() : 0;
if (intValue == 2 && intValue2 != 2) {
return -1;
}
if (intValue != 2 && intValue2 == 2) {
return 1;
}
if (intValue == 2 && intValue2 == 2) {
return 0;
}
boolean containsKey = ActivityMain.this.v2.containsKey(bi1.b);
boolean containsKey2 = ActivityMain.this.v2.containsKey(bi2.b);
if (!containsKey || containsKey2) {
return (containsKey || !containsKey2) ? 0 : 1;
}
return -1;
}
}
public l2(int shelfIndex) {
this.c = shelfIndex;
this.d = e50.A3().get(shelfIndex);
d(false);
boolean z = e50.o8;
ActivityMain.this.Y1 = 60;
if (e50.M2) {
ActivityMain.this.Y1 = 60 + 14;
}
this.a = ActivityMain.this.getSharedPreferences(e50.r0, 0);
}
public void c(boolean notifyChanged) {
ActivityMain activityMain;
HashMap<String, Integer> hashMap;
if (e50.E7 && (hashMap = (activityMain = ActivityMain.this).u2) != null && activityMain.v2 != null && (!hashMap.isEmpty() || !ActivityMain.this.v2.isEmpty())) {
try {
Collections.sort(this.b, new a());
} catch (Exception e) {
e50.S0(e);
}
}
if (notifyChanged) {
notifyDataSetChanged();
}
}
public void b(int position, n2 h) {
if (ActivityMain.this.W1 != 3 || h.d.findViewById(R.id.infoLay) == null) {
return;
}
ActivityMain activityMain = ActivityMain.this;
int i = activityMain.X1;
int i2 = (activityMain.Y1 * i) / 100;
int k0 = (((i - i2) * 3) / 4) - e50.k0(2.0f);
int i3 = i2 / 10;
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) h.d.findViewById(R.id.infoLay).getLayoutParams();
int i4 = ActivityMain.this.W1;
if (position % i4 == 0) {
marginLayoutParams.leftMargin = k0;
marginLayoutParams.rightMargin = i3;
} else if (position % i4 == i4 - 1) {
marginLayoutParams.leftMargin = i3;
marginLayoutParams.rightMargin = k0;
} else {
marginLayoutParams.rightMargin = i3;
marginLayoutParams.leftMargin = i3;
}
}
public void d(boolean notifyChanged) {
this.b = g50.N("favorite", e50.A3().get(this.c), null, false);
c(false);
if (notifyChanged) {
notifyDataSetChanged();
}
}
@Override
public int getItemCount() {
if (this.b.size() == 0 && ActivityMain.this.m1()) {
return 1;
}
return this.b.size();
}
@Override
public int getItemViewType(int pos) {
return 0;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
boolean z;
int i;
String str;
String str2;
String W0;
String str3;
String str4;
n2 n2Var = (n2) holder;
n2Var.a = position;
if (!this.e.contains(n2Var)) {
this.e.add(n2Var);
}
if (position < this.b.size()) {
g50.e eVar = this.b.get(position);
n2Var.b = eVar;
String str5 = eVar.b;
String W02 = e50.W0(ActivityMain.this.P0(str5, eVar));
boolean D5 = e50.D5(str5);
ActivityMain.this.J0(n2Var.c0, str5, eVar, true, false, n2Var.b0);
n2Var.d.setBackgroundColor((ActivityMain.this.U1() && ActivityMain.this.f2.contains(eVar)) ? 855670105 : com.flyersoft.discuss.z.getItemBackColor());
n2Var.e.setTag(eVar);
n2Var.e.setOnClickListener(ActivityMain.this.i2);
n2Var.d0.setTag(str5);
n2Var.d0.setOnClickListener(ActivityMain.this.q2);
if (D5) {
i = ActivityMain.this.u2.containsKey(str5) ? ActivityMain.this.u2.get(str5).intValue() : 0;
if (ActivityMain.this.v2.containsKey(str5)) {
str = "新增" + ActivityMain.this.v2.get(str5) + "章";
if (i == 0) {
i = 3;
}
} else {
str = null;
}
n2Var.f.setVisibility(i == 1 ? 0 : 8);
n2Var.d0.setVisibility(i != 1 ? 0 : 8);
n2Var.d0.setImageResource(i == 3 ? R.drawable.refresh_has2 : i == 2 ? R.drawable.refresh_has : R.drawable.refresh);
if (i == 0) {
ActivityMain activityMain = ActivityMain.this;
if (activityMain.s2 || activityMain.m1()) {
n2Var.d0.setVisibility(8);
}
}
z = e50.E7 && i > 1;
} else {
n2Var.f.setVisibility(8);
n2Var.d0.setVisibility(8);
z = false;
i = 0;
str = null;
}
TextView textView = n2Var.g;
if (textView == null) {
return;
}
textView.getPaint().setFakeBoldText(z);
if (ActivityMain.this.m1()) {
n2Var.g.setVisibility(0);
n2Var.e.setVisibility(0);
n2Var.g.setText(W02);
n2Var.g.setTag(eVar);
n2Var.g.setOnClickListener(ActivityMain.this.i2);
b(position, n2Var);
return;
}
TextView textView2 = n2Var.a0;
if (textView2 == null) {
return;
}
textView2.getPaint().setFakeBoldText(z);
str2 = "";
if (D5) {
g2 S0 = ActivityMain.this.S0(str5);
n2Var.a0.setText(e50.W0(S0.a));
if (i == 0 && e50.D2().contains(str5)) {
str2 = "<small><font color=\"#888888\"> (已完本)</font></small>";
} else if (i > 0 || S0.b >= 0) {
if (S0.d > 0) {
str3 = "未读" + S0.d + "章";
} else {
str3 = null;
}
if (str3 != null || str != null) {
StringBuilder sb = new StringBuilder();
sb.append("<small><font color=\"#888888\"> (");
if (str3 != null) {
StringBuilder sb2 = new StringBuilder();
sb2.append(str3);
sb2.append(str != null ? ", " : "");
str4 = sb2.toString();
} else {
str4 = "";
}
sb.append(str4);
if (str == null) {
str = "";
}
sb.append(str);
sb.append(")</font></small>");
str2 = sb.toString();
}
}
n2Var.g.setText(Html.fromHtml(W02 + str2));
return;
}
String str6 = "0%";
if (this.a.contains(str5.toLowerCase())) {
String string = this.a.getString(str5.toLowerCase(), "");
int z2 = string.indexOf(":") != -1 ? o50.z2(string.substring(string.indexOf(":") + 1)) : 0;
if (z2 >= 0) {
str6 = z2 + "%";
}
}
TextView textView3 = n2Var.a0;
if (str5.startsWith("#")) {
W0 = eVar.c;
} else {
W0 = e50.W0("阅读进度: " + str6);
}
textView3.setText(W0);
TextView textView4 = n2Var.g;
StringBuilder sb3 = new StringBuilder();
sb3.append(W02);
sb3.append(str5.startsWith("#") ? "" : "<small><font color=\"#888888\"> (本地书籍)</font></small>");
textView4.setText(Html.fromHtml(sb3.toString()));
return;
}
n2Var.b = null;
n2Var.c0.setImageResource(R.drawable.add_book);
n2Var.d.setBackgroundColor(e50.m1(com.flyersoft.discuss.z.getItemBackColor(), 100));
if (ActivityMain.this.m1()) {
n2Var.b0.setVisibility(8);
n2Var.g.setVisibility(4);
n2Var.e.setVisibility(8);
b(position, n2Var);
}
n2Var.f.setVisibility(8);
n2Var.d0.setVisibility(8);
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new n2(LayoutInflater.from(ActivityMain.this).inflate(ActivityMain.this.m1() ? R.layout.shelf_grid_item : R.layout.web_follow_item, (ViewGroup) null), viewType, this.b);
}
}
public class m implements WB.AfterAdd {
final String a;
class a implements DialogInterface.OnClickListener {
a() {
}
@Override
public void onClick(DialogInterface dialog, int which) {
String Q = q50.Q(ActivityMain.this.A1);
int i = 0;
while (true) {
if (i >= ActivityMain.this.A1.chapters.size()) {
break;
}
ActivityMain activityMain = ActivityMain.this;
if (activityMain.K1(activityMain.A1.chapters.get(i).url, m.this.a)) {
ActivityMain.this.getSharedPreferences(e50.r0, 0).edit().putString(Q.toLowerCase(), i + "@0#0:0%").apply();
break;
}
i++;
}
ActivityMain.v1(ActivityMain.this, Q);
}
}
m(final String val$webUrl) {
this.a = val$webUrl;
}
@Override
public void OnAdded() {
q50.X(ActivityMain.this.A1, false);
new AlertDialog.Builder(ActivityMain.this).setTitle("已放入" + WB.getLastAddShelf()).setMessage("\n开始阅读《" + ActivityMain.this.A1.name + "》?").setPositiveButton(R.string.ok, new a()).setNegativeButton(R.string.cancel, (DialogInterface.OnClickListener) null).show();
}
}
public class m0 implements DialogInterface.OnClickListener {
final Activity a;
final String b;
m0(final Activity val$act, final String val$filename) {
this.a = val$act;
this.b = val$filename;
}
@Override
public void onClick(DialogInterface dialog, int which) {
WB.doWebSearchWithSelect(this.a, o50.N0(this.b));
}
}
public class m1 implements View.OnTouchListener {
float a;
float b;
m1() {
}
@Override
public boolean onTouch(View v, MotionEvent event) {
ActivityMain activityMain = ActivityMain.this;
if (activityMain.h2) {
activityMain.h2 = false;
this.a = event.getX();
this.b = event.getY();
return false;
}
if (activityMain.e2 && event.getAction() == 2 && (Math.abs(this.a - event.getX()) > e50.k0(60.0f) || Math.abs(this.b - event.getY()) > e50.k0(80.0f))) {
ActivityMain.this.c2(false);
com.flyersoft.components.m mVar = ActivityMain.this.g2;
if (mVar != null) {
mVar.k();
}
}
return false;
}
}
public class m2 extends ItemTouchHelper.Callback {
m2() {
}
@Override
public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
super.clearView(recyclerView, viewHolder);
ActivityMain.this.e2 = false;
e50.N5("clearView: from " + ActivityMain.this.Z1 + " to " + ActivityMain.this.a2 + ", size:" + ActivityMain.this.W0().size());
if (viewHolder == null) {
return;
}
ActivityMain.this.Q1(((n2) viewHolder).d, false);
ActivityMain activityMain = ActivityMain.this;
int i = activityMain.Z1;
int i2 = activityMain.a2;
if (i != i2 && i >= 0 && i2 >= 0 && i < activityMain.W0().size() && i2 < ActivityMain.this.W0().size()) {
boolean z = i2 == 0;
g50.e eVar = (g50.e) ActivityMain.this.W0().get(i2);
g50.e eVar2 = (g50.e) ActivityMain.this.W0().get(z ? 1 : i2 - 1);
g50.e eVar3 = i2 == ActivityMain.this.W0().size() - 1 ? null : (g50.e) ActivityMain.this.W0().get(i2 + 1);
String str = eVar2.n.length() > eVar2.a.length() ? eVar2.n : eVar2.a;
if (z) {
StringBuilder sb = new StringBuilder();
sb.append(str.length() < 2 ? " " : str.substring(0, str.length() - 1));
sb.append(g50.m);
sb.append(eVar.a);
String sb2 = sb.toString();
eVar.n = sb2;
eVar.a = sb2;
} else {
String str2 = str + g50.m + eVar.a;
eVar.n = str2;
eVar.a = str2;
if (eVar3 != null && eVar3.n.indexOf(g50.m) > 0) {
String str3 = eVar.n + g50.m + eVar3.a;
eVar3.n = str3;
eVar3.a = str3;
g50.o0(eVar3);
eVar3.a = g50.z0(eVar3.a);
}
}
g50.o0(eVar);
eVar.a = g50.z0(eVar.a);
}
ActivityMain activityMain2 = ActivityMain.this;
if (activityMain2.d2 || activityMain2.U1()) {
ActivityMain.this.m2.sendEmptyMessage(1014);
ActivityMain.this.d2 = false;
}
}
@Override
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
if (viewHolder.getAdapterPosition() == ActivityMain.this.W0().size()) {
return 0;
}
return ItemTouchHelper.Callback.makeMovementFlags(15, 0);
}
@Override
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder toHolder) {
int adapterPosition = viewHolder.getAdapterPosition();
int adapterPosition2 = toHolder.getAdapterPosition();
if (adapterPosition2 >= ActivityMain.this.W0().size()) {
adapterPosition2 = ActivityMain.this.W0().size() - 1;
}
ActivityMain.this.a2 = adapterPosition2;
if (adapterPosition == adapterPosition2) {
return false;
}
if (adapterPosition < adapterPosition2) {
int i = adapterPosition;
while (i < adapterPosition2) {
int i2 = i + 1;
Collections.swap(ActivityMain.this.W0(), i, i2);
i = i2;
}
} else {
for (int i3 = adapterPosition; i3 > adapterPosition2; i3--) {
Collections.swap(ActivityMain.this.W0(), i3, i3 - 1);
}
}
ActivityMain.this.m1.getAdapter().notifyItemMoved(adapterPosition, adapterPosition2);
ActivityMain.this.d2 = true;
return true;
}
@Override
public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
super.onSelectedChanged(viewHolder, actionState);
ActivityMain activityMain = ActivityMain.this;
activityMain.e2 = false;
activityMain.b2 = SystemClock.elapsedRealtime();
if (viewHolder != null) {
if (actionState != 2) {
ActivityMain.this.Q1(((n2) viewHolder).d, false);
ActivityMain.this.c2(false);
} else {
ActivityMain activityMain2 = ActivityMain.this;
activityMain2.e2 = true;
int adapterPosition = viewHolder.getAdapterPosition();
activityMain2.Z1 = adapterPosition;
activityMain2.a2 = adapterPosition;
ActivityMain.this.Q1(((n2) viewHolder).d, true);
ActivityMain activityMain3 = ActivityMain.this;
activityMain3.f2.add((g50.e) activityMain3.W0().get(ActivityMain.this.Z1));
ActivityMain.this.c2(true);
ActivityMain.this.h2 = true;
}
}
e50.N5("onSelectedChanged: " + ActivityMain.this.a2);
}
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
}
}
public class n implements CompoundButton.OnCheckedChangeListener {
n() {
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
ActivityMain activityMain = ActivityMain.this;
activityMain.L2 = activityMain;
if (isChecked) {
WebService.Companion companion = WebService.Companion;
if (companion.isRun()) {
return;
}
ActivityMain activityMain2 = ActivityMain.this;
companion.start(activityMain2, activityMain2);
return;
}
WebService.Companion companion2 = WebService.Companion;
if (companion2.isRun()) {
companion2.stop(ActivityMain.this);
}
}
}
public class n0 implements DialogInterface.OnClickListener {
final Activity a;
final String b;
n0(final Activity val$act, final String val$filename) {
this.a = val$act;
this.b = val$filename;
}
@Override
public void onClick(DialogInterface dialog, int which) {
WB.doWebSearchWithSelect(this.a, o50.N0(this.b));
}
}
public class n1 implements ViewPager.OnPageChangeListener {
n1() {
}
@Override
public void onPageScrollStateChanged(int state) {
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
ViewGroup viewGroup;
ViewGroup viewGroup2;
ZKAD.postMainPage(position);
int i = e50.l2;
if (i != position) {
ActivityMain.this.x2(position, false);
} else if (i == 0 && e50.n0()) {
ActivityMain.this.x2(position, true);
}
e50.t4(ActivityMain.this);
ActivityMain.this.e2(e50.l2 != 0);
ActivityMain activityMain = ActivityMain.this;
activityMain.m2(e50.l2 == 1 && (viewGroup2 = activityMain.r1) != null && viewGroup2.getVisibility() == 0);
if (position == 1 && (viewGroup = ActivityMain.this.r1) != null && viewGroup.getVisibility() == 0) {
ActivityMain.this.e1.setExpanded(false, true);
}
ActivityMain.this.l2();
}
}
public class n2 extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
int a;
TextView a0;
g50.e b;
TextView b0;
ArrayList<g50.e> c;
ShelfImageView c0;
View d;
ImageView d0;
View e;
h2 e0;
View f;
TextView g;
class a implements h2 {
a() {
}
@Override
public void afterDelete(boolean all) {
((l2) ActivityMain.this.m1.getAdapter()).d(true);
}
}
public n2(View itemView, int viewType, ArrayList<g50.e> shelfBooks) {
super(itemView);
this.e0 = new a();
this.c = shelfBooks;
View findViewById = ActivityMain.this.m1() ? itemView.findViewById(R.id.infoLay) : itemView;
this.d = findViewById;
this.e = findViewById.findViewById(R.id.menu);
this.f = this.d.findViewById(R.id.progress);
this.d0 = (ImageView) this.d.findViewById(R.id.refresh);
TextView textView = (TextView) this.d.findViewById(R.id.title);
this.g = textView;
textView.setTextColor(e50.M2());
this.b0 = (TextView) this.d.findViewById(R.id.nameTv);
this.c0 = (ShelfImageView) this.d.findViewById(R.id.cover);
CardView cardView = (CardView) this.d.findViewById(R.id.cardView);
this.d.setOnClickListener(this);
if (ActivityMain.this.m1()) {
ActivityMain.this.P1(cardView, (ActivityMain.this.X1 * ActivityMain.this.Y1) / 100);
this.g.setOnLongClickListener(this);
this.g.setTextSize(e50.o8 ? 13.0f : 11.0f);
this.b0.setTextSize(e50.o8 ? 11.0f : 9.0f);
itemView.setLayoutParams(new RecyclerView.LayoutParams(ActivityMain.this.X1, -2));
((ViewGroup.MarginLayoutParams) this.b0.getLayoutParams()).topMargin = !e50.o8 ? 0 : e50.k0(12.0f);
if (e50.M2) {
TextView textView2 = this.b0;
textView2.setPadding(textView2.getPaddingLeft() + e50.k0(6.0f), this.b0.getPaddingTop(), this.b0.getPaddingRight() + e50.k0(6.0f), this.b0.getPaddingBottom());
this.c0.e = true;
cardView.setCardBackgroundColor(0);
cardView.setPadding(0, 0, 0, 0);
if (Build.VERSION.SDK_INT >= 21) {
cardView.setElevation(0.0f);
}
cardView.setCardElevation(0.0f);
cardView.setRadius(0.0f);
((ViewGroup.MarginLayoutParams) this.e.getLayoutParams()).bottomMargin = e50.k0(10.0f);
((ViewGroup.MarginLayoutParams) this.e.getLayoutParams()).rightMargin = e50.k0(10.0f);
return;
}
return;
}
this.a0 = (TextView) this.d.findViewById(R.id.chapter);
this.d.setBackgroundColor(e50.K2());
int k0 = e50.k0(e50.o8 ? 56.0f : 42.0f);
ActivityMain.this.P1(cardView, k0);
this.d.setPadding(e50.o8 ? e50.k0(18.0f) : 0, 0, 0, 0);
this.g.setTextSize(e50.o8 ? 16.0f : 15.0f);
this.b0.setTextSize(e50.o8 ? 11.0f : 9.0f);
this.a0.setTextSize(e50.o8 ? 13.0f : 11.0f);
int k02 = e50.k0(e50.o8 ? 120.0f : 90.0f);
this.d.setLayoutParams(new RecyclerView.LayoutParams(-1, k02));
((ViewGroup.MarginLayoutParams) this.b0.getLayoutParams()).topMargin = e50.o8 ? e50.k0(6.0f) : 0;
((ViewGroup.MarginLayoutParams) cardView.getLayoutParams()).topMargin = (k02 - ((k0 * 100) / 70)) / 2;
((ViewGroup.MarginLayoutParams) this.g.getLayoutParams()).topMargin = e50.k0(e50.o8 ? 26.0f : 20.0f);
((ViewGroup.MarginLayoutParams) this.a0.getLayoutParams()).topMargin = e50.o8 ? e50.k0(16.0f) : e50.k0(10.0f);
((ViewGroup.MarginLayoutParams) this.f.getLayoutParams()).topMargin = e50.o8 ? e50.k0(12.0f) : e50.k0(2.0f);
((ViewGroup.MarginLayoutParams) this.d0.getLayoutParams()).topMargin = e50.o8 ? e50.k0(10.0f) : e50.k0(0.0f);
((ViewGroup.MarginLayoutParams) this.e.getLayoutParams()).bottomMargin = e50.o8 ? e50.k0(10.0f) : e50.k0(0.0f);
}
@Override
public void onClick(View v) {
if (this.a < this.c.size()) {
if (ActivityMain.this.U1()) {
long elapsedRealtime = SystemClock.elapsedRealtime();
ActivityMain activityMain = ActivityMain.this;
if (elapsedRealtime - activityMain.b2 > 400) {
activityMain.t2(this.c.get(this.a));
return;
}
return;
}
if (ActivityMain.A2(ActivityMain.this, this.c.get(this.a), this.e0)) {
ActivityMain.b0 = v.findViewById(R.id.cover);
ActivityMain.v1(ActivityMain.this, this.c.get(this.a).b);
return;
}
return;
}
ActivityMain.this.y1();
}
@Override
public boolean onLongClick(View v) {
if (this.a >= this.c.size()) {
return true;
}
ActivityMain.this.i2.onClick(v);
return true;
}
}
class o extends Handler {
o(Looper looper) {
super(looper);
}
@Override
public void handleMessage(Message msg) {
ActivityMain.this.r2(true);
}
}
public class o0 implements DialogInterface.OnClickListener {
final ArrayList a;
final String b;
final Activity c;
final Handler d;
class a implements DialogInterface.OnClickListener {
a() {
}
@Override
public void onClick(DialogInterface dialog, int which) {
o0 o0Var = o0.this;
WB.doWebSearchWithSelect(o0Var.c, o50.N0(o0Var.b));
}
}
o0(final ArrayList val$sources, final String val$filename, final Activity val$act, final Handler val$actHandler) {
this.a = val$sources;
this.b = val$filename;
this.c = val$act;
this.d = val$actHandler;
}
@Override
public void onClick(DialogInterface dialog, int which) {
String str;
ArrayList<S.WebBook> arrayList = new ArrayList<>();
Iterator it = this.a.iterator();
String str2 = null;
while (it.hasNext()) {
String str3 = (String) it.next();
String K = q50.K(str3);
String M = q50.M(str3);
S.WebBook webBook = new S.WebBook();
if (K.startsWith("$$")) {
TS.Book P = q50.P(this.b, K);
webBook.tsBook = P;
webBook.tag = P.tag;
webBook.site = S.tsBook2Site(P, true);
} else {
webBook.site = S.getSite(K, true);
}
webBook.url = M;
webBook.name = this.b;
if (webBook.site != null && !o50.F1(M)) {
arrayList.add(webBook);
}
str2 = K;
}
if (arrayList.size() > 0) {
WebBookDetailAct.clearTestResults();
WebBookDetailAct.testBooks = new ArrayList<>();
Iterator<S.WebBook> it2 = arrayList.iterator();
while (it2.hasNext()) {
S.WebBook next = it2.next();
S.BookSite bookSite = next.site;
bookSite.load_time = 0L;
bookSite.tag = null;
WebBookDetailAct.testBooks.add(next);
}
WebBookDetailAct.fromBooks = arrayList;
WebBookDetailAct.fromAct = this.c;
WebBookDetailAct.fromActHandler = this.d;
WebBookDetailAct.startTestUrls();
WebBookDetailAct.createTestInfoDlg(this.c.getString(R.string.zhengzaisaomiao), false);
return;
}
if (str2 == null || this.a.size() > 1) {
str = "";
} else {
str = "\"" + str2 + "\"";
}
new m.c(this.c).m(e50.W0("本书所用书源" + str + "已失效, 无扫描目标, 请重新搜索.")).v(R.string.ok, new a()).o(R.string.cancel, null).d(false).C();
}
}
public class o1 implements m.d {
o1() {
}
@Override
public void onClick(int which) {
if (which == 0) {
ActivityMain.this.n0();
}
if (which == 1) {
ActivityMain.this.E0();
}
if (which == 2) {
ActivityMain.this.o1(null);
}
if (which == 3) {
ActivityMain.this.f2();
}
}
}
public class p implements DialogInterface.OnClickListener {
final CheckBox a;
p(final CheckBox val$cb) {
this.a = val$cb;
}
@Override
public void onClick(DialogInterface dialog, int which) {
boolean z;
SelectFileAct.sd_grant_dlg = null;
g50.d();
boolean z2 = false;
try {
z = false;
for (int size = ActivityMain.this.f2.size() - 1; size >= 0; size--) {
try {
g50.e eVar = ActivityMain.this.f2.get(size);
if (this.a.isChecked()) {
z = SelectFileAct.deleteSingeBook(ActivityMain.this, eVar.b, false, null);
if (SelectFileAct.sd_grant_dlg != null) {
break;
}
}
g50.p(eVar);
ActivityMain.this.W0().remove(eVar);
ActivityMain.this.f2.remove(eVar);
} catch (Throwable th) {
th = th;
z2 = z;
e50.S0(th);
z = z2;
g50.y();
if (z) {
}
ActivityMain.this.g2();
ActivityMain activityMain = ActivityMain.this;
activityMain.p1(activityMain.m1);
}
}
} catch (Throwable th2) {
th = th2;
}
g50.y();
if (z) {
ActivityMain activityMain2 = ActivityMain.this;
o50.p2(activityMain2, activityMain2.getString(R.string.yishanchutishi));
}
ActivityMain.this.g2();
ActivityMain activityMain3 = ActivityMain.this;
activityMain3.p1(activityMain3.m1);
}
}
public class p0 implements DialogInterface.OnClickListener {
final i2 a;
final ArrayList b;
final String c;
final Activity d;
p0(final i2 val$selectSource, final ArrayList val$sources, final String val$curSite, final Activity val$act) {
this.a = val$selectSource;
this.b = val$sources;
this.c = val$curSite;
this.d = val$act;
}
@Override
public void onClick(DialogInterface dialog, int which) {
boolean z;
int i;
if (this.a != null && (i = ActivityMain.J0) != -1) {
String str = (String) this.b.get(i);
if (!str.contains("*" + this.c + "#")) {
this.a.afterSelect(q50.K(str), q50.M(str));
z = true;
if (!z || ActivityMain.J0 == -1) {
}
Activity activity = this.d;
o50.p2(activity, activity.getString(R.string.wuxiaoshuyuan));
return;
}
}
z = false;
if (z) {
}
}
}
public class p1 implements CompoundButton.OnCheckedChangeListener {
final CheckBox a;
p1(final CheckBox val$listCb) {
this.a = val$listCb;
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
CheckBox checkBox = this.a;
StringBuilder sb = new StringBuilder();
sb.append(isChecked ? "当前" : "");
sb.append("书架布局使用列表模式");
checkBox.setText(e50.W0(sb.toString()));
}
}
public class q implements DialogInterface.OnClickListener {
class a implements DialogInterface.OnClickListener {
final ClearableEditText a;
a(final ClearableEditText val$et) {
this.a = val$et;
}
@Override
public void onClick(DialogInterface dialog, int which) {
ActivityMain.this.moveBooksToShelf(this.a.getText().toString());
}
}
q() {
}
@Override
public void onClick(DialogInterface dialog, int which) {
ClearableEditText clearableEditText = new ClearableEditText(ActivityMain.this);
clearableEditText.setSingleLine();
clearableEditText.setText("");
new m.c(ActivityMain.this).z(ActivityMain.this.getString(R.string.yidongdaoxinshujia)).B(clearableEditText).v(R.string.ok, new a(clearableEditText)).o(R.string.cancel, null).C();
}
}
public class q0 implements DialogInterface.OnClickListener {
q0() {
}
@Override
public void onClick(DialogInterface dialog, int which) {
ActivityMain.J0 = which;
}
}
public class q1 implements DialogInterface.OnClickListener {
final CheckBox a;
final boolean a0;
final CheckBox b;
final boolean b0;
final CheckBox c;
final CheckBox d;
final CheckBox e;
final boolean f;
final boolean g;
q1(final CheckBox val$autoCb, final CheckBox val$recentCb, final CheckBox val$updateCb, final CheckBox val$diffCb, final CheckBox val$listCb, final boolean val$diffShelfStyle, final boolean val$isGrid, final boolean val$sortByRecent, final boolean val$sortByUpdate) {
this.a = val$autoCb;
this.b = val$recentCb;
this.c = val$updateCb;
this.d = val$diffCb;
this.e = val$listCb;
this.f = val$diffShelfStyle;
this.g = val$isGrid;
this.a0 = val$sortByRecent;
this.b0 = val$sortByUpdate;
}
@Override
public void onClick(DialogInterface dialogInterface, int i) {
e50.Z2 = this.a.isChecked();
e50.D7 = this.b.isChecked();
e50.E7 = this.c.isChecked();
e50.F7 = this.d.isChecked();
int i2 = !this.e.isChecked() ? 1 : 0;
if (e50.F7) {
ActivityMain.this.M1(i2);
} else {
e50.Q5 = i2;
}
e50.e(ActivityMain.this);
if (this.f == e50.F7 && this.g == i2 && this.a0 == e50.D7 && this.b0 == e50.E7) {
return;
}
ActivityMain.this.i1(false);
}
}
public class r implements DialogInterface.OnClickListener {
final String[] a;
r(final String[] val$items) {
this.a = val$items;
}
@Override
public void onClick(DialogInterface dialog, int which) {
ActivityMain.this.moveBooksToShelf(this.a[((AlertDialog) dialog).getListView().getCheckedItemPosition()]);
}
}
public class r0 implements BottomNavigationView.OnNavigationItemReselectedListener {
r0() {
}
@Override
public void onNavigationItemReselected(@NonNull MenuItem menuItem) {
if (System.currentTimeMillis() - ActivityMain.I0 < 1000) {
return;
}
ActivityMain.I0 = System.currentTimeMillis();
int order = menuItem.getOrder();
if (order == 0) {
ActivityMain.this.e1.setExpanded(true, true);
ActivityMain.this.m1.scrollToPosition(0);
ActivityMain.this.n0();
return;
}
if (order == 1) {
if (ActivityMain.this.n1.getVisibility() != 0) {
ActivityMain.this.e1.setExpanded(!r6.f0(), true);
ActivityMain.this.p1.reload();
return;
} else {
ActivityMain.this.e1.setExpanded(true, true);
ActivityMain.this.n1.scrollToPosition(0);
return;
}
}
if (order != 2) {
if (order != 3) {
return;
}
ActivityMain.this.e1.setExpanded(!r6.f0(), true);
return;
}
ActivityMain.this.e1.setExpanded(true, true);
ForumMainFragment forumMainFragment = ActivityMain.this.X0;
if (forumMainFragment != null) {
forumMainFragment.refreshCurPage();
}
}
}
public class r1 implements z.ResultInterface {
r1() {
}
@Override
public void done(boolean success, Object obj) {
if (success && (obj instanceof Integer)) {
ActivityMain.this.H2 = ((Integer) obj).intValue();
ActivityMain.this.Y1();
}
}
}
public class s implements DialogInterface.OnClickListener {
final Activity a;
final h2 b;
s(final Activity val$act, final h2 val$onDelete) {
this.a = val$act;
this.b = val$onDelete;
}
@Override
public void onClick(DialogInterface dialog, int which) {
int H = g50.H();
g50.f(g50.D(), true);
int H2 = g50.H();
o50.n2(this.a, this.a.getString(R.string.remove_all_invalidated_books) + ":\n " + (H - H2));
h2 h2Var = this.b;
if (h2Var != null) {
h2Var.afterDelete(true);
}
}
}
public class s0 implements DownloadTask.Callback {
final S.WebBook a;
final String b;
final String c;
final q50 d;
final boolean e;
class a implements Runnable {
a() {
}
@Override
public void run() {
s0 s0Var = s0.this;
if (s0Var.e) {
ActivityMain.this.hideProgressDlg();
}
s0 s0Var2 = s0.this;
ActivityMain.this.u2.put(s0Var2.b, 0);
s0 s0Var3 = s0.this;
ActivityMain.this.o0(s0Var3.b);
}
}
s0(final S.WebBook val$book, final String val$filename, final String val$siteTag, final q50 val$ebook, final boolean val$showProgressDialog) {
this.a = val$book;
this.b = val$filename;
this.c = val$siteTag;
this.d = val$ebook;
this.e = val$showProgressDialog;
}
@Override
public void onCancel() {
this.a.site.working = false;
new Handler(Looper.getMainLooper()).postDelayed(new a(), 50L);
}
@Override
public void onError(DownloadTask.Result result, String err) {
result.taskBook = this.a;
result.filename = this.b;
result.showProgressDialog = this.e;
Handler handler = ActivityMain.this.m2;
handler.sendMessage(handler.obtainMessage(1011, result));
}
@Override
public void onFinish(DownloadTask.Result result) {
result.taskBook = this.a;
result.filename = this.b;
result.siteTag = this.c;
result.description = this.d.k;
result.showProgressDialog = this.e;
e50.N5("send CHECK_TASK_FINISHED");
Handler handler = ActivityMain.this.m2;
handler.sendMessageDelayed(handler.obtainMessage(1010, result), o50.R1(200));
}
@Override
public void onProgress(DownloadTask.Result result, int progress, int total) {
}
}
public class s1 implements Runnable {
s1() {
}
@Override
public void run() {
ActivityMain activityMain = ActivityMain.this;
activityMain.J2 = false;
activityMain.i2();
}
}
public class t implements DialogInterface.OnClickListener {
final Activity a;
final g50.e b;
t(final Activity val$act, final g50.e val$bi) {
this.a = val$act;
this.b = val$bi;
}
@Override
public void onClick(DialogInterface dialog, int which) {
WB.doWebSearchWithSelect(this.a, this.b.a);
}
}
public class t0 implements TS.OnBookResult {
final String a;
final S.WebBook b;
final boolean c;
t0(final String val$filename, final S.WebBook val$webBook, final boolean val$showProgressDialog) {
this.a = val$filename;
this.b = val$webBook;
this.c = val$showProgressDialog;
}
@Override
public void result(String error, TS.Book book, boolean includeChapters) {
if (ActivityMain.this.isFinishing()) {
return;
}
if (error != null) {
o50.p2(ActivityMain.this, error);
ActivityMain.this.u1(this.a, null, this.b, this.c);
} else if (includeChapters) {
ArrayList<S.WebChapter> arrayList = new ArrayList<>();
S.addTsChaptersToWebChapters(arrayList, book.chapters);
S.WebBook webBook = this.b;
webBook.chapters = arrayList;
ActivityMain.this.u1(this.a, arrayList, webBook, this.c);
}
}
}
public class t1 implements Observer<Long> {
t1() {
}
@Override
public void onNext(Long aLong) {
AnimalTools.startJdllyAnimal(ActivityMain.this.R0, 1.2f);
}
@Override
public void onComplete() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onSubscribe(Disposable d) {
ActivityMain.this.K2 = d;
}
}
public class u implements DialogInterface.OnClickListener {
final g50.e a;
final h2 b;
u(final g50.e val$bi, final h2 val$onDelete) {
this.a = val$bi;
this.b = val$onDelete;
}
@Override
public void onClick(DialogInterface dialog, int which) {
g50.p(this.a);
h2 h2Var = this.b;
if (h2Var != null) {
h2Var.afterDelete(false);
}
}
}
public class u0 implements DialogInterface.OnClickListener {
final String a;
u0(final String val$filename) {
this.a = val$filename;
}
@Override
public void onClick(DialogInterface dialog, int which) {
ActivityMain.v1(ActivityMain.this, this.a);
}
}
public class u1 implements View.OnClickListener {
u1() {
}
@Override
public void onClick(View v) {
ARouter.getInstance().build(ARouterPath.USER_TASK_MAIN).withString("action", "autoSign").navigation();
ActivityMain.this.Q0.setVisibility(8);
}
}
class v implements AppBarLayout.OnOffsetChangedListener {
v() {
}
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int i) {
ZhouBase.appBarLayoutShow = i == 0;
}
}
class v0 implements View.OnClickListener {
class a implements m.d {
final View a;
final int b;
final g50.e c;
a(final View val$v, final int val$off, final g50.e val$bi) {
this.a = val$v;
this.b = val$off;
this.c = val$bi;
}
@Override
public void onClick(int which) {
String str = (String) this.a.getTag();
if (this.b > 0 && which == 0) {
ActivityMain activityMain = ActivityMain.this;
g50.e eVar = this.c;
com.flyersoft.discuss.z.showShuPing(activityMain, eVar.a, eVar.c, "", eVar.g);
}
if (which == this.b + 0) {
WB.addToShelf(ActivityMain.this, str, null, null, true, true, null);
}
if (which == this.b + 1) {
ActivityMain.this.I0(str, null);
}
if (which == this.b + 2) {
ActivityMain.this.j2(str, 1);
e50.v0(str);
ActivityMain activityMain2 = ActivityMain.this;
activityMain2.p1(activityMain2.l1);
}
}
}
v0() {
}
@Override
public void onClick(final View v) {
g50.e I = g50.I((String) v.getTag());
int i = (I != null && e50.s4(I.b, I.a, I.c)) ? 2 : 0;
String[] strArr = new String[i + 3];
if (i > 0) {
strArr[0] = e50.W0("逛书评区");
strArr[1] = "-";
}
strArr[i + 0] = ActivityMain.this.getString(R.string.add_to_shelf);
strArr[i + 1] = ActivityMain.this.getString(R.string.xiazaifengmian);
strArr[i + 2] = ActivityMain.this.getString(R.string.yichubenshu);
new com.flyersoft.components.m(ActivityMain.this, v, strArr, new a(v, i, I)).A(v);
}
}
public class v1 implements View.OnLongClickListener {
v1() {
}
@Override
public boolean onLongClick(View v) {
return true;
}
}
public class w implements DialogInterface.OnClickListener {
w() {
}
@Override
public void onClick(DialogInterface dialog, int which) {
for (int size = e50.H2().size() - 1; size >= 0; size--) {
if (!o50.A1(e50.H2().get(size))) {
e50.H2().remove(size);
}
}
e50.q6();
ActivityMain activityMain = ActivityMain.this;
activityMain.p1(activityMain.l1);
}
}
public class w0 implements b.h {
w0() {
}
@Override
public void onGetImageFile(String saveTo, Drawable d) {
if (d == null) {
return;
}
o50.P(d, saveTo);
e50.x0(saveTo);
ActivityMain activityMain = ActivityMain.this;
activityMain.p1(activityMain.l1);
ActivityMain activityMain2 = ActivityMain.this;
activityMain2.p1(activityMain2.k1);
ActivityMain activityMain3 = ActivityMain.this;
activityMain3.p1(activityMain3.m1);
}
}
class w1 implements DialogInterface.OnClickListener {
final String a;
w1(final String val$ip) {
this.a = val$ip;
}
@Override
public void onClick(DialogInterface dialog, int which) {
((ClipboardManager) ActivityMain.this.getSystemService("clipboard")).setText(this.a);
z2.showToastText(ActivityMain.this.L2, "已拷贝IP地址到粘贴板");
}
}
public class x implements DialogInterface.OnClickListener {
final String a;
x(final String val$filename) {
this.a = val$filename;
}
@Override
public void onClick(DialogInterface dialog, int which) {
WB.doWebSearchWithSelect(ActivityMain.this, o50.N0(this.a));
}
}
public class x0 implements View.OnClickListener {
final int a;
final int b;
final String c;
final g50.e d;
x0(final int val$type, final int val$position, final String val$filename, final g50.e val$bi) {
this.a = val$type;
this.b = val$position;
this.c = val$filename;
this.d = val$bi;
}
@Override
public void onClick(View v) {
if (this.a == 1) {
ArrayList<String> H2 = e50.H2();
int i = this.b;
if (i < 0) {
i = 0;
}
H2.add(i, this.c);
e50.q6();
ActivityMain activityMain = ActivityMain.this;
activityMain.p1(activityMain.l1);
}
if (this.a == 2) {
if (this.d.n.length() > this.d.a.length()) {
g50.e eVar = this.d;
eVar.a = eVar.n;
}
g50.o0(this.d);
((l2) ActivityMain.this.m1.getAdapter()).d(true);
}
}
}
class x1 implements Observer<List<BookSource>> {
final ReturnData a;
final RequestCallback b;
x1(final ReturnData val$returnData, final RequestCallback val$callback) {
this.a = val$returnData;
this.b = val$callback;
}
@Override
public void onNext(@io.reactivex.annotations.NonNull List<BookSource> bookSources) {
if (bookSources != null && bookSources.size() > 0) {
SourceManagerLayout sourceManagerLayout = new SourceManagerLayout(ActivityMain.this);
for (BookSource bookSource : bookSources) {
if (sourceManagerLayout.isAcceptableSource(bookSource)) {
sourceManagerLayout.modifySourceGroup(bookSource);
}
}
SourceController.getInstance().insertOrReplace(bookSources);
this.a.setData("保存成功!");
} else {
this.a.setErrorMsg("数据有误,无法导入");
}
this.b.call(this.a);
}
@Override
public void onComplete() {
}
@Override
public void onError(@io.reactivex.annotations.NonNull Throwable e) {
this.a.setErrorMsg(e.getMessage());
this.b.call(this.a);
}
@Override
public void onSubscribe(@io.reactivex.annotations.NonNull Disposable d) {
}
}
public class y implements DialogInterface.OnClickListener {
final String a;
y(final String val$filename) {
this.a = val$filename;
}
@Override
public void onClick(DialogInterface dialog, int which) {
e50.v0(this.a);
ActivityMain activityMain = ActivityMain.this;
activityMain.p1(activityMain.l1);
}
}
public class y0 implements DialogInterface.OnClickListener {
final Activity a;
final String b;
y0(final Activity val$act, final String val$filename) {
this.a = val$act;
this.b = val$filename;
}
@Override
public void onClick(DialogInterface dialog, int which) {
ActivityMain.v1(this.a, this.b);
}
}
public class y1 extends RecyclerView.ItemDecoration {
y1() {
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
int childAdapterPosition = parent.getChildAdapterPosition(view);
int k0 = e50.k0(8.0f);
int size = S.getLinkSites().size();
int Q0 = ActivityMain.this.Q0();
if (S.storeToDiscovery()) {
outRect.top = childAdapterPosition == 0 ? 0 : (childAdapterPosition == 1 || childAdapterPosition == 5 || childAdapterPosition == 9 || childAdapterPosition == size || childAdapterPosition == size + Q0) ? k0 : 1;
} else {
outRect.top = childAdapterPosition == 0 ? 0 : (childAdapterPosition == 4 || childAdapterPosition == 8 || childAdapterPosition == size || childAdapterPosition == size + Q0) ? k0 : 1;
}
if (childAdapterPosition < ActivityMain.this.n1.getAdapter().getItemCount() - 1) {
k0 = 0;
}
outRect.bottom = k0;
}
}
class z implements View.OnClickListener {
class a implements m.d {
final View a;
final int b;
class C0925a implements c.l {
C0925a() {
}
@Override
public void onSaveBookInfo(boolean shelfChanged) {
if (shelfChanged) {
return;
}
((l2) ActivityMain.this.m1.getAdapter()).d(true);
}
}
a(final View val$v, final int val$off) {
this.a = val$v;
this.b = val$off;
}
@Override
public void onClick(int which) {
g50.e eVar = (g50.e) this.a.getTag();
String str = eVar.b;
new ArrayList().add(str);
if (this.b > 0 && which == 0) {
com.flyersoft.discuss.z.showShuPing(ActivityMain.this, eVar.a, eVar.c, "", eVar.g);
}
if (which == this.b + 0) {
if (str.startsWith("#")) {
return;
} else {
new com.flyersoft.seekbooks.c(ActivityMain.this, new C0925a(), true, eVar).show();
}
}
if (which == this.b + 1) {
if (str.startsWith("#")) {
return;
}
if (e50.D5(eVar.b)) {
ActivityMain.this.g0(eVar.b);
} else {
o50.p2(ActivityMain.this, e50.W0("非追更书籍"));
}
}
if (which == this.b + 2) {
if (str.startsWith("#")) {
return;
} else {
ActivityMain.this.I0(str, null);
}
}
if (which == this.b + 3) {
ActivityMain.this.j2(str, 2);
g50.p(eVar);
ActivityMain.this.W0().remove(eVar);
ActivityMain activityMain = ActivityMain.this;
activityMain.p1(activityMain.m1);
ActivityMain.this.c2(false);
}
}
}
z() {
}
@Override
public void onClick(final View v) {
g50.e eVar = (g50.e) v.getTag();
if (ActivityMain.this.m1() && ActivityMain.this.U1()) {
ActivityMain.this.t2(eVar);
return;
}
int i = e50.s4(eVar.b, eVar.a, eVar.c) ? 2 : 0;
String[] strArr = new String[i + 4];
if (i > 0) {
strArr[0] = e50.W0("逛书评区");
strArr[1] = "-";
}
strArr[i + 0] = ActivityMain.this.getString(R.string.shujixinxi);
strArr[i + 1] = ActivityMain.this.getString(R.string.genghuanshuyuan);
strArr[i + 2] = ActivityMain.this.getString(R.string.xiazaifengmian);
strArr[i + 3] = ActivityMain.this.getString(R.string.yichubenshu);
ActivityMain.this.g2 = new com.flyersoft.components.m(ActivityMain.this, v, strArr, new a(v, i));
ActivityMain.this.g2.A(v);
ActivityMain.this.h2 = true;
}
}
public class z0 implements DialogInterface.OnClickListener {
final Activity a;
final String b;
z0(final Activity val$act, final String val$filename) {
this.a = val$act;
this.b = val$filename;
}
@Override
public void onClick(DialogInterface dialog, int which) {
WB.addToShelf(this.a, this.b, null, null, true, true, null);
}
}
public class z1 implements DiscoveryModel.DiscoveryListener {
z1() {
}
@Override
public void onError(String e) {
ActivityMain.this.o1 = null;
}
@Override
public void onSuccess(List<DiscoveryBean> data) {
List<DiscoveryBean> list = ActivityMain.this.o1;
boolean z = true;
boolean z2 = list == null;
if (!z2) {
z2 = list.size() != data.size();
}
if (!z2) {
for (int i = 0; i < data.size(); i++) {
if (!ActivityMain.this.o1.get(i).getName().equals(data.get(i).getName())) {
break;
}
}
}
z = z2;
ActivityMain activityMain = ActivityMain.this;
activityMain.o1 = data;
if (z) {
activityMain.p1(activityMain.n1);
}
}
}
private void A1() {
if (o50.A1(this.a1)) {
v1(this, this.a1);
this.a1 = null;
}
}
public static boolean A2(final Activity act, final g50.e bi, final h2 onDelete) {
String str = bi.b;
if (o50.A1(str)) {
return true;
}
if (str.startsWith("#")) {
com.flyersoft.discuss.z.showShuPing(act, bi.a, bi.c, "", "");
return false;
}
new m.c(act).m(e50.W0("没有找到《" + bi.a + "》, 是否从书架移除本书, 或重新搜索书源?")).w(e50.W0("移除本书"), new u(bi, onDelete)).p(e50.W0("重新搜索"), new t(act, bi)).r(e50.W0("移除所有失效书籍"), new s(act, onDelete)).C();
return false;
}
public void B0(S.BookSite site, String bookId, final String webUrl, String toShelf) {
ArrayList<S.WebChapter> arrayList;
S.WebBook webBook = this.A1;
if (webBook == null || (arrayList = this.B1) == null || this.l2 == null) {
return;
}
webBook.chapters = arrayList;
this.B1 = null;
webBook.url = site.chapterPageUrl.replace("%id", bookId);
S.WebBook webBook2 = this.A1;
webBook2.sources.add(webBook2);
hideProgressDlg();
if (toShelf != null) {
e50.s(toShelf);
WB.addToShelf(this, null, this.A1, toShelf, false, false, new m(webUrl));
return;
}
String Q = q50.Q(this.A1);
int i3 = 0;
while (true) {
if (i3 >= this.A1.chapters.size()) {
break;
}
if (K1(this.A1.chapters.get(i3).url, webUrl)) {
getSharedPreferences(e50.r0, 0).edit().putString(Q.toLowerCase(), i3 + "@0#0:0%").apply();
break;
}
i3++;
}
q50.X(this.A1, false);
v1(this, Q);
}
private void B1(String dataFile) {
if (f != null && e50.l2 == 1) {
ActivityMain activityMain = f;
if (activityMain.p1 != null && activityMain.r1.getVisibility() == 0 && o50.D1(ActivityTxt.a) && o50.D1(WebSearchAct.selfPref)) {
f.R1(e50.l2);
f.n1(dataFile, null);
w0();
return;
}
}
this.Z0 = dataFile;
e50.l2 = 1;
R1(1);
m0();
}
private void C0(int requestCode, int resultCode, Intent data) {
RecyclerView recyclerView;
super.onActivityResult(requestCode, resultCode, data);
e = this;
e50.W();
System.gc();
e50.z6 = false;
getSharedPreferences(e50.q0, 0).edit().putBoolean("forceRebootToMain", e50.z6).commit();
this.Q1 = true;
if (e50.sa) {
e50.sa = false;
w2(true);
} else if (this.K0 == null) {
R1(e50.l2);
} else if (requestCode != 101 && requestCode != 102) {
if (e50.L2 && e50.l2 == 3 && (recyclerView = this.l1) != null && N0(recyclerView) == null) {
a2(false);
} else if (!e50.V1.equals(d0)) {
p1(this.l1);
}
p1(this.m1);
}
if (!com.flyersoft.seekbooks.q.x()) {
AboutAct.showRateTip(this, false, S.promoPicRate);
}
if (com.flyersoft.seekbooks.q.d()) {
T0();
}
}
public void C1(final S.BookSite site, final String bookId, final String webUrl, final String toShelf) {
this.A1 = null;
this.B1 = null;
this.C1 = false;
this.z1 = new HashMap<>();
if (site.javascriptTOC) {
DownloadTaskBrowser.CacheWebView cacheWebView = this.x1;
if (cacheWebView == null || cacheWebView.destroyed) {
this.x1 = DownloadTaskBrowser.createDownloadWebView();
}
DownloadTaskBrowser.CacheWebView cacheWebView2 = this.y1;
if (cacheWebView2 == null || cacheWebView2.destroyed) {
this.y1 = DownloadTaskBrowser.createDownloadWebView();
}
DownloadTaskBrowser.CacheWebView cacheWebView3 = this.x1;
DownloadTaskBrowser.CacheWebView cacheWebView4 = this.y1;
int i3 = site.TOCDelay;
if (i3 <= 0) {
i3 = 200;
}
cacheWebView4.delayed = i3;
cacheWebView3.delayed = i3;
}
String replace = bookId.replace("?ADTAG=ssds", "");
E1(site, replace, webUrl, toShelf);
if (site.chapterPageUrl.equals(site.bookPageUrl)) {
return;
}
this.m2.postDelayed(new i(site, replace, webUrl, toShelf), 100L);
}
public static void D0(final Activity act, final Handler actHandler, final String filename, final i2 selectSource) {
String str;
int i3;
String str2;
int i4;
File[] listFiles;
String H = q50.H(filename);
String n02 = o50.n0(filename);
ArrayList<String> C2 = o50.C2(q50.H(n02 + "/.sources"));
int size = C2.size() - 1;
while (true) {
str = "$$";
i3 = 0;
if (size < 0) {
break;
}
try {
String K = q50.K(C2.get(size));
if (!K.startsWith("$$") ? S.getSite(K) != null : TS.getSource(q50.L(C2.get(size))) != null) {
i3 = 1;
}
} catch (Exception e3) {
e50.S0(e3);
}
if (i3 == 0) {
C2.remove(size);
}
size--;
}
if (C2.size() == 0) {
new m.c(act).m(act.getString(R.string.meiyoushuyuanshifousousuo)).p("否", null).w("是", new m0(act, filename)).C();
return;
}
CharSequence[] charSequenceArr = new CharSequence[C2.size()];
int i5 = 0;
int i6 = -1;
while (i5 < C2.size()) {
String str3 = C2.get(i5);
String substring = str3.substring(i3, str3.indexOf("*"));
charSequenceArr[i5] = substring;
StringBuilder sb = new StringBuilder();
sb.append(n02);
sb.append(com.ksdk.ssds.manager.b.b);
sb.append(str3.contains(str) ? str : "");
sb.append(substring);
File file = new File(sb.toString());
if (!file.isDirectory() || (listFiles = file.listFiles()) == null) {
str2 = str;
i4 = 0;
} else {
int length = listFiles.length;
int i7 = 0;
int i8 = 0;
while (i7 < length) {
String str4 = str;
if (listFiles[i7].getName().startsWith("##")) {
i8++;
}
i7++;
str = str4;
}
str2 = str;
i4 = i8;
}
if (i4 > 0) {
StringBuilder sb2 = new StringBuilder();
sb2.append(substring);
i3 = 0;
sb2.append(o50.m1(" (" + i4 + ")", false));
charSequenceArr[i5] = Html.fromHtml(sb2.toString());
} else {
i3 = 0;
}
if (str3.contains("*" + H + "#")) {
i6 = i5;
}
i5++;
str = str2;
}
J0 = -1;
new m.c(act).z(act.getString(R.string.xuanzeshuyuan)).x(charSequenceArr, i6, new q0()).v(R.string.ok, new p0(selectSource, C2, H, act)).p(act.getString(R.string.saomiao), new o0(C2, filename, act, actHandler)).r(act.getString(R.string.chongxinsousuo), new n0(act, filename)).C();
}
public void D1(final S.BookSite site, final String bookId, final String webUrl, final String toShelf) {
String replace = site.chapterPageUrl.replace("%id", bookId);
DownloadTaskBrowser.CacheWebView cacheWebView = site.javascriptTOC ? this.y1 : null;
createProgressDlg(WB.getBookName(this.p1.getTitle()), getString(R.string.duqushujixinxizhong));
DownloadTask.Result result = new DownloadTask.Result();
result.callback = new l(site, bookId, webUrl, toShelf);
DownloadTask.download(cacheWebView, result, replace, null, site.userAgent);
}
private void E1(final S.BookSite site, final String bookId, final String webUrl, final String toShelf) {
String replace = site.bookPageUrl.replace("%id", bookId);
DownloadTaskBrowser.CacheWebView cacheWebView = site.javascriptTOC ? this.x1 : null;
createProgressDlg(WB.getBookName(this.p1.getTitle()), getString(R.string.duqushujixinxizhong));
DownloadTask.Result result = new DownloadTask.Result();
result.callback = new j(site, bookId, webUrl, toShelf);
DownloadTask.download(cacheWebView, result, replace, null, site.userAgent);
}
public void F0(String key) {
if (o50.F1(key)) {
return;
}
if (g50.M(key).size() == 0) {
o50.n2(this, getString(R.string.meiyouzhaoshujiashuji));
} else {
o1(key);
}
}
public void F1() {
this.m2.postDelayed(new i1(), u2(true) ? 50 : 0);
}
private boolean G0() {
Bundle extras;
String string;
try {
extras = getIntent().getExtras();
this.a1 = null;
if (extras != null && (string = extras.getString("bookSearch")) != null) {
WB.doWebSearch(this, string);
}
g = false;
} catch (Exception e3) {
e50.S0(e3);
}
if (!e50.z6 && !o50.D1(ActivityTxt.a) && getIntent().getDataString() == null && (extras == null || !extras.containsKey("bookFile"))) {
o50.p2(this, e50.W0("已恢复阅读状态"));
w0();
return false;
}
if (!e50.z6 && extras != null && extras.containsKey("bookFile") && (extras.getBoolean("fromWidget") || extras.getBoolean("fromNotification"))) {
String string2 = extras.getString("bookFile");
e50.N5("------------>extras bookFile:" + string2);
this.a1 = string2;
w0();
return false;
}
if (!e50.z6 && "android.intent.action.VIEW".equals(getIntent().getAction())) {
String R0 = R0();
e50.N5("===============>datafile: " + R0);
if (R0 != null && e50.c5(R0)) {
if (e50.C4(R0)) {
B1(R0);
} else {
e50.J0(this, R0, null, null);
o50.q2(this, getString(R.string.download) + ": " + R0, 1);
w0();
}
return false;
}
if (R0 != null && R0.contains("://")) {
S.openAppInWebView(this, R0, true);
w0();
return false;
}
if (o50.A1(R0)) {
this.a1 = R0;
e50.y6 = false;
w0();
return false;
}
if (R0 != null && (!o50.D1(f) || !o50.D1(ActivityTxt.a))) {
w0();
return false;
}
}
if (e50.z6) {
e50.z6 = false;
getSharedPreferences(e50.q0, 0).edit().putBoolean("forceRebootToMain", e50.z6).commit();
R1(e50.l2);
m0();
return true;
}
g = o50.A1(e50.h8) && ActivityTxt.a == null;
if (!e50.v2 && ((g || e50.y6 || e50.j5) && (e50.V1.indexOf("?") != -1 || o50.A1(e50.V1)))) {
e50.y6 = false;
this.a1 = e50.V1;
if (g) {
e50.M5("===============ActTxt killed by system when paused, no destroyed executed, should restore it==============", true);
o50.C(e50.h8);
}
m0();
return false;
}
R1(e50.l2);
m0();
return true;
}
public static void G1() {
ViewGroup viewGroup;
if (o50.D1(e)) {
return;
}
ActivityMain activityMain = e;
if (activityMain.p1 == null || (viewGroup = activityMain.r1) == null || viewGroup.getVisibility() != 0) {
return;
}
e.b1();
}
public void I1() {
ViewGroup viewGroup = this.s1;
if (viewGroup == null) {
return;
}
viewGroup.setVisibility(8);
TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f, this.s1.getHeight(), 0.0f);
translateAnimation.setDuration(200L);
this.p1.startAnimation(translateAnimation);
TranslateAnimation translateAnimation2 = new TranslateAnimation(0.0f, 0.0f, 0.0f, -this.s1.getHeight());
translateAnimation2.setDuration(200L);
this.s1.startAnimation(translateAnimation2);
}
public void J0(SimpleDraweeView cover, String filename, g50.e bi, boolean animation, boolean originalCover, TextView nameTv) {
String str;
try {
if (filename.startsWith("#")) {
nameTv.setVisibility(8);
if (bi != null && (str = bi.g) != null && str.toLowerCase().startsWith(rv.a)) {
cover.setImageURI(bi.g);
return;
} else {
cover.setImageURI(Uri.parse("res:///2131623942"));
return;
}
}
String x3 = originalCover ? e50.x3(filename) : null;
if (o50.F1(x3)) {
x3 = e50.z3(filename);
}
if (nameTv != null) {
if (!x3.startsWith(com.ksdk.ssds.manager.b.b) && !x3.startsWith(rv.a)) {
nameTv.setVisibility(0);
nameTv.setText(e50.W0(P0(filename, bi)));
}
nameTv.setVisibility(8);
}
if (x3.startsWith(rv.a)) {
cover.setImageURI(x3);
return;
}
if (x3.startsWith(com.ksdk.ssds.manager.b.b)) {
cover.setImageURI(Uri.fromFile(new File(x3)));
return;
}
cover.setImageURI(Uri.parse("res:///" + x3));
} catch (Exception e3) {
e50.S0(e3);
}
}
private void K0() {
e50.r7(true);
finish();
e = null;
f = null;
e50.Ba = 0L;
e50.xa = false;
e50.w9 = null;
e50.ga = null;
DownloadTaskAsync.stopAllTasks("main after exit");
}
public boolean K1(String cUrl, String webUrl) {
if (cUrl.equals(webUrl)) {
return true;
}
if (webUrl.startsWith(cUrl) && webUrl.length() > cUrl.length()) {
char charAt = webUrl.charAt(cUrl.length());
return charAt < '0' || charAt > '9';
}
if (cUrl.endsWith(com.ksdk.ssds.manager.b.b)) {
cUrl = cUrl.substring(0, cUrl.length() - 1);
}
if (webUrl.endsWith(com.ksdk.ssds.manager.b.b)) {
webUrl = webUrl.substring(0, webUrl.length() - 1);
}
int lastIndexOf = cUrl.lastIndexOf(com.ksdk.ssds.manager.b.b);
if (lastIndexOf > 0) {
lastIndexOf = cUrl.lastIndexOf(com.ksdk.ssds.manager.b.b, lastIndexOf);
}
String substring = lastIndexOf > 0 ? cUrl.substring(lastIndexOf) : null;
int lastIndexOf2 = webUrl.lastIndexOf(com.ksdk.ssds.manager.b.b);
if (lastIndexOf2 > 0) {
lastIndexOf2 = webUrl.lastIndexOf(com.ksdk.ssds.manager.b.b, lastIndexOf2);
}
return substring != null && substring.equals(lastIndexOf2 > 0 ? webUrl.substring(lastIndexOf2) : null);
}
public void L0() {
S.LinkSite linkSite = (S.LinkSite) this.t1.getTag();
boolean z2 = linkSite != null && linkSite.primary() && this.t1.getVisibility() == 0;
boolean z3 = S.favLinkId(this.v1) != -1;
EditText editText = new EditText(this);
editText.setText(this.p1.getTitle());
new m.c(this).z("网页").B(editText).w(z3 ? "移除书签" : "新建书签", new f(z3, editText)).r(getString(R.string.search_book), new e()).p(z2 ? "加入书架" : s5.BTN_CANCEL, new d(z2)).C();
}
public void N1() {
WB.doWebSearchWithSelect(this, WB.getBookName(this.p1.getTitle()));
}
private String O0(String url, String start, String end) {
int indexOf;
if (url != null && start != null) {
String pureUrl = S.getPureUrl(url);
if (pureUrl.startsWith(start)) {
String substring = pureUrl.substring(start.length());
if (!o50.F1(end) && (indexOf = substring.indexOf(end)) != -1) {
substring = substring.substring(0, indexOf);
}
int indexOf2 = substring.indexOf(com.ksdk.ssds.manager.b.b);
if (indexOf2 != -1) {
substring = substring.substring(0, indexOf2);
}
int indexOf3 = substring.indexOf(com.lygame.aaa.h1.b);
return indexOf3 != -1 ? substring.substring(0, indexOf3) : substring;
}
}
return null;
}
private void O1(int index, int padding) {
((ImageView) ((BottomNavigationItemView) ((BottomNavigationMenuView) this.W0.getChildAt(0)).getChildAt(index)).findViewById(R.id.icon)).setPadding(padding, padding, padding, padding);
}
public String P0(String filename, g50.e bi) {
return (bi == null || o50.F1(bi.a)) ? e50.B1(filename) : bi.a;
}
public void P1(View v2, int width) {
ViewGroup.LayoutParams layoutParams = v2.getLayoutParams();
layoutParams.height = (width * 100) / 70;
layoutParams.width = width;
}
public void Q1(View v2, boolean drag) {
if (drag) {
v2.setBackgroundColor(U0());
} else {
v2.setBackgroundColor(com.flyersoft.discuss.z.getItemBackColor());
}
}
public g2 S0(String filename) {
g2 g2Var = new g2();
String str = o50.n0(filename) + com.ksdk.ssds.manager.b.b + q50.H(filename);
try {
String a12 = a1(str + "/.latestc", str);
g2Var.b = e50.P2(getSharedPreferences(e50.r0, 0).getString(filename.toLowerCase(), "-1#"));
g2Var.c = o50.z2(a12);
g2Var.a = "" + (g2Var.b + 1) + com.ksdk.ssds.manager.b.b + g2Var.c + " | " + a12.substring(a12.indexOf("*") + 1);
int i3 = (g2Var.c - g2Var.b) + (-1);
g2Var.d = i3;
if (i3 < 0) {
g2Var.d = 0;
}
} catch (Exception e3) {
e50.S0(e3);
g2Var.a = "";
}
return g2Var;
}
private void S1() {
this.E1.setOnLongClickListener(new v1());
}
private void T1() {
a2 a2Var = new a2();
this.d1.findViewById(R.id.back2).setOnClickListener(a2Var);
this.d1.findViewById(R.id.forward2).setOnClickListener(a2Var);
this.d1.findViewById(R.id.home2).setOnClickListener(a2Var);
this.d1.findViewById(R.id.progress2).setOnClickListener(a2Var);
this.d1.findViewById(R.id.favorite).setOnClickListener(a2Var);
this.d1.findViewById(R.id.read2).setOnClickListener(a2Var);
this.d1.findViewById(R.id.outer).setOnClickListener(a2Var);
this.d1.findViewById(R.id.favorite).setOnLongClickListener(new a());
}
private int U0() {
return 860183140;
}
public boolean U1() {
View view = this.c1;
return view != null && view.getVisibility() == 0;
}
private boolean V1() {
if (this.y2 || o50.G1(S.suggestFreeBooks)) {
return false;
}
this.y2 = true;
S.validateFreeBookSource();
this.m2.sendEmptyMessage(z0);
e50.N5("show hot book act");
return true;
}
public ArrayList<g50.e> W0() {
return ((l2) this.F2.get(e50.j8).getAdapter()).b;
}
private boolean W1() {
if (!e50.w2 && com.flyersoft.discuss.z.privacyOk) {
return e50.v2 && !o50.A1(e50.G7());
}
return true;
}
public PullRefreshLayout X0() {
return this.E2.get(e50.j8);
}
public void X1() {
com.flyersoft.discuss.z.showMessageList(this.H2);
this.H2 = 0;
Y1();
}
public void Y1() {
if (this.H2 > 99) {
this.H2 = 99;
}
this.U0.setVisibility(this.H2 > 0 ? 0 : 8);
this.U0.setText("" + this.H2);
TextView textView = this.V0;
if (textView != null) {
textView.setVisibility(this.H2 <= 0 ? 8 : 0);
this.V0.setText("" + this.H2);
}
}
private void Z0(final String filename, String siteTag, final S.WebBook webBook, final boolean showProgressDialog) {
TS.Book P = q50.P(filename, siteTag);
S.BookSite tsBook2Site = S.tsBook2Site(P, false);
webBook.site = tsBook2Site;
if (!tsBook2Site.ok()) {
if (!this.s2) {
o50.p2(this, q50.f0(siteTag));
}
this.u2.put(filename, 0);
o0(filename);
return;
}
S.BookSite bookSite = webBook.site;
bookSite.working = true;
S.tempTsSites.add(bookSite);
if (showProgressDialog) {
createProgressDlg(siteTag.substring(2) + "·" + o50.N0(filename), getString(R.string.zhengzaigengxinzhangjieliebiao));
}
TS.getBookInfo(P, new t0(filename, webBook, showProgressDialog));
}
public void Z1(String err) {
String str;
hideProgressDlg();
if (!this.C1) {
StringBuilder sb = new StringBuilder();
sb.append("打开失败,请在章节阅读页面重试,或长按星标键搜索");
if (o50.F1(err)) {
str = "";
} else {
str = "\n" + err;
}
sb.append(str);
o50.q2(this, sb.toString(), 1);
}
this.C1 = true;
}
private String a1(String file, String dataPath) {
if (o50.A1(file)) {
return q50.H(file);
}
ArrayList<String> C2 = o50.C2(q50.H(dataPath + "/.chapters"));
return C2.size() > 0 ? q50.d0(file, C2) : "";
}
private void a2(boolean animate) {
if (animate) {
z2.animateInfoPanel(this, this.l1, e50.L2);
} else {
this.l1.setVisibility(e50.L2 ? 0 : 8);
}
this.F1.setVisibility(e50.L2 ? 0 : 8);
this.H1.setImageResource(e50.L2 ? R.drawable.toc_up : R.drawable.toc_open);
this.H1.setColorFilter(1720223880, PorterDuff.Mode.SRC_IN);
if (e50.L2 && N0(this.l1) == null) {
this.l1.setAdapter(new j2());
}
}
public void b1() {
S.clearWebView(this.p1);
o2(false);
p1(this.n1);
this.e1.setExpanded(true, true);
}
private void b2(boolean showProgressDialog, S.WebBook book, final String filename, String info) {
if (!showProgressDialog) {
if (info != null) {
o50.s2(this, o50.N0(filename), info, 1);
return;
}
o50.p2(this, "《" + o50.N0(filename) + "》无更新");
return;
}
if (info != null) {
new m.c(this).m(book.site.name() + "·" + o50.N0(filename) + "\n\n" + info).w(getString(R.string.kaishiyd), new u0(filename)).p(getString(R.string.shaohou), null).C();
return;
}
o50.n2(this, book.site.name() + "·" + o50.N0(filename) + "\n\n《" + o50.N0(filename) + "》无更新");
}
public void c1(DownloadTaskBrowser.CacheWebView cache, boolean step) {
int i3;
if (cache == null || (i3 = cache.delayed) >= 5000) {
return;
}
int i4 = step ? i3 + 1000 : i3 * 2;
cache.delayed = i4;
if (i4 > 5000) {
cache.delayed = 5000;
}
}
public void c2(boolean visible) {
if (this.c1 == null) {
if (!visible) {
return;
}
this.c1 = ((ViewStub) findViewById(R.id.shelf_stub)).inflate();
h1();
}
this.c1.setBackgroundColor(e50.N1());
((ImageView) this.c1.findViewById(R.id.shelf_style)).setImageResource(m1() ? R.drawable.shelf_list : R.drawable.shelf_grid);
this.V1 = visible;
int i3 = visible ? 0 : 8;
if (this.c1.getVisibility() != i3) {
this.c1.setVisibility(i3);
if (!visible) {
if (this.f2.size() > 0) {
this.f2.clear();
if (this.e2) {
return;
}
p1(this.m1);
return;
}
return;
}
g2();
}
}
public void clearCachedWebViews() {
DownloadTaskBrowser.destroyAllWebViews();
}
private void createProgressDlg(String title, String info) {
ProgressDialog progressDialog = this.l2;
if (progressDialog != null) {
progressDialog.setTitle(title);
this.l2.setMessage(info);
} else {
ProgressDialog g02 = e50.g0(this, title, info, true, true);
this.l2 = g02;
g02.setOnDismissListener(new h0());
}
}
private void d0(final S.BookSite site, final String id, final String url) {
View inflate = LayoutInflater.from(this).inflate(R.layout.add_to_favorite2, (ViewGroup) null);
EditText editText = (EditText) inflate.findViewById(R.id.favEt);
editText.setSingleLine();
editText.setText(e50.i8);
inflate.findViewById(R.id.favIb).setOnClickListener(new g(editText));
new m.c(this).z(e50.W0("加入本地书架")).B(inflate).v(R.string.ok, new h(editText, site, id, url)).o(R.string.cancel, null).C();
}
private void d2(View v2) {
new com.flyersoft.components.m(this, v2, new String[]{e50.W0("检查更新"), e50.W0("书架搜索"), getString(R.string.shujiaguanli), e50.W0("书架选项")}, new o1()).A(v2);
}
private void deleteShelfSelected() {
if (this.f2.size() == 0) {
return;
}
CheckBox checkBox = new CheckBox(this);
checkBox.setTextSize(14.0f);
checkBox.setText(R.string.tongshishangchuwenjian);
new m.c(this).z(getString(R.string.quanrenyichushuji)).B(checkBox).w(getString(R.string.delete), new p(checkBox)).o(R.string.cancel, null).C();
}
public static boolean e0() {
if (e50.w2 || !e50.o5()) {
return false;
}
if (e50.Da > System.currentTimeMillis()) {
e50.Da = 0L;
}
if (System.currentTimeMillis() - e50.Ba < Constants.START_AD_INTERVAL || System.currentTimeMillis() - e50.Da < Constants.MINIMAL_AD_INTERVAL) {
return false;
}
e50.Ba = System.currentTimeMillis();
if (com.flyersoft.seekbooks.q.x()) {
e50.q7("splashTry", "MemberFree", e50.r1(), 1);
return false;
}
if (e50.Fa > System.currentTimeMillis() && e50.Fa < System.currentTimeMillis() + o50.B(100L) && com.flyersoft.seekbooks.q.d()) {
e50.q7("splashTry", "StoreChargedFree", e50.r1(), 1);
return false;
}
if (!e50.E()) {
if (e50.u4()) {
e50.q7("splashTry", "ShareFree", e50.r1(), 1);
}
return false;
}
e50.Ca = System.currentTimeMillis();
e50.q7("splashTry", "shouldShow", e50.r1(), 1);
return true;
}
public void e1() {
if (e50.F2 && !com.flyersoft.seekbooks.q.m && com.flyersoft.seekbooks.q.d() && o50.C1(this) && !com.flyersoft.seekbooks.q.z(com.flyersoft.seekbooks.q.q())) {
Long l3 = com.flyersoft.seekbooks.q.l;
if (l3 == null) {
new Thread(new d1()).start();
} else if (Math.abs(l3.longValue() - System.currentTimeMillis()) < o50.B(2L)) {
this.m2.sendEmptyMessage(u0);
}
}
}
public void e2(boolean forceHide) {
View view = this.c1;
if (view != null) {
view.setVisibility((forceHide || !this.V1) ? 8 : 0);
}
}
public boolean f0() {
return this.e1.getTop() > 0;
}
private void f1() {
this.W0.setItemIconTintList(null);
this.W0.setOnNavigationItemSelectedListener(new g0());
this.W0.setOnNavigationItemReselectedListener(new r0());
}
public void f2() {
ScrollView scrollView = new ScrollView(this);
LinearLayout linearLayout = new LinearLayout(this);
linearLayout.setOrientation(1);
linearLayout.setPadding(e50.k0(24.0f), e50.k0(24.0f), e50.k0(24.0f), e50.k0(24.0f));
boolean z2 = e50.D7;
boolean z3 = e50.E7;
boolean m12 = m1();
boolean z4 = e50.F7;
CheckBox checkBox = new CheckBox(this);
checkBox.setText(e50.W0("把最近更新的书放前面(优先)"));
checkBox.setTextSize(14.0f);
checkBox.setChecked(e50.E7);
linearLayout.addView(checkBox);
CheckBox checkBox2 = new CheckBox(this);
checkBox2.setText(e50.W0("把最近阅读的书放前面"));
checkBox2.setTextSize(14.0f);
checkBox2.setChecked(e50.D7);
linearLayout.addView(checkBox2);
View view = new View(this);
view.setBackgroundColor(-7829368);
ViewGroup.MarginLayoutParams marginLayoutParams = new ViewGroup.MarginLayoutParams(-1, 1);
int k02 = e50.k0(8.0f);
marginLayoutParams.bottomMargin = k02;
marginLayoutParams.topMargin = k02;
marginLayoutParams.leftMargin = e50.k0(8.0f);
marginLayoutParams.rightMargin = e50.k0(80.0f);
linearLayout.addView(view, marginLayoutParams);
CheckBox checkBox3 = new CheckBox(this);
StringBuilder sb = new StringBuilder();
sb.append(e50.F7 ? "当前" : "");
sb.append("书架布局使用列表模式");
checkBox3.setText(e50.W0(sb.toString()));
checkBox3.setChecked(!m12);
checkBox3.setTextSize(14.0f);
linearLayout.addView(checkBox3);
CheckBox checkBox4 = new CheckBox(this);
checkBox4.setText(e50.W0("不同书架可分别使用列表或格子模式"));
checkBox4.setTextSize(14.0f);
checkBox4.setChecked(e50.F7);
linearLayout.addView(checkBox4);
checkBox4.setOnCheckedChangeListener(new p1(checkBox3));
View view2 = new View(this);
view2.setBackgroundColor(-7829368);
linearLayout.addView(view2, marginLayoutParams);
CheckBox checkBox5 = new CheckBox(this);
checkBox5.setText(getString(R.string.zidongshizhuigeng));
checkBox5.setTextSize(14.0f);
checkBox5.setChecked(e50.Z2);
linearLayout.addView(checkBox5);
TextView textView = new TextView(this);
textView.setTextColor(-7829368);
textView.setTextSize(13.0f);
textView.setPadding(e50.k0(8.0f), e50.k0(8.0f), e50.k0(8.0f), 0);
textView.setText(Html.fromHtml(e50.W0("建议用下拉更新或再次点击书架图标代替")));
linearLayout.addView(textView);
scrollView.addView(linearLayout, -1, -2);
new m.c(this).z(e50.W0("书架设置")).B(scrollView).v(R.string.ok, new q1(checkBox5, checkBox2, checkBox, checkBox4, checkBox3, z4, m12, z2, z3)).o(R.string.cancel, null).j(true).C();
}
public void g0(final String filename) {
D0(this, this.m2, filename, new l0(filename));
}
public void g2() {
String str;
this.c1.findViewById(R.id.shelf_delete).setVisibility(this.f2.size() == 0 ? 8 : 0);
TextView textView = (TextView) this.c1.findViewById(R.id.shelf_move);
StringBuilder sb = new StringBuilder();
sb.append(getString(R.string.move));
if (this.f2.size() == 0) {
str = "";
} else {
str = " (" + this.f2.size() + ")";
}
sb.append(str);
textView.setText(sb.toString());
}
private boolean h0() {
return AccountData.checkLoginStateInBackground(true);
}
private void h1() {
this.c1.findViewById(R.id.shelf_find).setVisibility(8);
this.c1.findViewById(R.id.shelf_find).setOnClickListener(this);
this.c1.findViewById(R.id.shelf_style).setOnClickListener(this);
this.c1.findViewById(R.id.shelf_move).setOnClickListener(this);
this.c1.findViewById(R.id.shelf_delete).setOnClickListener(this);
this.c1.findViewById(R.id.shelf_all).setOnClickListener(this);
this.c1.findViewById(R.id.shelf_reverse).setOnClickListener(this);
}
private void h2() {
if (this.J2) {
return;
}
if (!this.I2) {
if (e50.o5()) {
this.J2 = true;
this.I2 = true;
new Handler(Looper.getMainLooper()).postDelayed(new s1(), 1200L);
return;
}
return;
}
i2();
}
public void i2() {
if (e50.l2 == 2) {
if (!AccountData.isLoaded().booleanValue() && e50.r2 < 10) {
this.Q0.setVisibility(8);
return;
}
if (AccountData.hasFinishTask(1, 1)) {
this.Q0.setVisibility(8);
} else {
this.Q0.setVisibility(0);
Disposable disposable = this.K2;
if (disposable != null && !disposable.isDisposed()) {
this.K2.isDisposed();
}
Observable.interval(3L, TimeUnit.SECONDS).take(20L).observeOn(AndroidSchedulers.mainThread()).subscribe(new t1());
}
this.Q0.setOnClickListener(new u1());
return;
}
this.Q0.setVisibility(8);
}
private void initView() {
this.f1 = (LayoutInflater) getSystemService("layout_inflater");
this.b1 = findViewById(R.id.base);
w2(false);
}
public void j0(View webRead, boolean addToShelf) {
if (e50.k7(this, "请注意, 优化阅读需要应用获取本地存储空间的权限以缓存书籍信息, 是否进行权限设置?")) {
S.LinkSite linkSite = (S.LinkSite) webRead.getTag();
if (linkSite != null && linkSite.primary()) {
String str = this.v1;
if (this.p1.getUrl() != null) {
str = this.p1.getUrl();
}
String O0 = O0(str, linkSite.bookPageStart, linkSite.bookPageEnd);
if (O0 == null) {
O0 = O0(str, linkSite.chapterPageStart, linkSite.chapterPageEnd);
}
if (O0 == null) {
O0 = O0(str, linkSite.contentPageStart, linkSite.contentPageEnd);
}
if (O0 == null || linkSite.chapterPageUrl == null) {
o50.p2(this, getString(R.string.duqushujibiaozhishibai));
return;
} else if (addToShelf) {
d0(linkSite, O0, str);
return;
} else {
C1(linkSite, O0, str, null);
return;
}
}
N1();
}
}
private void j1() {
boolean z2 = true;
e50.N5("-initViewPager");
ViewPager viewPager = (ViewPager) findViewById(R.id.main_viewpager);
this.K0 = viewPager;
viewPager.setAdapter(new MainActivityFragmentAdapter(getSupportFragmentManager()));
f1();
this.K0.addOnPageChangeListener(new n1());
AppBarLayout appBarLayout = this.e1;
if (!e50.w2 && !e50.m8) {
z2 = false;
}
appBarLayout.setExpanded(z2, false);
}
public void j2(final String filename, final int type) {
int indexOf = type == 1 ? e50.H2().indexOf(filename) : 0;
g50.e F = type != 2 ? null : g50.F(filename);
Snackbar.make(this.b1, Html.fromHtml("<font color=\"#ffffff\">《" + o50.N0(filename) + "》已移除</font>"), 0).setAction(getString(R.string.chexiao), new x0(type, indexOf, filename, F)).setActionTextColor(InputDeviceCompat.SOURCE_ANY).show();
}
public static boolean k2(Activity act, int result, boolean directShow, boolean showBookCover) {
View view;
if (!e0()) {
return false;
}
Intent intent = new Intent(act, (Class<?>) SplashActivity.class);
intent.putExtra("directShow", directShow);
if (Build.VERSION.SDK_INT < 21 || !showBookCover || !e50.c5 || (view = b0) == null) {
if (result != -1) {
act.startActivityForResult(intent, result);
} else {
act.startActivity(intent);
}
return true;
}
ActivityOptionsCompat makeSceneTransitionAnimation = ActivityOptionsCompat.makeSceneTransitionAnimation(act, (View) view.getParent(), act.getString(R.string.transitions_name));
intent.putExtra("showBookCover", true);
if (result != -1) {
act.startActivityForResult(intent, result, makeSceneTransitionAnimation.toBundle());
} else {
act.startActivity(intent, makeSceneTransitionAnimation.toBundle());
}
return true;
}
private boolean l1() {
if (Build.VERSION.SDK_INT < 23 || !e50.w2) {
return true;
}
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
if (checkSelfPermission("android.permission.READ_PHONE_STATE") != 0) {
arrayList2.add("android.permission.READ_PHONE_STATE");
arrayList.add("○ 手机: 读取手机状态以搜索书籍");
}
if (checkSelfPermission("android.permission.WRITE_EXTERNAL_STORAGE") != 0) {
arrayList2.add("android.permission.WRITE_EXTERNAL_STORAGE");
arrayList.add("○ 存储空间: 缓存书籍相关文件");
}
if (arrayList2.size() == 0) {
return true;
}
Iterator it = arrayList.iterator();
String str = "<br>请注意, 运行应用需要授予以下权限:<br><font color=\"#009689\">";
while (it.hasNext()) {
str = str + "<br>" + ((String) it.next());
}
new m.c(this).m(Html.fromHtml(str + "</font>")).d(false).w(e50.W0("知道了"), new j0(arrayList2)).C();
return false;
}
public void l2() {
this.S0.setVisibility(e50.l2 == 2 ? 0 : 8);
this.O0.setVisibility((e50.l2 == 0 && this.s2) ? 0 : 8);
Y1();
h2();
}
private void m0() {
ActivityMain activityMain = f;
if (activityMain == null || activityMain == e) {
return;
}
try {
activityMain.finish();
f = null;
} catch (Exception e3) {
e50.S0(e3);
}
}
public void m2(boolean visible) {
View view = this.d1;
if (view != null) {
view.setVisibility(visible ? 0 : 8);
}
}
public void moveBooksToShelf(String toShelf) {
String trim = toShelf.trim();
if (o50.F1(trim)) {
return;
}
if (trim.equals(e50.A3().get(e50.j8))) {
o50.o2(this, getString(R.string.weiyidong), getString(R.string.yuyuanshujiaxiangtong));
return;
}
g50.C0(this.f2, trim);
Iterator<g50.e> it = this.f2.iterator();
while (it.hasNext()) {
W0().remove(it.next());
}
this.f2.clear();
g2();
o50.p2(this, getString(R.string.yiyidongdao) + trim);
e50.s(trim);
i1(false);
}
private void moveShelfSelected() {
if (this.f2.size() == 0) {
return;
}
String[] strArr = (String[]) e50.A3().toArray(new String[e50.A3().size()]);
new m.c(this).z(getString(R.string.yidongdao)).x(strArr, 0, null).w(getString(R.string.move), new r(strArr)).o(R.string.cancel, null).r(getString(R.string.xinjianshujia), new q()).C();
}
public void n0() {
int i3 = u2(true) ? 50 : 0;
X0().setRefreshing(true);
this.m2.postDelayed(new j1(), i3);
}
public void n2(String url) {
String str;
String str2;
if (o50.F1(url)) {
return;
}
String pureUrl = S.getPureUrl(url);
S.initLinkSiteParams();
S.LinkSite linkSite = null;
Iterator<S.LinkSite> it = S.getLinkSites().iterator();
while (it.hasNext()) {
S.LinkSite next = it.next();
String str3 = next.bookPageStart;
if ((str3 != null && pureUrl.startsWith(str3) && (o50.F1(next.bookPageEnd) || pureUrl.contains(next.bookPageEnd))) || (((str = next.chapterPageStart) != null && pureUrl.startsWith(str) && (o50.F1(next.chapterPageEnd) || pureUrl.contains(next.chapterPageEnd))) || ((str2 = next.contentPageStart) != null && pureUrl.startsWith(str2) && (o50.F1(next.contentPageEnd) || pureUrl.contains(next.contentPageEnd))))) {
linkSite = next;
break;
}
}
this.t1.setTag(linkSite);
this.t1.setVisibility(linkSite != null ? 0 : 4);
this.t1.setText(getString((linkSite == null || !linkSite.primary()) ? R.string.search_books2 : R.string.youhua_yd2));
}
public void o0(String lastFile) {
if (isFinishing()) {
return;
}
this.w2.remove(lastFile);
q1(lastFile);
if (!o50.G1(this.r2)) {
String str = this.r2.get(0);
this.r2.remove(0);
Handler handler = this.m2;
handler.sendMessageDelayed(handler.obtainMessage(1020, str), 200L);
this.u2.put(str, 1);
q1(str);
return;
}
if (this.s2 && !S.sitesWorking() && this.w2.size() == 0) {
this.s2 = false;
l2();
boolean z2 = false;
for (String str2 : e50.Ma.keySet()) {
if (this.u2.containsKey(str2) && this.u2.get(str2).intValue() == 2) {
z2 = true;
}
if (this.v2.containsKey(str2)) {
z2 = true;
}
}
if (!z2) {
o50.p2(this, getString(R.string.zhuishuwugengxin));
}
clearCachedWebViews();
this.r2.clear();
this.w2.clear();
S.tempTsSites.clear();
e50.N5("=======================updateAllFollows end======================");
}
}
public void o1(String key) {
Intent intent = new Intent(this, (Class<?>) ShelfManageAct.class);
if (!o50.F1(key)) {
intent.putExtra("key", key);
}
startActivityForResult(intent, 102);
}
private void o2(boolean webVisible) {
if (this.d1 == null) {
View inflate = ((ViewStub) findViewById(R.id.discovery_stub)).inflate();
this.d1 = inflate;
this.q1 = inflate.findViewById(R.id.progress2);
this.u1 = (ImageView) this.d1.findViewById(R.id.favorite);
this.t1 = (TextView) this.d1.findViewById(R.id.read2);
this.q1.setVisibility(8);
T1();
}
if (e50.l2 == 1) {
this.n1.setVisibility(webVisible ? 4 : 0);
this.r1.setVisibility(webVisible ? 0 : 4);
if (webVisible) {
Constants.createNativeAd(this, this.m2, this.s1, Constants.WebBannerID, false);
}
String str = this.Z0;
if (str != null) {
n1(str, null);
}
}
m2(webVisible);
}
private void p0() {
if (this.p1 != null) {
return;
}
StoreWebView storeWebView = new StoreWebView((Activity) this, (StoreWebView.e) new b(), (WebChromeClient) new S.NormalChromeClient(), this.m2);
this.p1 = storeWebView;
storeWebView.setDownloadListener(new c());
this.p1.getSettings().setCacheMode(-1);
this.r1.addView(this.p1, -1, -1);
}
public ViewGroup p2(boolean forceRefresh) {
if (this.h1 == null) {
ViewGroup viewGroup = (ViewGroup) this.f1.inflate(R.layout.main_dash, this.g1, false);
this.h1 = viewGroup;
viewGroup.setBackgroundColor(com.flyersoft.discuss.z.getItemBackColor());
RecyclerView recyclerView = (RecyclerView) this.h1.findViewById(R.id.rv);
this.k1 = recyclerView;
recyclerView.setLayoutManager(new LinearLayoutManager(this, 1, false));
}
ViewGroup viewGroup2 = this.N1;
if (viewGroup2 != null && e50.l2 == 3) {
viewGroup2.requestFocus();
}
if (forceRefresh || e50.l2 == 3) {
q0();
}
return this.h1;
}
private void q0() {
if (this.k1.getAdapter() != null) {
return;
}
this.k1.setBackgroundColor(com.flyersoft.discuss.z.getToolbarBackColor());
this.k1.setAdapter(new c2());
}
private void q1(String filename) {
g50.e eVar;
l2 l2Var = (l2) this.m1.getAdapter();
Iterator<n2> it = l2Var.e.iterator();
while (it.hasNext()) {
n2 next = it.next();
if (next != null && (eVar = next.b) != null && eVar.b.equals(filename)) {
l2Var.onBindViewHolder(next, next.a);
return;
}
}
}
public ViewGroup q2(boolean forceRefresh) {
String str;
if (this.j1 == null) {
ViewGroup viewGroup = (ViewGroup) this.f1.inflate(R.layout.main_discovery, this.g1, false);
this.j1 = viewGroup;
viewGroup.setBackgroundColor(com.flyersoft.discuss.z.getItemBackColor());
RecyclerView recyclerView = (RecyclerView) this.j1.findViewById(R.id.rv);
this.n1 = recyclerView;
recyclerView.setLayoutManager(new LinearLayoutManager(this, 1, false));
this.r1 = (ViewGroup) this.j1.findViewById(R.id.webLay);
this.s1 = (ViewGroup) this.j1.findViewById(R.id.adLay);
}
if ((forceRefresh || e50.l2 == 1) && !s0() && this.r1.getVisibility() == 0 && (str = this.v1) != null) {
n2(str);
}
return this.j1;
}
public void r0() {
this.n1.setAdapter(new e2());
y2();
}
private void r1(boolean notifyAll) {
this.m2.removeMessages(1021);
Handler handler = this.m2;
handler.sendMessageDelayed(handler.obtainMessage(1021, Boolean.valueOf(notifyAll)), 50L);
}
public ViewGroup r2(boolean forceRefresh) {
if (this.i1 == null) {
ViewGroup viewGroup = (ViewGroup) this.f1.inflate(R.layout.main_shelf, this.g1, false);
this.i1 = viewGroup;
viewGroup.setBackgroundColor(com.flyersoft.discuss.z.getItemBackColor());
this.i1.findViewById(R.id.topLay).setBackgroundColor(com.flyersoft.discuss.z.getToolbarBackColor());
}
if (forceRefresh || e50.l2 == 0) {
if (!forceRefresh && this.A2 != null) {
if (this.s2) {
p1(this.m1);
}
} else {
i1(true);
}
}
return this.i1;
}
private boolean s0() {
if (this.n1.getAdapter() != null) {
return false;
}
S.forceInitAllLinkSites();
if (this.n1.getTag() == null) {
this.n1.setTag(1);
this.n1.addItemDecoration(new y1());
}
this.n1.setBackgroundColor(com.flyersoft.discuss.z.getListBackColor());
if (S.inited) {
r0();
} else {
this.m2.sendEmptyMessageDelayed(1015, 50L);
}
o2(this.Z0 != null);
return true;
}
public View s2(int position, boolean forceRefresh) {
if (this.G2 == null) {
return null;
}
View view = this.D2.get(position);
if (view == null) {
view = this.f1.inflate(R.layout.main_shelf_sub, this.G2, false);
view.setBackgroundColor(com.flyersoft.discuss.z.getItemBackColor());
PullRefreshLayout pullRefreshLayout = (PullRefreshLayout) view.findViewById(R.id.pullRefreshLayout);
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.rv);
this.D2.put(position, view);
this.E2.put(position, pullRefreshLayout);
this.F2.put(position, recyclerView);
this.G2.addView(view, 0);
pullRefreshLayout.setColor(getResources().getColor(R.color.base_color));
pullRefreshLayout.setOnRefreshListener(new h1());
}
if (forceRefresh || e50.j8 == position) {
boolean t02 = t0(position, false);
RecyclerView recyclerView2 = this.F2.get(position);
this.m1 = recyclerView2;
if (!t02 && this.s2) {
p1(recyclerView2);
}
if (e50.Z2 && !this.n2) {
this.m2.sendEmptyMessageDelayed(1013, 200L);
}
}
return view;
}
private boolean t0(int position, boolean forceUpdate) {
RecyclerView recyclerView = this.F2.get(position);
if (recyclerView == null) {
return false;
}
if (!forceUpdate && recyclerView.getAdapter() != null) {
return false;
}
c2(false);
recyclerView.setBackgroundColor(com.flyersoft.discuss.z.getItemBackColor());
this.W1 = e50.u3() / e50.k0(98.0f);
int i3 = e50.o8 ? e50.g5() ? 6 : 4 : e50.g5() ? 5 : 3;
if (this.W1 > i3) {
this.W1 = i3;
}
this.X1 = e50.u3() / this.W1;
if (m1()) {
recyclerView.setLayoutManager(new GridLayoutManager((Context) this, this.W1, 1, false));
} else {
recyclerView.setLayoutManager(new LinearLayoutManager(this, 1, false));
}
recyclerView.addItemDecoration(new k1());
recyclerView.addOnScrollListener(new l1(recyclerView));
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(new m2());
this.c2 = itemTouchHelper;
itemTouchHelper.attachToRecyclerView(recyclerView);
recyclerView.setOnTouchListener(new m1());
l2 l2Var = new l2(position);
recyclerView.setAdapter(l2Var);
int i4 = e50.w7;
if (i4 > 0 && i4 < l2Var.b.size()) {
recyclerView.getLayoutManager().scrollToPosition(e50.w7);
}
return true;
}
private void t1() {
l1();
initView();
if (W1()) {
long currentTimeMillis = System.currentTimeMillis();
e50.Da = currentTimeMillis;
e50.Ba = currentTimeMillis;
this.z2 = true;
IntroActivity.start(this, B0);
}
d1();
}
public void t2(g50.e bi) {
if (this.f2.contains(bi)) {
this.f2.remove(bi);
} else {
this.f2.add(bi);
}
if (this.f2.size() == 0) {
c2(false);
} else {
g2();
}
p1(this.m1);
}
public void u0() {
}
public void u1(String filename, ArrayList<S.WebChapter> chapters, S.WebBook book, boolean showProgressDialog) {
boolean z2;
int i3;
StringBuilder sb;
if (showProgressDialog) {
hideProgressDlg();
}
book.site.working = false;
if (!o50.G1(chapters)) {
String H = q50.H(filename);
if (!o50.F1(H)) {
if (H.equals(book.site.siteTag)) {
i3 = chapters.size() - o50.C2(q50.H(o50.n0(filename) + com.ksdk.ssds.manager.b.b + H + "/.chapters")).size();
z2 = false;
if (i3 > 0) {
}
q50.X(book, z2);
this.u2.put(filename, 2);
L1(filename, i3);
StringBuilder sb2 = new StringBuilder();
if (i3 > 0) {
}
sb.append(i3);
sb2.append(sb.toString());
sb2.append("章, 最新: ");
sb2.append(chapters.get(chapters.size() - 1).name);
b2(showProgressDialog, book, filename, e50.W0(sb2.toString()));
o0(filename);
}
z2 = true;
i3 = 0;
if (i3 > 0 && !z2) {
this.u2.put(filename, 0);
if (this.t2) {
b2(showProgressDialog, book, filename, null);
}
} else {
q50.X(book, z2);
this.u2.put(filename, 2);
L1(filename, i3);
StringBuilder sb22 = new StringBuilder();
if (i3 > 0) {
sb = new StringBuilder();
sb.append("本次新增");
} else {
sb = new StringBuilder();
sb.append("共");
i3 = chapters.size();
}
sb.append(i3);
sb22.append(sb.toString());
sb22.append("章, 最新: ");
sb22.append(chapters.get(chapters.size() - 1).name);
b2(showProgressDialog, book, filename, e50.W0(sb22.toString()));
}
o0(filename);
}
}
z2 = false;
i3 = 0;
if (i3 > 0) {
}
q50.X(book, z2);
this.u2.put(filename, 2);
L1(filename, i3);
StringBuilder sb222 = new StringBuilder();
if (i3 > 0) {
}
sb.append(i3);
sb222.append(sb.toString());
sb222.append("章, 最新: ");
sb222.append(chapters.get(chapters.size() - 1).name);
b2(showProgressDialog, book, filename, e50.W0(sb222.toString()));
o0(filename);
}
public boolean u2(boolean showTip) {
if (!S.inited) {
return false;
}
ArrayList arrayList = new ArrayList();
Iterator<g50.e> it = W0().iterator();
while (it.hasNext()) {
g50.e next = it.next();
if (e50.D5(next.b) && !e50.D2().contains(next.b) && !this.r2.contains(next.b) && !e50.A4(next.b)) {
arrayList.add(next.b);
}
}
if (arrayList.size() == 0) {
if (showTip) {
o50.p2(this, e50.W0(e50.A3().get(e50.j8) + "没有需要现在更新的书籍"));
}
return false;
}
this.m1.setTag(1);
S.resetSiteStates();
this.r2.addAll(arrayList);
int i3 = 0;
while (arrayList.size() > 0 && i3 < e50.k8) {
String str = (String) arrayList.get(0);
e50.D(str);
arrayList.remove(0);
this.r2.remove(str);
Handler handler = this.m2;
handler.sendMessageDelayed(handler.obtainMessage(1020, str), (i3 * 200) + 200);
i3++;
this.s2 = true;
this.t2 = false;
this.u2.put(str, 1);
q1(str);
}
return true;
}
public static void v0(final Activity act, Object obj) {
if (obj == null) {
return;
}
String str = (String) obj;
if (o50.o0(str) < 2000) {
new m.c(act).z(e50.W0("书籍文件可能未下载成功")).m(e50.W0("监测到书籍文件可能已损坏, 建议选择其它下载地址重新下载")).w(e50.W0("尝试打开"), new y0(act, str)).p(e50.W0("重选其它下载地址"), null).d(false).C();
return;
}
new m.c(act).z(act.getString(R.string.xiazaiwancheng)).m("\n" + o50.v0(str)).w(str.endsWith(".apk") ? "安装应用" : act.getString(R.string.kaishiyd), new a1(act, str)).o(R.string.cancel, null).r(str.endsWith(".apk") ? "" : act.getString(R.string.add_to_shelf), new z0(act, str)).d(false).C();
}
public static void v1(Activity act, String filename) {
w1(act, filename, 0, true);
}
public void v2(String url) {
this.v1 = url;
this.u1.setImageResource(S.favLinkId(url) != -1 ? R.drawable.ic_menu_star2 : R.drawable.ic_menu_star);
}
private void w0() {
this.m2.removeMessages(1005);
finish();
e = f;
}
public static void w1(final Activity act, final String filename, final int requestCode, boolean showAlert) {
if (e50.k7(e, "请注意, 阅读书籍需要应用获取本地存储空间的权限以读取书籍信息, 是否进行权限设置?")) {
String substring = filename.indexOf("?") != -1 ? filename.substring(0, filename.indexOf("?")) : filename;
if (!o50.A1(substring)) {
o50.o2(act, act.getString(R.string.error), act.getString(R.string.filename) + " \"" + substring + "\" " + act.getString(R.string.not_exists));
return;
}
if (!e50.z5(filename)) {
String i3 = com.flyersoft.components.a.i(filename);
if (e50.e5(o50.k0(i3))) {
Intent intent = new Intent(act, (Class<?>) PicGalleryShow.class);
intent.putExtra("imageFile", filename);
act.startActivity(intent);
return;
} else {
if (!e50.l5(o50.H0(i3))) {
if (showAlert) {
new m.c(act).y(R.string.app_name).l(R.string.unknow_book_hint).v(R.string.text_mode, new f0(act, filename, requestCode)).o(R.string.system_applications, new e0(act, i3)).C();
return;
} else {
x1(act, filename, requestCode);
return;
}
}
if (showAlert) {
o50.Y1(act, i3);
return;
} else if (o50.H0(i3).startsWith("text")) {
x1(act, filename, requestCode);
return;
} else {
o50.Y1(act, i3);
return;
}
}
}
x1(act, filename, requestCode);
}
}
private void w2(boolean updateList) {
e50.N6(this, e50.M2);
getWindow().addFlags(Integer.MIN_VALUE);
getWindow().setStatusBarColor(com.flyersoft.discuss.z.getStatusBarBackColor());
getWindow().setNavigationBarColor(ViewCompat.MEASURED_STATE_MASK);
this.L0.setBackgroundColor(com.flyersoft.discuss.z.getToolbarBackColor());
this.W0.setBackgroundColor(com.flyersoft.discuss.z.getToolbarBackColor());
View view = this.N0;
boolean z2 = e50.M2;
int i3 = R.drawable.background_home_tallbar_search_night;
view.setBackgroundResource(z2 ? R.drawable.background_home_tallbar_search_night : R.drawable.background_home_tallbar_search);
ImageView imageView = this.S0;
if (!e50.M2) {
i3 = R.drawable.background_home_tallbar_search;
}
imageView.setBackgroundResource(i3);
this.T0.setImageResource(e50.M2 ? R.drawable.toolbar_day : R.drawable.toolbar_night);
if (updateList) {
if (this.K0 == null) {
R1(e50.l2);
return;
}
ViewGroup viewGroup = this.i1;
if (viewGroup != null) {
viewGroup.setBackgroundColor(com.flyersoft.discuss.z.getItemBackColor());
this.i1.findViewById(R.id.topLay).setBackgroundColor(com.flyersoft.discuss.z.getToolbarBackColor());
i1(false);
}
ViewGroup viewGroup2 = this.j1;
if (viewGroup2 != null) {
viewGroup2.setBackgroundColor(com.flyersoft.discuss.z.getListBackColor());
}
ViewGroup viewGroup3 = this.h1;
if (viewGroup3 != null) {
viewGroup3.setBackgroundColor(com.flyersoft.discuss.z.getToolbarBackColor());
}
l0(this.k1);
l0(this.n1);
x2(e50.l2, true);
}
}
public static void x1(Activity act, String filename, int requestCode) {
if (e50.k7(e, "请注意, 阅读书籍需要应用获取本地存储空间的权限以读取书籍信息, 是否进行权限设置?")) {
e50.s6("before open book:");
e50.S(false);
if (!(act instanceof ActivityMain)) {
WB.notifyRecentListChanged(filename);
}
d0 = e50.V1;
int B2 = e50.B2(filename);
if (B2 != 11 && B2 != 10) {
o50.b = false;
Intent intent = new Intent(act, (Class<?>) ActivityTxt.class);
intent.putExtra("bookFile", filename);
if (c0) {
intent.putExtra("noad", true);
}
if (e50.c5 && b0 != null && Build.VERSION.SDK_INT >= 21) {
ActivityOptionsCompat makeSceneTransitionAnimation = ActivityOptionsCompat.makeSceneTransitionAnimation(act, b0, act.getString(R.string.transitions_name));
intent.putExtra("hasActTrans", true);
act.startActivityForResult(intent, requestCode, makeSceneTransitionAnimation.toBundle());
} else {
act.startActivityForResult(intent, requestCode);
}
if (!o50.D1(e)) {
e.H1(e50.V1);
}
e50.f6(filename);
e0 = false;
return;
}
Intent intent2 = new Intent(act, (Class<?>) PicGalleryShow.class);
intent2.putExtra("imageFile", filename);
act.startActivityForResult(intent2, 0);
}
}
private void y0() {
this.S1 = true;
e = this;
o50.c = false;
a0 = false;
e50.t3(this);
this.Q1 = false;
if (e50.sa) {
e50.sa = false;
w2(this.K0 != null);
}
this.m2.sendEmptyMessageDelayed(1019, 500L);
i0();
}
public void y1() {
startActivityForResult(new Intent(this, (Class<?>) SelectFileAct.class), 101);
}
public void A0(DownloadTask.Result result) {
S.WebBook webBook = result.taskBook;
String str = result.siteTag;
String str2 = result.filename;
webBook.site.last_url = result.final_url;
if (o50.F1(webBook.description) && !o50.F1(result.description)) {
webBook.description = result.description;
}
ArrayList<S.WebChapter> chapterList = S.getChapterList(result.html, webBook.site);
e50.N5("doOnTaskFinish: " + webBook.name + " " + chapterList.size());
if (chapterList.size() == 1 && chapterList.get(0).name.equals(S.CHAPTER_URL_TAG) && !chapterList.get(0).url.equals(result.url)) {
x0(str2, str, chapterList.get(0).url, false, 0, result.showProgressDialog, webBook);
return;
}
if (!S.sameChapterList(webBook.chapters, chapterList)) {
webBook.chapters.addAll(chapterList);
}
ArrayList<S.WebChapter> arrayList = webBook.chapters;
if (!o50.F1(webBook.site.nextChapterTag)) {
webBook.loadedUrls.add(result.url);
String nextChapterUrl = S.getNextChapterUrl(result.html, webBook.site, webBook.loadedUrls);
if (!o50.F1(nextChapterUrl)) {
e50.N5("*hasNextChapterUrl: " + nextChapterUrl, Integer.valueOf(arrayList.size()));
x0(str2, str, nextChapterUrl, false, 0, result.showProgressDialog, webBook);
return;
}
S.deleteDuplicatedChapters(arrayList);
}
u1(str2, arrayList, webBook, result.showProgressDialog);
}
public void E0() {
ClearableEditText clearableEditText = new ClearableEditText(this);
clearableEditText.setText(e50.O7);
clearableEditText.setSingleLine();
new m.c(this).z(e50.W0("搜索全部书架")).B(clearableEditText).v(R.string.ok, new d0(clearableEditText)).o(R.string.cancel, null).C();
}
public void H0() {
e1 e1Var = new e1();
e1Var.setPriority(1);
e1Var.start();
}
public boolean H1(String filename) {
HashMap<String, Integer> hashMap = this.u2;
if (hashMap != null && hashMap.containsKey(filename)) {
this.u2.remove(filename);
}
HashMap<String, Integer> hashMap2 = this.v2;
if (hashMap2 == null || !hashMap2.containsKey(filename)) {
return false;
}
this.v2.remove(filename);
getSharedPreferences("newfollows", 0).edit().remove(filename).apply();
return true;
}
protected void I0(String fullname, g50.e bi) {
String N0;
if (bi == null && !o50.B1(fullname) && e50.u5(fullname) && (bi = g50.F(fullname)) == null) {
bi = g50.i("", fullname, false);
}
if (bi != null) {
N0 = bi.a + " " + bi.c;
} else {
N0 = o50.N0(fullname);
}
String trim = N0.replace('_', ' ').replace(n63.b, ' ').replace("(TXT)", "").replace("(HTM)", "").replace("(HTML)", "").replace("(PDF)", "").trim();
new com.flyersoft.seekbooks.b(this, new w0(), e50.T1(fullname) + e50.la, trim, 0, true).show();
}
public void J1(Context con) {
this.L2 = con;
WebService.Companion companion = WebService.Companion;
if (!companion.isRun()) {
companion.start(this, this);
} else {
companion.stop(this);
}
}
void L1(String filename, int updated) {
if (this.v2.containsKey(filename)) {
updated += this.v2.get(filename).intValue();
}
this.v2.put(filename, Integer.valueOf(updated));
getSharedPreferences("newfollows", 0).edit().putInt(filename, updated).apply();
}
public void M0() {
this.m2.sendEmptyMessageDelayed(E0, 100L);
}
void M1(int style) {
getSharedPreferences("shelf_style", 0).edit().putInt(e50.A3().get(e50.j8), style).apply();
}
protected RecyclerView.Adapter N0(RecyclerView rv) {
if (rv == null) {
return null;
}
return rv.getAdapter();
}
int Q0() {
List<DiscoveryBean> list = this.o1;
if (list == null) {
return 0;
}
return list.size();
}
public String R0() {
String substring;
String str;
String dataString = getIntent().getDataString();
if (dataString == null) {
return null;
}
if (dataString.startsWith(rv.a)) {
return dataString;
}
if (dataString.startsWith("files://")) {
substring = dataString.substring(8);
} else if (dataString.startsWith("file://")) {
substring = dataString.substring(7);
} else if (dataString.startsWith(com.ksdk.ssds.manager.b.d)) {
substring = dataString.substring(10);
} else {
int indexOf = dataString.indexOf("/sdcard/");
substring = indexOf > 0 ? dataString.substring(indexOf) : null;
}
if (substring == null) {
return null;
}
if (substring.startsWith("//")) {
substring = substring.substring(1);
}
String decode = Uri.decode(substring);
if (o50.A1(decode)) {
return decode;
}
Uri data = getIntent().getData();
try {
InputStream openInputStream = getContentResolver().openInputStream(data);
String f02 = o50.f0(getContentResolver(), data);
if (f02 != null && f02.contains(".")) {
str = e50.u + "/attachments/" + f02;
if (!o50.t1(openInputStream, str)) {
return null;
}
return str;
}
byte[] b3 = o50.b(openInputStream);
String u02 = o50.u0(o50.w1(o50.a(b3), "UTF-8", 2));
String k02 = o50.k0(dataString);
String v02 = o50.v0(dataString);
if (o50.F1(v02)) {
v02 = "" + System.currentTimeMillis();
}
String str2 = v02 + u02;
if (k02.length() > 0 && k02.length() < 6 && k02.indexOf(com.ksdk.ssds.manager.b.b) == -1 && u02.equals(k02)) {
str2 = o50.v0(dataString);
}
str = e50.u + "/attachments/" + str2;
o50.t1(o50.a(b3), str);
return str;
} catch (Throwable th) {
e50.S0(th);
return null;
}
}
public void R1(int tab) {
if (this.K0 == null) {
j1();
}
I0 = System.currentTimeMillis();
this.K0.setCurrentItem(tab);
BottomNavigationView bottomNavigationView = this.W0;
bottomNavigationView.setSelectedItemId(bottomNavigationView.getMenu().getItem(tab).getItemId());
}
public void T0() {
com.flyersoft.discuss.z.getNewMessage(new r1());
}
public f50 V0(String filename) {
f50 f50Var;
if (filename.equals(this.N2) && (f50Var = this.M2) != null) {
return f50Var;
}
this.N2 = filename;
f50 o2 = e50.o2(filename);
this.M2 = o2;
return o2;
}
int Y0(String shelf) {
return getSharedPreferences("shelf_style", 0).getInt(shelf, e50.Q5);
}
@Override
@h43
public ReturnData addShelf(String name) {
ReturnData returnData = new ReturnData();
if (name.length() > 0 && !e50.A3().contains(name)) {
e50.s(name);
WB.notifyShelfListChanged();
returnData.setData("已添加");
} else {
returnData.setErrorMsg("书架名称输入有误,新建失败。。。");
}
return returnData;
}
@Override
@h43
public ReturnData batch(String action, String parame, String urls) {
ReturnData returnData = new ReturnData();
List<String> jsonToList = JsonUtils.jsonToList(urls, String.class);
if (jsonToList != null) {
if ("group".equals(action)) {
SourceController.getInstance().groupSourceByUrl(parame, jsonToList);
} else if ("sort".equals(action)) {
SourceController.getInstance().sortSourceByUrl(jsonToList);
} else if ("del".equals(action)) {
SourceController.getInstance().deleteSourceByUrl(jsonToList);
} else if ("enable".equals(action)) {
SourceController.getInstance().enableSourceByUrl(true, jsonToList);
} else if ("disable".equals(action)) {
SourceController.getInstance().enableSourceByUrl(false, jsonToList);
}
returnData.setData("操作成功");
} else {
returnData.setErrorMsg("数据有误,无法完成操作");
}
return returnData;
}
public void d1() {
if (!this.Y0 && com.flyersoft.discuss.z.privacyOk) {
this.Y0 = true;
if (!G0() || e50.v2) {
A1();
}
S.initAllSitesInThread();
this.m2.sendEmptyMessageDelayed(1022, 500L);
this.T1 = true;
if (this.R1 && !this.S1) {
y0();
}
BoardControler.init(this);
l2();
}
}
@Override
@h43
public ReturnData delFile(String json) {
ReturnData returnData = new ReturnData();
g50.e eVar = (g50.e) JsonUtils.gsonToObject(json, g50.e.class);
if (eVar != null) {
SelectFileAct.deleteSingeBook(this, eVar.b, false, null);
g50.p(eVar);
WB.notifyShelfListChanged();
returnData.setData("已删除");
} else {
returnData.setErrorMsg("数据有误,无法删除");
}
return returnData;
}
@Override
@h43
public ReturnData delSource(String bookSourceUrl) {
ReturnData returnData = new ReturnData();
if (StringTools.isNotEmpty(bookSourceUrl)) {
SourceController.getInstance().deleteSourceById(bookSourceUrl);
returnData.setData("已删除");
} else {
returnData.setErrorMsg("数据有误,无法删除");
}
return returnData;
}
@Override
@h43
public ReturnData editor(String source) {
ReturnData returnData = new ReturnData();
BookSource bookSource = (BookSource) JsonUtils.gsonToObject(source, BookSource.class);
if (bookSource != null) {
SourceController.getInstance().insertOrReplace(bookSource);
returnData.setData("编辑成功");
} else {
returnData.setErrorMsg("数据有误,无法保存");
}
return returnData;
}
@Override
@h43
public ReturnData enableBookSource(String json) {
ReturnData returnData = new ReturnData();
BookSource bookSource = (BookSource) JsonUtils.gsonToObject(json, BookSource.class);
if (bookSource != null) {
SourceController.getInstance().insertOrReplace(bookSource);
returnData.setData("操作成功");
} else {
returnData.setErrorMsg("数据有误,无法操作");
}
return returnData;
}
void g1() {
if (this.v2 == null) {
this.u2 = new HashMap<>();
this.v2 = new HashMap<>();
SharedPreferences sharedPreferences = getSharedPreferences("newfollows", 0);
for (String str : sharedPreferences.getAll().keySet()) {
int i3 = sharedPreferences.getInt(str, 0);
if (i3 > 0) {
this.v2.put(str, Integer.valueOf(i3));
}
}
}
}
@Override
@h43
public ReturnData getBookSource() {
ReturnData returnData = new ReturnData();
ArrayList arrayList = new ArrayList();
BookSourceAll bookSourceAll = new BookSourceAll();
bookSourceAll.setName("网络书源");
bookSourceAll.setList(SourceController.getInstance().getAll());
arrayList.add(bookSourceAll);
returnData.setData(arrayList);
return returnData;
}
@Override
public ReturnData getChapterList(String filename) {
ReturnData returnData = new ReturnData();
if (!o50.A1(filename)) {
return returnData.setErrorMsg("书籍文件不存在");
}
if (e50.H1(filename) != 100) {
returnData.setErrorMsg("不支持该文件类型的在线阅读");
} else {
f50 V0 = V0(filename);
if (V0 != null) {
try {
int C1 = e50.C1(filename);
ChapterResponse chapterResponse = new ChapterResponse();
chapterResponse.setLastChapter(C1);
Iterator<f50.e> it = V0.h().iterator();
while (it.hasNext()) {
f50.e next = it.next();
chapterResponse.add(next.c, next.h);
}
returnData.setData(chapterResponse);
} catch (Exception unused) {
returnData.setErrorMsg("服务器数据有误");
}
} else {
returnData.setErrorMsg("暂不支持该文件的在线阅读");
}
}
return returnData;
}
@Override
@h43
public ReturnData getDevices() {
ReturnData returnData = new ReturnData();
DevicesInfo devicesInfo = new DevicesInfo();
Locale locale = Locale.getDefault();
devicesInfo.setLanguage(locale.getLanguage() + "-" + locale.getCountry());
devicesInfo.setVersionName(e50.m4());
devicesInfo.setVersionCode(e50.r1());
returnData.setData(devicesInfo);
return returnData;
}
@Override
@h43
public void getEBookChapterText(String filename, int chapterId, RequestCallback callback) {
ReturnData returnData = new ReturnData();
if (!o50.A1(filename)) {
returnData.setErrorMsg("书籍文件不存在");
} else if (e50.H1(filename) != 100) {
returnData.setErrorMsg("不支持该文件类型的在线阅读");
} else {
f50 V0 = V0(filename);
if (V0 != null) {
String g3 = V0.g(chapterId);
if (V0 instanceof q50) {
if (q50.U(V0.h().get(chapterId), g3, true)) {
ChapterDownloadService.f(V0, chapterId, callback);
} else {
returnData.setData(g3);
callback.call(returnData);
}
if (chapterId < V0.h().size() - 1) {
int i3 = chapterId + 1;
if (q50.U(V0.h().get(i3), V0.g(i3), true)) {
ChapterDownloadService.f(V0, i3, null);
}
}
} else if (V0 instanceof j50) {
String str = V0.h().get(chapterId).u;
String str2 = e50.x + "/tmp.css";
o50.i2(str2, str);
returnData.setData(g3 + "&flysorft&" + str2);
callback.call(returnData);
} else {
returnData.setData(g3);
callback.call(returnData);
}
} else {
returnData.setErrorMsg("不支持该文件类型的在线阅读");
callback.call(returnData);
}
}
if (chapterId != e50.C1(filename)) {
e50.o6(filename, chapterId, -1);
}
}
@Override
@h43
public FileInputStream getEBookSource(String filename, String sourceName) {
if (this.M2 == null) {
return null;
}
e50.N5("##" + sourceName, filename);
if (StringTools.isEmpty(sourceName)) {
return null;
}
try {
String f3 = this.M2.f(Uri.fromFile(new File(sourceName)));
if (f3 == null) {
return null;
}
File file = new File(f3);
if (file.exists()) {
return new FileInputStream(ParcelFileDescriptor.open(file, 268435456).getFileDescriptor());
}
return null;
} catch (Exception unused) {
return null;
}
}
public void hideProgressDlg() {
ProgressDialog progressDialog = this.l2;
if (progressDialog != null) {
progressDialog.dismiss();
}
this.l2 = null;
}
public void i0() {
if (this.U1 == null) {
this.m2.sendEmptyMessageDelayed(C0, 50L);
}
}
public void i1(boolean animate) {
g1();
e50.n0();
this.A2 = (ViewPager) this.i1.findViewById(R.id.shelf_pager);
this.B2 = (TabLayout) this.i1.findViewById(R.id.shelf_tab);
View findViewById = this.i1.findViewById(R.id.shelf_option);
this.C2 = findViewById;
findViewById.setOnClickListener(this);
this.B2.setSelectedTabIndicatorWidth(e50.k0(10.0f));
this.B2.setSelectedTabIndicatorHeight(e50.k0(2.0f));
this.B2.setNeedSwitchAnimation(true);
this.D2.clear();
this.E2.clear();
this.F2.clear();
this.A2.setAdapter(new ShelfPagerAdapter());
this.A2.addOnPageChangeListener(new f1());
this.B2.addOnTabSelectedListener(new g1());
this.B2.setupWithViewPager(this.A2);
com.flyersoft.discuss.z.setTabColor(this.B2);
if (e50.j8 > e50.A3().size() - 1) {
e50.j8 = 0;
}
this.A2.setCurrentItem(e50.j8);
}
protected void k0(ListView lv) {
if (lv != null) {
lv.setAdapter((ListAdapter) null);
}
}
void k1(View base) {
this.D1 = base;
this.L1 = (ViewGroup) base.findViewById(R.id.accountInfo);
this.M1 = (ViewGroup) base.findViewById(R.id.accountLay);
this.J1 = (TextView) base.findViewById(R.id.accountName);
this.K1 = (ImageView) base.findViewById(R.id.accountLv);
this.I1 = (ShelfImageView) base.findViewById(R.id.accountPic);
this.N1 = (ViewGroup) base.findViewById(R.id.recentLay);
this.E1 = base.findViewById(R.id.recentTv);
this.F1 = base.findViewById(R.id.recentTvIcon);
this.H1 = (ImageView) base.findViewById(R.id.recentUp);
this.G1 = base.findViewById(R.id.msgLay);
TextView textView = (TextView) base.findViewById(R.id.msg_count2);
this.V0 = textView;
textView.setVisibility(8);
this.N1.setBackgroundColor(com.flyersoft.discuss.z.getItemBackColor());
if (e50.M2) {
e50.b1(this.M1);
}
base.setBackgroundColor(com.flyersoft.discuss.z.getToolbarBackColor());
base.findViewById(R.id.padding).setBackgroundColor(com.flyersoft.discuss.z.getToolbarBackColor());
base.findViewById(R.id.splitter).setBackgroundColor(com.flyersoft.discuss.z.getListBackColor());
this.M1.setBackgroundColor(com.flyersoft.discuss.z.getItemBackColor());
this.N1.setBackgroundColor(com.flyersoft.discuss.z.getItemBackColor());
((ViewGroup.MarginLayoutParams) this.E1.getLayoutParams()).bottomMargin = e50.o8 ? e50.k0(6.0f) : 0;
View inflate = LayoutInflater.from(this).inflate(R.layout.web_dash_book, (ViewGroup) null);
P1(inflate.findViewById(R.id.cardView), e50.k0(e50.o8 ? 77.0f : 56.0f));
inflate.measure(0, 0);
this.L1.setOnClickListener(this);
this.E1.setOnClickListener(this);
this.H1.setOnClickListener(this);
this.G1.setOnClickListener(this);
base.findViewById(R.id.guanzhuLay).setOnClickListener(this);
base.findViewById(R.id.shoucangLay).setOnClickListener(this);
base.findViewById(R.id.shudanLay).setOnClickListener(this);
base.findViewById(R.id.tieziLay).setOnClickListener(this);
base.findViewById(R.id.pinglunLay).setOnClickListener(this);
base.findViewById(R.id.my_task).setOnClickListener(this);
this.O1 = (SwitchCompat) base.findViewById(R.id.switch_compat);
this.P1 = (TextView) base.findViewById(R.id.webserviceTag);
this.O1.setOnCheckedChangeListener(new n());
RecyclerView recyclerView = (RecyclerView) base.findViewById(R.id.recentRv);
this.l1 = recyclerView;
recyclerView.setLayoutManager(new LinearLayoutManager(this, 0, false));
this.l1.getLayoutParams().height = inflate.getMeasuredHeight() + (e50.o8 ? e50.k0(6.0f) : 0);
a2(false);
this.I1.d = true;
showUserInfo();
Y1();
S1();
}
protected void l0(RecyclerView rv) {
if (rv != null) {
rv.setAdapter(null);
}
}
boolean m1() {
return !e50.F7 ? e50.Q5 == 1 : Y0(e50.A3().get(e50.j8)) == 1;
}
@Override
@h43
public ReturnData moveBook(String bookArr, String toShelf) {
ReturnData returnData = new ReturnData();
g50.C0(JsonUtils.jsonToList(bookArr, g50.e.class), toShelf);
e50.s(toShelf);
i1(false);
returnData.setData("书籍移动成功");
return returnData;
}
protected void n1(String url, String userAgent) {
if (!e50.o5()) {
o50.p2(this, e50.W0("请先连接网络."));
return;
}
p0();
this.d1.setBackgroundColor(e50.N1());
this.e1.setExpanded(true, false);
if (this.Z0 == null) {
o2(true);
} else {
this.Z0 = null;
}
this.q1.setVisibility(0);
this.t1.setVisibility(4);
this.p1.getSettings().setUserAgentString(userAgent);
this.p1.clearHistory();
this.w1 = true;
this.p1.loadUrl(url);
v2(url);
}
@Override
@h43
public void netSource(String url, RequestCallback callback) {
MoonEngine.getInstance().addSource(url).subscribe(new x1(new ReturnData(), callback));
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
e50.N5("-main:onActivityResult");
if (requestCode == 3042) {
try {
e50.N5("intro act result");
this.z2 = false;
d1();
} catch (Exception e3) {
e50.S0(e3);
return;
}
}
if (requestCode == 3041) {
this.m2.sendEmptyMessageDelayed(1019, 500L);
return;
}
if (requestCode == 3030) {
A1();
return;
}
if (requestCode == 20209 && resultCode == -1) {
Uri data2 = data.getData();
DocumentFile fromTreeUri = DocumentFile.fromTreeUri(this, data2);
if (fromTreeUri.findFile("Android") == null && fromTreeUri.findFile("LOST.DIR") == null) {
SelectFileAct.requestGrantSD(this);
}
com.flyersoft.components.t.n(data2);
if (Build.VERSION.SDK_INT >= 19) {
getContentResolver().takePersistableUriPermission(data2, 3);
}
}
if (requestCode != 1030 && requestCode != 45001) {
if (requestCode == 3044 && S.forceUpdateApp > 3) {
finish();
return;
} else {
if (this.Q1) {
return;
}
C0(requestCode, resultCode, data);
return;
}
}
if (com.flyersoft.seekbooks.q.t()) {
com.flyersoft.seekbooks.q.v(false);
if (com.flyersoft.seekbooks.q.d()) {
o50.C(com.flyersoft.seekbooks.q.s());
}
G1();
}
}
@Override
public void onClick(View view) {
View view2 = this.O0;
if (view == view2) {
view2.setVisibility(8);
DownloadTaskAsync.stopAllTasks("main follows click");
this.r2.clear();
this.w2.clear();
r1(true);
}
if (view == this.G1) {
X1();
}
if (view == this.S0) {
new com.flyersoft.components.m(this, view, new String[]{getString(R.string.menu_home_toolbar_creat_booklist), getString(R.string.menu_home_toolbar_sub_taolun), getString(R.string.menu_home_toolbar_sub_shuhuan), getString(R.string.menu_home_toolbar_sub_shupin)}, new a0()).s(R.style.menuTopRight).A(view);
}
if (view == this.T0) {
e50.J6(!e50.M2);
e50.ta = true;
w2(true);
com.flyersoft.discuss.z.notifyThemeChanged();
}
if (view == this.P0) {
String[] strArr = new String[this.H2 > 0 ? 8 : 6];
strArr[0] = getString(R.string.menu_1);
strArr[1] = "-";
strArr[2] = getString(R.string.site_manage);
strArr[3] = getString(R.string.xiazaiguanli);
strArr[4] = getString(R.string.bendishuji);
strArr[5] = getString(R.string.yingyongshuoming);
int i3 = this.H2;
int[] iArr = new int[i3 <= 0 ? 6 : 8];
iArr[0] = R.drawable.ic_menu_continue;
iArr[1] = 0;
iArr[2] = R.drawable.ic_menu_netlibrary_normal;
iArr[3] = R.drawable.ic_menu_download;
iArr[4] = R.drawable.ic_menu_myfiles_normal;
iArr[5] = R.drawable.ic_menu_about;
if (i3 > 0) {
strArr[6] = "-";
strArr[7] = e50.W0("新消息(" + this.H2 + ")");
iArr[6] = 0;
iArr[7] = R.drawable.toolbar_message2;
}
new com.flyersoft.components.m(this, view, strArr, null, 0, new b0(), null, iArr, false).A(view);
}
if (view == this.C2) {
d2(view);
}
if (view.getId() == R.id.shelf_find) {
E0();
}
if (view.getId() == R.id.shelf_style) {
if (e50.F7) {
M1(!m1() ? 1 : 0);
t0(e50.j8, true);
} else {
e50.Q5 = e50.Q5 == 0 ? 1 : 0;
i1(false);
}
}
if (view.getId() == R.id.shelf_move) {
moveShelfSelected();
}
if (view.getId() == R.id.shelf_delete) {
deleteShelfSelected();
}
if (view.getId() == R.id.shelf_all) {
this.f2.clear();
this.f2.addAll(W0());
g2();
p1(this.m1);
}
if (view.getId() == R.id.shelf_reverse) {
Iterator<g50.e> it = W0().iterator();
while (it.hasNext()) {
g50.e next = it.next();
if (this.f2.contains(next)) {
this.f2.remove(next);
} else {
this.f2.add(next);
}
}
g2();
p1(this.m1);
}
if (view == this.E1) {
new com.flyersoft.components.m(this, view, new String[]{getString(R.string.qingkong)}, new c0()).z(-e50.k0(30.0f), e50.k0(0.0f));
}
if (view == this.H1) {
e50.L2 = !e50.L2;
a2(true);
}
if (view == this.I1 || view == this.J1 || view == this.L1) {
if (e50.T5(this)) {
return;
}
if (!com.flyersoft.seekbooks.q.d()) {
com.flyersoft.seekbooks.q.D(this, x0);
} else {
startActivity(new Intent(this, (Class<?>) UserInfoAct.class));
}
}
if (view.getId() == R.id.shudanLay) {
com.flyersoft.discuss.z.showShuDanList();
}
if (view.getId() == R.id.guanzhuLay) {
com.flyersoft.discuss.z.showGuanZhuList();
}
if (view.getId() == R.id.shoucangLay) {
com.flyersoft.discuss.z.showShouCangList();
}
if (view.getId() == R.id.tieziLay) {
com.flyersoft.discuss.z.showTieZiList();
}
if (view.getId() == R.id.pinglunLay) {
com.flyersoft.discuss.z.showPingLunList();
}
if (view.getId() == R.id.my_task) {
com.flyersoft.discuss.z.showMyTask();
}
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
e50.N5("-main:onConfigurationChanged");
e50.v = System.currentTimeMillis();
super.onConfigurationChanged(newConfig);
e50.t3(this);
if (N0(this.m1) != null) {
new o(Looper.getMainLooper()).sendEmptyMessageDelayed(0, 200L);
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EventBus.getDefault().register(this);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
this.L0 = toolbar;
setSupportActionBar(toolbar);
View findViewById = findViewById(R.id.signLay);
this.Q0 = findViewById;
findViewById.setVisibility(8);
this.R0 = findViewById(R.id.iv_main_sing);
if (e50.r2 < 3) {
((TextView) findViewById(R.id.searchTip)).setText(e50.W0("点这里开始搜索书籍"));
}
View findViewById2 = findViewById(R.id.home_toolbar_search);
this.N0 = findViewById2;
findViewById2.setOnClickListener(new k());
this.M0 = findViewById(R.id.home_web_tool_bar);
this.W0 = (BottomNavigationView) findViewById(R.id.nav_view);
AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.appBarLayout);
this.e1 = appBarLayout;
appBarLayout.addOnOffsetChangedListener((AppBarLayout.OnOffsetChangedListener) new v());
this.S0 = (ImageView) findViewById(R.id.add_button);
this.T0 = (ImageView) findViewById(R.id.night_button);
this.P0 = findViewById(R.id.menu_button);
this.O0 = findViewById(R.id.progressTop);
this.U0 = (TextView) findViewById(R.id.msg_count);
this.S0.setOnClickListener(this);
this.P0.setOnClickListener(this);
this.T0.setOnClickListener(this);
this.O0.setOnClickListener(this);
O1(0, e50.k0(2.0f));
O1(1, e50.k0(2.0f));
O1(3, e50.k0(1.0f));
s1();
}
@Override
public void onDestroy() {
WB.clearCache();
e50.N5("-main:onDestroy");
e50.r9 = null;
e50.Y8 = null;
e50.w2 = false;
super.onDestroy();
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == 4) {
try {
if (e50.l2 == 0 && U1()) {
c2(false);
return true;
}
if (e50.l2 == 1 && this.n1.getVisibility() != 0) {
if (this.p1.canGoBack()) {
this.p1.goBack();
return true;
}
b1();
return true;
}
if (SystemClock.elapsedRealtime() - G0 > 2000) {
G0 = SystemClock.elapsedRealtime();
o50.p2(this, getString(R.string.zaicianxiatuichu));
return true;
}
H0 = SystemClock.elapsedRealtime();
K0();
return true;
} catch (Exception e3) {
e50.S0(e3);
}
}
return super.onKeyUp(keyCode, event);
}
@Override
public void onLowMemory() {
super.onLowMemory();
}
@Override
protected void onPause() {
e50.s6("-main:onPause");
if (this.e1 != null) {
e50.m8 = f0();
}
e50.z6 = false;
e50.y6 = false;
e50.e(this);
a0 = true;
super.onPause();
e50.r7(false);
}
@Override
public void onPostCreate(Bundle savedInstanceState) {
e50.N5("-main:onPostCreate");
super.onPostCreate(savedInstanceState);
}
@Override
public void onRequestPermissionsResult(int permsRequestCode, String[] permissions, int[] grantResults) {
if (permsRequestCode == 200) {
o50.i2(e50.G7(), "" + System.currentTimeMillis());
if (V1()) {
return;
}
this.m2.sendEmptyMessageDelayed(1019, 500L);
}
}
@Override
public void onResume() {
e50.N5("-main:onResume");
super.onResume();
this.R1 = true;
if (this.T1) {
y0();
}
}
@Override
public void onStart() {
e50.N5("-main:onStart");
super.onStart();
setRequestedOrientation(13);
}
public void p1(RecyclerView rv) {
if (rv == null || rv.getAdapter() == null) {
return;
}
try {
rv.getAdapter().notifyDataSetChanged();
} catch (Exception e3) {
e50.S0(e3);
}
}
protected void s1() {
e50.s6("-main:onCreate");
f = e;
e = this;
e50.t3(this);
getWindow().addFlags(16777216);
int i3 = Build.VERSION.SDK_INT;
if (i3 >= 21) {
e50.F0(this);
getWindow().getDecorView().setSystemUiVisibility(256);
}
this.Q1 = true;
t1();
if (i3 >= 28) {
getWindow().getDecorView().addOnAttachStateChangeListener(new c1());
}
}
@Override
@h43
public ReturnData saveFile(WebServicerBookEvent event) {
ReturnData returnData = new ReturnData();
if (StringTools.isNotEmpty(event.getFavorite())) {
e50.s(event.getFavorite());
File file = new File(event.getCachePath());
File file2 = new File(e50.t + File.separator + event.getFileName());
FileUtils fileUtils = FileUtils.INSTANCE;
fileUtils.createFileIfNotExist(file2, new String[0]);
fileUtils.copy(file, file2);
String substring = event.getFileName().substring(0, event.getFileName().lastIndexOf("."));
if (e50.u5(event.getFileName())) {
g50.e F = g50.F(substring);
if (F != null) {
if (!F.i.equals(event.getFavorite())) {
F.i = event.getFavorite();
g50.o0(F);
returnData.setData("相同书籍切换书架");
} else {
returnData.setErrorMsg("已存在相同书籍");
}
} else if (g50.i(event.getFavorite(), file2.getAbsolutePath(), true) != null) {
returnData.setData("保存成功");
WB.notifyShelfListChanged();
} else {
returnData.setErrorMsg("保存失败");
}
} else {
returnData.setErrorMsg("不能识别的文件类型");
}
return returnData;
}
returnData.setErrorMsg("书架名称无效");
return returnData;
}
@Override
@h43
public ReturnData shelfBook() {
ReturnData returnData = new ReturnData();
ArrayList arrayList = new ArrayList();
Iterator<String> it = e50.A3().iterator();
while (it.hasNext()) {
String next = it.next();
BooksAndBookShelfs booksAndBookShelfs = new BooksAndBookShelfs();
ArrayList<g50.e> N = g50.N("favorite", next, null, false);
Iterator<g50.e> it2 = N.iterator();
while (it2.hasNext()) {
g50.e next2 = it2.next();
next2.g = e50.F1(next2.b);
}
booksAndBookShelfs.setName(next);
booksAndBookShelfs.setBooks(N);
arrayList.add(booksAndBookShelfs);
}
returnData.setData(arrayList);
return returnData;
}
public void showAD() {
if (e50.E() && !e50.f && e50.g < 1) {
}
}
public void showUserInfo() {
if (this.I1 == null) {
return;
}
py a3 = py.a();
a3.o(-1431655766, e50.k0(com.flyersoft.seekbooks.q.d() ? 1.0f : 3.0f));
this.I1.setHierarchy(my.u(getResources()).Z(a3).B(DownloadTaskBrowser.MIN_JS_DEALY).a());
if (com.flyersoft.seekbooks.q.d()) {
this.I1.setTag(1);
this.J1.setText(com.flyersoft.seekbooks.q.G().getPetName());
this.K1.setVisibility(0);
this.K1.setImageResource(DataConfig.levelImgs[com.flyersoft.seekbooks.q.G().getUserAchie().getGrade()]);
if (com.flyersoft.seekbooks.q.G().getHeadPic() != null) {
this.I1.setImageURI(com.flyersoft.seekbooks.q.G().getHeadPic());
if (o50.A1(com.flyersoft.seekbooks.q.s())) {
try {
if (this.I1.getHierarchy() != null) {
this.I1.getHierarchy().A(e50.u2(new File(com.flyersoft.seekbooks.q.s()), 1, 0), gy.c.FIT_XY);
}
} catch (Exception e3) {
e50.S0(e3);
}
} else {
new b1().start();
}
} else {
this.I1.setImageURI(Uri.parse("res:///2131231133"));
}
e50.N5("user=" + com.flyersoft.seekbooks.q.G().getPetName() + ",id=" + com.flyersoft.seekbooks.q.G().getId() + bf0.COMMA + o50.y(Long.valueOf(com.flyersoft.seekbooks.q.G().getNoAdTime())) + ", img=" + com.flyersoft.seekbooks.q.G().getHeadPic());
return;
}
this.J1.setText(e50.W0("一键登录"));
this.I1.setImageURI(Uri.parse("res:///2131231133"));
this.K1.setVisibility(8);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void webServicerEventChange(WebServicerEvent event) {
if (this.L2 == null) {
this.L2 = this;
}
if (event.isStart()) {
String hostAddress = WebService.Companion.getHostAddress();
this.P1.setText("(" + hostAddress + ")");
z2.alertDialog(this.L2).setTitle("已启动Web服务").setMessage("可用电脑浏览器访问这个地址来上传管理书籍:\n" + hostAddress).setPositiveButton(android.R.string.ok, (DialogInterface.OnClickListener) null).setNeutralButton("拷贝地址到粘贴板", new w1(hostAddress)).show();
return;
}
this.P1.setText("(管理书架/上传书籍)");
if (this.O1.isChecked()) {
this.O1.setChecked(false);
}
z2.showToastText(this.L2, "服务已经关闭");
}
public void x0(final String filename, final String siteTag, String url, boolean first, int delayed, final boolean showProgressDialog, S.WebBook savedBook) {
String str = url;
q50 q50Var = new q50(filename, true);
S.WebBook webBook = savedBook != null ? savedBook : new S.WebBook();
webBook.name = q50Var.d();
webBook.author = q50Var.b();
webBook.description = q50Var.k;
webBook.url = str;
String H = siteTag != null ? siteTag : q50.H(filename);
if (H.startsWith("$$")) {
Z0(filename, H, webBook, showProgressDialog);
return;
}
if (S.inited) {
if (str == null) {
str = WB.getWebBookMeta(filename, H, 0);
}
String str2 = str;
S.BookSite site = S.getSite(H, true);
if (site != null && !o50.F1(str2)) {
e50.N5("doFollowTask: " + o50.N0(filename));
this.u2.put(filename, 1);
site.working = true;
site.firstExecute = first;
if (!this.w2.contains(filename)) {
this.w2.add(filename);
}
webBook.site = site;
if (showProgressDialog) {
createProgressDlg(site.name() + "·" + o50.N0(filename), getString(R.string.zhengzaigengxinzhangjieliebiao));
}
DownloadTask.Result result = new DownloadTask.Result();
result.callback = new s0(webBook, filename, siteTag, q50Var, showProgressDialog);
DownloadTaskBrowser.CacheWebView createDownloadWebView = !site.javascriptTOC ? null : DownloadTaskBrowser.createDownloadWebView();
if (createDownloadWebView != null) {
createDownloadWebView.delayed = site.TOCDelay;
createDownloadWebView.timeout = 10000;
}
DownloadTask.download(createDownloadWebView, result, false, delayed, str2, null, site.userAgent);
return;
}
if (site == null && !this.s2) {
o50.p2(this, getString(R.string.wuxiaoshuyuan) + ": " + q50.e0(H));
}
this.u2.put(filename, 0);
o0(filename);
}
}
public void x2(int tab, boolean forceRefresh) {
e50.l2 = tab;
if (this.f1 != null) {
if (tab == 0) {
r2(forceRefresh);
return;
}
if (tab == 1) {
q2(forceRefresh);
return;
}
if (tab != 2) {
if (tab != 3) {
return;
}
p2(forceRefresh);
} else {
ForumMainFragment forumMainFragment = this.X0;
forumMainFragment.ready = tab == 2;
forumMainFragment.initData();
}
}
}
public void y2() {
TS.getSelectDiscoverySources(new z1());
}
public void z0(DownloadTask.Result result) {
S.WebBook webBook = result.taskBook;
webBook.site.working = false;
if (result.showProgressDialog) {
hideProgressDlg();
}
e50.N5("###TaskError " + webBook.site.name() + com.ksdk.ssds.manager.b.b + webBook.site.siteTag + ": " + result.err);
if (!this.s2) {
o50.s2(this, o50.N0(result.filename), webBook.site.name() + ": " + result.err, 0);
}
this.u2.put(result.filename, 0);
o0(result.filename);
}
public void z1() {
startActivity(new Intent(this, (Class<?>) WebSitesAct.class));
}
public boolean z2(final String filename) {
if (o50.A1(filename)) {
return true;
}
new m.c(this).m(e50.W0("没有找到《" + o50.N0(filename) + "》, 是否从最近阅读移除本书, 或重新搜索书源?")).w(e50.W0("移除本书"), new y(filename)).p(e50.W0("重新搜索"), new x(filename)).r(e50.W0("移除所有失效书籍"), new w()).C();
return false;
}
}