搜书大师 v23.2版本的 MD5 值为:5ee433f6456b6278bd6e80a5d44df55e

以下内容为反编译后的 ActivityTxt.java 源代码,内容仅作参考


package com.flyersoft.seekbooks;

import android.animation.Animator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.app.Dialog;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.app.SharedElementCallback;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.Shader;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.hardware.SensorManager;
import android.media.AudioManager;
import android.media.MediaPlayer;
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.Parcelable;
import android.os.PowerManager;
import android.os.SystemClock;
import android.provider.Settings;
import android.speech.tts.TextToSpeech;
import android.speech.tts.UtteranceProgressListener;
import android.text.ClipboardManager;
import android.text.Html;
import android.text.Layout;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.SpannedString;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.text.format.Time;
import android.text.style.URLSpan;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.TranslateAnimation;
import android.webkit.DownloadListener;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.RemoteViews;
import android.widget.ScrollView;
import android.widget.SeekBar;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.core.view.InputDeviceCompat;
import androidx.core.view.ViewCompat;
import androidx.recyclerview.widget.ItemTouchHelper;
import cd.InterfaceC0548;
import com.flyersoft.WB.BrowserAct;
import com.flyersoft.WB.Constants;
import com.flyersoft.WB.DownloadTask;
import com.flyersoft.WB.DownloadTaskBrowser;
import com.flyersoft.WB.ReadingOptionsAct;
import com.flyersoft.WB.S;
import com.flyersoft.WB.SplashActivity;
import com.flyersoft.WB.WB;
import com.flyersoft.WB.WebBookDetailAct;
import com.flyersoft.WB.collect.AutoCollect;
import com.flyersoft.baseapplication.been.BookAndDiscuss;
import com.flyersoft.baseapplication.http.base.MustParam;
import com.flyersoft.baseapplication.login.AccountData;
import com.flyersoft.components.BatteryTextView;
import com.flyersoft.components.ClearableEditText;
import com.flyersoft.components.ColorDialog;
import com.flyersoft.components.ColorTemplate;
import com.flyersoft.components.ContentLay;
import com.flyersoft.components.DotImageView;
import com.flyersoft.components.DragSort.ReaderBar;
import com.flyersoft.components.FlipImageView;
import com.flyersoft.components.HighlightLay;
import com.flyersoft.components.MRBookView;
import com.flyersoft.components.NewCurl3D;
import com.flyersoft.components.OpenFile_Receiver;
import com.flyersoft.components.RoundButton;
import com.flyersoft.components.RoundImage;
import com.flyersoft.components.ScrollImage;
import com.flyersoft.components.ScrollView2;
import com.flyersoft.components.b;
import com.flyersoft.components.m;
import com.flyersoft.components.q;
import com.flyersoft.discuss.TS;
import com.flyersoft.discuss.z;
import com.flyersoft.seekbooks.ActivityMain;
import com.flyersoft.seekbooks.PrefChapters;
import com.flyersoft.seekbooks.b;
import com.flyersoft.seekbooks.c;
import com.flyersoft.seekbooks.d;
import com.flyersoft.seekbooks.e;
import com.flyersoft.seekbooks.f;
import com.flyersoft.seekbooks.h;
import com.flyersoft.seekbooks.j;
import com.flyersoft.seekbooks.n;
import com.flyersoft.seekbooks.o;
import com.flyersoft.seekbooks.wwutil.StoreWebView;
import com.flyersoft.source.utils.NetworkUtils;
import com.flyersoft.staticlayout.MRTextView;
import com.flyersoft.staticlayout.MyUrlSpan;
import com.flyersoft.staticlayout.j;
import com.flyersoft.wwtools.config.Const;
import com.flyersoft.wwtools.config.ThirdConfig;
import com.ksdk.ssds.s.cr;
import com.lygame.aaa.bf0;
import com.lygame.aaa.e50;
import com.lygame.aaa.f50;
import com.lygame.aaa.g50;
import com.lygame.aaa.j50;
import com.lygame.aaa.jb1;
import com.lygame.aaa.jy1;
import com.lygame.aaa.kw0;
import com.lygame.aaa.o50;
import com.lygame.aaa.pk2;
import com.lygame.aaa.pl2;
import com.lygame.aaa.q50;
import com.lygame.aaa.rv;
import com.radaee.pdf.Document;
import com.radaee.pdf.Global;
import com.radaee.pdf.Page;
import com.radaee.pdfex.f;
import com.radaee.reader.PDFReader;
import com.radaee.reader.PDFThumbView2;
import com.radaee.reader.i;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.lang.Character;
import java.net.URL;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import java.util.zip.ZipOutputStream;
import org.slf4j.Marker;

public class ActivityTxt extends BaseActivity implements Runnable, View.OnTouchListener, View.OnClickListener, View.OnLongClickListener {
    public static final int A0 = 950;
    public static final int B0 = 951;
    public static final int C0 = 952;
    public static final int D0 = 953;
    public static final int E0 = 954;
    public static final int F0 = 955;
    public static final int G0 = 956;
    public static final int H0 = 957;
    public static final int I0 = 958;
    public static final int J0 = 960;
    public static final int K0 = 961;
    public static final int L0 = 962;
    public static final int M0 = 963;
    public static final int N0 = 964;
    public static final int O0 = 965;
    public static final int P0 = 9652;
    public static final int Q0 = 967;
    public static final int R0 = 9672;
    public static final int S0 = 968;
    public static final int T0 = 969;
    public static final int U0 = 970;
    public static final int V0 = 971;
    public static final int W0 = 973;
    public static final int X0 = 974;
    public static final int Y0 = 975;
    public static final int Z0 = 976;
    public static ActivityTxt a = null;
    private static final int a0 = 105;
    public static final int a1 = 977;
    public static final int b = -1;
    private static final int b0 = 106;
    public static final int b1 = 978;
    public static final int c = 1;
    private static final int c0 = 201;
    public static final int c1 = 979;
    private static final int d = 101;
    private static final int d0 = 202;
    public static final int d1 = 980;
    private static final int e = 102;
    private static final int e0 = 301;
    public static final int e1 = 981;
    private static final int f = 103;
    private static final int f0 = 401;
    public static final int f1 = 982;
    private static final int g = 1042;
    private static final int g0 = 501;
    public static final int g1 = 983;
    private static final int h0 = 502;
    public static final int h1 = 984;
    private static final int i0 = 601;
    public static final int i1 = 985;
    public static final int j0 = 801;
    static boolean j1 = false;
    public static final int k0 = 850;
    static boolean k1 = false;
    public static final int l0 = 851;
    static boolean l1 = false;
    public static final int m0 = 8512;
    static boolean m1 = false;
    public static final int n0 = 901;
    public static final int o0 = 902;
    public static final int p0 = 904;
    public static final int q0 = 9042;
    public static final int r0 = 9043;
    public static final int s0 = 9044;
    public static final int t0 = 906;
    public static final int u0 = 907;
    public static final int v0 = 909;
    public static final int w0 = 910;
    public static final int x0 = 920;
    public static final int y0 = 921;
    public static final int z0 = 922;
    public boolean A1;
    View A2;
    SeekBar A3;
    private long A4;
    boolean A6;
    public View A7;
    long A8;
    boolean A9;
    private int Aa;
    int Ab;
    public long B1;
    View B2;
    SeekBar B3;
    int B4;
    private int B5;
    boolean B6;
    public View B7;
    m.c B8;
    int B9;
    long Ba;
    CharSequence Bb;
    long C1;
    View C2;
    ImageView C3;
    int C5;
    boolean C6;
    public View C7;
    public View C8;
    public MRBookView C9;
    private long Ca;
    boolean D1;
    View D2;
    ImageView D3;
    public boolean D4;
    private float D5;
    m7 D6;
    public View D7;
    public View D8;
    boolean E1;
    ListView E2;
    ImageView E3;
    private float E5;
    TextView E7;
    public View E8;
    private int Ea;
    String Eb;
    boolean F1;
    public PDFReader F2;
    ImageView F3;
    private float F5;
    SeekBar F7;
    public View F8;
    private boolean Fa;
    private ProgressDialog Fb;
    boolean G1;
    private ProgressDialog G2;
    ImageView G3;
    private float G5;
    SeekBar G7;
    public View G8;
    private boolean Ga;
    private int Gb;
    ImageView H3;
    private boolean H5;
    SeekBar H7;
    private TextView H8;
    Handler H9;
    private CharSequence Ha;
    private boolean Hb;
    boolean I1;
    long I2;
    ImageView I3;
    private Handler I4;
    boolean I5;
    private boolean I6;
    boolean I7;
    private TextView I8;
    boolean I9;
    private ArrayList<String> Ia;
    private long Ib;
    long J1;
    boolean J2;
    ImageView J3;
    long J4;
    public boolean J5;
    boolean J7;
    private TextView J8;
    private String J9;
    private String Ja;
    StoreWebView Jb;
    private long K1;
    ImageView K3;
    boolean K4;
    public boolean K5;
    private ArrayList<e50.o> K6;
    boolean K7;
    private TextView K8;
    private Float K9;
    public MRTextView Ka;
    boolean Kb;
    boolean L1;
    ImageView L3;
    boolean L4;
    long L5;
    int L6;
    boolean L7;
    private TextView L8;
    private m.c L9;
    public ScrollView2 La;
    m.c Lb;
    boolean M1;
    View M3;
    private int M4;
    private int M5;
    long M6;
    private View.OnClickListener M7;
    private TextView M8;
    Bitmap Ma;
    String Mb;
    long N1;
    View N3;
    private String N4;
    private boolean N5;
    private TextToSpeech N6;
    private SeekBar.OnSeekBarChangeListener N7;
    private TextView N8;
    private int N9;
    int Na;
    DownloadTaskBrowser.CacheWebView Nb;
    public boolean O2;
    View O3;
    private String O4;
    private int O5;
    private String O6;
    int O7;
    private TextView O8;
    private int O9;
    int Oa;
    boolean P1;
    TextView P3;
    Message P4;
    private boolean P5;
    private boolean P7;
    private long P9;
    int Pa;
    int Pb;
    MRTextView Q1;
    boolean Q2;
    TextView Q3;
    private boolean Q4;
    private int Q5;
    private int Q6;
    private Timer Q7;
    View Q9;
    int Qa;
    boolean Qb;
    MRTextView R1;
    public NewCurl3D R2;
    TextView R3;
    private boolean R4;
    double R5;
    private int R7;
    View R9;
    public boolean Ra;
    int Rb;
    public ScrollView2 S1;
    public FlipImageView S2;
    private boolean S4;
    boolean S5;
    private TextToSpeech.OnUtteranceCompletedListener S6;
    private int S7;
    public boolean S8;
    View S9;
    boolean Sa;
    boolean Sb;
    public ScrollView2 T1;
    public long T2;
    private boolean T4;
    private UtteranceProgressListener T6;
    private boolean T7;
    private Handler T8;
    ImageView T9;
    boolean Ta;
    boolean Tb;
    public FrameLayout U1;
    public Bitmap U2;
    private boolean U4;
    ScrollImage U7;
    ImageView U9;
    boolean Ub;
    public FrameLayout V1;
    public Bitmap V2;
    TextView V3;
    private boolean V4;
    private float V5;
    HashMap<Integer, Integer> V8;
    ImageView V9;
    private int Va;
    long Vb;
    public FrameLayout W1;
    public Bitmap W2;
    RoundButton W3;
    private float W4;
    VelocityTracker W5;
    private int W7;
    HashMap<Integer, Integer> W8;
    ImageView W9;
    private int Wa;
    View X1;
    private boolean X2;
    RoundButton X3;
    boolean X4;
    private long X7;
    long X8;
    ImageView X9;
    private CharSequence Xa;
    View Y1;
    private boolean Y2;
    RoundButton Y3;
    boolean Y4;
    private boolean Y5;
    private long Y7;
    long Y8;
    ImageView Y9;
    private ArrayList<String> Ya;
    View Z1;
    boolean Z2;
    RoundButton Z3;
    int Z4;
    private String Z5;
    private long Z7;
    e50.p Z8;
    ImageView Z9;
    private String Za;
    public ContentLay a2;
    RoundButton a4;
    boolean a5;
    private Dialog a6;
    private long a8;
    private int a9;
    public View b2;
    RoundImage b4;
    int b5;
    private m.c b6;
    private Handler b7;
    private boolean b8;
    private int b9;
    ImageView c2;
    int c3;
    RoundImage c4;
    int c5;
    private String c6;
    private boolean c7;
    boolean c8;
    public HighlightLay c9;
    ImageView ca;
    String cb;
    ImageView d2;
    int d3;
    RoundImage d4;
    int d5;
    private boolean d6;
    private boolean d7;
    boolean d8;
    TextView d9;
    ImageView da;
    BroadcastReceiver db;
    ImageView e2;
    boolean e3;
    RoundImage e4;
    long e5;
    private boolean e6;
    private m.c e7;
    TextView e9;
    ImageView ea;
    private boolean eb;
    ImageView f2;
    View f3;
    View f4;
    Boolean f6;
    Notification f7;
    boolean f8;
    TextView f9;
    ImageView fa;
    View fb;
    ImageView g2;
    View g3;
    boolean g4;
    long g5;
    BroadcastReceiver g7;
    boolean g8;
    TextView g9;
    ImageView ga;
    ImageView gb;
    ImageView h2;
    ArrayList<com.flyersoft.components.DragSort.b> h3;
    SeekBar h4;
    long h5;
    private boolean h6;
    View h7;
    n.C0941n h8;
    TextView h9;
    ImageView ha;
    ImageView hb;
    public FlipImageView i2;
    LinearLayout i3;
    SeekBar i4;
    private Handler i5;
    View i7;
    PrefChapters i8;
    public ColorTemplate i9;
    ImageView ia;
    TextView ib;
    TextView j2;
    SeekBar j4;
    public long j5;
    View j7;
    private View j8;
    public DotImageView j9;
    ImageView ja;
    TextView jb;
    TextView k2;
    int k3;
    SeekBar k4;
    View k7;
    private String k8;
    public DotImageView k9;
    ClearableEditText ka;
    SeekBar kb;
    TextView l2;
    int l3;
    SeekBar l4;
    View l7;
    View l9;
    String la;
    MediaPlayer lb;
    TextView m2;
    int m3;
    SeekBar m4;
    private j.d m5;
    View m7;
    OpenFile_Receiver m8;
    View m9;
    PDFThumbView2 ma;
    public int mb;
    boolean n1;
    TextView n2;
    boolean n3;
    SeekBar n4;
    public String n5;
    private GestureDetector n6;
    TextView n7;
    ComponentName n8;
    ImageView n9;
    FrameLayout na;
    public String nb;
    boolean o1;
    TextView o2;
    boolean o3;
    RoundButton o4;
    long o5;
    VelocityTracker o6;
    EditText o7;
    AudioManager.OnAudioFocusChangeListener o8;
    int o9;
    View.OnClickListener oa;
    Handler ob;
    boolean p1;
    TextView p2;
    boolean p3;
    RoundButton p4;
    Handler p5;
    int p6;
    View p7;
    boolean p8;
    int p9;
    private boolean pa;
    private long pb;
    boolean q1;
    DotImageView q2;
    boolean q3;
    Handler q5;
    float q6;
    View q7;
    boolean q8;
    MotionEvent q9;
    public Document qa;
    private Handler qb;
    long r1;
    public View r2;
    boolean r3;
    private int r5;
    CheckBox r7;
    private Handler r8;
    MotionEvent r9;
    public String ra;
    boolean s1;
    public View s2;
    boolean s3;
    RoundButton s4;
    ImageView s7;
    private ArrayList<String> sa;
    q50.b sb;
    boolean t1;
    public View t2;
    boolean t3;
    RoundButton t4;
    public com.flyersoft.components.n t8;
    private int ta;
    boolean tb;
    int u1;
    public View u2;
    boolean u3;
    RoundButton u4;
    private SensorManager u8;
    public boolean u9;
    private ArrayList<Integer> ua;
    DownloadTaskBrowser.CacheWebView ub;
    int v1;
    public View v2;
    boolean v3;
    float v6;
    private int v7;
    public boolean v9;
    public boolean va;
    boolean vb;
    int w1;
    public View w2;
    boolean w3;
    private boolean w5;
    private GestureDetector w6;
    public View w7;
    public int w8;
    public ArrayList<PrefChapters.l> wa;
    S.WebBook wb;
    public long x1;
    public View x2;
    String x3;
    private boolean x4;
    private float x6;
    public View x7;
    Boolean xa;
    String xb;
    public long y1;
    public ViewGroup y2;
    String y3;
    public View y7;
    private ProgressDialog y8;
    public int ya;
    public boolean z1;
    View z2;
    SeekBar z3;
    boolean z6;
    public View z7;
    ProgressBar z8;
    public boolean za;
    boolean zb;
    public Handler H1 = new s5(Looper.getMainLooper());
    private int O1 = -1;
    int H2 = 0;
    boolean K2 = false;
    boolean L2 = false;
    public long M2 = 0;
    String N2 = "";
    public String P2 = "";
    View.OnClickListener a3 = new g0();
    int b3 = -250539759;
    View.OnClickListener j3 = new c4();
    int S3 = 150;
    View.OnLongClickListener T3 = new e4();
    View.OnClickListener U3 = new f4();
    View.OnClickListener q4 = new h4();
    SeekBar.OnSeekBarChangeListener r4 = new i4();
    private boolean v4 = false;
    private int w4 = 0;
    public int y4 = 1;
    private boolean z4 = false;
    private ArrayList<Integer> C4 = new ArrayList<>();
    private long E4 = -1;
    private Handler F4 = new t4(Looper.getMainLooper());
    long G4 = 0;
    private e50.h H4 = new u4();
    boolean f5 = true;
    private boolean k5 = false;
    private boolean l5 = false;
    SeekBar.OnSeekBarChangeListener s5 = new h5();
    private float t5 = 0.0f;
    public float u5 = 0.0f;
    private boolean v5 = false;
    public boolean x5 = false;
    public boolean y5 = false;
    private boolean z5 = false;
    public boolean A5 = false;
    private float T5 = -1.0f;
    private float U5 = -1.0f;
    long X5 = -1;
    int g6 = 0;
    private float i6 = 0.0f;
    private float j6 = 0.0f;
    private boolean k6 = false;
    private int l6 = 0;
    long m6 = -1;
    long r6 = 1;
    long s6 = 0;
    private boolean t6 = false;
    private boolean u6 = false;
    private boolean y6 = false;
    private ArrayList<m7> E6 = new ArrayList<>();
    private int F6 = -1;
    private int G6 = -1;
    private int H6 = -1;
    private String J6 = ",.;?\":(){}[]!,。;"”“:?()、!\n";
    private TextToSpeech.OnInitListener P6 = new w5();
    private int R6 = -2;
    private final int U6 = 0;
    private final int V6 = 1;
    private final int W6 = 2;
    private final int X6 = 3;
    private final int Y6 = 4;
    private final int Z6 = 5;
    private final int a7 = 6;
    private final int t7 = 0;
    private final int u7 = 1;
    private int V7 = -1;
    private boolean e8 = false;
    boolean l8 = false;
    private long s8 = -1;
    private int v8 = -1;
    private boolean x8 = false;
    private long P8 = -1;
    private long Q8 = -1;
    private long R8 = -1;
    private long U8 = -1;
    View.OnTouchListener s9 = new l();
    View.OnClickListener t9 = new m();
    float w9 = -1.0f;
    private boolean x9 = false;
    private int y9 = -1;
    public g50.f z9 = null;
    int D9 = -1;
    int E9 = -1;
    private int F9 = e50.k0(5.0f);
    public int G9 = -2;
    private int M9 = -1;
    private int Da = -1;
    private int Ua = -1;
    ArrayList<q50.b> rb = new ArrayList<>();
    private HashMap<String, Integer> yb = new HashMap<>();
    int Cb = 0;
    private int Db = -1;
    long Ob = -1;

    public class a implements DialogInterface.OnDismissListener {
        a() {
        }

        @Override
        public void onDismiss(DialogInterface dialog) {
            e50.R6(true);
            if (ActivityTxt.this.G2 == ActivityTxt.this.y8) {
                ActivityTxt.this.G2 = null;
            }
        }
    }

    public class a0 implements DialogInterface.OnClickListener {
        a0() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.f6(false);
        }
    }

    public class a1 implements DialogInterface.OnClickListener {
        final EditText a;
        final String b;
        final CheckBox c;

        a1(final EditText val$uEdit, final String val$filename, final CheckBox val$cb) {
            this.a = val$uEdit;
            this.b = val$filename;
            this.c = val$cb;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            String obj = this.a.getText().toString();
            if (ActivityTxt.this.qa.E(this.b, obj) != 0) {
                ActivityTxt.this.O7("Invalidated password.", false);
                return;
            }
            ActivityTxt.this.getSharedPreferences("pdf", 0).edit().putString(this.b + "u", e50.q2(obj)).putBoolean(this.b + "s", this.c.isChecked()).commit();
            ActivityTxt.this.ee();
        }
    }

    public class a2 implements TS.OnChapterResult {
        final q50.b a;

        a2(final q50.b val$cacheItem) {
            this.a = val$cacheItem;
        }

        @Override
        public void result(String error, TS.Chapter chapter) {
            if (e50.Q1 == null || ActivityTxt.this.isFinishing()) {
                return;
            }
            e50.N5("*getChapter: " + chapter.url + " " + error);
            ActivityTxt activityTxt = ActivityTxt.this;
            activityTxt.tb = false;
            if (error != null) {
                if (activityTxt.zb) {
                    int i = activityTxt.Ab + 1;
                    activityTxt.Ab = i;
                    if (i < 5 && activityTxt.rb.size() > 0) {
                        ActivityTxt activityTxt2 = ActivityTxt.this;
                        activityTxt2.sb = null;
                        activityTxt2.H1.sendEmptyMessageDelayed(ActivityTxt.Q0, o50.R1(200));
                        return;
                    }
                }
                DownloadTask.Result result = new DownloadTask.Result();
                result.err = error;
                Handler handler = ActivityTxt.this.H1;
                handler.sendMessage(handler.obtainMessage(ActivityTxt.T0, result));
                return;
            }
            if (q50.Z(e50.Q1.d(), e50.Q1.b(), e50.Q1.p, this.a.e, chapter.name, chapter.text, chapter.url, false)) {
                ActivityTxt.this.Pb(this.a);
            }
            ActivityTxt.this.Y4(false);
            ActivityTxt activityTxt3 = ActivityTxt.this;
            if (activityTxt3.zb) {
                return;
            }
            activityTxt3.hideProgressDlg();
        }
    }

    public class a3 implements DialogInterface.OnClickListener {
        a3() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            Intent intent = new Intent(ActivityTxt.this, (Class<?>) BrowserAct.class);
            intent.putExtra("filename", "各平台VIP章节阅读指引");
            ActivityTxt.this.startActivity(intent);
        }
    }

    public class a4 implements z.ResultInterface {
        a4() {
        }

        @Override
        public void done(boolean success, Object object) {
            if (success && (object instanceof Integer)) {
                ActivityTxt.this.Rb = ((Integer) object).intValue();
                e50.N5(ActivityTxt.this.p8() + " ---------- comments: " + ActivityTxt.this.Rb);
                ActivityTxt activityTxt = ActivityTxt.this;
                if (activityTxt.Ub || activityTxt.Rb >= com.flyersoft.discuss.z.LESS_COMMENT_COUNT) {
                    if (com.flyersoft.discuss.z.shouldUpdateCollectTags(com.flyersoft.discuss.z.getTagsCollectedTime(activityTxt.p8(), ActivityTxt.this.k8()))) {
                        ActivityTxt.this.M4(false, true);
                    }
                } else {
                    activityTxt.Ub = true;
                    activityTxt.M4(false, false);
                }
                ActivityTxt.this.Hf();
                ActivityTxt activityTxt2 = ActivityTxt.this;
                if (activityTxt2.Sb) {
                    return;
                }
                activityTxt2.Sb = true;
                com.flyersoft.discuss.z.uploadHot(activityTxt2.p8(), ActivityTxt.this.k8());
            }
        }
    }

    public class a5 extends Handler {
        a5(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            try {
                int i = 0;
                ActivityTxt.this.Yf(msg.what == 1);
                if (!ActivityTxt.this.X2 || e50.i4 < 3) {
                    ActivityTxt.this.u6 = false;
                }
                ActivityTxt.this.hg();
                ActivityTxt activityTxt = ActivityTxt.this;
                if (!e50.Q4() && !ActivityTxt.this.kb()) {
                    i = msg.what == 1 ? 1 : -1;
                }
                activityTxt.cg(i);
                if (!e50.S4() || ActivityTxt.this.kg()) {
                    return;
                }
                ActivityTxt.this.H1.sendEmptyMessageDelayed(ActivityTxt.f0, 50L);
            } catch (Exception e) {
                e50.S0(e);
            }
        }
    }

    public class a6 extends Handler {
        a6(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            ActivityTxt.this.D6(msg.what, msg.obj);
        }
    }

    public class a7 implements DialogInterface.OnClickListener {

        class a implements DialogInterface.OnClickListener {
            a() {
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                if (which == 0) {
                    ActivityTxt.this.B6(true);
                }
                if (which == 1) {
                    g50.u(e50.V1);
                    ActivityTxt.this.C1 = System.currentTimeMillis();
                    ActivityTxt.this.cg(0);
                }
                if (which == 2) {
                    if (ActivityTxt.this.nb()) {
                        ActivityTxt.this.n5();
                    } else {
                        e50.y6(ActivityTxt.this, e50.V1);
                    }
                }
            }
        }

        a7() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            String[] strArr = new String[3];
            strArr[0] = ActivityTxt.this.getString(R.string.fenxiangbenshujindu);
            strArr[1] = ActivityTxt.this.getString(R.string.qingkongbenshutongji);
            ActivityTxt activityTxt = ActivityTxt.this;
            strArr[2] = activityTxt.getString(activityTxt.nb() ? R.string.qingkonghuanchun : R.string.send_file);
            new m.c(ActivityTxt.this).i(strArr, new a()).C();
        }
    }

    public class b extends TimerTask {
        final TextView a;

        class a implements Runnable {
            a() {
            }

            @Override
            public void run() {
                try {
                    e50.L5 = SystemClock.elapsedRealtime();
                    long currentTimeMillis = System.currentTimeMillis();
                    b bVar = b.this;
                    ActivityTxt activityTxt = ActivityTxt.this;
                    long j = (currentTimeMillis - activityTxt.A8) / 1000;
                    if (j >= 60) {
                        m.c cVar = activityTxt.B8;
                        if (cVar != null) {
                            cVar.a();
                            ActivityTxt.this.B8 = null;
                        }
                        b.this.cancel();
                        return;
                    }
                    TextView textView = bVar.a;
                    if (textView != null) {
                        textView.setText("" + (60 - j));
                    }
                } catch (Exception e) {
                    e50.S0(e);
                }
            }
        }

        b(final TextView val$timeTv) {
            this.a = val$timeTv;
        }

        @Override
        public void run() {
            ActivityTxt.this.runOnUiThread(new a());
        }
    }

    public class b0 implements m.d {
        final String a;

        b0(final String val$s) {
            this.a = val$s;
        }

        @Override
        public void onClick(int which) {
            if (which != 0) {
                if (which == 1) {
                    ActivityTxt.this.u7();
                    return;
                }
                if (which == 2) {
                    ActivityTxt.this.ag(this.a);
                    return;
                }
                if (which == 3) {
                    Intent intent = new Intent("android.intent.action.WEB_SEARCH");
                    intent.putExtra("query", this.a);
                    ActivityTxt.this.startActivity(intent);
                    return;
                } else {
                    if (which != 4) {
                        return;
                    }
                    ActivityTxt activityTxt = ActivityTxt.this;
                    activityTxt.T5(activityTxt, false);
                    return;
                }
            }
            String str = this.a + "\n\n(" + e50.p1() + ", 《" + e50.D1() + "》)";
            Intent intent2 = new Intent("android.intent.action.SEND");
            intent2.setType("text/plain");
            intent2.putExtra("android.intent.extra.SUBJECT", ActivityTxt.this.getString(R.string.share_page) + ": " + e50.D1());
            intent2.putExtra("android.intent.extra.TEXT", str);
            ActivityTxt.this.startActivity(Intent.createChooser(intent2, ""));
        }
    }

    class b1 extends Handler {
        b1(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            ActivityTxt.this.bd();
        }
    }

    public class b2 extends Thread {
        b2() {
        }

        @Override
        public void run() {
            ActivityTxt.this.c8(1);
        }
    }

    public class b3 implements DialogInterface.OnClickListener {
        final String a;

        b3(final String val$url) {
            this.a = val$url;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (((AlertDialog) dialog).getListView().getCheckedItemPosition() == 0) {
                ActivityTxt.this.Xb(this.a);
            } else {
                o50.b2(ActivityTxt.this, this.a);
            }
        }
    }

    public class b4 implements z.ResultInterface {
        final boolean a;
        final boolean b;

        class a implements z.ResultInterface {
            a() {
            }

            @Override
            public void done(boolean success, Object obj) {
                if (success) {
                    z.WWBookMeta wWBookMeta = (z.WWBookMeta) obj;
                    if (wWBookMeta.comments.size() > 0) {
                        ActivityTxt.this.H1.sendEmptyMessageDelayed(ActivityTxt.i1, 100L);
                    }
                    if (o50.F1(wWBookMeta.coverUrl) || !o50.F1(e50.A1(e50.V1))) {
                        return;
                    }
                    o50.h2(wWBookMeta.coverUrl, e50.T1(e50.V1) + e50.ja, null);
                }
            }
        }

        b4(final boolean val$forceTestUpdate, final boolean val$collectTagsOnly) {
            this.a = val$forceTestUpdate;
            this.b = val$collectTagsOnly;
        }

        @Override
        public void done(boolean success, Object obj) {
            e50.N5(obj);
            if (success) {
                z.WWBookMeta wWBookMeta = (z.WWBookMeta) obj;
                if (this.a) {
                    wWBookMeta.parentLay = ActivityTxt.this.U1;
                    wWBookMeta.forTest = true;
                }
                wWBookMeta.onUpdateBookResult = new a();
                if (wWBookMeta.original == null) {
                    BookAndDiscuss bookAndDiscuss = new BookAndDiscuss();
                    wWBookMeta.original = bookAndDiscuss;
                    bookAndDiscuss.setBookName(ActivityTxt.this.p8());
                    wWBookMeta.original.setBookAuthor(ActivityTxt.this.k8());
                }
                if (this.b) {
                    wWBookMeta.collectTagsOnly = true;
                    if (!com.flyersoft.discuss.z.shouldCollectBookTags(wWBookMeta.original)) {
                        return;
                    }
                }
                AutoCollect.autoCollect(wWBookMeta);
            }
        }
    }

    public class b5 implements e50.h {
        b5() {
        }

        @Override
        public void Finished(boolean success) {
            ActivityTxt.this.q2.setVisibility(8);
            ActivityTxt.this.mf(false);
            ActivityTxt activityTxt = ActivityTxt.this;
            activityTxt.v6 = 0.0f;
            activityTxt.j5 = 0L;
            if (activityTxt.Dh()) {
                return;
            }
            ActivityTxt.this.a2.postInvalidate();
        }
    }

    public class b6 implements CompoundButton.OnCheckedChangeListener {
        final CheckBox a;

        b6(final CheckBox val$askCheck) {
            this.a = val$askCheck;
        }

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                this.a.setChecked(false);
                this.a.setEnabled(false);
            } else {
                this.a.setEnabled(true);
            }
        }
    }

    public class b7 implements DialogInterface.OnCancelListener {
        b7() {
        }

        @Override
        public void onCancel(DialogInterface dialog) {
            ActivityTxt.this.j8 = null;
            ActivityTxt.this.k8 = null;
        }
    }

    public class c extends Handler {
        c(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            if (ActivityTxt.this.isFinishing()) {
                return;
            }
            try {
                if (msg.what == 0) {
                    ActivityTxt.this.cg(0);
                    if (!ActivityTxt.this.z4) {
                        ActivityTxt activityTxt = ActivityTxt.this;
                        if (!activityTxt.z1 && msg.arg1 > 0) {
                            activityTxt.qe(true, true);
                        }
                    }
                }
                if (msg.what == 100) {
                    if (!ActivityTxt.this.Ya() && ActivityTxt.this.q8() != 0 && ActivityTxt.this.Q1.getRealHeight() < ActivityTxt.this.U1.getHeight() * 3) {
                        ActivityTxt.this.sd(false);
                    }
                    ActivityTxt.this.cg(0);
                }
                if (msg.what == 1) {
                    e50.V6(ActivityTxt.this.S1);
                    ActivityTxt.this.k5();
                }
            } catch (Exception e) {
                e50.S0(e);
            }
        }
    }

    public class c0 extends Handler {
        c0(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            if (ActivityTxt.this.S1.getScrollY() != msg.arg1 || ActivityTxt.this.Q1.getHeight() < msg.arg2) {
                e50.N5("*verifiyBottomFixed, txtView.height: " + ActivityTxt.this.Q1.getHeight() + ", should be: " + msg.arg2);
                ActivityTxt.this.nh(msg.arg1);
            }
        }
    }

    class c1 implements m.d {
        c1() {
        }

        @Override
        public void onClick(int which) {
            ActivityTxt.this.A6(which);
        }
    }

    public class c2 implements DialogInterface.OnClickListener {
        c2() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.v7();
        }
    }

    public class c3 extends Thread {
        final String a;

        c3(final String val$url) {
            this.a = val$url;
        }

        @Override
        public void run() {
            try {
                Drawable createFromStream = Drawable.createFromStream((InputStream) new URL(NetworkUtils.getAbsoluteURL(e50.Q1.h().get(e50.g2).s, this.a)).getContent(), "src");
                if (createFromStream != null) {
                    o50.P(createFromStream, e50.j1(this.a));
                    ActivityTxt.this.H1.sendEmptyMessage(ActivityTxt.X0);
                }
            } catch (Throwable th) {
                e50.S0(th);
                Handler handler = ActivityTxt.this.H1;
                handler.sendMessage(handler.obtainMessage(ActivityTxt.Y0, e50.U0(th)));
            }
            ActivityTxt.this.Ib = System.currentTimeMillis();
        }
    }

    class c4 implements View.OnClickListener {
        c4() {
        }

        @Override
        public void onClick(View v) {
            View view = (View) v.getTag();
            if (((Integer) view.getTag()).intValue() >= e50.M9.size()) {
                e50.M9.add(new e50.n("", ""));
                view.setTag(Integer.valueOf(e50.M9.size() - 1));
                ActivityTxt.this.Le(view);
                View inflate = LayoutInflater.from(ActivityTxt.this).inflate(R.layout.tts_filter, (ViewGroup) null);
                inflate.setTag(Integer.valueOf(e50.M9.size()));
                ActivityTxt.this.Le(inflate);
                ActivityTxt.this.i3.addView(inflate, -1, -2);
                return;
            }
            ActivityTxt.this.i3.removeView(view);
            ActivityTxt.this.ne();
        }
    }

    public class c5 implements j.d {
        c5() {
        }

        @Override
        public Drawable getDrawable(String source, boolean original) {
            String str = o50.n0(e50.V1) + com.ksdk.ssds.manager.b.b + source;
            if (!o50.A1(str)) {
                return null;
            }
            try {
                Drawable u2 = e50.u2(new File(str), 0, 1);
                int intrinsicWidth = u2.getIntrinsicWidth();
                int width = ActivityTxt.this.Q1.getWidth();
                int intrinsicHeight = u2.getIntrinsicHeight();
                if (intrinsicWidth > width / 2) {
                    int i = width > intrinsicWidth ? (width - intrinsicWidth) / 2 : 0;
                    int i2 = width > intrinsicWidth ? ((width - intrinsicWidth) / 2) + intrinsicWidth : width;
                    if (intrinsicWidth > width) {
                        intrinsicHeight = (intrinsicHeight * width) / intrinsicWidth;
                    }
                    u2.setBounds(i, 0, i2, intrinsicHeight);
                } else {
                    u2.setBounds(0, 0, intrinsicWidth, intrinsicHeight);
                }
                return e50.j2(u2);
            } catch (Exception e) {
                e50.S0(e);
                return null;
            } catch (OutOfMemoryError e2) {
                e50.S0(e2);
                System.gc();
                return null;
            }
        }

        @Override
        public Rect getDrawableBounds(String source, boolean original) {
            Drawable drawable = getDrawable(source, false);
            if (drawable != null) {
                return drawable.getBounds();
            }
            return null;
        }
    }

    public class c6 implements View.OnClickListener {
        c6() {
        }

        @Override
        public void onClick(View v) {
            o50.a2(ActivityTxt.this);
        }
    }

    public class c7 implements c.l {
        c7() {
        }

        @Override
        public void onSaveBookInfo(boolean shelfChanged) {
            e50.R6(true);
        }
    }

    public class d implements f50.d {
        d() {
        }

        @Override
        public void refresh(int wordCount) {
            Handler handler = ActivityTxt.this.H1;
            handler.sendMessage(handler.obtainMessage(ActivityTxt.n0, wordCount, 0));
        }
    }

    public class d0 implements DialogInterface.OnDismissListener {
        d0() {
        }

        @Override
        public void onDismiss(DialogInterface dialog) {
            e50.R6(true);
            ActivityTxt.this.N7(0);
        }
    }

    public class d1 extends Handler {
        d1(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            String string = ActivityTxt.this.getSharedPreferences(e50.r0, 0).getString(e50.V1.toLowerCase() + "pdf", "");
            if (string.length() > 0) {
                try {
                    ActivityTxt activityTxt = ActivityTxt.this;
                    activityTxt.G1 = true;
                    f.c viewGetPos = activityTxt.F2.b.viewGetPos();
                    if (viewGetPos.a != e50.f2) {
                        e50.N5("*********incorrect pdf load page, why:" + e50.f2 + " - " + viewGetPos.a);
                        viewGetPos.a = (int) e50.f2;
                    }
                    float floatValue = Float.valueOf(string.substring(0, string.indexOf("#"))).floatValue();
                    viewGetPos.b = Integer.valueOf(string.substring(string.indexOf("#") + 1, string.indexOf(":"))).intValue();
                    viewGetPos.c = Integer.valueOf(string.substring(string.indexOf(":") + 1, string.indexOf("@"))).intValue();
                    ActivityTxt.this.Nc(viewGetPos, floatValue);
                    if (e50.t3) {
                        e50.t3 = string.indexOf(pk2.e) > 0;
                    }
                    boolean z = e50.t3;
                    if (z) {
                        PDFReader pDFReader = ActivityTxt.this.F2;
                        pDFReader.b.viewLockSide(z, pDFReader.getContext());
                        return;
                    }
                    return;
                } catch (Exception e) {
                    e50.S0(e);
                    return;
                }
            }
            e50.t3 = false;
        }
    }

    public class d2 implements DialogInterface.OnClickListener {
        d2() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.wg();
            o50.q2(ActivityTxt.this, Html.fromHtml(e50.W0("<small><b>提示:</b> 1.点工具栏右上的\"原版/优化\"可切换阅读模式; 2.点击工具栏网址可用外部浏览器打开</small>")), 1);
        }
    }

    public class d3 extends Handler {
        d3(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            if (ActivityTxt.this.isFinishing()) {
                return;
            }
            if (msg.what == 0) {
                ActivityTxt.this.Sf("下载章节图片中: " + (ActivityTxt.this.Gb - e50.Q1.h().get(e50.g2).b.size()) + com.ksdk.ssds.manager.b.b + ActivityTxt.this.Gb, (String) msg.obj);
            }
            if (msg.what == 1) {
                if (ActivityTxt.this.Gb != e50.Q1.h().get(e50.g2).b.size()) {
                    ActivityTxt.this.Ld();
                }
                if (ActivityTxt.this.Fb != null) {
                    ActivityTxt.this.Fb.dismiss();
                    ActivityTxt.this.Fb = null;
                }
            }
            if (msg.what == 2) {
                o50.p2(ActivityTxt.this, (String) msg.obj);
            }
        }
    }

    public class d4 extends Handler {
        d4(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            ActivityTxt.this.za(false);
        }
    }

    public class d5 extends Handler {
        d5(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            if (ActivityTxt.this.Q1.getLayout() == null) {
                ActivityTxt.this.V7(true);
                ActivityTxt activityTxt = ActivityTxt.this;
                if (activityTxt.z1) {
                    return;
                }
                activityTxt.H1.postDelayed(activityTxt, 200L);
                return;
            }
            ActivityTxt activityTxt2 = ActivityTxt.this;
            if (activityTxt2.Q1.i1 == 1) {
                e50.N5("**************SoftHyphenStaticLayout tWorking, delay 100************");
                ActivityTxt.this.j8().sendEmptyMessageDelayed(0, 100L);
                return;
            }
            if (activityTxt2.F7()) {
                if (ActivityTxt.this.R1.getWidth() != 0 && (ActivityTxt.this.Q1.getText().length() <= 0 || ActivityTxt.this.Q1.getHeight() != 0)) {
                    ActivityTxt activityTxt3 = ActivityTxt.this;
                    MRTextView mRTextView = activityTxt3.Q1;
                    activityTxt3.U7(mRTextView, mRTextView.getRealHeight());
                } else {
                    e50.N5("********error txtView.getHeight():" + ActivityTxt.this.Q1.getHeight());
                    ActivityTxt.this.V7(true);
                    ActivityTxt activityTxt4 = ActivityTxt.this;
                    if (activityTxt4.z1) {
                        return;
                    }
                    activityTxt4.j8().sendEmptyMessageDelayed(0, 200L);
                    return;
                }
            }
            MRTextView mRTextView2 = ActivityTxt.this.Q1;
            int a0 = mRTextView2.a0(mRTextView2.getLayout().B((int) e50.f2));
            ActivityTxt.this.o5 = SystemClock.elapsedRealtime();
            ActivityTxt.this.nh(a0);
            ActivityTxt.this.K7();
            ActivityTxt.this.z4 = false;
            ActivityTxt.this.X2 = false;
            ActivityTxt activityTxt5 = ActivityTxt.this;
            activityTxt5.H1.sendEmptyMessageDelayed(ActivityTxt.w0, activityTxt5.sb() ? 1000L : 100L);
            ActivityTxt activityTxt6 = ActivityTxt.this;
            activityTxt6.C5(activityTxt6.sb() ? 1300 : 300);
            ActivityTxt.this.u5();
            ActivityTxt.this.a8(50);
        }
    }

    public class d6 implements DialogInterface.OnClickListener {
        final CheckBox a;

        d6(final CheckBox val$askCheck) {
            this.a = val$askCheck;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.Q6 = !this.a.isChecked();
            ActivityTxt.this.e7 = null;
        }
    }

    public class d7 implements DialogInterface.OnDismissListener {
        d7() {
        }

        @Override
        public void onDismiss(DialogInterface dialog) {
            e50.R6(true);
        }
    }

    public class e implements f50.d {
        e() {
        }

        @Override
        public void refresh(int wordCount) {
            Handler handler = ActivityTxt.this.H1;
            handler.sendMessage(handler.obtainMessage(ActivityTxt.n0, wordCount, 0));
        }
    }

    public class e0 implements o50.h {
        final ArrayList a;

        e0(final ArrayList val$fonts) {
            this.a = val$fonts;
        }

        @Override
        public void onClick(String url) {
            ActivityTxt.this.E7(url, this.a.size() > 1);
        }
    }

    public class e1 implements e.c {
        e1() {
        }

        @Override
        public void AfterEditNote(int result, final String text) {
            if (text.length() == 0 || !ActivityTxt.this.qa.a()) {
                result = 0;
            }
            try {
                if (result == 0) {
                    ActivityTxt.this.F2.f();
                } else if (result == 1) {
                    ActivityTxt activityTxt = ActivityTxt.this;
                    if (!activityTxt.za) {
                        if (!activityTxt.F2.b.annotSetMarkup(0)) {
                            ActivityTxt.this.ad("Failed to add annotation!");
                            return;
                        }
                        ActivityTxt activityTxt2 = ActivityTxt.this;
                        Page j = activityTxt2.qa.j(activityTxt2.rc());
                        j.P();
                        e50.N5("*page:" + j + " annotCount:" + j.E());
                        if (j.E() > 0) {
                            j.D(j.E() - 1).o0(text);
                            ActivityTxt activityTxt3 = ActivityTxt.this;
                            activityTxt3.Qc((int) e50.f2, activityTxt3.F2.p0, text, 0);
                        } else {
                            e50.N5("#Error pdf note# GetAnnotCount()==0");
                        }
                    } else if (!activityTxt.F2.i().equals(text)) {
                        ActivityTxt.this.F2.s(text);
                    }
                    ActivityTxt.this.F2.f();
                    e50.qa = true;
                    e50.h7 = true;
                } else if (result == 2) {
                    ActivityTxt.this.F2.o();
                    e50.qa = true;
                    ActivityTxt.this.J9();
                }
            } catch (Exception e) {
                e50.S0(e);
            }
            ActivityTxt.this.F2.G(false);
            ActivityTxt.this.J9();
            ActivityTxt.this.Pc();
            ActivityTxt.this.Xc(false);
        }
    }

    public class e2 implements DialogInterface.OnClickListener {
        e2() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.ea(true);
            ActivityTxt.this.Md();
        }
    }

    public class e3 extends Thread {
        final Handler a;

        e3(final Handler val$h) {
            this.a = val$h;
        }

        @Override
        public void run() {
            f50 f50Var;
            while (e50.Q1.h().get(e50.g2).b.size() > 0) {
                String str = e50.Q1.h().get(e50.g2).b.get(0);
                String absoluteURL = NetworkUtils.getAbsoluteURL(e50.Q1.h().get(e50.g2).s, str);
                e50.N5(absoluteURL);
                Handler handler = this.a;
                handler.sendMessage(handler.obtainMessage(0, absoluteURL));
                try {
                    Drawable createFromStream = Drawable.createFromStream((InputStream) new URL(absoluteURL).getContent(), "src");
                    if (createFromStream != null) {
                        o50.P(createFromStream, e50.j1(str));
                    }
                } catch (Throwable th) {
                    e50.S0(th);
                    ActivityTxt.M2(ActivityTxt.this);
                    Handler handler2 = this.a;
                    handler2.sendMessage(handler2.obtainMessage(2, e50.U0(th)));
                }
                if (ActivityTxt.this.isFinishing() || (f50Var = e50.Q1) == null) {
                    return;
                }
                if (!o50.G1(f50Var.h().get(e50.g2).b)) {
                    e50.Q1.h().get(e50.g2).b.remove(0);
                }
                if (ActivityTxt.this.Hb) {
                    break;
                }
            }
            ActivityTxt.this.Ib = System.currentTimeMillis();
            this.a.sendEmptyMessage(1);
        }
    }

    class e4 implements View.OnLongClickListener {
        e4() {
        }

        @Override
        public boolean onLongClick(View v) {
            ActivityTxt activityTxt = ActivityTxt.this;
            if (v == activityTxt.Y3) {
                if (e50.g4 != 3) {
                    e50.g4 = 3;
                    e50.e4 = 3;
                    o50.r2(activityTxt, e50.W0("已设置为滑动式左右翻页"), 0, 17);
                } else {
                    e50.g4 = 6;
                    e50.e4 = 6;
                    o50.r2(activityTxt, e50.W0("已设置为覆盖式左右翻页"), 0, 17);
                }
                ActivityTxt.this.Ch();
                ActivityTxt.this.g4 = true;
                return true;
            }
            if (v != activityTxt.Z3) {
                return false;
            }
            if (e50.g4 != 1) {
                e50.g4 = 1;
                e50.e4 = 1;
                o50.p2(activityTxt, e50.W0("已设置为仿真翻页二"));
            } else {
                e50.g4 = 2;
                e50.e4 = 2;
                o50.p2(activityTxt, e50.W0("已设置为仿真翻页一"));
            }
            ActivityTxt.this.Ch();
            ActivityTxt.this.g4 = true;
            return true;
        }
    }

    public class e5 extends Handler {
        e5(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            if (e50.P9) {
                if (msg.what == 3) {
                    o50.n1();
                    ActivityTxt.this.P6(true, false);
                    return;
                }
                o50.p2(ActivityTxt.this, "" + (3 - msg.what));
            }
        }
    }

    public class e6 implements DialogInterface.OnClickListener {
        final CheckBox a;

        e6(final CheckBox val$askCheck) {
            this.a = val$askCheck;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.Q6 = !this.a.isChecked();
            ActivityTxt.this.ua();
            ActivityTxt.this.e7 = null;
        }
    }

    public class e7 implements AudioManager.OnAudioFocusChangeListener {
        e7() {
        }

        @Override
        public void onAudioFocusChange(int focusChange) {
            if (e50.R6) {
                return;
            }
            e50.N5("##onAudioFocusChange: " + focusChange);
            if (focusChange == -3) {
                return;
            }
            if (focusChange == -2) {
                if (e50.O9) {
                    ActivityTxt activityTxt = ActivityTxt.this;
                    if (activityTxt.J7) {
                        return;
                    }
                    activityTxt.z7(activityTxt.z7, false);
                    ActivityTxt.this.q8 = true;
                    return;
                }
                return;
            }
            if (focusChange == 1) {
                ActivityTxt activityTxt2 = ActivityTxt.this;
                if (activityTxt2.J7 && activityTxt2.q8) {
                    activityTxt2.z7(activityTxt2.z7, false);
                    return;
                }
                return;
            }
            if (focusChange == -1 && e50.O9) {
                ActivityTxt activityTxt3 = ActivityTxt.this;
                if (activityTxt3.J7) {
                    return;
                }
                activityTxt3.z7(activityTxt3.z7, false);
                ActivityTxt.this.q8 = true;
            }
        }
    }

    public class f implements f50.d {
        f() {
        }

        @Override
        public void refresh(int wordCount) {
            Handler handler = ActivityTxt.this.H1;
            handler.sendMessage(handler.obtainMessage(ActivityTxt.n0, wordCount, 0));
        }
    }

    public class f0 implements DialogInterface.OnClickListener {
        final CheckBox a;

        f0(final CheckBox val$cb) {
            this.a = val$cb;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (this.a.isChecked()) {
                e50.J2 = false;
            }
        }
    }

    public class f1 implements DialogInterface.OnClickListener {
        f1() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            String str = "/sdcard/Books/Pdf/" + o50.v0(e50.V1);
            File file = new File(str);
            if (!file.isFile() || file.length() != o50.o0(e50.V1)) {
                o50.v(e50.V1, str, true);
            }
            if (o50.A1(str)) {
                ActivityTxt.this.pe(true);
                e50.v0(e50.V1);
                e50.V1 = str;
                e50.S1 = o50.n0(str);
                ActivityTxt.this.pe(true);
                ActivityTxt.this.ee();
            }
        }
    }

    public class f2 implements ActivityMain.i2 {
        f2() {
        }

        @Override
        public void afterSelect(String siteTag, String url) {
            ActivityTxt.this.Xg(siteTag, url, false);
        }
    }

    public class f3 implements CompoundButton.OnCheckedChangeListener {
        f3() {
        }

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            e50.R2 = isChecked;
        }
    }

    class f4 implements View.OnClickListener {

        class a implements DialogInterface.OnClickListener {
            final EditText a;

            a(final EditText val$et2) {
                this.a = val$et2;
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                try {
                    int intValue = Integer.valueOf(this.a.getText().toString()).intValue();
                    if (intValue == e50.I6 || intValue <= -50 || intValue > 100) {
                        return;
                    }
                    e50.I6 = intValue;
                    e50.J6 = true;
                    ((TextView) ActivityTxt.this.D2.findViewById(R.id.nbrightTv)).setText(e50.I6 + "%");
                    if (e50.M2 && e50.J6) {
                        ActivityTxt.this.Ze(e50.I6, true);
                    }
                } catch (Exception e) {
                    e50.S0(e);
                }
            }
        }

        class b implements h.l {
            b() {
            }

            @Override
            public void getFont(String newName) {
                if (newName.equals(e50.F3)) {
                    return;
                }
                String str = com.flyersoft.staticlayout.j.e + com.flyersoft.staticlayout.j.f + com.flyersoft.staticlayout.j.g;
                e50.F3 = newName;
                com.flyersoft.staticlayout.j.j();
                String str2 = com.flyersoft.staticlayout.j.e + com.flyersoft.staticlayout.j.f + com.flyersoft.staticlayout.j.g;
                ActivityTxt.this.zd();
                if (!str.equals(str2)) {
                    ActivityTxt.this.Ad();
                }
                ActivityTxt.this.N7(100);
                ActivityTxt.this.P9();
            }
        }

        class c implements DialogInterface.OnClickListener {
            final EditText a;

            c(final EditText val$et) {
                this.a = val$et;
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                float y2 = o50.y2(this.a.getText().toString());
                if (y2 == e50.d3 || y2 <= 4.0f || y2 > 100.0f) {
                    return;
                }
                e50.d3 = y2;
                ActivityTxt.this.Y7(0);
                ActivityTxt.this.P9();
            }
        }

        class d implements ReadingOptionsAct.OnFlipSelected {
            d() {
            }

            @Override
            public void afterSelect() {
                ActivityTxt.this.Ch();
                ActivityTxt.this.g4 = true;
            }
        }

        class e implements ColorDialog.g {
            e() {
            }

            @Override
            public void getColor(int color) {
                if (ActivityTxt.this.Ne(color)) {
                    ((RoundButton) ActivityTxt.this.y2.findViewById(R.id.fontColor)).setSolidColor(e50.f3);
                    ActivityTxt.this.o5();
                    ActivityTxt.this.P9();
                }
            }
        }

        class f implements ColorDialog.g {
            f() {
            }

            @Override
            public void getColor(int color) {
                int o0 = e50.o0(color);
                if (o0 != e50.k3 || e50.B3) {
                    e50.k3 = o0;
                    ActivityTxt.this.b5(null, o0);
                    e50.B3 = false;
                    ActivityTxt.this.U1.setBackgroundColor(o0);
                    ActivityTxt.this.Ah();
                    ActivityTxt.this.o5();
                    ActivityTxt.this.P9();
                }
            }
        }

        class g implements j.i {
            g() {
            }

            @Override
            public void onGetImageFile(String filename, String outerPath) {
                Drawable I2;
                e50.V7 = outerPath;
                e50.N5(filename);
                if (filename == null || (I2 = e50.I2(e50.w1(false), filename, 0, 0)) == null) {
                    return;
                }
                e50.B6(ActivityTxt.this.U1, I2);
                e50.B3 = true;
                e50.z3 = filename;
                ActivityTxt.this.b5(I2, e50.f3);
                ActivityTxt.this.Ah();
                ActivityTxt.this.o5();
                ActivityTxt.this.P9();
            }
        }

        class h implements ColorDialog.g {
            h() {
            }

            @Override
            public void getColor(int color) {
                e50.m d3 = e50.d3();
                d3.c = color;
                d3.c(d3.a, false);
                ((RoundButton) ActivityTxt.this.D2.findViewById(R.id.nfontColor)).setSolidColor(d3.c);
                if (e50.M2 && ActivityTxt.this.Ne(color)) {
                    ActivityTxt.this.Ah();
                    ActivityTxt.this.o5();
                    ActivityTxt.this.P9();
                }
            }
        }

        class i implements ColorDialog.g {
            i() {
            }

            @Override
            public void getColor(int color) {
                e50.m d3 = e50.d3();
                int o0 = e50.o0(color);
                if (o0 != d3.d || d3.f) {
                    d3.d = o0;
                    d3.f = false;
                    d3.c(d3.a, false);
                    ActivityTxt.this.Gh();
                    if (e50.M2) {
                        e50.B3 = false;
                        ActivityTxt.this.b5(null, o0);
                        e50.M1.setBackgroundColor(o0);
                        ActivityTxt.this.Ah();
                        ActivityTxt.this.o5();
                        ActivityTxt.this.P9();
                    }
                }
            }
        }

        class j implements j.i {
            j() {
            }

            @Override
            public void onGetImageFile(String filename, String outerPath) {
                Drawable I2;
                e50.V7 = outerPath;
                if (filename == null || (I2 = e50.I2(e50.w1(false), filename, 0, 0)) == null) {
                    return;
                }
                e50.m d3 = e50.d3();
                d3.f = true;
                d3.e = filename;
                d3.c(d3.a, false);
                ActivityTxt.this.Gh();
                if (e50.M2) {
                    e50.B6(e50.M1, I2);
                    e50.B3 = true;
                    e50.z3 = filename;
                    ActivityTxt.this.b5(I2, e50.f3);
                    ActivityTxt.this.Ah();
                    ActivityTxt.this.o5();
                }
                ActivityTxt.this.P9();
            }
        }

        f4() {
        }

        @Override
        public void onClick(View v) {
            Drawable I2;
            Drawable I22;
            switch (v.getId()) {
                case R.id.backgroundColor:
                    ActivityTxt activityTxt = ActivityTxt.this;
                    new ColorDialog(activityTxt, activityTxt.getString(R.string.background_color), false, e50.k3, new f()).show();
                    return;
                case R.id.backgroundColorTv:
                    if (e50.B3) {
                        e50.B3 = false;
                        ActivityTxt.this.U1.setBackgroundColor(e50.k3);
                        ActivityTxt.this.Ah();
                        ActivityTxt.this.o5();
                        ActivityTxt.this.P9();
                        return;
                    }
                    return;
                case R.id.backgroundImage:
                    new com.flyersoft.seekbooks.j(ActivityTxt.this, new g(), e50.w1(true), true, e50.V7, 1, e50.k0(90.0f), e50.k0(70.0f), ActivityTxt.this.getString(R.string.background_image), e50.z3).show();
                    return;
                case R.id.backgroundImageTv:
                    if (e50.B3 || (I2 = e50.I2(e50.w1(false), e50.z3, 0, 0)) == null) {
                        return;
                    }
                    e50.B6(ActivityTxt.this.U1, I2);
                    e50.B3 = true;
                    ActivityTxt.this.b5(I2, e50.f3);
                    ActivityTxt.this.Ah();
                    ActivityTxt.this.o5();
                    ActivityTxt.this.P9();
                    return;
                case R.id.denseT:
                    if (!e50.Q3) {
                        e50.Q3 = true;
                        ActivityTxt.this.o4.setChecked(!true);
                        ActivityTxt.this.p4.setChecked(e50.Q3);
                        ActivityTxt.this.Ad();
                        ActivityTxt.this.P9();
                    }
                    o50.o2(ActivityTxt.this, "关于紧凑排版的说明", "该模式下每行会尽量显示更多字符, 允许标点出现在行首, 允许拆分标点组合, 允许拆分西文单词等.");
                    return;
                case R.id.exportTheme:
                    ActivityTxt.this.R7();
                    return;
                case R.id.flip1:
                    e50.g4 = 0;
                    e50.e4 = 0;
                    e50.N5 = false;
                    ActivityTxt.this.Ch();
                    ActivityTxt.this.g4 = true;
                    return;
                case R.id.flip2:
                    e50.g4 = 6;
                    e50.e4 = 6;
                    ActivityTxt.this.Ch();
                    ActivityTxt.this.g4 = true;
                    return;
                case R.id.flip3:
                    e50.g4 = 2;
                    e50.e4 = 2;
                    ActivityTxt.this.Ch();
                    ActivityTxt.this.g4 = true;
                    return;
                case R.id.fontColor:
                    ActivityTxt activityTxt2 = ActivityTxt.this;
                    new ColorDialog(activityTxt2, activityTxt2.getString(R.string.font_color), true, e50.f3, new e()).show();
                    return;
                case R.id.fontFan:
                    if (e50.R3) {
                        e50.R3 = false;
                        e50.S3 = true;
                        o50.n2(ActivityTxt.this, e50.W0("已设置文本为繁简转换, 不需要时请及时取消. 如果所阅读文本并非繁体字, 强制繁简转换后可能会出现一些异常文字."));
                    } else if (e50.S3) {
                        e50.R3 = false;
                        e50.S3 = false;
                        o50.r2(ActivityTxt.this, e50.W0("已取消简繁/繁简转换, 目前为原始文本"), 1, 17);
                    } else {
                        e50.R3 = true;
                        e50.S3 = false;
                        o50.r2(ActivityTxt.this, e50.W0("已设置文本为简繁转换"), 1, 17);
                    }
                    ActivityTxt.this.Bh();
                    ActivityTxt.this.Ad();
                    ActivityTxt.this.P9();
                    return;
                case R.id.fontsize1:
                    ActivityTxt.this.Y7(-1);
                    ActivityTxt.this.P9();
                    return;
                case R.id.fontsize2:
                    ActivityTxt.this.Y7(1);
                    ActivityTxt.this.P9();
                    return;
                case R.id.fontsizeTv:
                    EditText editText = new EditText(ActivityTxt.this);
                    editText.setText("" + e50.d3);
                    editText.setSingleLine();
                    editText.setInputType(8192);
                    new m.c(ActivityTxt.this).y(R.string.font_size).B(editText).w("确定", new c(editText)).p(com.qadsdk.s1.s5.BTN_CANCEL, null).C();
                    return;
                case R.id.importTheme:
                    ActivityTxt.this.ba();
                    return;
                case R.id.moreFlip:
                    ActivityTxt activityTxt3 = ActivityTxt.this;
                    ReadingOptionsAct.showFlipOptions(activityTxt3, activityTxt3.f4, null, new d());
                    return;
                case R.id.moreFont:
                    if (ActivityTxt.this.wf(1)) {
                        new com.flyersoft.seekbooks.h(ActivityTxt.this, new b()).show();
                        return;
                    }
                    return;
                case R.id.moreTheme:
                    e50.V3 = 5;
                    ActivityTxt.this.Kh();
                    ActivityTxt.this.Af(4);
                    return;
                case R.id.moreTypeset:
                    if (ActivityTxt.this.wf(2)) {
                        ActivityTxt.this.Af(5);
                        return;
                    }
                    return;
                case R.id.nautoCancelNight:
                    e50.D6 = !e50.D6;
                    ((RoundButton) ActivityTxt.this.D2.findViewById(R.id.nautoCancelNight)).setChecked(e50.D6);
                    return;
                case R.id.nbackgroundColor:
                    ActivityTxt activityTxt4 = ActivityTxt.this;
                    new ColorDialog(activityTxt4, activityTxt4.getString(R.string.background_color), false, e50.d3().d, new i()).show();
                    return;
                case R.id.nbackgroundColorTv:
                    e50.m d3 = e50.d3();
                    if (d3.f) {
                        d3.f = false;
                        d3.c(d3.a, false);
                        ActivityTxt.this.Gh();
                        if (e50.M2) {
                            e50.B3 = false;
                            ActivityTxt.this.b5(null, d3.d);
                            ActivityTxt.this.U1.setBackgroundColor(d3.d);
                            ActivityTxt.this.Ah();
                            ActivityTxt.this.o5();
                            ActivityTxt.this.P9();
                            return;
                        }
                        return;
                    }
                    return;
                case R.id.nbackgroundImage:
                    new com.flyersoft.seekbooks.j(ActivityTxt.this, new j(), e50.w1(true), true, e50.V7, 1, e50.k0(90.0f), e50.k0(70.0f), ActivityTxt.this.getString(R.string.background_image), e50.z3).show();
                    return;
                case R.id.nbackgroundImageTv:
                    e50.m d32 = e50.d3();
                    if (d32.f || (I22 = e50.I2(e50.w1(false), d32.e, 0, 0)) == null) {
                        return;
                    }
                    d32.f = true;
                    d32.c(d32.a, false);
                    ActivityTxt.this.Gh();
                    if (e50.M2) {
                        e50.B6(e50.M1, I22);
                        e50.B3 = true;
                        e50.z3 = d32.e;
                        ActivityTxt.this.b5(I22, e50.f3);
                        ActivityTxt.this.Ah();
                        ActivityTxt.this.o5();
                        ActivityTxt.this.P9();
                        return;
                    }
                    return;
                case R.id.nbrightIndicator:
                case R.id.nbrightText:
                    e50.J6 = !e50.J6;
                    ((ImageView) ActivityTxt.this.D2.findViewById(R.id.nbrightIndicator)).setImageResource(e50.J6 ? R.drawable.indicator2 : R.drawable.indicator3);
                    return;
                case R.id.nbrightTv:
                    EditText editText2 = new EditText(ActivityTxt.this);
                    editText2.setText("" + e50.I6);
                    editText2.setSingleLine();
                    editText2.setInputType(InputDeviceCompat.SOURCE_TOUCHSCREEN);
                    new m.c(ActivityTxt.this).y(R.string.brightness).B(editText2).w("确定", new a(editText2)).p(com.qadsdk.s1.s5.BTN_CANCEL, null).C();
                    return;
                case R.id.nextChapterTv:
                    if (ActivityTxt.this.f2.getTag() == null) {
                        ActivityTxt.this.f2.setTag(1);
                        ActivityTxt.this.re(true);
                    }
                    if (ActivityTxt.this.i7()) {
                        ActivityTxt.this.P9();
                        ActivityTxt.this.f2.setVisibility(0);
                        ActivityTxt.this.wh();
                        return;
                    }
                    return;
                case R.id.nfontColor:
                    ActivityTxt activityTxt5 = ActivityTxt.this;
                    new ColorDialog(activityTxt5, activityTxt5.getString(R.string.font_color), true, e50.d3().c, new h()).show();
                    return;
                case R.id.priorChapterTv:
                    if (ActivityTxt.this.f2.getTag() == null) {
                        ActivityTxt.this.f2.setTag(1);
                        ActivityTxt.this.re(true);
                    }
                    if (ActivityTxt.this.q7()) {
                        ActivityTxt.this.P9();
                        ActivityTxt.this.f2.setVisibility(0);
                        ActivityTxt.this.wh();
                        return;
                    }
                    return;
                case R.id.resetSpace:
                    e50.d7();
                    if (e50.E2) {
                        e50.a4 += (ActivityTxt.this.w8 * 3) / 5;
                    }
                    e50.c7();
                    ActivityTxt.this.P9();
                    ActivityTxt.this.qf(2);
                    ActivityTxt.this.Fh(false);
                    ActivityTxt.this.o4.setChecked(!e50.Q3);
                    ActivityTxt.this.p4.setChecked(e50.Q3);
                    ActivityTxt.this.Ad();
                    ActivityTxt.this.G4(0);
                    o50.r2(ActivityTxt.this, "已重置各间距为缺省值", 1, 17);
                    return;
                case R.id.saveTheme:
                    ActivityTxt.this.ve();
                    return;
                case R.id.setNightTheme:
                case R.id.setNightTheme2:
                    ActivityTxt.this.Af(6);
                    ActivityTxt.this.Gh();
                    return;
                case R.id.standardT:
                    if (e50.Q3) {
                        e50.Q3 = false;
                        ActivityTxt.this.o4.setChecked(!false);
                        ActivityTxt.this.p4.setChecked(e50.Q3);
                        ActivityTxt.this.Ad();
                        ActivityTxt.this.P9();
                        return;
                    }
                    return;
                case R.id.theme1:
                    ActivityTxt.this.lf(1);
                    return;
                case R.id.theme2:
                    ActivityTxt.this.lf(2);
                    return;
                case R.id.theme3:
                    ActivityTxt.this.lf(3);
                    return;
                case R.id.theme4:
                    ActivityTxt.this.lf(4);
                    return;
                case R.id.typeset1:
                    ActivityTxt.this.qf(1);
                    return;
                case R.id.typeset2:
                    ActivityTxt.this.qf(2);
                    return;
                case R.id.typeset3:
                    ActivityTxt.this.qf(3);
                    return;
                case R.id.typeset4:
                    ActivityTxt.this.qf(4);
                    return;
                default:
                    return;
            }
        }
    }

    public class f5 extends Handler {
        f5(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            Handler handler = ActivityTxt.this.H1;
            handler.sendMessageDelayed(handler.obtainMessage(202, msg.what, 0), ActivityTxt.this.V7(false) ? 50L : ActivityTxt.this.Y5());
        }
    }

    public class f6 extends BroadcastReceiver {
        f6() {
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            Intent launchIntentForPackage;
            String action = intent.getAction();
            if (action.equals("mr.tts.stop")) {
                ActivityTxt activityTxt = ActivityTxt.this;
                activityTxt.z7(activityTxt.x7, false);
            }
            if (action.equals("mr.tts.pause")) {
                ActivityTxt activityTxt2 = ActivityTxt.this;
                if (!activityTxt2.J7) {
                    activityTxt2.fc();
                }
            }
            if (action.equals("mr.tts.play")) {
                ActivityTxt activityTxt3 = ActivityTxt.this;
                if (activityTxt3.J7) {
                    activityTxt3.he();
                }
            }
            if (!action.equals("mr.tts.to.reader") || (launchIntentForPackage = ActivityTxt.this.getPackageManager().getLaunchIntentForPackage(ActivityTxt.this.getPackageName())) == null) {
                return;
            }
            launchIntentForPackage.setFlags(268566528);
            launchIntentForPackage.setPackage(null);
            ActivityTxt.this.startActivity(launchIntentForPackage);
        }
    }

    class f7 extends Handler {
        f7(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            Integer num = (Integer) msg.obj;
            e50.N5("received key:" + num + ", msg.waht:" + msg.what);
            if (msg.what == 1) {
                int intValue = num.intValue();
                if (intValue != 79) {
                    if (intValue != 85) {
                        if (intValue != 87) {
                            if (intValue != 88) {
                                if (intValue != 126) {
                                }
                            } else if (e50.O9) {
                                ActivityTxt activityTxt = ActivityTxt.this;
                                activityTxt.z7(activityTxt.y7, false);
                            } else {
                                ActivityTxt.this.k6(e50.K4);
                            }
                        } else if (e50.O9) {
                            ActivityTxt activityTxt2 = ActivityTxt.this;
                            activityTxt2.z7(activityTxt2.A7, false);
                        } else {
                            ActivityTxt.this.k6(e50.J4);
                        }
                    }
                    int i = e50.I4;
                    if (i == 19) {
                        if (!e50.O9) {
                            ActivityTxt.this.u7();
                        } else {
                            ActivityTxt activityTxt3 = ActivityTxt.this;
                            activityTxt3.z7(activityTxt3.z7, false);
                        }
                    } else {
                        ActivityTxt.this.k6(i);
                    }
                } else {
                    int i2 = e50.H4;
                    if (i2 == 19) {
                        if (!e50.O9) {
                            ActivityTxt.this.u7();
                        } else {
                            ActivityTxt activityTxt4 = ActivityTxt.this;
                            activityTxt4.z7(activityTxt4.z7, false);
                        }
                    } else {
                        ActivityTxt.this.k6(i2);
                    }
                }
            }
            if (msg.what == 2 && num.intValue() == 0 && e50.O9) {
                ActivityTxt activityTxt5 = ActivityTxt.this;
                if (activityTxt5.L6 == 2) {
                    activityTxt5.L6 = 0;
                    return;
                }
                if (System.currentTimeMillis() - ActivityTxt.this.x1 > Constants.MINIMAL_AD_INTERVAL) {
                    long currentTimeMillis = System.currentTimeMillis();
                    ActivityTxt activityTxt6 = ActivityTxt.this;
                    if (currentTimeMillis - activityTxt6.B1 > 2000) {
                        activityTxt6.Tg();
                    }
                }
            }
        }
    }

    public class g implements DialogInterface.OnCancelListener {
        final boolean a;

        g(final boolean val$oom) {
            this.a = val$oom;
        }

        @Override
        public void onCancel(DialogInterface dialog) {
            if (!this.a) {
                ActivityTxt.this.l6();
            } else {
                ActivityTxt.this.de();
            }
        }
    }

    class g0 implements View.OnClickListener {
        g0() {
        }

        @Override
        public void onClick(View v) {
            if (ActivityTxt.this.Z5(v)) {
                return;
            }
            ActivityTxt.this.b6(((Integer) v.getTag()).intValue());
        }
    }

    public class g1 implements o.h {
        g1() {
        }

        @Override
        public void selectColor(int mode, boolean delete) {
            if (delete) {
                ActivityTxt.this.F2.o();
                e50.qa = true;
                ActivityTxt.this.J9();
                ActivityTxt.this.Pc();
            } else {
                ActivityTxt.this.pc(-1);
            }
            e50.h7 = true;
        }
    }

    public class g2 implements DownloadTask.Callback {
        final boolean a;
        final boolean b;

        g2(final boolean val$forUpdateCur, final boolean val$showTip) {
            this.a = val$forUpdateCur;
            this.b = val$showTip;
        }

        @Override
        public void onCancel() {
            ActivityTxt.this.hideProgressDlg();
            if (this.b && e50.o5()) {
                ActivityTxt activityTxt = ActivityTxt.this;
                o50.p2(activityTxt, activityTxt.getString(R.string.get_content_failed));
            }
        }

        @Override
        public void onError(DownloadTask.Result result, String err) {
            if (this.b) {
                Handler handler = ActivityTxt.this.H1;
                handler.sendMessage(handler.obtainMessage(ActivityTxt.V0, result));
            }
        }

        @Override
        public void onFinish(DownloadTask.Result result) {
            Handler handler = ActivityTxt.this.H1;
            handler.sendMessage(handler.obtainMessage(ActivityTxt.U0, this.a ? 1 : 0, this.b ? 1 : 0, result));
        }

        @Override
        public void onProgress(DownloadTask.Result result, int progress, int total) {
        }
    }

    class g3 extends SharedElementCallback {
        g3() {
        }

        @Override
        public void onSharedElementEnd(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
            e50.N5("onSharedElementEnd");
            ActivityTxt.this.q1 = true;
            super.onSharedElementEnd(sharedElementNames, sharedElements, sharedElementSnapshots);
        }

        @Override
        public void onSharedElementsArrived(List<String> sharedElementNames, List<View> sharedElements, SharedElementCallback.OnSharedElementsReadyListener listener) {
            e50.N5("onSharedElementsArrived");
            ActivityTxt activityTxt = ActivityTxt.this;
            activityTxt.n1 = true;
            activityTxt.p1 = true;
            super.onSharedElementsArrived(sharedElementNames, sharedElements, listener);
        }
    }

    public class g4 extends Handler {
        g4(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            ActivityTxt.this.Jh();
        }
    }

    class g5 extends Handler {
        g5(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            ActivityTxt activityTxt = ActivityTxt.this;
            activityTxt.O2 = false;
            activityTxt.H1.postDelayed(activityTxt, 10L);
        }
    }

    public class g6 implements View.OnClickListener {
        g6() {
        }

        @Override
        public void onClick(View v) {
            ActivityTxt.this.y7(v);
        }
    }

    public class g7 implements DialogInterface.OnClickListener {
        final CheckBox a;

        g7(final CheckBox val$checkBox) {
            this.a = val$checkBox;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            boolean z = !this.a.isChecked();
            e50.L6 = z;
            if (z) {
                return;
            }
            e50.v4 = 15;
            e50.w4 = 15;
        }
    }

    public class h implements DialogInterface.OnClickListener {
        final boolean a;

        h(final boolean val$oom) {
            this.a = val$oom;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (!this.a) {
                ActivityTxt.this.l6();
            } else {
                ActivityTxt.this.de();
            }
        }
    }

    public class h0 implements DialogInterface.OnClickListener {
        final ArrayList a;
        final CheckBox b;

        h0(final ArrayList val$fonts, final CheckBox val$cb) {
            this.a = val$fonts;
            this.b = val$cb;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ArrayList arrayList = this.a;
            if (arrayList != null && arrayList.size() > 0) {
                ActivityTxt.this.E7((String) this.a.get(0), false);
            }
            if (this.b.isChecked()) {
                e50.J2 = false;
            }
        }
    }

    public class h1 implements DialogInterface.OnDismissListener {
        h1() {
        }

        @Override
        public void onDismiss(DialogInterface dialog) {
            ActivityTxt.this.F2.f();
            ActivityTxt.this.F2.G(false);
            ActivityTxt.this.Xc(false);
        }
    }

    public class h2 implements TS.OnBookResult {
        h2() {
        }

        @Override
        public void result(String error, TS.Book book, boolean includeChapters) {
            if (e50.Q1 == null || ActivityTxt.this.isFinishing()) {
                return;
            }
            if (error != null) {
                ActivityTxt.this.hideProgressDlg();
                ActivityTxt.this.O7(error, true);
                return;
            }
            if (includeChapters) {
                ArrayList<S.WebChapter> arrayList = new ArrayList<>();
                S.addTsChaptersToWebChapters(arrayList, book.chapters);
                if (arrayList.size() <= 0) {
                    ActivityTxt.this.O7(e50.W0("获取章节列表失败"), true);
                    return;
                }
                S.WebBook webBook = new S.WebBook();
                webBook.chapters = arrayList;
                webBook.name = e50.Q1.d();
                webBook.author = e50.Q1.b();
                webBook.description = e50.Q1.k;
                webBook.url = book.url;
                webBook.site = S.tsBook2Site(book, false);
                q50.X(webBook, false);
                e50.G5(e50.V1);
                ActivityTxt activityTxt = ActivityTxt.this;
                activityTxt.H1.postDelayed(activityTxt, 10L);
            }
        }
    }

    public class h3 implements View.OnClickListener {

        class a implements DialogInterface.OnClickListener {
            final EditText a;

            a(final EditText val$et2) {
                this.a = val$et2;
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                String obj = this.a.getText().toString();
                if (o50.A1(obj)) {
                    String p0 = o50.p0(obj);
                    if (p0 == null) {
                        return;
                    }
                    while (true) {
                        int indexOf = p0.indexOf("\n");
                        if (indexOf == -1) {
                            return;
                        }
                        String substring = p0.substring(0, indexOf);
                        p0 = p0.substring(indexOf + 1);
                        int indexOf2 = substring.indexOf("#->#");
                        if (indexOf2 > 0) {
                            e50.M9.add(new e50.n(substring.substring(0, indexOf2), substring.substring(indexOf2 + 4)));
                            View childAt = ActivityTxt.this.i3.getChildAt(r7.getChildCount() - 1);
                            childAt.setTag(Integer.valueOf(e50.M9.size() - 1));
                            ActivityTxt.this.Le(childAt);
                            View inflate = LayoutInflater.from(ActivityTxt.this).inflate(R.layout.tts_filter, (ViewGroup) null);
                            inflate.setTag(Integer.valueOf(e50.M9.size()));
                            ActivityTxt.this.Le(inflate);
                            ActivityTxt.this.i3.addView(inflate, -1, -2);
                        }
                    }
                } else {
                    ActivityTxt activityTxt = ActivityTxt.this;
                    o50.o2(activityTxt, activityTxt.getString(R.string.error), "\"" + obj + "\" " + ActivityTxt.this.getString(R.string.not_exists));
                }
            }
        }

        h3() {
        }

        @Override
        public void onClick(View v) {
            EditText editText = new EditText(ActivityTxt.this);
            String str = o50.n0(e50.V1) + com.ksdk.ssds.manager.b.b + o50.N0(e50.V1) + ".ttsfilter";
            if (!o50.A1(str)) {
                str = "/sdcard/" + o50.N0(e50.V1) + ".ttsfilter";
            }
            editText.setText(str);
            new m.c(ActivityTxt.this).y(R.string.import_ebooks).B(editText).v(android.R.string.ok, new a(editText)).o(android.R.string.cancel, null).C();
        }
    }

    class h4 implements View.OnClickListener {
        h4() {
        }

        private int a(int m, int a) {
            int D7 = e50.D7(m) + a;
            if (a <= 0) {
                do {
                    m--;
                } while (e50.D7(m) >= D7);
                return m + 1;
            }
            do {
                m++;
            } while (e50.D7(m) < D7);
            return m;
        }

        @Override
        public void onClick(View v) {
            int i;
            int i2;
            int v8;
            int v82;
            int i3;
            int a;
            int intValue = ((Integer) v.getTag()).intValue();
            if (intValue == 11) {
                i = e50.X3;
            } else {
                if (intValue == 12) {
                    i3 = e50.X3;
                } else if (intValue == 21) {
                    i = e50.Y3;
                } else if (intValue == 22) {
                    i3 = e50.Y3;
                } else {
                    if (intValue == 31) {
                        i2 = a(e50.c4, -1);
                    } else if (intValue == 32) {
                        i2 = a(e50.c4, 1);
                    } else if (intValue == 41) {
                        i2 = a(e50.d4, -1);
                    } else if (intValue == 42) {
                        i2 = a(e50.d4, 1);
                    } else if (intValue == 51) {
                        i2 = a(e50.a4, -1);
                    } else if (intValue == 52) {
                        i2 = a(e50.a4, 1);
                    } else if (intValue != 61) {
                        if (intValue == 62) {
                            a = a(e50.b4, 1);
                        } else if (intValue == 71) {
                            a = e50.Z3 - 1;
                        } else if (intValue != 72) {
                            i2 = 0;
                        } else {
                            a = e50.Z3 + 1;
                        }
                        i2 = a;
                    } else {
                        i2 = a(e50.b4, -1);
                    }
                    if (intValue != 11 || intValue == 12) {
                        v8 = ActivityTxt.this.v8();
                        e50.X3 = i2;
                        e50.I6(e50.F1);
                        e50.I6(e50.G1);
                        if (ActivityTxt.this.Q1.getSpanned() == null && ((com.flyersoft.staticlayout.i[]) ActivityTxt.this.Q1.getSpanned().getSpans(0, e50.F1.getText().length(), com.flyersoft.staticlayout.i.class)).length > 0) {
                            ActivityTxt.this.Ad();
                        } else if (v8 > 0) {
                            ActivityTxt.this.kh(v8);
                        }
                        i2 = e50.X3;
                        ActivityTxt.this.h4.setProgress(i2 + 3);
                    }
                    if (intValue != 21 || intValue == 22) {
                        v82 = ActivityTxt.this.v8();
                        e50.Y3 = i2;
                        if (i2 > 20) {
                            e50.Y3 = 20;
                        }
                        if (e50.Y3 < 0) {
                            e50.Y3 = 0;
                        }
                        e50.I6(e50.F1);
                        e50.I6(e50.G1);
                        if (ActivityTxt.this.Q1.getSpanned() == null && ((com.flyersoft.staticlayout.m[]) ActivityTxt.this.Q1.getSpanned().getSpans(0, ActivityTxt.this.Q1.getText().length(), com.flyersoft.staticlayout.m.class)).length > 0) {
                            ActivityTxt.this.Ad();
                        } else if (v82 > 0) {
                            ActivityTxt.this.kh(v82);
                        }
                        i2 = e50.Y3;
                        ActivityTxt.this.i4.setProgress(i2);
                    }
                    if (intValue != 71 || intValue == 72) {
                        e50.Z3 = i2;
                        e50.G6(e50.F1);
                        e50.G6(e50.G1);
                        ActivityTxt.this.Ad();
                        i2 = e50.Z3;
                        ActivityTxt.this.j4.setProgress(i2 + 3);
                    }
                    if (intValue != 31 || intValue == 32) {
                        e50.c4 = i2;
                        ActivityTxt.this.G4(0);
                        i2 = e50.D7(e50.c4);
                        ActivityTxt.this.k4.setProgress(i2);
                    }
                    if (intValue != 41 || intValue == 42) {
                        e50.d4 = i2;
                        ActivityTxt.this.G4(1);
                        i2 = e50.D7(e50.d4);
                        ActivityTxt.this.l4.setProgress(i2);
                    }
                    if (intValue != 51 || intValue == 52) {
                        e50.a4 = i2;
                        ActivityTxt.this.G4(2);
                        i2 = e50.D7(e50.a4);
                        ActivityTxt.this.m4.setProgress(i2);
                    }
                    if (intValue != 61 || intValue == 62) {
                        e50.b4 = i2;
                        ActivityTxt.this.G4(3);
                        ActivityTxt.this.n4.setProgress(e50.D7(e50.b4));
                    }
                    e50.W3 = 5;
                    ActivityTxt.this.Lh();
                    ActivityTxt.this.Fh(true);
                    ActivityTxt.this.P9();
                }
                i2 = i3 + 1;
                if (intValue != 11) {
                }
                v8 = ActivityTxt.this.v8();
                e50.X3 = i2;
                e50.I6(e50.F1);
                e50.I6(e50.G1);
                if (ActivityTxt.this.Q1.getSpanned() == null) {
                }
                if (v8 > 0) {
                }
                i2 = e50.X3;
                ActivityTxt.this.h4.setProgress(i2 + 3);
                if (intValue != 21) {
                }
                v82 = ActivityTxt.this.v8();
                e50.Y3 = i2;
                if (i2 > 20) {
                }
                if (e50.Y3 < 0) {
                }
                e50.I6(e50.F1);
                e50.I6(e50.G1);
                if (ActivityTxt.this.Q1.getSpanned() == null) {
                }
                if (v82 > 0) {
                }
                i2 = e50.Y3;
                ActivityTxt.this.i4.setProgress(i2);
                if (intValue != 71) {
                }
                e50.Z3 = i2;
                e50.G6(e50.F1);
                e50.G6(e50.G1);
                ActivityTxt.this.Ad();
                i2 = e50.Z3;
                ActivityTxt.this.j4.setProgress(i2 + 3);
                if (intValue != 31) {
                }
                e50.c4 = i2;
                ActivityTxt.this.G4(0);
                i2 = e50.D7(e50.c4);
                ActivityTxt.this.k4.setProgress(i2);
                if (intValue != 41) {
                }
                e50.d4 = i2;
                ActivityTxt.this.G4(1);
                i2 = e50.D7(e50.d4);
                ActivityTxt.this.l4.setProgress(i2);
                if (intValue != 51) {
                }
                e50.a4 = i2;
                ActivityTxt.this.G4(2);
                i2 = e50.D7(e50.a4);
                ActivityTxt.this.m4.setProgress(i2);
                if (intValue != 61) {
                }
                e50.b4 = i2;
                ActivityTxt.this.G4(3);
                ActivityTxt.this.n4.setProgress(e50.D7(e50.b4));
                e50.W3 = 5;
                ActivityTxt.this.Lh();
                ActivityTxt.this.Fh(true);
                ActivityTxt.this.P9();
            }
            i2 = i - 1;
            if (intValue != 11) {
            }
            v8 = ActivityTxt.this.v8();
            e50.X3 = i2;
            e50.I6(e50.F1);
            e50.I6(e50.G1);
            if (ActivityTxt.this.Q1.getSpanned() == null) {
            }
            if (v8 > 0) {
            }
            i2 = e50.X3;
            ActivityTxt.this.h4.setProgress(i2 + 3);
            if (intValue != 21) {
            }
            v82 = ActivityTxt.this.v8();
            e50.Y3 = i2;
            if (i2 > 20) {
            }
            if (e50.Y3 < 0) {
            }
            e50.I6(e50.F1);
            e50.I6(e50.G1);
            if (ActivityTxt.this.Q1.getSpanned() == null) {
            }
            if (v82 > 0) {
            }
            i2 = e50.Y3;
            ActivityTxt.this.i4.setProgress(i2);
            if (intValue != 71) {
            }
            e50.Z3 = i2;
            e50.G6(e50.F1);
            e50.G6(e50.G1);
            ActivityTxt.this.Ad();
            i2 = e50.Z3;
            ActivityTxt.this.j4.setProgress(i2 + 3);
            if (intValue != 31) {
            }
            e50.c4 = i2;
            ActivityTxt.this.G4(0);
            i2 = e50.D7(e50.c4);
            ActivityTxt.this.k4.setProgress(i2);
            if (intValue != 41) {
            }
            e50.d4 = i2;
            ActivityTxt.this.G4(1);
            i2 = e50.D7(e50.d4);
            ActivityTxt.this.l4.setProgress(i2);
            if (intValue != 51) {
            }
            e50.a4 = i2;
            ActivityTxt.this.G4(2);
            i2 = e50.D7(e50.a4);
            ActivityTxt.this.m4.setProgress(i2);
            if (intValue != 61) {
            }
            e50.b4 = i2;
            ActivityTxt.this.G4(3);
            ActivityTxt.this.n4.setProgress(e50.D7(e50.b4));
            e50.W3 = 5;
            ActivityTxt.this.Lh();
            ActivityTxt.this.Fh(true);
            ActivityTxt.this.P9();
        }
    }

    class h5 implements SeekBar.OnSeekBarChangeListener {
        h5() {
        }

        private void a(int progress, boolean updatePage) {
            ActivityTxt activityTxt = ActivityTxt.this;
            Document document = activityTxt.qa;
            if (document == null || document == null) {
                return;
            }
            int kd = activityTxt.kd(progress);
            ActivityTxt.this.k2.setText("" + (kd + 1) + com.ksdk.ssds.manager.b.b + ActivityTxt.this.qa.k());
            if (updatePage) {
                long j = kd;
                e50.f2 = j;
                ActivityTxt.this.vc((int) j, true);
                ActivityTxt.this.Ih();
            }
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (ActivityTxt.this.Ya()) {
                if (fromUser) {
                    a(progress, true);
                    return;
                }
                return;
            }
            if (progress < 0) {
                progress = 0;
            }
            if (progress > 1000) {
                progress = 1000;
            }
            ActivityTxt activityTxt = ActivityTxt.this;
            if (activityTxt.L2) {
                float f = (progress * 100.0f) / 1000.0f;
                if (!fromUser) {
                    activityTxt.k2.setText(activityTxt.P8());
                } else if (!activityTxt.nb()) {
                    ActivityTxt.this.k2.setText(f + "%");
                }
            }
            if (fromUser && ActivityTxt.this.o8() > 0) {
                ActivityTxt activityTxt2 = ActivityTxt.this;
                if (activityTxt2.C9 == null && (activityTxt2.q8() == 0 || ActivityTxt.this.q8() == 1)) {
                    ActivityTxt.this.zf(progress);
                    ActivityTxt.this.k5();
                    ActivityTxt.this.Me(true);
                    ActivityTxt.this.Td();
                }
            }
            ActivityTxt.this.Q8 = -1L;
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
            if (ActivityTxt.this.f2.getTag() == null) {
                ActivityTxt.this.f2.setTag(1);
                ActivityTxt.this.re(true);
            }
            ActivityTxt activityTxt = ActivityTxt.this;
            activityTxt.r5 = activityTxt.X8(seekBar);
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            o50.n1();
            ActivityTxt.this.f2.setVisibility(0);
            if (ActivityTxt.this.q8() == 100 && !ActivityTxt.this.z4 && (ActivityTxt.this.r5 != ActivityTxt.this.X8(seekBar) || (ActivityTxt.this.X8(seekBar) == 0 && e50.f2 != 0))) {
                ActivityTxt.this.z4 = true;
                ActivityTxt activityTxt = ActivityTxt.this;
                activityTxt.zf(activityTxt.X8(seekBar));
                ActivityTxt.this.P9();
            }
            ActivityTxt.this.wh();
        }
    }

    public class h6 implements SeekBar.OnSeekBarChangeListener {
        h6() {
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser) {
                ActivityTxt activityTxt = ActivityTxt.this;
                if (seekBar == activityTxt.F7) {
                    progress = activityTxt.w9(progress);
                }
                o50.p2(ActivityTxt.this, "" + progress);
                ActivityTxt.this.tb();
                ActivityTxt activityTxt2 = ActivityTxt.this;
                if (seekBar == activityTxt2.G7) {
                    ((AudioManager) activityTxt2.getSystemService("audio")).setStreamVolume(3, seekBar.getProgress(), 0);
                }
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            ActivityTxt activityTxt = ActivityTxt.this;
            if (seekBar == activityTxt.F7 || seekBar == activityTxt.H7) {
                int progress = seekBar.getProgress();
                ActivityTxt activityTxt2 = ActivityTxt.this;
                if (seekBar == activityTxt2.F7) {
                    e50.p6 = activityTxt2.w9(progress);
                }
                ActivityTxt activityTxt3 = ActivityTxt.this;
                if (seekBar == activityTxt3.H7) {
                    if (progress <= 0) {
                        progress = 1;
                    }
                    e50.q6 = progress;
                }
                activityTxt3.of();
                ActivityTxt.this.he();
            }
        }
    }

    public class h7 implements DialogInterface.OnClickListener {
        final CheckBox a;
        final boolean b;

        h7(final CheckBox val$checkBox, final boolean val$fromLeftToRight) {
            this.a = val$checkBox;
            this.b = val$fromLeftToRight;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.L6 = !this.a.isChecked();
            if (this.b) {
                ActivityTxt.this.j7();
            } else {
                ActivityTxt.this.r7();
            }
        }
    }

    public class i implements View.OnClickListener {
        i() {
        }

        @Override
        public void onClick(View v) {
            boolean c = ActivityTxt.this.i9.c();
            int clicked = ActivityTxt.this.i9.getClicked();
            if (c && clicked == 4) {
                ActivityTxt activityTxt = ActivityTxt.this;
                o50.q2(activityTxt, activityTxt.getString(R.string.show_highlight_template_tip), 1);
                return;
            }
            ActivityTxt activityTxt2 = ActivityTxt.this;
            PDFReader pDFReader = activityTxt2.F2;
            if (pDFReader != null && !pDFReader.c) {
                if (c && activityTxt2.Fa()) {
                    return;
                }
                if (c) {
                    e50.A3 = clicked;
                }
                ActivityTxt activityTxt3 = ActivityTxt.this;
                activityTxt3.pc(activityTxt3.i9.getClickedColor());
                return;
            }
            if (c) {
                e50.A3 = clicked;
                activityTxt2.i9.postInvalidate();
            }
            ActivityTxt activityTxt4 = ActivityTxt.this;
            MRTextView mRTextView = e50.y8 == activityTxt4.T1 ? activityTxt4.R1 : activityTxt4.Q1;
            if (!c) {
                clicked = -1;
            }
            activityTxt4.o6(mRTextView, clicked, activityTxt4.i9.getClickedColor(), !c);
        }
    }

    public class i0 implements b.h {
        final String a;
        final boolean b;

        class a implements DialogInterface.OnClickListener {
            final String a;

            a(final String val$saveTo) {
                this.a = val$saveTo;
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                if (o50.g2(this.a, o50.n0(this.a) + com.ksdk.ssds.manager.b.b + i0.this.a + o50.k0(this.a), true)) {
                    i0.this.b();
                }
            }
        }

        public class b implements DialogInterface.OnClickListener {
            b() {
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                ActivityTxt.this.pe(true);
                ActivityTxt.this.ee();
            }
        }

        i0(final String val$font, final boolean val$restartTip) {
            this.a = val$font;
            this.b = val$restartTip;
        }

        public void b() {
            if (this.b) {
                new m.c(ActivityTxt.this).l(R.string.use_css_font_now).v(android.R.string.ok, new b()).o(android.R.string.cancel, null).C();
            } else {
                ActivityTxt.this.pe(true);
                ActivityTxt.this.ee();
            }
        }

        @Override
        public void onGetImageFile(final String saveTo, Drawable d) {
            if (saveTo != null) {
                if (o50.N0(saveTo).toLowerCase().equals(this.a.toLowerCase())) {
                    b();
                    return;
                }
                new m.c(ActivityTxt.this).m(Html.fromHtml("\"<b>" + o50.v0(saveTo) + "</b>\" " + ActivityTxt.this.getString(R.string.rename_file) + " \"<b>" + this.a + o50.k0(saveTo) + "</b>\"?")).d(false).v(android.R.string.ok, new a(saveTo)).o(android.R.string.cancel, null).C();
            }
        }
    }

    public class i1 implements f.a {

        class a implements DialogInterface.OnCancelListener {
            a() {
            }

            @Override
            public void onCancel(DialogInterface dialog) {
                ActivityTxt.this.F2.G(false);
                ActivityTxt.this.za = false;
            }
        }

        class b implements DialogInterface.OnClickListener {
            b() {
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                ActivityTxt.this.F2.G(false);
                ActivityTxt.this.za = false;
            }
        }

        class c implements DialogInterface.OnClickListener {
            final EditText a;

            c(final EditText val$et) {
                this.a = val$et;
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                ActivityTxt.this.F2.q(this.a.getText().toString());
                e50.qa = true;
                ActivityTxt.this.F2.G(false);
                ActivityTxt.this.za = false;
            }
        }

        class d implements DialogInterface.OnCancelListener {
            d() {
            }

            @Override
            public void onCancel(DialogInterface dialog) {
                ActivityTxt.this.F2.G(false);
                ActivityTxt.this.za = false;
            }
        }

        class e implements DialogInterface.OnClickListener {
            e() {
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                ActivityTxt.this.F2.G(false);
                ActivityTxt.this.za = false;
            }
        }

        class f implements DialogInterface.OnClickListener {
            f() {
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                ActivityTxt activityTxt = ActivityTxt.this;
                activityTxt.F2.p(activityTxt.Aa);
                e50.qa = true;
                ActivityTxt.this.F2.G(false);
                ActivityTxt.this.za = false;
            }
        }

        class g implements DialogInterface.OnClickListener {
            g() {
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                ActivityTxt.this.Aa = which;
            }
        }

        i1() {
        }

        @Override
        public void onAnnotComboBox(int sel, String[] opts, float arg2, float arg3, float arg4, float arg5) {
            ActivityTxt activityTxt = ActivityTxt.this;
            activityTxt.za = true;
            activityTxt.F2.G(true);
            ActivityTxt.this.Aa = sel;
            new m.c(ActivityTxt.this).x(opts, sel, new g()).v(R.string.ok, new f()).o(R.string.cancel, new e()).t(new d()).C();
        }

        @Override
        public void onAnnotDragStart(boolean has_goto, boolean has_popup) {
            ActivityTxt activityTxt = ActivityTxt.this;
            activityTxt.za = true;
            activityTxt.za(true);
            Page.a selectedAnnot = ActivityTxt.this.F2.b.getSelectedAnnot();
            int T = selectedAnnot.T();
            if (T == 1 || T == 3 || T == 4 || T == 5 || T == 6 || T == 15) {
                ActivityTxt.this.ia.setVisibility(0);
                ActivityTxt.this.fa.setVisibility((T == 1 || T == 3) ? 8 : 0);
                ActivityTxt.this.ga.setVisibility((T == 1 || T == 3) ? 8 : 0);
                ActivityTxt.this.ha.setVisibility((T == 5 || T == 6) ? 0 : 8);
                ActivityTxt.this.ea.setImageResource(R.drawable.trash);
                ActivityTxt.this.S9.setVisibility(0);
                if (ActivityTxt.this.R9.getVisibility() == 0) {
                    ActivityTxt activityTxt2 = ActivityTxt.this;
                    activityTxt2.T9 = null;
                    activityTxt2.Wc();
                }
                if (o50.F1(selectedAnnot.J())) {
                    return;
                }
                ActivityTxt activityTxt3 = ActivityTxt.this;
                activityTxt3.oa.onClick(activityTxt3.ia);
                return;
            }
            if (!o50.F1(ActivityTxt.this.F2.i())) {
                ActivityTxt.this.nc();
                return;
            }
            ActivityTxt.this.Vc(false);
            ActivityTxt.this.n9.setTag(1);
            ActivityTxt.this.Te(true);
            ActivityTxt.this.d9.setTextColor(-2002081110);
            ActivityTxt.this.g9.setTextColor(-2002081110);
            ActivityTxt.this.h9.setTextColor(-2002081110);
        }

        @Override
        public void onAnnotEditBox(int type, String val, float text_size, float left, float top, float right, float bottom) {
            ActivityTxt.this.Oc();
            if (PDFReader.F(ActivityTxt.this.F2.b.getSelectedAnnot())) {
                onAnnotDragStart(false, false);
                return;
            }
            ActivityTxt activityTxt = ActivityTxt.this;
            activityTxt.za = true;
            activityTxt.F2.G(true);
            EditText editText = new EditText(ActivityTxt.this);
            editText.setText(val);
            new m.c(ActivityTxt.this).B(editText).v(R.string.ok, new c(editText)).o(R.string.cancel, new b()).t(new a()).C();
        }

        @Override
        public void onAnnotEnd() {
            ActivityTxt.this.Ba = SystemClock.elapsedRealtime();
            ActivityTxt activityTxt = ActivityTxt.this;
            activityTxt.za = false;
            activityTxt.T9 = null;
            e50.ra = f.EnumC1090f.sta_none;
            if (activityTxt.R9.getVisibility() == 0) {
                ActivityTxt.this.Zc();
            }
            ActivityTxt.this.wc(false, true);
            ActivityTxt.this.J9();
        }

        @Override
        public void onAnnotUpdate() {
            ActivityTxt.this.J9();
        }
    }

    public class i2 implements TS.OnBookResult {
        final boolean a;
        final boolean b;

        i2(final boolean val$forUpdateCur, final boolean val$showTip) {
            this.a = val$forUpdateCur;
            this.b = val$showTip;
        }

        @Override
        public void result(String error, TS.Book book, boolean includeChapters) {
            if (e50.Q1 == null || ActivityTxt.this.isFinishing()) {
                return;
            }
            if (error != null) {
                ActivityTxt.this.hideProgressDlg();
                o50.p2(ActivityTxt.this, error);
            } else if (includeChapters) {
                ArrayList<S.WebChapter> arrayList = new ArrayList<>();
                S.addTsChaptersToWebChapters(arrayList, book.chapters);
                ActivityTxt activityTxt = ActivityTxt.this;
                S.WebBook webBook = activityTxt.wb;
                webBook.chapters = arrayList;
                webBook.tag = book.tag;
                activityTxt.Qb(this.a, this.b, arrayList);
            }
        }
    }

    public class i3 implements DialogInterface.OnClickListener {
        i3() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.Ib = System.currentTimeMillis();
            ActivityTxt.this.Hb = true;
            ActivityTxt.this.Fb = null;
            if (ActivityTxt.this.Gb != e50.Q1.h().get(e50.g2).b.size()) {
                ActivityTxt.this.Ld();
            }
        }
    }

    class i4 implements SeekBar.OnSeekBarChangeListener {
        i4() {
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser) {
                ActivityTxt.this.o5();
                ActivityTxt.this.P9();
                if (seekBar == ActivityTxt.this.h4) {
                    e50.X3 = progress - 3;
                    e50.I6(e50.F1);
                    e50.I6(e50.G1);
                    if (ActivityTxt.this.Q1.getSpanned() != null && ((com.flyersoft.staticlayout.i[]) ActivityTxt.this.Q1.getSpanned().getSpans(0, e50.F1.getText().length(), com.flyersoft.staticlayout.i.class)).length > 0) {
                        ActivityTxt.this.Ad();
                    }
                }
                if (seekBar == ActivityTxt.this.i4) {
                    e50.Y3 = progress;
                    e50.I6(e50.F1);
                    e50.I6(e50.G1);
                    if (ActivityTxt.this.Q1.getSpanned() != null && ((com.flyersoft.staticlayout.m[]) ActivityTxt.this.Q1.getSpanned().getSpans(0, ActivityTxt.this.Q1.getText().length(), com.flyersoft.staticlayout.m.class)).length > 0) {
                        ActivityTxt.this.Ad();
                    }
                }
                if (seekBar == ActivityTxt.this.j4) {
                    e50.Z3 = progress - 3;
                    e50.G6(e50.F1);
                    e50.G6(e50.G1);
                    ActivityTxt.this.Ad();
                }
                if (seekBar == ActivityTxt.this.k4) {
                    e50.c4 = e50.K0(progress);
                    ActivityTxt.this.G4(0);
                }
                if (seekBar == ActivityTxt.this.l4) {
                    e50.d4 = e50.K0(progress);
                    ActivityTxt.this.G4(1);
                }
                if (seekBar == ActivityTxt.this.m4) {
                    e50.a4 = e50.K0(progress);
                    ActivityTxt.this.G4(2);
                }
                if (seekBar == ActivityTxt.this.n4) {
                    e50.b4 = e50.K0(progress);
                    ActivityTxt.this.G4(3);
                }
                e50.W3 = 5;
                ActivityTxt.this.Lh();
                ActivityTxt.this.Fh(true);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    }

    public class i5 implements DialogInterface.OnClickListener {
        final e50.j a;

        class a implements d.InterfaceC0936d {
            a() {
            }

            @Override
            public void AfterEdit(String result, Integer editColor) {
                e50.j jVar = i5.this.a;
                jVar.b = result;
                jVar.i = editColor.intValue();
                g50.x0(i5.this.a);
                g50.b(i5.this.a);
                e50.h7 = true;
                if (ActivityTxt.this.Dh()) {
                    return;
                }
                ActivityTxt.this.a2.postInvalidate();
            }
        }

        i5(final e50.j val$bm) {
            this.a = val$bm;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            int L1;
            if (which == 0) {
                new com.flyersoft.seekbooks.d(ActivityTxt.this, this.a.b, new a(), Integer.valueOf(this.a.i));
                return;
            }
            if (which == 1 && (L1 = e50.L1(e50.V1)) != -1) {
                e50.J1().get(L1).a(this.a);
                g50.x0(this.a);
                e50.h7 = true;
                if (ActivityTxt.this.Dh()) {
                    return;
                }
                ActivityTxt.this.a2.postInvalidate();
            }
        }
    }

    public class i6 extends Handler {
        i6(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            if (ActivityTxt.this.P7) {
                return;
            }
            ActivityTxt activityTxt = ActivityTxt.this;
            if (activityTxt.I7) {
                activityTxt.rg(false);
            }
        }
    }

    public class i7 implements DialogInterface.OnKeyListener {
        i7() {
        }

        @Override
        public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
            return keyCode == 25 || keyCode == 24 || keyCode == 92 || keyCode == 93 || keyCode == 105 || keyCode == 106;
        }
    }

    public class j implements View.OnLongClickListener {

        class a implements ColorDialog.g {
            a() {
            }

            @Override
            public void getColor(int color) {
                if (ActivityTxt.this.i9.c()) {
                    int clicked = ActivityTxt.this.i9.getClicked();
                    if (clicked != 0) {
                        if (clicked == 1) {
                            e50.n3 = color;
                        } else if (clicked == 2) {
                            e50.p3 = color;
                        } else if (clicked == 3) {
                            e50.o3 = color;
                        } else if (clicked == 4) {
                            return;
                        }
                    } else if (ActivityTxt.this.Ya()) {
                        e50.m3 = color;
                    } else {
                        e50.g3 = color;
                    }
                } else {
                    int clicked2 = ActivityTxt.this.i9.getClicked();
                    if (clicked2 != 0) {
                        if (clicked2 == 1) {
                            e50.h3 = color;
                        } else if (clicked2 == 2) {
                            e50.i3 = color;
                        } else if (clicked2 == 3) {
                            e50.j3 = color;
                        } else if (clicked2 == 4) {
                            int i = e50.A3;
                            if (i == 3) {
                                e50.o3 = color;
                            } else if (i == 2) {
                                e50.p3 = color;
                            } else {
                                e50.n3 = color;
                            }
                        }
                    } else if (ActivityTxt.this.Ya()) {
                        e50.m3 = color;
                    } else {
                        e50.g3 = color;
                    }
                }
                ActivityTxt.this.i9.postInvalidate();
            }
        }

        j() {
        }

        @Override
        public boolean onLongClick(View v) {
            if (ActivityTxt.this.i9.c() && ActivityTxt.this.i9.getClicked() == 4) {
                return true;
            }
            ActivityTxt activityTxt = ActivityTxt.this;
            new ColorDialog(activityTxt, activityTxt.getString(R.string.highlight_color), true, ActivityTxt.this.i9.getLongClickedColor(), new a()).show();
            return true;
        }
    }

    public class j0 extends Handler {
        j0(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            ActivityTxt.this.nh(msg.what);
            ActivityTxt.this.K7();
        }
    }

    public class j1 extends Thread {
        j1() {
        }

        @Override
        public void run() {
            ActivityTxt.this.Fa = true;
            try {
                try {
                } catch (Exception e) {
                    e50.S0(e);
                }
                if (ActivityTxt.this.isFinishing()) {
                    return;
                }
                if (ActivityTxt.this.Ea <= 0) {
                    ActivityTxt.this.c8(1);
                    S.BookSite bookSite = e50.Q1.p;
                    if (bookSite != null && bookSite.ok()) {
                        ActivityTxt activityTxt = ActivityTxt.this;
                        activityTxt.Hh(activityTxt.Da, ActivityTxt.this.Ja, true);
                    }
                } else {
                    ActivityTxt activityTxt2 = ActivityTxt.this;
                    f50 f50Var = e50.Q1;
                    activityTxt2.m5 = f50Var == null ? activityTxt2.G5() : f50Var.p();
                    ActivityTxt activityTxt3 = ActivityTxt.this;
                    activityTxt3.Ja = e50.Q(e50.G9.get(activityTxt3.Ea));
                    ActivityTxt activityTxt4 = ActivityTxt.this;
                    activityTxt4.te(activityTxt4.Da, com.flyersoft.staticlayout.j.c(ActivityTxt.this.Ja, ActivityTxt.this.m5, ActivityTxt.this.Da), true);
                    ActivityTxt.this.Ia = e50.G9;
                }
            } finally {
                ActivityTxt.this.Fa = false;
            }
        }
    }

    public class j2 implements DialogInterface.OnClickListener {
        j2() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.M9 = null;
            e50.y4();
        }
    }

    public class j3 extends StoreWebView.e {
        j3() {
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            e50.N5("#onPageFinished : " + url);
            ActivityTxt.this.hideProgressDlg();
            ActivityTxt activityTxt = ActivityTxt.this;
            if (activityTxt.Kb) {
                activityTxt.Kb = false;
                view.clearHistory();
            }
        }

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            e50.N5("#onPageStarted : " + url);
            ActivityTxt.this.bg();
            if (ActivityTxt.this.Kb) {
                view.clearHistory();
            }
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            e50.N5("#url : " + url);
            if (S.openAppInWebView(ActivityTxt.this, url, true)) {
                return true;
            }
            if (url.endsWith(".txt")) {
                ActivityTxt activityTxt = ActivityTxt.this;
                BrowserAct.downloadBook(activityTxt, activityTxt.H1, activityTxt.z8, url, null, null);
                return true;
            }
            if (ActivityTxt.this.Kb) {
                view.clearHistory();
            }
            if (ThirdConfig.isYueWenUrl(url)) {
                return super.shouldOverrideUrlLoading(view, url);
            }
            view.loadUrl(url);
            return true;
        }
    }

    public class j4 implements SeekBar.OnSeekBarChangeListener {
        j4() {
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser) {
                ActivityTxt.this.Ze(progress - 50, true);
                ActivityTxt.this.s4.setChecked(false);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    }

    public class j5 extends Handler {
        final String a;
        final String b;

        j5(Looper looper, final String val$url, final String val$title) {
            super(looper);
            this.a = val$url;
            this.b = val$title;
        }

        @Override
        public void handleMessage(Message msg) {
            try {
                ActivityTxt.this.n9().invalidate();
                ActivityTxt.this.Wb(this.a, this.b);
            } catch (Exception e) {
                e50.S0(e);
            } catch (OutOfMemoryError e2) {
                e50.S0(e2);
            }
        }
    }

    class j6 implements DialogInterface.OnClickListener {
        final CheckBox a;
        final Spinner b;
        final SeekBar c;

        j6(final CheckBox val$checkBox, final Spinner val$sp, final SeekBar val$sb) {
            this.a = val$checkBox;
            this.b = val$sp;
            this.c = val$sb;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.P6 = !this.a.isChecked();
            e50.r5 = this.b.getSelectedItemPosition();
            e50.s5 = 100 - this.c.getProgress();
            ActivityTxt.this.O6(true);
        }
    }

    public class j7 extends Thread {
        j7() {
        }

        @Override
        public void run() {
            try {
                e50.M(true);
                e50.J1();
                e50.L9 = true;
                ActivityTxt.this.Q1.postInvalidate();
                ActivityTxt.this.R1.postInvalidate();
            } catch (Exception e) {
                e50.S0(e);
            }
        }
    }

    public class k implements e50.h {
        k() {
        }

        @Override
        public void Finished(boolean success) {
            if (ActivityTxt.this.Nb()) {
                ActivityTxt.this.fa();
            }
        }
    }

    public class k0 extends Handler {
        k0(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            ActivityTxt activityTxt = ActivityTxt.this;
            activityTxt.ph(activityTxt.Q1.getText());
            ActivityTxt.this.B9();
        }
    }

    public class k1 extends Handler {
        k1(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            ActivityTxt.this.x9(true);
        }
    }

    public class k2 implements DialogInterface.OnClickListener {
        k2() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt activityTxt = ActivityTxt.this;
            activityTxt.Wg(activityTxt.wb.chapters);
        }
    }

    public class k3 implements DownloadListener {
        k3() {
        }

        @Override
        public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
            e50.N5("*onDownloadStart : " + url);
            ActivityTxt.this.L5();
            ActivityTxt.this.z8.setVisibility(8);
            ActivityTxt activityTxt = ActivityTxt.this;
            BrowserAct.downloadBook(activityTxt, activityTxt.H1, activityTxt.z8, url, null, null);
        }
    }

    class k4 implements View.OnAttachStateChangeListener {
        k4() {
        }

        @Override
        public void onViewAttachedToWindow(View v) {
            e50.I(ActivityTxt.this);
        }

        @Override
        public void onViewDetachedFromWindow(View v) {
        }
    }

    public class k5 implements DialogInterface.OnDismissListener {
        k5() {
        }

        @Override
        public void onDismiss(DialogInterface dialog) {
            e50.R6(true);
            ActivityTxt.this.N7(0);
        }
    }

    public class k6 extends Handler {
        k6(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            ActivityTxt.this.Q1.a();
            ActivityTxt.this.lh(msg.what);
            ActivityTxt.this.Kg();
        }
    }

    public class k7 extends TimerTask {
        public k7() {
        }

        @Override
        public void run() {
            if (e50.P9) {
                if (ActivityTxt.this.Y5) {
                    return;
                }
                ActivityTxt.W0(ActivityTxt.this);
                int V8 = ActivityTxt.this.V8();
                if (V8 == 0) {
                    ActivityTxt.this.H1.sendEmptyMessage(301);
                    return;
                }
                if (V8 == 1) {
                    if (ActivityTxt.this.W7 * 4 >= e50.s5) {
                        ActivityTxt.this.W7 = 0;
                        ActivityTxt.this.H1.sendEmptyMessage(301);
                        return;
                    }
                    return;
                }
                if (V8 == 2) {
                    ActivityTxt.this.H1.sendEmptyMessage(301);
                    return;
                }
                if (V8 != 3) {
                    if (V8 != 4) {
                        return;
                    }
                    ActivityTxt.this.H1.sendEmptyMessage(301);
                    return;
                } else {
                    if (ActivityTxt.this.W7 * 5 >= e50.s5) {
                        ActivityTxt.this.W7 = 0;
                        ActivityTxt.this.H1.sendEmptyMessage(301);
                        return;
                    }
                    return;
                }
            }
            cancel();
        }
    }

    class l implements View.OnTouchListener {
        l() {
        }

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            ActivityTxt activityTxt;
            View view;
            ActivityTxt.this.ig();
            int action = event.getAction();
            if (action == 0) {
                ActivityTxt activityTxt2 = ActivityTxt.this;
                if (v != activityTxt2.j9 && v != activityTxt2.k9) {
                    v = null;
                }
                activityTxt2.l9 = v;
                if (v != null) {
                    activityTxt2.o9 = ((int) event.getRawX()) - ActivityTxt.this.l9.getLeft();
                    ActivityTxt.this.p9 = ((int) event.getRawY()) - ActivityTxt.this.l9.getTop();
                }
            } else if (action == 1) {
                ActivityTxt activityTxt3 = ActivityTxt.this;
                if (activityTxt3.l9 != null) {
                    activityTxt3.W9(true, -1, -1);
                    ActivityTxt.this.l9 = null;
                }
            } else if (action == 2 && (view = (activityTxt = ActivityTxt.this).l9) != null) {
                activityTxt.ze(view.getTop());
                int rawX = ((int) event.getRawX()) - ActivityTxt.this.o9;
                int rawY = (int) event.getRawY();
                ActivityTxt activityTxt4 = ActivityTxt.this;
                int i = rawY - activityTxt4.p9;
                View view2 = activityTxt4.l9;
                view2.layout(rawX, i, view2.getWidth() + rawX, ActivityTxt.this.l9.getHeight() + i);
                ActivityTxt.this.l9.postInvalidate();
                ActivityTxt activityTxt5 = ActivityTxt.this;
                activityTxt5.z9 = null;
                activityTxt5.W9(false, -1, -1);
            }
            return true;
        }
    }

    public class l0 implements i.a {
        l0() {
        }

        @Override
        public void OnPageClicked(int pageno) {
            ActivityTxt.this.vc(pageno, true);
            ActivityTxt.this.k2.setText("" + (pageno + 1) + com.ksdk.ssds.manager.b.b + ActivityTxt.this.qa.k());
        }
    }

    public class l1 extends Handler {
        l1(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            ActivityTxt.this.y9();
        }
    }

    public class l2 implements DialogInterface.OnClickListener {
        l2() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.n5();
        }
    }

    public class l3 implements View.OnTouchListener {
        l3() {
        }

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            boolean z;
            if (event.getAction() == 0) {
                ActivityTxt.this.u5 = event.getX();
                if (ActivityTxt.this.hb(event)) {
                    z = true;
                    ActivityTxt activityTxt = ActivityTxt.this;
                    activityTxt.onTouch(activityTxt.Jb, event);
                    if (event.getAction() == 1) {
                        z = false;
                    }
                    return !z;
                }
            }
            z = false;
            ActivityTxt activityTxt2 = ActivityTxt.this;
            activityTxt2.onTouch(activityTxt2.Jb, event);
            if (event.getAction() == 1) {
            }
            if (!z) {
            }
        }
    }

    public class l4 implements View.OnClickListener {
        l4() {
        }

        @Override
        public void onClick(View v) {
            int progress = (ActivityTxt.this.A3.getProgress() - 50) - 1;
            e50.A5 = progress;
            ActivityTxt.this.Ze(progress, true);
            ActivityTxt.this.Fe();
        }
    }

    public class l5 implements DialogInterface.OnClickListener {
        final String a;
        final String b;

        class a extends Handler {
            a(Looper looper) {
                super(looper);
            }

            @Override
            public void handleMessage(Message msg) {
                l5 l5Var = l5.this;
                ActivityTxt.this.Vb(l5Var.a, l5Var.b, 50L);
            }
        }

        l5(final String val$url, final String val$title) {
            this.a = val$url;
            this.b = val$title;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.d6 = false;
            ActivityTxt.this.c6 = null;
            new a(Looper.getMainLooper()).sendEmptyMessageDelayed(0, 50L);
        }
    }

    public class l6 implements e50.h {

        class a extends Handler {
            a(Looper looper) {
                super(looper);
            }

            @Override
            public void handleMessage(Message msg) {
                ActivityTxt.this.m6();
            }
        }

        l6() {
        }

        @Override
        public void Finished(boolean success) {
            new a(Looper.getMainLooper()).sendEmptyMessageDelayed(0, 60L);
        }
    }

    public class l7 extends BaseAdapter {
        CharSequence[] a;
        int[] b;
        int c;
        View.OnClickListener d = new a();

        class a implements View.OnClickListener {

            class DialogInterfaceOnClickListenerC0926a implements DialogInterface.OnClickListener {
                final EditText a;

                DialogInterfaceOnClickListenerC0926a(final EditText val$et) {
                    this.a = val$et;
                }

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    int z2 = o50.z2(this.a.getText().toString());
                    if (z2 != e50.r6 && z2 > 0) {
                        e50.r6 = z2;
                    }
                    e50.t6 = true;
                    ActivityTxt.this.kf();
                }
            }

            class b implements DialogInterface.OnClickListener {
                final EditText a;

                b(final EditText val$et) {
                    this.a = val$et;
                }

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    int z2 = o50.z2(this.a.getText().toString());
                    if (z2 != e50.s6 && z2 > 0) {
                        e50.s6 = z2;
                    }
                    e50.u6 = true;
                    o50.p2(ActivityTxt.this, "朗读间隔设置为" + e50.s6 + "秒, 下次开始朗读时生效");
                }
            }

            a() {
            }

            @Override
            public void onClick(View v) {
                int intValue = ((Integer) v.getTag()).intValue();
                l7 l7Var = l7.this;
                if (l7Var.c == 0) {
                    if (intValue < ActivityTxt.this.h3.size()) {
                        ActivityTxt activityTxt = ActivityTxt.this;
                        activityTxt.b6(activityTxt.h3.get(intValue).a);
                    } else {
                        ActivityTxt.this.dg();
                        ActivityTxt.this.za(true);
                    }
                }
                l7 l7Var2 = l7.this;
                if (l7Var2.c == 1) {
                    if (intValue == 0) {
                        ActivityTxt.this.s7();
                    } else if (intValue == 1) {
                        ActivityTxt.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("http://www.baidu.com/s?ie=utf-8&wd=" + ActivityTxt.this.a9(1))));
                    } else if (intValue == 2) {
                        ActivityTxt.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("http://www.baidu.com/s?ie=utf-8&wd=" + e50.D1() + " 书评")));
                    } else if (intValue == 3) {
                        ActivityTxt.this.K6(e50.D1());
                    } else if (intValue == 4) {
                        f50 f50Var = e50.Q1;
                        String b2 = f50Var != null ? f50Var.b() : "";
                        ActivityTxt activityTxt2 = ActivityTxt.this;
                        if (b2.startsWith("(")) {
                            b2 = "";
                        }
                        activityTxt2.K6(b2);
                    }
                    ActivityTxt.this.za(true);
                }
                l7 l7Var3 = l7.this;
                if (l7Var3.c == 100) {
                    if (intValue == 0) {
                        o50.a2(ActivityTxt.this);
                    } else if (intValue != 1) {
                        if (intValue != 2) {
                            if (intValue == 3) {
                                ActivityTxt.this.zg();
                            } else if (intValue == 4) {
                                if (e50.H4 != 19) {
                                    e50.H4 = 19;
                                    e50.I4 = 19;
                                    e50.J4 = 1;
                                    e50.K4 = 0;
                                    o50.n2(ActivityTxt.this, e50.W0("\n已启用耳机及蓝牙控制, 重启阅读器后生效."));
                                } else {
                                    e50.K4 = 15;
                                    e50.J4 = 15;
                                    e50.I4 = 15;
                                    e50.H4 = 15;
                                    o50.r2(ActivityTxt.this, e50.W0("已禁用耳机及蓝牙控制"), 0, 17);
                                }
                            }
                        } else if (e50.u6) {
                            e50.u6 = false;
                            o50.p2(ActivityTxt.this, "已取消朗读间隔, 下次开始朗读时生效");
                        } else {
                            EditText editText = new EditText(ActivityTxt.this);
                            editText.setText("" + e50.s6);
                            editText.setSingleLine();
                            editText.setInputType(2);
                            new m.c(ActivityTxt.this).z(e50.W0("设置朗读间隔(毫秒)")).B(editText).w("确定", new b(editText)).p(com.qadsdk.s1.s5.BTN_CANCEL, null).C();
                        }
                    } else if (e50.t6) {
                        e50.t6 = false;
                        ActivityTxt.this.Gg().removeMessages(3);
                        o50.p2(ActivityTxt.this, "已取消自动停止朗读");
                    } else {
                        EditText editText2 = new EditText(ActivityTxt.this);
                        editText2.setText("" + e50.r6);
                        editText2.setSingleLine();
                        editText2.setInputType(2);
                        new m.c(ActivityTxt.this).z(e50.W0("设置自动停止时间(分钟)")).B(editText2).w("确定", new DialogInterfaceOnClickListenerC0926a(editText2)).p(com.qadsdk.s1.s5.BTN_CANCEL, null).C();
                    }
                    ActivityTxt.this.za(true);
                }
            }
        }

        public l7(CharSequence[] items, int[] res, int level) {
            this.a = items;
            this.b = res;
            this.c = level;
        }

        @Override
        public int getCount() {
            return this.a.length;
        }

        @Override
        public Object getItem(int position) {
            return Integer.valueOf(position);
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            LinearLayout linearLayout;
            if (convertView != null) {
                linearLayout = (LinearLayout) convertView;
            } else {
                linearLayout = (LinearLayout) LayoutInflater.from(ActivityTxt.this).inflate(R.layout.menu_row, (ViewGroup) null);
            }
            ImageView imageView = (ImageView) linearLayout.findViewById(R.id.iv);
            TextView textView = (TextView) linearLayout.findViewById(R.id.name);
            if (this.b[position] > 0) {
                imageView.setVisibility(0);
                imageView.setImageResource(this.b[position]);
            } else {
                imageView.setVisibility(4);
            }
            textView.setVisibility(0);
            textView.setText(this.a[position]);
            linearLayout.setBackgroundResource(R.drawable.my_list_selector);
            linearLayout.setTag(Integer.valueOf(position));
            linearLayout.setOnClickListener(this.d);
            return linearLayout;
        }
    }

    class m implements View.OnClickListener {
        m() {
        }

        @Override
        public void onClick(View v) {
            String str;
            ActivityTxt activityTxt = ActivityTxt.this;
            if (v == activityTxt.e9) {
                activityTxt.n6(false);
            }
            ActivityTxt activityTxt2 = ActivityTxt.this;
            if (v == activityTxt2.f9) {
                activityTxt2.U6();
            }
            ActivityTxt activityTxt3 = ActivityTxt.this;
            if (v == activityTxt3.n9) {
                if (activityTxt3.Fa()) {
                    if (ActivityTxt.this.Za()) {
                        ActivityTxt.this.F2.o();
                        e50.qa = true;
                        ActivityTxt.this.J9();
                        ActivityTxt.this.Pc();
                    } else {
                        ActivityTxt activityTxt4 = ActivityTxt.this;
                        activityTxt4.Qd(activityTxt4.z9);
                    }
                } else if (ActivityTxt.this.Za()) {
                    if (ActivityTxt.this.qa.a()) {
                        ActivityTxt.this.J9();
                        ActivityTxt.this.Zc();
                    } else {
                        ActivityTxt activityTxt5 = ActivityTxt.this;
                        activityTxt5.ad(activityTxt5.getString(R.string.pdf_cannot_modify));
                    }
                }
            }
            if (!ActivityTxt.this.Za()) {
                str = ActivityTxt.this.n9().R0;
            } else {
                ActivityTxt activityTxt6 = ActivityTxt.this;
                str = activityTxt6.F2.p0;
                if (str == null && activityTxt6.z9 == null) {
                    return;
                }
            }
            ActivityTxt activityTxt7 = ActivityTxt.this;
            if (v == activityTxt7.d9 && str != null) {
                activityTxt7.w5(str);
                ActivityTxt.this.J9();
            }
            if (str != null) {
                str = str.trim();
            }
            ActivityTxt activityTxt8 = ActivityTxt.this;
            if (v == activityTxt8.g9) {
                activityTxt8.ig();
                if (e50.v6) {
                    ActivityTxt.this.i6(false);
                } else {
                    ActivityTxt activityTxt9 = ActivityTxt.this;
                    activityTxt9.T5(activityTxt9, true);
                }
            }
            ActivityTxt activityTxt10 = ActivityTxt.this;
            if (v != activityTxt10.h9 || str == null) {
                return;
            }
            activityTxt10.Mf(str);
        }
    }

    public class m0 extends Handler {
        m0(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            ActivityTxt.this.gd(true);
        }
    }

    public class m1 extends Handler {
        m1(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            if (ActivityTxt.this.Wa != -1) {
                ActivityTxt.this.K7();
                ActivityTxt activityTxt = ActivityTxt.this;
                activityTxt.nh(activityTxt.Wa);
                ActivityTxt.this.X2 = false;
            } else {
                ActivityTxt.this.F4.sendEmptyMessageDelayed(1, 50L);
            }
            if (!e50.Q4()) {
                ActivityTxt.this.a8(50);
            } else {
                ActivityTxt.this.Vd(false, 0, false);
                ActivityTxt activityTxt2 = ActivityTxt.this;
                if (activityTxt2.G4 > 0) {
                    activityTxt2.Je(false);
                    ActivityTxt.this.Me(true);
                }
            }
            ActivityTxt.this.Ih();
            ActivityTxt.this.G4 = 0L;
        }
    }

    public class m2 implements DialogInterface.OnClickListener {

        class a implements DialogInterface.OnClickListener {
            final int a;

            a(final int val$count) {
                this.a = val$count;
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                ActivityTxt.this.C7(this.a);
            }
        }

        m2() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            int checkedItemPosition = ((AlertDialog) dialog).getListView().getCheckedItemPosition();
            if (checkedItemPosition == 0) {
                ActivityTxt.this.Mh(true);
                return;
            }
            String str = "";
            int i = 0;
            if (checkedItemPosition == 1) {
                ActivityTxt activityTxt = ActivityTxt.this;
                activityTxt.Hh(e50.g2, activityTxt.getString(R.string.downloading_content), false);
                ActivityTxt activityTxt2 = ActivityTxt.this;
                activityTxt2.tb = true;
                activityTxt2.createProgressDlg("", e50.Q1.h().get(e50.g2).c + "\n" + ActivityTxt.this.getString(R.string.downloading_content));
                ActivityTxt.this.q5();
                return;
            }
            if (checkedItemPosition < 5) {
                if (checkedItemPosition == 2) {
                    i = 30;
                } else if (checkedItemPosition != 3) {
                    i = -1;
                }
                if (!ActivityTxt.this.Ra()) {
                    ActivityTxt.this.C7(i);
                    return;
                } else {
                    new m.c(ActivityTxt.this).m(Html.fromHtml(ActivityTxt.this.getString(R.string.bunenghuancheng))).v(R.string.ok, new a(i)).o(R.string.cancel, null).C();
                    return;
                }
            }
            String webBookMeta = WB.getWebBookMeta(e50.V1, e50.Q1.p.siteTag, 0);
            if (o50.F1(webBookMeta)) {
                webBookMeta = e50.Q1.h().get(e50.g2).s;
            }
            String str2 = webBookMeta;
            StringBuilder sb = new StringBuilder();
            sb.append(e50.Q1.d());
            if (!o50.F1(e50.Q1.b())) {
                str = " - " + e50.Q1.b();
            }
            sb.append(str);
            BrowserAct.loadDownloadPage(ActivityTxt.this, e50.Q1.p, str2, null, sb.toString(), e50.W0("如有书籍下载链接, 可点击下载"));
        }
    }

    public class m3 implements DialogInterface.OnClickListener {
        final CheckBox a;
        final S.BookSite b;

        m3(final CheckBox val$cb, final S.BookSite val$site) {
            this.a = val$cb;
            this.b = val$site;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (this.a.isChecked()) {
                S.addToIgnoreAdTipSites(this.b.siteTag);
            }
            ActivityTxt.this.bh(false);
            ActivityTxt.this.Lb = null;
        }
    }

    public class m4 implements View.OnClickListener {
        m4() {
        }

        @Override
        public void onClick(View v) {
            int progress = (ActivityTxt.this.A3.getProgress() - 50) + 1;
            e50.A5 = progress;
            ActivityTxt.this.Ze(progress, true);
            ActivityTxt.this.Fe();
        }
    }

    public class m5 implements DialogInterface.OnDismissListener {
        m5() {
        }

        @Override
        public void onDismiss(DialogInterface dialog) {
            e50.R6(true);
            ActivityTxt.this.N7(0);
        }
    }

    public class m6 extends Handler {
        m6(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            ActivityTxt.this.We(0.0f, true);
        }
    }

    public class m7 {
        String a;
        String b;
        int c;
        int d;
        long e;

        public m7(String title, String backFile, int backChapter, int backSplitIndex, long backPosition) {
            this.a = title;
            this.b = backFile;
            this.c = backChapter;
            this.d = backSplitIndex;
            this.e = backPosition;
        }
    }

    public class n extends Handler {

        class a extends Handler {
            a(Looper looper) {
                super(looper);
            }

            @Override
            public void handleMessage(Message msg) {
                if (ActivityTxt.this.h9.getWidth() < ((ActivityTxt.this.h9.getPaint().measureText(ActivityTxt.this.h9.getText().toString()) + ActivityTxt.this.h9.getPaddingLeft()) + ActivityTxt.this.h9.getPaddingRight()) - e50.k0(1.0f)) {
                    ActivityTxt activityTxt = ActivityTxt.this;
                    float f = activityTxt.w9 - 1.0f;
                    activityTxt.w9 = f;
                    if (f > 10.0f) {
                        activityTxt.u9 = false;
                        activityTxt.Bg();
                        return;
                    }
                }
                ActivityTxt.this.Se(true);
            }
        }

        n(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            int width = ActivityTxt.this.d9.getWidth() + ActivityTxt.this.e9.getWidth() + ActivityTxt.this.f9.getWidth() + ActivityTxt.this.g9.getWidth() + ActivityTxt.this.h9.getWidth() + (e50.k0(4.0f) * 4) + (e50.k0(6.0f) * 2);
            if (ActivityTxt.this.Za() || ActivityTxt.this.n9.getVisibility() == 0) {
                width += ActivityTxt.this.D9();
            }
            int width2 = width > ActivityTxt.this.U1.getWidth() ? 0 : (ActivityTxt.this.U1.getWidth() - width) / 2;
            HighlightLay highlightLay = ActivityTxt.this.c9;
            highlightLay.layout(width2, highlightLay.getTop(), width + width2, ActivityTxt.this.c9.getBottom());
            new a(Looper.getMainLooper()).sendEmptyMessage(0);
        }
    }

    public class n0 implements View.OnFocusChangeListener {

        class a implements Runnable {
            a() {
            }

            @Override
            public void run() {
                e50.R6(true);
            }
        }

        n0() {
        }

        @Override
        public void onFocusChange(View view, boolean hasFocus) {
            new Handler(Looper.getMainLooper()).postDelayed(new a(), 400L);
        }
    }

    public class n1 implements Animation.AnimationListener {
        n1() {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            ActivityTxt activityTxt = ActivityTxt.this;
            if (activityTxt.g3 != null) {
                activityTxt.Cg();
            } else {
                activityTxt.y2.setVisibility(8);
            }
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationStart(Animation animation) {
        }
    }

    public class n2 implements DialogInterface.OnClickListener {
        n2() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.R6(true);
            ActivityTxt.this.G2 = null;
        }
    }

    public class n3 implements DialogInterface.OnClickListener {
        final CheckBox a;
        final S.BookSite b;
        final WebView c;
        final String d;

        n3(final CheckBox val$cb, final S.BookSite val$site, final WebView val$readWeb, final String val$url) {
            this.a = val$cb;
            this.b = val$site;
            this.c = val$readWeb;
            this.d = val$url;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (this.a.isChecked()) {
                S.addToIgnoreAdTipSites(this.b.siteTag);
            }
            this.c.loadUrl(this.d);
            ActivityTxt.this.Lb = null;
        }
    }

    public class n4 implements View.OnClickListener {
        n4() {
        }

        @Override
        public void onClick(View v) {
            if (e50.A5 != -100) {
                e50.A5 = -100;
                ActivityTxt.this.Ze(-100, false);
                ActivityTxt.this.s4.setChecked(true);
            } else {
                ActivityTxt.this.Ze(r4.A3.getProgress() - 50, true);
                ActivityTxt.this.s4.setChecked(false);
            }
        }
    }

    public class n5 implements View.OnTouchListener {
        long a;
        float b;
        float c;

        n5() {
        }

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            int i;
            try {
                e50.N5("*action:" + event.getAction());
                ScrollView scrollView = (ScrollView) v;
                if (scrollView.getScrollY() > 0) {
                    ActivityTxt.this.N7(0);
                }
                if (event.getAction() == 0) {
                    this.a = SystemClock.elapsedRealtime();
                    this.b = event.getX();
                    this.c = event.getY();
                    if (e50.n5()) {
                        ActivityTxt.this.N7(com.bigkoo.pickerview.lib.c.b);
                    }
                    ActivityTxt activityTxt = ActivityTxt.this;
                    activityTxt.y5 = true;
                    activityTxt.H1.removeMessages(ActivityTxt.h0);
                    Handler handler = ActivityTxt.this.H1;
                    handler.sendMessageDelayed(handler.obtainMessage(ActivityTxt.h0, 1, 1), 400L);
                }
                if (event.getAction() == 2 && (Math.abs(event.getY() - this.c) > e50.k0(10.0f) || Math.abs(ActivityTxt.this.o9(event) - this.b) > e50.k0(10.0f))) {
                    ActivityTxt.this.y5 = false;
                }
                if (event.getAction() == 1) {
                    ActivityTxt.this.H1.sendEmptyMessageDelayed(ActivityTxt.G0, Constants.MINIMAL_AD_INTERVAL);
                    if (SystemClock.elapsedRealtime() - this.a > 400) {
                        return false;
                    }
                    ActivityTxt.this.y5 = false;
                    TextView textView = (TextView) v.findViewById(R.id.childId);
                    Layout layout = textView.getLayout();
                    int x = ((int) event.getX()) - textView.getPaddingLeft();
                    int lineForVertical = layout.getLineForVertical((((int) event.getY()) + scrollView.getScrollY()) - textView.getPaddingTop());
                    int offsetForHorizontal = layout.getOffsetForHorizontal(lineForVertical, x);
                    int lineStart = layout.getLineStart(lineForVertical);
                    int lineEnd = layout.getLineEnd(lineForVertical);
                    if (offsetForHorizontal >= lineStart && offsetForHorizontal < lineEnd && lineStart != lineEnd) {
                        Spanned spanned = (Spanned) textView.getText();
                        if (lineStart < offsetForHorizontal) {
                            lineStart = offsetForHorizontal - 1;
                        }
                        if (lineEnd > offsetForHorizontal) {
                            lineEnd = offsetForHorizontal + 1;
                        }
                        Object[] spans = spanned.getSpans(lineStart, lineEnd, Object.class);
                        int length = spans.length;
                        while (i < length) {
                            Object obj = spans[i];
                            i = ((obj instanceof URLSpan) || (obj instanceof MyUrlSpan)) ? 0 : i + 1;
                            String url = obj instanceof URLSpan ? ((URLSpan) obj).getURL() : ((MyUrlSpan) obj).b();
                            String str = "";
                            int indexOf = ActivityTxt.this.Z5.indexOf("<a href=\"" + url + "\">");
                            if (indexOf != -1) {
                                int indexOf2 = ActivityTxt.this.Z5.indexOf(">", indexOf) + 1;
                                str = ActivityTxt.this.Z5.substring(indexOf2, ActivityTxt.this.Z5.indexOf("<", indexOf2));
                            }
                            e50.N5("title:#" + str + "#url:" + url);
                            if (ActivityTxt.this.a6 != null) {
                                ActivityTxt.this.a6.dismiss();
                            }
                            ActivityTxt.this.a6 = null;
                            if (ActivityTxt.this.b6 != null) {
                                ActivityTxt.this.b6.a();
                            }
                            ActivityTxt.this.b6 = null;
                            if (e50.c5(url)) {
                                o50.b2(ActivityTxt.this, url);
                            } else {
                                if (url.startsWith("#")) {
                                    ActivityTxt.this.N7(50);
                                }
                                if (url.startsWith("?") && e50.Q1 != null) {
                                    String substring = url.substring(1, url.length());
                                    f50.f l = e50.Q1.l(substring);
                                    if (l == null && substring.startsWith("?")) {
                                        l = e50.Q1.l(substring.substring(1));
                                    }
                                    if (l != null) {
                                        ActivityTxt.this.Rf(l);
                                        return false;
                                    }
                                }
                                ActivityTxt.this.Vb(url, str, 50L);
                            }
                            e50.N5("text click: " + textView.getText().toString().substring(lineStart, lineEnd) + "#" + textView.getText().toString().substring(offsetForHorizontal - 4, offsetForHorizontal + 4));
                        }
                        e50.N5("text click: " + textView.getText().toString().substring(lineStart, lineEnd) + "#" + textView.getText().toString().substring(offsetForHorizontal - 4, offsetForHorizontal + 4));
                    }
                }
            } catch (Exception e) {
                e50.S0(e);
            }
            return false;
        }
    }

    public class n6 implements DialogInterface.OnClickListener {
        n6() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.l6();
        }
    }

    public class n7 extends GestureDetector.SimpleOnGestureListener {
        n7() {
        }

        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
            ActivityTxt.this.x6 = velocityX;
            return false;
        }

        @Override
        public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
            return false;
        }
    }

    public class o implements View.OnLongClickListener {
        o() {
        }

        @Override
        public boolean onLongClick(View v) {
            ActivityTxt activityTxt = ActivityTxt.this;
            o50.p2(activityTxt, activityTxt.getString(R.string.delete));
            return false;
        }
    }

    public class o0 implements TextView.OnEditorActionListener {
        o0() {
        }

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            e50.R6(true);
            return false;
        }
    }

    public class o1 extends BroadcastReceiver {
        o1() {
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            int intExtra = intent.getIntExtra("level", -1);
            ActivityTxt.this.cb = "" + intExtra;
            ActivityTxt.this.xh();
        }
    }

    public class o2 implements DialogInterface.OnClickListener {
        o2() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.R6(true);
            ActivityTxt activityTxt = ActivityTxt.this;
            activityTxt.zb = false;
            activityTxt.rb.clear();
            ActivityTxt.this.G2 = null;
            ActivityTxt.this.cg(0);
        }
    }

    public class o3 implements DialogInterface.OnClickListener {
        o3() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.wg();
        }
    }

    public class o4 implements View.OnClickListener {
        o4() {
        }

        @Override
        public void onClick(View v) {
            boolean z = !e50.t5;
            e50.t5 = z;
            ActivityTxt.this.u4.setChecked(z);
        }
    }

    public class o5 implements m.d {
        final boolean a;

        o5(final boolean val$encode) {
            this.a = val$encode;
        }

        @Override
        public void onClick(int which) {
            ActivityTxt.this.pe(true);
            ActivityTxt.this.za(true);
            if (ActivityTxt.this.nb()) {
                if (which == 0) {
                    ActivityTxt.this.v7();
                }
                if (which == 1) {
                    ActivityTxt activityTxt = ActivityTxt.this;
                    WB.set_purify(activityTxt, activityTxt.Q1.getText2(), e50.Q1.h().get(e50.g2).s);
                }
                if (which == 2) {
                    WB.set_replacement(ActivityTxt.this);
                }
                if (which == 3) {
                    ActivityTxt.this.X6();
                }
                if (which == 4) {
                    ActivityTxt.this.B6(false);
                    return;
                }
                return;
            }
            if (!this.a) {
                if (which == 0) {
                    ActivityTxt activityTxt2 = ActivityTxt.this;
                    WB.set_purify(activityTxt2, activityTxt2.Q1.getText2(), null);
                }
                if (which == 1) {
                    WB.set_replacement(ActivityTxt.this);
                }
                if (which == 2) {
                    ActivityTxt.this.X6();
                }
                if (which == 3) {
                    ActivityTxt.this.B6(false);
                    return;
                }
                return;
            }
            if (which == 0) {
                ActivityTxt activityTxt3 = ActivityTxt.this;
                WB.set_purify(activityTxt3, activityTxt3.Q1.getText2(), null);
            }
            if (which == 1) {
                WB.set_replacement(ActivityTxt.this);
            }
            if (which == 2) {
                ActivityTxt.this.ye();
            }
            if (which == 3) {
                ActivityTxt.this.X6();
            }
            if (which == 4) {
                ActivityTxt.this.B6(false);
            }
        }
    }

    public class o6 implements n.l {
        o6() {
        }

        @Override
        public void onClick(int resultId) {
            ActivityTxt.this.y6(resultId, true);
        }
    }

    public class o7 extends GestureDetector.SimpleOnGestureListener {
        o7() {
        }

        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
            ActivityTxt activityTxt = ActivityTxt.this;
            if (activityTxt.K2 || activityTxt.Ya() || ActivityTxt.this.B7() || e50.O9 || e50.P9 || !(e50.y8 instanceof ScrollView)) {
                return false;
            }
            try {
                ActivityTxt activityTxt2 = ActivityTxt.this;
                activityTxt2.o6.addMovement(activityTxt2.q9);
                ActivityTxt.this.o6.addMovement(e1);
                ActivityTxt.this.o6.computeCurrentVelocity(1000, r3.p6);
                ActivityTxt activityTxt3 = ActivityTxt.this;
                if (activityTxt3.c(activityTxt3.o6, velocityX, velocityY) || ActivityTxt.this.Ha()) {
                    return true;
                }
                if (ActivityTxt.this.Ia() && !ActivityTxt.this.Ta(e1)) {
                    return true;
                }
                ActivityTxt.this.Q8 = -1L;
                ActivityTxt activityTxt4 = ActivityTxt.this;
                activityTxt4.x5 = false;
                activityTxt4.J9();
                if (ActivityTxt.this.q8() != 0) {
                    ActivityTxt.this.Ih();
                    return false;
                }
                double yVelocity = ActivityTxt.this.o6.getYVelocity();
                if (yVelocity == 0.0d) {
                    yVelocity = velocityY;
                }
                int i = (int) ((yVelocity * yVelocity) / (ActivityTxt.this.q6 * 2.0f));
                if (Math.abs(yVelocity) < 5.0d) {
                    return false;
                }
                int scrollY = ActivityTxt.this.S1.getScrollY();
                int realHeight = ActivityTxt.this.Q1.getRealHeight();
                int lineHeight = ActivityTxt.this.Q1.getLineHeight();
                com.flyersoft.staticlayout.l layout = ActivityTxt.this.Q1.getLayout();
                if (layout == null) {
                    return false;
                }
                if (i >= realHeight / 2) {
                    double sqrt = Math.sqrt((realHeight / 2) * 2 * ActivityTxt.this.q6);
                    if (yVelocity <= 0.0d) {
                        sqrt = -sqrt;
                    }
                    yVelocity = sqrt;
                }
                if (yVelocity <= 0.0d || e50.i2 <= 2) {
                    if (yVelocity < 0.0d && e50.i2 < e50.f4().size() - 2 && e50.i2 > 0 && scrollY - yVelocity > realHeight - lineHeight) {
                        yVelocity = (yVelocity * 9.0d) / 10.0d;
                        int I = layout.I(layout.C(scrollY));
                        int i2 = e50.i2;
                        int length = e50.g4(i2 - 1).length();
                        int length2 = e50.g4(i2).length();
                        int i3 = length + length2;
                        int i4 = I - length;
                        if (I > i3) {
                            i4 -= length2;
                        }
                        if (I > i3) {
                            i2++;
                        }
                        StringBuilder sb = new StringBuilder();
                        sb.append(e50.g4(i2));
                        int i5 = i2 + 1;
                        sb.append(e50.g4(i5));
                        sb.append(e50.g4(i2 + 2));
                        ActivityTxt.this.ph(e50.Q(sb.toString()));
                        ActivityTxt.this.nh(ActivityTxt.this.Q1.a0(ActivityTxt.this.Q1.getLayout().B(i4 + 5)));
                        e50.i2 = i5;
                    }
                } else if (scrollY - yVelocity < lineHeight) {
                    int I2 = layout.I(layout.C(scrollY));
                    int i6 = e50.i2;
                    int length3 = e50.g4(i6 - 1).length();
                    int i7 = I2 > length3 ? I2 - length3 : I2;
                    if (I2 < length3) {
                        i6--;
                    }
                    StringBuilder sb2 = new StringBuilder();
                    sb2.append(e50.g4(i6 - 2));
                    int i8 = i6 - 1;
                    sb2.append(e50.g4(i8));
                    sb2.append(e50.g4(i6));
                    ActivityTxt.this.ph(e50.Q(sb2.toString()));
                    ActivityTxt.this.nh(ActivityTxt.this.Q1.a0(ActivityTxt.this.Q1.getLayout().B(((e50.g4(r4).length() + e50.g4(i8).length()) + i7) - 5)));
                    e50.i2 = i8;
                }
                ActivityTxt.this.s6 = SystemClock.elapsedRealtime();
                ActivityTxt.this.S1.fling(-((int) yVelocity));
                if (((int) Math.abs(velocityY)) > 1500 && !ActivityTxt.this.kg()) {
                    ActivityTxt.this.H1.sendEmptyMessageDelayed(ActivityTxt.f0, (r0 * 3200) / (r0 + 2500));
                }
                ActivityTxt.this.Ih();
                return true;
            } catch (Exception e) {
                e50.S0(e);
                return false;
            }
        }

        @Override
        public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
            return false;
        }
    }

    public class p implements o.h {
        final MRTextView a;

        p(final MRTextView val$tv) {
            this.a = val$tv;
        }

        @Override
        public void selectColor(int mode, boolean delete) {
            if (delete) {
                ActivityTxt activityTxt = ActivityTxt.this;
                activityTxt.Qd(activityTxt.z9);
            } else {
                ActivityTxt.this.o6(this.a, mode, -1, true);
            }
        }
    }

    public class p0 implements View.OnClickListener {
        p0() {
        }

        @Override
        public void onClick(View v) {
            boolean z = !e50.t3;
            e50.t3 = z;
            PDFReader pDFReader = ActivityTxt.this.F2;
            pDFReader.b.viewLockSide(z, pDFReader.getContext());
            ActivityTxt.this.za(true);
        }
    }

    public class p1 implements View.OnClickListener {
        p1() {
        }

        @Override
        public void onClick(View v) {
            ActivityTxt activityTxt = ActivityTxt.this;
            int i = activityTxt.mb;
            if (i == 0) {
                activityTxt.Ib();
            } else if (i == 1) {
                activityTxt.lb.pause();
                ActivityTxt.this.mb = 2;
            } else {
                activityTxt.lb.start();
                ActivityTxt.this.mb = 1;
            }
            ActivityTxt activityTxt2 = ActivityTxt.this;
            activityTxt2.gb.setImageResource(activityTxt2.mb != 2 ? R.drawable.tts_pause : R.drawable.tts_play);
        }
    }

    public class p2 implements DialogInterface.OnClickListener {
        p2() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.D5();
        }
    }

    public class p3 implements DialogInterface.OnClickListener {
        p3() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.Xb(e50.Q1.p.last_url);
        }
    }

    public class p4 implements SeekBar.OnSeekBarChangeListener {
        p4() {
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser) {
                e50.y5 = true;
                e50.z5 = progress;
                ActivityTxt.this.zh();
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    }

    public class p5 implements DialogInterface.OnClickListener {
        final int a;

        p5(final int val$selected) {
            this.a = val$selected;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            int checkedItemPosition = ((AlertDialog) dialog).getListView().getCheckedItemPosition();
            if (this.a != checkedItemPosition) {
                String charSequence = checkedItemPosition == 0 ? e50.V0 : e50.K3()[checkedItemPosition].toString();
                if (e50.P0(ActivityTxt.this, charSequence)) {
                    return;
                }
                e50.b3 = charSequence;
                ActivityTxt.this.getSharedPreferences(e50.s0, 0).edit().putString(e50.V1, charSequence).commit();
                ActivityTxt.this.getSharedPreferences(e50.q0, 0).edit().putString("textEncode", charSequence).commit();
                ActivityTxt.this.Ad();
            }
        }
    }

    public class p6 implements PrefChapters.k {
        p6() {
        }

        @Override
        public void onGetChapter(int chapterId, int splitIndex, long position, boolean fromChapterList) {
            if (e50.g2 > 0) {
                ActivityTxt.this.re(true);
            }
            if (fromChapterList && ActivityTxt.this.Ya()) {
                long j = ActivityTxt.this.wa.get(chapterId).f;
                e50.f2 = j;
                ActivityTxt.this.vc((int) j, true);
                ActivityTxt.this.cg(0);
                return;
            }
            e50.h2 = splitIndex;
            int q8 = ActivityTxt.this.q8();
            if (q8 == 0 || q8 == 1) {
                if (fromChapterList) {
                    position = e50.Y3().get(chapterId).a(chapterId);
                }
                e50.f2 = position;
                ActivityTxt.this.Jd();
                ActivityTxt.this.k5();
                ActivityTxt.this.Td();
            } else if (q8 == 100) {
                if (ActivityTxt.this.Ya != null && ActivityTxt.this.Ya.size() > 1) {
                    ActivityTxt.this.Xa = null;
                }
                e50.g2 = chapterId;
                e50.f2 = position;
                ActivityTxt.this.q5();
                e50.e(ActivityTxt.this);
                if (ActivityTxt.this.Da(e50.g2)) {
                    ActivityTxt.this.J5(e50.Q1.h().get(e50.g2).c);
                }
                ActivityTxt.this.k5 = false;
                ActivityTxt.this.Jd();
            }
            if (e50.g5 && ActivityTxt.this.F7()) {
                ActivityTxt.this.H1.sendEmptyMessageDelayed(ActivityTxt.A0, 500L);
            }
        }
    }

    public class q implements e.c {
        final g50.f a;

        q(final g50.f val$fromNote) {
            this.a = val$fromNote;
        }

        @Override
        public void AfterEditNote(int result, String text) {
            if (result == 1) {
                e50.r(this.a);
                ActivityTxt.this.J9();
                MRTextView n9 = ActivityTxt.this.n9();
                n9.P0 = -1;
                n9.postInvalidate();
                ActivityTxt.this.C5(400);
            }
        }
    }

    public class q0 extends Handler {
        q0(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            ActivityTxt.this.dd(true);
        }
    }

    public class q1 implements View.OnClickListener {
        q1() {
        }

        @Override
        public void onClick(View v) {
            ActivityTxt.this.Jb();
        }
    }

    public class q2 implements DialogInterface.OnClickListener {
        q2() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.rb.clear();
            ActivityTxt.this.W6();
        }
    }

    public class q3 implements DialogInterface.OnClickListener {
        final CheckBox a;

        q3(final CheckBox val$cb) {
            this.a = val$cb;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.M6 = !this.a.isChecked();
        }
    }

    public class q4 implements View.OnClickListener {
        q4() {
        }

        @Override
        public void onClick(View v) {
            e50.y5 = true;
            e50.z5--;
            ActivityTxt.this.zh();
        }
    }

    public class q5 implements DialogInterface.OnClickListener {
        final CheckBox a;

        q5(final CheckBox val$cb) {
            this.a = val$cb;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.O2 = !this.a.isChecked();
            e50.D6 = false;
            ActivityTxt.this.h6();
        }
    }

    public class q6 implements DialogInterface.OnDismissListener {
        q6() {
        }

        @Override
        public void onDismiss(DialogInterface dialog) {
            e50.R6(true);
            ActivityTxt.this.i8 = null;
        }
    }

    public class r implements e.c {
        final g50.f a;
        final String b;

        r(final g50.f val$note, final String val$tag1) {
            this.a = val$note;
            this.b = val$tag1;
        }

        @Override
        public void AfterEditNote(int result, String text) {
            if (result == 1) {
                if (!this.b.equals(this.a.k + this.a.h + this.a.n + this.a.o + this.a.m)) {
                    e50.z7(this.a);
                }
            } else if (result == 2) {
                ActivityTxt.this.Qd(this.a);
            }
            ActivityTxt.this.a2.postInvalidate();
        }
    }

    class r0 implements DialogInterface.OnClickListener {
        r0() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.A6(which);
        }
    }

    public class r1 implements SeekBar.OnSeekBarChangeListener {
        long a;

        r1() {
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser) {
                Time time = new Time();
                time.set(seekBar.getProgress());
                ActivityTxt.this.ib.setText(time.format("%M:%S"));
                if (SystemClock.elapsedRealtime() - this.a > 800) {
                    this.a = SystemClock.elapsedRealtime();
                    ActivityTxt.this.lb.seekTo(seekBar.getProgress());
                }
                ActivityTxt.this.L8().sendEmptyMessageDelayed(0, 1000L);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            ActivityTxt.this.lb.seekTo(seekBar.getProgress());
        }
    }

    public class r2 implements DialogInterface.OnClickListener {
        r2() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.rb.clear();
            ActivityTxt.this.W6();
        }
    }

    public class r3 implements DialogInterface.OnClickListener {
        final CheckBox a;

        r3(final CheckBox val$cb) {
            this.a = val$cb;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.M6 = !this.a.isChecked();
            ActivityTxt.this.wg();
        }
    }

    public class r4 implements View.OnClickListener {
        r4() {
        }

        @Override
        public void onClick(View v) {
            e50.y5 = true;
            e50.z5++;
            ActivityTxt.this.zh();
        }
    }

    class r5 implements Runnable {
        r5() {
        }

        @Override
        public void run() {
            if (ActivityTxt.this.isFinishing()) {
                return;
            }
            e50.R6(true);
        }
    }

    public class r6 implements d.InterfaceC0936d {
        final e50.k a;

        r6(final e50.k val$bms) {
            this.a = val$bms;
        }

        @Override
        public void AfterEdit(String result, Integer editColor) {
            ActivityTxt.this.y5(this.a, result);
            if (ActivityTxt.this.Dh()) {
                return;
            }
            ActivityTxt.this.a2.postInvalidate();
        }
    }

    class s implements DialogInterface.OnClickListener {
        s() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.getSharedPreferences(e50.w0, 0).edit().clear().commit();
        }
    }

    public class s0 implements View.OnClickListener {

        class a implements DialogInterface.OnCancelListener {
            a() {
            }

            @Override
            public void onCancel(DialogInterface dialog) {
                ActivityTxt.this.Xc(false);
            }
        }

        class b implements DialogInterface.OnClickListener {
            b() {
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                ActivityTxt.this.Xc(false);
            }
        }

        class c implements DialogInterface.OnClickListener {
            final EditText a;

            c(final EditText val$et) {
                this.a = val$et;
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                String obj = this.a.getText().toString();
                Page.a selectedAnnot = ActivityTxt.this.F2.b.getSelectedAnnot();
                if (selectedAnnot != null) {
                    if (selectedAnnot.T() == 3) {
                        selectedAnnot.d0(obj);
                        ActivityTxt.this.F2.b.refreshCurPage();
                    } else {
                        selectedAnnot.o0(obj);
                    }
                    e50.qa = true;
                    return;
                }
                if (obj.length() > 0) {
                    Global.g = obj;
                } else {
                    Global.g = null;
                }
            }
        }

        class d implements DialogInterface.OnCancelListener {
            d() {
            }

            @Override
            public void onCancel(DialogInterface dialog) {
                ActivityTxt.this.Xc(false);
            }
        }

        class e implements DialogInterface.OnClickListener {
            e() {
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                ActivityTxt.this.Xc(false);
            }
        }

        class f implements DialogInterface.OnClickListener {
            final CheckBox a;

            f(final CheckBox val$caseCb) {
                this.a = val$caseCb;
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                e50.S7 = this.a.isChecked();
                ActivityTxt activityTxt = ActivityTxt.this;
                activityTxt.la = null;
                activityTxt.Xc(false);
            }
        }

        class g implements DialogInterface.OnCancelListener {
            g() {
            }

            @Override
            public void onCancel(DialogInterface dialog) {
                ActivityTxt.this.Xc(false);
            }
        }

        class h implements DialogInterface.OnClickListener {
            h() {
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                if (ActivityTxt.this.F2.b.getSelectedAnnot() != null) {
                    ActivityTxt.this.F2.b.getSelectedAnnot().t0(which + 1);
                    ActivityTxt.this.F2.b.refreshCurPage();
                    e50.qa = true;
                } else {
                    ActivityTxt activityTxt = ActivityTxt.this;
                    if (activityTxt.T9 == activityTxt.V9) {
                        Global.f = which + 11;
                    } else {
                        if (e50.ra == f.EnumC1090f.sta_ink) {
                            activityTxt.oa.onClick(activityTxt.W9);
                        }
                        Global.d = which + 1;
                    }
                }
                ActivityTxt.this.Xc(false);
            }
        }

        class i implements ColorDialog.g {
            i() {
            }

            @Override
            public void getColor(int color) {
                Global.c = color;
                if (ActivityTxt.this.F2.b.getSelectedAnnot() != null) {
                    ActivityTxt.this.F2.b.getSelectedAnnot().s0(color);
                    ActivityTxt.this.F2.b.refreshCurPage();
                    e50.qa = true;
                } else if (e50.ra == f.EnumC1090f.sta_ink) {
                    ActivityTxt activityTxt = ActivityTxt.this;
                    activityTxt.oa.onClick(activityTxt.W9);
                }
            }
        }

        class j implements DialogInterface.OnDismissListener {
            j() {
            }

            @Override
            public void onDismiss(DialogInterface dialog) {
                e50.R6(true);
                ActivityTxt.this.Xc(false);
            }
        }

        class k implements ColorDialog.g {
            k() {
            }

            @Override
            public void getColor(int color) {
                Global.e = color;
                if (ActivityTxt.this.F2.b.getSelectedAnnot() != null) {
                    ActivityTxt.this.F2.b.getSelectedAnnot().f0(color);
                    ActivityTxt.this.F2.b.refreshCurPage();
                    e50.qa = true;
                }
            }
        }

        class l implements DialogInterface.OnDismissListener {
            l() {
            }

            @Override
            public void onDismiss(DialogInterface dialog) {
                e50.R6(true);
                ActivityTxt.this.Xc(false);
            }
        }

        s0() {
        }

        @Override
        public void onClick(View v) {
            float Q;
            ActivityTxt.this.J9();
            if (v.getId() == R.id.optionB) {
                ActivityTxt.this.Xc(true);
                LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(ActivityTxt.this).inflate(R.layout.search_options, (ViewGroup) null);
                linearLayout.findViewById(R.id.forwardcb).setVisibility(8);
                linearLayout.findViewById(R.id.TextView02).setVisibility(8);
                CheckBox checkBox = (CheckBox) linearLayout.findViewById(R.id.casecb);
                CheckBox checkBox2 = (CheckBox) linearLayout.findViewById(R.id.wholecb);
                checkBox.setChecked(e50.S7);
                checkBox2.setVisibility(8);
                new m.c(ActivityTxt.this).y(R.string.search_options).B(linearLayout).v(R.string.ok, new f(checkBox)).o(R.string.cancel, new e()).t(new d()).C();
            }
            if (v.getId() == R.id.priorB) {
                ActivityTxt.this.Uc(false);
            }
            if (v.getId() == R.id.nextB) {
                ActivityTxt.this.Uc(true);
            }
            ActivityTxt.this.Pc();
            ActivityTxt activityTxt = ActivityTxt.this;
            if (v == activityTxt.U9) {
                if (activityTxt.T9 == activityTxt.W9 && e50.ra == f.EnumC1090f.sta_ink) {
                    activityTxt.F2.f();
                }
                ActivityTxt activityTxt2 = ActivityTxt.this;
                activityTxt2.T9 = activityTxt2.U9;
                Global.g = null;
                activityTxt2.F2.l();
                ActivityTxt.this.Zc();
            }
            ActivityTxt activityTxt3 = ActivityTxt.this;
            if (v == activityTxt3.V9) {
                if (activityTxt3.T9 == activityTxt3.W9 && e50.ra == f.EnumC1090f.sta_ink) {
                    activityTxt3.F2.f();
                }
                ActivityTxt.this.Oc();
                ActivityTxt activityTxt4 = ActivityTxt.this;
                activityTxt4.T9 = activityTxt4.V9;
                Global.g = null;
                activityTxt4.F2.g();
                ActivityTxt.this.Zc();
            }
            ActivityTxt activityTxt5 = ActivityTxt.this;
            ImageView imageView = activityTxt5.W9;
            if (v == imageView) {
                if (activityTxt5.T9 == imageView && e50.ra == f.EnumC1090f.sta_ink) {
                    activityTxt5.F2.f();
                }
                ActivityTxt activityTxt6 = ActivityTxt.this;
                activityTxt6.T9 = activityTxt6.W9;
                activityTxt6.F2.j();
                ActivityTxt.this.Zc();
            }
            ActivityTxt activityTxt7 = ActivityTxt.this;
            if (v == activityTxt7.X9) {
                if (activityTxt7.T9 == activityTxt7.W9 && e50.ra == f.EnumC1090f.sta_ink) {
                    activityTxt7.F2.f();
                }
                ActivityTxt activityTxt8 = ActivityTxt.this;
                activityTxt8.T9 = activityTxt8.X9;
                activityTxt8.F2.k();
                ActivityTxt.this.Zc();
            }
            ActivityTxt activityTxt9 = ActivityTxt.this;
            if (v == activityTxt9.Y9) {
                if (activityTxt9.T9 == activityTxt9.W9 && e50.ra == f.EnumC1090f.sta_ink) {
                    activityTxt9.F2.f();
                }
                ActivityTxt activityTxt10 = ActivityTxt.this;
                activityTxt10.T9 = activityTxt10.Y9;
                activityTxt10.F2.d();
                ActivityTxt.this.Zc();
            }
            ActivityTxt activityTxt11 = ActivityTxt.this;
            if (v == activityTxt11.Z9) {
                if (activityTxt11.T9 == activityTxt11.W9 && e50.ra == f.EnumC1090f.sta_ink) {
                    activityTxt11.F2.f();
                }
                ActivityTxt activityTxt12 = ActivityTxt.this;
                activityTxt12.T9 = activityTxt12.Z9;
                activityTxt12.F2.n();
                ActivityTxt.this.Zc();
            }
            ActivityTxt activityTxt13 = ActivityTxt.this;
            if (v == activityTxt13.ca) {
                if (activityTxt13.T9 == activityTxt13.W9 && e50.ra == f.EnumC1090f.sta_ink) {
                    activityTxt13.F2.f();
                }
                ActivityTxt activityTxt14 = ActivityTxt.this;
                activityTxt14.T9 = activityTxt14.ca;
                activityTxt14.F2.e();
                ActivityTxt.this.Zc();
            }
            ActivityTxt activityTxt15 = ActivityTxt.this;
            if (v == activityTxt15.da) {
                if (activityTxt15.T9 == activityTxt15.W9 && e50.ra == f.EnumC1090f.sta_ink) {
                    activityTxt15.F2.f();
                }
                e50.ra = f.EnumC1090f.sta_none;
                ActivityTxt activityTxt16 = ActivityTxt.this;
                activityTxt16.T9 = null;
                Global.g = null;
                activityTxt16.wc(true, true);
            }
            ActivityTxt activityTxt17 = ActivityTxt.this;
            if (v == activityTxt17.ea) {
                if (activityTxt17.F2.b.getSelectedAnnot() != null) {
                    e50.ra = f.EnumC1090f.sta_annot;
                    ActivityTxt.this.F2.o();
                    e50.qa = true;
                }
                ActivityTxt activityTxt18 = ActivityTxt.this;
                if (activityTxt18.T9 == activityTxt18.W9 && e50.ra == f.EnumC1090f.sta_ink) {
                    activityTxt18.F2.f();
                }
                e50.ra = f.EnumC1090f.sta_none;
                ActivityTxt activityTxt19 = ActivityTxt.this;
                activityTxt19.T9 = null;
                Global.g = null;
                if (activityTxt19.R9.getVisibility() == 0) {
                    ActivityTxt.this.Zc();
                } else {
                    ActivityTxt.this.S9.setVisibility(8);
                }
            }
            ActivityTxt activityTxt20 = ActivityTxt.this;
            String str = "";
            if (v == activityTxt20.fa) {
                Page.a selectedAnnot = activityTxt20.F2.b.getSelectedAnnot();
                String[] strArr = new String[20];
                if (selectedAnnot == null) {
                    ActivityTxt activityTxt21 = ActivityTxt.this;
                    Q = activityTxt21.T9 == activityTxt21.V9 ? Global.f : Global.d;
                } else {
                    Q = selectedAnnot.Q();
                }
                int i2 = (int) Q;
                for (int i3 = 0; i3 < 20; i3++) {
                    ActivityTxt activityTxt22 = ActivityTxt.this;
                    int i4 = (activityTxt22.T9 == activityTxt22.V9 ? 11 : 1) + i3;
                    StringBuilder sb = new StringBuilder();
                    sb.append(i4 == i2 ? com.flyersoft.components.m.a : "");
                    sb.append(i4);
                    strArr[i3] = sb.toString();
                }
                ActivityTxt.this.Xc(true);
                m.c cVar = new m.c(ActivityTxt.this);
                ActivityTxt activityTxt23 = ActivityTxt.this;
                cVar.y(activityTxt23.T9 == activityTxt23.V9 ? R.string.font_size : R.string.pdf_pen_width).i(strArr, new h()).t(new g()).C();
            }
            ActivityTxt activityTxt24 = ActivityTxt.this;
            if (v == activityTxt24.ga) {
                activityTxt24.Xc(true);
                Page.a selectedAnnot2 = ActivityTxt.this.F2.b.getSelectedAnnot();
                int P = selectedAnnot2 == null ? Global.c : selectedAnnot2.P();
                ActivityTxt activityTxt25 = ActivityTxt.this;
                ColorDialog colorDialog = new ColorDialog(activityTxt25, activityTxt25.getString(R.string.highlight_color), true, P, new i());
                colorDialog.setOnDismissListener(new j());
                colorDialog.show();
            }
            ActivityTxt activityTxt26 = ActivityTxt.this;
            if (v == activityTxt26.ha) {
                activityTxt26.Xc(true);
                Page.a selectedAnnot3 = ActivityTxt.this.F2.b.getSelectedAnnot();
                int v2 = selectedAnnot3 == null ? Global.e : selectedAnnot3.v();
                ActivityTxt activityTxt27 = ActivityTxt.this;
                ColorDialog colorDialog2 = new ColorDialog(activityTxt27, activityTxt27.getString(R.string.fill_color), true, v2, new k());
                colorDialog2.setOnDismissListener(new l());
                colorDialog2.show();
            }
            ActivityTxt activityTxt28 = ActivityTxt.this;
            if (v == activityTxt28.ia) {
                activityTxt28.Xc(true);
                EditText editText = new EditText(ActivityTxt.this);
                Page.a selectedAnnot4 = ActivityTxt.this.F2.b.getSelectedAnnot();
                if (selectedAnnot4 == null) {
                    String str2 = Global.g;
                    if (str2 != null) {
                        str = str2;
                    }
                } else {
                    str = selectedAnnot4.T() == 3 ? selectedAnnot4.k() : selectedAnnot4.J();
                }
                editText.setText(str);
                new m.c(ActivityTxt.this).B(editText).v(R.string.ok, new c(editText)).o(R.string.cancel, new b()).t(new a()).C();
            }
        }
    }

    public class s1 implements MediaPlayer.OnCompletionListener {
        s1() {
        }

        @Override
        public void onCompletion(MediaPlayer mp) {
            ActivityTxt.this.Jb();
        }
    }

    public class s2 implements DialogInterface.OnClickListener {
        s2() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt activityTxt = ActivityTxt.this;
            q50.b bVar = activityTxt.sb;
            if (bVar != null) {
                activityTxt.rb.add(0, bVar);
            }
            ActivityTxt activityTxt2 = ActivityTxt.this;
            ChapterDownloadService.g(activityTxt2, (q50) e50.Q1, activityTxt2.rb);
            ActivityTxt.this.rb.clear();
            ActivityTxt.this.W6();
        }
    }

    public class s3 implements View.OnClickListener {

        class a implements DialogInterface.OnClickListener {
            final EditText a;

            a(final EditText val$et) {
                this.a = val$et;
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                String obj = this.a.getText().toString();
                ActivityTxt.this.ne();
                if (e50.v6(obj)) {
                    o50.q2(ActivityTxt.this, ActivityTxt.this.getString(R.string.export_success) + "\n" + obj, 1);
                    return;
                }
                ActivityTxt activityTxt = ActivityTxt.this;
                o50.q2(activityTxt, activityTxt.getString(R.string.export_failed), 1);
            }
        }

        s3() {
        }

        @Override
        public void onClick(View v) {
            EditText editText = new EditText(ActivityTxt.this);
            editText.setText("/sdcard/" + o50.N0(e50.V1) + ".ttsfilter");
            new m.c(ActivityTxt.this).y(R.string.export).B(editText).v(android.R.string.ok, new a(editText)).o(android.R.string.cancel, null).C();
        }
    }

    public class s4 implements View.OnClickListener {
        s4() {
        }

        @Override
        public void onClick(View v) {
            e50.y5 = !e50.y5;
            ActivityTxt.this.zh();
        }
    }

    class s5 extends Handler {
        int a;

        class a implements DialogInterface.OnClickListener {
            a() {
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                ActivityTxt.this.ee();
            }
        }

        s5(Looper looper) {
            super(looper);
            this.a = 0;
        }

        private boolean a(Message msg) {
            if (!e50.c5) {
                return false;
            }
            ActivityTxt activityTxt = ActivityTxt.this;
            if (!activityTxt.n1 || e50.x5(activityTxt) || this.a >= 15) {
                return false;
            }
            ActivityTxt activityTxt2 = ActivityTxt.this;
            if ((!activityTxt2.p1 || activityTxt2.q1) && activityTxt2.U1.getWidth() >= e50.u3()) {
                return false;
            }
            Message obtain = Message.obtain(msg);
            e50.N5("-waitActTransFinish, re_send: " + obtain.what + ", baseFrame: " + ActivityTxt.this.U1.getWidth() + ", system: " + e50.u3());
            this.a = this.a + 1;
            ActivityTxt.this.H1.sendMessageDelayed(obtain, 50L);
            return true;
        }

        @Override
        public void handleMessage(Message msg) {
            if (ActivityTxt.this.isFinishing()) {
                return;
            }
            ActivityTxt.this.ff();
            int i = msg.what;
            if (i == 985) {
                ActivityTxt.this.m8();
                return;
            }
            if (i == 45003) {
                com.flyersoft.seekbooks.q.C(ActivityTxt.this, msg.arg1, msg.arg2);
                return;
            }
            if (i == 976) {
                WB.searchClipboardBook(ActivityTxt.this);
                return;
            }
            if (i == 10171) {
                BrowserAct.downloadBook2();
                ActivityTxt.this.hideProgressDlg();
                return;
            }
            if (i == 974) {
                if (ActivityTxt.this.G2 != null) {
                    ActivityTxt.this.hideProgressDlg();
                    ActivityTxt.this.Ld();
                    return;
                }
                return;
            }
            if (i == 975) {
                ActivityTxt.this.hideProgressDlg();
                o50.p2(ActivityTxt.this, (String) msg.obj);
                return;
            }
            if (i == 2100) {
                WebBookDetailAct.doOnFinish((DownloadTask.Result) msg.obj);
                return;
            }
            if (i == 2101) {
                WebBookDetailAct.doOnError((DownloadTask.Result) msg.obj);
                return;
            }
            if (i == 2102) {
                ActivityTxt.this.clearCachedWebViews();
                return;
            }
            if (i == 973) {
                ActivityTxt.this.Mh(false);
                return;
            }
            if (i == 960) {
                ActivityTxt.this.l6();
                return;
            }
            if (i == 961) {
                ActivityTxt.this.O7((String) msg.obj, msg.arg1 == 1);
                return;
            }
            try {
                switch (i) {
                    case 101:
                        if (ActivityTxt.this.P1) {
                            return;
                        }
                        e50.N5("===========SHOW_TXT");
                        if (a(msg)) {
                            return;
                        }
                        ActivityTxt.this.tg(e50.f2, null);
                        ActivityTxt.this.Yd();
                        ActivityTxt.this.cg(0);
                        ActivityTxt.this.vd();
                        ActivityTxt.this.hideProgressDlg();
                        if (ActivityTxt.this.S9()) {
                            return;
                        }
                        if (!ActivityTxt.this.N2.equals("")) {
                            ActivityTxt activityTxt = ActivityTxt.this;
                            o50.q2(activityTxt, activityTxt.N2, 1);
                            ActivityTxt.this.N2 = "";
                            return;
                        }
                        ActivityTxt activityTxt2 = ActivityTxt.this;
                        if (activityTxt2.J2) {
                            activityTxt2.J2 = false;
                            o50.p2(activityTxt2, activityTxt2.getString(R.string.loaded_all));
                            return;
                        } else {
                            if (activityTxt2.Q2) {
                                o50.q2(activityTxt2, e50.V1 + ActivityTxt.this.getString(R.string.not_exists), 1);
                                return;
                            }
                            return;
                        }
                    case 102:
                        if (ActivityTxt.this.P1) {
                            return;
                        }
                        e50.N5("===========SHOW_HTML");
                        if (a(msg)) {
                            return;
                        }
                        if (e50.g7) {
                            ActivityTxt.this.hideProgressDlg();
                            ActivityTxt.this.Tf("");
                            return;
                        }
                        ActivityTxt activityTxt3 = ActivityTxt.this;
                        if (!activityTxt3.Q2) {
                            if (!activityTxt3.O2 && e50.f2 > 0) {
                                MRTextView mRTextView = activityTxt3.Q1;
                                activityTxt3.R1.D0 = true;
                                mRTextView.D0 = true;
                            }
                            try {
                                activityTxt3.P2 = o50.F(o50.B0(activityTxt3.P2));
                                ActivityTxt activityTxt4 = ActivityTxt.this;
                                activityTxt4.n5 = e50.x(activityTxt4.P2);
                                if (!e50.U5()) {
                                    if (e50.h2 > e50.G9.size() - 1) {
                                        e50.h2 = 0;
                                    }
                                    ActivityTxt.this.n5 = e50.G9.get(e50.h2);
                                }
                                ActivityTxt activityTxt5 = ActivityTxt.this;
                                activityTxt5.n5 = e50.Q(activityTxt5.n5);
                                ActivityTxt activityTxt6 = ActivityTxt.this;
                                activityTxt6.ph(com.flyersoft.staticlayout.j.c(activityTxt6.n5, activityTxt6.G5(), -1));
                            } catch (Exception e) {
                                e50.S0(e);
                                ActivityTxt activityTxt7 = ActivityTxt.this;
                                activityTxt7.ph(activityTxt7.P2);
                            }
                            ActivityTxt.this.hh(e50.f2);
                            ActivityTxt.this.hideProgressDlg();
                            if (ActivityTxt.this.S9()) {
                                return;
                            } else {
                                return;
                            }
                        }
                        o50.q2(activityTxt3, e50.V1 + ActivityTxt.this.getString(R.string.not_exists), 1);
                        return;
                    case 103:
                        ActivityTxt activityTxt8 = ActivityTxt.this;
                        if (activityTxt8.P1) {
                            return;
                        }
                        activityTxt8.H1.sendEmptyMessageDelayed(202, 30L);
                        return;
                    case 105:
                        if (a(msg)) {
                            return;
                        }
                        ActivityTxt.this.Fc(e50.V1);
                        if (ActivityTxt.this.Nb()) {
                            if (e50.c5 && ActivityTxt.this.L1) {
                                return;
                            }
                            ActivityTxt.this.fa();
                            return;
                        }
                        return;
                    case 106:
                        ActivityTxt.this.hideProgressDlg();
                        ActivityTxt.this.Gc(e50.V1);
                        return;
                    case 201:
                        if (ActivityTxt.this.P1 || a(msg)) {
                            return;
                        }
                        ActivityTxt.this.hideProgressDlg();
                        ActivityTxt.this.Zf((String) msg.obj, msg.arg1);
                        return;
                    case 202:
                        if (ActivityTxt.this.P1 || a(msg)) {
                            return;
                        }
                        boolean ha = ActivityTxt.this.ha(false);
                        ActivityTxt activityTxt9 = ActivityTxt.this;
                        activityTxt9.Tb = false;
                        int q8 = activityTxt9.q8();
                        if (q8 == 0 || q8 == 1) {
                            ActivityTxt activityTxt10 = ActivityTxt.this;
                            activityTxt10.Tb = e50.s4(e50.V1, activityTxt10.p8(), ActivityTxt.this.k8());
                            ActivityTxt activityTxt11 = ActivityTxt.this;
                            MRTextView mRTextView2 = activityTxt11.Q1;
                            activityTxt11.R1.D0 = false;
                            mRTextView2.D0 = false;
                            com.flyersoft.staticlayout.l layout = mRTextView2.getLayout();
                            if (layout == null) {
                                return;
                            } else {
                                ActivityTxt.this.nh(ActivityTxt.this.Q1.a0(layout.B(msg.arg1)));
                            }
                        } else if (q8 == 100) {
                            ActivityTxt.this.k5();
                            if (!e50.J4()) {
                                if (ActivityTxt.this.Nd()) {
                                    return;
                                }
                                ActivityTxt.this.hideProgressDlg();
                                ActivityTxt.this.O7(null, true);
                                return;
                            }
                            if (ActivityTxt.this.Ja()) {
                                return;
                            }
                            ActivityTxt activityTxt12 = ActivityTxt.this;
                            activityTxt12.Tb = e50.s4(e50.V1, activityTxt12.p8(), ActivityTxt.this.k8());
                            if (ActivityTxt.this.nb()) {
                                e50.g7 = false;
                                ActivityTxt.this.H1.sendEmptyMessageDelayed(ActivityTxt.d1, Constants.MINIMAL_AD_INTERVAL);
                            }
                            ActivityTxt activityTxt13 = ActivityTxt.this;
                            boolean z = activityTxt13.O2;
                            boolean z2 = !z && e50.g2 == 0 && e50.f2 == 0;
                            if (!z && e50.f2 > 0) {
                                MRTextView mRTextView3 = activityTxt13.Q1;
                                activityTxt13.R1.D0 = true;
                                mRTextView3.D0 = true;
                            }
                            activityTxt13.Of(e50.g2, e50.h2, e50.f2, true);
                            if (e50.Q1.A() && ((ActivityTxt.this.nb() || (!ActivityTxt.this.G1 && z2 && e50.Q1.h().size() > 3)) && !ha)) {
                                ActivityTxt.this.t7(0);
                            }
                            if (z2 && e50.A2() == 6) {
                                ActivityTxt.this.za(false);
                            }
                        }
                        if (ActivityTxt.this.q8() != 100) {
                            ActivityTxt.this.hideProgressDlg();
                        }
                        ActivityTxt activityTxt14 = ActivityTxt.this;
                        if (!activityTxt14.vb && e50.a3 && activityTxt14.nb() && !e50.D2().contains(e50.V1) && !e50.A4(e50.V1)) {
                            ActivityTxt.this.H1.sendEmptyMessageDelayed(ActivityTxt.W0, Constants.MINIMAL_AD_INTERVAL);
                        }
                        ActivityTxt.this.Yd();
                        ActivityTxt.this.z4 = false;
                        ActivityTxt activityTxt15 = ActivityTxt.this;
                        if (!activityTxt15.O2) {
                            activityTxt15.O2 = true;
                            activityTxt15.Bb();
                        }
                        ActivityTxt.this.xc();
                        if (ActivityTxt.this.t2.getVisibility() == 8) {
                            ActivityTxt.this.t2.setVisibility(0);
                        }
                        if (ActivityTxt.this.Nb() && (!e50.c5 || !ActivityTxt.this.L1)) {
                            ActivityTxt.this.fa();
                        }
                        ActivityTxt.this.j5();
                        ActivityTxt activityTxt16 = ActivityTxt.this;
                        if (activityTxt16.F1) {
                            activityTxt16.H1.sendEmptyMessageDelayed(ActivityTxt.f1, 100L);
                        }
                        ActivityTxt activityTxt17 = ActivityTxt.this;
                        if (activityTxt17.Tb && !activityTxt17.vb) {
                            activityTxt17.H1.sendEmptyMessageDelayed(ActivityTxt.i1, 300L);
                        }
                        ActivityTxt activityTxt18 = ActivityTxt.this;
                        activityTxt18.F1 = false;
                        activityTxt18.vb = false;
                        return;
                    case 301:
                        ActivityTxt.this.V6();
                        return;
                    case ActivityTxt.f0:
                        ActivityTxt.this.fg(false);
                        return;
                    case ActivityTxt.g0:
                        ActivityTxt.this.z5 = false;
                        ActivityTxt activityTxt19 = ActivityTxt.this;
                        if (!activityTxt19.x5 || activityTxt19.z1 || activityTxt19.za) {
                            return;
                        }
                        activityTxt19.x5 = false;
                        if (activityTxt19.Rg(activityTxt19.q9)) {
                            return;
                        }
                        ActivityTxt.this.s6();
                        return;
                    case ActivityTxt.h0:
                        ActivityTxt.this.H1.removeMessages(ActivityTxt.h0);
                        ActivityTxt activityTxt20 = ActivityTxt.this;
                        if (activityTxt20.y5) {
                            activityTxt20.y5 = false;
                            activityTxt20.v5(msg);
                            return;
                        }
                        return;
                    case 601:
                        e50.H6(ActivityTxt.this);
                        return;
                    case ActivityTxt.k0:
                        ActivityTxt.this.la();
                        return;
                    case ActivityTxt.l0:
                        ActivityTxt.this.ka(false);
                        ActivityTxt.this.H1.sendEmptyMessageDelayed(ActivityTxt.k0, 50L);
                        return;
                    case ActivityTxt.n0:
                        ActivityTxt activityTxt21 = ActivityTxt.this;
                        int i2 = msg.arg1;
                        activityTxt21.Bd(i2, i2 == -1);
                        return;
                    case ActivityTxt.o0:
                        if (ActivityTxt.this.isFinishing()) {
                            return;
                        }
                        ActivityTxt.this.i5();
                        ActivityTxt.this.l5();
                        ActivityTxt.this.j5();
                        ActivityTxt.this.H1.removeMessages(ActivityTxt.o0);
                        ActivityTxt.this.H1.sendEmptyMessageDelayed(ActivityTxt.o0, cr.l);
                        ActivityTxt.this.G6();
                        return;
                    case ActivityTxt.p0:
                        if (ActivityTxt.this.Nb()) {
                            ActivityTxt.this.f8(false);
                            return;
                        } else {
                            ActivityTxt.this.u9(false);
                            return;
                        }
                    case ActivityTxt.t0:
                        ActivityTxt activityTxt22 = ActivityTxt.this;
                        activityTxt22.E9(activityTxt22.E5(msg.arg1, activityTxt22.q9));
                        return;
                    case ActivityTxt.u0:
                        ActivityTxt activityTxt23 = ActivityTxt.this;
                        activityTxt23.Yf(activityTxt23.y4 == 1);
                        return;
                    case ActivityTxt.v0:
                        if (!e50.O9 || !ActivityTxt.this.Ka()) {
                            ActivityTxt.this.ac();
                            return;
                        } else {
                            ActivityTxt.this.Tg();
                            return;
                        }
                    case ActivityTxt.w0:
                        ActivityTxt.this.H1.removeMessages(ActivityTxt.w0);
                        ActivityTxt.this.sd(false);
                        return;
                    case ActivityTxt.x0:
                        ActivityTxt activityTxt24 = ActivityTxt.this;
                        activityTxt24.K6 = activityTxt24.f9();
                        ActivityTxt.this.ef(0);
                        return;
                    case ActivityTxt.y0:
                        new m.c(ActivityTxt.this).z(e50.S1().getString(R.string.error)).m((String) msg.obj).v(R.string.ok, null).o(R.string.cancel, new a()).C();
                        return;
                    case ActivityTxt.z0:
                        if (ActivityTxt.this.b8) {
                            ActivityTxt.this.fe(100, true, 50L);
                            return;
                        }
                        return;
                    case ActivityTxt.A0:
                        boolean z3 = e50.r3() > ActivityTxt.this.U1.getHeight() || e50.r3() > ActivityTxt.this.U1.getWidth();
                        if (!z3) {
                            ActivityTxt.this.pf();
                        }
                        if (z3 || msg.arg1 != 1) {
                            Handler handler = ActivityTxt.this.H1;
                            handler.sendMessageDelayed(handler.obtainMessage(ActivityTxt.A0, 1, 1), z3 ? 500L : 100L);
                            return;
                        }
                        return;
                    case ActivityTxt.B0:
                        ActivityTxt.this.lh(msg.arg1);
                        return;
                    case ActivityTxt.C0:
                        ActivityTxt.this.Pe();
                        return;
                    case ActivityTxt.D0:
                        e50.W6(e50.I1, false);
                        if (ActivityTxt.this.F7()) {
                            e50.W6(e50.J1, false);
                        }
                        ActivityTxt.this.X4();
                        return;
                    case ActivityTxt.E0:
                        ActivityTxt.this.X4();
                        ActivityTxt.this.a2.postInvalidate();
                        return;
                    case ActivityTxt.F0:
                        ActivityTxt.this.ed();
                        return;
                    case ActivityTxt.G0:
                        ActivityTxt.this.N7(0);
                        return;
                    case ActivityTxt.H0:
                        ActivityTxt.this.Dh();
                        return;
                    case ActivityTxt.I0:
                        ActivityTxt.this.jg();
                        ActivityTxt activityTxt25 = ActivityTxt.this;
                        o50.q2(activityTxt25, activityTxt25.getString(R.string.bluelight_filter_enabled), 0);
                        return;
                    case ActivityTxt.L0:
                        ActivityTxt.this.Y6();
                        return;
                    case ActivityTxt.M0:
                        ActivityTxt.this.H5();
                        return;
                    case ActivityTxt.N0:
                        ActivityTxt.this.I5();
                        return;
                    case ActivityTxt.O0:
                        System.exit(0);
                        return;
                    case ActivityTxt.Q0:
                        ActivityTxt.this.R4();
                        return;
                    case ActivityTxt.S0:
                        ActivityTxt.this.e6((DownloadTask.Result) msg.obj);
                        return;
                    case ActivityTxt.T0:
                        ActivityTxt.this.c6((DownloadTask.Result) msg.obj);
                        return;
                    case ActivityTxt.U0:
                        ActivityTxt.this.F6((DownloadTask.Result) msg.obj, msg.arg1 == 1, msg.arg2 == 1);
                        return;
                    case ActivityTxt.V0:
                        ActivityTxt.this.E6((DownloadTask.Result) msg.obj);
                        return;
                    case ActivityTxt.a1:
                        ActivityTxt.this.Q9();
                        return;
                    case ActivityTxt.b1:
                        ActivityTxt.this.X9(msg.arg1 == 1);
                        return;
                    case ActivityTxt.c1:
                        ActivityTxt.this.I6();
                        return;
                    case ActivityTxt.d1:
                        ActivityTxt activityTxt26 = ActivityTxt.this;
                        if (activityTxt26.P1 || activityTxt26.isFinishing()) {
                            return;
                        }
                        ActivityTxt.this.Q4();
                        return;
                    case ActivityTxt.e1:
                        ActivityTxt.this.d6((DownloadTask.Result) msg.obj);
                        return;
                    case ActivityTxt.f1:
                        ActivityTxt.this.za(false);
                        return;
                    case ActivityTxt.h1:
                        ActivityTxt.this.Oh();
                        return;
                    case ActivityTxt.g:
                        ActivityTxt.this.S9();
                        return;
                    case ActivityTxt.m0:
                        ActivityTxt.this.ka(false);
                        return;
                    case ActivityTxt.q0:
                        ActivityTxt.this.A5();
                        return;
                    case ActivityTxt.r0:
                        ActivityTxt.this.B5();
                        return;
                    case ActivityTxt.s0:
                        ActivityTxt.this.L7();
                        return;
                    case ActivityTxt.P0:
                        ActivityTxt.this.ce();
                        return;
                    case ActivityTxt.R0:
                        ActivityTxt.this.Qg();
                        return;
                    default:
                        return;
                }
            } catch (Exception e2) {
                e50.S0(e2);
            }
            e50.S0(e2);
        }
    }

    public class s6 extends Handler {
        s6(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            ActivityTxt.this.l7((String) msg.obj);
        }
    }

    class t implements DialogInterface.OnClickListener {
        final String[] a;

        t(final String[] val$list) {
            this.a = val$list;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.Rb(e50.h2(e50.m6), this.a[which]);
        }
    }

    public class t0 extends Thread {
        t0() {
        }

        @Override
        public void run() {
            ActivityTxt activityTxt = ActivityTxt.this;
            activityTxt.pa = Global.a(activityTxt, e50.V1);
            ActivityTxt.this.H1.sendEmptyMessage(106);
        }
    }

    public class t1 extends Handler {
        t1(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            ActivityTxt activityTxt = ActivityTxt.this;
            MediaPlayer mediaPlayer = activityTxt.lb;
            if (mediaPlayer == null || activityTxt.mb != 1) {
                return;
            }
            activityTxt.kb.setMax(mediaPlayer.getDuration());
            ActivityTxt activityTxt2 = ActivityTxt.this;
            activityTxt2.kb.setProgress(activityTxt2.lb.getCurrentPosition());
            Time time = new Time();
            time.set(ActivityTxt.this.lb.getCurrentPosition());
            ActivityTxt.this.ib.setText(time.format("%M:%S"));
            time.set(ActivityTxt.this.lb.getDuration());
            ActivityTxt.this.jb.setText(time.format("%M:%S"));
            ActivityTxt activityTxt3 = ActivityTxt.this;
            if (activityTxt3.mb == 1) {
                activityTxt3.ob.sendEmptyMessageDelayed(0, 1000L);
            }
        }
    }

    public class t2 implements DialogInterface.OnClickListener {
        t2() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (ActivityTxt.this.Db != -1) {
                e50.w6("" + (ActivityTxt.this.Db + 1), true);
                ActivityTxt.this.Jh();
            }
        }
    }

    public class t3 implements DialogInterface.OnClickListener {
        final CheckBox a;

        t3(final CheckBox val$cb) {
            this.a = val$cb;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.N6 = !this.a.isChecked();
        }
    }

    class t4 extends Handler {
        t4(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            int a0;
            int spanStart;
            if (ActivityTxt.this.Q1.getLayout() == null) {
                return;
            }
            try {
                int i = msg.what;
                int i2 = 0;
                if (i == 0) {
                    ActivityTxt.this.nh(0);
                    ActivityTxt.this.X2 = false;
                    ActivityTxt.this.z4 = false;
                } else if (i == 1) {
                    ActivityTxt.this.a6();
                    int realHeight = ActivityTxt.this.Q1.getRealHeight();
                    int h3 = e50.h3();
                    int lineHeight = ActivityTxt.this.Q1.getLineHeight();
                    if (ActivityTxt.this.F7()) {
                        int i3 = h3 * 2;
                        a0 = realHeight > i3 - lineHeight ? ActivityTxt.this.Q1.a0(ActivityTxt.this.Q1.getLayout().C((realHeight - i3) + (lineHeight * 3))) : 0;
                    } else {
                        int C = ActivityTxt.this.Q1.getLayout().C((realHeight - h3) + (lineHeight * 2));
                        if (ActivityTxt.this.Q1.getSpanned() != null) {
                            int I = ActivityTxt.this.Q1.getLayout().I(C);
                            b.C0906b[] c0906bArr = (b.C0906b[]) ActivityTxt.this.Q1.getSpanned().getSpans(I, ActivityTxt.this.Q1.getText().length(), b.C0906b.class);
                            if (c0906bArr.length > 0 && (spanStart = ActivityTxt.this.Q1.getSpanned().getSpanStart(c0906bArr[c0906bArr.length - 1])) > I && spanStart < ActivityTxt.this.Q1.getText().length()) {
                                C = ActivityTxt.this.Q1.getLayout().B(spanStart);
                            }
                        }
                        a0 = ActivityTxt.this.Q1.a0(C);
                    }
                    ActivityTxt.this.o5 = SystemClock.elapsedRealtime();
                    ActivityTxt.this.nh(a0);
                    ActivityTxt.this.K7();
                    ActivityTxt.this.X2 = false;
                    ActivityTxt.this.z4 = false;
                } else if (i == 2) {
                    ActivityTxt.this.nh((int) ((((Integer) msg.obj).intValue() * ActivityTxt.this.Q1.getRealHeight()) / e50.Z7));
                } else if (i == 3) {
                    ActivityTxt.this.nh(ActivityTxt.this.Q1.a0(ActivityTxt.this.Q1.getLayout().B(((Integer) msg.obj).intValue())));
                } else if (i == 4) {
                    ActivityTxt.this.z4 = true;
                    ActivityTxt.this.q5();
                    ActivityTxt.this.Ie();
                    f50 f50Var = e50.Q1;
                    if (f50Var != null && !f50Var.y()) {
                        ActivityTxt.this.ph(e50.Q(e50.G9.get(e50.h2)));
                        Handler handler = ActivityTxt.this.F4;
                        if (((Integer) msg.obj).intValue() == 1) {
                            i2 = 1;
                        }
                        handler.sendEmptyMessageDelayed(i2, 50L);
                        if (e50.O9) {
                            ActivityTxt.this.Eg(-100);
                        }
                    }
                    ActivityTxt activityTxt = ActivityTxt.this;
                    f50 f50Var2 = e50.Q1;
                    activityTxt.m5 = f50Var2 == null ? activityTxt.G5() : f50Var2.p();
                    if (e50.U5()) {
                        return;
                    }
                    if (e50.h2 >= e50.G9.size()) {
                        e50.h2 = e50.G9.size() - 1;
                    }
                    ActivityTxt.this.n5 = e50.G9.get(e50.h2);
                    ActivityTxt activityTxt2 = ActivityTxt.this;
                    activityTxt2.n5 = e50.Q(activityTxt2.n5);
                    ActivityTxt activityTxt3 = ActivityTxt.this;
                    activityTxt3.ph(com.flyersoft.staticlayout.j.c(activityTxt3.n5, activityTxt3.m5, e50.g2));
                    Handler handler2 = ActivityTxt.this.F4;
                    if (((Integer) msg.obj).intValue() == 1) {
                    }
                    handler2.sendEmptyMessageDelayed(i2, 50L);
                    if (e50.O9) {
                    }
                }
            } finally {
                ActivityTxt.this.E4 = SystemClock.elapsedRealtime();
                ActivityTxt.this.hideProgressDlg();
            }
        }
    }

    public class t5 implements DialogInterface.OnClickListener {
        final CheckBox a;

        t5(final CheckBox val$cb) {
            this.a = val$cb;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.O2 = !this.a.isChecked();
            e50.D6 = true;
            ActivityTxt.this.h6();
        }
    }

    public class t6 implements View.OnClickListener {
        t6() {
        }

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(ActivityTxt.this, (Class<?>) PicGalleryShow.class);
            f50 f50Var = e50.Q1;
            if (f50Var != null && f50Var.i() != null) {
                intent.putExtra("ebookImage", e50.Q1.i());
            } else {
                intent.putExtra("imageFile", e50.A1(e50.V1));
                intent.putExtra("singPicOnly", true);
            }
            ActivityTxt.this.startActivity(intent);
        }
    }

    public class u implements DialogInterface.OnClickListener {
        u() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (o50.W1(ActivityTxt.this, "com.eusoft.eudic")) {
                return;
            }
            ActivityTxt activityTxt = ActivityTxt.this;
            o50.o2(activityTxt, activityTxt.getString(R.string.error), ActivityTxt.this.getString(R.string.market_not_install));
        }
    }

    public class u0 implements DialogInterface.OnCancelListener {
        u0() {
        }

        @Override
        public void onCancel(DialogInterface dialog) {
            ActivityTxt.this.l6();
        }
    }

    public class u1 extends Handler {
        u1(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            if (msg.what == 50) {
                e50.M1.setBackgroundDrawable(null);
            }
            e50.D6(e50.M1);
        }
    }

    public class u2 implements DialogInterface.OnClickListener {
        u2() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.ne();
            e50.v6(null);
        }
    }

    public class u3 implements DialogInterface.OnClickListener {
        final CheckBox a;

        u3(final CheckBox val$cb) {
            this.a = val$cb;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.N6 = !this.a.isChecked();
            ActivityTxt.this.bh(false);
            m.c cVar = ActivityTxt.this.Lb;
            if (cVar != null) {
                cVar.a();
            }
        }
    }

    class u4 implements e50.h {
        u4() {
        }

        @Override
        public void Finished(boolean success) {
            if (!success) {
                ActivityTxt activityTxt = ActivityTxt.this;
                activityTxt.j5 = 0L;
                if (activityTxt.q8() == 0 && ActivityTxt.this.Q8 > 1) {
                    ActivityTxt.x(ActivityTxt.this);
                }
                ActivityTxt activityTxt2 = ActivityTxt.this;
                if (activityTxt2.y4 == 1) {
                    activityTxt2.S2.setTag(null);
                }
                ActivityTxt.this.G4 = SystemClock.elapsedRealtime();
                int i = e50.g2;
                ActivityTxt activityTxt3 = ActivityTxt.this;
                activityTxt3.cc(-activityTxt3.y4, true, false);
                if (i == e50.g2) {
                    ActivityTxt.this.G4 = 0L;
                }
            }
            ActivityTxt activityTxt4 = ActivityTxt.this;
            activityTxt4.E9(activityTxt4.E5(1, null));
        }
    }

    public class u5 implements m.d {
        u5() {
        }

        @Override
        public void onClick(int which) {
            if (which < ActivityTxt.this.E6.size()) {
                m7 m7Var = (m7) ActivityTxt.this.E6.get(which);
                ActivityTxt.this.re(true);
                ActivityTxt.this.K9();
                ActivityTxt.this.A9(m7Var);
            }
        }
    }

    public class u6 implements f50.d {
        u6() {
        }

        @Override
        public void refresh(int wordCount) {
            ActivityTxt.this.H1.sendEmptyMessage(ActivityTxt.L0);
        }
    }

    public class v extends Thread {
        final String a;

        v(final String val$filename) {
            this.a = val$filename;
        }

        @Override
        public void run() {
            e50.n(this.a, true);
        }
    }

    public class v0 implements DialogInterface.OnClickListener {
        v0() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.l6();
        }
    }

    public class v1 extends Handler {
        v1(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            try {
                ActivityTxt.this.pe(true);
                e50.W();
                ActivityTxt.this.q5();
                e50.N();
                ActivityTxt.this.qh(e50.d3);
                ActivityTxt activityTxt = ActivityTxt.this;
                activityTxt.P2 = "";
                activityTxt.Jd();
            } catch (Exception e) {
                e50.S0(e);
            }
        }
    }

    public class v2 implements DialogInterface.OnClickListener {
        v2() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.Db = which;
        }
    }

    public class v3 implements DownloadTask.Callback {
        v3() {
        }

        @Override
        public void onCancel() {
        }

        @Override
        public void onError(DownloadTask.Result result, String err) {
            e50.N5("cacheStoreUrl error: " + err);
        }

        @Override
        public void onFinish(DownloadTask.Result result) {
            if (ActivityTxt.this.isFinishing()) {
                return;
            }
            result.site = S.store;
            Handler handler = ActivityTxt.this.H1;
            handler.sendMessage(handler.obtainMessage(ActivityTxt.e1, result));
        }

        @Override
        public void onProgress(DownloadTask.Result result, int progress, int total) {
        }
    }

    class v4 implements Runnable {
        v4() {
        }

        @Override
        public void run() {
            ActivityTxt.this.Ae();
        }
    }

    public class v5 implements DialogInterface.OnClickListener {
        final EditText a;

        v5(final EditText val$et) {
            this.a = val$et;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (ActivityTxt.this.C9 == null) {
                try {
                    String replace = this.a.getText().toString().replace("%", "");
                    if (ActivityTxt.this.Ya()) {
                        int intValue = Integer.valueOf(replace).intValue();
                        if (intValue > 0 && intValue <= ActivityTxt.this.qa.k()) {
                            ActivityTxt.this.vc(intValue, true);
                        }
                        ActivityTxt.this.Ih();
                    } else {
                        float floatValue = Float.valueOf(replace).floatValue() * 10.0f;
                        if (floatValue >= 0.0f && floatValue <= 1000.0f) {
                            ActivityTxt.this.zf((int) floatValue);
                            ActivityTxt.this.Ih();
                        }
                    }
                    ActivityTxt.this.za(true);
                } catch (Exception unused) {
                }
            }
        }
    }

    public class v6 implements f50.d {
        v6() {
        }

        @Override
        public void refresh(int wordCount) {
            ActivityTxt.this.H1.sendEmptyMessage(ActivityTxt.L0);
        }
    }

    public class w implements DialogInterface.OnClickListener {
        final String a;

        w(final String val$packageName) {
            this.a = val$packageName;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (o50.W1(ActivityTxt.this, this.a)) {
                return;
            }
            ActivityTxt activityTxt = ActivityTxt.this;
            o50.o2(activityTxt, activityTxt.getString(R.string.error), ActivityTxt.this.getString(R.string.market_not_install));
        }
    }

    public class w0 implements DialogInterface.OnClickListener {
        w0() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (o50.W1(ActivityTxt.this, "com.flyersoft.plugin_pdf")) {
                ActivityTxt.this.l6();
            } else {
                ActivityTxt activityTxt = ActivityTxt.this;
                activityTxt.O7(activityTxt.getString(R.string.market_not_install), true);
            }
        }
    }

    public class w1 implements DialogInterface.OnClickListener {
        w1() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            WB.doWebSearchWithSelect(ActivityTxt.this, o50.N0(e50.V1));
        }
    }

    public class w2 implements DialogInterface.OnClickListener {
        final EditText a;
        final CheckBox b;
        final CheckBox c;

        w2(final EditText val$et, final CheckBox val$cb1, final CheckBox val$cb2) {
            this.a = val$et;
            this.b = val$cb1;
            this.c = val$cb2;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            String obj = this.a.getText().toString();
            if (ActivityTxt.this.S7(obj, this.b.isChecked(), this.c.isChecked())) {
                e50.y6(ActivityTxt.this, obj);
            }
        }
    }

    public class w3 implements DialogInterface.OnClickListener {
        final CheckBox a;

        w3(final CheckBox val$cb) {
            this.a = val$cb;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.O2 = !this.a.isChecked();
            e50.D6 = false;
        }
    }

    public class w4 extends Handler {
        w4(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            ActivityTxt.this.E9(msg);
        }
    }

    class w5 implements TextToSpeech.OnInitListener {

        class a extends Handler {
            a(Looper looper) {
                super(looper);
            }

            @Override
            public void handleMessage(Message msg) {
                ActivityTxt.this.Q1.a();
                ActivityTxt.this.lh(msg.what);
                w5.this.b();
            }
        }

        w5() {
        }

        public void b() {
            ActivityTxt.this.F6 = -1;
            ActivityTxt activityTxt = ActivityTxt.this;
            activityTxt.K6 = activityTxt.f9();
            if (ActivityTxt.this.K6 != null && ActivityTxt.this.N6 != null) {
                e50.O9 = true;
                ActivityTxt.this.Cd();
                ActivityTxt.this.Ag();
                ActivityTxt.this.za(true);
                ActivityTxt.this.Q6 = -1;
                ActivityTxt activityTxt2 = ActivityTxt.this;
                activityTxt2.ef(activityTxt2.Q6 + 1);
                ActivityTxt.this.kf();
                ActivityTxt.this.qg();
                ActivityTxt.this.U1.setKeepScreenOn(true);
                return;
            }
            e50.O9 = false;
        }

        @Override
        public void onInit(int status) {
            String str;
            e50.N5("*TTS onInit:" + status);
            if (status == 0) {
                ActivityTxt activityTxt = ActivityTxt.this;
                activityTxt.L7 = false;
                try {
                    if (activityTxt.O6 != null) {
                        String str2 = ActivityTxt.this.O6;
                        ActivityTxt.this.O6 = null;
                        ActivityTxt.this.N6.setSpeechRate(e50.p6 / 10.0f);
                        ActivityTxt.this.N6.setPitch(e50.q6 / 10.0f);
                        ActivityTxt.this.N6.speak(str2, 0, null);
                        ActivityTxt.this.M6 = SystemClock.elapsedRealtime();
                        return;
                    }
                    if (ActivityTxt.this.Ya()) {
                        if (ActivityTxt.this.B7() && (str = ActivityTxt.this.F2.p0) != null && str.length() > 0) {
                            ActivityTxt.this.za(true);
                            ActivityTxt.this.I9();
                            ActivityTxt.this.N6.setSpeechRate(e50.p6 / 10.0f);
                            ActivityTxt.this.N6.setPitch(e50.q6 / 10.0f);
                            ActivityTxt.this.N6.speak(ActivityTxt.this.F2.p0, 0, null);
                            ActivityTxt.this.M6 = SystemClock.elapsedRealtime();
                            return;
                        }
                        b();
                        return;
                    }
                    ActivityTxt activityTxt2 = ActivityTxt.this;
                    MRTextView mRTextView = activityTxt2.Q1;
                    if (mRTextView.P0 == -1) {
                        mRTextView = activityTxt2.R1;
                        if (mRTextView.P0 == -1) {
                            mRTextView = null;
                        }
                    }
                    if (mRTextView != null) {
                        String charSequence = mRTextView.getText().subSequence(mRTextView.P0, mRTextView.Q0).toString();
                        ActivityTxt.this.za(true);
                        ActivityTxt.this.N6.setSpeechRate(e50.p6 / 10.0f);
                        ActivityTxt.this.N6.setPitch(e50.q6 / 10.0f);
                        ActivityTxt.this.N6.speak(charSequence, 0, null);
                        ActivityTxt.this.M6 = SystemClock.elapsedRealtime();
                        return;
                    }
                    if (activityTxt2.F7()) {
                        e50.y8 = null;
                        e50.O9 = true;
                        ActivityTxt.this.Z4();
                        new a(Looper.getMainLooper()).sendEmptyMessage(ActivityTxt.this.Q1.getCurPosition());
                        return;
                    }
                    b();
                    return;
                } catch (Exception e) {
                    e50.S0(e);
                    return;
                }
            }
            ActivityTxt activityTxt3 = ActivityTxt.this;
            o50.o2(activityTxt3, activityTxt3.getString(R.string.error), ActivityTxt.this.getString(R.string.tts_init_failed));
        }
    }

    public class w6 implements f50.d {
        w6() {
        }

        @Override
        public void refresh(int wordCount) {
            ActivityTxt.this.H1.sendEmptyMessage(ActivityTxt.L0);
        }
    }

    public class x extends Handler {
        final String[] a;
        final Context b;
        final Spinner c;
        final Spinner d;

        class a implements AdapterView.OnItemSelectedListener {

            class DialogInterfaceOnClickListenerC0927a implements DialogInterface.OnClickListener {
                final EditText a;

                DialogInterfaceOnClickListenerC0927a(final EditText val$et) {
                    this.a = val$et;
                }

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    e50.j6 = this.a.getText().toString();
                }
            }

            a() {
            }

            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                if (position == x.this.a.length - 1) {
                    EditText editText = new EditText(x.this.b);
                    editText.setText(e50.j6);
                    editText.setSingleLine(true);
                    new m.c(x.this.b).z(ActivityTxt.this.getString(R.string.my_dict_hint)).B(editText).v(R.string.ok, new DialogInterfaceOnClickListenerC0927a(editText)).C();
                }
                if (e50.p5()) {
                    for (int i = 0; i < parent.getChildCount(); i++) {
                        if (parent.getChildAt(i) instanceof TextView) {
                            ((TextView) parent.getChildAt(i)).setTextColor(-2236963);
                        }
                    }
                }
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {
            }
        }

        x(Looper looper, final String[] val$items, final Context val$context, final Spinner val$dict_sp, final Spinner val$dict_sp2) {
            super(looper);
            this.a = val$items;
            this.b = val$context;
            this.c = val$dict_sp;
            this.d = val$dict_sp2;
        }

        @Override
        public void handleMessage(Message msg) {
            a aVar = new a();
            this.c.setOnItemSelectedListener(aVar);
            this.d.setOnItemSelectedListener(aVar);
        }
    }

    public class x0 implements Document.PDFFontDelegate {
        x0() {
        }

        @Override
        public String GetExtFont(String collection, String fname, int flag, int[] ret_flags) {
            e50.N5("-------->pdfFontDelegate:" + fname);
            if (!e50.w3) {
                return null;
            }
            if (ActivityTxt.this.sa == null) {
                ActivityTxt.this.sa = new ArrayList();
            }
            if (ActivityTxt.this.sa.indexOf(fname) != -1) {
                return null;
            }
            if (!ActivityTxt.this.getSharedPreferences(e50.V1.replace(com.ksdk.ssds.manager.b.b, "") + "_font", 0).contains(fname)) {
                ActivityTxt.this.sa.add(fname);
                ActivityTxt.this.H1.removeMessages(ActivityTxt.F0);
                ActivityTxt.this.H1.sendEmptyMessageDelayed(ActivityTxt.F0, 1000L);
                return null;
            }
            e50.N5("*****ERROR: pdf font already added to delete sp:" + fname);
            return null;
        }
    }

    public class x1 implements DialogInterface.OnClickListener {
        x1() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.bh(true);
        }
    }

    public class x2 implements DialogInterface.OnClickListener {
        final EditText a;
        final CheckBox b;
        final CheckBox c;

        x2(final EditText val$et, final CheckBox val$cb1, final CheckBox val$cb2) {
            this.a = val$et;
            this.b = val$cb1;
            this.c = val$cb2;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            String obj = this.a.getText().toString();
            if (ActivityTxt.this.S7(obj, this.b.isChecked(), this.c.isChecked())) {
                o50.p2(ActivityTxt.this, e50.W0("已导出到" + obj));
                return;
            }
            o50.p2(ActivityTxt.this, e50.W0("导出失败"));
        }
    }

    public class x3 implements DialogInterface.OnClickListener {
        final CheckBox a;

        x3(final CheckBox val$cb) {
            this.a = val$cb;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.H2 = !this.a.isChecked();
            ActivityTxt.this.Zg();
        }
    }

    public class x4 implements ValueAnimator.AnimatorUpdateListener {
        x4() {
        }

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            ActivityTxt.this.b5++;
            int intValue = ((Integer) animation.getAnimatedValue()).intValue();
            ActivityTxt.this.S1.b0 = SystemClock.elapsedRealtime();
            if (intValue != 0) {
                ActivityTxt.this.rf(intValue, false, false);
            }
        }
    }

    public class x5 extends UtteranceProgressListener {
        x5() {
        }

        @Override
        public void onDone(String utteranceId) {
            e50.N5("#tts_onDone: " + utteranceId);
            ActivityTxt.this.x6(utteranceId);
        }

        @Override
        public void onError(String utteranceId) {
            e50.N5("###TTS ERROR### id: " + utteranceId);
        }

        @Override
        public void onStart(String utteranceId) {
            e50.N5("#tts_onStart: " + utteranceId);
            if (!ActivityTxt.this.Ya() || ActivityTxt.this.ab()) {
                e50.o oVar = (e50.o) ActivityTxt.this.K6.get(Integer.valueOf(utteranceId).intValue());
                ActivityTxt activityTxt = ActivityTxt.this;
                activityTxt.U9(activityTxt.G6 + oVar.b, ActivityTxt.this.G6 + oVar.c);
            }
        }
    }

    public class x6 implements DialogInterface.OnClickListener {
        x6() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.T6();
        }
    }

    public class y implements DialogInterface.OnClickListener {
        final Spinner a;
        final Spinner b;
        final CheckBox c;
        final CheckBox d;
        final boolean e;

        y(final Spinner val$dict_sp, final Spinner val$dict_sp2, final CheckBox val$cb, final CheckBox val$cb2, final boolean val$showMenu) {
            this.a = val$dict_sp;
            this.b = val$dict_sp2;
            this.c = val$cb;
            this.d = val$cb2;
            this.e = val$showMenu;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.m6 = this.a.getSelectedItemPosition();
            e50.n6 = this.b.getSelectedItemPosition();
            e50.T6 = this.c.isChecked();
            e50.U6 = this.d.isChecked();
            e50.v6 = true;
            if (this.e) {
                ActivityTxt.this.i6(false);
            }
        }
    }

    public class y0 implements DialogInterface.OnCancelListener {
        y0() {
        }

        @Override
        public void onCancel(DialogInterface dialog) {
            ActivityTxt.this.l6();
        }
    }

    public class y1 implements DialogInterface.OnCancelListener {
        y1() {
        }

        @Override
        public void onCancel(DialogInterface dialog) {
            e50.N5("tts filter cancelled");
            ActivityTxt.this.ne();
            e50.v6(null);
        }
    }

    public class y2 implements View.OnClickListener {
        final TextView a;
        final CheckBox b;
        final CheckBox c;

        class a implements f.d {
            a() {
            }

            @Override
            public void onGetFile(String filename) {
                y2.this.a.setText(filename);
                y2 y2Var = y2.this;
                ActivityTxt activityTxt = ActivityTxt.this;
                String charSequence = y2Var.a.getText().toString();
                y2 y2Var2 = y2.this;
                activityTxt.Ve(charSequence, y2Var2.b, y2Var2.c);
            }
        }

        y2(final TextView val$tv, final CheckBox val$cb1, final CheckBox val$cb2) {
            this.a = val$tv;
            this.b = val$cb1;
            this.c = val$cb2;
        }

        @Override
        public void onClick(View v) {
            new com.flyersoft.seekbooks.f(ActivityTxt.this, e50.W0("选择配色文件"), o50.n0(this.a.getText().toString()), new a(), "*.ssdsps").show();
        }
    }

    public class y3 implements DialogInterface.OnClickListener {
        final CheckBox a;

        y3(final CheckBox val$cb) {
            this.a = val$cb;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.P2 = !this.a.isChecked();
        }
    }

    public class y4 implements Animator.AnimatorListener {
        y4() {
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            ActivityTxt activityTxt = ActivityTxt.this;
            activityTxt.La.g = false;
            activityTxt.I6();
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }

        @Override
        public void onAnimationStart(Animator animation) {
            if (ActivityTxt.this.Ka.getHeight() < (ActivityTxt.this.Q1.getHeight() * 3) / 2) {
                ActivityTxt activityTxt = ActivityTxt.this;
                e50.a7(activityTxt.Ka, activityTxt.Q1.getHeight() * 2);
            }
        }
    }

    public class y5 implements Runnable {
        y5() {
        }

        @Override
        public void run() {
            ActivityTxt.this.Tg();
        }
    }

    public class y6 implements Runnable {
        y6() {
        }

        @Override
        public void run() {
            int size = e50.Y3().size();
            if (size > 0) {
                ActivityTxt.this.a8(200);
            }
            if (e50.f2 == 0 && e50.C8) {
                ActivityTxt activityTxt = ActivityTxt.this;
                if (activityTxt.G1) {
                    return;
                }
                activityTxt.G1 = true;
                if (size <= 5 || e50.f2 != 0) {
                    return;
                }
                activityTxt.t7(0);
            }
        }
    }

    public class z extends Handler {
        z(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            int left = ActivityTxt.this.c9.getLeft();
            int right = ActivityTxt.this.c9.getRight() + ActivityTxt.this.D9();
            if (right > ActivityTxt.this.U1.getWidth()) {
                int width = (right - ActivityTxt.this.U1.getWidth()) + e50.k0(2.0f);
                left -= width;
                right -= width;
            }
            if (left < 0) {
                right = ActivityTxt.this.D9() + ActivityTxt.this.c9.getWidth();
                left = 0;
            }
            HighlightLay highlightLay = ActivityTxt.this.c9;
            highlightLay.layout(left, highlightLay.getTop(), right, ActivityTxt.this.c9.getBottom());
            ActivityTxt.this.c9.requestLayout();
            ActivityTxt activityTxt = ActivityTxt.this;
            if (activityTxt.v9) {
                return;
            }
            activityTxt.v9 = true;
            activityTxt.u9 = false;
            activityTxt.Bg();
        }
    }

    public class z0 implements DialogInterface.OnClickListener {
        z0() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ActivityTxt.this.l6();
        }
    }

    public class z1 implements DownloadTask.Callback {
        z1() {
        }

        @Override
        public void onCancel() {
            q50.b bVar;
            ActivityTxt activityTxt = ActivityTxt.this;
            activityTxt.tb = false;
            activityTxt.hideProgressDlg();
            ActivityTxt.this.rb.clear();
            ActivityTxt activityTxt2 = ActivityTxt.this;
            if (activityTxt2.zb || ((bVar = activityTxt2.sb) != null && bVar.e == e50.g2)) {
                activityTxt2.Gf(null);
            }
            ActivityTxt.this.sb = null;
        }

        @Override
        public void onError(DownloadTask.Result result, String err) {
            Handler handler = ActivityTxt.this.H1;
            handler.sendMessage(handler.obtainMessage(ActivityTxt.T0, result));
        }

        @Override
        public void onFinish(DownloadTask.Result result) {
            Handler handler = ActivityTxt.this.H1;
            handler.sendMessage(handler.obtainMessage(ActivityTxt.S0, result));
        }

        @Override
        public void onProgress(DownloadTask.Result result, int progress, int total) {
        }
    }

    public class z2 implements DialogInterface.OnClickListener {
        final TextView a;
        final CheckBox b;
        final CheckBox c;

        class a implements DialogInterface.OnClickListener {
            a() {
            }

            @Override
            public void onClick(DialogInterface dialog, int which) {
                ActivityTxt.this.ce();
            }
        }

        z2(final TextView val$tv, final CheckBox val$cb1, final CheckBox val$cb2) {
            this.a = val$tv;
            this.b = val$cb1;
            this.c = val$cb2;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            String charSequence = this.a.getText().toString();
            if (o50.A1(charSequence)) {
                if (ActivityTxt.this.ca(charSequence, this.b.isChecked(), this.c.isChecked())) {
                    new m.c(ActivityTxt.this).m(e50.W0("\n已成功导入")).v(R.string.ok, new a()).d(false).C();
                    return;
                } else {
                    o50.n2(ActivityTxt.this, e50.W0("导入失败, 配置文件可能已损坏"));
                    return;
                }
            }
            o50.n2(ActivityTxt.this, e50.W0("文件不存在"));
        }
    }

    public class z3 implements DialogInterface.OnClickListener {
        final CheckBox a;

        z3(final CheckBox val$cb) {
            this.a = val$cb;
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            e50.P2 = !this.a.isChecked();
            Intent intent = new Intent();
            intent.setAction("android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS");
            ActivityTxt.this.startActivity(intent);
        }
    }

    public class z4 extends TimerTask {
        int a;
        int b;
        long c;

        z4() {
        }

        @Override
        public void run() {
            int i = ActivityTxt.this.La.a0;
            int i2 = i - this.b;
            this.b = i;
            int i3 = i2 > 0 ? 0 : this.a + 1;
            this.a = i3;
            if (i3 == 1) {
                this.c = SystemClock.elapsedRealtime();
            }
            if (this.a > 5) {
                e50.N5("============= no onDraw() execute ============");
                ActivityTxt.this.j5 += (SystemClock.elapsedRealtime() - this.c) + 20;
                this.a = 0;
            }
            ActivityTxt.this.b5++;
            long elapsedRealtime = SystemClock.elapsedRealtime();
            ActivityTxt activityTxt = ActivityTxt.this;
            float f = (float) (elapsedRealtime - activityTxt.j5);
            long j = activityTxt.e5;
            if (f >= ((float) j)) {
                activityTxt.La.g = false;
                long j2 = (r2.a0 * 1000) / j;
                activityTxt.H1.sendEmptyMessage(ActivityTxt.c1);
                cancel();
                return;
            }
            int i4 = activityTxt.d5 - activityTxt.c5;
            int i5 = activityTxt.y4;
            float f2 = i4;
            float pow = f2 - ((((float) Math.pow(((float) j) - f, 3.0d)) * f2) / ((float) Math.pow(ActivityTxt.this.e5, 3.0d)));
            ActivityTxt.this.rf((int) (r3.c5 + pow), false, true);
        }
    }

    public class z5 implements Runnable {
        z5() {
        }

        @Override
        public void run() {
            ActivityTxt.this.Hg();
        }
    }

    public class z6 implements DialogInterface.OnClickListener {
        z6() {
        }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (e50.D2().contains(e50.V1)) {
                e50.t0(e50.V1);
            } else {
                e50.m(e50.V1);
            }
        }
    }

    private void A4(int count) {
        e50.S4 += count;
        this.O9 += count;
    }

    public boolean A5() {
        try {
            if (!this.Y2 && !Ka() && !e50.O9 && !e50.P9) {
                if ((q8() == 100 && vb()) || this.j5 > 0) {
                    return false;
                }
                this.J4 = SystemClock.elapsedRealtime();
                e8();
                boolean z7 = this.T2 == H8() && !o50.I1(this.V2);
                o50.f2(this.U2);
                this.W2 = null;
                this.U2 = null;
                if (!z7) {
                    o50.f2(this.V2);
                    this.V2 = O8(false, b());
                    this.T2 = H8();
                }
                if (this.W1.getVisibility() != 0) {
                    FlipImageView flipImageView = this.i2;
                    flipImageView.d = this.V2;
                    flipImageView.b0 = true;
                    flipImageView.setVisibility(0);
                }
                int visibility = this.R1.getVisibility();
                this.M4 = this.S1.getScrollY();
                this.L4 = false;
                if (q8() == 0) {
                    int C = this.Q1.getLayout().C(this.S1.getScrollY());
                    this.N4 = this.Q1.X(C);
                    this.O4 = C < this.Q1.getLineCount() - 1 ? this.Q1.X(C + 1) : null;
                }
                cc(1, false, true);
                boolean z8 = visibility != this.R1.getVisibility();
                this.K4 = z8;
                if (z8) {
                    this.H1.sendEmptyMessage(r0);
                } else {
                    B5();
                }
                return true;
            }
            return false;
        } catch (Exception e8) {
            e50.S0(e8);
            return false;
        }
    }

    public void A6(int which) {
        za(true);
        if (which == 0) {
            B6(true);
        }
        if (which == 1) {
            e50.y6(this, e50.V1);
        }
        if (which == 2) {
            String i8 = com.flyersoft.components.a.i(e50.V1);
            String c02 = e50.c0();
            Bitmap O8 = O8(false, false);
            String str = e50.z + "/screenshot.jpg";
            o50.j(O8, str);
            ArrayList<? extends Parcelable> arrayList = new ArrayList<>();
            arrayList.add(Uri.fromFile(new File(str)));
            arrayList.add(Uri.fromFile(new File(i8)));
            o50.v(e50.R1 + com.ksdk.ssds.manager.b.b + e50.q0 + ".xml", e50.z + "/settings.txt", true);
            arrayList.add(Uri.fromFile(new File(e50.z + "/settings.txt")));
            Intent intent = new Intent("android.intent.action.SEND_MULTIPLE");
            intent.putExtra("android.intent.extra.EMAIL", new String[]{"soushushenqi@163.com"});
            intent.putExtra("android.intent.extra.SUBJECT", "Bug report: v23.2");
            intent.putExtra("android.intent.extra.TEXT", "Please describe how to repeat the bug:\n-------------\n" + c02 + "\n-------------\n");
            intent.setType(InterfaceC0548.f1142);
            intent.putParcelableArrayListExtra("android.intent.extra.STREAM", arrayList);
            startActivity(Intent.createChooser(intent, ""));
            int i9 = e50.ya + 1;
            e50.ya = i9;
            if (i9 > 1) {
                o50.q2(this, c02, 1);
            }
        }
    }

    private boolean A7() {
        PDFReader pDFReader;
        if (this.r2 == null || this.y2 == null || e50.M3) {
            return true;
        }
        return Ya() && (pDFReader = this.F2) != null && e50.c2 == 1 && !pDFReader.c;
    }

    public void A9(m7 back) {
        if (Ya()) {
            vc((int) back.e, true);
        } else {
            if (q8() == 1 && !e50.V1.equals(back.b)) {
                this.P2 = "";
            }
            e50.V1 = back.b;
            e50.g2 = back.c;
            e50.h2 = back.d;
            e50.f2 = back.e;
            if (!H9(null)) {
                J5("");
                Jd();
            }
        }
        Ih();
    }

    private boolean Aa() {
        return e50.n4 == 0;
    }

    private void Ab(String filename) {
        this.Ha = null;
        this.Xa = null;
        e50.N5("*loadFile:" + filename);
        getSharedPreferences(e50.q0, 0).edit().putBoolean("forceRebootToMain", true).commit();
        String i8 = com.flyersoft.components.a.i(filename);
        if (i8 == null) {
            this.H1.sendEmptyMessage(J0);
            return;
        }
        Handler handler = this.T8;
        if (handler != null) {
            handler.removeCallbacksAndMessages(null);
        }
        if (!e50.X6 && e50.S8 != null) {
            try {
                e50.S8 = null;
                q5();
                e50.Y6();
            } catch (Exception e8) {
                e50.S0(e8);
            }
        }
        e50.A = e50.z + "/tmp";
        if (i8.toLowerCase().endsWith(".fb2")) {
            if (o50.A1(i8 + ".zip")) {
                i8 = i8 + ".zip";
            }
        }
        if (new File(i8).isFile()) {
            e50.W();
            int q8 = q8();
            if (q8 == 0 || q8 == 1) {
                Db(i8);
            } else if (q8 == 100) {
                e50.G5(i8);
            }
            if (o50.b && e50.k5()) {
                e50.s6(o50.v0(e50.V1) + " open failed:");
                System.exit(0);
            } else {
                o50.b = false;
            }
            z4(e50.V1);
            e50.X();
        }
        e50.V1 = i8;
        e50.z6 = false;
        com.flyersoft.seekbooks.n.a = null;
        e50.H5();
        boolean Qa = Qa();
        this.B6 = Qa;
        this.z6 = Qa;
        this.u1 = e50.u3();
        this.v1 = e50.q3();
        this.w1 = getResources().getConfiguration().orientation;
    }

    private void Ac(boolean showHBar, boolean showHighlight) {
        int k02 = e50.k0(5.0f);
        int width = this.j9.getWidth() / 2;
        int left = this.j9.getLeft() + width;
        int top = this.j9.getTop() - k02;
        int left2 = this.k9.getLeft() + width;
        int top2 = this.k9.getTop() - k02;
        if (showHighlight) {
            if (left != left2) {
                e50.wa = true;
            }
            zc(left, top, left2, top2);
        }
        if (showHBar) {
            yb();
        } else {
            Se(false);
        }
    }

    public boolean Ae() {
        if (this.C9 != null || getResources().getConfiguration().orientation != this.w1) {
            return false;
        }
        int i8 = this.u1;
        int i9 = this.v1;
        int q32 = e50.q3();
        int u32 = e50.u3();
        if (i8 != 0 && u32 != 0) {
            boolean z7 = i9 == q32;
            if (!z7) {
                float f8 = i9 / q32;
                z7 = f8 > 0.88f && f8 < 1.12f;
            }
            if (z7 && (i8 > (u32 * 3) / 2 || u32 > (i8 * 3) / 2)) {
                e50.C2 = true;
                if (!e50.B2) {
                    return false;
                }
                e50.A2 = u32 > (i8 * 3) / 2;
                ce();
                return true;
            }
        }
        return false;
    }

    public void Ag() {
        if (e50.O9) {
            try {
                if (this.f7 == null) {
                    int i8 = Build.VERSION.SDK_INT;
                    if (i8 >= 16) {
                        RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.tts_notification);
                        Notification.Builder contentText = new Notification.Builder(getApplicationContext()).setSmallIcon(R.drawable.ttsb3).setOngoing(true).setContentTitle(getString(R.string.app_name)).setContentText("TTS");
                        e50.L6(contentText);
                        Notification build = contentText.build();
                        this.f7 = build;
                        build.contentView = remoteViews;
                        Drawable z12 = e50.z1(e50.V1);
                        if (z12 != null) {
                            remoteViews.setImageViewBitmap(R.id.tts_lay, o50.M(z12));
                        }
                        remoteViews.setOnClickPendingIntent(R.id.tts_stop, PendingIntent.getBroadcast(this, 0, new Intent("mr.tts.stop"), kw0.SUPERSCRIPT));
                        remoteViews.setOnClickPendingIntent(R.id.tts_pause, PendingIntent.getBroadcast(this, 0, new Intent("mr.tts.pause"), kw0.SUPERSCRIPT));
                        remoteViews.setOnClickPendingIntent(R.id.tts_play, PendingIntent.getBroadcast(this, 0, new Intent("mr.tts.play"), kw0.SUPERSCRIPT));
                        remoteViews.setOnClickPendingIntent(R.id.tts_lay, PendingIntent.getBroadcast(this, 0, new Intent("mr.tts.to.reader"), kw0.SUPERSCRIPT));
                        IntentFilter intentFilter = new IntentFilter();
                        intentFilter.addAction("mr.tts.stop");
                        intentFilter.addAction("mr.tts.pause");
                        intentFilter.addAction("mr.tts.play");
                        intentFilter.addAction("mr.tts.to.reader");
                        f6 f6Var = new f6();
                        this.g7 = f6Var;
                        registerReceiver(f6Var, intentFilter);
                    } else {
                        Intent intent = new Intent(getApplicationContext(), (Class<?>) ActivityMain.class);
                        intent.setAction("android.intent.action.MAIN");
                        intent.addCategory("android.intent.category.LAUNCHER");
                        PendingIntent activity = PendingIntent.getActivity(this, 0, intent, 0);
                        if (i8 < 19) {
                            Notification notification = new Notification(R.drawable.ttsb3, getString(R.string.app_name), System.currentTimeMillis());
                            this.f7 = notification;
                            notification.flags |= 2;
                            try {
                                notification.getClass().getMethod("setLatestEventInfo", Context.class, CharSequence.class, CharSequence.class, PendingIntent.class).invoke(this.f7, getApplicationContext(), getString(R.string.app_name), "TTS", activity);
                            } catch (Throwable th) {
                                e50.S0(th);
                            }
                        } else {
                            Notification.Builder contentText2 = new Notification.Builder(getApplicationContext()).setSmallIcon(R.drawable.ttsb3).setOngoing(true).setContentIntent(activity).setContentTitle(getString(R.string.app_name)).setContentText("TTS");
                            e50.L6(contentText2);
                            this.f7 = contentText2.build();
                        }
                    }
                }
                ((NotificationManager) getSystemService("notification")).notify(-1889667143, this.f7);
            } catch (Exception e8) {
                e50.S0(e8);
            }
        }
    }

    public void Ah() {
        View view = this.B2;
        if (view == null) {
            return;
        }
        ((RoundButton) view.findViewById(R.id.fontColor)).setSolidColor(e50.f3);
        ((RoundImage) this.B2.findViewById(R.id.backgroundImage)).setRoundImageDrawable(e50.I2(e50.w1(false), e50.z3, 1, 1));
        ((RoundButton) this.B2.findViewById(R.id.backgroundColor)).setSolidColor(e50.k3);
        ImageView imageView = (ImageView) this.B2.findViewById(R.id.backgroundColorSelect);
        boolean z7 = e50.B3;
        int i8 = R.drawable.indicator2;
        imageView.setImageResource(!z7 ? R.drawable.indicator2 : R.drawable.indicator3);
        ImageView imageView2 = (ImageView) this.B2.findViewById(R.id.backgroundImageSelect);
        if (!e50.B3) {
            i8 = R.drawable.indicator3;
        }
        imageView2.setImageResource(i8);
        ((RoundButton) this.B2.findViewById(R.id.saveTheme)).setChecked(Q5("1") || Q5("2") || Q5(Const.ACTION_COMPLAINT) || Q5("4"));
        Ye();
    }

    private void B4(String s7) {
        A4(o50.l1(s7, e50.H8));
    }

    public void B5() {
        this.W2 = O8(false, b());
        if (this.L4) {
            int i8 = -1;
            cc(-1, false, true);
            int C = this.Q1.getLayout().C(this.S1.getScrollY());
            int lineCount = this.Q1.getLineCount();
            if (!this.Q1.X(C).equals(this.N4) || (this.O4 != null && C < lineCount - 1 && !this.Q1.X(C + 1).equals(this.O4))) {
                int i9 = 1;
                while (true) {
                    if (i9 >= 50) {
                        break;
                    }
                    int i10 = C - i9;
                    if (i10 > 0 && this.Q1.X(i10).equals(this.N4) && (this.O4 == null || this.Q1.X(i10 + 1).equals(this.O4))) {
                        i8 = this.Q1.a0(i10);
                    } else {
                        int i11 = C + i9;
                        if (i11 < lineCount - 2 && this.Q1.X(i11).equals(this.N4) && (this.O4 == null || this.Q1.X(i11 + 1).equals(this.O4))) {
                            i8 = this.Q1.a0(i11);
                        }
                    }
                    if (i8 > 0) {
                        nh(i8);
                        e50.N5("*************now:" + this.S1.getScrollY() + ", shouldbe:" + i8 + ", offset:" + i9);
                        break;
                    }
                    i9++;
                }
            }
        } else {
            nh(this.M4);
        }
        Og(0, 0);
        if (this.K4) {
            this.H1.sendEmptyMessage(s0);
        } else {
            L7();
        }
    }

    public void B6(boolean readState) {
        e50.i E1 = e50.E1(e50.V1);
        if (readState) {
            ue();
            E1.d = P8();
        }
        uf(this, E1, e50.Q1, readState);
        e50.q7("doShare", "share_book", "", 1);
    }

    public static int B8(Drawable d8, int c8) {
        if (d8 != null) {
            c8 = o50.e0(d8);
        }
        int b02 = o50.b0(c8);
        int b03 = o50.b0(e50.f3);
        int i8 = e50.f3;
        if (b02 < 126 && b03 < 126) {
            return -723724;
        }
        if (b02 <= 126 || b03 <= 126) {
            return i8;
        }
        return -13421773;
    }

    public void B9() {
        this.z4 = true;
        a6();
        j8().sendEmptyMessageDelayed(0, Y5());
    }

    private boolean Ba() {
        return e50.O9 || e50.P9;
    }

    private void Bc() {
        if (this.oa != null) {
            return;
        }
        this.oa = new s0();
        this.u2.findViewById(R.id.optionB).setOnClickListener(this.oa);
        this.u2.findViewById(R.id.priorB).setOnClickListener(this.oa);
        this.u2.findViewById(R.id.nextB).setOnClickListener(this.oa);
        this.U9.setOnClickListener(this.oa);
        this.V9.setOnClickListener(this.oa);
        this.W9.setOnClickListener(this.oa);
        this.X9.setOnClickListener(this.oa);
        this.Y9.setOnClickListener(this.oa);
        this.Z9.setOnClickListener(this.oa);
        this.ca.setOnClickListener(this.oa);
        this.da.setOnClickListener(this.oa);
        this.ea.setOnClickListener(this.oa);
        this.fa.setOnClickListener(this.oa);
        this.ga.setOnClickListener(this.oa);
        this.ha.setOnClickListener(this.oa);
        this.ia.setOnClickListener(this.oa);
        this.T9 = null;
    }

    private void Be() {
        if (this.C6) {
            this.C6 = false;
        } else if (e50.C6) {
            if (e50.D6 || e50.G6) {
                Ce();
            }
        }
    }

    private void Bf() {
    }

    public void Bh() {
        this.W3.setChecked(e50.R3 || e50.S3);
        this.W3.setText(e50.S3 ? "简" : "繁");
    }

    private void C4() {
        if (Build.VERSION.SDK_INT >= 23 && e50.P2 && !this.Qb) {
            this.Qb = true;
            try {
                if (((PowerManager) getSystemService("power")).isIgnoringBatteryOptimizations(getPackageName())) {
                    return;
                }
                ScrollView scrollView = (ScrollView) LayoutInflater.from(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);
                checkBox.setChecked(false);
                textView.setText(Html.fromHtml(e50.W0("如果需要阅读器在息屏后继续朗读, 请在系统<b>电池优化</b>里, 把搜书大师加入到<b>白名单</b>中.")));
                new m.c(this).y(R.string.tip).B(scrollView).w(e50.W0("手动设置"), new z3(checkBox)).p(e50.W0("下次再说"), new y3(checkBox)).d(false).C();
            } catch (Exception e8) {
                e50.S0(e8);
            }
        }
    }

    public boolean C5(int delay) {
        Bitmap bitmap;
        this.J4 = 0L;
        if (!o50.I1(this.W2) && (bitmap = this.W2) != this.V2) {
            o50.f2(bitmap);
        }
        this.W2 = null;
        if (!e50.Q4() || this.j5 > 0) {
            return false;
        }
        if ((!this.Z2 && Build.VERSION.SDK_INT < 11) || q8() == 7) {
            return false;
        }
        if (q8() == 0 && F7()) {
            return false;
        }
        this.H1.removeMessages(q0);
        if (delay == 0) {
            return A5();
        }
        this.H1.sendEmptyMessageDelayed(q0, delay);
        return false;
    }

    private void C6(int msgWhat, Object obj) {
        if (this.z1) {
            D6(msgWhat, obj);
        } else {
            Gg().sendMessage(Gg().obtainMessage(msgWhat, obj));
        }
    }

    public void C7(int count) {
        this.Ab = 0;
        ArrayList arrayList = new ArrayList();
        int size = e50.Q1.h().size();
        if (count == -1) {
            for (int i8 = e50.g2 + 2; i8 < size; i8++) {
                if (!o50.A1(e50.Q1.h().get(i8).d)) {
                    arrayList.add(Integer.valueOf(i8));
                }
            }
            for (int i9 = 0; i9 < e50.g2; i9++) {
                if (!o50.A1(e50.Q1.h().get(i9).d)) {
                    arrayList.add(Integer.valueOf(i9));
                }
            }
        } else if (count == 0) {
            for (int i10 = e50.g2 + 2; i10 < size; i10++) {
                if (!o50.A1(e50.Q1.h().get(i10).d)) {
                    arrayList.add(Integer.valueOf(i10));
                }
            }
        } else {
            for (int i11 = e50.g2 + 2; i11 < size; i11++) {
                count--;
                if (count == 0) {
                    break;
                }
                if (!o50.A1(e50.Q1.h().get(i11).d)) {
                    arrayList.add(Integer.valueOf(i11));
                }
            }
        }
        if (arrayList.size() == 0) {
            o50.n2(this, getString(R.string.zhangjieyixiazai));
            return;
        }
        this.rb.clear();
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            int intValue = ((Integer) it.next()).intValue();
            ArrayList<q50.b> arrayList2 = this.rb;
            String str = e50.Q1.h().get(intValue).s;
            f50 f50Var = e50.Q1;
            arrayList2.add(new q50.b(str, f50Var.p.userAgent, f50Var.h().get(intValue).c, intValue, false, e50.Q1.h().get(intValue).a));
        }
        this.zb = true;
        this.H1.sendEmptyMessageDelayed(Q0, 0L);
        this.Bb = Html.fromHtml(e50.Q1.h().get(((Integer) arrayList.get(0)).intValue()).c + "<br><br><small><font color=\"#888888\">" + getString(R.string.paiduizhong) + this.rb.size() + "</font></small>");
        D5();
    }

    private int C8() {
        if (bb()) {
            return -1;
        }
        return e50.E5(e50.f3) ? R.drawable.bookstyle_night : R.drawable.bookstyle;
    }

    private boolean C9() {
        try {
            getPackageManager().getApplicationInfo("com.google.android.apps.translate", 0);
            return true;
        } catch (PackageManager.NameNotFoundException unused) {
            return false;
        }
    }

    private boolean Ca() {
        if (Ya()) {
            if (rc() != 0) {
                return false;
            }
            PDFReader pDFReader = this.F2;
            return pDFReader.c ? this.S1.getScrollY() == 0 : Global.m != 0 || pDFReader.b.viewGetPos().c == 0;
        }
        if (this.S1.getScrollY() == 0) {
            if (q8() == 0) {
                return true;
            }
            if (e50.g2 == 0 && e50.h2 == 0) {
                return true;
            }
        }
        return false;
    }

    private void Cb(String str, boolean z7) {
        boolean z8 = e50.M2;
        Td();
        if (Za()) {
            Lc();
            e50.c2 = str.equals("2") ? 1 : 0;
            jd(true);
            hf(true);
            return;
        }
        boolean z9 = this.x1 > 0 && q8() == 100 && vb();
        if (z9) {
            pe(true);
        }
        com.flyersoft.staticlayout.l layout = this.Q1.getLayout();
        if (!z7) {
            z7 = e50.n7(str);
        }
        int I = (z7 || layout == null) ? -1 : layout.I(layout.C(this.S1.getScrollY()));
        e50.J5(str, z7);
        this.Ra = true;
        if (!z7) {
            k5();
        } else {
            hf(true);
        }
        if (I != -1) {
            kh(I);
        }
        if (Z4()) {
            pf();
        }
        if (z9) {
            new k0(Looper.getMainLooper()).sendEmptyMessage(0);
        }
    }

    private void Cc() {
        if (this.u2 == null) {
            View inflate = ((ViewStub) findViewById(R.id.pdfStub)).inflate();
            this.u2 = inflate;
            this.na = (FrameLayout) inflate.findViewById(R.id.base);
            this.F2 = (PDFReader) this.u2.findViewById(R.id.PDFView);
            this.Q9 = this.u2.findViewById(R.id.searchLay);
            this.R9 = this.u2.findViewById(R.id.pdfTop);
            this.S9 = this.u2.findViewById(R.id.pdfBottom);
            this.U9 = (ImageView) this.u2.findViewById(R.id.imageView1);
            ImageView imageView = (ImageView) this.u2.findViewById(R.id.imageView2);
            this.V9 = imageView;
            imageView.setVisibility(8);
            this.W9 = (ImageView) this.u2.findViewById(R.id.imageView3);
            this.X9 = (ImageView) this.u2.findViewById(R.id.imageView4);
            this.Y9 = (ImageView) this.u2.findViewById(R.id.imageView5);
            this.Z9 = (ImageView) this.u2.findViewById(R.id.imageView6);
            this.ca = (ImageView) this.u2.findViewById(R.id.imageView7);
            this.da = (ImageView) this.u2.findViewById(R.id.imageView8);
            this.ea = (ImageView) this.u2.findViewById(R.id.ImageView01);
            this.fa = (ImageView) this.u2.findViewById(R.id.ImageView02);
            this.ga = (ImageView) this.u2.findViewById(R.id.ImageView03);
            this.ha = (ImageView) this.u2.findViewById(R.id.ImageView04);
            this.ia = (ImageView) this.u2.findViewById(R.id.ImageView05);
            this.R9.setVisibility(8);
            this.S9.setVisibility(8);
            this.ka = (ClearableEditText) findViewById(R.id.keyEdit);
            yc();
            Bc();
            if (e50.l7()) {
                this.ka.setOnFocusChangeListener(new n0());
                this.ka.setOnEditorActionListener(new o0());
            }
            ImageView imageView2 = (ImageView) this.u2.findViewById(R.id.pdfLockIv);
            this.ja = imageView2;
            imageView2.setOnClickListener(new p0());
        }
    }

    public void Cd() {
        if (e50.R6) {
            return;
        }
        AudioManager audioManager = (AudioManager) getSystemService("audio");
        this.q8 = false;
        this.p8 = false;
        if (this.o8 == null) {
            this.o8 = new e7();
        }
        e50.N5("##requestAudioFocus:" + audioManager.requestAudioFocus(this.o8, 3, 1));
    }

    private void Ce() {
        long currentTimeMillis = System.currentTimeMillis();
        int i8 = e50.E6 / 100;
        int i9 = e50.H6 / 100;
        Calendar calendar = Calendar.getInstance();
        int i10 = calendar.get(11);
        calendar.set(calendar.get(1), calendar.get(2), calendar.get(5), i8, e50.E6 % 100, 0);
        long timeInMillis = calendar.getTimeInMillis();
        calendar.set(calendar.get(1), calendar.get(2), calendar.get(5), 17, 0, 0);
        long timeInMillis2 = calendar.getTimeInMillis();
        calendar.set(calendar.get(1), calendar.get(2), calendar.get(5), i9, e50.H6 % 100, 0);
        long timeInMillis3 = calendar.getTimeInMillis();
        calendar.set(calendar.get(1), calendar.get(2), calendar.get(5), 5, 0, 0);
        long timeInMillis4 = calendar.getTimeInMillis();
        calendar.setTime(new Date(e50.K6));
        int i11 = calendar.get(11);
        char c8 = (!e50.D6 || currentTimeMillis <= timeInMillis || currentTimeMillis >= timeInMillis2 || (i11 >= 5 && i11 <= 17)) ? (char) 0 : (char) 1;
        if (c8 == 0 && e50.G6) {
            if (i9 > 17 && i9 < 24) {
                if (currentTimeMillis <= timeInMillis3) {
                }
                c8 = 65535;
            } else if (i9 < 5 && i10 >= i9 && currentTimeMillis < timeInMillis4) {
                Calendar calendar2 = Calendar.getInstance();
                int i12 = calendar2.get(1);
                int i13 = calendar2.get(2);
                int i14 = calendar2.get(5);
                int i15 = e50.H6;
                calendar2.set(i12, i13, i14, i15 / 100, i15 % 100, 0);
            }
        }
        if (c8 != 0) {
            boolean Ya = Ya();
            String str = e50.Z8;
            boolean z7 = !Ya && ((c8 == 1 && e50.Y1.equals(e50.Z8)) || (c8 == 65535 && !e50.Y1.equals(e50.Z8)));
            if (z7) {
                za(true);
                if (c8 == 1) {
                    str = e50.b9;
                }
                Cb(str, true);
                e50.J6(c8 == 65535);
                e50.sa = true;
                com.flyersoft.discuss.z.notifyThemeChanged();
            }
            if (e50.A5 != -100) {
                if (c8 == 1 && (e50.F6 == -100 || e50.A5 < e50.F6)) {
                    Ze(e50.F6, false);
                }
                if (c8 == 65535 && (e50.I6 == -100 || e50.A5 > e50.I6)) {
                    Ze(e50.I6, false);
                }
            }
            if (z7) {
                k5();
                Xe();
            }
            if (this.C9 != null) {
                Od();
            }
        }
    }

    public void Cg() {
        View view = this.f3;
        if (view != null && view != this.g3) {
            view.setVisibility(8);
        }
        View view2 = this.g3;
        if (view2 != null) {
            view2.setVisibility(0);
            this.y2.setVisibility(0);
            if (this.g3.getHeight() == 0) {
                this.g3.measure(0, 0);
            }
            TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f, this.y2.getHeight() - e50.ba, 0.0f);
            translateAnimation.setDuration(this.S3);
            this.y2.startAnimation(translateAnimation);
        }
    }

    public void Ch() {
        if (this.z2 == null) {
            return;
        }
        boolean z7 = false;
        this.X3.setChecked(e50.e4 == 0 && !e50.N5);
        RoundButton roundButton = this.Y3;
        int i8 = e50.e4;
        roundButton.setChecked(i8 == 3 || i8 == 6);
        RoundButton roundButton2 = this.Z3;
        int i9 = e50.e4;
        roundButton2.setChecked(i9 == 2 || i9 == 1);
        RoundButton roundButton3 = this.a4;
        if (!this.X3.e() && !this.Y3.e() && !this.Z3.e()) {
            z7 = true;
        }
        roundButton3.setChecked(z7);
    }

    public void D5() {
        ProgressDialog progressDialog = this.G2;
        if (progressDialog != null) {
            this.y8 = progressDialog;
            progressDialog.dismiss();
        }
        ProgressDialog progressDialog2 = !e50.p5() ? new ProgressDialog(this) : new ProgressDialog(this, R.style.MyProgressDialogDark);
        this.G2 = progressDialog2;
        progressDialog2.setTitle(getString(R.string.zhengzaixiazai));
        this.G2.setMessage(o50.E1(this.Bb) ? "" : this.Bb);
        this.G2.setCancelable(false);
        this.G2.setButton(-1, getString(R.string.houtiaxiazai), new n2());
        this.G2.setButton(-2, getString(R.string.tingzhixiazai), new o2());
        this.G2.show();
    }

    public void D6(int msgWhat, Object obj) {
        ArrayList<e50.o> arrayList;
        if (msgWhat == 6) {
            ac();
        }
        if (msgWhat == 0 && !Za()) {
            o7();
        }
        if (msgWhat == 1 && !Za()) {
            p7();
        }
        if (msgWhat == 2) {
            try {
                int intValue = ((Integer) obj).intValue();
                int scrollY = this.S1.getScrollY();
                e50.N5("----------------SPEAK_CHECK_PAGE---------------", Integer.valueOf(intValue), Integer.valueOf(scrollY));
                if (Math.abs(scrollY - intValue) > 5) {
                    this.K6 = f9();
                    if (this.H6 < 2) {
                        Hg();
                    } else {
                        ef(0);
                    }
                } else if (Ka()) {
                    Tg();
                }
            } catch (Exception e8) {
                Tg();
                e50.S0(e8);
            }
        }
        if (msgWhat == 3) {
            Tg();
        }
        if (msgWhat != 5 || (arrayList = this.K6) == null) {
            return;
        }
        if (this.Q6 > arrayList.size() - 2) {
            this.Q6 = -1;
        }
        Za();
        ef(this.Q6 + 1);
    }

    private void D7() {
        if (nb() && e50.Q1.h().size() != 0 && !o50.G1(e50.Q1.h().get(e50.g2).b) && e50.o5() && System.currentTimeMillis() - this.Ib >= 1000) {
            this.Hb = false;
            this.Gb = e50.Q1.h().get(e50.g2).b.size();
            Sf("下载章节图片", "...");
            new e3(new d3(Looper.getMainLooper())).start();
        }
    }

    private int D8(int curY) {
        int C = this.Q1.getLayout().C(curY);
        int R2 = e50.R2(this.S1, -1, q8() != 0);
        if (!this.Q1.x0(R2)) {
            R2++;
        }
        if (R2 == C && C < this.Q1.getRealLineCount()) {
            R2++;
        }
        return this.Q1.a0(R2);
    }

    public int D9() {
        return this.n9.getWidth() + e50.k0(4.0f) + 1;
    }

    public boolean Da(int id) {
        HashMap<String, b.c> hashMap;
        f50 f50Var = e50.Q1;
        if (f50Var == null || id < 0 || id >= f50Var.h().size()) {
            return false;
        }
        f50.e eVar = e50.Q1.h().get(id);
        int i8 = (Build.VERSION.SDK_INT >= 21 || Runtime.getRuntime().maxMemory() > 100000000) ? 16000 : 8000;
        com.flyersoft.components.b bVar = eVar.t;
        if (bVar != null && (hashMap = bVar.o) != null) {
            if (hashMap.size() > 1000) {
                i8 /= 5;
            } else if (eVar.t.o.size() > 600) {
                i8 /= 4;
            } else if (eVar.t.o.size() > 300) {
                i8 /= 3;
            } else if (eVar.t.o.size() > 100) {
                i8 /= 2;
            }
        }
        return eVar.h > ((long) i8);
    }

    private void Db(String str) {
        ?? bufferedReader;
        try {
            e50.I9 = e50.y2(str);
            DataInputStream dataInputStream = new DataInputStream(new FileInputStream(str));
            if (e50.I9.equals("")) {
                bufferedReader = new BufferedReader(new InputStreamReader(dataInputStream));
            } else {
                bufferedReader = new BufferedReader(new InputStreamReader(dataInputStream, e50.I9));
            }
            if (q8() == 0) {
                String s9 = s9();
                if (s9 == null) {
                    try {
                    } catch (Exception e8) {
                        e50.S0(e8);
                        this.K2 = false;
                        s9 = null;
                    } finally {
                        bufferedReader.close();
                        new BufferedReader(new InputStreamReader(new DataInputStream(new FileInputStream(str)), e50.I9));
                    }
                    if (e50.f2 < e50.q2) {
                        this.K2 = true;
                        e50.i2 = 0;
                        this.Pb = (int) e50.f2;
                        char[] cArr = new char[e50.q2 * 3];
                        s9 = e50.Q(e50.c4(String.valueOf(cArr, 0, bufferedReader.read(cArr))));
                        bufferedReader = str;
                    }
                }
                if (s9 != null) {
                    this.K2 = true;
                    Handler handler = this.H1;
                    handler.sendMessageDelayed(handler.obtainMessage(201, this.Pb, 0, s9), (long) (b9() * 1.5d));
                }
            }
            if (q8() == 0) {
                char[] cArr2 = new char[e50.q2];
                long j8 = 0;
                long j9 = 0;
                while (true) {
                    int read = bufferedReader.read(cArr2);
                    if (read != -1) {
                        e50.f4().add(String.valueOf(cArr2, 0, read));
                        long j10 = read;
                        j8 += j10;
                        j9 += j10;
                        if (j8 > e50.U0 && j9 > 500000) {
                            if (e50.j5(15)) {
                                e50.Q9 = true;
                                this.N2 = getString(R.string.low_memory_limits) + Formatter.formatFileSize(this, j8 * 2);
                                bufferedReader.close();
                                return;
                            }
                            j9 = 0;
                        }
                    } else {
                        bufferedReader.close();
                        return;
                    }
                }
            } else {
                StringBuilder sb = new StringBuilder();
                char[] cArr3 = new char[e50.q2];
                while (true) {
                    int read2 = bufferedReader.read(cArr3);
                    if (read2 != -1) {
                        sb.append(String.valueOf(cArr3, 0, read2));
                    } else {
                        bufferedReader.close();
                        String sb2 = sb.toString();
                        this.P2 = sb2;
                        this.P2 = o50.E(sb2);
                        return;
                    }
                }
            }
        } catch (UnsupportedEncodingException e9) {
            e50.S0(e9);
            SharedPreferences sharedPreferences = getSharedPreferences(e50.s0, 0);
            if (sharedPreferences.contains(e50.V1)) {
                sharedPreferences.edit().remove(e50.V1).commit();
            }
            e50.b3 = e50.f2("");
            getSharedPreferences(e50.q0, 0).edit().putString("textEncode", "").commit();
            Handler handler2 = this.H1;
            handler2.sendMessage(handler2.obtainMessage(K0, 0, 0, "Unsupported Encoding Exception: " + e50.U0(e9)));
        } catch (Exception e10) {
            e50.S0(e10);
            System.exit(0);
        } catch (OutOfMemoryError e11) {
            e50.S0(e11);
            System.exit(0);
        }
    }

    private void Dc(int delay) {
        new d1(Looper.getMainLooper()).sendEmptyMessageDelayed(0, delay);
    }

    private void Df() {
        String[] strArr = new String[5];
        StringBuilder sb = new StringBuilder();
        sb.append(getString(R.string.sousuobenshuneirong));
        sb.append(nb() ? getString(R.string.jinxianyixiazai) : "");
        strArr[0] = sb.toString();
        strArr[1] = getString(R.string.sousuoxiangguanwangye);
        strArr[2] = getString(R.string.sousuobenshushuping);
        strArr[3] = getString(R.string.shujisousuo1);
        strArr[4] = getString(R.string.soujisousuo2);
        Cf(strArr, new int[]{R.drawable.b3_search, R.drawable.b3_search, R.drawable.b3_search, R.drawable.b3_search, R.drawable.b3_search}, 1);
    }

    private void Dg() {
        TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f, 0.0f, this.y2.getHeight());
        translateAnimation.setDuration(this.S3);
        translateAnimation.setAnimationListener(new n1());
        this.y2.startAnimation(translateAnimation);
    }

    public boolean Dh() {
        if (!e50.fa) {
            return false;
        }
        PDFReader pDFReader = this.F2;
        if (pDFReader != null) {
            pDFReader.invalidate();
        } else {
            if (!this.z1 && Aa() && rh()) {
                e50.M5("******txtView.getText().length() > 0 && txtView.getLineCount() == 0******", true);
                q5();
                Kd();
                this.N1 = SystemClock.elapsedRealtime();
                o50.p2(this, getString(R.string.loading) + "...");
                this.H1.sendEmptyMessageDelayed(H0, 1000L);
                return false;
            }
            this.Q1.invalidate();
            this.R1.invalidate();
        }
        this.a2.postInvalidate();
        return true;
    }

    private int E4(MRTextView tv) {
        if (tv == this.R1) {
            return this.S1.getWidth() + this.t2.getPaddingLeft();
        }
        if (F7()) {
            return this.t2.getPaddingLeft();
        }
        return 0;
    }

    public Message E5(int what, MotionEvent event) {
        Message message = new Message();
        message.what = what;
        if (event != null) {
            message.arg1 = (int) o9(event);
            message.arg2 = (int) event.getY();
        }
        return message;
    }

    public void E6(DownloadTask.Result result) {
        hideProgressDlg();
        if (e50.o5()) {
            o50.p2(this, getString(R.string.get_content_failed) + "\n" + result.err);
        }
    }

    public void E7(final String font, final boolean restartTip) {
        StringBuilder sb = new StringBuilder();
        sb.append(font.replace("\"", "").replace("'", "").trim());
        sb.append(e50.C8 ? " 字体下载" : " ttf download");
        new com.flyersoft.seekbooks.b(this, new i0(font, restartTip), null, sb.toString(), 2, false).show();
    }

    private long E8() {
        int c8 = f50.c(-1);
        return c8 > 0 ? c8 : e50.Q1.u();
    }

    public void E9(Message msg) {
        if (!kb() && !Na()) {
            NewCurl3D newCurl3D = this.R2;
            if (newCurl3D == null) {
                return;
            }
            if (!newCurl3D.s0 && !Qh()) {
                int i8 = msg.what;
                if (i8 == 0) {
                    this.R2.f0();
                    Je(true);
                    this.R2.U(this.y4 == 1);
                    this.j5 = SystemClock.elapsedRealtime();
                    return;
                }
                if (i8 == 1) {
                    if (this.Sa) {
                        this.Ta = true;
                        return;
                    }
                    this.a2.setAnimationState(false);
                    this.a2.invalidate();
                    this.R2.M();
                    boolean z7 = this.G4 == 0 || this.y4 != -1;
                    if (z7) {
                        Je(false);
                        Me(true);
                    }
                    o50.f2(this.U2);
                    this.j5 = 0L;
                    if (!z7 || C5(0)) {
                        return;
                    }
                    Je(false);
                    return;
                }
                if (i8 == 2) {
                    this.R4 = false;
                    return;
                }
                if (i8 != 3) {
                    if (i8 != 4 || this.S4 || this.V4) {
                        return;
                    }
                    if (!this.U4) {
                        this.U4 = true;
                        if (Math.abs(this.x6) > 600.0f) {
                            this.y4 = this.x6 <= 0.0f ? 1 : -1;
                        } else if (M7(msg.arg1, this.u5, true)) {
                            this.y4 = ((float) msg.arg1) <= this.u5 ? 1 : -1;
                        } else {
                            this.y4 = w8(this.q9);
                        }
                        int i9 = this.y4;
                        if (i9 == 0 || Y9(i9, true) || aa()) {
                            return;
                        }
                        if (!f8(true)) {
                            this.P4 = E5(0, null);
                        } else {
                            E9(E5(0, null));
                        }
                    } else if (this.P4 != null) {
                        Handler handler = this.H1;
                        handler.sendMessageDelayed(handler.obtainMessage(t0, i8, 0), 10L);
                        return;
                    } else if (this.W1.getVisibility() == 0) {
                        MotionEvent obtain = MotionEvent.obtain(this.q9);
                        obtain.setLocation(o9(obtain), obtain.getY());
                        float f8 = this.x6;
                        if ((f8 > 200.0f && this.y4 == 1) || (f8 < -200.0f && this.y4 == -1)) {
                            this.R2.a0(obtain, true);
                        } else {
                            this.R2.a0(obtain, false);
                        }
                    } else {
                        this.j5 = 0L;
                    }
                    this.U4 = false;
                    return;
                }
                if (this.S4 || this.V4) {
                    return;
                }
                if (this.T4 || M7(msg.arg1, this.u5, true)) {
                    if (!this.U4) {
                        int i10 = ((float) msg.arg1) <= this.u5 ? 1 : -1;
                        this.y4 = i10;
                        if (Y9(i10, true)) {
                            return;
                        }
                        this.U4 = true;
                        if (!this.T4 && Wa(msg.arg1, this.u5)) {
                            this.S4 = true;
                            bc(this.y4);
                            return;
                        } else if (!f8(true)) {
                            this.P4 = E5(3, this.q9);
                            return;
                        } else {
                            E9(E5(3, this.q9));
                            return;
                        }
                    }
                    if (this.X2 || this.P4 != null) {
                        return;
                    }
                    MotionEvent obtain2 = MotionEvent.obtain(this.q9);
                    if (!this.T4) {
                        this.T4 = true;
                        obtain2.setLocation(this.u5, obtain2.getY());
                        obtain2.setAction(0);
                        this.R2.f0();
                        Je(true);
                        this.R2.a0(obtain2, false);
                        this.j5 = SystemClock.elapsedRealtime();
                        return;
                    }
                    obtain2.setLocation(o9(obtain2), obtain2.getY());
                    this.R2.a0(obtain2, false);
                    return;
                }
                return;
            }
            this.S4 = true;
            return;
        }
        F9(msg);
    }

    private boolean Ea(String lastFile) {
        if (lastFile.indexOf("?") != -1) {
            return false;
        }
        File file = new File(lastFile);
        if (file.isFile()) {
            long length = file.length();
            if (e50.f2 > length) {
                e50.f2 = length;
            }
            if (length > 2000000) {
                return true;
            }
        }
        return false;
    }

    private void Eb(final WebView readWeb, final S.BookSite site, final String url) {
        if (site != null && site.hasAd && !S.ignoreAdTip(site.siteTag)) {
            ScrollView scrollView = (ScrollView) LayoutInflater.from(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(e50.W0("该书源网页可能含有不当广告, 广告并非来自搜书大师, 搜书大师亦无法预知广告内容, 请谨慎点击.\n\n请确认是否仍要打开该网页?"));
            checkBox.setChecked(false);
            checkBox.setText(e50.W0("不再对这个网站提出警示"));
            m.c cVar = this.Lb;
            if (cVar != null) {
                cVar.a();
            }
            m.c cVar2 = new m.c(this);
            this.Lb = cVar2;
            cVar2.z("广告提示(" + site.name() + ")").B(scrollView).w(e50.W0("用浏览器打开"), new n3(checkBox, site, readWeb, url)).o(R.string.cancel, new m3(checkBox, site)).d(false).C();
            return;
        }
        readWeb.loadUrl(url);
    }

    private f.a Ec() {
        return new i1();
    }

    private void Ed() {
    }

    private void Ef() {
        String[] strArr = new String[4];
        strArr[0] = e50.W0("设置语音引擎");
        strArr[1] = e50.W0(e50.t6 ? "取消自动停止(" + e50.r6 + "分钟)" : "设置自动停止");
        strArr[2] = e50.W0(e50.u6 ? "取消朗读间隔(" + e50.s6 + "毫秒)" : "设置朗读间隔");
        strArr[3] = e50.W0("设置字符过滤");
        int[] iArr = {R.drawable.b3_speak, R.drawable.b3_speak, R.drawable.b3_speak, R.drawable.b3_speak};
        if (Build.VERSION.SDK_INT >= 26) {
            String[] strArr2 = new String[5];
            for (int i8 = 0; i8 < 4; i8++) {
                strArr2[i8] = strArr[i8];
            }
            StringBuilder sb = new StringBuilder();
            sb.append("设置耳机蓝牙控制(");
            sb.append(e50.H4 == 19 ? "已启用" : "已禁用");
            sb.append(")");
            strArr2[4] = e50.W0(sb.toString());
            iArr = new int[]{R.drawable.b3_speak, R.drawable.b3_speak, R.drawable.b3_speak, R.drawable.b3_speak, R.drawable.b3_speak};
            strArr = strArr2;
        }
        Cf(strArr, iArr, 100);
    }

    public void Eg(int y7) {
        if (y7 == -100) {
            this.F6 = -1;
        }
        C6(2, Integer.valueOf(y7));
    }

    private int F4(MRTextView tv, int end) {
        int indexOf;
        if (Ya() || q8() != 100) {
            return end;
        }
        int T8 = T8() - 1;
        if (e50.d6 && !e50.Z4 && (indexOf = tv.getText2().indexOf(e50.R1())) > 0) {
            T8 = tv.getLayout().B(indexOf) - 1;
        }
        int B = tv.getLayout().B(end);
        return (B <= 0 || B <= T8) ? end : tv.getLayout().M(T8);
    }

    private g50.f F5() {
        MRTextView n9 = n9();
        return new g50.f(0, e50.D1(), e50.V1, e50.g2, e50.h2, q8() == 0 ? e50.d4(n9.P0) : n9.P0, n9.Q0 - n9.P0, e50.g3, System.currentTimeMillis(), "", "", n9.R0, false, false, "");
    }

    public void F6(DownloadTask.Result result, boolean forUpdateCur, boolean showTip) {
        if (!this.c8 && !isFinishing() && nb()) {
            S.WebBook webBook = this.wb;
            S.BookSite bookSite = webBook.site;
            bookSite.last_url = result.final_url;
            if (bookSite instanceof S.LinkSite) {
                bookSite.firstExecute = false;
            }
            if (o50.F1(webBook.description) && !o50.F1(e50.Q1.k)) {
                this.wb.description = e50.Q1.k;
            }
            ArrayList<S.WebChapter> chapterList = S.getChapterList(result.html, this.wb.site);
            if (chapterList.size() == 1 && chapterList.get(0).name.equals(S.CHAPTER_URL_TAG) && !chapterList.get(0).url.equals(result.url)) {
                c9(this.xb, chapterList.get(0).url, false, forUpdateCur, showTip, this.wb);
                return;
            }
            if (chapterList.size() == 0 && this.wb.chapters.size() == 0 && this.wb.site.javascriptTOC && DownloadTaskBrowser.reloadCacheWB(this.ub, result.url, this.yb, 200)) {
                return;
            }
            if (!S.sameChapterList(this.wb.chapters, chapterList)) {
                this.wb.chapters.addAll(chapterList);
            }
            S.WebBook webBook2 = this.wb;
            ArrayList<S.WebChapter> arrayList = webBook2.chapters;
            if (!o50.F1(webBook2.site.nextChapterTag)) {
                this.wb.loadedUrls.add(result.url);
                String str = result.html;
                S.WebBook webBook3 = this.wb;
                String nextChapterUrl = S.getNextChapterUrl(str, webBook3.site, webBook3.loadedUrls);
                if (!o50.F1(nextChapterUrl)) {
                    e50.N5("*hasNextChapterUrl: " + nextChapterUrl, Integer.valueOf(arrayList.size()));
                    c9(this.xb, nextChapterUrl, false, forUpdateCur, showTip, this.wb);
                    return;
                }
                S.deleteDuplicatedChapters(arrayList);
            }
            Qb(forUpdateCur, showTip, arrayList);
            return;
        }
        hideProgressDlg();
    }

    private int F8() {
        float f8;
        if (e50.o8) {
            f8 = e50.q8 ? 60 : 50;
        } else {
            f8 = 40.0f;
        }
        return e50.k0(f8);
    }

    private void F9(Message msg) {
        if (this.j5 > 0) {
            e50.N5(" ================== handleValueMessage()flippingAnimationTime > 0 ================== ");
            this.S4 = true;
            return;
        }
        int i8 = msg.what;
        if (i8 == 0) {
            Mg(msg.arg1 - ((int) this.u5));
            return;
        }
        if (i8 == 2) {
            this.R4 = false;
            return;
        }
        if (i8 != 3) {
            if (i8 != 4 || this.S4 || this.V4) {
                return;
            }
            if (!this.U4) {
                this.U4 = true;
                if (Math.abs(this.x6) > 600.0f) {
                    this.y4 = this.x6 <= 0.0f ? 1 : -1;
                } else if (M7(msg.arg1, this.u5, true)) {
                    this.y4 = ((float) msg.arg1) <= this.u5 ? 1 : -1;
                } else {
                    this.y4 = w8(this.q9);
                }
                int i9 = this.y4;
                if (i9 == 0 || Y9(i9, true) || aa()) {
                    return;
                }
                if (!u9(true)) {
                    this.P4 = O5();
                } else {
                    F9(O5());
                }
            } else if (this.P4 != null) {
                Handler handler = this.H1;
                handler.sendMessageDelayed(handler.obtainMessage(t0, i8, 0), 10L);
                return;
            } else if (this.Y4) {
                MotionEvent obtain = MotionEvent.obtain(this.q9);
                obtain.setLocation(o9(obtain), obtain.getY());
                float f8 = this.x6;
                if ((f8 > 200.0f && this.y4 == 1) || (f8 < -200.0f && this.y4 == -1)) {
                    this.X4 = true;
                }
                F9(E5(0, this.q9));
            } else {
                this.j5 = 0L;
            }
            this.U4 = false;
            return;
        }
        if (this.S4 || this.V4) {
            return;
        }
        if (this.T4 || M7(msg.arg1, this.u5, true)) {
            if (!this.U4) {
                int i10 = ((float) msg.arg1) <= this.u5 ? 1 : -1;
                this.y4 = i10;
                if (Y9(i10, true)) {
                    return;
                }
                this.U4 = true;
                this.a5 = true;
                if (!u9(true)) {
                    this.P4 = E5(3, this.q9);
                    return;
                } else {
                    rf((int) (this.q9.getX() - this.u5), true, false);
                    F9(E5(3, this.q9));
                    return;
                }
            }
            if (this.X2 || this.P4 != null) {
                return;
            }
            this.T4 = true;
            rf((int) (this.q9.getX() - this.u5), true, false);
        }
    }

    private void Fb(String word, boolean longTap) {
        if (o50.F1(word)) {
            return;
        }
        Rb(e50.h2(longTap ? e50.n6 : e50.m6), word);
    }

    private void Fd() {
        if (this.l8) {
            return;
        }
        this.l8 = true;
        if (e50.H4 == 15 && e50.I4 == 15 && e50.J4 == 15 && e50.K4 == 15) {
            return;
        }
        try {
            ((AudioManager) getSystemService("audio")).registerMediaButtonEventReceiver(new ComponentName(getPackageName(), OpenFile_Receiver.class.getName()));
            if (Build.VERSION.SDK_INT >= 14) {
                OpenFile_Receiver openFile_Receiver = new OpenFile_Receiver();
                this.m8 = openFile_Receiver;
                registerReceiver(openFile_Receiver, new IntentFilter("android.intent.action.HEADSET_PLUG"));
            }
        } catch (Throwable th) {
            e50.S0(th);
        }
    }

    private void Ff(q50.b item) {
        if (this.zb) {
            if (this.G2 != null) {
                Spanned fromHtml = Html.fromHtml(e50.Q1.h().get(item.e).c + "<br><br><small><font color=\"#888888\">" + getString(R.string.paiduizhong) + this.rb.size() + "</font></small>");
                this.Bb = fromHtml;
                this.G2.setMessage(fromHtml);
                return;
            }
            if (!kg() || this.K8 == null || F7()) {
                return;
            }
            this.K8.setText(getString(R.string.zhengzaixiazai) + "(" + this.rb.size() + "): " + e50.Q1.h().get(item.e).c);
        }
    }

    public void Fh(boolean valueOnly) {
        if (!valueOnly) {
            this.h4.setProgress(e50.X3 + 3);
            this.j4.setProgress(e50.Z3 + 3);
            this.i4.setProgress(e50.Y3);
            this.k4.setProgress(e50.F7(e50.c4));
            this.l4.setProgress(e50.F7(e50.d4));
            this.m4.setProgress(e50.F7(e50.a4));
            this.n4.setProgress(e50.F7(e50.b4));
        }
        ((TextView) this.C2.findViewById(R.id.linev)).setText("行间距(" + e50.X3 + ")");
        ((TextView) this.C2.findViewById(R.id.letterv)).setText("字间距(" + e50.Z3 + ")");
        ((TextView) this.C2.findViewById(R.id.parav)).setText("段间距(" + e50.Y3 + ")");
        ((TextView) this.C2.findViewById(R.id.leftv)).setText("左边空白(" + e50.F7((float) e50.c4) + ")");
        ((TextView) this.C2.findViewById(R.id.rightv)).setText("右边空白(" + e50.F7((float) e50.d4) + ")");
        ((TextView) this.C2.findViewById(R.id.topv)).setText("上边空白(" + e50.F7((float) e50.a4) + ")");
        ((TextView) this.C2.findViewById(R.id.bottomv)).setText("下边空白(" + e50.F7((float) e50.b4) + ")");
    }

    public j.d G5() {
        c5 c5Var = new c5();
        this.m5 = c5Var;
        return c5Var;
    }

    public void G6() {
        if (AccountData.isLoaded().booleanValue()) {
            AccountData.readTaskShowToast = e50.Y4 < 3;
            if (this.z1) {
                return;
            }
            if (e50.W4 != o50.X0()) {
                e50.W4 = o50.X0();
                e50.X4 = 0L;
                this.Vb = System.currentTimeMillis();
                m1 = false;
                l1 = false;
                k1 = false;
            }
            if (this.Vb > 0) {
                long currentTimeMillis = e50.X4 + (System.currentTimeMillis() - this.Vb);
                e50.X4 = currentTimeMillis;
                if (!k1 && currentTimeMillis >= o50.N1(20L) && e50.X4 < o50.N1(22L)) {
                    k1 = true;
                    com.flyersoft.discuss.z.taskReade("20");
                    e50.Y4++;
                }
                if (!l1 && e50.X4 >= o50.N1(40L) && e50.X4 < o50.N1(42L)) {
                    l1 = true;
                    com.flyersoft.discuss.z.taskReade("40");
                    e50.Y4++;
                }
                if (!m1 && e50.X4 >= o50.N1(60L) && e50.X4 < o50.N1(62L)) {
                    m1 = true;
                    com.flyersoft.discuss.z.taskReade("60");
                    e50.Y4++;
                }
            }
            this.Vb = System.currentTimeMillis();
        }
    }

    private void G7() {
        if (Za()) {
            int i8 = e50.r3;
            if (i8 == 0) {
                e50.r3 = e50.g5() ? 2 : 1;
            } else if (i8 == 1) {
                e50.r3 = 2;
            } else {
                e50.r3 = 1;
            }
        } else if (this.C9 != null || Ya()) {
            return;
        } else {
            e50.A2 = !e50.A2;
        }
        pe(true);
        e50.e(this);
        ce();
    }

    private String G8(String filename) {
        q.a j02;
        f50 f50Var = e50.Q1;
        return (f50Var == null || !(f50Var instanceof j50) || (j02 = ((j50) f50Var).j0(filename)) == null) ? filename : j02.a;
    }

    private boolean G9(boolean toChapterBegin, String progressTitle) {
        int i8;
        int i9;
        if (this.Fa || this.Ha == null || (i8 = this.Da) != e50.g2 || (i9 = this.Ea) != e50.h2) {
            return false;
        }
        e50.g2 = i8;
        e50.h2 = i9;
        e50.G9 = this.Ia;
        this.n5 = this.Ja;
        if (!e50.O9 && !e50.P9 && e50.Q4() && toChapterBegin && this.G4 == 0 && e50.g2 == this.Na && e50.h2 == this.Oa && R5()) {
            this.W2 = this.Ma;
            this.Sa = true;
            new k1(Looper.getMainLooper()).sendEmptyMessageDelayed(0, 500L);
        } else {
            x9(toChapterBegin);
        }
        return true;
    }

    private boolean Ga(int keyCode) {
        boolean z7 = keyCode == 20 || keyCode == 19 || keyCode == 21 || keyCode == 22 || keyCode == 23;
        if (z7) {
            this.x4 = true;
        }
        return z7;
    }

    private void Gb() {
        if (e50.T6 && B7()) {
            if (Za()) {
                if (o50.F1(this.F2.p0)) {
                    return;
                }
                Fb(this.F2.p0.replace(e50.H9, ' ').trim(), false);
                this.c9.b();
                return;
            }
            if (o50.F1(n9().R0)) {
                return;
            }
            Fb(n9().R0.replace(e50.H9, ' ').trim(), false);
        }
    }

    public void Gc(String filename) {
        if (!this.pa) {
            e50.e(this);
            new m.c(this).z("PDF").m(getString(R.string.pdf_init_error, new Object[]{Global.a})).v(R.string.ok, new w0()).o(R.string.cancel, new v0()).t(new u0()).C();
            return;
        }
        e50.e(this);
        Cc();
        this.t2.setVisibility(8);
        Rd();
        Hc(filename);
    }

    private void Ge(boolean visible) {
        ImageView imageView = this.g2;
        if (imageView != null) {
            imageView.setVisibility((e50.y3 && Za()) ? 0 : 8);
        }
        if (this.d2 == null) {
            return;
        }
        boolean z7 = true;
        if ((!Ya() || !e50.x3) && ((this.C9 == null && !e50.V6 && e50.A2() != 6 && e50.A2() != 1) || !visible || !Oa())) {
            z7 = false;
        }
        if (!nb() && z7) {
            ImageView imageView2 = this.d2;
            boolean Ya = Ya();
            int i8 = R.drawable.mrbookview2;
            if (Ya) {
                if (!this.F2.c) {
                    i8 = R.drawable.text_reflow;
                }
            } else if (!e50.g7) {
                i8 = R.drawable.chromebookview2;
            }
            imageView2.setImageResource(i8);
            this.d2.setVisibility(0);
            return;
        }
        this.d2.setVisibility(8);
    }

    public void Gf(String err) {
        String str;
        this.zb = false;
        if (!e50.o5()) {
            o50.n2(this, getString(R.string.huoquzhangjieshibai));
            return;
        }
        StringBuilder sb = new StringBuilder();
        sb.append(e50.W0("<br>请五秒后重试, 或使用原版浏览(登录), 或切换到其它书源<br>"));
        if (o50.F1(err)) {
            str = "";
        } else {
            str = "<br><small><font color=\"#888888\">" + err + "</font></small><br>";
        }
        sb.append(str);
        new m.c(this).z(getString(R.string.weinenghuoquzhangjie)).m(Html.fromHtml(sb.toString())).w(getString(R.string.chongshi), new e2()).p(e50.W0("原版浏览(登录)"), new d2()).r(getString(R.string.qiehuanshuyuan), new c2()).C();
    }

    public Handler Gg() {
        if (this.b7 == null) {
            this.b7 = new a6(Looper.getMainLooper());
        }
        return this.b7;
    }

    public void Gh() {
        if (this.D2 == null) {
            return;
        }
        e50.m d32 = e50.d3();
        ((RoundButton) this.D2.findViewById(R.id.nfontColor)).setSolidColor(d32.c);
        ((RoundImage) this.D2.findViewById(R.id.nbackgroundImage)).setRoundImageDrawable(e50.I2(e50.w1(false), d32.e, 1, 1));
        ((RoundButton) this.D2.findViewById(R.id.nbackgroundColor)).setSolidColor(d32.d);
        ImageView imageView = (ImageView) this.D2.findViewById(R.id.nbackgroundColorSelect);
        boolean z7 = d32.f;
        int i8 = R.drawable.indicator2;
        imageView.setImageResource(!z7 ? R.drawable.indicator2 : R.drawable.indicator3);
        ((ImageView) this.D2.findViewById(R.id.nbackgroundImageSelect)).setImageResource(d32.f ? R.drawable.indicator2 : R.drawable.indicator3);
        ImageView imageView2 = (ImageView) this.D2.findViewById(R.id.nbrightIndicator);
        if (!e50.J6) {
            i8 = R.drawable.indicator3;
        }
        imageView2.setImageResource(i8);
        ((TextView) this.D2.findViewById(R.id.nbrightTv)).setText(e50.I6 + "%");
        ((RoundButton) this.D2.findViewById(R.id.nautoCancelNight)).setChecked(e50.D6);
    }

    public void H5() {
        if (this.Sa) {
            this.H1.sendEmptyMessageDelayed(M0, 100L);
            return;
        }
        if (this.Ja == null) {
            return;
        }
        if (this.Na == this.Da && this.Oa == this.Ea && !o50.I1(this.Ma)) {
            e50.N5("=======already has txtCacheBm: " + this.Da);
            return;
        }
        try {
            if (U4(this.Da)) {
                return;
            }
            this.Pa = this.Da;
            this.Qa = this.Ea;
            this.La.setPadding(this.S1.getPaddingLeft(), this.S1.getPaddingTop(), this.S1.getPaddingRight(), this.S1.getPaddingBottom());
            MRTextView mRTextView = this.Ka;
            mRTextView.d = true;
            mRTextView.e = N8() * 2;
            e50.T6(this.Ka, false);
            e50.Z6(this.Ka);
            e50.I6(this.Ka);
            e50.G6(this.Ka);
            this.Ka.l(0, this.Q1.getTextSize());
            this.Ka.setText(com.flyersoft.staticlayout.j.c(this.Ja, this.m5, this.Da));
            MRTextView mRTextView2 = this.Ka;
            mRTextView2.k1 = this.Da;
            mRTextView2.l1 = this.Ea;
            o50.f2(this.Ma);
            this.H1.sendEmptyMessageDelayed(N0, 10L);
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    private int H7(int edge) {
        return (edge == 0 || edge == 1) ? this.U1.getHeight() : this.U1.getWidth();
    }

    private long H8() {
        if (this.F2 != null) {
            return r0.b.viewGetPos().b + this.F2.b.viewGetPos().c + e50.f2;
        }
        if (q8() == 0) {
            pe(false);
            return e50.f2;
        }
        return this.S1.getScrollY();
    }

    private boolean H9(String progressTitle) {
        int i8;
        int i9;
        if (this.Xa == null || this.Ua != e50.g2 || ((i8 = this.Va) != (i9 = e50.h2) && i9 != -1)) {
            return false;
        }
        if (i9 == -1) {
            e50.h2 = i8;
        }
        if (e50.h2 == -1) {
            e50.h2 = 0;
        }
        z9();
        return true;
    }

    public boolean Ha() {
        return e50.N5 || e50.e4 > 0 || F7();
    }

    private int Hb() {
        return this.F7.getMax() + 10;
    }

    private void Hc(String filename) {
        if (this.qa != null) {
            ee();
            return;
        }
        String i8 = com.flyersoft.components.a.i(filename);
        this.qa = new Document();
        SharedPreferences sharedPreferences = getSharedPreferences("pdf", 0);
        String str = "";
        if (sharedPreferences.contains(i8 + "s")) {
            str = e50.b2(sharedPreferences.getString(i8 + "u", ""));
            if (!sharedPreferences.getBoolean(i8 + "s", false)) {
                sharedPreferences.edit().remove(i8 + "s").commit();
            }
        }
        int E = this.qa.E(i8, str);
        String str2 = null;
        if (E == -10) {
            str2 = "Access denied or invalid file path.";
        } else if (E == -3) {
            str2 = "Damaged or invalid format.";
        } else if (E == -2) {
            str2 = "Unknown encryption.";
        } else if (E == -1) {
            lc(i8);
            return;
        } else if (E != 0) {
            str2 = "Unknown error";
        }
        e50.qa = false;
        if (str2 != null) {
            O7(str2, true);
            return;
        }
        qc();
        hideProgressDlg();
        Yc(false);
        this.F2.H(this.qa, i8);
        this.F2.b.viewEnableTextSelection(false);
        PDFReader pDFReader = this.F2;
        pDFReader.setViewListener(pDFReader);
        this.F2.setAnnotListener(Ec());
        Global.h = this.F2.b(e50.g3, 80, -40);
        this.ra = this.qa.h("Title");
        e50.h2 = 0;
        e50.g2 = 0;
        boolean ha = ha(false);
        long j8 = e50.f2;
        if (j8 == 0) {
            tc();
            if (!ha && !this.G1 && this.wa.size() > 3) {
                t7(0);
            }
        } else {
            vc((int) j8, false);
        }
        Dc(Global.m == 0 ? 200 : 0);
        Bb();
        k5();
    }

    private void Hd() {
        if (!o50.I1(this.c9.e)) {
            this.c9.b();
        }
        ContentLay contentLay = this.a2;
        if (contentLay.f) {
            contentLay.f = false;
            contentLay.d();
            Dh();
        }
    }

    private void He(boolean disabled) {
        ScrollView2 scrollView2 = this.S1;
        if (scrollView2.f != disabled) {
            scrollView2.f = disabled;
        }
    }

    public void Hf() {
        if (this.Rb < 0) {
            this.Rb = 0;
        }
        TextView textView = this.R3;
        if (textView != null) {
            StringBuilder sb = new StringBuilder();
            sb.append("");
            sb.append(this.Rb);
            sb.append(this.Rb < 10 ? " " : "");
            textView.setText(sb.toString());
        }
    }

    public void Hg() {
        try {
            this.S1.getScrollY();
            C6(0, 0);
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    public boolean Hh(int id, String text, boolean checkEmpty) {
        int i8;
        q50.b bVar;
        DownloadTaskBrowser.CacheWebView cacheWebView;
        if (!Va(id, text, checkEmpty)) {
            return false;
        }
        if (!e50.Q1.p.ok()) {
            if (o50.C2(q50.H(o50.n0(e50.V1) + "/.sources")).size() < 2) {
                new m.c(this).m(e50.W0("本书所用书源\"" + e50.Q1.p.name() + "\"已失效, 请重新搜索.")).v(R.string.ok, new w1()).o(R.string.cancel, null).d(false).C();
            } else {
                o50.q2(this, e50.W0("本书所用书源\"" + e50.Q1.p.name() + "\"已失效, 请切换书源或重新搜索."), 1);
                v7();
            }
            return false;
        }
        String str = e50.Q1.h().get(id).s;
        if (o50.F1(str)) {
            return false;
        }
        if (e50.Q1.p.webReadLevel > 1) {
            ph("");
            if (id == e50.g2) {
                new m.c(this).y(R.string.tip).m("\n该书源不提供优化阅读服务, 是否打开网页版?").w("打开网页版", new x1()).o(R.string.cancel, null).d(false).C();
            }
            return false;
        }
        q50.b bVar2 = this.sb;
        if (bVar2 != null && bVar2.e == id) {
            if (id == e50.g2 && Ra() && (cacheWebView = this.ub) != null) {
                cacheWebView.reload();
            }
            return true;
        }
        int S4 = S4(str);
        if (id == e50.g2) {
            if (S4 != -1) {
                this.rb.remove(S4);
            }
            ArrayList<q50.b> arrayList = this.rb;
            f50 f50Var = e50.Q1;
            arrayList.add(0, new q50.b(str, f50Var.p.userAgent, f50Var.h().get(id).c, id, false, e50.Q1.h().get(id).a));
            if (Ra() && (bVar = this.sb) != null) {
                this.rb.add(1, bVar);
                this.sb = null;
            }
            R4();
        } else if (S4 == -1) {
            ArrayList<q50.b> arrayList2 = this.rb;
            f50 f50Var2 = e50.Q1;
            arrayList2.add(0, new q50.b(str, f50Var2.p.userAgent, f50Var2.h().get(id).c, id, false, e50.Q1.h().get(id).a));
            int R1 = o50.R1(200) + 200;
            if (Ra() && (i8 = e50.Q1.p.contentDelay) > 200) {
                R1 = i8 + o50.R1(i8);
            }
            this.H1.sendEmptyMessageDelayed(Q0, R1);
        } else if (S4 > 0) {
            Collections.swap(this.rb, 0, S4);
        }
        return true;
    }

    private void I4() {
        try {
            if (q8() != 0) {
                return;
            }
            int scrollY = this.S1.getScrollY();
            int realHeight = this.Q1.getRealHeight();
            int lineHeight = this.Q1.getLineHeight();
            int h32 = e50.h3();
            if (e50.P9 && e50.A2) {
                MRTextView mRTextView = this.Q1;
                realHeight = mRTextView.Z(mRTextView.getLineCount()) + this.Q1.getLineHeight();
            }
            char c8 = 65535;
            if (scrollY < lineHeight / 2 && e50.i2 > 1) {
                c8 = 0;
            } else if (scrollY + h32 > ((realHeight - lineHeight) - (lineHeight / 2)) - 1 && e50.i2 < e50.f4().size() - 2) {
                c8 = 1;
            }
            if (c8 == 0) {
                int i8 = e50.i2;
                long m32 = e50.m3(i8 == 0 ? 0 : i8 - 1) + 5;
                e50.f2 = m32;
                tg(m32, null);
            }
            if (c8 != 1 || this.Q1.getLayout() == null) {
                return;
            }
            e50.N5("----load next txt block-----");
            int i9 = e50.i2;
            int i10 = i9 == 0 ? 1 : 0;
            int i11 = i9 + i10;
            StringBuilder sb = new StringBuilder();
            int i12 = i11 + 0;
            sb.append(e50.g4(i12));
            int i13 = i11 + 1;
            sb.append(e50.g4(i13));
            sb.append(e50.g4(i11 + 2));
            ph(e50.Q(sb.toString()));
            int B = this.Q1.getLayout().B((e50.g4(i12).length() + e50.g4(i13).length()) - 1);
            if ((B - (h32 / lineHeight)) - 1 > 0) {
                B = (B - (h32 / lineHeight)) - 1;
            }
            nh(this.Q1.a0(B) + 2);
            e50.i2 = i13 + i10;
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    public void I5() {
        if (this.Pa == this.Da && this.Qa == this.Ea) {
            try {
                this.Ra = false;
                Bitmap bitmap = this.W2;
                Bitmap bitmap2 = this.Ma;
                if (bitmap != bitmap2) {
                    o50.f2(bitmap2);
                }
                this.Ma = Bitmap.createBitmap(this.U1.getWidth(), this.U1.getHeight(), b() ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565);
                Canvas canvas = new Canvas(this.Ma);
                e50.C6(canvas);
                this.La.draw(canvas);
                this.Na = this.Da;
                this.Oa = this.Ea;
                this.Ka.setText("");
                return;
            } catch (Throwable th) {
                e50.S0(th);
                Bitmap bitmap3 = this.W2;
                Bitmap bitmap4 = this.Ma;
                if (bitmap3 != bitmap4) {
                    o50.f2(bitmap4);
                    return;
                }
                return;
            }
        }
        Bitmap bitmap5 = this.W2;
        Bitmap bitmap6 = this.Ma;
        if (bitmap5 != bitmap6) {
            o50.f2(bitmap6);
        }
    }

    public void I6() {
        this.Y4 = false;
        this.a5 = false;
        this.j5 = 0L;
        this.S1.d(0.0f, 0.0f, false);
        ScrollView2.c(0, 0, 0);
        He(false);
        if (this.X4) {
            this.X4 = false;
            sh();
        } else {
            this.La.setVisibility(4);
            this.a2.postInvalidate();
            this.H1.removeMessages(a1);
        }
    }

    private float I7(int edge, MotionEvent event) {
        float y7;
        float f8;
        if (edge == 0 || edge == 1) {
            y7 = event.getY();
            f8 = this.t5;
        } else {
            y7 = o9(event);
            f8 = this.u5;
        }
        return y7 - f8;
    }

    private int I8() {
        int i8;
        int left = (this.j9.getLeft() > this.k9.getLeft() ? this.k9 : this.j9).getLeft();
        int width = (this.j9.getWidth() / 2) + left + (((this.j9.getLeft() > this.k9.getLeft() ? this.j9 : this.k9).getLeft() - left) / 2);
        int width2 = this.c9.getWidth();
        int v32 = e50.v3();
        int i9 = width2 / 2;
        int i10 = width + i9;
        if (i10 < v32 && (i8 = width - i9) > 5) {
            return i8;
        }
        if (i10 < v32) {
            return 5;
        }
        return width - i9 > 5 ? (v32 - width2) - 5 : v32;
    }

    public void I9() {
        MRTextView n9 = n9();
        int i8 = n9.P0;
        int i9 = n9.Q0;
        J9();
        n9.P0 = i8;
        n9.Q0 = i9;
    }

    public boolean Ia() {
        int i8 = e50.e4;
        return i8 == 3 || i8 == 6;
    }

    public void Ib() {
        try {
            this.lb.reset();
            this.lb.setDataSource(this.nb);
            this.lb.prepare();
            this.lb.start();
            this.kb.setMax(this.lb.getDuration());
            this.kb.setProgress(0);
            this.mb = 1;
            Time time = new Time();
            time.set(this.lb.getDuration());
            this.jb.setText(time.format("%M:%S"));
            this.gb.setImageResource(R.drawable.tts_pause);
            L8().sendEmptyMessageDelayed(0, 1000L);
            ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.fb.getLayoutParams();
            int v32 = e50.v3() / (e50.g5() ? 4 : 6);
            marginLayoutParams.rightMargin = v32;
            marginLayoutParams.leftMargin = v32;
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    private float Ic(int pageno) {
        if (pageno == -1) {
            pageno = rc();
        }
        return this.qa.l(pageno) * this.F2.getParaRatio();
    }

    private void Id() {
        VelocityTracker velocityTracker = this.W5;
        if (velocityTracker != null) {
            velocityTracker.clear();
            this.W5.recycle();
            this.W5 = null;
        }
        this.V5 = 0.0f;
    }

    public void Ie() {
        String str;
        Float f8;
        MRTextView.v0 = 0;
        if (e50.Q1 != null) {
            if (e50.g2 > e50.Q1.h().size() - 1) {
                return;
            }
            f50.e eVar = e50.Q1.h().get(e50.g2);
            com.flyersoft.components.b bVar = eVar.t;
            b.c e8 = com.flyersoft.staticlayout.j.e("body", eVar.w, eVar.v, eVar, null, null);
            if (eVar.x != null) {
                b.c cVar = new b.c(e8);
                cVar.l(eVar.x);
                e8 = cVar;
            }
            Drawable drawable = null;
            if (e8 != null) {
                int i8 = e8.e;
                if (i8 > 1) {
                    MRTextView.v0 = i8;
                }
                str = e8.s;
                if (str != null) {
                    String str2 = e50.S8;
                    if (str2 == null || !str2.equals(str)) {
                        e50.S8 = str;
                        q5();
                        e50.Y6();
                        com.flyersoft.staticlayout.j.j();
                    }
                } else {
                    str = null;
                }
                float f9 = e8.q;
                f8 = (f9 <= 0.0f || f9 == 1.0f) ? null : Float.valueOf(f9);
            } else {
                str = null;
                f8 = null;
            }
            if (f8 != null) {
                if (f8 != this.K9) {
                    q5();
                    this.K9 = f8;
                    qh(e50.d3);
                }
            } else if (this.K9 != null) {
                this.K9 = null;
                q5();
                qh(e50.d3);
            }
            if (str == null && e50.S8 != null) {
                e50.S8 = null;
                q5();
                e50.Y6();
                com.flyersoft.staticlayout.j.j();
            }
            if (bVar != null && e8 != null && e8.J != null && V4(eVar)) {
                String str3 = e8.J;
                if (str3 == this.J9) {
                    return;
                }
                int indexOf = str3.indexOf("(");
                int indexOf2 = str3.indexOf(")");
                if (indexOf == -1 || indexOf2 <= indexOf) {
                    return;
                }
                Drawable j8 = e50.Q1.j(str3.substring(indexOf + 1, indexOf2), 0);
                if (j8 != null) {
                    String str4 = e8.b;
                    boolean z7 = str4 == null || !str4.contains("no-repeat");
                    boolean z8 = str4 != null && str4.contains("contain");
                    boolean z9 = str4 != null && str4.contains("cover");
                    int intrinsicWidth = j8.getIntrinsicWidth();
                    int intrinsicHeight = j8.getIntrinsicHeight();
                    if (intrinsicWidth > 0 && intrinsicHeight > 0 && z8) {
                        int width = this.S1.getWidth();
                        int height = this.S1.getHeight();
                        j8 = intrinsicHeight / height > intrinsicWidth / width ? o50.K2(e50.S1().getResources(), j8, (intrinsicWidth * height) / intrinsicHeight, height) : o50.K2(e50.S1().getResources(), j8, width, (intrinsicHeight * width) / intrinsicWidth);
                    }
                    if (!z9 && z7 && (j8 instanceof BitmapDrawable)) {
                        BitmapDrawable bitmapDrawable = (BitmapDrawable) j8;
                        bitmapDrawable.setTileModeX(Shader.TileMode.REPEAT);
                        bitmapDrawable.setTileModeY(Shader.TileMode.REPEAT);
                    }
                    if (!z7 && !z8 && !z9) {
                        String G = com.flyersoft.components.b.G(str4, "background-position", false);
                        String G2 = com.flyersoft.components.b.G(str4, "background-size", false);
                        if (G != null) {
                            if (G2 != null) {
                                if (!G.contains("bottom")) {
                                }
                                this.J9 = str3;
                                this.S1.setBackgroundDrawable(drawable);
                                this.T1.setBackgroundDrawable(drawable);
                                return;
                            }
                        }
                    }
                    drawable = j8;
                    this.J9 = str3;
                    this.S1.setBackgroundDrawable(drawable);
                    this.T1.setBackgroundDrawable(drawable);
                    return;
                }
                return;
            }
            if (this.J9 != null) {
                this.J9 = null;
                this.S1.setBackgroundDrawable(null);
                this.T1.setBackgroundDrawable(null);
            }
        }
    }

    private void Ig() {
        try {
            C6(1, 0);
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    public void Ih() {
        Og(100, 200);
    }

    private void J4(boolean up) {
        AudioManager audioManager = (AudioManager) getSystemService("audio");
        int streamMaxVolume = audioManager.getStreamMaxVolume(3);
        int streamVolume = audioManager.getStreamVolume(3);
        int i8 = streamMaxVolume / 15;
        if (i8 < 1) {
            i8 = 1;
        }
        int i9 = up ? streamVolume + i8 : streamVolume - i8;
        if (i9 < 0) {
            i9 = 0;
        }
        if (i9 > streamMaxVolume) {
            i9 = streamMaxVolume;
        }
        audioManager.setStreamVolume(3, i9, 0);
        o50.r2(this, "翻页音量: " + i9 + com.ksdk.ssds.manager.b.b + streamMaxVolume, 0, 17);
    }

    public void J5(String info) {
        createProgressDlg(getString(R.string.loading), info);
    }

    private boolean J6() {
        if (Ya() && this.F2.c) {
            return false;
        }
        if (!u9(true)) {
            this.P4 = O5();
            return true;
        }
        F9(O5());
        return true;
    }

    private float J7(int edge, MotionEvent event) {
        return (edge == 0 || edge == 1) ? event.getY() : o9(event);
    }

    public boolean J9() {
        PDFReader pDFReader;
        MRTextView mRTextView = this.Q1;
        if (mRTextView == null) {
            return false;
        }
        mRTextView.P0 = -1;
        this.R1.P0 = -1;
        this.y9 = -1;
        HighlightLay highlightLay = this.c9;
        if (highlightLay == null || this.j9 == null || this.k9 == null) {
            return false;
        }
        if (highlightLay.getVisibility() != 0 && !B7()) {
            return false;
        }
        this.Q1.postInvalidate();
        this.R1.postInvalidate();
        this.r6 = SystemClock.elapsedRealtime();
        this.x5 = false;
        e50.H7(this.j9, 4);
        e50.H7(this.k9, 4);
        Se(false);
        if (Ya() && (pDFReader = this.F2) != null) {
            pDFReader.I(null);
            this.F2.b.viewEnableTextSelection(false);
            com.radaee.pdfex.b.c(true);
        }
        return true;
    }

    public void Jb() {
        this.lb.stop();
        this.mb = 0;
        this.kb.setProgress(0);
        this.fb.setVisibility(8);
        this.a2.postInvalidate();
    }

    private float Jc(int pageno) {
        if (pageno == -1) {
            pageno = rc();
        }
        return this.qa.m(pageno) * this.F2.getParaRatio();
    }

    public void Jd() {
        this.z4 = true;
        this.J1 = System.currentTimeMillis();
        this.H1.post(this);
    }

    public void Je(boolean visible) {
        S9();
        if (visible) {
            this.R2.setDurationTime(g8());
            this.W1.setVisibility(0);
            return;
        }
        this.j5 = 0L;
        this.W1.setVisibility(8);
        this.W1.setTag(null);
        if (this.S2.getVisibility() != 8) {
            this.S2.setVisibility(8);
            this.S2.setBackgroundDrawable(null);
            this.S2.setImageDrawable(null);
        }
        this.a2.postInvalidate();
    }

    private boolean Jf() {
        String str;
        ArrayList<String> arrayList = Ya() ? this.sa : e50.X8;
        if (arrayList != null && arrayList.size() > 0) {
            if (!Ya() && !e50.J2) {
                return false;
            }
            try {
                StringBuilder sb = new StringBuilder();
                Iterator<String> it = arrayList.iterator();
                while (it.hasNext()) {
                    String next = it.next();
                    sb.append(" <a href=\"" + next + "\">" + next + ".ttf</a>  ");
                }
                StringBuilder sb2 = new StringBuilder();
                sb2.append("<b>");
                if (Ya()) {
                    str = "PDF " + getString(R.string.button_options);
                } else {
                    str = "精排版选项";
                }
                sb2.append(str);
                sb2.append(" -> ");
                sb2.append(Ya() ? getString(R.string.pdf_missed_font_hint) : getString(R.string.epub_embedded_fonts));
                sb2.append("</b><br><br>");
                sb2.append(getString(R.string.epub_embedded_fonts_missied, new Object[]{"<b>" + sb.toString() + "</b><br>", "\"" + e50.c3 + "\""}));
                String sb3 = sb2.toString();
                m.c cVar = this.L9;
                if (cVar != null) {
                    cVar.a();
                }
                this.L9 = new m.c(this);
                this.H1.sendEmptyMessageDelayed(G0, 50L);
                this.L9.u(new d0());
                LinearLayout linearLayout = new LinearLayout(this);
                linearLayout.setOrientation(1);
                TextView textView = new TextView(this);
                float f8 = e50.d3;
                if (f8 > 19.0f) {
                    f8 -= 2.0f;
                }
                textView.setTextSize(f8);
                textView.setPadding(e50.k0(4.0f), e50.k0(4.0f), e50.k0(4.0f), e50.k0(12.0f));
                o50.m2(textView, sb3, new e0(arrayList));
                linearLayout.addView(textView);
                CheckBox checkBox = new CheckBox(this);
                checkBox.setText(R.string.do_not_ask_again);
                linearLayout.addView(checkBox);
                this.L9.B(linearLayout).v(R.string.open_note, new h0(arrayList, checkBox)).o(R.string.cancel, new f0(checkBox)).C();
                return true;
            } catch (Exception e8) {
                e50.S0(e8);
            }
        }
        return false;
    }

    private void Jg(MotionEvent event) {
        int i8;
        if (this.G7 == null) {
            return;
        }
        int actionMasked = event.getActionMasked();
        if (actionMasked == 0) {
            this.t5 = event.getY();
            this.u5 = event.getX();
            this.O5 = this.G7.getProgress();
            this.O7 = -1;
            this.P5 = true;
            e50.N5("pressDown_speak_volume: " + this.O5);
            return;
        }
        if (actionMasked != 1) {
            if (actionMasked == 2 && !B7()) {
                if (this.P5 && this.O7 == -1 && event.getPointerCount() >= 2) {
                    this.P5 = false;
                    int i9 = e50.p6;
                    this.O5 = i9;
                    this.Q5 = i9;
                }
                float abs = Math.abs(event.getX() - this.u5);
                if (Math.abs(event.getY() - this.t5) <= abs && this.O7 == -1) {
                    if (abs <= e50.k0(80.0f) || !this.P5) {
                        return;
                    }
                    Tg();
                    this.v5 = false;
                    return;
                }
                int y7 = ((int) (event.getY() - this.t5)) / e50.k0(40.0f);
                if (this.P5) {
                    if (this.L7 || Math.abs(event.getY() - this.t5) > e50.k0(8.0f)) {
                        if (!this.L7) {
                            this.L7 = true;
                            gh();
                        }
                        int m9 = m9();
                        int d9 = d9(m9);
                        if (d9 != -1) {
                            this.O7 = m9;
                            e50.o oVar = this.K6.get(d9);
                            int i10 = this.G6;
                            U9(oVar.b + i10, i10 + oVar.c);
                            return;
                        }
                        return;
                    }
                    return;
                }
                if (y7 == 0 && e50.p6 == this.O5) {
                    return;
                }
                int i11 = this.O5 - y7;
                int i12 = i11 >= 1 ? i11 : 1;
                if (i12 > Hb()) {
                    i12 = Hb();
                }
                fh(i12);
                this.Q5 = i12;
                o50.p2(this, getString(R.string.tts_speed) + " " + i12);
                return;
            }
            return;
        }
        if (this.O7 != -1) {
            Fg();
        } else {
            if (this.P5 || (i8 = this.Q5) == e50.p6) {
                return;
            }
            e50.p6 = i8;
            he();
        }
    }

    public void Jh() {
        if (this.z2 == null) {
            return;
        }
        e50.m mVar = e50.O3().get(e50.N3("1"));
        this.b4.setRoundImageDrawable(!mVar.f ? new ColorDrawable(mVar.d) : e50.I2(e50.w1(false), mVar.e, 1, 1));
        e50.m mVar2 = e50.O3().get(e50.N3("2"));
        this.c4.setRoundImageDrawable(!mVar2.f ? new ColorDrawable(mVar2.d) : e50.I2(e50.w1(false), mVar2.e, 1, 1));
        e50.m mVar3 = e50.O3().get(e50.N3(Const.ACTION_COMPLAINT));
        this.d4.setRoundImageDrawable(!mVar3.f ? new ColorDrawable(mVar3.d) : e50.I2(e50.w1(false), mVar3.e, 1, 1));
        e50.m mVar4 = e50.O3().get(e50.N3("4"));
        this.e4.setRoundImageDrawable(!mVar4.f ? new ColorDrawable(mVar4.d) : e50.I2(e50.w1(false), mVar4.e, 1, 1));
    }

    private boolean K4() {
        return e50.c5 && (this.o1 || System.currentTimeMillis() - e50.Ca > 10000);
    }

    private void K5(String title, String info, boolean useNew) {
        ProgressDialog progressDialog;
        if (!useNew && (progressDialog = this.G2) != null) {
            progressDialog.setTitle(title);
            this.G2.setMessage(info);
            return;
        }
        ProgressDialog progressDialog2 = this.G2;
        if (progressDialog2 != null) {
            this.y8 = progressDialog2;
            progressDialog2.dismiss();
        }
        o50.n1();
        if (e50.P9) {
            return;
        }
        ProgressDialog g02 = e50.g0(this, title, info, true, true);
        this.G2 = g02;
        g02.setOnKeyListener(new i7());
        this.G2.setOnDismissListener(new a());
    }

    public void K6(String key) {
        WB.doWebSearchWithSelect(this, key);
    }

    public boolean K7() {
        MRTextView mRTextView = this.Q1;
        boolean z7 = mRTextView.D0;
        this.R1.D0 = false;
        mRTextView.D0 = false;
        if (z7) {
            mRTextView.postInvalidate();
            this.R1.postInvalidate();
            return true;
        }
        if (this.S1.getScrollY() == 0) {
            this.Q1.postInvalidate();
        }
        return false;
    }

    public boolean Ka() {
        int scrollY = this.S1.getScrollY();
        int realHeight = this.Q1.getRealHeight();
        int h32 = e50.h3();
        int lineHeight = this.Q1.getLineHeight();
        int q8 = q8();
        if (q8 != 0) {
            if (q8 != 1) {
                if (q8 != 7) {
                    if (q8 == 100 && e50.Q1 != null && e50.g2 == e50.Q1.h().size() - 1 && ((e50.G9.size() == 0 || e50.h2 == e50.G9.size() - 1) && vb())) {
                        return true;
                    }
                } else if (rc() == this.qa.k() - 1) {
                    PDFReader pDFReader = this.F2;
                    if (pDFReader.c) {
                        return vb();
                    }
                    f.c viewGetPos = pDFReader.b.viewGetPos();
                    return ((float) viewGetPos.c) >= (Ic(viewGetPos.a) - ((float) (this.F2.getHeight() - e50.k0(10.0f)))) - ((float) e50.k0(10.0f));
                }
            } else if ((e50.G9.size() == 0 || e50.h2 == e50.G9.size() - 1) && scrollY + (h32 * ih(0)) > realHeight - ((lineHeight * 9) / 10)) {
                return true;
            }
        } else if (e50.i2 >= e50.f4().size() - 2 && scrollY + (h32 * ih(0)) > realHeight - ((lineHeight * 9) / 10)) {
            return true;
        }
        return false;
    }

    private boolean Kb(MotionEvent event) {
        if ((!e50.P5 && this.C9 == null) || Ya() || hb(event)) {
            return false;
        }
        int actionMasked = event.getActionMasked();
        if (actionMasked != 1) {
            if (actionMasked != 2) {
                if (actionMasked == 5 && event.getPointerCount() >= 2) {
                    this.S5 = true;
                    return true;
                }
            } else if (this.S5 && event.getPointerCount() >= 2) {
                Ke();
                Me(true);
                if (this.R5 == -1.0d) {
                    this.R5 = A8(event.getX(0), event.getY(0), event.getX(1), event.getY(1));
                } else {
                    double A8 = A8(event.getX(0), event.getY(0), event.getX(1), event.getY(1));
                    if (this.C9 == null) {
                        float k02 = e50.d3 + (((int) (A8 - this.R5)) / e50.k0(20.0f));
                        if (e50.d3 != k02 && k02 > 5.0f && k02 < 200.0f) {
                            if (event.getPointerCount() > 2) {
                                float f8 = e50.d3;
                                k02 = ((k02 - f8) / 10.0f) + f8;
                            }
                            e50.d3 = k02;
                            int i8 = e50.q9;
                            if (k02 > i8) {
                                e50.d3 = i8;
                            }
                            float f9 = e50.d3;
                            int i9 = e50.p9;
                            if (f9 < i9) {
                                e50.d3 = i9;
                            }
                            Oe();
                            k5();
                            this.R5 = A8;
                            o50.p2(this, new DecimalFormat("0.0").format(e50.d3));
                        }
                    } else {
                        int k03 = ((int) (A8 - this.R5)) / e50.k0(20.0f);
                        if (Math.abs(k03) > 0) {
                            int i10 = e50.k2 + k03;
                            e50.k2 = i10;
                            if (i10 > 72) {
                                e50.k2 = 72;
                            }
                            if (e50.k2 < 1) {
                                e50.k2 = 1;
                            }
                            Oe();
                            this.R5 = A8;
                            o50.p2(this, new DecimalFormat("0.0").format(e50.k2));
                        }
                    }
                }
                return true;
            }
        } else if (this.S5) {
            this.S5 = false;
            this.R5 = -1.0d;
            return true;
        }
        return false;
    }

    private boolean Kc(boolean pageDown) {
        if (!Ya()) {
            return false;
        }
        if (!e50.O9) {
            this.c2.setVisibility(4);
        }
        int i8 = (e50.u3 && e50.g5()) ? 2 : 1;
        PDFReader pDFReader = this.F2;
        if (pDFReader.c) {
            int scrollY = this.S1.getScrollY();
            int realHeight = this.Q1.getRealHeight();
            int h32 = e50.h3();
            if ((!pageDown && scrollY == 0) || (pageDown && (vb() || scrollY + h32 >= realHeight - ((this.Q1.getLineHeight() * 95) / 100)))) {
                int i9 = (int) e50.f2;
                if (!pageDown) {
                    i8 = -i8;
                }
                e50.f2 = kd(i9 + i8);
                this.C4.clear();
                q5();
                this.Q1.setText(mc(e50.f2));
                kh(0);
            } else {
                nh(this.Q1.Z(M8(pageDown, false)));
            }
            if (e50.O9) {
                this.H1.sendEmptyMessageDelayed(x0, 50L);
            }
        } else {
            f.c viewGetPos = pDFReader.b.viewGetPos();
            if (Global.m == 0) {
                ld(pageDown, viewGetPos);
            } else {
                Mc(viewGetPos);
                int i10 = viewGetPos.a;
                if (!pageDown) {
                    i8 = -i8;
                }
                viewGetPos.a = kd(i10 + i8);
                this.F2.b.viewGoto(viewGetPos);
            }
            e50.f2 = viewGetPos.a;
        }
        cg(0);
        if (pageDown) {
            Sc();
        }
        return true;
    }

    private void Kd() {
        Z4();
        Td();
        this.O2 = false;
        this.H1.postDelayed(this, 0L);
        Og(1, 100);
    }

    private void Ke() {
        if (this.R2 == null || this.W1.getVisibility() != 0) {
            return;
        }
        Je(false);
    }

    private void Kf(Bitmap bm) {
        try {
            this.R2.e0 = 0;
            int paddingLeft = this.W1.getPaddingLeft();
            if (paddingLeft > 0) {
                int paddingTop = this.W1.getPaddingTop();
                int width = this.W1.getWidth() - (paddingLeft * 2);
                int height = this.U1.getHeight() - (paddingTop * 2);
                Bitmap createBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
                new Canvas(createBitmap).drawBitmap(bm, new Rect(paddingLeft, paddingTop, paddingLeft + width, paddingTop + height), new Rect(0, 0, width, height), (Paint) null);
                this.S2.setImageBitmap(createBitmap);
            } else if (!o50.I1(bm)) {
                this.S2.setImageBitmap(bm.copy(bm.getConfig(), false));
            }
            this.S2.setTag(1);
            this.Z2 = true;
            this.S2.setVisibility(0);
        } catch (OutOfMemoryError e8) {
            e50.S0(e8);
        }
    }

    public void Kg() {
        e50.P9 = true;
        int V8 = V8();
        if (V8 == 0 || V8 == 1) {
            M5();
            if (Ya()) {
                this.S7 = md();
            }
            this.R7 = Ya() ? this.S7 : this.S1.getPaddingTop();
        } else if (V8 == 2 || V8 == 3) {
            if (e50.Q1 != null && this.Q1.getRealLineCount() > 2) {
                int h32 = e50.h3();
                MRTextView mRTextView = this.Q1;
                int S = h32 / mRTextView.S(mRTextView.getRealLineCount() - 1);
                MRTextView mRTextView2 = this.Q1;
                int i8 = mRTextView2.n1;
                int i9 = S / 4;
                if (i8 < i9) {
                    mRTextView2.p(i9 - i8);
                }
            }
        } else if (V8 == 4) {
            if (this.X1 == null) {
                View view = new View(this);
                this.X1 = view;
                view.setBackgroundColor(-1436129690);
                this.U1.addView(this.X1, new FrameLayout.LayoutParams(-1, 1));
            }
            this.X1.setVisibility(0);
        }
        this.W7 = 0;
        this.X7 = SystemClock.elapsedRealtime();
        this.T7 = true;
        Timer timer = new Timer();
        this.Q7 = timer;
        timer.schedule(new k7(), 0L, l8());
    }

    public void Kh() {
        if (this.z2 == null) {
            return;
        }
        this.b4.setChecked(e50.V3 == 1);
        this.c4.setChecked(e50.V3 == 2);
        this.d4.setChecked(e50.V3 == 3);
        this.e4.setChecked(e50.V3 == 4);
        ((RoundButton) this.y2.findViewById(R.id.moreTheme)).setChecked(e50.V3 == 5);
    }

    private boolean L4() {
        if (!e50.O2) {
            return false;
        }
        ScrollView scrollView = (ScrollView) LayoutInflater.from(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);
        checkBox.setChecked(true);
        textView.setText(Html.fromHtml(e50.W0("切换到夜间模式后, 是否启用\"天亮后自动关闭夜间模式\"?<br><br><small><font color=\"#888888\">(可在\"亮度调节->配置夜间模式\"重设)</font></small>")));
        new m.c(this).B(scrollView).w(e50.W0("启用"), new t5(checkBox)).p(e50.W0("不启用"), new q5(checkBox)).d(false).C();
        return true;
    }

    public void L5() {
        if (this.z8 == null) {
            ProgressBar progressBar = new ProgressBar(this);
            this.z8 = progressBar;
            this.U1.addView(progressBar);
            FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.z8.getLayoutParams();
            layoutParams.width = e50.k0(30.0f);
            layoutParams.height = e50.k0(30.0f);
            layoutParams.gravity = 17;
            layoutParams.bottomMargin = e50.k0(10.0f);
            layoutParams.rightMargin = e50.k0(10.0f);
        }
    }

    private void L6(boolean reverse) {
        if (reverse) {
            e50.g7 = !e50.g7;
        }
        ImageView imageView = this.d2;
        if (imageView != null) {
            imageView.setImageResource(e50.g7 ? R.drawable.mrbookview2 : R.drawable.chromebookview2);
        }
        if (e50.g7) {
            ph("");
            Jd();
        } else {
            MRBookView mRBookView = this.C9;
            if (mRBookView != null) {
                this.E9 = e50.g2;
                this.D9 = mRBookView.getScrollY();
                Rd();
                this.Xa = null;
                this.Ha = null;
                Jd();
            }
        }
        za(true);
    }

    public void L7() {
        if (this.W1.getVisibility() != 0) {
            this.i2.setVisibility(8);
            this.i2.b0 = false;
        } else {
            Je(false);
        }
        this.J4 = 0L;
    }

    private void L9() {
        if (this.q2.getVisibility() != 4) {
            this.q2.setVisibility(4);
        }
    }

    private boolean La(String url, String title) {
        int i8;
        int i9;
        int i10;
        boolean z7;
        int indexOf;
        int indexOf2;
        String str = url;
        if (str.contains("#")) {
            str = str.substring(str.indexOf("#"));
        }
        String str2 = str;
        if (!str2.startsWith("#")) {
            return false;
        }
        int i11 = -1;
        if (this.n5.indexOf("\"noteref\"") == -1) {
            return false;
        }
        this.Z5 = null;
        String str3 = this.n5;
        int i12 = 1;
        if (!e50.U5() && e50.h2 < e50.G9.size() - 1) {
            try {
                for (int i13 = e50.h2 + 1; i13 < e50.G9.size(); i13++) {
                    str3 = str3 + e50.G9.get(i13);
                }
            } catch (OutOfMemoryError e8) {
                e50.S0(e8);
            }
        }
        int i14 = 0;
        while (true) {
            int indexOf3 = str3.indexOf(" href=\"" + str2 + "\"", i14);
            if (indexOf3 == i11) {
                indexOf3 = str3.indexOf(" href = \"" + str2 + "\"", i14);
            }
            if (indexOf3 == i11) {
                indexOf3 = str3.indexOf(str2 + "\"", i14);
                if (indexOf3 != i11) {
                    int lastIndexOf = str3.lastIndexOf(" href=\"", indexOf3);
                    int lastIndexOf2 = str3.lastIndexOf("<", indexOf3);
                    if (lastIndexOf == i11) {
                        break;
                    }
                    if (lastIndexOf < lastIndexOf2) {
                        break;
                    }
                    if (indexOf3 - lastIndexOf > 120) {
                        break;
                    }
                }
            }
            if (indexOf3 == i11) {
                break;
            }
            int lastIndexOf3 = str3.lastIndexOf("<", indexOf3);
            int indexOf4 = str3.indexOf(">", indexOf3);
            if (lastIndexOf3 != i11 && indexOf4 != i11 && indexOf4 - lastIndexOf3 < 200) {
                String substring = str3.substring(lastIndexOf3, indexOf4);
                if (substring.indexOf("noteref") != i11) {
                    int indexOf5 = str3.indexOf(" id=\"" + str2.substring(i12) + "\"", indexOf4);
                    if (indexOf5 == -1) {
                        StringBuilder sb = new StringBuilder();
                        sb.append(" id = \"");
                        i8 = indexOf3;
                        i10 = 1;
                        sb.append(str2.substring(1));
                        sb.append("\"");
                        indexOf5 = str3.indexOf(sb.toString(), indexOf4);
                    } else {
                        i8 = indexOf3;
                        i10 = 1;
                    }
                    if (indexOf5 == -1) {
                        indexOf5 = str3.indexOf(" id=\"" + str2.substring(i10) + "\"", i14);
                    }
                    if (indexOf5 == -1 && (indexOf2 = substring.indexOf("href=\"")) > 0) {
                        int i15 = indexOf2 + 6;
                        String substring2 = substring.substring(i15, substring.indexOf("\"", i15));
                        if (substring2.contains("#")) {
                            String t7 = e50.Q1.t(substring2.substring(0, substring2.indexOf("#")));
                            if (t7 != null) {
                                indexOf5 = t7.indexOf(" id=\"" + str2.substring(1) + "\"", 0);
                                if (indexOf5 == -1) {
                                    indexOf5 = t7.indexOf(" id = \"" + str2.substring(1) + "\"", 0);
                                }
                                if (indexOf5 == -1) {
                                    indexOf5 = t7.indexOf(" id=\"" + str2.substring(1) + "\"", 0);
                                }
                                str3 = t7;
                                z7 = true;
                                if (indexOf5 != -1 && indexOf5 - str3.lastIndexOf("<aside ", indexOf5) < 1000) {
                                    int indexOf6 = !z7 ? -1 : str3.substring(indexOf4 + 1, indexOf4 + 100).replace(jy1.f, ' ').indexOf(title.replace(jy1.f, ' '));
                                    indexOf = str3.indexOf("</aside>", indexOf5);
                                    if (indexOf != -1) {
                                        int length = str2.length() - 1;
                                        while (length > 0 && o50.o(str2.charAt(length))) {
                                            length--;
                                        }
                                        int i16 = indexOf5 + 10;
                                        int indexOf7 = str3.indexOf(" id=\"" + str2.substring(1, length + 1), i16);
                                        if (indexOf7 != -1 && indexOf7 < indexOf) {
                                            if (indexOf7 != str3.indexOf(" id=\"" + str2.substring(1), i16)) {
                                                i14 = str3.lastIndexOf("<", indexOf7);
                                            }
                                        }
                                        i14 = indexOf;
                                        int indexOf8 = str3.indexOf(">", indexOf5);
                                        if (this.Z5 == null) {
                                            this.Z5 = str3.substring(indexOf8 + 1, i14);
                                        }
                                        i11 = -1;
                                        if (indexOf6 != -1 && indexOf6 < 10) {
                                            this.Z5 = str3.substring(indexOf8 + 1, i14);
                                            break;
                                        }
                                        i9 = i8;
                                        if (i14 >= i9) {
                                            i14 = i9 + 100;
                                        }
                                        i12 = 1;
                                    }
                                }
                                i11 = -1;
                                i9 = i8;
                                if (i14 >= i9) {
                                }
                                i12 = 1;
                            }
                        }
                    }
                    z7 = false;
                    if (indexOf5 != -1) {
                        if (!z7) {
                        }
                        indexOf = str3.indexOf("</aside>", indexOf5);
                        if (indexOf != -1) {
                        }
                    }
                    i11 = -1;
                    i9 = i8;
                    if (i14 >= i9) {
                    }
                    i12 = 1;
                }
            }
            i8 = indexOf3;
            i9 = i8;
            if (i14 >= i9) {
            }
            i12 = 1;
        }
        if (this.Z5 == null) {
            return false;
        }
        hideProgressDlg();
        this.Z5 = this.Z5.trim().replace("\u200f^", "^");
        StringBuilder sb2 = new StringBuilder();
        sb2.append("".equals(title) ? "" : "<h3>" + title + "</h3>");
        sb2.append(this.Z5);
        this.Z5 = sb2.toString();
        Pf();
        return true;
    }

    private boolean Lb() {
        if (this.E6.size() == 0) {
            return false;
        }
        CharSequence[] charSequenceArr = new CharSequence[this.E6.size()];
        for (int i8 = 0; i8 < this.E6.size(); i8++) {
            if (nb()) {
                String trim = e50.Q1.h().get(this.E6.get(i8).c).c.trim();
                if (trim.contains(" ")) {
                    trim = trim.substring(0, trim.indexOf(" "));
                }
                charSequenceArr[i8] = Html.fromHtml("<small><font color=\"#888888\">(返回" + trim + ") </font></small>" + this.E6.get(i8).a + "");
            } else {
                charSequenceArr[i8] = this.E6.get(i8).a;
            }
        }
        new com.flyersoft.components.m(this, null, charSequenceArr, null, 0, new u5(), null, null, false).y();
        return true;
    }

    public void Ld() {
        pe(true);
        e50.Q1.h().get(e50.g2).f = f50.a;
        Of(e50.g2, e50.h2, e50.f2, true);
    }

    public void Le(View item) {
        int intValue = ((Integer) item.getTag()).intValue();
        EditText editText = (EditText) item.findViewById(R.id.editText1);
        EditText editText2 = (EditText) item.findViewById(R.id.editText2);
        View findViewById = item.findViewById(R.id.arrow);
        TextView textView = (TextView) item.findViewById(R.id.op);
        textView.setTag(item);
        textView.setOnClickListener(this.j3);
        editText.setText(intValue < e50.M9.size() ? e50.M9.get(intValue).a : "");
        editText2.setText(intValue < e50.M9.size() ? e50.M9.get(intValue).b : "");
        int i8 = intValue == e50.M9.size() ? 4 : 0;
        editText.setVisibility(i8);
        editText2.setVisibility(i8);
        editText.setTextSize(15.0f);
        editText2.setTextSize(15.0f);
        findViewById.setVisibility(i8);
        textView.setText(intValue == e50.M9.size() ? Marker.ANY_NON_NULL_MARKER : "-");
    }

    private void Lg(com.flyersoft.staticlayout.k gallerySp) {
        if (gallerySp == null) {
            return;
        }
        String g8 = gallerySp.g();
        if (e50.c5(g8)) {
            String j12 = e50.j1(g8);
            if (o50.A1(j12)) {
                Intent intent = new Intent(this, (Class<?>) PicGalleryShow.class);
                intent.putExtra("imageFile", j12);
                startActivity(intent);
                return;
            }
            return;
        }
        Intent intent2 = new Intent(this, (Class<?>) PicGalleryShow.class);
        if (e50.Q1 != null) {
            intent2.putExtra("ebookImage", g8);
        } else {
            intent2.putExtra("imageFile", o50.n0(e50.V1) + com.ksdk.ssds.manager.b.b + g8);
        }
        startActivity(intent2);
    }

    public void Lh() {
        View view = this.z2;
        if (view != null) {
            ((RoundImage) view.findViewById(R.id.typeset1)).setChecked(e50.W3 == 1);
            ((RoundImage) this.z2.findViewById(R.id.typeset2)).setChecked(e50.W3 == 2);
            ((RoundImage) this.z2.findViewById(R.id.typeset3)).setChecked(e50.W3 == 3);
            ((RoundButton) this.z2.findViewById(R.id.typeset4)).setChecked(e50.W3 == 4);
            ((RoundButton) this.z2.findViewById(R.id.moreTypeset)).setChecked(e50.W3 == 5);
        }
    }

    static int M2(ActivityTxt activityTxt) {
        int i8 = activityTxt.Gb;
        activityTxt.Gb = i8 - 1;
        return i8;
    }

    private void M5() {
        this.V1.setVisibility(0);
        if (this.U7 == null) {
            ScrollImage scrollImage = new ScrollImage(this);
            this.U7 = scrollImage;
            this.V1.addView(scrollImage, new FrameLayout.LayoutParams(-1, -1));
        }
        this.V1.setOnTouchListener(this);
    }

    private boolean M6(MotionEvent event) {
        if (rb(e50.a8, event)) {
            float J7 = J7(e50.a8, event);
            float f8 = this.T5;
            if (f8 == -1.0f) {
                this.T5 = J7;
            } else {
                float f9 = f8 - J7;
                float abs = Math.abs(f9);
                float C02 = e50.C0(20.0f);
                if (abs > C02) {
                    if (e50.A5 == -100) {
                        e50.A5 = i9();
                    }
                    if (this.V5 > 10000.0f) {
                        this.V5 = 10000.0f;
                    }
                    float f10 = f9 > 0.0f ? 500.0f : 400.0f;
                    int i8 = (int) ((((this.V5 / f10) + 1.0f) * abs) / C02);
                    int i9 = e50.A5;
                    int i10 = (f9 > 0.0f ? i8 : -i8) + i9;
                    if (i9 > 2 && i10 < 2) {
                        i10 = 2;
                    } else if (i9 > 1 && i10 < 1) {
                        i10 = 1;
                    } else if (i9 > 0 && i10 < 0) {
                        i10 = 0;
                    } else if (i9 <= 0 && f9 < 0.0f && i8 > 1) {
                        i10 = i9 - 1;
                        i8 = 1;
                    }
                    e50.A5 = i10;
                    this.T5 = J7;
                    e50.N5("*adjust:" + f9 + ", step:" + i8 + ", velSpeed: " + this.V5 + ", brightness:" + e50.A5 + ", rate:" + f10);
                    Ze(e50.A5, true);
                    this.w5 = true;
                    return true;
                }
            }
            if (!e50.Q4() && !kb()) {
                return true;
            }
        } else {
            this.T5 = -1.0f;
        }
        return false;
    }

    private boolean M7(float nowX, float downX, boolean checkOpposite) {
        return Math.abs(nowX - downX) > ((float) e50.k0(!checkOpposite ? false : Wa(nowX, downX) ? 20.0f : 8.0f));
    }

    private int M8(boolean isPageDown, boolean forCacheOnly) {
        int C;
        int i8;
        com.flyersoft.staticlayout.l layout = this.Q1.getLayout();
        boolean F7 = F7();
        if (isPageDown) {
            if (!forCacheOnly && !Ka()) {
                this.C4.add(Integer.valueOf(this.S1.getScrollY()));
            }
            MRTextView mRTextView = this.Q1;
            i8 = mRTextView.H0;
            if (i8 <= 0) {
                if ((!F7 && mRTextView.C0() > 0) || (F7 && this.R1.C0() > 0)) {
                    C = (!F7 ? this.Q1 : this.R1).C0();
                } else {
                    C = e50.Q2(F7 ? this.T1 : this.S1, -1);
                    i8 = C + 1;
                    if (this.Q1.x0(C)) {
                        if (!this.Q1.u0(C)) {
                            if (F7) {
                            }
                        }
                    }
                }
                i8 = C;
            }
            if (e50.p5 && !e50.O9 && this.Q1.getPageBreakLine() != i8) {
                i8--;
            }
            int i9 = i8 >= 0 ? i8 : 0;
            return i9 > T8() - 1 ? T8() - 1 : i9;
        }
        this.D4 = false;
        if (!forCacheOnly && this.C4.size() > 0) {
            this.D4 = true;
            ArrayList<Integer> arrayList = this.C4;
            return layout.C(arrayList.remove(arrayList.size() - 1).intValue());
        }
        int scrollY = this.S1.getScrollY();
        int C2 = layout.C(scrollY);
        int h32 = scrollY - (e50.h3() * ih(0));
        C = h32 < this.Q1.getLineHeight() / 2 ? 0 : layout.C(h32) + 1;
        int Q2 = e50.Q2(this.S1, C);
        if (F7) {
            Q2 = e50.Q2(this.T1, Q2 + 1);
        }
        if (C > 0 && Q2 >= C2) {
            i8 = C - 1;
            if (e50.p5) {
                i8--;
            }
            if (i8 >= 0) {
            }
            if (i9 > T8() - 1) {
            }
        }
        i8 = C;
        if (e50.p5) {
        }
        if (i8 >= 0) {
        }
        if (i9 > T8() - 1) {
        }
    }

    private boolean M9() {
        View view = this.h7;
        if (view == null || view.getVisibility() != 0) {
            return false;
        }
        this.h7.setVisibility(8);
        return true;
    }

    private boolean Ma(View v7, MotionEvent event) {
        if ((v7 == this.F2 || (v7 instanceof ScrollView)) && e50.P4 != 15) {
            int action = event.getAction();
            if (action == 0) {
                if (!this.z5 && !this.A5) {
                    this.x5 = true;
                    this.A5 = true;
                    int i8 = (int) (e50.e3 * 1000.0f);
                    if (hb(event)) {
                        i8 = (i8 * 15) / 10;
                    }
                    this.H1.sendEmptyMessageDelayed(g0, i8);
                    this.z5 = true;
                }
                if (J9()) {
                    this.v5 = false;
                    return true;
                }
                this.v5 = true;
            } else if (action == 1) {
                this.x5 = false;
                this.A5 = false;
                if (!this.v5) {
                    this.r6 = SystemClock.elapsedRealtime();
                    return true;
                }
                this.v5 = false;
            } else if (action == 2) {
                if (Rg(event)) {
                    this.x5 = false;
                    J9();
                }
                if (!this.v5) {
                    return true;
                }
            } else if (action == 3) {
                e50.N5("MotionEvent.ACTION_CANCEL");
                this.x5 = false;
            }
        }
        return false;
    }

    private boolean Mb() {
        return Build.VERSION.SDK_INT < 11 || e50.n9 || e50.o9;
    }

    private void Mc(f.c p7) {
        if (e50.t3) {
            return;
        }
        if (p7.c == 0) {
            float Ic = Ic(p7.a);
            if (this.F2.getHeight() > Ic) {
                p7.c = (-((int) ((r2 - Ic) / 2.0f))) - 1;
            }
        }
        if (p7.b == 0) {
            float Jc = Jc(p7.a);
            float width = this.F2.getWidth();
            if (width > Jc) {
                p7.b = -((int) ((width - Jc) / 2.0f));
            }
        }
    }

    public void Md() {
        this.sb = null;
        this.Q1.setText(getString(R.string.downloading_content));
        if (Hh(e50.g2, getString(R.string.downloading_content), false)) {
            this.tb = true;
            createProgressDlg("", e50.Q1.h().get(e50.g2).c + "\n" + getString(R.string.downloading_content));
            q5();
        }
    }

    public void Me(boolean clear) {
        if (this.i2.getVisibility() != 8) {
            this.i2.setVisibility(8);
            if (clear) {
                this.i2.setImageDrawable(null);
            }
            this.a2.setAnimationState(false);
        }
    }

    public void Mf(final String s7) {
        new com.flyersoft.components.m(this, this.h9, new String[]{"分享文字", "朗读文字", "搜索本书", "搜索网络", "词典选项"}, new b0(s7)).v().A(this.h9);
    }

    private void N4(int direction, boolean resetScrollPos) {
        int lineHeight;
        int V8 = V8();
        if (V8 != 0 && V8 != 1) {
            if (V8 == 2 || V8 == 3) {
                bc(direction);
                return;
            } else {
                if (V8 != 4) {
                    return;
                }
                this.W7 = 0;
                bc(direction);
                return;
            }
        }
        if (this.U7 == null) {
            return;
        }
        if (resetScrollPos) {
            boolean z7 = V8() == 1;
            if (Ya()) {
                lineHeight = this.S7;
            } else {
                lineHeight = (z7 ? this.Q1.getLineHeight() : 0) + this.S1.getPaddingTop();
            }
            this.R7 = lineHeight;
        }
        this.U7.setVisibility(4);
        View view = this.p7;
        boolean z8 = view != null && view.getVisibility() == 0;
        if (z8) {
            this.p7.setVisibility(4);
        }
        this.U7.setPage2Bm(O8(true, true));
        ScrollImage scrollImage = this.U7;
        scrollImage.a = 0;
        scrollImage.setVisibility(0);
        if (z8) {
            this.p7.setVisibility(0);
        }
        this.U7.invalidate();
        int i8 = e50.g2;
        bc(direction);
        if (i8 == e50.g2) {
            this.U7.setPage1Bm(O8(true, true));
        }
        this.U7.invalidate();
    }

    private View N5() {
        e50.y4();
        LinearLayout linearLayout = new LinearLayout(this);
        linearLayout.setPadding(e50.k0(10.0f), e50.k0(10.0f), e50.k0(6.0f), e50.k0(6.0f));
        linearLayout.setOrientation(1);
        LinearLayout linearLayout2 = new LinearLayout(this);
        this.i3 = linearLayout2;
        linearLayout2.setOrientation(1);
        CheckBox checkBox = new CheckBox(this);
        checkBox.setText(R.string.use_regular_expression);
        checkBox.setChecked(e50.R2);
        checkBox.setOnCheckedChangeListener(new f3());
        checkBox.setTextSize(13.0f);
        LinearLayout linearLayout3 = new LinearLayout(this);
        TextView textView = new TextView(this);
        TextView textView2 = new TextView(this);
        textView.setTextSize(13.0f);
        textView2.setTextSize(13.0f);
        textView.setPadding(e50.k0(6.0f), e50.k0(4.0f), e50.k0(6.0f), e50.k0(0.0f));
        textView2.setPadding(e50.k0(6.0f), e50.k0(4.0f), e50.k0(6.0f), e50.k0(0.0f));
        textView.setBackgroundResource(R.drawable.my_list_selector);
        textView2.setBackgroundResource(R.drawable.my_list_selector);
        textView.setTextColor(com.flyersoft.components.b.e);
        textView2.setTextColor(com.flyersoft.components.b.e);
        textView.getPaint().setUnderlineText(true);
        textView2.getPaint().setUnderlineText(true);
        textView.setText(getString(R.string.import_ebooks));
        textView2.setText(getString(R.string.export));
        linearLayout3.setOrientation(0);
        linearLayout3.addView(textView);
        linearLayout3.addView(textView2);
        textView.setOnClickListener(new h3());
        textView2.setOnClickListener(new s3());
        for (int i8 = 0; i8 <= e50.M9.size(); i8++) {
            View inflate = LayoutInflater.from(this).inflate(R.layout.tts_filter, (ViewGroup) null);
            inflate.setTag(Integer.valueOf(i8));
            Le(inflate);
            this.i3.addView(inflate, -1, -2);
        }
        ScrollView scrollView = new ScrollView(this);
        scrollView.addView(this.i3, -1, -1);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
        layoutParams.weight = 5.0f;
        linearLayout.addView(scrollView, layoutParams);
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-2, -2);
        int k02 = e50.k0(10.0f);
        layoutParams2.bottomMargin = k02;
        layoutParams2.topMargin = k02;
        layoutParams2.height = 1;
        View view = new View(this);
        view.setBackgroundColor(1431655765);
        linearLayout.addView(view, layoutParams2);
        linearLayout.addView(checkBox);
        linearLayout.addView(linearLayout3);
        if (Build.VERSION.SDK_INT < 11) {
            e50.b1(linearLayout);
        }
        return linearLayout;
    }

    private boolean N6(MotionEvent event) {
        if (rb(e50.b8, event)) {
            float J7 = J7(e50.b8, event);
            float f8 = this.U5;
            if (f8 == -1.0f) {
                this.U5 = J7;
            } else {
                float f9 = f8 - J7;
                if (Math.abs(f9) > e50.k0(40.0f)) {
                    Yd();
                    if (Za()) {
                        nd(f9 <= 0.0f ? -0.1f : 0.1f);
                    } else if (this.C9 == null) {
                        float f10 = event.getPointerCount() < 2 ? 1.0f : 0.1f;
                        float f11 = e50.d3;
                        if (f9 <= 0.0f) {
                            f10 = -f10;
                        }
                        float f12 = f11 + f10;
                        e50.d3 = f12;
                        int i8 = e50.q9;
                        if (f12 > i8) {
                            e50.d3 = i8;
                        }
                        float f13 = e50.d3;
                        int i9 = e50.p9;
                        if (f13 < i9) {
                            e50.d3 = i9;
                        }
                        o50.p2(this, new DecimalFormat("0.0").format(e50.d3));
                        Oe();
                    } else {
                        Uh(f9 > 0.0f);
                    }
                    this.U5 = J7;
                    this.w5 = true;
                    return true;
                }
            }
            if (!e50.Q4() && !kb()) {
                return true;
            }
        } else {
            this.U5 = -1.0f;
        }
        return false;
    }

    private int N8() {
        float h32 = e50.h3() / this.Q1.getLineHeight();
        int i8 = (int) h32;
        return Zb(h32) ? i8 + 1 : i8;
    }

    private void N9() {
        if (Build.VERSION.SDK_INT < 15 || e50.g5) {
            return;
        }
        try {
            this.U1.setSystemUiVisibility(1);
        } catch (Throwable th) {
            e50.S0(th);
        }
    }

    private boolean Na() {
        return e50.S4() && e50.a5();
    }

    public boolean Nb() {
        return e50.Q4() || (e50.S4() && e50.Z4());
    }

    public void Nc(f.c p7, float ratio) {
        Mc(p7);
        this.F2.b.viewSetRatio(ratio, p7.b, p7.c, false);
        this.F2.b.viewGoto(p7);
    }

    public boolean Nd() {
        if (!nb() || !q50.V((q50) e50.Q1)) {
            return false;
        }
        J5(e50.W0("正在读取章节列表"));
        TS.getBookInfo(((q50) e50.Q1).E, new h2());
        return true;
    }

    public boolean Ne(int color) {
        if (color == e50.f3) {
            return false;
        }
        e50.f3 = color;
        this.Q1.setTextColor(color);
        this.R1.setTextColor(color);
        if (kg() && !e50.i7) {
            hf(true);
        }
        o5();
        if (e50.L3) {
            e50.X6(this.Q1);
            e50.X6(this.R1);
            this.Q1.postInvalidate();
            this.R1.postInvalidate();
        }
        return true;
    }

    private void Nf() {
        e50.H7(this.j9, 0);
        e50.H7(this.k9, 0);
    }

    private void Ng() {
        if (e50.P9) {
            return;
        }
        if (this.y4 != 1) {
            return;
        }
        int i8 = this.M9;
        if (i8 != -1 && i8 == this.S1.getScrollY() && this.N9 == e50.g2) {
            return;
        }
        if (SystemClock.elapsedRealtime() - this.P9 > 1000) {
            this.M9 = this.S1.getScrollY();
            this.N9 = e50.g2;
            e50.R4 += Xa() ? 2 : 1;
            try {
                int z8 = z8();
                e50.S4 += z8;
                this.O9 += z8;
            } catch (Exception e8) {
                e50.S0(e8);
            }
        }
        this.P9 = SystemClock.elapsedRealtime();
    }

    private void O4(MotionEvent event) {
        int actionMasked = event.getActionMasked();
        if (actionMasked == 0) {
            this.t5 = event.getY();
            this.u5 = event.getX();
            this.M5 = e50.s5;
            boolean z7 = event.getPointerCount() < 2;
            this.N5 = z7;
            if (z7) {
                return;
            }
            this.Y5 = true;
            return;
        }
        if (actionMasked != 1) {
            if (actionMasked == 2 && !B7()) {
                if (this.N5 && event.getPointerCount() >= 2) {
                    this.N5 = false;
                }
                float abs = Math.abs(event.getX() - this.u5);
                if (Math.abs(event.getY() - this.t5) <= abs) {
                    if (abs <= e50.k0(80.0f) || !this.N5) {
                        return;
                    }
                    O6(false);
                    this.v5 = false;
                    return;
                }
                int y7 = ((int) (event.getY() - this.t5)) / e50.k0(20.0f);
                if (this.N5) {
                    if (y7 == 0 && this.M5 == e50.s5) {
                        return;
                    }
                    int i8 = this.M5 + y7;
                    e50.s5 = i8;
                    if (i8 < 0) {
                        e50.s5 = 0;
                    }
                    if (e50.s5 > 100) {
                        e50.s5 = 100;
                    }
                    o50.p2(this, getString(R.string.scroll_speed) + " " + (100 - e50.s5) + "%");
                    Zd();
                    return;
                }
                this.Y5 = true;
                return;
            }
            return;
        }
        if (this.N5) {
            return;
        }
        this.Y5 = false;
    }

    private Message O5() {
        MotionEvent motionEvent = this.r9;
        MotionEvent obtain = motionEvent == null ? MotionEvent.obtain(0L, 0L, 0, 0.0f, 0.0f, 0) : MotionEvent.obtain(motionEvent);
        obtain.setLocation(this.u5, obtain.getY());
        return E5(0, this.r9);
    }

    public void O6(boolean start) {
        if (wf(3) && this.C9 == null) {
            P6(start, true);
        }
    }

    public void O7(String errMsg, boolean clearLastFile) {
        f50 f50Var;
        if (clearLastFile) {
            e50.V1 = "";
        }
        if (errMsg == null && ((f50Var = e50.Q1) == null || (errMsg = f50Var.o) == null)) {
            errMsg = getString(R.string.invalid_file);
        }
        boolean z7 = errMsg.indexOf(".OutOfMemoryError") != -1;
        new m.c(this).z(getString(R.string.error)).m(errMsg).v(R.string.ok, new h(z7)).t(new g(z7)).C();
    }

    private boolean O9() {
        View view = this.p7;
        if (view == null || view.getVisibility() != 0) {
            return false;
        }
        this.p7.setVisibility(8);
        this.s7.setImageDrawable(null);
        if (this.r7.isChecked()) {
            int i8 = this.v7;
            if (i8 == 0) {
                e50.Q2 = false;
            }
            if (i8 == 1) {
                e50.N2 = false;
            }
        }
        return true;
    }

    private boolean Oa() {
        f50 f50Var;
        if (q8() != 1) {
            return q8() == 100 && (f50Var = e50.Q1) != null && f50Var.y();
        }
        return true;
    }

    private boolean Ob(int offset) {
        com.flyersoft.staticlayout.l layout = this.R1.getLayout();
        if (layout == null || this.R1.getVisibility() != 0) {
            return false;
        }
        int B = layout.B(offset);
        int C = layout.C(this.T1.getScrollY());
        return B >= C && B <= e50.Q2(this.T1, C);
    }

    public void Oc() {
        if (!e50.qa || this.F2 == null || this.qa == null || Build.CPU_ABI.equals("armeabi-v7a")) {
            return;
        }
        e50.N5("****SAVE PDF DOCUMENT****3");
        e50.qa = false;
        this.qa.I();
        this.Ca = SystemClock.elapsedRealtime();
    }

    private void Od() {
        int scrollY = this.C9.getScrollY();
        this.D9 = scrollY;
        e50.j2 = scrollY;
        Rd();
        this.C8.setVisibility(8);
        P5();
        this.C9.d = e50.j2;
        Tf(this.n5);
    }

    private void Og(int what, int delay) {
        if (this.T8 == null) {
            this.T8 = new c(Looper.getMainLooper());
        }
        this.T8.removeMessages(what);
        Handler handler = this.T8;
        handler.sendMessageDelayed(handler.obtainMessage(what, delay, 0), delay);
    }

    public void Oh() {
        ActivityMain activityMain = ActivityMain.e;
        if (activityMain != null) {
            activityMain.H1(e50.V1);
            if (e50.D7 || e50.E7) {
                ActivityMain activityMain2 = ActivityMain.e;
                if (activityMain2.A2 != null) {
                    activityMain2.i1(false);
                }
            }
        }
    }

    private boolean P4(String cName, String content) {
        if (S.isVipChapter(cName)) {
            return false;
        }
        if (content.length() < 80) {
            return true;
        }
        if (content.length() < 800) {
            if (Html.fromHtml(content).toString().length() < (WB.goodChapterTitle(cName) ? 100 : 50)) {
                return true;
            }
        }
        return false;
    }

    private void P5() {
        if (this.C9 != null) {
            return;
        }
        MRBookView mRBookView = new MRBookView(this);
        this.C9 = mRBookView;
        mRBookView.setFocusableInTouchMode(false);
        sf();
        this.C9.setScrollBarStyle(0);
        this.C9.getSettings().setDefaultTextEncodingName(e50.I9);
        this.C9.getSettings().setJavaScriptEnabled(true);
        this.C9.getSettings().setCacheMode(1);
        this.C9.getSettings().setBuiltInZoomControls(true);
        this.C9.getSettings().setDisplayZoomControls(false);
        Nh(false);
        this.U1.addView(this.C9, new FrameLayout.LayoutParams(-1, -1));
        this.C9.bringToFront();
        va(true);
        this.r2.bringToFront();
        this.y2.bringToFront();
        this.Z1.bringToFront();
    }

    public void P6(boolean start, boolean showHint) {
        if (this.C9 != null) {
            return;
        }
        if (start) {
            ue();
        } else {
            this.O9 = 0;
            this.C1 = System.currentTimeMillis();
        }
        this.Y5 = false;
        if (start) {
            pg(1);
            if (!showHint || !ae()) {
                Kg();
            }
            za(true);
            this.U1.setKeepScreenOn(true);
            e50.P9 = true;
            return;
        }
        this.C4.clear();
        e50.P9 = false;
        if (!Ya()) {
            this.G9 = -1;
            if (showHint && F7()) {
                pe(true);
                ee();
            }
        }
        Timer timer = this.Q7;
        if (timer != null) {
            timer.cancel();
        }
        this.V1.setVisibility(8);
        ScrollImage scrollImage = this.U7;
        if (scrollImage != null) {
            o50.f2(scrollImage.b);
            o50.f2(this.U7.c);
        }
        ScrollImage scrollImage2 = this.U7;
        if (scrollImage2 != null) {
            o50.f2(scrollImage2.d);
        }
        View view = this.X1;
        if (view != null) {
            view.setVisibility(8);
        }
        if (showHint) {
            o50.p2(this, getString(R.string.scroll_cancel));
        }
        this.U1.setKeepScreenOn(e50.h5);
        O9();
        if (!Ya() && !F7()) {
            Og(0, 0);
        }
        this.Y7 = 0L;
    }

    private boolean P7(Spanned spanned, Object o8, String url) {
        if (o50.F1(url)) {
            return false;
        }
        if (e50.Q1 != null && url.startsWith("***")) {
            this.Z5 = url.substring(3);
            Pf();
            return true;
        }
        if (e50.Q1 != null && url.startsWith("?")) {
            return V5(url);
        }
        if (url.startsWith("@@")) {
            return false;
        }
        Vb(url, spanned.subSequence(spanned.getSpanStart(o8), spanned.getSpanEnd(o8)).toString().trim(), 50L);
        return true;
    }

    public String P8() {
        if (Ya()) {
            return o50.O0(rc() + 1, this.qa.k());
        }
        if (Ka()) {
            return "100%";
        }
        if (q8() == 0) {
            return o50.P0(x8(), o8());
        }
        return o50.O0(x8(), o8());
    }

    public void P9() {
        View view = this.r2;
        if (view != null) {
            view.setVisibility(4);
        }
    }

    private boolean Pa(MotionEvent event, boolean forMediaOnly, boolean execute) {
        MRTextView n9;
        float x7;
        int y7;
        com.flyersoft.staticlayout.l layout;
        float width;
        if (Ya() || this.C9 != null || !Oa()) {
            return false;
        }
        try {
            View view = e50.y8;
            ScrollView2 scrollView2 = this.T1;
            if (view != scrollView2) {
                scrollView2 = this.S1;
            }
            n9 = n9();
            int scrollY = scrollView2.getScrollY();
            int paddingLeft = scrollView2.getPaddingLeft();
            int paddingTop = scrollView2.getPaddingTop();
            x7 = event.getX() - paddingLeft;
            y7 = (((int) event.getY()) + scrollY) - paddingTop;
            layout = n9.getLayout();
        } catch (Exception e8) {
            e50.S0(e8);
        }
        if (layout == null) {
            return false;
        }
        int C = layout.C(y7);
        int I = layout.I(C);
        int M = layout.M(C);
        int z7 = layout.z(C);
        if (z7 != 0) {
            com.flyersoft.staticlayout.i A = layout.A(C);
            MRTextView.d K = n9.K(C);
            if (z7 > 0) {
                if (x7 < K.a) {
                    width = x7;
                    if (width != -1.0f && !A.w0) {
                        if (A.y0 != null) {
                            float f8 = y7;
                            float f9 = A.A0;
                            if (f8 >= f9) {
                                if (execute) {
                                    int offsetForHorizontal = A.z0.getOffsetForHorizontal(A.z0.getLineForVertical((int) (f8 - f9)), width);
                                    int i8 = offsetForHorizontal + 2;
                                    int i9 = offsetForHorizontal - 2;
                                    if (i9 < 0) {
                                        i9 = 0;
                                    }
                                    if (i8 > A.y0.length()) {
                                        i8 = A.y0.length();
                                    }
                                    MyUrlSpan[] myUrlSpanArr = (MyUrlSpan[]) ((Spanned) A.y0).getSpans(i9, i8, MyUrlSpan.class);
                                    if (myUrlSpanArr.length > 0) {
                                        return P7((Spanned) A.y0, myUrlSpanArr[0], myUrlSpanArr[0].b());
                                    }
                                    w5(A.y0.toString());
                                    return true;
                                }
                            }
                        }
                        return W5(A.J0, forMediaOnly, execute);
                    }
                }
                width = -1.0f;
                if (width != -1.0f) {
                    if (A.y0 != null) {
                    }
                    return W5(A.J0, forMediaOnly, execute);
                }
            } else {
                if (z7 < 0 && x7 > n9.getWidth() - K.c) {
                    width = x7 - (n9.getWidth() - K.c);
                    if (width != -1.0f) {
                    }
                }
                width = -1.0f;
                if (width != -1.0f) {
                }
            }
        }
        int T = n9.T(C, x7);
        if (T != -1 && M > I) {
            Spanned spanned = n9.getText() instanceof SpannedString ? (SpannedString) n9.getText() : null;
            if (n9.getText() instanceof SpannableStringBuilder) {
                spanned = (SpannableStringBuilder) n9.getText();
            }
            if (spanned != null) {
                Object[] spans = spanned.getSpans(I, M, Object.class);
                String trim = n9.X(C).replace("\n", "").replace("\u3000", "").trim();
                for (Object obj : spans) {
                    if (obj instanceof com.flyersoft.staticlayout.k) {
                        com.flyersoft.staticlayout.k kVar = (com.flyersoft.staticlayout.k) obj;
                        if (kVar.d().getBounds().width() > this.U1.getWidth() / 2 || trim.length() == 1) {
                            return W5(kVar, forMediaOnly, execute);
                        }
                    }
                }
                if (I < T || M > T) {
                    if (I < T) {
                        I = T - 1;
                    }
                    if (M > T) {
                        M = T + 1;
                    }
                    for (Object obj2 : spanned.getSpans(I, M, Object.class)) {
                        if (obj2 instanceof com.flyersoft.staticlayout.k) {
                            return W5((com.flyersoft.staticlayout.k) obj2, forMediaOnly, execute);
                        }
                    }
                }
            }
        }
        return false;
    }

    public void Pb(q50.b cacheItem) {
        int i8;
        int i9 = cacheItem.e;
        f50.e eVar = e50.Q1.h().get(cacheItem.e);
        eVar.f = f50.a;
        eVar.f = e50.Q1.g(i9);
        eVar.h = r1.length();
        int i10 = e50.g2;
        if (i10 == i9) {
            if (this.Da == i10) {
                this.Ha = null;
            }
            this.vb = true;
            Jd();
        } else if (this.Da == i9) {
            new b2().start();
        }
        if (this.rb.size() > 0) {
            int R1 = o50.R1(100) + 100;
            if (Ra() && (i8 = e50.Q1.p.contentDelay) > 200) {
                R1 = o50.R1(i8) + i8;
            }
            this.H1.sendEmptyMessageDelayed(Q0, R1 + (this.Ab <= 0 ? 0 : 200));
        } else if (Ra()) {
            this.H1.sendEmptyMessageDelayed(R0, 0L);
        }
        this.sb = null;
    }

    public void Pc() {
        if (!e50.qa || this.F2 == null || this.qa == null) {
            return;
        }
        if (this.Ca == 0) {
            this.Ca = SystemClock.elapsedRealtime();
        }
        if (SystemClock.elapsedRealtime() - this.Ca < 300000) {
            return;
        }
        e50.N5("****SAVE PDF DOCUMENT****2");
        e50.qa = false;
        this.qa.I();
        this.Ca = SystemClock.elapsedRealtime();
    }

    public void Pe() {
        if (this.C9 != null) {
            Nh(false);
            return;
        }
        com.flyersoft.staticlayout.l layout = this.Q1.getLayout();
        if (layout == null) {
            return;
        }
        pe(false);
        int I = layout.I(layout.C(this.S1.getScrollY()));
        qh(e50.d3);
        kh(I);
        Og(1, 200);
        Td();
    }

    private void Pf() {
        Drawable drawable;
        Drawable drawable2;
        n9().invalidate();
        if (this.Z5.indexOf("<ruby") != -1) {
            WebView webView = new WebView(this);
            int i8 = e50.k3;
            if (e50.B3 && (drawable2 = e50.j9) != null) {
                i8 = o50.e0(drawable2);
            }
            webView.loadDataWithBaseURL("", "<html>" + (!e50.p5() ? "" : MRBookView.a.replace("%BACKGROUND", "background-color:" + o50.s(i8) + com.lygame.aaa.x1.b).replace("%COLOR", o50.s(e50.f3)).replace("%LEFT", "20").replace("%RIGHT", "0").replace("%TOP", "0").replace("%BOTTOM", "0")) + "<body>" + this.Z5 + "<body></html>", jb1.MIME_HTML, "UTF-8", null);
            new m.c(this).B(webView).v(R.string.ok, null).C();
            return;
        }
        CharSequence w02 = e50.w0(Html.fromHtml(this.Z5, e50.Q1.o(), null));
        TextView textView = new TextView(this);
        textView.setId(R.id.childId);
        textView.setText(w02);
        textView.setTextSize(e50.d3);
        textView.setPadding(e50.k0(28.0f), e50.k0(28.0f), e50.k0(28.0f), e50.k0(28.0f));
        ScrollView scrollView = new ScrollView(this);
        scrollView.setLayoutParams(new ViewGroup.LayoutParams(-1, -2));
        e50.U6(textView);
        if (e50.B3 && (drawable = e50.j9) != null) {
            int e02 = o50.e0(drawable);
            textView.setBackgroundColor(e02);
            scrollView.setBackgroundColor(e02);
        } else {
            e50.D6(textView);
            e50.D6(scrollView);
        }
        scrollView.addView(textView, new ViewGroup.LayoutParams(-1, -2));
        this.H1.sendEmptyMessageDelayed(G0, 50L);
        Dialog dialog = new Dialog(this, R.style.dialog_fullscreen);
        this.a6 = dialog;
        dialog.setContentView(scrollView);
        this.a6.setOnDismissListener(new m5());
        this.a6.show();
        if (e50.n5()) {
            scrollView.setVerticalScrollBarEnabled(false);
        }
        scrollView.setOnTouchListener(new n5());
    }

    private boolean Pg() {
        if (!this.zb) {
            return false;
        }
        if (Ra()) {
            new m.c(this).m(e50.W0("\n正在缓存章节, 是否退出? \n(所用书源不支持后台缓存)\n")).w(e50.W0("直接退出"), new q2()).p(e50.W0("查看进度"), new p2()).C();
            return true;
        }
        new m.c(this).m(e50.W0("\n正在缓存章节, 退出后是否继续在后台缓存?\n")).w(e50.W0("继续缓存"), new s2()).p(e50.W0("停止缓存"), new r2()).C();
        return true;
    }

    private void Ph(int scrollY, int height) {
        if (this.H9 == null) {
            this.H9 = new c0(Looper.getMainLooper());
        }
        Handler handler = this.H9;
        handler.sendMessageDelayed(handler.obtainMessage(0, scrollY, height), 100L);
    }

    private boolean Q5(String name) {
        e50.m mVar = e50.O3().get(e50.N3(name));
        if (mVar.f != e50.B3 || mVar.c != e50.f3) {
            return false;
        }
        if (e50.B3) {
            return mVar.e.equals(e50.z3);
        }
        return mVar.d == e50.k3;
    }

    private void Q6() {
        if (e50.P6) {
            ScrollView scrollView = (ScrollView) LayoutInflater.from(this).inflate(R.layout.scroll_event_confirm, (ViewGroup) null);
            CheckBox checkBox = (CheckBox) scrollView.findViewById(R.id.ofNeverAskAgain);
            SeekBar seekBar = (SeekBar) scrollView.findViewById(R.id.pmScrollSpeed);
            seekBar.setProgress(100 - e50.s5);
            Spinner spinner = (Spinner) scrollView.findViewById(R.id.pmScrollMode);
            spinner.setSelection(e50.r5);
            if (Ya()) {
                scrollView.findViewById(R.id.modeLay).setVisibility(8);
            }
            new m.c(this).z(getString(R.string.auto_scroll_control)).B(scrollView).v(R.string.ok, new j6(checkBox, spinner, seekBar)).C();
            return;
        }
        O6(true);
    }

    private int Q7(String aUrl, String file, String id_str, int i8) {
        f50.e eVar = e50.Q1.h().get(i8);
        if (!file.equals("")) {
            String str = eVar.d;
            if (str == null) {
                return -1;
            }
            if (!str.equals(file)) {
                if (!eVar.d.endsWith(com.ksdk.ssds.manager.b.b + file) && !da(file, eVar)) {
                    return -1;
                }
            }
        }
        return r8(i8, o50.v0(file), id_str, aUrl, eVar, null, 0);
    }

    private int Q8() {
        int i8 = e50.s5;
        if (i8 >= 50) {
            return 1;
        }
        return (55 - i8) / 5;
    }

    public void Q9() {
        if (this.Y4 || this.La.getVisibility() == 0) {
            this.H1.removeMessages(a1);
            if (this.j5 == 0 && this.B5 == 1) {
                e50.N5("========force hide txtCache==========");
                this.La.setVisibility(4);
                this.Y4 = false;
                He(false);
                return;
            }
            this.H1.sendEmptyMessageDelayed(a1, 1500L);
        }
    }

    private boolean Qa() {
        if (!nb()) {
            return false;
        }
        if (e50.O6) {
            if (S.isFreeBookUrl(e50.Q1.p.url)) {
                return false;
            }
            if (e50.Q1.p != S.store) {
                return true;
            }
        }
        return e50.o4().contains(e50.Q1.p.siteTag);
    }

    public void Qb(boolean forUpdateCur, boolean showTip, ArrayList<S.WebChapter> chapters) {
        hideProgressDlg();
        if (chapters.size() <= 0) {
            if (forUpdateCur) {
                if (showTip) {
                    o50.p2(this, getString(R.string.gengxinshibai));
                    return;
                }
                return;
            } else {
                o50.n2(this, getString(R.string.huanyuan1) + this.wb.site.name() + getString(R.string.huanyuan2));
                return;
            }
        }
        if (forUpdateCur) {
            int size = chapters.size() - e50.Q1.h().size();
            if (size < 0) {
                if (chapters.size() <= 1 || !showTip) {
                    return;
                }
                o50.n2(this, e50.W0("章节列表已修复, 原章节数" + e50.Q1.h().size() + ", 新章节数" + chapters.size()));
                q50.X(this.wb, false);
                int i8 = e50.g2;
                if (i8 > 0) {
                    e50.g2 = i8 - 1;
                }
                if (e50.g2 > chapters.size() - 1) {
                    e50.g2 = chapters.size() - 1;
                }
                e50.G5(e50.V1);
                this.H1.postDelayed(this, 10L);
                return;
            }
            if (size == 0) {
                int size2 = chapters.size() - 1;
                if (chapters.get(size2).name.equals(e50.Q1.h().get(size2).c)) {
                    if (showTip) {
                        o50.p2(this, getString(R.string.meiyouxinzhangjie));
                        return;
                    }
                    return;
                } else {
                    q50.X(this.wb, false);
                    e50.G5(e50.V1);
                    o50.p2(this, e50.W0("章节列表已更新"));
                    return;
                }
            }
            if (size > 0) {
                ActivityMain.e0 = true;
                q50.X(this.wb, false);
                e50.G5(e50.V1);
                cg(0);
                if (showTip) {
                    o50.n2(this, getString(R.string.xinzeng) + size + getString(R.string.xinzheng2) + chapters.get(chapters.size() - 1).name);
                    return;
                }
                o50.q2(this, getString(R.string.xinzeng) + size + getString(R.string.xinzheng2) + chapters.get(chapters.size() - 1).name, 1);
                return;
            }
            return;
        }
        if (chapters.size() > e50.g2) {
            Wg(chapters);
            return;
        }
        new m.c(this).m(Html.fromHtml(e50.W0("当前章节是<b>\"" + e50.Q1.h().get(e50.g2).c + "\"</b>, 所选书源<b>\"" + this.wb.site.name() + "\"</b>章节数总共<b>只有" + chapters.size() + "章</b>, 是否仍切换过去?"))).v(R.string.ok, new k2()).o(R.string.cancel, null).d(false).C();
    }

    public void Qd(g50.f note) {
        if (note == null) {
            return;
        }
        if (!e50.g6(note)) {
            e50.e6();
        }
        MRTextView n9 = n9();
        n9.P0 = -1;
        J9();
        if (!o50.F1(note.l)) {
            e50.u0(note.l);
        }
        n9.postInvalidate();
        Td();
    }

    private void Qe(boolean topLayHeightOnly) {
        int i8;
        int i9;
        ff();
        int i10 = 0;
        if (topLayHeightOnly) {
            if (this.v8 == -1) {
                this.v8 = this.r2.getPaddingTop();
            }
            int paddingBottom = this.r2.getPaddingBottom();
            int paddingLeft = this.r2.getPaddingLeft();
            i9 = this.r2.getPaddingRight();
            i8 = paddingBottom;
            i10 = paddingLeft;
        } else {
            i8 = 0;
            i9 = 0;
        }
        if (!e50.f5) {
            if (!topLayHeightOnly) {
                getWindow().clearFlags(2048);
                getWindow().clearFlags(1024);
                return;
            } else {
                eh(i10, this.v8, i9, i8);
                return;
            }
        }
        if (!topLayHeightOnly) {
            getWindow().addFlags(1024);
        } else {
            eh(i10, this.v8 + this.w8, i9, i8);
        }
        if (!e50.E2 || Build.VERSION.SDK_INT < 21) {
            return;
        }
        getWindow().addFlags(2048);
        getWindow().addFlags(Integer.MIN_VALUE);
    }

    public void Qg() {
        DownloadTaskBrowser.CacheWebView cacheWebView = this.ub;
        if (cacheWebView != null) {
            cacheWebView.stop = true;
            S.clearWebView(cacheWebView);
        }
    }

    private boolean Qh() {
        if (this.J4 <= 0) {
            return false;
        }
        if (SystemClock.elapsedRealtime() - this.J4 > 2500) {
            this.J4 = 0L;
        }
        e50.N5("waitingForCahingShots:" + e50.g2 + bf0.COMMA + this.S1.getScrollY());
        return true;
    }

    public void R4() {
        DownloadTaskBrowser.CacheWebView cacheWebView;
        if (this.rb.size() == 0 || this.sb != null) {
            return;
        }
        this.sb = this.rb.get(0);
        this.rb.remove(0);
        Ff(this.sb);
        q50.b bVar = this.sb;
        if (bVar.a != null) {
            q9(bVar);
            return;
        }
        DownloadTask.Result result = new DownloadTask.Result();
        result.callback = new z1();
        if (Ra()) {
            DownloadTaskBrowser.CacheWebView cacheWebView2 = this.ub;
            if (cacheWebView2 == null || cacheWebView2.destroyed) {
                DownloadTaskBrowser.CacheWebView createDownloadWebView = DownloadTaskBrowser.createDownloadWebView();
                this.ub = createDownloadWebView;
                S.BookSite bookSite = e50.Q1.p;
                int i8 = bookSite.contentDelay;
                if (i8 == 0) {
                    i8 = 200;
                }
                createDownloadWebView.delayed = i8;
                createDownloadWebView.contentJs = bookSite.contentJs;
            }
            cacheWebView = this.ub;
            cacheWebView.stop = false;
            cacheWebView.timeout = e50.Q1.p.contentTimeout;
            this.yb.remove(this.sb.b);
        } else {
            cacheWebView = null;
        }
        DownloadTask.download(cacheWebView, result, this.sb.b, null, e50.Q1.p.userAgent);
    }

    private boolean R6(MotionEvent event) {
        if (this.C9 != null) {
            return false;
        }
        DotImageView dotImageView = this.j9;
        if (dotImageView != null && dotImageView.getVisibility() == 0) {
            return false;
        }
        int v32 = e50.v3() / 2;
        if (v32 >= 400) {
            v32 = 400;
        }
        if (Math.abs(event.getY() - this.t5) < 120.0f) {
            if (o9(event) - this.u5 > v32 && p6(true)) {
                return true;
            }
            if (o9(event) - this.u5 < (-v32) && p6(false)) {
                return true;
            }
        }
        int height = this.U1.getHeight() / 2;
        int i8 = height < 400 ? height : 400;
        if (Math.abs(o9(event) - this.u5) < 120.0f) {
            if (event.getY() - this.t5 > i8) {
                int i9 = e50.x4;
                if (i9 != 15) {
                    this.r6 = 1L;
                    this.h6 = true;
                }
                if (j6(i9)) {
                    return true;
                }
            }
            if (event.getY() - this.t5 < (-i8)) {
                int i10 = e50.y4;
                if (i10 != 15) {
                    this.r6 = 1L;
                    this.h6 = true;
                }
                if (j6(i10)) {
                    return true;
                }
            }
        }
        return false;
    }

    public void R7() {
        View inflate = LayoutInflater.from(this).inflate(R.layout.typesetting_export, (ViewGroup) null);
        EditText editText = (EditText) inflate.findViewById(R.id.path);
        CheckBox checkBox = (CheckBox) inflate.findViewById(R.id.cb1);
        CheckBox checkBox2 = (CheckBox) inflate.findViewById(R.id.cb2);
        inflate.findViewById(R.id.pathTv).setVisibility(8);
        String str = !e50.F3.contains(".") ? ".ttf" : "";
        String str2 = e50.c3 + com.ksdk.ssds.manager.b.b + e50.F3 + str;
        if (o50.A1(str2)) {
            checkBox.setText(checkBox.getText().toString() + "\n(" + e50.F3 + str + " " + e50.h1(o50.o0(str2)) + ")");
        }
        new m.c(this).z(e50.W0("导出配色方案")).B(inflate).w(e50.W0("导出"), new x2(editText, checkBox, checkBox2)).p(e50.W0("导出并分享"), new w2(editText, checkBox, checkBox2)).C();
    }

    private void R8() {
        SharedPreferences sharedPreferences = getSharedPreferences(e50.r0, 0);
        String lowerCase = com.flyersoft.components.a.j(e50.V1.toLowerCase(), true).toLowerCase();
        String str = "0";
        if (sharedPreferences.contains(lowerCase)) {
            str = sharedPreferences.getString(lowerCase, "0");
            this.G1 = true;
        } else {
            this.G1 = false;
            Iterator<String> it = sharedPreferences.getAll().keySet().iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                String next = it.next();
                if (next.endsWith(com.ksdk.ssds.manager.b.b + o50.v0(lowerCase))) {
                    str = sharedPreferences.getString(next, "0");
                    this.G1 = true;
                    break;
                }
            }
        }
        e50.U2(str);
        e50.N5("#loadPosition:" + str + ", " + e50.f2);
        if (e50.g7) {
            if (sharedPreferences.contains(lowerCase + 2)) {
                e50.j2 = sharedPreferences.getInt(lowerCase + 2, 0);
            }
        }
    }

    private void R9() {
        e50.A0(e50.Q1.p.siteTag);
        StoreWebView storeWebView = this.Jb;
        if (storeWebView != null) {
            storeWebView.stopLoading();
            this.Jb.clearHistory();
            this.Jb.setVisibility(8);
        }
    }

    public boolean Ra() {
        S.BookSite bookSite = e50.Q1.p;
        return bookSite.javascriptContent || (bookSite.primary() && S.getForceWebSites().contains(e50.Q1.p.siteTag));
    }

    private void Rc() {
        if (this.d8 || this.c8) {
            return;
        }
        try {
            float viewGetRatio = this.F2.b.viewGetRatio();
            f.c viewGetPos = this.F2.b.viewGetPos();
            if (!this.F2.c) {
                e50.f2 = viewGetPos.a;
            }
            String str = "" + viewGetRatio + "#" + viewGetPos.b + ":" + viewGetPos.c + "@" + e50.t3;
            SharedPreferences.Editor putString = getSharedPreferences(e50.r0, 0).edit().putString(e50.V1.toLowerCase(), "" + e50.f2 + ":" + P8());
            StringBuilder sb = new StringBuilder();
            sb.append(e50.V1.toLowerCase());
            sb.append("pdf");
            putString.putString(sb.toString(), str).commit();
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    private void Rd() {
        MRBookView mRBookView = this.C9;
        if (mRBookView == null) {
            return;
        }
        mRBookView.setVisibility(8);
        this.U1.removeView(this.C9);
        this.C9.destroy();
        this.C9 = null;
        if (kg()) {
            this.C8.setVisibility(0);
        }
    }

    private void Re() {
        int i8 = e50.s3;
        int i9 = 0;
        Global.n = i8 == 0 ? 2 : i8 == 1 ? 1 : 0;
        if (e50.u3 && e50.g5()) {
            Global.m = 4;
            return;
        }
        int i10 = e50.r3;
        if (i10 != 0 ? i10 == 1 : !e50.g5()) {
            i9 = 3;
        }
        Global.m = i9;
    }

    public void Rf(final f50.f fn) {
        this.Z5 = "<h3>" + fn.b + "</h3>" + fn.c;
        Pf();
    }

    public boolean Rg(MotionEvent event) {
        if (this.j5 > 0) {
            return true;
        }
        return (Ya() && event.getPointerCount() > 1) || Math.abs(event.getY() - this.t5) > ((float) e50.k0(10.0f)) || Math.abs(o9(event) - this.u5) > ((float) e50.k0(10.0f));
    }

    private boolean Rh() {
        MRBookView mRBookView = this.C9;
        if (mRBookView == null) {
            return false;
        }
        int scrollX = mRBookView.getScrollX();
        int scrollY = this.C9.getScrollY();
        if (e50.M3) {
            if (scrollX <= 0) {
                if (e50.Q1 != null && e50.g2 < e50.Q1.h().size() - 1) {
                    this.C9.e = 0;
                    i7();
                }
            } else {
                MRBookView mRBookView2 = this.C9;
                mRBookView2.scrollTo(scrollX - (mRBookView2.getWidth() - this.F9), scrollY);
            }
        } else if (this.C9.getHeight() + scrollY >= this.C9.getContentHeight2()) {
            if (e50.Q1 != null && e50.g2 < e50.Q1.h().size() - 1) {
                this.C9.d = 0;
                i7();
            }
        } else {
            MRBookView mRBookView3 = this.C9;
            mRBookView3.scrollTo(scrollX, (scrollY + mRBookView3.getHeight()) - this.F9);
        }
        return true;
    }

    private int S4(String url) {
        if (this.rb == null) {
            this.rb = new ArrayList<>();
        }
        for (int i8 = 0; i8 < this.rb.size(); i8++) {
            if (this.rb.get(i8) != null && url.equals(this.rb.get(i8).b)) {
                return i8;
            }
        }
        return -1;
    }

    private void S5(Message msg) {
        if (!kb() && !Na()) {
            if (this.I4 == null) {
                this.I4 = new w4(Looper.getMainLooper());
            }
            this.I4.sendMessage(msg);
            return;
        }
        E9(msg);
    }

    private void S6(MotionEvent event) {
        boolean z7;
        if (S9()) {
            return;
        }
        if (this.L2) {
            za(true);
            return;
        }
        if (this.X5 != -1 && SystemClock.elapsedRealtime() - this.X5 < 100) {
            return;
        }
        this.X5 = SystemClock.elapsedRealtime();
        if (e50.P9) {
            boolean z8 = !this.Y5;
            this.Y5 = z8;
            if (z8) {
                o50.p2(this, getString(R.string.pause));
                return;
            }
            return;
        }
        if (e50.O9) {
            y7(this.z7);
            if (this.J7) {
                o50.p2(this, getString(R.string.pause));
                return;
            }
            return;
        }
        if (this.B6) {
            if (Ta(event)) {
                za(false);
                return;
            }
            return;
        }
        if (ib(event, true) || s5(event)) {
            return;
        }
        int t8 = t8(event);
        if (t8 != 0) {
            if (t8 == 1) {
                if (this.L2) {
                    za(true);
                }
                if (e50.O5 && e50.e4 == 0) {
                    return;
                }
                H6(1);
                return;
            }
            if (t8 == 2) {
                if (this.L2) {
                    za(true);
                }
                if (e50.O5 && e50.e4 == 0) {
                    return;
                }
                H6(2);
                return;
            }
            if (t8 == 3) {
                if (this.L2) {
                    za(true);
                }
                if (e50.O5 && e50.e4 == 0) {
                    return;
                }
                H6(3);
                return;
            }
            if (t8 != 4) {
                return;
            }
            if (this.L2) {
                za(true);
            }
            if (e50.O5 && e50.e4 == 0) {
                return;
            }
            H6(4);
            return;
        }
        if (eb()) {
            w7(true);
            PDFReader pDFReader = this.F2;
            if (pDFReader == null || pDFReader.c) {
                z7 = B7();
                if (z7) {
                    za(false);
                    return;
                }
                return;
            }
        }
        z7 = false;
        if (z7) {
        }
    }

    public boolean S7(String filename, boolean includeFont, boolean includeMargins) {
        StringBuilder sb = new StringBuilder();
        StringBuilder sb2 = new StringBuilder();
        sb2.append(e50.B3 ? "*pic" : "*color");
        sb2.append("\n");
        sb.append(sb2.toString());
        StringBuilder sb3 = new StringBuilder();
        sb3.append(e50.B3 ? e50.z3 : Integer.valueOf(e50.k3));
        sb3.append("\n");
        sb.append(sb3.toString());
        sb.append(e50.f3 + "\n");
        if (includeFont) {
            sb.append("*font\n");
            sb.append(e50.F3 + "\n");
            sb.append(e50.H3 + "\n");
            sb.append(e50.G3 + "\n");
            sb.append(e50.K3 + "\n");
            sb.append(e50.L3 + "\n");
            sb.append(e50.I3 + "\n");
            sb.append(e50.J3 + "\n");
        }
        if (includeMargins) {
            sb.append("*margin\n");
            sb.append(e50.X3 + "\n");
            sb.append(e50.Y3 + "\n");
            sb.append(e50.Z3 + "\n");
            sb.append(e50.c4 + "\n");
            sb.append(e50.d4 + "\n");
            sb.append(e50.a4 + "\n");
            sb.append(e50.b4 + "\n");
        }
        String str = e50.z + "/typeset";
        if (!o50.i2(str, sb.toString())) {
            return false;
        }
        try {
            ZipOutputStream zipOutputStream = new ZipOutputStream(o50.l0(filename));
            com.flyersoft.components.r.k(zipOutputStream, str, o50.v0(str));
            if (e50.B3 && e50.z3.startsWith(com.ksdk.ssds.manager.b.b) && o50.A1(e50.z3)) {
                com.flyersoft.components.r.k(zipOutputStream, e50.z3, "pic" + o50.k0(e50.z3));
            }
            String str2 = e50.c3 + com.ksdk.ssds.manager.b.b + e50.F3 + (!e50.F3.contains(".") ? ".ttf" : "");
            if (includeFont && o50.A1(str2)) {
                com.flyersoft.components.r.k(zipOutputStream, str2, "font.ttf");
            }
            zipOutputStream.finish();
            zipOutputStream.close();
            return true;
        } catch (Exception e8) {
            e50.S0(e8);
            return false;
        }
    }

    private int S8() {
        g50.h e02 = g50.e0(e50.V1);
        long j8 = 600000;
        if (System.currentTimeMillis() - this.C1 > j8) {
            ue();
        }
        long j9 = e02.b;
        if (j9 > j8) {
            return (int) (((float) e02.c) / ((((float) j9) / 60.0f) / 1000.0f));
        }
        long j10 = e50.T4;
        if (j10 > j8) {
            return (int) (((float) e50.S4) / ((((float) j10) / 60.0f) / 1000.0f));
        }
        return e50.H8 ? 400 : 220;
    }

    private boolean Sa(com.flyersoft.staticlayout.k sp, boolean playMedia) {
        String g8 = sp.g();
        if (!g8.equals("#audio#null") && !g8.startsWith("#video#null")) {
            if (g8.startsWith("#audio#")) {
                if (playMedia) {
                    if (!g8.startsWith("#audio#http") && !g8.startsWith("#audio#rtsp")) {
                        e50.Q1.j(g8, 0);
                        String str = e50.z + com.ksdk.ssds.manager.b.b + o50.v0(e50.V1) + com.ksdk.ssds.manager.b.b + o50.v0(g8).replace("#audio#", "");
                        if (o50.A1(str)) {
                            pd(str);
                        }
                    } else {
                        pd(g8.substring(7));
                    }
                }
                return true;
            }
            if (!g8.startsWith("#video#")) {
                return false;
            }
            if (playMedia) {
                if (g8.startsWith("#video#http")) {
                    rd(g8.substring(7));
                } else {
                    e50.Q1.j(g8, 0);
                    String str2 = e50.z + com.ksdk.ssds.manager.b.b + o50.v0(e50.V1) + com.ksdk.ssds.manager.b.b + o50.v0(g8).replace("#video#", "");
                    if (o50.A1(str2)) {
                        rd(str2);
                    }
                }
            }
            return true;
        }
        o50.p2(this, com.ksdk.ssds.manager.b.p);
        return true;
    }

    private boolean Sb(final String tagUrl, boolean reload) {
        if (reload) {
            this.n5 = e50.x(this.n5);
        }
        if (e50.U5()) {
            if (Tb(this.n5, 0, tagUrl)) {
                return true;
            }
        } else {
            for (int i8 = 0; i8 < e50.G9.size(); i8++) {
                if (Tb(e50.G9.get(i8), i8, tagUrl)) {
                    return true;
                }
            }
        }
        if (reload) {
            ph(com.flyersoft.staticlayout.j.c(this.n5, this.m5, -1));
        }
        return false;
    }

    private void Sc() {
        try {
            if (this.ua == null) {
                this.ua = new ArrayList<>();
            }
            if (this.F2.n0.indexOf(Integer.valueOf((int) e50.f2)) == -1) {
                this.F2.n0.add(Integer.valueOf((int) e50.f2));
            }
            Iterator<Integer> it = this.F2.n0.iterator();
            while (it.hasNext()) {
                int intValue = it.next().intValue();
                if (this.ua.indexOf(Integer.valueOf(intValue)) == -1) {
                    this.ua.add(Integer.valueOf(intValue));
                    e50.R4++;
                    String sc = sc(intValue);
                    if (sc.length() > 0) {
                        Tc(sc);
                    }
                }
            }
            this.F2.n0.clear();
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    private void Sd() {
        if (e50.C2 && e50.B2 && !e50.g5()) {
            Bundle extras = getIntent().getExtras();
            if (extras == null || !extras.getBoolean("restartReaderIntent")) {
                boolean z7 = (getResources().getConfiguration().screenLayout & 15) < 3;
                boolean z8 = e50.A2;
                if (z7 && z8) {
                    e50.A2 = false;
                } else {
                    if (z7 || z8) {
                        return;
                    }
                    e50.A2 = true;
                }
            }
        }
    }

    public void Se(boolean visible) {
        e50.da = this.K5;
        if (visible) {
            this.c9.setBackgroundResource(e50.p5() ? R.drawable.hbar : R.drawable.hbar2);
            int i8 = e50.p5() ? -1118482 : -10395295;
            this.d9.setTextColor(i8);
            this.e9.setTextColor(i8);
            this.f9.setTextColor(i8);
            this.g9.setTextColor(i8);
            this.h9.setTextColor(i8);
            if (this.n9.getVisibility() == 8 && this.d9.getLeft() > 0) {
                this.m9.requestLayout();
            }
        }
        e50.H7(this.c9, visible ? 0 : 4);
    }

    private boolean Sg(View v7, MotionEvent event) {
        if (Ya() && (this.za || SystemClock.elapsedRealtime() - this.Ba < 500)) {
            return true;
        }
        if (Ya() && PDFReader.a != -1 && event.getAction() == 1) {
            PDFReader.a = -1;
            return true;
        }
        if (e50.P9 || v7 == this.V1) {
            O4(event);
        }
        if (this.L2) {
            za(true);
            return true;
        }
        if (e50.O9) {
            if (this.I7) {
                if (event.getAction() == 1) {
                    rg(false);
                    if (this.J7) {
                        he();
                    }
                }
                return true;
            }
            Jg(event);
        }
        ViewGroup viewGroup = this.y2;
        if (viewGroup != null && viewGroup.getVisibility() == 0) {
            Af(-1);
            return true;
        }
        int action = event.getAction();
        if (action == 0) {
            this.S4 = false;
            mf(true);
            this.K5 = e50.da;
            e50.da = false;
            this.h6 = false;
            this.l6 = 0;
            this.W4 = 0.0f;
            this.m6 = SystemClock.elapsedRealtime();
            this.u5 = o9(event);
            this.t5 = event.getY();
            this.F5 = -1.0f;
            this.E5 = -1.0f;
            this.D5 = -1.0f;
            this.H5 = false;
            this.T5 = -1.0f;
            this.U5 = -1.0f;
            this.w5 = false;
            this.J5 = false;
            Hd();
        } else if (action == 1) {
            mf(false);
            Hd();
            this.A9 = false;
            if (this.J5) {
                this.J5 = false;
                this.A5 = false;
                o6(null, -1, -1, true);
                e50.h7 = true;
                return true;
            }
            if (this.e8) {
                this.e8 = false;
                Xe();
            }
        } else if (action == 2) {
            if (this.Y5 && !this.N5) {
                if (cb()) {
                    int y7 = (int) event.getY();
                    this.R7 = y7;
                    ScrollImage scrollImage = this.U7;
                    scrollImage.a = y7;
                    scrollImage.invalidate();
                }
                return cb();
            }
            this.l6++;
            f.EnumC1090f enumC1090f = e50.ra;
            f.EnumC1090f enumC1090f2 = f.EnumC1090f.sta_sel;
            if (enumC1090f == enumC1090f2) {
                this.A9 = true;
            }
            if (this.A9) {
                if (e50.ra != enumC1090f2) {
                    ze(event.getY());
                    xe(true);
                }
                if ((Math.abs(o9(event) - this.u5) > e50.k0(24.0f) || Math.abs(event.getY() - this.t5) > e50.k0(16.0f)) && e50.D3) {
                    this.J5 = true;
                }
                if (e50.E3) {
                    this.a2.f = true;
                    this.c9.a(event);
                }
                return true;
            }
            if (Ba()) {
                return true;
            }
            if (!Ha()) {
                I4();
            }
        }
        return false;
    }

    private boolean Sh() {
        MRBookView mRBookView = this.C9;
        if (mRBookView == null) {
            return false;
        }
        int scrollX = mRBookView.getScrollX();
        int scrollY = this.C9.getScrollY();
        if (e50.M3) {
            if (this.C9.getWidth() + scrollX >= this.C9.getContentWidth2()) {
                if (e50.Q1 != null && e50.g2 > 0) {
                    this.C9.e = -1;
                    q7();
                    return true;
                }
                if (!this.C9.canGoBack()) {
                    return true;
                }
                this.C9.goBack();
                return true;
            }
            MRBookView mRBookView2 = this.C9;
            mRBookView2.scrollTo(scrollX + (mRBookView2.getWidth() - this.F9), scrollY);
            return true;
        }
        if (scrollY <= 0) {
            if (e50.Q1 != null && e50.g2 > 0) {
                this.C9.d = -1;
                q7();
                return true;
            }
            if (!this.C9.canGoBack()) {
                return true;
            }
            this.C9.goBack();
            return true;
        }
        MRBookView mRBookView3 = this.C9;
        mRBookView3.scrollTo(scrollX, scrollY - (mRBookView3.getHeight() - this.F9));
        return true;
    }

    private boolean T4(String text) {
        if (!C9()) {
            return false;
        }
        try {
            Intent intent = new Intent();
            intent.setAction("android.intent.action.VIEW");
            intent.setPackage("com.google.android.apps.translate");
            intent.setData(new Uri.Builder().scheme(rv.a).authority("translate.google.com").path("/m/translate").appendQueryParameter("q", text).appendQueryParameter("tl", e50.i6).appendQueryParameter("sl", e50.h6).build());
            startActivity(intent);
            return true;
        } catch (Exception e8) {
            e50.S0(e8);
            return false;
        }
    }

    private void T7() {
    }

    private int T8() {
        return this.Q1.getRealLineCount();
    }

    public boolean Ta(MotionEvent event) {
        if (event == null) {
            event = this.q9;
        }
        int width = this.U1.getWidth();
        int height = this.U1.getHeight();
        float o9 = o9(event);
        float y7 = event.getY();
        float f8 = width / 3;
        if (o9 > f8) {
            float f9 = (width * 2) / 3;
            if (o9 < f9) {
                float f10 = height / 3;
                if (y7 > f10) {
                    float f11 = (height * 2) / 3;
                    if (y7 < f11) {
                        float f12 = this.u5;
                        if (f12 > f8 && f12 < f9) {
                            float f13 = this.t5;
                            if (f13 > f10 && f13 < f11) {
                                return true;
                            }
                        }
                    }
                }
            }
        }
        return false;
    }

    private boolean Tb(String html, int splitIndex, String tagUrl) {
        String str = "@@" + tagUrl;
        String str2 = "(<a href=\"" + str + "\">#</a>)";
        String str3 = "<a name=\"" + tagUrl + "\"></a>";
        if (html.indexOf(str3) == -1) {
            str3 = "<a name='" + tagUrl + "'></a>";
            if (html.indexOf(str3) == -1) {
                str3 = "<a name=" + tagUrl + "></a>";
                if (html.indexOf(str3) == -1) {
                    str3 = "<a name=\"" + tagUrl + "\">";
                    if (html.indexOf(str3) == -1) {
                        str3 = "<a name=" + tagUrl + ">";
                        if (html.indexOf(str3) == -1) {
                            str3 = "<a id='" + tagUrl + "'></a>";
                            if (html.indexOf(str3) == -1) {
                                str3 = "<a id=\"" + tagUrl + "\"></a>";
                                if (html.indexOf(str3) == -1) {
                                    str3 = "<a id=" + tagUrl + "></a>";
                                    if (html.indexOf(str3) == -1) {
                                        str3 = "<a id=\"" + tagUrl + "\">";
                                        if (html.indexOf(str3) == -1) {
                                            str3 = "<a id=" + tagUrl + ">";
                                            if (html.indexOf(str3) == -1) {
                                                return false;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        String replace = html.replace(str3, str2);
        Spanned c8 = com.flyersoft.staticlayout.j.c(replace, this.m5, -1);
        for (MyUrlSpan myUrlSpan : (MyUrlSpan[]) c8.getSpans(0, c8.length(), MyUrlSpan.class)) {
            if (myUrlSpan.b().equals(str)) {
                this.n5 = replace;
                ph(c8);
                e50.h2 = splitIndex;
                hh(c8.getSpanStart(r4));
                return true;
            }
        }
        return false;
    }

    private void Tc(String text) {
        int l12 = o50.l1(text, e50.H8);
        e50.S4 += l12;
        this.O9 += l12;
    }

    public void Te(boolean trash) {
        if (trash) {
            this.n9.setImageResource(e50.p5() ? R.drawable.trash : R.drawable.trash2);
            this.n9.setOnLongClickListener(new o());
        } else {
            this.n9.setImageResource(R.drawable.pen);
            this.n9.setOnLongClickListener(null);
        }
    }

    public void Tf(String html) {
        String str;
        this.C8.setVisibility(8);
        P5();
        if (!this.O2) {
            MRBookView mRBookView = this.C9;
            int i8 = e50.j2;
            mRBookView.e = i8;
            mRBookView.d = i8;
        }
        int i9 = this.D9;
        if (i9 != -1 && this.E9 == e50.g2) {
            this.C9.d = i9;
            this.D9 = -1;
            this.E9 = -1;
        }
        this.C9.clearHistory();
        if (nb() && e50.Q1.h().get(e50.g2).s != null) {
            MRBookView mRBookView2 = this.C9;
            f50 f50Var = e50.Q1;
            Eb(mRBookView2, f50Var.p, f50Var.h().get(e50.g2).s);
            return;
        }
        MRBookView.c = null;
        if (q8() == 1) {
            this.C9.loadUrl("file://" + e50.V1);
            return;
        }
        if (Oa() && e50.Q1.h().size() != 0) {
            if (e50.g2 >= e50.Q1.h().size()) {
                e50.g2 = e50.Q1.h().size() - 1;
            }
            f50.e eVar = e50.Q1.h().get(e50.g2);
            MRBookView.c = eVar.u;
            WebSettings settings = this.C9.getSettings();
            if (eVar.m == null && (str = eVar.d) != null && str.length() > 0 && !eVar.d.endsWith(".xml") && !eVar.d.endsWith(".xhtml") && eVar.e.size() <= 1) {
                if (settings != null && !settings.getDefaultTextEncodingName().equals(e50.I9)) {
                    settings.setDefaultTextEncodingName(e50.I9);
                }
                this.C9.e(e50.V1, eVar.d);
            } else {
                o50.i2(e50.A, "<html>" + html + "</html>");
                if (settings != null && !settings.getDefaultTextEncodingName().equals("UTF-8")) {
                    settings.setDefaultTextEncodingName("UTF-8");
                }
                this.C9.e(e50.V1, e50.A);
            }
            bg();
            this.C9.clearHistory();
        }
    }

    private boolean Th() {
        return this.C9 != null;
    }

    private boolean U4(int id) {
        String str;
        if (e50.j0(id)) {
            return true;
        }
        f50.e eVar = e50.Q1.h().get(id);
        b.c e8 = com.flyersoft.staticlayout.j.e("body", eVar.w, eVar.v, eVar, null, null);
        if (eVar.x != null) {
            b.c cVar = new b.c(e8);
            cVar.l(eVar.x);
            e8 = cVar;
        }
        if (e8 == null) {
            return false;
        }
        int i8 = e8.e;
        if (i8 > 1 && i8 != MRTextView.v0) {
            return true;
        }
        String str2 = e8.s;
        if (str2 != null && ((str = e50.S8) == null || !str.equals(str2))) {
            return true;
        }
        float f8 = e8.q;
        if (f8 > 0.0f && f8 != 1.0f && f8 != this.K9.floatValue()) {
            return true;
        }
        String str3 = e8.J;
        if (!o50.F1(str3) && str3 != this.J9) {
            int indexOf = str3.indexOf("(");
            int indexOf2 = str3.indexOf(")");
            if (indexOf != -1 && indexOf2 > indexOf) {
                if (e50.Q1.j(str3.substring(indexOf + 1, indexOf2), 0) != null) {
                    return true;
                }
            }
        }
        return false;
    }

    private void U5(boolean saveTempThemeOnly) {
        int M3 = e50.M3("2");
        int M32 = e50.M3(e50.Z8);
        int Y1 = e50.Y1();
        if (saveTempThemeOnly) {
            if (Y1 == M3 || Y1 == M32) {
                return;
            }
            e50.w6(e50.b9, true);
            return;
        }
        if (Y1 != M3 && Y1 != M32) {
            e50.w6(e50.b9, true);
            Cb(e50.Z8, e50.B6);
        } else if (Y1 == M32) {
            Cb("2", e50.B6);
        } else if (Y1 == M3) {
            int M33 = e50.M3(e50.b9);
            if (M33 != M3 && M33 != M32) {
                Cb(e50.b9, e50.B6);
            } else {
                Cb(e50.Z8, e50.B6);
            }
        }
        Me(true);
    }

    public void U7(MRTextView tv, int toY) {
        int h32;
        int height;
        if (toY != 0 && (height = tv.getHeight() - toY) < (h32 = e50.h3())) {
            int i8 = h32 - height;
            int lineHeight = tv.getLineHeight();
            int i9 = i8 / lineHeight;
            if (i8 % lineHeight > 0) {
                i9++;
            }
            tv.p(i9);
        }
    }

    public void U9(int start, int end) {
        V9(this.Q1, start, end);
        if (F7()) {
            V9(this.R1, start, end);
        }
        if (!this.z1 && e50.fa) {
            this.a2.postInvalidate();
        }
        if (e50.O9 || start < 0 || start >= this.Q1.getText().length()) {
            return;
        }
        char charAt = this.Q1.getText().charAt(start);
        e50.N5("[" + charAt + "]ASCII:" + (charAt + 0) + " CharacterType:" + Character.getType(charAt) + " UnicodeBlock:" + Character.UnicodeBlock.of(charAt));
    }

    private boolean Ua(MotionEvent event) {
        int C;
        int T;
        long j8;
        boolean z7 = false;
        if (Za() || e50.G2().size() == 0 || o9(event) > this.a2.getWidth() - this.S1.getPaddingRight()) {
            return false;
        }
        View view = e50.y8;
        ScrollView2 scrollView2 = this.T1;
        if (view != scrollView2) {
            scrollView2 = this.S1;
        }
        MRTextView n9 = n9();
        int scrollY = scrollView2.getScrollY();
        int paddingLeft = scrollView2.getPaddingLeft();
        int paddingTop = scrollView2.getPaddingTop();
        float x7 = event.getX() - paddingLeft;
        int y7 = (((int) event.getY()) + scrollY) - paddingTop;
        com.flyersoft.staticlayout.l layout = n9.getLayout();
        if (layout == null || (T = n9.T((C = layout.C(y7)), x7)) == -1) {
            return false;
        }
        if (T < n9.getText().length() && n9.getText().charAt(T) == '\n') {
            return false;
        }
        long j9 = T;
        if (q8() == 0) {
            j8 = e50.d4(j9);
            if (j8 == -1) {
                return false;
            }
        } else {
            j8 = j9;
        }
        g50.f l32 = e50.l3(T);
        this.z9 = l32;
        if (l32 == null) {
            return false;
        }
        if (e50.y8 == this.T1 && this.R1.getVisibility() != 0) {
            return false;
        }
        int i8 = (int) (q8() == 0 ? j9 - (j8 - this.z9.f) : this.z9.f);
        if (this.z9.k.length() > 0 && Math.abs(n9.h0(C, i8) - x7) < e50.k0(26.0f)) {
            f7(this.z9);
            z7 = true;
        }
        if (!z7) {
            W9(true, i8, this.z9.g + i8);
        }
        return true;
    }

    private void Ub(final String packageName) {
        new m.c(this).l(R.string.dict_install).v(R.string.ok, new w(packageName)).o(R.string.cancel, null).C();
    }

    public void Uc(boolean forward) {
        String obj = this.ka.getText().toString();
        e50.O7 = obj;
        String str = this.la;
        if (str != null && obj.compareTo(str) == 0) {
            this.F2.y(forward ? 1 : -1);
        } else if (e50.O7.length() > 0) {
            String str2 = e50.O7;
            this.la = str2;
            this.F2.z(str2, e50.S7, e50.T7);
            this.F2.y(forward ? 1 : -1);
        }
    }

    private void Ue(int v7) {
        this.n9.setVisibility(v7);
        findViewById(R.id.penSplit).setVisibility(v7);
    }

    private boolean V4(f50.e c8) {
        if (c8.e.size() == 0) {
            return true;
        }
        if (c8.e.size() != 1) {
            return false;
        }
        String str = c8.d;
        String str2 = c8.e.get(0);
        return str.endsWith(str2) || str2.endsWith(str);
    }

    private boolean V5(String url) {
        if (url.startsWith("??")) {
            String substring = url.substring(2, url.length());
            try {
                int size = e50.Q1.h().size() - 1;
                while (size >= 0) {
                    String g8 = e50.Q1.g(size);
                    int indexOf = g8.indexOf("id=\"" + substring + "\"");
                    if (indexOf != -1) {
                        indexOf = g8.lastIndexOf("<", indexOf);
                    }
                    if (indexOf != -1) {
                        int length = com.flyersoft.staticlayout.j.c(g8.substring(0, indexOf), this.m5, e50.g2).toString().length();
                        re(true);
                        ke(e50.g2, e50.h2, this.n5);
                        boolean z7 = e50.g2 == size;
                        e50.g2 = size;
                        e50.f2 = length;
                        if (z7) {
                            com.flyersoft.staticlayout.l layout = this.Q1.getLayout();
                            nh(layout.J(layout.B((int) e50.f2)));
                        } else {
                            Of(e50.g2, 0, e50.f2, true);
                        }
                        zb();
                        Td();
                        hideProgressDlg();
                    }
                    size--;
                }
            } catch (Exception e8) {
                e50.S0(e8);
            } catch (OutOfMemoryError e9) {
                e50.S0(e9);
            }
            return true;
        }
        f50.f l8 = e50.Q1.l(url.substring(1, url.length()));
        n9().invalidate();
        if (l8 == null) {
            return false;
        }
        Rf(l8);
        return true;
    }

    public void V6() {
        boolean z7;
        boolean z8;
        View view;
        if (this.Y5) {
            return;
        }
        if (SystemClock.elapsedRealtime() - this.X7 > 2500) {
            this.X7 = SystemClock.elapsedRealtime();
            z7 = true;
        } else {
            z7 = false;
        }
        int i8 = e50.s5;
        int V8 = V8();
        if (V8 == 0 || V8 == 1) {
            boolean z9 = V8() == 1;
            if (this.T7) {
                N4(1, false);
                this.T7 = false;
                this.U7.a = 0;
            }
            if (z9) {
                int S = this.Q1.S(this.Q1.getLayout().C(this.S1.getScrollY() + this.U7.a + 1));
                int i9 = this.R7;
                if (S > this.Q1.getLineHeight() * 2) {
                    S = this.Q1.getLineHeight();
                }
                this.R7 = i9 + S;
            } else {
                this.R7 += (Q8() * 55) / (55 - (i8 < 50 ? 50 - i8 : 0));
            }
            if (this.R7 > this.U1.getHeight() - (Ya() ? this.S7 : kg() ? this.C8.getHeight() : 0)) {
                if (Ka()) {
                    O6(false);
                } else {
                    N4(1, true);
                }
            }
            ScrollImage scrollImage = this.U7;
            scrollImage.a = this.R7;
            scrollImage.invalidate();
            return;
        }
        if (V8 == 2) {
            long j8 = this.Y7 + 1;
            this.Y7 = j8;
            if (j8 > i8 / (i8 >= 20 ? i8 < 30 ? 3 : i8 < 40 ? 4 : 5 : 2)) {
                this.Y7 = 0L;
                I4();
                int scrollY = this.S1.getScrollY();
                if (e50.Q1 != null && e50.A2) {
                    int h32 = e50.h3() + scrollY;
                    MRTextView mRTextView = this.Q1;
                    if (h32 > mRTextView.b0(mRTextView.getLineCount()) + (this.Q1.getLineHeight() * 5)) {
                        z8 = true;
                        if (!z8) {
                            this.S1.scrollBy(0, i8 < 40 ? ((50 - i8) * 5) / (50 - (40 - i8)) : 1);
                        }
                        od(scrollY);
                    }
                }
                z8 = false;
                if (!z8) {
                }
                od(scrollY);
            }
            if (z7) {
                cg(0);
                return;
            }
            return;
        }
        if (V8 == 3) {
            I4();
            int scrollY2 = this.S1.getScrollY();
            int S2 = this.Q1.S(this.Q1.getLayout().C(this.S1.getScrollY() + e50.h3() + 1));
            ScrollView2 scrollView2 = this.S1;
            if (S2 > this.Q1.getLineHeight() * 2) {
                S2 = this.Q1.getLineHeight();
            }
            scrollView2.scrollBy(0, S2);
            od(scrollY2);
            if (z7) {
                cg(0);
                return;
            }
            return;
        }
        if (V8 != 4) {
            return;
        }
        float f8 = (i8 + 20) / 10;
        float f9 = ((((f8 * f8) / (f8 + 5.0f)) * 30.0f) * 100.0f) / (((i8 < 50 ? 50 - i8 : 0) * 2) + 100);
        if (this.W7 >= f9) {
            this.W7 = 0;
            if (Ka()) {
                O6(false);
            } else {
                bc(1);
            }
        }
        int v32 = e50.v3();
        int i10 = (int) (((v32 * r3) / f9) + 15.0f);
        if (this.W7 % 2 != 0 || (view = this.X1) == null) {
            return;
        }
        view.layout(0, 0, i10, e50.k0(2.0f));
    }

    public boolean V7(boolean forceReload) {
        boolean rh = rh();
        if (rh || forceReload) {
            e50.N5("************txtView broken, lineCount:" + this.Q1.getLineCount() + " tvH: " + this.Q1.getHeight() + " txtLen:" + this.Q1.getText().length() + ", lastPosition:" + e50.f2);
            CharSequence text = this.Q1.getText();
            q5();
            ph(text);
        }
        return rh;
    }

    public int V8() {
        if (Ya()) {
            return 0;
        }
        return e50.r5;
    }

    private void V9(MRTextView tv, int start, int end) {
        if (!e50.O9 && start > (end = F4(tv, end))) {
            start = end;
        }
        tv.P0 = start;
        tv.Q0 = end;
        if (this.z1) {
            return;
        }
        tv.postInvalidate();
    }

    private boolean Va(int chapterId, String text, boolean checkEmpty) {
        if (nb()) {
            return q50.U(e50.Q1.h().get(chapterId), text, checkEmpty);
        }
        return false;
    }

    public void Vb(final String url, final String title, long delay) {
        if (ob(url, title) || lb(url) || La(url, title)) {
            return;
        }
        J5(title);
        new j5(Looper.getMainLooper(), url, title).sendEmptyMessageDelayed(0, delay);
    }

    public void Vc(boolean showSelector) {
        MotionEvent motionEvent = this.q9;
        if (motionEvent == null) {
            return;
        }
        int x7 = (int) motionEvent.getX();
        int y7 = (int) this.q9.getY();
        int width = this.j9.getWidth();
        int i8 = x7 - (width / 2);
        int i9 = width + i8;
        int height = this.j9.getHeight() + y7;
        this.j9.layout(i8, y7, i9, height);
        this.k9.layout(i8, y7, i9, height);
        this.e9.setTag(0);
        if (showSelector) {
            Nf();
            this.F2.I(this);
        }
        Ac(true, showSelector);
    }

    public void Ve(String filename, CheckBox cb1, CheckBox cb2) {
        cb1.setChecked(true);
        cb1.setEnabled(true);
        cb2.setChecked(true);
        cb2.setEnabled(true);
        if (o50.A1(filename)) {
            try {
                com.flyersoft.components.k kVar = new com.flyersoft.components.k(filename);
                if (kVar.d().contains("typeset")) {
                    ArrayList<String> C2 = o50.C2(o50.u1(kVar.l("typeset")));
                    if (!C2.contains("*font")) {
                        cb1.setChecked(false);
                        cb1.setEnabled(false);
                    }
                    if (C2.contains("*margin")) {
                        return;
                    }
                    cb2.setChecked(false);
                    cb2.setEnabled(false);
                }
            } catch (Exception e8) {
                e50.S0(e8);
            }
        }
    }

    private long Vg(ArrayList<String> list, int index) {
        long j8 = 0;
        for (int i8 = 0; i8 < index; i8++) {
            j8 += list.get(i8).length();
        }
        return j8;
    }

    static int W0(ActivityTxt activityTxt) {
        int i8 = activityTxt.W7;
        activityTxt.W7 = i8 + 1;
        return i8;
    }

    private boolean W5(com.flyersoft.staticlayout.k sp, boolean forMediaOnly, boolean execute) {
        if (Sa(sp, forMediaOnly)) {
            return true;
        }
        if (forMediaOnly) {
            return false;
        }
        if (execute) {
            Lg(sp);
        }
        return true;
    }

    public void W9(boolean setDotPosition, int offset1, int offset2) {
        MRTextView mRTextView;
        MRTextView mRTextView2;
        int i8;
        int i9;
        int i10 = offset1;
        int i11 = offset2;
        if (Za()) {
            Ac(setDotPosition, true);
            return;
        }
        com.flyersoft.staticlayout.l layout = this.Q1.getLayout();
        if (layout == null) {
            return;
        }
        if (i10 == -1 && F7()) {
            mRTextView = this.j9.getLeft() + (this.j9.getWidth() / 2) > this.U1.getWidth() / 2 ? this.R1 : this.Q1;
            mRTextView2 = this.k9.getLeft() + (this.j9.getWidth() / 2) > this.U1.getWidth() / 2 ? this.R1 : this.Q1;
        } else if (F7()) {
            mRTextView = Ob(i10) ? this.R1 : this.Q1;
            mRTextView2 = Ob(i11) ? this.R1 : this.Q1;
        } else {
            mRTextView = this.Q1;
            mRTextView2 = mRTextView;
        }
        MRTextView mRTextView3 = this.R1;
        ScrollView2 scrollView2 = mRTextView == mRTextView3 ? this.T1 : this.S1;
        ScrollView2 scrollView22 = mRTextView2 == mRTextView3 ? this.T1 : this.S1;
        int lineHeight = mRTextView.getLineHeight();
        int scrollY = scrollView2.getScrollY();
        int scrollY2 = scrollView22.getScrollY();
        int paddingLeft = scrollView2.getPaddingLeft();
        int paddingTop = scrollView2.getPaddingTop();
        if (i10 == -1 || i11 == -1) {
            int i12 = lineHeight / 3;
            int C = layout.C(((this.j9.getTop() + scrollY) - i12) - paddingTop);
            int C2 = layout.C(((this.k9.getTop() + scrollY2) - i12) - paddingTop);
            i10 = mRTextView.T(C, ((this.j9.getLeft() - E4(mRTextView)) + (this.j9.getWidth() / 2)) - paddingLeft);
            i11 = mRTextView2.T(C2, ((this.k9.getLeft() - E4(mRTextView2)) + (this.j9.getWidth() / 2)) - paddingLeft);
            if (i10 == -1 || i11 == -1) {
                return;
            }
        }
        int F4 = F4(mRTextView, i10);
        int F42 = F4(mRTextView2, i11);
        int B = layout.B(F4);
        int B2 = layout.B(F42 - 1);
        int length = mRTextView.getText().length();
        mRTextView2.Q0 = -1;
        mRTextView2.P0 = -1;
        mRTextView.Q0 = -1;
        mRTextView.P0 = -1;
        if (F4 < 0 || F42 < 0 || F4 == F42 || F4 >= length || F42 > length) {
            return;
        }
        boolean z7 = F4 > F42;
        U9(z7 ? F42 : F4, z7 ? F4 : F42);
        if (mRTextView.P0 > mRTextView.Q0) {
            e50.N5("ERROR tv1.hStart-End:" + mRTextView.P0 + com.ksdk.ssds.manager.b.b + mRTextView.Q0);
            return;
        }
        MRTextView mRTextView4 = this.Q1;
        MRTextView mRTextView5 = this.R1;
        String substring = mRTextView4.getText2().substring(mRTextView.P0, mRTextView.Q0);
        mRTextView5.R0 = substring;
        mRTextView4.R0 = substring;
        if (setDotPosition) {
            int width = this.j9.getWidth();
            int height = this.j9.getHeight();
            int h02 = (int) mRTextView.h0(B, F4);
            int s7 = ((layout.s(B) + paddingTop) - scrollY) - 3;
            this.y9 = s7 - (lineHeight / 2);
            int h03 = (int) mRTextView2.h0(B2, F42);
            int s8 = ((paddingTop + layout.s(B2)) - scrollY2) - 3;
            if (mRTextView.getLayout().T(B) == -1) {
                if (mRTextView.N0(B)) {
                    int i13 = width / 2;
                    i8 = ((h03 + paddingLeft) - i13) + E4(mRTextView2);
                    i9 = ((h02 + paddingLeft) - i13) + E4(mRTextView);
                } else {
                    int width2 = (mRTextView.getWidth2() - h03) + paddingLeft;
                    int i14 = width / 2;
                    int E4 = (width2 - i14) + E4(mRTextView2);
                    i9 = E4(mRTextView) + (((mRTextView.getWidth2() - h02) + paddingLeft) - i14);
                    i8 = E4;
                }
                s8 = s7;
                s7 = s8;
            } else {
                int i15 = paddingLeft - (width / 2);
                int E42 = h02 + E4(mRTextView) + i15;
                int E43 = h03 + i15 + E4(mRTextView2);
                i8 = E42;
                i9 = E43;
            }
            this.j9.layout(i8, s7, i8 + width, s7 + height);
            this.k9.layout(i9, s8, width + i9, height + s8);
            yb();
            if (this.z9 != null) {
                this.n9.setTag(1);
                Te(true);
                Ue(0);
                new z(Looper.getMainLooper()).sendEmptyMessage(0);
            }
            Nf();
            return;
        }
        Se(false);
    }

    private boolean Wa(float nowX, float downX) {
        if (nowX > this.U1.getWidth() / 2) {
            if (nowX > downX) {
                return true;
            }
        } else if (nowX < downX) {
            return true;
        }
        return false;
    }

    public void Wb(final String url, final String title) {
        ArrayList<String> arrayList;
        ArrayList<String> arrayList2;
        String str;
        String str2;
        String str3;
        ArrayList<String> arrayList3;
        int i8;
        String str4;
        int i9;
        int i10;
        int i11;
        String str5;
        String y7;
        String str6;
        int i12;
        int i13;
        String str7;
        int k9;
        int i14;
        boolean z7;
        String str8;
        int i15;
        int i16;
        int i17;
        String str9;
        f50.e eVar;
        int i18;
        int i19;
        String str10;
        f50.e eVar2;
        f50.e eVar3;
        int i20;
        int i21;
        if (url.startsWith("@mobi") && e50.Q1 != null) {
            u6(url, title);
            hideProgressDlg();
            return;
        }
        if (e50.c5(url)) {
            o50.b2(this, url);
            hideProgressDlg();
            return;
        }
        m7 re = re(true);
        int i22 = 0;
        this.g6 = 0;
        int i23 = e50.h2;
        int i24 = e50.g2;
        String str11 = this.n5;
        e50.N5("1:");
        ArrayList<String> arrayList4 = (ArrayList) e50.G9.clone();
        ArrayList<String> arrayList5 = this.Ia;
        if (arrayList5 == null) {
            arrayList = null;
        } else if (e50.G9 != arrayList5) {
            arrayList = (ArrayList) arrayList5.clone();
        } else {
            arrayList2 = arrayList4;
            String str12 = "#";
            if (q8() != 1) {
                if (url.startsWith("#")) {
                    if (Sb(url.substring(1), false)) {
                        zb();
                        hideProgressDlg();
                        return;
                    }
                } else {
                    int indexOf = url.indexOf("#");
                    StringBuilder sb = new StringBuilder();
                    sb.append(o50.n0(e50.V1));
                    sb.append(com.ksdk.ssds.manager.b.b);
                    sb.append(indexOf == -1 ? url : url.substring(0, indexOf));
                    String sb2 = sb.toString();
                    if (o50.A1(sb2)) {
                        e50.V1 = sb2;
                        if (indexOf != -1) {
                            this.n5 = o50.p0(sb2);
                            Sb(url.substring(indexOf + 1), true);
                        } else {
                            this.P2 = "";
                            Jd();
                        }
                        zb();
                        hideProgressDlg();
                        return;
                    }
                }
                str4 = "#";
                str3 = "\"";
                str5 = url;
            } else {
                String decode = Uri.decode(url);
                int indexOf2 = decode.indexOf("#");
                if (indexOf2 == -1) {
                    String G8 = G8(decode);
                    while (i22 < e50.Q1.h().size()) {
                        String str13 = e50.Q1.h().get(i22).d;
                        if (str13 != null && str13.equals(G8)) {
                            break;
                        } else {
                            i22++;
                        }
                    }
                }
                i22 = -1;
                if (i22 == -1 && decode.indexOf("./") != -1 && indexOf2 == -1) {
                    String substring = decode.substring(decode.lastIndexOf(com.ksdk.ssds.manager.b.b) + 1);
                    int i25 = 0;
                    while (i25 < e50.Q1.h().size()) {
                        f50.e eVar4 = e50.Q1.h().get(i25);
                        str = str12;
                        String str14 = eVar4.d;
                        if (str14 != null) {
                            if (!str14.equals(substring)) {
                                if (eVar4.d.endsWith(com.ksdk.ssds.manager.b.b + substring)) {
                                }
                            }
                            i22 = i25;
                            break;
                        }
                        i25++;
                        str12 = str;
                    }
                }
                str = str12;
                if (i22 == -1) {
                    if (indexOf2 == 0) {
                        String str15 = this.n5;
                        String substring2 = decode.substring(indexOf2 + 1);
                        String str16 = "id=\"" + substring2 + "\"";
                        String str17 = "id = \"" + substring2 + "\"";
                        String str18 = "name=\"" + substring2 + "\"";
                        String str19 = "name = \"" + substring2 + "\"";
                        int length = (((int) ((str15.length() * e50.f2) / this.Q1.getText().length())) * 9) / 10;
                        if (e50.U5()) {
                            str7 = decode;
                            i13 = i22;
                            i12 = -1;
                            i10 = indexOf2;
                            str6 = substring2;
                            str4 = str;
                            str3 = "\"";
                            k9 = k9(str15, str16, str17, str18, str19, length);
                            if (k9 == -1) {
                                k9 = k9(str15, str16, str17, str18, str19, 0);
                            }
                            i14 = i23;
                            z7 = false;
                        } else {
                            str6 = substring2;
                            str3 = "\"";
                            str4 = str;
                            i12 = -1;
                            i13 = i22;
                            i10 = indexOf2;
                            str7 = decode;
                            k9 = k9(str15, str16, str17, str18, str19, length);
                            if (k9 == -1) {
                                int i26 = i23 + 1;
                                while (i26 < e50.G9.size()) {
                                    i14 = i26;
                                    k9 = k9(e50.G9.get(i26), str16, str17, str18, str19, 0);
                                    if (k9 != -1) {
                                        z7 = true;
                                        break;
                                    }
                                    i26 = i14 + 1;
                                }
                            }
                            i14 = i23;
                            z7 = false;
                            if (k9 == -1) {
                                int i27 = i23;
                                while (true) {
                                    if (i27 < 0) {
                                        break;
                                    }
                                    int i28 = i27;
                                    k9 = k9(e50.G9.get(i27), str16, str17, str18, str19, 0);
                                    if (k9 != -1) {
                                        i14 = i28;
                                        z7 = true;
                                        break;
                                    }
                                    i27 = i28 - 1;
                                }
                            }
                        }
                        if (k9 == i12) {
                            f50.e eVar5 = e50.Q1.h().get(e50.g2);
                            String str20 = eVar5.d;
                            int i29 = 0;
                            while (true) {
                                if (i29 >= e50.Q1.h().size()) {
                                    str9 = str20;
                                    eVar = eVar5;
                                    str8 = str6;
                                    break;
                                }
                                if (i29 != e50.g2) {
                                    f50.e eVar6 = e50.Q1.h().get(i29);
                                    String str21 = str6;
                                    if (str21.equals(eVar6.m) && eVar6.d.equals(str20)) {
                                        ArrayList arrayList6 = new ArrayList();
                                        String y8 = e50.y(e50.Q1.g(i29), arrayList6);
                                        if (arrayList6.size() != 0) {
                                            str8 = str21;
                                            i21 = i29;
                                            str9 = str20;
                                            eVar = eVar5;
                                            int i30 = 0;
                                            while (true) {
                                                if (i30 >= arrayList6.size()) {
                                                    break;
                                                }
                                                y8 = (String) arrayList6.get(i30);
                                                ArrayList arrayList7 = arrayList6;
                                                int i31 = i30;
                                                k9 = k9(y8, str16, str17, str18, str19, 0);
                                                if (k9 != i12) {
                                                    i14 = i31;
                                                    break;
                                                } else {
                                                    i30 = i31 + 1;
                                                    arrayList6 = arrayList7;
                                                }
                                            }
                                        } else {
                                            str8 = str21;
                                            i21 = i29;
                                            str9 = str20;
                                            eVar = eVar5;
                                            k9 = k9(y8, str16, str17, str18, str19, 0);
                                        }
                                        if (k9 != i12) {
                                            e50.g2 = i21;
                                            str15 = y8;
                                            break;
                                        }
                                    } else {
                                        str8 = str21;
                                        i21 = i29;
                                        str9 = str20;
                                        eVar = eVar5;
                                    }
                                } else {
                                    i21 = i29;
                                    str9 = str20;
                                    eVar = eVar5;
                                    str8 = str6;
                                }
                                i29 = i21 + 1;
                                str6 = str8;
                                str20 = str9;
                                eVar5 = eVar;
                            }
                            if (k9 == i12) {
                                int i32 = 0;
                                while (true) {
                                    if (i32 >= e50.Q1.h().size()) {
                                        i16 = i14;
                                        i15 = k9;
                                        break;
                                    }
                                    if (i32 != e50.g2) {
                                        f50.e eVar7 = e50.Q1.h().get(i32);
                                        String str22 = str9;
                                        boolean equals = eVar7.d.equals(str22);
                                        if (equals) {
                                            i18 = k9;
                                            eVar3 = eVar;
                                        } else {
                                            eVar3 = eVar;
                                            if (eVar3.e.size() > 1) {
                                                Iterator<String> it = eVar3.e.iterator();
                                                while (it.hasNext()) {
                                                    String next = it.next();
                                                    i18 = k9;
                                                    if (next != str22 && eVar7.d.equals(next)) {
                                                        equals = true;
                                                        break;
                                                    }
                                                    k9 = i18;
                                                }
                                            }
                                            i18 = k9;
                                        }
                                        if (!equals && eVar7.e.size() > 1) {
                                            Iterator<String> it2 = eVar7.e.iterator();
                                            while (true) {
                                                if (it2.hasNext()) {
                                                    if (it2.next().equals(str22)) {
                                                        equals = true;
                                                        break;
                                                    }
                                                } else {
                                                    break;
                                                }
                                            }
                                        }
                                        if (equals) {
                                            ArrayList arrayList8 = new ArrayList();
                                            String y9 = e50.y(e50.Q1.g(i32), arrayList8);
                                            if (arrayList8.size() == 0) {
                                                eVar2 = eVar3;
                                                str10 = str22;
                                                i19 = i32;
                                                k9 = k9(y9, str16, str17, str18, str19, 0);
                                            } else {
                                                eVar2 = eVar3;
                                                str10 = str22;
                                                i19 = i32;
                                                k9 = i18;
                                                int i33 = 0;
                                                while (i33 < arrayList8.size()) {
                                                    y9 = (String) arrayList8.get(i33);
                                                    int i34 = i33;
                                                    k9 = k9(y9, str16, str17, str18, str19, 0);
                                                    i20 = -1;
                                                    if (k9 != -1) {
                                                        i14 = i34;
                                                        break;
                                                    }
                                                    i33 = i34 + 1;
                                                }
                                            }
                                            i20 = -1;
                                            if (k9 != i20) {
                                                e50.g2 = i19;
                                                i15 = k9;
                                                i16 = i14;
                                                str15 = y9;
                                                break;
                                            }
                                            i32 = i19 + 1;
                                            String str23 = str10;
                                            eVar = eVar2;
                                            str9 = str23;
                                        } else {
                                            eVar2 = eVar3;
                                            str10 = str22;
                                            i19 = i32;
                                        }
                                    } else {
                                        i18 = k9;
                                        i19 = i32;
                                        f50.e eVar8 = eVar;
                                        str10 = str9;
                                        eVar2 = eVar8;
                                    }
                                    k9 = i18;
                                    i32 = i19 + 1;
                                    String str232 = str10;
                                    eVar = eVar2;
                                    str9 = str232;
                                }
                                if (i15 == -1) {
                                    if (z7) {
                                        str15 = e50.G9.get(i16);
                                    }
                                    int i35 = i16;
                                    String str24 = str15;
                                    arrayList3 = arrayList2;
                                    r8(0, null, str8, str7, null, str24, i15);
                                    i17 = e50.g2;
                                    e50.h2 = i35;
                                } else {
                                    arrayList3 = arrayList2;
                                    i17 = i13;
                                }
                                i11 = i17;
                                str2 = str7;
                                i9 = -1;
                            }
                        } else {
                            str8 = str6;
                        }
                        i15 = k9;
                        i16 = i14;
                        if (i15 == -1) {
                        }
                        i11 = i17;
                        str2 = str7;
                        i9 = -1;
                    } else {
                        str3 = "\"";
                        arrayList3 = arrayList2;
                        i8 = i22;
                        str4 = str;
                        i10 = indexOf2;
                        str2 = decode;
                        if (i10 > 0) {
                            String G82 = G8(str2.substring(0, i10));
                            String substring3 = str2.substring(i10 + 1);
                            int i36 = 0;
                            while (i36 < e50.Q1.h().size()) {
                                i11 = Q7(str2, G82, substring3, i36);
                                i9 = -1;
                                if (i11 != -1) {
                                    break;
                                }
                                i36++;
                                i8 = i11;
                            }
                        }
                        i9 = -1;
                    }
                    if (i11 == i9) {
                        String G83 = G8(i10 == i9 ? str2 : str2.substring(0, i10));
                        for (int i37 = 0; i37 < e50.Q1.h().size(); i37++) {
                            if (da(G83, e50.Q1.h().get(i37))) {
                                String str25 = "<a name=" + o50.v0(str2) + ">";
                                ArrayList<String> arrayList9 = new ArrayList<>();
                                if (i37 == i24) {
                                    arrayList9 = e50.G9;
                                    y7 = arrayList9.size() > 0 ? arrayList9.get(0) : this.n5;
                                } else {
                                    y7 = e50.y(e50.Q1.g(i37), arrayList9);
                                }
                                if (arrayList9.size() == 0) {
                                    int indexOf3 = y7.indexOf(str25);
                                    if (indexOf3 != -1) {
                                        this.g6 = com.flyersoft.staticlayout.j.c(y7.substring(0, indexOf3), this.m5, i37).length() + 1;
                                    }
                                } else {
                                    for (int i38 = 0; i38 < arrayList9.size(); i38++) {
                                        String str26 = arrayList9.get(i38);
                                        int indexOf4 = str26.indexOf(str25);
                                        if (indexOf4 != -1) {
                                            this.g6 = com.flyersoft.staticlayout.j.c(str26.substring(0, indexOf4), this.m5, i37).length() + 1;
                                            e50.h2 = i38;
                                            break;
                                        }
                                    }
                                }
                                i11 = i37;
                                if (i11 >= 0) {
                                    if (this.c6 != null) {
                                        e50.g2 = i24;
                                        e50.h2 = i23;
                                        e50.G9 = arrayList4;
                                        this.n5 = str11;
                                        this.Ia = arrayList3;
                                        hideProgressDlg();
                                        this.E6.remove(re);
                                        ug(url, title, i11);
                                        return;
                                    }
                                    pe(false);
                                    e50.G9 = arrayList4;
                                    ke(e50.g2, i23, str11);
                                    boolean z8 = i24 == i11 && i23 == e50.h2;
                                    e50.g2 = i11;
                                    long j8 = this.g6;
                                    e50.f2 = j8;
                                    if (j8 == 0) {
                                        this.l5 = true;
                                        Jd();
                                    } else if (z8) {
                                        nh(this.Q1.a0(this.Q1.getLayout().B((int) e50.f2)));
                                    } else {
                                        Of(e50.g2, e50.h2, e50.f2, true);
                                    }
                                    zb();
                                    hideProgressDlg();
                                    Ih();
                                    e50.N5("3:");
                                    return;
                                }
                                str5 = url;
                            }
                        }
                    }
                    if (i11 >= 0) {
                    }
                } else {
                    str2 = decode;
                    str3 = "\"";
                    arrayList3 = arrayList2;
                    i8 = i22;
                    str4 = str;
                    i9 = -1;
                    i10 = indexOf2;
                }
                i11 = i8;
                if (i11 == i9) {
                }
                if (i11 >= 0) {
                }
            }
            if (e50.Q1 != null) {
                String decode2 = Uri.decode(url);
                String str27 = str4;
                if (decode2.indexOf(str27) != -1) {
                    decode2 = decode2.substring(0, decode2.indexOf(str27));
                }
                String t7 = e50.Q1.t(decode2);
                if (t7 != null && t7.length() > 0) {
                    zb();
                    String F = o50.F(o50.B0(t7));
                    this.n5 = F;
                    String x7 = e50.x(F);
                    this.n5 = x7;
                    String Q = e50.Q(x7);
                    this.n5 = Q;
                    ph(com.flyersoft.staticlayout.j.c(Q, this.m5, e50.g2));
                    kh(this.g6);
                    hideProgressDlg();
                    return;
                }
            }
            e50.h2 = i23;
            hideProgressDlg();
            o50.p2(this, str3 + str5 + "\" " + getString(R.string.link_not_found));
        }
        arrayList2 = arrayList;
        String str122 = "#";
        if (q8() != 1) {
        }
        if (e50.Q1 != null) {
        }
        e50.h2 = i23;
        hideProgressDlg();
        o50.p2(this, str3 + str5 + "\" " + getString(R.string.link_not_found));
    }

    public void Wc() {
        this.U9.setBackgroundResource(R.drawable.my_list_selector);
        this.V9.setBackgroundResource(R.drawable.my_list_selector);
        this.W9.setBackgroundResource(R.drawable.my_list_selector);
        this.X9.setBackgroundResource(R.drawable.my_list_selector);
        this.Y9.setBackgroundResource(R.drawable.my_list_selector);
        this.Z9.setBackgroundResource(R.drawable.my_list_selector);
        this.ca.setBackgroundResource(R.drawable.my_list_selector);
        this.U9.setPadding(e50.k0(6.0f), e50.k0(6.0f), e50.k0(6.0f), e50.k0(6.0f));
        this.V9.setPadding(e50.k0(6.0f), e50.k0(6.0f), e50.k0(6.0f), e50.k0(6.0f));
        this.W9.setPadding(e50.k0(6.0f), e50.k0(6.0f), e50.k0(6.0f), e50.k0(6.0f));
        this.X9.setPadding(e50.k0(6.0f), e50.k0(6.0f), e50.k0(6.0f), e50.k0(6.0f));
        this.Y9.setPadding(e50.k0(6.0f), e50.k0(6.0f), e50.k0(6.0f), e50.k0(6.0f));
        this.Z9.setPadding(e50.k0(6.0f), e50.k0(6.0f), e50.k0(6.0f), e50.k0(6.0f));
        this.ca.setPadding(e50.k0(6.0f), e50.k0(6.0f), e50.k0(6.0f), e50.k0(6.0f));
        ImageView imageView = this.T9;
        ImageView imageView2 = this.U9;
        if (imageView == imageView2) {
            imageView2.setBackgroundColor(-293042040);
        }
        ImageView imageView3 = this.T9;
        ImageView imageView4 = this.V9;
        if (imageView3 == imageView4) {
            imageView4.setBackgroundColor(-293042040);
        }
        ImageView imageView5 = this.T9;
        ImageView imageView6 = this.W9;
        if (imageView5 == imageView6) {
            imageView6.setBackgroundColor(-293042040);
        }
        ImageView imageView7 = this.T9;
        ImageView imageView8 = this.X9;
        if (imageView7 == imageView8) {
            imageView8.setBackgroundColor(-293042040);
        }
        ImageView imageView9 = this.T9;
        ImageView imageView10 = this.Y9;
        if (imageView9 == imageView10) {
            imageView10.setBackgroundColor(-293042040);
        }
        ImageView imageView11 = this.T9;
        ImageView imageView12 = this.Z9;
        if (imageView11 == imageView12) {
            imageView12.setBackgroundColor(-293042040);
        }
        ImageView imageView13 = this.T9;
        ImageView imageView14 = this.ca;
        if (imageView13 == imageView14) {
            imageView14.setBackgroundColor(-293042040);
        }
    }

    private void Wd() {
        if (e50.O9) {
            int y7 = this.Q1.getLayout().y(e50.Q2(this.S1, -1)) - this.F6;
            this.B4 = y7;
            if (y7 < 0 || y7 > 100) {
                this.B4 = 0;
            }
        }
    }

    private void Wf(boolean visible) {
        if (visible && ((this.G5 < 0.0f && Ka()) || (this.G5 > 0.0f && Ca()))) {
            visible = false;
        }
        this.H5 = visible;
        if (visible) {
            boolean z7 = ((int) Math.abs((this.G5 * 6.0f) / e50.g2())) >= 360;
            this.H5 = z7;
            this.I5 = true;
            if (!z7 || this.G5 <= 0.0f) {
                return;
            }
            td();
            return;
        }
        this.I5 = false;
    }

    public void Wg(ArrayList<S.WebChapter> chapters) {
        int lastChapter = WB.getLastChapter(e50.g2, e50.Q1.h().get(e50.g2).c, chapters);
        if (lastChapter != e50.g2) {
            e50.N5("last chapter: " + e50.g2 + ", new last chapter: " + lastChapter);
            e50.g2 = lastChapter;
            pe(true);
        }
        q50.X(this.wb, true);
        ee();
    }

    private void X5(long delayTime) {
        this.P1 = true;
        this.H1.sendEmptyMessageDelayed(O0, delayTime);
    }

    private boolean X7() {
        if (this.j5 <= 0) {
            return false;
        }
        if (SystemClock.elapsedRealtime() - this.j5 <= 2000) {
            return true;
        }
        this.j5 = 0L;
        return true;
    }

    public int X8(SeekBar seekBar) {
        int progress = seekBar.getProgress();
        if (progress < 0) {
            progress = 0;
        }
        if (progress > 1000) {
            return 1000;
        }
        return progress;
    }

    public void X9(boolean directShow) {
        if (this.P1 || isFinishing() || e50.v2 || !o50.D1(SplashActivity.selfPref) || com.flyersoft.seekbooks.q.x() || System.currentTimeMillis() - e50.Da < o50.N1(5L)) {
            return;
        }
        if (directShow) {
            ActivityMain.k2(this, 127, true, true);
        } else {
            long currentTimeMillis = this.B1 > 0 ? System.currentTimeMillis() - this.B1 : 0L;
            int i8 = SplashActivity.count > 0 ? 1 : 0;
            if (currentTimeMillis > o50.N1(30L)) {
                ActivityMain.k2(this, -1, true, false);
            } else if (currentTimeMillis > o50.N1(10L) && o50.R1(i8 + 2) == 0) {
                ActivityMain.k2(this, -1, true, false);
            } else if (currentTimeMillis > o50.N1(2L) && System.currentTimeMillis() - e50.Da > o50.N1(15L) && o50.R1((i8 + 1) * 3) == 0) {
                ActivityMain.k2(this, -1, true, false);
            } else if (Pd()) {
                e50.Ba = 0L;
                if (ActivityMain.k2(this, -1, true, false)) {
                    this.A8 = 0L;
                    e50.q7("splashTry", "fromReminderReturn", e50.r1(), 1);
                }
            }
        }
        ActivityMain.b0 = null;
    }

    private boolean Xa() {
        return this.T1.getVisibility() == 0 && this.R1.getVisibility() == 0;
    }

    public void Xc(boolean immersive) {
        PDFReader pDFReader;
        if (!e50.g5 || (pDFReader = this.F2) == null) {
            return;
        }
        pDFReader.c0 = immersive;
    }

    private void Xd() {
        if (e50.O9) {
            this.F6 = -1;
            if (this.B4 == 0) {
                return;
            }
            this.F6 = this.Q1.getLayout().I(this.Q1.getLayout().C(this.S1.getScrollY())) - this.B4;
            this.B4 = 0;
        }
    }

    private void Xf(final View v7) {
    }

    public long Y5() {
        return 50L;
    }

    public void Y6() {
        String str;
        if (isFinishing() || this.j8 == null || this.k8 == null) {
            return;
        }
        try {
            long o8 = o8();
            long e8 = f50.e();
            String format = this.F2 == null ? NumberFormat.getInstance().format(o8) : "";
            if (e8 > 0) {
                format = o50.l(format, "<br><b>", getString(R.string.words_in_book), ":</b>  ", NumberFormat.getInstance().format(e8));
                int n8 = n8();
                int s8 = s8();
                if (s8 > 0) {
                    n8 += s8;
                }
                if (n8 > 0) {
                    int S8 = S8();
                    int i8 = n8 / S8;
                    int i9 = i8 / 60;
                    int i10 = i8 % 60;
                    if (e50.Q1 == null || s8 <= 0) {
                        str = "<br>";
                    } else {
                        StringBuilder sb = new StringBuilder();
                        sb.append("<br><br>");
                        sb.append(String.format(getString(R.string.remaining_time_chapter) + "", Integer.valueOf(s8 / S8)));
                        str = sb.toString();
                    }
                    format = o50.l(format, "<i>", str, "<br>", String.format(getString(R.string.remaining_time_book), Integer.valueOf(i9), Integer.valueOf(i10)), "</i>");
                }
            }
            ((TextView) this.j8.findViewById(R.id.rdmTextView01)).setText(Html.fromHtml(this.k8 + format));
        } catch (Throwable th) {
            System.gc();
            e50.S0(th);
        }
        this.j8.findViewById(R.id.progressBar3).setVisibility(8);
    }

    public void Y7(int add) {
        if (Za()) {
            nd(add > 0 ? 0.1f : -1.0f);
            return;
        }
        if (this.C9 != null) {
            Uh(add > 0);
            return;
        }
        Yd();
        float f8 = e50.d3 + add;
        e50.d3 = f8;
        int i8 = e50.p9;
        if (f8 < i8) {
            e50.d3 = i8;
        }
        float f9 = e50.d3;
        int i9 = e50.q9;
        if (f9 > i9) {
            e50.d3 = i9;
        }
        o50.r2(this, "" + e50.d3, 0, 17);
        Oe();
        TextView textView = this.V3;
        if (textView != null) {
            textView.setText("" + ((int) e50.d3));
        }
    }

    private boolean Y9(int direction, boolean showTip) {
        boolean Ca;
        if (direction == 1) {
            Ca = Ka();
        } else {
            Ca = Ca();
        }
        if (Ca && showTip) {
            o50.p2(this, e50.W0(direction == 1 ? "已到最后一页" : "已是第一页"));
        }
        return Ca;
    }

    private boolean Yb(View sv, int left, int top, int right, int bottom) {
        return (sv.getPaddingLeft() == left && sv.getPaddingTop() == top && sv.getPaddingRight() == right && sv.getPaddingBottom() == bottom) ? false : true;
    }

    private void Yc(boolean updateView) {
        if (!Ya() || this.F2 == null) {
            return;
        }
        int i8 = Global.m;
        Re();
        if (!updateView || i8 == Global.m) {
            return;
        }
        jd(false);
    }

    public void Yd() {
        this.Q8 = -1L;
        this.P8 = -1L;
    }

    private void Ye() {
        ImageView imageView = this.L3;
        if (imageView != null) {
            imageView.setImageResource(e50.M2 ? R.drawable.b2_day : R.drawable.b2_night);
        }
        View view = this.B2;
        if (view != null) {
            ((RoundButton) view.findViewById(R.id.setNightTheme)).setChecked(e50.M2);
        }
        View view2 = this.A2;
        if (view2 != null) {
            ((RoundButton) view2.findViewById(R.id.setNightTheme2)).setChecked(e50.M2);
        }
    }

    private void Yg() {
        if (!e50.Q1.p.primary() && e50.H2) {
            ScrollView scrollView = (ScrollView) LayoutInflater.from(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);
            checkBox.setChecked(true);
            textView.setTextSize(15.0f);
            textView.setText(Html.fromHtml(e50.W0("切换到阅文书城阅读正版, 无错字更新快, 更可有效支持您喜欢的作者.")));
            new m.c(this).B(scrollView).v(R.string.ok, new x3(checkBox)).o(R.string.cancel, new w3(checkBox)).d(false).C();
            return;
        }
        Zg();
    }

    public boolean Z4() {
        boolean F7 = F7();
        if (!F7) {
            if (this.T1.getVisibility() != 8) {
                this.R1.setText("");
                this.T1.setVisibility(8);
                this.b2.setBackgroundDrawable(null);
                this.b2.setVisibility(8);
            }
        } else {
            this.T1.setVisibility(0);
            De();
            if (!e50.D2 && this.b2.getBackground() != null) {
                this.b2.setBackgroundDrawable(null);
                this.b2.setVisibility(8);
            }
        }
        return F7;
    }

    public boolean Z5(View v7) {
        int intValue = ((Integer) v7.getTag()).intValue();
        boolean z7 = this.C9 != null && (intValue == 6 || intValue == 5 || intValue == 7);
        if (z7) {
            new m.c(this).l(R.string.preview_disable_hint).v(R.string.preview_turn_off, new a0()).p("Cancel", null).C();
        }
        return z7;
    }

    private boolean Z7() {
        return false;
    }

    private com.flyersoft.components.n Z8() {
        if (this.t8 == null) {
            this.t8 = new com.flyersoft.components.n();
        }
        return this.t8;
    }

    private boolean Z9(MotionEvent event) {
        return Ya() && (!e50.t3 || event.getPointerCount() > 1);
    }

    private boolean Zb(float rest) {
        return rest - ((float) ((int) rest)) > e50.W5();
    }

    public void Zc() {
        this.R9.setVisibility(0);
        Wc();
        View view = this.S9;
        ImageView imageView = this.T9;
        view.setVisibility((imageView == null || imageView == this.U9) ? 8 : 0);
        this.ea.setImageResource(R.drawable.pdf_ok);
        this.fa.setVisibility(this.T9 == this.U9 ? 8 : 0);
        this.ga.setVisibility(this.T9 == this.U9 ? 8 : 0);
        ImageView imageView2 = this.ha;
        ImageView imageView3 = this.T9;
        imageView2.setVisibility((imageView3 == this.Z9 || imageView3 == this.ca) ? 0 : 8);
        this.ia.setVisibility(this.T9 == this.V9 ? 8 : 0);
    }

    private void Zd() {
        int l8;
        if ((V8() != 2 && V8() != 0) || this.Q7 == null || (l8 = l8()) == this.V7) {
            return;
        }
        this.V7 = l8;
        Timer timer = this.Q7;
        if (timer != null) {
            timer.cancel();
        }
        Timer timer2 = new Timer();
        this.Q7 = timer2;
        timer2.schedule(new k7(), 10L, l8);
    }

    public void Zg() {
        Xg(S.store.siteTag, o50.p0(h9()), false);
    }

    private void a() {
        if (Build.VERSION.SDK_INT >= 26 && e50.H4 == 19) {
            e50.b6(this, R.raw.silence);
        }
    }

    private boolean a5() {
        int i8;
        if (this.k3 != e50.e4) {
            Ch();
        }
        this.g4 = false;
        boolean z7 = this.k3 != e50.e4 && e50.Q4();
        if (!z7 && this.l3 != e50.i4 && e50.W5 && ((i8 = e50.i4) == 1 || i8 == 2)) {
            z7 = true;
        }
        if (z7) {
            NewCurl3D newCurl3D = this.R2;
            if (newCurl3D != null && newCurl3D.z0 == newCurl3D.getStyle()) {
                this.R2.M();
            } else {
                ee();
                return true;
            }
        }
        this.k3 = e50.e4;
        return false;
    }

    public void a6() {
        MRTextView mRTextView = this.Q1;
        this.R1.D0 = true;
        mRTextView.D0 = true;
    }

    public void a8(int delay) {
        if (e50.fa) {
            this.H1.sendEmptyMessageDelayed(H0, delay);
        }
    }

    public String a9(int type) {
        f50 f50Var;
        String D1 = e50.D1();
        if (q8() != 100 || (f50Var = e50.Q1) == null || f50Var.b().equals("")) {
            return D1;
        }
        StringBuilder sb = new StringBuilder();
        sb.append(D1);
        sb.append(type == 0 ? " - " : " ");
        sb.append(e50.Q1.b());
        return sb.toString();
    }

    private boolean aa() {
        return Z9(this.q9) && Math.abs(o9(this.q9) - this.u5) > ((float) e50.k0(8.0f));
    }

    public void ac() {
        ActivityMain.e0 = true;
        if (kb()) {
            this.Ka.d = true;
        }
        if (!e50.U5() && e50.h2 < e50.G9.size() - 1) {
            ke(e50.g2, e50.h2, this.n5);
            e50.h2++;
            StringBuilder sb = new StringBuilder();
            f50 f50Var = e50.Q1;
            sb.append(f50Var != null ? f50Var.h().get(e50.g2).c : o50.v0(e50.V1));
            sb.append(" (");
            sb.append(e50.h2 + 1);
            sb.append(com.ksdk.ssds.manager.b.b);
            sb.append(e50.G9.size());
            sb.append(")");
            String sb2 = sb.toString();
            if (G9(true, sb2)) {
                return;
            }
            J5(sb2);
            this.X2 = true;
            Handler handler = this.F4;
            handler.sendMessageDelayed(handler.obtainMessage(4, 1), 50L);
            return;
        }
        if (q8() != 1 && e50.g2 < e50.Q1.h().size() - 1) {
            ke(e50.g2, e50.h2, this.n5);
            e50.g2++;
            e50.f2 = 0L;
            e50.h2 = 0;
            String str = e50.Q1.h().get(e50.g2).c;
            if (G9(true, str)) {
                return;
            }
            e50.N5("-------no cahce for next chapter");
            if (Da(e50.g2)) {
                J5(str);
            }
            this.X2 = true;
            this.k5 = false;
            this.l5 = true;
            Jd();
        }
    }

    private boolean ae() {
        if (!F7()) {
            return false;
        }
        try {
            e50.P9 = true;
            Z4();
            new k6(Looper.getMainLooper()).sendEmptyMessage(this.Q1.getCurPosition());
            return true;
        } catch (Exception e8) {
            e50.S0(e8);
            return false;
        }
    }

    private void ah(boolean playState) {
        if (playState) {
            this.J7 = false;
            View view = this.z7;
            if (view != null) {
                ((ImageView) view).setImageResource(R.drawable.tts_pause);
                return;
            }
            return;
        }
        this.J7 = true;
        View view2 = this.z7;
        if (view2 != null) {
            ((ImageView) view2).setImageResource(R.drawable.tts_play);
        }
    }

    private boolean b() {
        return this.b2.getVisibility() == 0 && C8() != -1 && Build.VERSION.SDK_INT > 14;
    }

    public void b5(Drawable d8, int c8) {
        Ne(B8(d8, c8));
    }

    public void b6(int i8) {
        switch (i8) {
            case 0:
                t7(0);
                break;
            case 1:
                g7();
                break;
            case 2:
                b7();
                break;
            case 3:
                G7();
                break;
            case 4:
                z6();
                break;
            case 5:
                u7();
                break;
            case 6:
                O6(true);
                break;
            case 7:
                Df();
                break;
        }
        if (i8 == 0 || i8 == 4 || i8 == 5 || i8 == 6) {
            za(true);
        }
    }

    private void b7() {
        Af(2);
        Fe();
        this.B3.setProgress(e50.z5);
    }

    private int b9() {
        return e50.v > 0 ? DownloadTaskBrowser.MIN_JS_DEALY : e50.c5 ? 80 : 0;
    }

    public void ba() {
        View inflate = LayoutInflater.from(this).inflate(R.layout.typesetting_export, (ViewGroup) null);
        TextView textView = (TextView) inflate.findViewById(R.id.pathTv);
        CheckBox checkBox = (CheckBox) inflate.findViewById(R.id.cb1);
        CheckBox checkBox2 = (CheckBox) inflate.findViewById(R.id.cb2);
        inflate.findViewById(R.id.path).setVisibility(8);
        inflate.findViewById(R.id.tip).setVisibility(8);
        textView.setVisibility(0);
        Ve(textView.getText().toString(), checkBox, checkBox2);
        textView.setOnClickListener(new y2(textView, checkBox, checkBox2));
        new m.c(this).z(e50.W0("导入配色方案")).B(inflate).w(e50.W0("导入"), new z2(textView, checkBox, checkBox2)).p(e50.W0(com.qadsdk.s1.s5.BTN_CANCEL), null).C();
    }

    private boolean bb() {
        return !e50.B3 && e50.k3 == -16777216;
    }

    private void bc(int direction) {
        cc(direction, false, false);
        pe(true);
    }

    private void be() {
        if (eg() && e50.l5) {
            if (this.K8.getPaddingLeft() == e50.k0(30.0f)) {
                this.K8.setPadding(e50.k0(2.0f), 0, e50.k0(2.0f), 0);
                this.K8.setEllipsize(TextUtils.TruncateAt.END);
                return;
            }
            return;
        }
        if (this.K8.getPaddingLeft() == e50.k0(2.0f)) {
            this.K8.setPadding(e50.k0(30.0f), 0, e50.k0(30.0f), 0);
            this.K8.setEllipsize(TextUtils.TruncateAt.MIDDLE);
        }
    }

    private void bf() {
    }

    public void bh(boolean useWeb) {
        e50.O6 = false;
        this.B6 = useWeb;
        if (useWeb) {
            wg();
            ph("");
        } else {
            R9();
            hideProgressDlg();
            this.Xa = null;
            this.Ha = null;
            Jd();
        }
        za(true);
    }

    public boolean c(VelocityTracker vt, float velocityX, float velocityY) {
        if (!e50.W5 || this.h6) {
            return false;
        }
        float abs = Math.abs(this.o6.getXVelocity());
        float abs2 = Math.abs(this.o6.getYVelocity());
        if (abs == 0.0f) {
            abs = Math.abs(velocityX);
        }
        if (abs2 == 0.0f) {
            abs2 = Math.abs(velocityY);
        }
        float abs3 = Math.abs(o9(this.q9) - this.u5);
        float abs4 = Math.abs(this.q9.getY() - this.t5);
        if (e50.T4()) {
            if (Ta(this.r9)) {
                return false;
            }
            if (this.S4) {
                return true;
            }
            if (abs2 > 600.0f || abs > 600.0f) {
                if (abs3 <= abs4 && abs3 < e50.k0(40.0f)) {
                    this.r6 = SystemClock.elapsedRealtime();
                    W7(velocityY < 0.0f, 0.0f);
                } else if (abs3 > abs4 && abs4 < e50.k0(40.0f)) {
                    this.r6 = SystemClock.elapsedRealtime();
                    W7(velocityX < 0.0f, 0.0f);
                }
                return true;
            }
        } else if (abs > 600.0f && abs > abs2) {
            if (!this.S4 && abs3 >= abs4 && abs4 < e50.k0(40.0f)) {
                this.r6 = SystemClock.elapsedRealtime();
                W7(velocityX < 0.0f, 0.0f);
            }
            return true;
        }
        return false;
    }

    public void c6(DownloadTask.Result result) {
        q50.b bVar;
        this.tb = false;
        hideProgressDlg();
        this.rb.clear();
        if (this.zb || ((bVar = this.sb) != null && bVar.e == e50.g2)) {
            Gf(result.err);
        }
        this.sb = null;
    }

    public void c8(int type) {
        int i8;
        int i9;
        String Q;
        String str;
        ArrayList<String> arrayList = new ArrayList<>();
        if (type == 1) {
            i8 = this.Da;
        } else {
            i8 = type == -1 ? this.Ua : e50.g2;
        }
        if (type == 1) {
            i9 = this.Ea;
        } else {
            i9 = type == -1 ? this.Va : e50.h2;
        }
        String g8 = e50.Q1.g(i8);
        if (e50.d6 && i8 == e50.Q1.h().size() - 1) {
            try {
                StringBuilder sb = new StringBuilder();
                sb.append(g8);
                if (e50.Q1.y()) {
                    str = "<br><br><center>" + e50.m7() + "</center><br><br>";
                } else {
                    str = "\n\n" + e50.m7() + "\n\n";
                }
                sb.append(str);
                g8 = sb.toString();
            } catch (OutOfMemoryError e8) {
                e50.S0(e8);
            }
        }
        int i10 = 0;
        if (e50.Q1.y()) {
            if (!e50.g7) {
                g8 = e50.y(g8, arrayList);
            }
            if (arrayList.size() > 0) {
                if ((type == -1 && this.Va == -1) || this.k5 || i9 >= arrayList.size()) {
                    i9 = arrayList.size() - 1;
                }
                g8 = arrayList.get(i9);
                i10 = i9;
            }
            Q = e50.Q(e50.Q1.a(i8, i10, arrayList.size(), g8));
            j.d p7 = e50.Q1.p();
            this.m5 = p7;
            if (type == 1) {
                te(i8, com.flyersoft.staticlayout.j.c(Q, p7, i8), true);
            } else if (type == -1) {
                this.Xa = com.flyersoft.staticlayout.j.c(Q, p7, i8);
            } else if (!e50.g7) {
                this.n5 = Q;
                Ie();
                ph(com.flyersoft.staticlayout.j.c(Q, this.m5, i8));
                if (this.g8) {
                    e50.f2 = W8();
                }
            }
        } else {
            String y7 = e50.y(g8, arrayList);
            if (arrayList.size() > 0) {
                if ((type == -1 && this.Va == -1) || this.k5 || i9 >= arrayList.size()) {
                    i9 = arrayList.size() - 1;
                }
                y7 = arrayList.get(i9);
                i10 = i9;
            }
            Q = e50.Q(y7);
            if (type == 1) {
                te(i8, Q, true);
            } else if (type == -1) {
                this.Xa = Q;
            } else if (!e50.g7) {
                ph(Q);
            }
        }
        if (type == 1) {
            this.Ja = Q;
            this.Da = i8;
            this.Ea = i10;
            this.Ia = arrayList;
            return;
        }
        if (type == -1) {
            this.Za = Q;
            this.Ua = i8;
            this.Va = i10;
            this.Ya = arrayList;
            return;
        }
        this.n5 = Q;
        e50.g2 = i8;
        e50.h2 = i10;
        e50.G9 = arrayList;
    }

    private void c9(final String siteTag, String url, boolean first, final boolean forUpdateCur, final boolean showTip, S.WebBook savedBook) {
        DownloadTaskBrowser.CacheWebView cacheWebView;
        String string;
        if (savedBook == null) {
            savedBook = new S.WebBook();
        }
        this.wb = savedBook;
        savedBook.name = e50.Q1.d();
        this.wb.author = e50.Q1.b();
        S.WebBook webBook = this.wb;
        webBook.description = e50.Q1.k;
        webBook.url = url;
        if (siteTag.startsWith("$$")) {
            this.wb.tsBook = q50.P(e50.V1, siteTag);
            S.WebBook webBook2 = this.wb;
            webBook2.site = S.tsBook2Site(webBook2.tsBook, false);
        } else {
            this.wb.site = S.getSite(siteTag, true);
        }
        S.BookSite bookSite = this.wb.site;
        if (bookSite != null && bookSite.ok()) {
            if (showTip) {
                if (forUpdateCur) {
                    string = bookSite.name() + "·" + e50.D1();
                } else {
                    string = getString(R.string.qiehuanshuyuan);
                }
                K5(string, getString(R.string.gengxinzhangjieliebiaozhong), false);
            }
            if (siteTag.startsWith("$$")) {
                p9(siteTag, forUpdateCur, showTip);
                return;
            }
            bookSite.working = true;
            bookSite.firstExecute = first;
            this.xb = siteTag;
            DownloadTask.Result result = new DownloadTask.Result();
            result.callback = new g2(forUpdateCur, showTip);
            if (bookSite.javascriptTOC) {
                DownloadTaskBrowser.CacheWebView cacheWebView2 = this.ub;
                if (cacheWebView2 == null || cacheWebView2.destroyed) {
                    this.ub = DownloadTaskBrowser.createDownloadWebView();
                }
                cacheWebView = this.ub;
                cacheWebView.stop = false;
                int i8 = bookSite.TOCDelay;
                if (i8 == 0) {
                    i8 = 200;
                }
                cacheWebView.delayed = i8;
            } else {
                cacheWebView = null;
            }
            DownloadTask.download(cacheWebView, result, url, null, bookSite.userAgent);
            return;
        }
        o50.p2(this, getString(R.string.wuxiaoshuyuan) + q50.e0(siteTag));
    }

    public boolean ca(String filename, boolean includeFont, boolean includeMargins) {
        try {
            com.flyersoft.components.k kVar = new com.flyersoft.components.k(filename);
            ArrayList<String> d8 = kVar.d();
            if (d8.contains("typeset")) {
                ArrayList<String> C2 = o50.C2(o50.u1(kVar.l("typeset")));
                if (C2.get(0).equals("*pic")) {
                    e50.B3 = true;
                    String str = C2.get(1);
                    String str2 = "pic" + o50.k0(str);
                    if (d8.contains(str2)) {
                        String str3 = e50.V7 + com.ksdk.ssds.manager.b.b + o50.v0(str);
                        kVar.k(str2, str3);
                        e50.z3 = str3;
                    } else {
                        e50.z3 = str;
                    }
                } else {
                    e50.B3 = false;
                    e50.k3 = o50.z2(C2.get(1));
                }
                e50.f3 = o50.z2(C2.get(2));
                if (includeFont && C2.contains("*font")) {
                    int indexOf = C2.indexOf("*font");
                    e50.F3 = C2.get(indexOf + 1);
                    e50.H3 = C2.get(indexOf + 2).equals(pk2.e);
                    e50.G3 = C2.get(indexOf + 3).equals(pk2.e);
                    e50.K3 = C2.get(indexOf + 4).equals(pk2.e);
                    e50.L3 = C2.get(indexOf + 5).equals(pk2.e);
                    e50.I3 = C2.get(indexOf + 6).equals(pk2.e);
                    e50.J3 = C2.get(indexOf + 7).equals(pk2.e);
                    if (d8.contains("font.ttf")) {
                        kVar.k("font.ttf", e50.c3 + com.ksdk.ssds.manager.b.b + e50.F3 + (!e50.F3.contains(".") ? ".ttf" : ""));
                    }
                }
                if (includeMargins && C2.contains("*margin")) {
                    int indexOf2 = C2.indexOf("*margin");
                    e50.X3 = o50.z2(C2.get(indexOf2 + 1));
                    e50.Y3 = o50.z2(C2.get(indexOf2 + 2));
                    e50.Z3 = o50.z2(C2.get(indexOf2 + 3));
                    e50.c4 = o50.z2(C2.get(indexOf2 + 4));
                    e50.d4 = o50.z2(C2.get(indexOf2 + 5));
                    e50.a4 = o50.z2(C2.get(indexOf2 + 6));
                    e50.b4 = o50.z2(C2.get(indexOf2 + 7));
                }
                return true;
            }
        } catch (Exception e8) {
            e50.S0(e8);
        }
        return false;
    }

    private boolean cb() {
        return V8() == 0 || V8() == 1;
    }

    public void cc(int direction, boolean fromCurlFlip, boolean forCacheOnly) {
        boolean z7;
        int i8;
        yd();
        if ((forCacheOnly || !Qh()) && !Y9(direction, !forCacheOnly)) {
            try {
                com.flyersoft.staticlayout.l layout = this.Q1.getLayout();
                if (layout != null || Ya()) {
                    int scrollY = this.S1.getScrollY();
                    int h32 = e50.h3();
                    int lineHeight = this.Q1.getLineHeight();
                    int i9 = 0;
                    boolean z8 = direction == 1;
                    if (!forCacheOnly) {
                        if (this.z4 || X7() || S9() || SystemClock.elapsedRealtime() - this.E4 < 500) {
                            return;
                        }
                        this.A1 = true;
                        this.x5 = false;
                        K9();
                        if (this.L2) {
                            za(true);
                        }
                        J9();
                        e50.da = false;
                        this.s8 = -1L;
                        this.y4 = direction;
                        if (!e50.P9 && !e50.O9) {
                            if (((this.u6 && e50.S4()) || (!fromCurlFlip && e50.Q4())) && (e50.Z4() || !this.u6)) {
                                this.u6 = false;
                                if (g6()) {
                                    return;
                                }
                            }
                            if (((this.u6 && e50.S4()) || (!fromCurlFlip && kb())) && (e50.a5() || !this.u6)) {
                                this.u6 = false;
                                if (J6()) {
                                    return;
                                }
                            }
                        }
                        qd();
                        PDFReader pDFReader = this.F2;
                        if (pDFReader == null || !pDFReader.c) {
                            oe(this.v6 != 0.0f && e50.S4());
                        }
                    }
                    if (Kc(z8)) {
                        if (this.F2.c) {
                            return;
                        }
                        Yf(z8);
                        return;
                    }
                    if (!forCacheOnly) {
                        Ng();
                        this.A4 = SystemClock.elapsedRealtime();
                    }
                    if (q8() == 0) {
                        int M8 = M8(z8, forCacheOnly);
                        int ih = (ih(0) * h32) + (lineHeight * 2);
                        int i10 = e50.i2;
                        boolean z9 = i10 > 1 && scrollY < ih;
                        boolean z10 = i10 < e50.f4().size() + (-2) && this.Q1.getHeight() - ((h32 * ih(0)) + scrollY) < ih;
                        if (!z9 && !z10) {
                            nh(this.Q1.a0(M8));
                        }
                        e50.N5("reload txt..");
                        this.L4 = true;
                        if (!this.K2) {
                            int I = layout.I(M8);
                            String substring = I < this.Q1.getText2().length() + (-20) ? this.Q1.getText2().substring(I, I + 20) : null;
                            e50.f2 = e50.d4(I);
                            Wd();
                            tg(e50.f2, substring);
                            Xd();
                        }
                    } else {
                        boolean F7 = F7();
                        if (z8) {
                            try {
                            } catch (Exception e8) {
                                e50.S0(e8);
                                i9 = -1;
                            }
                            if (vb() && (F7 || e50.i0() || e50.h3() + scrollY >= this.Q1.getRealHeight() || !this.Q1.G0(T8() - 1))) {
                                z7 = true;
                                if (!z7) {
                                    ac();
                                    Yf(true);
                                    return;
                                }
                                if (scrollY == 0 && !z8) {
                                    if (Qh()) {
                                        return;
                                    }
                                    dc();
                                    Yf(false);
                                    return;
                                }
                                int M82 = M8(z8, forCacheOnly);
                                if (F7 || M82 <= 0 || !this.Q1.G0(M82 - 1)) {
                                    int a02 = this.Q1.a0(M82);
                                    if (!z8 || a02 > scrollY) {
                                        i8 = a02;
                                        if (i8 < 0) {
                                            i9 = i8;
                                        }
                                        nh(i9);
                                        if (!c5(direction, scrollY, i9) && z8) {
                                            sd(true);
                                        }
                                    }
                                } else if (!z8) {
                                    h32 = -h32;
                                }
                                i8 = h32 + scrollY;
                                if (i8 < 0) {
                                }
                                nh(i9);
                                if (!c5(direction, scrollY, i9)) {
                                    sd(true);
                                }
                            }
                        }
                        z7 = false;
                        if (!z7) {
                        }
                    }
                    if (forCacheOnly) {
                        return;
                    }
                    if (e50.O9 && q8() == 0) {
                        Eg(scrollY);
                    }
                    v9().sendEmptyMessage(direction);
                }
            } catch (Exception e9) {
                e50.S0(e9);
            }
        }
    }

    private void cf(long p7) {
        this.z3.setProgress((int) p7);
    }

    public static void ch() {
        if (o50.D1(a)) {
            return;
        }
        a.H1.sendEmptyMessage(z0);
    }

    public void clearCachedWebViews() {
        for (int childCount = this.U1.getChildCount() - 1; childCount >= 0; childCount--) {
            View childAt = this.U1.getChildAt(childCount);
            if ((childAt instanceof WebView) && childAt != this.C9 && childAt != this.ub) {
                WebView webView = (WebView) childAt;
                S.clearWebView(webView);
                this.U1.removeView(webView);
                webView.destroy();
            }
        }
    }

    public void createProgressDlg(String title, String info) {
        K5(title, info, true);
    }

    private void d5() {
        if (F7()) {
            e50.V6(this.S1);
            mh(this.S1.getPaddingLeft(), this.S1.getPaddingTop(), this.S1.getPaddingRight(), this.S1.getPaddingTop());
        }
    }

    public void d6(DownloadTask.Result result) {
        if (this.Nb.stop) {
            return;
        }
        S.BookSite bookSite = result.site;
        bookSite.last_url = result.final_url;
        ArrayList<S.WebBook> bookList = S.getBookList(result.html, bookSite);
        if (bookList.size() > 5) {
            o50.i2(h9(), "");
        }
        e50.N5("doCacheStoreUrlFinished, books: " + bookList.size());
        Iterator<S.WebBook> it = bookList.iterator();
        while (true) {
            if (!it.hasNext()) {
                break;
            }
            S.WebBook next = it.next();
            if (e50.Q1.d().equals(next.name) && e50.Q1.b().equals(next.author)) {
                e50.N5("=====found it======= " + next.url);
                o50.i2(h9(), next.url);
                q50.B(e50.V1, next);
                break;
            }
        }
        DownloadTaskBrowser.CacheWebView cacheWebView = this.Nb;
        cacheWebView.stop = true;
        S.clearWebView(cacheWebView);
    }

    private void d8() {
        int i8 = getResources().getConfiguration().orientation;
        if (Build.VERSION.SDK_INT >= 9) {
            e50.n4 = i8 == 2 ? 6 : 5;
        } else {
            e50.n4 = i8 != 2 ? 1 : 2;
        }
    }

    private int d9(int pos) {
        if (pos != -1 && this.K6 != null) {
            for (int i8 = 0; i8 < this.K6.size(); i8++) {
                e50.o oVar = this.K6.get(i8);
                int i9 = this.G6;
                int i10 = oVar.b + i9;
                int i11 = i9 + oVar.c;
                if (pos >= i10 && pos < i11) {
                    return i8;
                }
            }
        }
        return -1;
    }

    private boolean da(String file, f50.e c8) {
        String v02 = o50.v0(file);
        Iterator<String> it = c8.e.iterator();
        while (it.hasNext()) {
            String next = it.next();
            if (next.equals(v02)) {
                return true;
            }
            if (next.endsWith(com.ksdk.ssds.manager.b.b + v02)) {
                return true;
            }
        }
        return false;
    }

    private boolean db(float xMove, float yMove, MotionEvent event) {
        if (!B7() && SystemClock.elapsedRealtime() - this.A4 >= 500) {
            if (e50.R4() && xMove >= yMove && xMove > e50.k0(20.0f) && yMove < e50.k0(40.0f)) {
                this.S4 = true;
                bc(o9(event) - this.u5 < 0.0f ? 1 : -1);
                return true;
            }
            if (!e50.T4() || Ta(this.r9)) {
                return false;
            }
            if (xMove <= yMove && yMove > e50.k0(20.0f) && xMove < e50.k0(40.0f)) {
                this.S4 = true;
                bc(event.getY() - this.t5 < 0.0f ? 1 : -1);
            }
            return true;
        }
        return false;
    }

    private void dc() {
        ActivityMain.e0 = true;
        if (kb()) {
            this.Ka.d = true;
        }
        if (!e50.U5() && e50.h2 > 0) {
            je(e50.g2, e50.h2);
            e50.h2--;
            StringBuilder sb = new StringBuilder();
            f50 f50Var = e50.Q1;
            sb.append(f50Var != null ? f50Var.h().get(e50.g2).c : o50.v0(e50.V1));
            sb.append(" (");
            sb.append(e50.h2 + 1);
            sb.append(com.ksdk.ssds.manager.b.b);
            sb.append(e50.G9.size());
            sb.append(")");
            String sb2 = sb.toString();
            if (H9(sb2)) {
                return;
            }
            J5(sb2);
            this.X2 = true;
            Handler handler = this.F4;
            handler.sendMessageDelayed(handler.obtainMessage(4, -1), 50L);
            return;
        }
        int i8 = e50.g2;
        if (i8 > 0) {
            je(i8, e50.h2);
            e50.g2--;
            e50.h2 = -1;
            e50.f2 = e50.Q1.h().get(e50.g2).h;
            String str = e50.Q1.h().get(e50.g2).c;
            if (H9(str)) {
                return;
            }
            if (Da(e50.g2)) {
                J5(str);
            }
            e50.h2 = 0;
            this.X2 = true;
            this.k5 = true;
            Jd();
            if (e50.e4 == 0) {
                a8(50);
            }
        }
    }

    public void dd(boolean visible) {
        PDFThumbView2 pDFThumbView2;
        ImageView imageView = this.ja;
        if (imageView == null) {
            return;
        }
        if (this.F2.c) {
            visible = false;
        }
        if (visible) {
            imageView.setImageResource(e50.t3 ? R.drawable.pdf_unlock : R.drawable.pdf_lock);
            FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.ja.getLayoutParams();
            layoutParams.bottomMargin = this.y2.getHeight();
            if (e50.v3 && (pDFThumbView2 = this.ma) != null) {
                if (pDFThumbView2.getHeight() == 0) {
                    new q0(Looper.getMainLooper()).sendEmptyMessage(0);
                    return;
                }
                layoutParams.bottomMargin += this.ma.getHeight();
            }
            layoutParams.gravity = 85;
            layoutParams.bottomMargin -= e50.k0(8.0f);
        }
        this.ja.setVisibility(visible ? 0 : 8);
    }

    private void df() {
        if (this.T6 == null) {
            this.T6 = new x5();
        }
        this.N6.setOnUtteranceProgressListener(this.T6);
    }

    private void e5() {
        if (e50.W7 != 0) {
            this.H1.sendEmptyMessageDelayed(601, 500L);
        }
    }

    public void e6(DownloadTask.Result result) {
        DownloadTaskBrowser.CacheWebView cacheWebView;
        boolean z7 = false;
        this.tb = false;
        if (!isFinishing() && nb()) {
            if (result.noJavascript || (cacheWebView = this.ub) == null || !cacheWebView.stop) {
                S.BookSite bookSite = e50.Q1.p;
                bookSite.last_url = result.final_url;
                String chapterContent = S.getChapterContent(result.html, bookSite);
                q50.b bVar = this.sb;
                if (bVar != null) {
                    int i8 = bVar.e;
                    f50.e eVar = e50.Q1.h().get(i8);
                    if (Ra() && P4(this.sb.d, chapterContent)) {
                        ea(true);
                        if (DownloadTaskBrowser.reloadCacheWB(this.ub, result.url, this.yb, ItemTouchHelper.Callback.DEFAULT_SWIPE_ANIMATION_DURATION)) {
                            if (e50.g2 == i8) {
                                createProgressDlg("", eVar.c + "\n" + getString(R.string.downloading_content));
                                return;
                            }
                            return;
                        }
                    }
                    if (S.isVipChapter(eVar.c) || !o50.F1(chapterContent)) {
                        boolean Z = q50.Z(e50.Q1.d(), e50.Q1.b(), e50.Q1.p, i8, eVar.c, chapterContent, eVar.s, this.sb.f);
                        if (!this.sb.g.contains(result.url)) {
                            this.sb.g.add(result.url);
                        }
                        String nextContentUrl = S.getNextContentUrl(result.html, e50.Q1.p, this.sb.g, i8 < e50.Q1.h().size() - 1 ? e50.Q1.h().get(i8 + 1).s : null);
                        if (!o50.F1(nextContentUrl)) {
                            f50 f50Var = e50.Q1;
                            q50.b bVar2 = new q50.b(nextContentUrl, f50Var.p.userAgent, f50Var.h().get(i8).c, i8, true, null);
                            bVar2.g = this.sb.g;
                            this.rb.add(0, bVar2);
                            this.sb = null;
                            this.H1.sendEmptyMessageDelayed(Q0, o50.R1(200));
                            return;
                        }
                        if (Z) {
                            Pb(this.sb);
                        } else if (S.isVipChapter(eVar.c) && o50.F1(chapterContent) && e50.g2 == i8) {
                            ng();
                            z7 = true;
                        }
                        z7 = Z;
                    }
                    if (!z7 && e50.g2 == i8) {
                        hideProgressDlg();
                        Gf(null);
                    }
                } else {
                    z7 = true;
                }
                Y4(!z7);
                if (this.zb) {
                    return;
                }
                hideProgressDlg();
                return;
            }
            return;
        }
        hideProgressDlg();
    }

    private void e8() {
        int e02;
        NewCurl3D newCurl3D = this.R2;
        if (newCurl3D != null) {
            if (Ya()) {
                e02 = e50.l3;
            } else {
                e02 = !e50.B3 ? e50.k3 : o50.e0(e50.v1(e50.z3));
            }
            newCurl3D.g0 = e02;
        }
    }

    private int e9(int startLine, int curLine) {
        int Q2 = e50.Q2(this.S1, curLine);
        if (Q2 >= startLine) {
            return Q2;
        }
        int N8 = (N8() + startLine) - 1;
        return N8 > this.Q1.getLineCount() + (-1) ? this.Q1.getLineCount() - 1 : N8;
    }

    public void ea(boolean step) {
        int i8;
        DownloadTaskBrowser.CacheWebView cacheWebView = this.ub;
        if (cacheWebView == null || (i8 = cacheWebView.delayed) >= 5000) {
            return;
        }
        int i9 = step ? i8 + 1000 : i8 * 2;
        cacheWebView.delayed = i9;
        if (i9 > 5000) {
            cacheWebView.delayed = 5000;
        }
    }

    private boolean eb() {
        return e50.p4 == 17 || e50.q4 == 17 || e50.t4 == 17 || e50.u4 == 17;
    }

    private void ec() {
        if (e50.P9) {
            if (V8() == 2 || V8() == 3) {
                P6(false, false);
                e50.P9 = true;
            }
        }
    }

    public void ed() {
        ArrayList<String> arrayList = this.sa;
        if (arrayList == null || arrayList.size() == 0) {
            return;
        }
        boolean z7 = false;
        SharedPreferences sharedPreferences = getSharedPreferences(e50.V1.replace(com.ksdk.ssds.manager.b.b, "") + "_font", 0);
        Iterator<String> it = this.sa.iterator();
        while (it.hasNext()) {
            String next = it.next();
            if (o50.A1(e50.c3 + com.ksdk.ssds.manager.b.b + next + ".ttf")) {
                z7 = true;
            }
            sharedPreferences.edit().putString(next, "").commit();
        }
        if (z7) {
            pe(true);
            ee();
        } else {
            Jf();
        }
    }

    public void ef(int fromId) {
        int i8;
        try {
            this.q8 = false;
            if (this.K6 != null && this.N6 != null) {
                int i9 = this.R6;
                if (i9 != -2) {
                    fromId = i9 + 1;
                    this.R6 = -2;
                }
                e50.N5("tts_utteranceId 2*:" + this.Q6 + com.ksdk.ssds.manager.b.b + fromId + " size:" + this.K6.size());
                df();
                this.L7 = false;
                if (this.K7) {
                    this.K7 = false;
                    fromId = this.K6.size() - 1;
                }
                this.Q6 = fromId - 1;
                this.N6.setSpeechRate(e50.p6 / 10.0f);
                this.N6.setPitch(e50.q6 / 10.0f);
                for (int i10 = fromId; i10 < this.K6.size(); i10++) {
                    e50.o oVar = this.K6.get(i10);
                    if (i10 == fromId && e50.o6 != 3) {
                        int i11 = this.G6;
                        U9(oVar.b + i11, i11 + oVar.c);
                    }
                    HashMap<String, String> hashMap = new HashMap<>();
                    hashMap.put("utteranceId", String.valueOf(i10));
                    this.N6.speak(oVar.a, 1, hashMap);
                    if (e50.u6 && (i8 = e50.s6) > 0) {
                        this.N6.playSilence(i8, 1, null);
                    }
                    this.M6 = SystemClock.elapsedRealtime();
                }
                if (this.K6.size() == 0) {
                    Hg();
                }
            }
        } catch (Exception e8) {
            e50.S0(e8);
            o50.p2(this, e50.U0(e8));
        }
    }

    private boolean eg() {
        if (nb()) {
            return false;
        }
        if (!Ya() || (ic() && bd())) {
            return e50.m5;
        }
        return false;
    }

    private void eh(int l8, int t7, int r7, int b8) {
        if (Build.VERSION.SDK_INT >= 21) {
            View findViewById = this.r2.findViewById(R.id.notificationBar);
            if (e50.V9 != 1 && e50.G4() && e50.f5) {
                findViewById.setVisibility(8);
            } else {
                findViewById.getLayoutParams().height = t7;
                findViewById.setVisibility(0);
            }
            if (e50.b()) {
                getWindow().addFlags(Integer.MIN_VALUE);
                getWindow().setStatusBarColor(ViewCompat.MEASURED_STATE_MASK);
            }
            this.r2.setPadding(l8, 0, r7, b8);
            return;
        }
        this.r2.setPadding(l8, t7, r7, b8);
    }

    private void f5() {
        if (e50.f5 || Build.VERSION.SDK_INT < 21) {
            return;
        }
        getWindow().addFlags(Integer.MIN_VALUE);
        getWindow().setStatusBarColor(ViewCompat.MEASURED_STATE_MASK);
    }

    public void f6(boolean fromLongTap) {
        if (fromLongTap && this.C9 != null && !o50.F1(this.n5)) {
            String str = this.n5 + "\n@\n" + MRBookView.c;
            this.C9.loadDataWithBaseURL("", "<pre>" + str.replace("<", "&lt;").replace(">", "&gt;").replace("\n@\n", "<br><hr><br>") + "</code>", jb1.MIME_HTML, "UTF-8", null);
            return;
        }
        if (Ya()) {
            hd(true);
        } else {
            L6(true);
        }
    }

    public boolean f8(boolean front) {
        boolean z7;
        if (front) {
            this.P4 = null;
        }
        int i8 = 1;
        if (!front && this.X2) {
            if (this.S2.getVisibility() != 0) {
                Kf(this.U2);
            }
            Je(true);
            this.H1.sendEmptyMessageDelayed(p0, 10L);
            return false;
        }
        try {
            this.Y2 = true;
            boolean F7 = F7();
            if (this.W1.getWidth() > 0) {
                this.R2.Z(F7, this.W1.getWidth() - (this.W1.getPaddingLeft() * 2), this.U1.getHeight() - (this.W1.getPaddingTop() * 2));
            }
            if (front) {
                if (this.y4 == -1) {
                    o50.f2(this.W2);
                }
                this.W1.setTag(1);
            }
            long H8 = H8();
            if (!front) {
                this.T2 = H8;
            }
            if (front) {
                z7 = this.T2 == H8 && !o50.I1(this.V2);
                if (z7) {
                    o50.f2(this.U2);
                    this.U2 = this.V2;
                } else {
                    o50.f2(this.V2);
                    o50.f2(this.W2);
                    this.U2 = O8(false, b());
                    e8();
                }
            } else {
                this.V2 = !o50.I1(this.W2) ? this.W2 : O8(false, b());
                z7 = false;
            }
            Bitmap bitmap = front ? this.U2 : this.V2;
            boolean z8 = z7 && this.S2.getTag() != null;
            if (front) {
                NewCurl3D newCurl3D = this.R2;
                if (newCurl3D.f0 > 0) {
                    if (z8) {
                        newCurl3D.e0 = 2;
                    } else {
                        Kf(bitmap);
                    }
                }
            }
            if (F7) {
                if (front && z8) {
                    NewCurl3D.e[] eVarArr = this.R2.M0;
                    eVarArr[0] = eVarArr[2];
                    eVarArr[1] = eVarArr[3];
                } else {
                    Bitmap.Config config = Bitmap.Config.RGB_565;
                    NewCurl3D newCurl3D2 = this.R2;
                    Bitmap createBitmap = Bitmap.createBitmap(newCurl3D2.m0, newCurl3D2.n0, config);
                    NewCurl3D newCurl3D3 = this.R2;
                    Bitmap createBitmap2 = Bitmap.createBitmap(newCurl3D3.m0, newCurl3D3.n0, config);
                    int paddingTop = this.W1.getPaddingTop();
                    int paddingLeft = this.W1.getPaddingLeft();
                    NewCurl3D newCurl3D4 = this.R2;
                    Rect rect = new Rect(paddingLeft, paddingTop, newCurl3D4.m0 + paddingLeft, newCurl3D4.n0 + paddingTop);
                    NewCurl3D newCurl3D5 = this.R2;
                    Rect rect2 = new Rect(0, 0, newCurl3D5.m0, newCurl3D5.n0);
                    new Canvas(createBitmap).drawBitmap(bitmap, rect, rect2, (Paint) null);
                    Canvas canvas = new Canvas(createBitmap2);
                    int i9 = rect.right;
                    NewCurl3D newCurl3D6 = this.R2;
                    canvas.drawBitmap(bitmap, new Rect(i9, paddingTop, newCurl3D6.m0 + i9, newCurl3D6.n0 + paddingTop), rect2, (Paint) null);
                    this.R2.Y(front ? 0 : 2, createBitmap, true);
                    this.R2.Y(front ? 1 : 3, createBitmap2, true);
                }
            } else if (front && z8) {
                NewCurl3D.e[] eVarArr2 = this.R2.M0;
                eVarArr2[0] = eVarArr2[1];
            } else {
                this.R2.Y(front ? 0 : 1, bitmap, true);
            }
            if (this.R2.f0 > 0) {
                if (front) {
                    cc(this.y4, true, false);
                    pe(true);
                    if (this.y4 != 1) {
                        i8 = -1;
                    }
                    cg(i8);
                    return f8(false);
                }
                Message message = this.P4;
                if (message != null) {
                    this.P4 = null;
                    E9(message);
                }
            }
            this.Y2 = false;
            return true;
        } catch (Exception e8) {
            e50.S0(e8);
            this.Y2 = false;
            return false;
        } catch (OutOfMemoryError e9) {
            e50.S0(e9);
            System.gc();
            Je(false);
            this.Y2 = false;
            return false;
        }
    }

    public ArrayList<e50.o> f9() {
        int i8;
        int i9;
        Gg();
        if (Za()) {
            return uc();
        }
        com.flyersoft.staticlayout.l layout = this.Q1.getLayout();
        if (layout == null) {
            return null;
        }
        pe(true);
        int C = layout.C(this.S1.getScrollY());
        int e9 = e9(C, -1);
        if (q8() != 0) {
            e9 = T8() - 1;
            sd(false);
            this.I6 = true;
        } else {
            this.I6 = false;
        }
        int I = layout.I(C);
        int y7 = layout.y(e9);
        String text2 = this.Q1.getText2();
        if (nb() && (Va(e50.g2, text2, false) || text2.length() == 0)) {
            return null;
        }
        if (I < 10) {
            try {
                this.F6 = -1;
            } catch (Exception e8) {
                o50.q2(this, f50.c + e50.U0(e8), 1);
                e50.S0(e8);
                this.F6 = -1;
                this.G6 = I;
                String substring = text2.substring(I, y7);
                this.H6 = substring.replace("\n", "").replace(" ", "").length();
                return e50.V3(substring, false, this.I6, this.G6);
            }
        }
        int i10 = this.F6;
        if (i10 == -1 || i10 >= y7) {
            i10 = I;
            i8 = -1;
        } else {
            if (this.J6.indexOf(text2.charAt(i10)) != -1) {
                i10++;
            }
            i8 = I;
        }
        if (y7 < text2.length() - 20) {
            i9 = y7;
            while (i9 > i10 + 15 && this.J6.indexOf(text2.charAt(i9 - 1)) == -1) {
                i9--;
            }
        } else {
            i9 = y7;
        }
        this.F6 = i9;
        this.G6 = i10;
        String substring2 = text2.substring(i10, i9);
        if (i8 > i10 && text2.substring(i10, i8).trim().length() > 0 && !this.z1) {
            lh(i10);
            int B = layout.B(i10);
            if (B < C) {
                int y8 = layout.y(e9(C, B));
                if (y8 < text2.length() - 20) {
                    while (y8 > i10 + 15 && this.J6.indexOf(text2.charAt(y8 - 1)) == -1) {
                        y8--;
                    }
                }
                this.F6 = y8;
                substring2 = text2.substring(i10, y8);
            }
        }
        Me(true);
        this.H6 = substring2.replace("\n", "").replace(" ", "").length();
        return e50.V3(substring2, false, this.I6, this.G6);
    }

    public void fa() {
        e50.N5("*init3dHandler");
        if (this.R2 != null) {
            this.H1.sendEmptyMessage(k0);
        } else {
            this.H1.sendEmptyMessageDelayed(l0, 50L);
        }
    }

    private boolean fb(char c8) {
        return e50.J.indexOf(c8) != -1 || (e50.U6 && Character.getType(c8) == 5);
    }

    public void fc() {
        if (this.N6 != null) {
            ah(false);
            this.L7 = true;
            gh();
            if (this.w7.getVisibility() != 0) {
                sg(true, true);
            }
        }
    }

    private void fd() {
        if (this.Q9 != null) {
            za(true);
            this.C8.setVisibility(8);
            this.Q9.setVisibility(0);
            this.ka.setText(e50.O7);
        }
    }

    public boolean fe(int percent, boolean restartToMain, long delayTime) {
        if (!e50.j5(percent) && !e50.k5()) {
            return false;
        }
        e50.s6(restartToMain ? "**txt force reboot to main**" : "**txt force reboot**");
        e50.y6 = !restartToMain;
        e50.z6 = restartToMain;
        e50.e(this);
        e50.N5("*delay restart: " + delayTime);
        if (delayTime > 0) {
            X5(delayTime);
        } else {
            System.exit(0);
        }
        return true;
    }

    public void ff() {
        if (this.x8) {
            return;
        }
        int i8 = e50.c8;
        if (i8 > 0) {
            this.w8 = i8;
        }
        try {
            Rect rect = new Rect();
            getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);
            int i9 = rect.top;
            if (i9 > 0) {
                this.w8 = i9;
                e50.c8 = i9;
                this.x8 = true;
            } else {
                if (this.w8 != 0 || o50.D1(ActivityMain.e)) {
                    return;
                }
                ActivityMain.e.getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);
                int i10 = rect.top;
                if (i10 > 0) {
                    this.w8 = i10;
                    e50.c8 = i10;
                }
            }
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    public void fg(boolean always) {
        int l9;
        this.q2.setVisibility(8);
        if (kg() || this.C9 != null || !e50.S4() || this.u6 || this.K2 || F7() || Ya()) {
            return;
        }
        int R02 = o50.R0(this) - (kg() ? this.C8.getHeight() : 0);
        if (this.Q1.getRealHeight() < R02 * 2) {
            return;
        }
        int q8 = q8();
        if (q8 != 0) {
            if (q8 == 1 && this.P2.length() == 0) {
                return;
            }
        } else if (e50.f4().size() == 0) {
            return;
        }
        int width = this.q2.getWidth();
        int height = this.q2.getHeight();
        int q82 = q8();
        long j8 = 0;
        if (q82 == 0) {
            long j9 = R02;
            long i8 = i8() * j9;
            if (e50.x7() > 0) {
                j9 = e50.x7();
            }
            j8 = i8 / j9;
            l9 = (int) (l9() / 100000);
        } else if (q82 == 1 || q82 == 100) {
            l9 = (this.Q1.getRealHeight() / e50.h3()) + 1;
            j8 = (this.S1.getScrollY() * R02) / this.Q1.getRealHeight();
        } else {
            l9 = 1;
        }
        long j10 = j8 + (((R02 / l9) * j8) / R02);
        int v32 = (e50.v3() - width) - 1;
        int i9 = (int) j10;
        int i10 = R02 - height;
        if (i9 > i10 || (!e50.o8 && j10 > R02 - ((r7 * 2) / 3))) {
            i9 = i10 - 1;
        }
        int i11 = i9 >= 2 ? i9 : 2;
        this.q2.layout(v32, i11, width + v32, height + i11);
        this.q2.setVisibility(0);
        if (always) {
            return;
        }
        AlphaAnimation alphaAnimation = new AlphaAnimation(0.8f, 0.1f);
        alphaAnimation.setDuration(500L);
        this.q2.clearAnimation();
        this.q2.startAnimation(alphaAnimation);
        this.q2.setVisibility(8);
    }

    private void fh(int value) {
        if (value > 30) {
            value = ((value - 30) / 2) + 30;
        }
        this.F7.setProgress(value);
    }

    private void g5(View v7, MotionEvent event, boolean webOrPdf, boolean isAutoState, float xMove, float yMove) {
        PDFReader pDFReader;
        if (e50.N5) {
            return;
        }
        if (!(Ya() && (pDFReader = this.F2) != null && pDFReader.c) && (this.w5 || !e50.S4() || isAutoState || !(v7 instanceof ScrollView) || this.C9 != null || F7() || B7() || (q8() != 100 && q8() != 1))) {
            Wf(false);
            return;
        }
        int scrollY = this.S1.getScrollY();
        if (this.D5 == -1.0f) {
            this.D5 = scrollY;
            this.E5 = event.getY();
        } else if (this.I5 || (yMove > xMove && Math.abs(event.getY() - this.E5) > e50.k0(2.0f))) {
            this.E5 = event.getY();
            if (!this.I5) {
                float f8 = scrollY;
                if (this.D5 != f8) {
                    this.D5 = f8;
                    this.F5 = -1.0f;
                    this.G5 = 0.0f;
                }
            }
            if (this.F5 == -1.0f) {
                this.F5 = event.getY();
            } else {
                float y7 = event.getY() - this.F5;
                if (Math.abs(y7) > e50.k0(61.0f)) {
                    this.F5 = event.getY() - e50.k0(y7 <= 0.0f ? -61.0f : 61.0f);
                }
                if ((y7 > 0.0f && this.G5 < 0.0f) || (y7 < 0.0f && this.G5 > 0.0f)) {
                    Wf(false);
                    this.F5 = -1.0f;
                    this.G5 = 0.0f;
                } else {
                    this.G5 = y7;
                }
            }
        }
        if (this.I5 || ((this.G5 > e50.k0(8.0f) && this.S1.getScrollY() < e50.k0(2.0f)) || (this.G5 < (-e50.k0(8.0f)) && this.S1.getScrollY() > (this.Q1.getHeight() - e50.h3()) - e50.k0(2.0f)))) {
            Wf(true);
        }
    }

    private boolean g6() {
        if (Ya() && this.F2.c) {
            return false;
        }
        if (!f8(true)) {
            this.P4 = E5(0, null);
            return true;
        }
        E9(E5(0, null));
        return true;
    }

    private void g7() {
        Af(1);
    }

    private int g8() {
        if (e50.e4 == 1) {
            return (60 - e50.j4) * 8;
        }
        return (60 - e50.j4) * 10;
    }

    private int g9(long tp) {
        int i8 = 0;
        for (int i9 = 0; i9 < e50.G9.size(); i9++) {
            i8 += e50.G9.get(i9).length();
            if (i8 >= tp) {
                return i9;
            }
        }
        return 0;
    }

    private void ga() {
        if (this.A2 == null) {
            View inflate = ((ViewStub) this.y2.findViewById(R.id.stub_brightness)).inflate();
            this.A2 = inflate;
            inflate.setBackgroundColor(this.b3);
            this.A2.findViewById(R.id.setNightTheme2).setOnClickListener(this.U3);
            Ye();
            SeekBar seekBar = (SeekBar) this.A2.findViewById(R.id.brightnessSK);
            this.A3 = seekBar;
            seekBar.setMax(150);
            this.s4 = (RoundButton) this.A2.findViewById(R.id.autoCheck);
            RoundButton roundButton = (RoundButton) this.A2.findViewById(R.id.brightSwipeCheck);
            this.u4 = roundButton;
            roundButton.setChecked(e50.t5);
            this.A3.setOnSeekBarChangeListener(new j4());
            this.A2.findViewById(R.id.decTv).setOnClickListener(new l4());
            this.A2.findViewById(R.id.incTv).setOnClickListener(new m4());
            this.s4.setOnClickListener(new n4());
            this.u4.setOnClickListener(new o4());
            SeekBar seekBar2 = (SeekBar) this.A2.findViewById(R.id.opacitySK);
            this.B3 = seekBar2;
            seekBar2.setMax(95);
            this.B3.setProgress(e50.z5);
            RoundButton roundButton2 = (RoundButton) this.A2.findViewById(R.id.opacityCheck);
            this.t4 = roundButton2;
            roundButton2.setChecked(e50.y5);
            this.B3.setOnSeekBarChangeListener(new p4());
            this.A2.findViewById(R.id.decTv2).setOnClickListener(new q4());
            this.A2.findViewById(R.id.incTv2).setOnClickListener(new r4());
            this.t4.setOnClickListener(new s4());
        }
    }

    private boolean gb(MRTextView tv, Spanned spanStr, int line, float hx) {
        int B;
        for (com.flyersoft.staticlayout.n nVar : (com.flyersoft.staticlayout.n[]) spanStr.getSpans(this.Q1.getLayout().I(line > 0 ? line - 1 : 0), this.Q1.getLayout().M(line < tv.getRealLineCount() - 1 ? line + 1 : line), com.flyersoft.staticlayout.n.class)) {
            if (nVar.b != null && nVar.c > 0 && ((line == (B = this.Q1.getLayout().B(nVar.d)) || line == B - 1) && hx > nVar.i - e50.k0(48.0f) && hx < nVar.i)) {
                new com.flyersoft.seekbooks.i(this, nVar.b).show();
                return true;
            }
        }
        return false;
    }

    private void gc(Document.e o8, int indent) {
        while (o8 != null) {
            Document.e c8 = o8.c();
            this.wa.add(new PrefChapters.l(o8.g(), this.wa.size(), indent, c8 != null, true, o8.d(), null));
            if (c8 != null) {
                this.va = true;
                gc(c8, indent + 1);
            }
            o8 = o8.f();
        }
    }

    public void gd(boolean show) {
        PDFReader pDFReader;
        if (!show) {
            PDFThumbView2 pDFThumbView2 = this.ma;
            if (pDFThumbView2 == null || pDFThumbView2.getVisibility() != 0) {
                return;
            }
            this.ma.setVisibility(8);
            return;
        }
        if (e50.v3 && Ya() && (pDFReader = this.F2) != null && !pDFReader.c) {
            PDFThumbView2 pDFThumbView22 = this.ma;
            if (pDFThumbView22 == null) {
                if (pDFReader == null || pDFReader.b == null) {
                    return;
                }
                PDFThumbView2 pDFThumbView23 = new PDFThumbView2(this, null);
                this.ma = pDFThumbView23;
                pDFThumbView23.setTag(Integer.valueOf(Global.m));
                FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, e50.k0(e50.o8 ? 150.0f : 100.0f));
                layoutParams.bottomMargin = this.y2.getHeight();
                layoutParams.gravity = 80;
                this.na.addView(this.ma, layoutParams);
                this.ma.c(this.qa, new l0());
                new m0(Looper.getMainLooper()).sendEmptyMessage(0);
                return;
            }
            pDFThumbView22.setVisibility(0);
            this.ma.b(rc());
            this.F2.set_thumb(this.ma);
            return;
        }
        PDFThumbView2 pDFThumbView24 = this.ma;
        if (pDFThumbView24 != null) {
            pDFThumbView24.setVisibility(8);
        }
    }

    private void ge(final boolean restore) {
        if (!e50.P9 && e50.g5 && !Ya() && this.C9 == null && e50.l7()) {
            if ((restore || F7()) && vb()) {
                a6();
                new j0(Looper.getMainLooper()).sendEmptyMessageDelayed(this.S1.getScrollY(), 100L);
            }
        }
    }

    private void gf(int m22, int left, int bottom) {
        if (kg()) {
            if (m22 == 0) {
                this.G8.setVisibility(8);
                this.C8.setPadding(0, 0, 0, 0);
                hf(false);
                return;
            }
            int i8 = m22 + ((left * 12) / 10);
            int height = (bottom / 2) - ((this.C8.getHeight() * 3) / 10);
            if (height < e50.k0(5.0f)) {
                height = e50.k0(5.0f);
            }
            if (e50.Y4()) {
                height -= e50.k0(4.0f);
            }
            int k02 = i8 - e50.k0(3.0f);
            View view = this.C8;
            if (k02 <= 0) {
                k02 = 0;
            }
            view.setPadding(k02, 0, i8 + e50.k0(1.0f), height);
            this.D8.setBackgroundDrawable(null);
            this.H8.setBackgroundDrawable(null);
            this.G8.setVisibility(0);
            this.E8.setVisibility(8);
            jf();
        }
    }

    private void gh() {
        try {
            this.N6.stop();
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    private void h5() {
        if (this.w3 != e50.c5) {
            e50.y6 = true;
            e50.e(this);
            finish();
            if (!o50.D1(ActivityMain.e)) {
                ActivityMain.e.finish();
            }
            startActivity(new Intent(this, (Class<?>) ActivityMain.class));
            return;
        }
        if (a5()) {
            return;
        }
        if (this.o3 != e50.f5) {
            if (e50.G4()) {
                ce();
                return;
            }
            f5();
            Qe(false);
            if (e50.V4()) {
                hf(true);
            }
        }
        if (e50.f5 && (this.n3 != e50.E2 || this.m3 != e50.V9)) {
            ce();
            return;
        }
        if (!this.y3.equals(q50.O())) {
            ce();
            return;
        }
        this.U1.setKeepScreenOn(e50.h5);
        if (this.r3 != e50.A2 && !Ya()) {
            j1 = true;
            ee();
            return;
        }
        if (this.q3 != e50.b5) {
            e50.l6();
            if (q8() == 0) {
                e50.X();
                tg(e50.f2, null);
            } else {
                r5();
                Jd();
            }
        } else {
            String str = "" + e50.W6 + e50.Y6 + e50.a7 + e50.Z6 + e50.b7 + e50.c7 + e50.d7 + e50.e7 + e50.f7;
            if ((this.p3 != e50.X6 || !this.x3.equals(str)) && (q8() == 100 || q8() == 1)) {
                J5(e50.V1);
                if (this.p3 != e50.X6) {
                    e50.S8 = null;
                    com.flyersoft.staticlayout.j.j();
                }
                e50.Q1 = null;
                Jd();
            }
        }
        if (this.s3 != e50.k5 || this.t3 != e50.m5 || this.v3 != e50.l5) {
            if (F7()) {
                ee();
            } else {
                k5();
                o5();
            }
        }
        boolean z7 = this.u3;
        boolean z8 = e50.a3;
        if (z7 == z8 || !z8) {
            return;
        }
        this.H1.sendEmptyMessageDelayed(W0, 100L);
    }

    public void h6() {
        boolean z7 = e50.M2;
        Td();
        if (Za()) {
            Lc();
            e50.c2 = e50.c2 == 0 ? 1 : 0;
            jd(true);
        } else {
            int M3 = e50.M3(e50.Z8);
            int M32 = e50.M3(e50.b9);
            int Y1 = e50.Y1();
            int i8 = e50.A5;
            if (!e50.M2) {
                if (Y1 != M3) {
                    e50.w6(e50.b9, true);
                }
                e50.F6 = i8;
                if (e50.J6) {
                    int i9 = e50.I6;
                    e50.A5 = i9;
                    Ze(i9, false);
                }
                Cb(e50.Z8, e50.B6);
            } else {
                int i10 = e50.F6;
                e50.A5 = i10;
                Ze(i10, false);
                if (M32 != -1 && M32 != M3) {
                    Cb(e50.b9, e50.B6);
                } else {
                    Cb("2", e50.B6);
                }
            }
            if (this.C9 != null) {
                Od();
            }
        }
        e50.J6(!e50.M2);
        e50.sa = true;
        Ye();
        com.flyersoft.discuss.z.notifyThemeChanged();
        if (e50.b() && e50.f5) {
            getWindow().setStatusBarColor(ViewCompat.MEASURED_STATE_MASK);
        }
    }

    private void h7() {
        String charSequence;
        String str;
        EditText editText = new EditText(this);
        if (Ya()) {
            charSequence = "" + (rc() + 1);
        } else {
            charSequence = this.r2.getVisibility() == 0 ? this.k2.getText().toString() : P8();
        }
        editText.setSingleLine();
        editText.setText(charSequence);
        m.c cVar = new m.c(this);
        if (Ya()) {
            str = "1 - " + this.qa.k();
        } else {
            str = "0.0% - 100%";
        }
        cVar.z(str).B(editText).v(R.string.ok, new v5(editText)).o(R.string.cancel, null).C();
    }

    private long h8(int pageAdd) {
        if (this.Q8 == -1) {
            long o8 = o8();
            if (o8 == 0) {
                o8 = 1;
            }
            int q8 = q8();
            if (q8 == 0) {
                this.Q8 = (((l9() * e50.f2) / o8) / 100000) + 1;
            } else if (q8 == 1) {
                this.Q8 = (((l9() * (e50.U5() ? e50.f2 : (e50.Z7 * e50.h2) + e50.f2)) / o8) / 100000) + 1;
            } else if (q8 == 100) {
                if (this.Q1.getRealHeight() > 0) {
                    this.Q8 = (((l9() * f50.s(e50.g2)) / o8) / 100000) + ((((r6 / e50.h3()) + 1) * (this.S1.getScrollY() + (e50.h3() / 5))) / r6) + 1;
                } else {
                    this.Q8 = 1L;
                }
            }
        }
        long j8 = this.Q8 + pageAdd;
        this.Q8 = j8;
        if (j8 < 1) {
            this.Q8 = 1L;
        }
        if (this.Q8 > l9() / 100000) {
            this.Q8 = l9() / 100000;
        }
        return this.Q8;
    }

    private String h9() {
        return S.getStoreUrlFile(e50.Q1.d(), e50.Q1.b());
    }

    private void hd(boolean reverse) {
        if (reverse) {
            this.F2.c = !r5.c;
        }
        this.ja.setVisibility(this.F2.c ? 8 : 0);
        this.d2.setImageResource(this.F2.c ? R.drawable.mrbookview2 : R.drawable.text_reflow);
        za(true);
        PDFReader pDFReader = this.F2;
        if (pDFReader.c) {
            pDFReader.setVisibility(8);
            e50.K5(false);
            this.t2.setVisibility(0);
            this.Q1.setText(mc(e50.f2));
            kh(0);
        } else {
            pDFReader.setVisibility(0);
            this.t2.setVisibility(8);
            this.F2.b.viewGotoPage((int) e50.f2);
        }
        k5();
    }

    public void he() {
        try {
            this.L7 = true;
            gh();
            Gg().removeMessages(5);
            Gg().sendEmptyMessageDelayed(5, 100L);
            ah(true);
        } catch (Exception e8) {
            e50.S0(e8);
            Tg();
            o50.p2(this, e50.U0(e8));
        }
    }

    public void hg() {
        String str;
        if (this.L2) {
            try {
                int q8 = q8();
                long j8 = 1000;
                if (q8 == 0) {
                    this.j2.setText(o50.v0(e50.V1));
                    if (e50.x7() > 0) {
                        if (!Ka()) {
                            j8 = (i8() * 1000) / e50.x7();
                        }
                        cf(j8);
                        return;
                    }
                    this.z3.setProgress(0);
                    return;
                }
                int i8 = 1;
                if (q8 == 1) {
                    this.j2.setText(o50.v0(e50.V1));
                    if (!Ka()) {
                        if (e50.U5()) {
                            j8 = this.P2.length() > 0 ? (x8() * 1000) / o8() : 0L;
                        } else {
                            j8 = (x8() * 1000) / o8();
                        }
                    }
                    cf(j8);
                    return;
                }
                if (q8 == 7) {
                    this.j2.setText(e50.D1());
                    int k8 = this.qa.k();
                    this.z3.setMax(k8 - 1);
                    this.z3.setProgress(rc());
                    TextView textView = this.k2;
                    if (this.C8.getVisibility() == 0) {
                        str = this.J8.getText().toString();
                    } else {
                        str = "" + (rc() + 1) + com.ksdk.ssds.manager.b.b + k8;
                    }
                    textView.setText(str);
                    return;
                }
                if (q8 != 100) {
                    return;
                }
                this.j2.setText(e50.Q1.d());
                if (nb()) {
                    int i9 = 1000;
                    if (!Ka()) {
                        i9 = (e50.g2 * 1000) / e50.Q1.h().size();
                    }
                    if (e50.g2 <= 0 || i9 != 0) {
                        i8 = i9;
                    }
                    cf(i8);
                    return;
                }
                if (E8() > 0) {
                    pe(false);
                    long x8 = x8();
                    if (!Ka()) {
                        j8 = (1000 * x8) / E8();
                    }
                    if (x8 > 0 && j8 == 0) {
                        j8 = 1;
                    }
                    cf(j8);
                    return;
                }
                this.z3.setProgress(0);
            } catch (Exception e8) {
                e50.S0(e8);
            }
        }
    }

    public void hh(long p7) {
        if (p7 > 0) {
            MRTextView mRTextView = this.Q1;
            this.R1.D0 = true;
            mRTextView.D0 = true;
        }
        k5();
        new f5(Looper.getMainLooper()).sendEmptyMessageDelayed((int) p7, V7(false) ? 50L : 0L);
    }

    public boolean i5() {
        if (Ba()) {
            e50.L5 = SystemClock.elapsedRealtime();
            return false;
        }
        if (e50.F5 && SystemClock.elapsedRealtime() - e50.L5 > e50.G5 * 60 * 1000) {
            this.x5 = false;
            e50.L5 = SystemClock.elapsedRealtime();
            if (this.z1) {
                return false;
            }
            View inflate = LayoutInflater.from(this).inflate(R.layout.health_remind, (ViewGroup) null);
            ((TextView) inflate.findViewById(R.id.tipTv)).setText(e50.W0("(提醒间隔为" + e50.G5 + "分钟, 可在阅读设置里调整)"));
            TextView textView = (TextView) inflate.findViewById(R.id.timeTv);
            textView.setText("60");
            if (!e50.p5()) {
                e50.Z0(inflate);
            }
            m.c cVar = new m.c(this);
            this.B8 = cVar;
            cVar.B(inflate).d(false).C();
            this.A8 = System.currentTimeMillis();
            new Timer().schedule(new b(textView), 10L, 100L);
            return true;
        }
        if (e50.H5 && !this.z1 && !e50.M5) {
            Calendar calendar = Calendar.getInstance();
            calendar.set(calendar.get(1), calendar.get(2), calendar.get(5), e50.I5, e50.J5, 0);
            long timeInMillis = calendar.getTimeInMillis();
            long currentTimeMillis = System.currentTimeMillis();
            if (((currentTimeMillis - timeInMillis) / 60) / 1000 < 15 && currentTimeMillis > timeInMillis) {
                this.x5 = false;
                e50.M5 = true;
                new m.c(this).z(o50.E2()).m(e50.K5).v(R.string.ok, null).C();
                return true;
            }
        }
        return false;
    }

    public void i6(boolean longTap) {
        try {
            Fb((Za() ? this.F2.p0 : n9().R0.replace(e50.H9, ' ')).trim(), longTap);
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    public boolean i7() {
        int X3;
        int q8 = q8();
        boolean z7 = false;
        if (q8 == 0 || q8 == 1) {
            if (e50.Y3().size() > 0 && (X3 = e50.X3(e50.f2, null, null)) < e50.Y3().size() - 1) {
                if (X3 == 0 && e50.f2 < e50.Y3().get(0).a(0)) {
                    e50.f2 = e50.Y3().get(0).a(0);
                } else {
                    long j8 = e50.f2;
                    int i8 = X3 + 1;
                    long a8 = e50.Y3().get(i8).a(i8);
                    e50.f2 = a8;
                    if (j8 == a8 && X3 < e50.Y3().size() - 2) {
                        int i9 = X3 + 2;
                        e50.f2 = e50.Y3().get(i9).a(i9);
                    }
                }
                Jd();
                z7 = true;
            }
        } else if (q8 != 7) {
            if (q8 == 100 && e50.Q1 != null && e50.g2 < e50.Q1.h().size() - 1) {
                e50.g2++;
                e50.f2 = 0L;
                e50.h2 = 0;
                this.k5 = false;
                q5();
                e50.e(this);
                if (Da(e50.g2)) {
                    J5(e50.Q1.h().get(e50.g2).c);
                }
                Jd();
                z7 = true;
            }
        } else if (!Ka()) {
            o7();
            z7 = true;
        }
        if (!z7) {
            if (!Ya()) {
                o50.p2(this, getString(R.string.no_next_chapter));
            }
        } else {
            Td();
        }
        return z7;
    }

    private long i8() {
        int scrollY = this.S1.getScrollY();
        int realHeight = this.Q1.getRealHeight();
        if (realHeight == 0) {
            return 0L;
        }
        int q8 = q8();
        if (q8 == 0) {
            int x12 = (e50.x1(e50.i2) * scrollY) / realHeight;
            return e50.m3(e50.i2 != 0 ? r0 - 1 : 0) + x12;
        }
        if (q8 != 1) {
            if (q8 != 100 || e50.Q1.h().size() == 0) {
                return 0L;
            }
            return f50.s(e50.g2 != 0 ? r0 - 1 : 0) + ((e50.Q1.h().get(e50.g2).h * scrollY) / realHeight);
        }
        return (this.P2.length() * scrollY) / realHeight;
    }

    private int i9() {
        try {
            int i8 = (Settings.System.getInt(getContentResolver(), "screen_brightness") * 100) / 255;
            if (Build.VERSION.SDK_INT >= 29) {
                return i8;
            }
            int i9 = Calendar.getInstance().get(11);
            return (i9 <= 8 || i9 >= 19 || i8 >= 30) ? (i9 > 21 || i9 < 6) ? i8 + 0 : i8 < 30 ? i8 + 5 : i8 : i8 + 15;
        } catch (Exception e8) {
            e50.S0(e8);
            return 50;
        }
    }

    private void ia() {
        if (this.B2 == null) {
            View inflate = ((ViewStub) this.y2.findViewById(R.id.stub_color)).inflate();
            this.B2 = inflate;
            inflate.setBackgroundColor(this.b3);
            this.B2.findViewById(R.id.fontColor).setOnClickListener(this.U3);
            this.B2.findViewById(R.id.backgroundColor).setOnClickListener(this.U3);
            this.B2.findViewById(R.id.backgroundColorTv).setOnClickListener(this.U3);
            this.B2.findViewById(R.id.backgroundImage).setOnClickListener(this.U3);
            this.B2.findViewById(R.id.backgroundImageTv).setOnClickListener(this.U3);
            this.B2.findViewById(R.id.saveTheme).setOnClickListener(this.U3);
            this.B2.findViewById(R.id.exportTheme).setOnClickListener(this.U3);
            this.B2.findViewById(R.id.importTheme).setOnClickListener(this.U3);
            this.B2.findViewById(R.id.setNightTheme).setOnClickListener(this.U3);
        }
        Ah();
    }

    private boolean ib(MotionEvent event, boolean checkHighlight) {
        int I;
        int M;
        this.c6 = null;
        this.d6 = true;
        if (Za() || this.C9 != null || e50.i0()) {
            return false;
        }
        if (this.I9 && Pa(event, true, true)) {
            return true;
        }
        if (Oa()) {
            try {
                View view = e50.y8;
                ScrollView2 scrollView2 = this.T1;
                if (view != scrollView2) {
                    scrollView2 = this.S1;
                }
                MRTextView n9 = n9();
                Spanned spanned = n9.getSpanned();
                if (spanned == null) {
                    return false;
                }
                int scrollY = scrollView2.getScrollY();
                int paddingLeft = scrollView2.getPaddingLeft();
                int paddingTop = scrollView2.getPaddingTop();
                float x7 = event.getX() - paddingLeft;
                int y7 = (((int) event.getY()) + scrollY) - paddingTop;
                com.flyersoft.staticlayout.l layout = n9.getLayout();
                if (layout == null || y7 > n9.getHeight()) {
                    return false;
                }
                int C = layout.C(y7);
                if (n9.C0() > 0 && C >= n9.C0()) {
                    return false;
                }
                if (gb(n9, spanned, C, x7)) {
                    return true;
                }
                int T = n9.T(C, x7);
                if (T == -1 || (M = layout.M(C)) == (I = layout.I(C))) {
                    return false;
                }
                if (T == I && x7 < n9.h0(C, I) - e50.k0(20.0f)) {
                    return false;
                }
                if (T >= M) {
                    if (T == M) {
                        T = M - 1;
                    }
                    int width = n9.getWidth();
                    int i8 = M - I;
                    if ((i8 == 1 && n9.h0(C, I) < width / 3 && x7 > width / 3) || x7 > n9.h0(C, M) + e50.k0(20.0f)) {
                        return false;
                    }
                    if (i8 == 1 && spanned.charAt(I) == 65532 && ((x7 < width / 3 || x7 > (width * 2) / 3) && n9.S(C) > n9.S(C) * 2)) {
                        return false;
                    }
                }
                int T2 = x7 > ((float) e50.k0(16.0f)) ? this.Q1.T(C, x7 - e50.k0(16.0f)) : I < T ? T - 2 : T;
                if (T2 >= I) {
                    I = T2;
                }
                int T3 = x7 < ((float) (this.Q1.getWidth() - e50.k0(16.0f))) ? this.Q1.T(C, x7 + e50.k0(16.0f)) : M > T ? T + 2 : T;
                if (T3 <= M) {
                    M = T3;
                }
                MyUrlSpan t9 = t9(I, M, T, spanned);
                if (t9 != null) {
                    t9.b = true;
                    if (P7(spanned, t9, t9.b())) {
                        return true;
                    }
                }
            } catch (Exception e8) {
                e50.S0(e8);
            }
        }
        return checkHighlight && Ua(event);
    }

    private boolean ic() {
        if (this.ta == 0) {
            this.ta = getSharedPreferences("pdf_words_failed", 0).contains(e50.V1) ? 2 : 1;
        }
        return this.ta == 1;
    }

    private void id(boolean full) {
        Boolean bool = this.xa;
        if (bool == null || bool.booleanValue() != full) {
            e50.N5("*pdfCheckStatusBar--------");
            this.xa = Boolean.valueOf(full);
            if (full) {
                this.J8.setBackgroundDrawable(null);
                this.J8.setPadding(0, 0, e50.k0(4.0f), 0);
                hf(true);
                xh();
            } else {
                this.J8.setBackgroundColor(-1442840576);
                this.J8.setTextColor(-1);
                this.J8.setPadding(e50.k0(4.0f), 0, e50.k0(4.0f), 0);
            }
            int i8 = full ? 0 : 4;
            this.O8.setVisibility(i8);
            this.H8.setVisibility(i8);
            this.I8.setVisibility(i8);
            this.K8.setVisibility(i8);
        }
    }

    private void ie(MotionEvent event) {
        if (rb(e50.a8, event)) {
            int action = event.getAction();
            if (action != 0) {
                if (action != 1) {
                    if (action == 2) {
                        xa();
                        this.W5.addMovement(event);
                        this.W5.computeCurrentVelocity(1000);
                        this.V5 = Math.abs(e50.a8 < 2 ? this.W5.getYVelocity() : this.W5.getXVelocity());
                        return;
                    }
                    if (action != 3) {
                        return;
                    }
                }
                Id();
                return;
            }
            this.V5 = 0.0f;
            xa();
            this.W5.addMovement(event);
            return;
        }
        if (this.W5 == null || event.getAction() != 1) {
            return;
        }
        Id();
    }

    public void ig() {
        this.x9 = true;
        Bg();
        e50.H7(this.j9, 0);
        e50.H7(this.k9, 0);
    }

    private void initView() {
        this.U1 = (FrameLayout) findViewById(R.id.txtFrame);
        this.a2 = (ContentLay) findViewById(R.id.contentLay);
        this.b2 = findViewById(R.id.dualPageBackground);
        this.t2 = findViewById(R.id.txtLay);
        this.Z1 = findViewById(R.id.shadeView);
        this.S1 = (ScrollView2) findViewById(R.id.txtScrollView01);
        this.T1 = (ScrollView2) findViewById(R.id.txtScrollView02);
        this.Q1 = (MRTextView) findViewById(R.id.txtTextView01);
        MRTextView mRTextView = (MRTextView) findViewById(R.id.txtTextView02);
        this.R1 = mRTextView;
        MRTextView mRTextView2 = this.Q1;
        mRTextView.d = false;
        mRTextView2.d = false;
        this.S1.setSmoothScrollingEnabled(false);
        this.T1.setSmoothScrollingEnabled(false);
        this.S1.setFadingEdgeLength(0);
        this.T1.setFadingEdgeLength(0);
        bf();
        ScrollView2 scrollView2 = (ScrollView2) findViewById(R.id.scrollCache);
        this.La = scrollView2;
        scrollView2.setSmoothScrollingEnabled(false);
        this.La.setFadingEdgeLength(0);
        this.La.setOnTouchListener(this);
        MRTextView mRTextView3 = (MRTextView) findViewById(R.id.txtCache);
        this.Ka = mRTextView3;
        mRTextView3.d = true;
        this.V1 = (FrameLayout) findViewById(R.id.txtScrollLay);
        this.W1 = (FrameLayout) findViewById(R.id.curl3dLay);
        this.i2 = (FlipImageView) findViewById(R.id.flipImageView);
        this.c2 = (ImageView) findViewById(R.id.linkBackIv);
        this.e2 = (ImageView) findViewById(R.id.ttsB);
        this.q2 = (DotImageView) findViewById(R.id.txtScrollPos);
        sa();
        pa();
        this.S1.setOnTouchListener(this);
        this.T1.setOnTouchListener(this);
        this.i2.setOnTouchListener(this);
        this.c2.setOnClickListener(this);
        this.e2.setOnClickListener(this);
        Qe(false);
        this.L2 = false;
        this.M2 = 0L;
        ya();
        if (!Ya()) {
            e50.K5(false);
            H4();
        } else {
            this.U1.setBackgroundColor(ViewCompat.MEASURED_STATE_MASK);
        }
        this.U1.setKeepScreenOn(e50.h5);
        this.a2.setDrawingCacheEnabled(false);
        this.a2.setAnimationCacheEnabled(false);
        Z4();
        d5();
        if (e50.c5 || q8() == 100) {
            xg();
        }
        if (Nb()) {
            if ((e50.g5 && e50.A2 && q8() != 7) || e50.c5) {
                return;
            }
            ka(false);
        }
    }

    private String j9(String html, String file, String idStr) {
        int indexOf = html.indexOf("<a name=" + file + ">");
        int indexOf2 = indexOf != -1 ? html.indexOf(idStr, indexOf) : -1;
        if (indexOf2 == -1) {
            indexOf2 = html.indexOf(idStr);
        }
        if (idStr == null || indexOf2 == -1) {
            return null;
        }
        this.n5 = e50.x(html);
        int i8 = 0;
        if (!e50.U5()) {
            if (indexOf != -1) {
                int i9 = 0;
                int i10 = 0;
                while (true) {
                    if (i9 >= e50.G9.size()) {
                        break;
                    }
                    i10 += e50.G9.get(i9).length();
                    if (i10 > indexOf2) {
                        i8 = i9;
                        break;
                    }
                    i9++;
                }
            }
            while (i8 < e50.G9.size()) {
                if (e50.G9.get(i8).indexOf(idStr) != -1) {
                    e50.h2 = i8;
                    return e50.G9.get(i8);
                }
                i8++;
            }
        } else {
            e50.h2 = 0;
        }
        return this.n5;
    }

    private boolean jb(String html, String idStr, int idPos) {
        String str;
        this.c6 = null;
        if (html != null && idStr != null) {
            String substring = idStr.endsWith("\"") ? idStr.substring(0, idStr.length() - 1) : idStr;
            int length = substring.length() - 1;
            while (true) {
                if (length <= 3) {
                    str = null;
                    break;
                }
                char charAt = substring.charAt(length);
                if (length == substring.length() - 1) {
                    if (!o50.o(charAt)) {
                        return false;
                    }
                } else if (!o50.o(charAt)) {
                    str = substring.substring(0, length + 1);
                    break;
                }
                length--;
            }
        } else {
            return false;
        }
    }

    private boolean jc() {
        if (this.qa.a()) {
            return true;
        }
        ad(getString(R.string.pdf_cannot_modify));
        return false;
    }

    private void je(int lastChapter, int lastSplitIndex) {
        if (this.n5 == null) {
            return;
        }
        te(lastChapter, this.Q1.getText(), false);
        this.Da = lastChapter;
        this.Ea = lastSplitIndex;
        this.Ia = (ArrayList) e50.G9.clone();
        this.Ja = this.n5;
        if (!e50.Q4() || e50.Q1 == null) {
            return;
        }
        this.Na = this.Da;
        this.Oa = this.Ea;
        this.Ma = O8(false, b());
        e50.N5("*" + this.Da + " : " + this.Ma.toString());
    }

    public void jg() {
        View view = this.Z1;
        if (view == null) {
            return;
        }
        if (e50.A5 > 0 && !e50.y5) {
            if (view.getVisibility() != 8) {
                this.Z1.setVisibility(8);
                return;
            }
            return;
        }
        int i8 = e50.z5;
        int Y8 = e50.y5 ? ((i8 * 180) / 80) + Y8() : Y8();
        if (i8 > 80) {
            i8 = 80;
        }
        boolean z7 = e50.y5;
        int i9 = z7 ? 200 - ((i8 * 190) / 80) : 0;
        int i10 = z7 ? 180 - ((i8 * 170) / 80) : 0;
        int i11 = z7 ? 60 - ((i8 * 60) / 80) : 0;
        if (Y8 > 230) {
            Y8 = 230;
        }
        this.Z1.setBackgroundColor(Color.argb(Y8, i9, i10, i11));
        this.Z1.setVisibility(0);
    }

    private void jh(int y7) {
        if (this.R1.getVisibility() != 0) {
            this.R1.setVisibility(0);
        }
        if (this.T1.getScrollY() != y7) {
            U7(this.R1, y7);
            this.T1.scrollTo(0, y7);
            if (SystemClock.elapsedRealtime() - this.o5 < 100) {
                Ph(this.S1.getScrollY(), this.Q1.getHeight());
                Ih();
            }
        }
    }

    public void k5() {
        if (kg() && this.C9 == null) {
            this.C8.setVisibility(0);
            hf(true);
            Ih();
            if (Ya()) {
                this.xa = null;
                bd();
            }
        } else {
            this.C8.setVisibility(8);
        }
        W4();
    }

    public String k8() {
        String N02;
        int indexOf;
        f50 f50Var = e50.Q1;
        if (f50Var != null) {
            return f50Var.b();
        }
        return (q8() != 0 || (indexOf = (N02 = o50.N0(e50.V1)).indexOf(" - ")) <= 0) ? "" : N02.substring(indexOf + 3).trim();
    }

    private int k9(String html, String tag1, String tag12, String tag2, String tag22, int start) {
        int indexOf = html.indexOf(tag1, start);
        if (indexOf == -1) {
            indexOf = html.indexOf(tag12, start);
        }
        if (indexOf == -1) {
            indexOf = html.indexOf(tag2, start);
        }
        return indexOf == -1 ? html.indexOf(tag22, start) : indexOf;
    }

    public void ka(boolean forceRecreate) {
        if (this.R2 == null || forceRecreate) {
            if (forceRecreate || Nb()) {
                e50.N5("*initCurl3d");
                NewCurl3D newCurl3D = this.R2;
                if (newCurl3D != null) {
                    newCurl3D.M();
                    this.W1.removeView(this.R2);
                    this.H1.sendEmptyMessage(k0);
                }
                if (Mb()) {
                    this.W1.setVisibility(0);
                } else {
                    this.W1.setVisibility(4);
                }
                if (F7() && e50.D2) {
                    Rect rect = new Rect();
                    getResources().getDrawable(R.drawable.bookstyle).getPadding(rect);
                    int i8 = (rect.top * 25) / 100;
                    int i9 = (rect.left * 72) / 100;
                    this.W1.setPadding(i9, i8, i9, i8);
                } else {
                    this.W1.setPadding(0, 0, 0, 0);
                }
                NewCurl3D newCurl3D2 = new NewCurl3D(this);
                this.R2 = newCurl3D2;
                this.W1.addView(newCurl3D2, new FrameLayout.LayoutParams(-1, -1));
                this.R2.setEnableTouchPressure(true);
                this.R2.setOnScrollListener(this.H4);
                this.R2.Z(F7(), e50.v3() - (this.W1.getPaddingLeft() * 2), e50.r3() - (this.W1.getPaddingTop() * 2));
                if (this.S2 == null) {
                    FlipImageView flipImageView = new FlipImageView(this);
                    this.S2 = flipImageView;
                    this.W1.addView(flipImageView, new FrameLayout.LayoutParams(-1, -1));
                }
                if (Mb()) {
                    e50.D6(this.S2);
                    this.R2.e0 = 2;
                }
                NewCurl3D newCurl3D3 = this.R2;
                newCurl3D3.c0 = this.W1;
                FlipImageView flipImageView2 = this.S2;
                newCurl3D3.d0 = flipImageView2;
                flipImageView2.setVisibility(0);
                this.S2.bringToFront();
                this.W1.setOnTouchListener(this);
            }
        }
    }

    public boolean kb() {
        return (!e50.R4() || Ya() || e50.O0()) ? false : true;
    }

    private void kc() {
        String i8 = com.flyersoft.components.a.i(e50.V1);
        if (o50.A1(e50.x + com.ksdk.ssds.manager.b.b + o50.v0(i8) + e50.ia)) {
            return;
        }
        long currentTimeMillis = System.currentTimeMillis();
        e50.i1(Global.o(this.qa, 0, null), i8, false);
        e50.N5("extract cover time:" + (System.currentTimeMillis() - currentTimeMillis));
    }

    private void ke(int lastChapter, int lastSplitIndex, String tmpHtmlSrc) {
        if (this.n5 == null) {
            return;
        }
        this.Ua = lastChapter;
        this.Va = lastSplitIndex;
        this.Xa = this.Q1.getText();
        this.Ya = (ArrayList) e50.G9.clone();
        this.Za = tmpHtmlSrc;
        this.Wa = this.S1.getScrollY();
    }

    public void kf() {
        if ((!e50.t6 || this.d7) && !this.c7) {
            return;
        }
        Gg().removeMessages(3);
        Gg().sendEmptyMessageDelayed(3, e50.r6 * 60 * 1000);
        o50.p2(this, "已设置" + e50.r6 + "分钟后自动停止朗读");
    }

    public void kh(int p7) {
        this.H1.removeMessages(B0);
        Handler handler = this.H1;
        handler.sendMessageDelayed(handler.obtainMessage(B0, p7, 0), 100L);
    }

    public void l5() {
    }

    public void l6() {
        pe(true);
        this.d8 = true;
        ActivityMain.b0 = null;
        if (e50.c5) {
            NewCurl3D newCurl3D = this.R2;
            if (newCurl3D != null) {
                newCurl3D.setVisibility(8);
                this.W1.setVisibility(8);
            }
            Drawable z12 = e50.z1(e50.V1);
            if (z12 != null) {
                za(true);
                FlipImageView flipImageView = this.i2;
                flipImageView.q0 = true;
                flipImageView.setBitmap1(o50.M(z12));
                this.i2.setBitmap2(null);
                this.i2.setImageDrawable(null);
                this.i2.c(false, -100, new l6());
                return;
            }
            this.a2.e();
        }
        m6();
    }

    private int l8() {
        int i8 = e50.s5;
        int i9 = 4;
        if (V8() == 0) {
            int i10 = 25;
            if (i8 >= 50) {
                i10 = 40 + (((i8 - 50) * 150) / 50);
            } else {
                int i11 = e50.s5 % 5 != 0 ? i8 % 5 : 5;
                if (Q8() <= 4) {
                    i10 = 20 + (i11 * 3);
                }
            }
            i9 = (i10 * 100) / (((i8 < 50 ? 50 - i8 : 0) * 2) + 100);
        } else if (V8() == 1) {
            i9 = 10000 / (((i8 < 50 ? 50 - i8 : 0) * 2) + 100);
        } else if (V8() != 2) {
            i9 = 100;
        }
        e50.N5("----interval:" + i9);
        return i9;
    }

    private long l9() {
        try {
            if (q8() == 100) {
                if (e50.Q1.h().size() > 0) {
                    long length = this.Q1.getText().length();
                    if (length - this.R8 > 100) {
                        this.R8 = length;
                        this.P8 = (long) ((((this.Q1.getRealHeight() / e50.h3()) * E8()) / e50.Q1.h().get(e50.g2).h) * 100000.0d);
                    }
                }
            } else if (this.P8 < 100000 && this.Q1.getRealHeight() > this.U1.getHeight()) {
                if (q8() == 0 && e50.f4().size() > 3) {
                    this.P8 = e50.f4().size() * (((this.Q1.getRealHeight() * 100000) / e50.h3()) / 3);
                } else {
                    double realHeight = (this.Q1.getRealHeight() * 100000) / e50.h3();
                    if (!e50.U5()) {
                        realHeight *= this.P2.length() / this.Q1.getText().length();
                    }
                    this.P8 = (long) realHeight;
                }
            }
        } catch (Exception e8) {
            e50.S0(e8);
            this.P8 = 100000L;
        }
        long j8 = this.P8;
        if (j8 > 100000) {
            return j8;
        }
        return 100000L;
    }

    public void la() {
        NewCurl3D newCurl3D = this.R2;
        if (newCurl3D != null && newCurl3D.f0 == 0) {
            if (Mb()) {
                f8(true);
                this.R2.f0();
                this.R2.U(true);
            }
            this.R2.f0 = 1;
            this.H1.sendEmptyMessage(k0);
            return;
        }
        if (newCurl3D == null || newCurl3D.f0 >= 2) {
            return;
        }
        newCurl3D.f0 = 2;
        Je(false);
    }

    private boolean lb(final String url) {
        if (!nb() || !S.isVipChapter(e50.Q1.h().get(e50.g2).c) || !this.n5.contains(q50.w) || !this.n5.contains(q50.x)) {
            return false;
        }
        if (e50.Q1.p == S.store) {
            Xb(url);
        } else {
            new m.c(this).z(getString(R.string.qingxuanze)).x(new String[]{getString(R.string.zaisoushuliyd), getString(R.string.shiyongwaibuliulan)}, 0, null).v(R.string.ok, new b3(url)).o(R.string.cancel, null).r(getString(R.string.youhuaydshuoming), new a3()).C();
        }
        return true;
    }

    private void lc(final String filename) {
        View inflate = LayoutInflater.from(this).inflate(R.layout.pdf_password, (ViewGroup) null);
        new m.c(this).z("Need input password").B(inflate).v(R.string.ok, new a1((EditText) inflate.findViewById(R.id.ueit), filename, (CheckBox) inflate.findViewById(R.id.saveCheck))).o(R.string.cancel, new z0()).t(new y0()).C();
    }

    private void ld(boolean pageDown, f.c p7) {
        float Ic = Ic(p7.a);
        float height = this.F2.getHeight() - e50.k0(10.0f);
        if (pageDown) {
            if (!e50.O9) {
                int i8 = p7.c;
                if (i8 + height <= Ic) {
                    p7.c = i8 + ((int) height);
                }
            }
            if (p7.a == this.qa.k() - 1) {
                p7.c = (int) (Ic - height);
            } else {
                p7.a = kd(p7.a + 1);
                if (e50.O9) {
                    p7.c = 0;
                } else {
                    p7.c = (int) ((height - (Ic - p7.c)) - 4.0f);
                }
            }
        } else {
            int i9 = p7.c;
            if (i9 < height) {
                int i10 = p7.a;
                if (i10 == 0) {
                    p7.c = 0;
                } else {
                    p7.a = i10 - 1;
                    p7.c = (int) ((Ic - (height - i9)) + 4.0f);
                }
            } else {
                p7.c = i9 - ((int) height);
            }
        }
        this.F2.b.viewGoto(p7);
        this.F2.postInvalidate();
    }

    private void le() {
        String str;
        String str2;
        String str3;
        String N02;
        int indexOf;
        Document document;
        f50 f50Var;
        if (g50.F(e50.V1) == null) {
            String str4 = null;
            if (q8() != 100 || (f50Var = e50.Q1) == null) {
                str = "";
                str2 = str;
                str3 = str2;
            } else {
                str4 = f50Var.d();
                str = e50.Q1.b();
                f50 f50Var2 = e50.Q1;
                String str5 = f50Var2.k;
                str3 = o50.B2(f50Var2.m);
                str2 = str5;
            }
            if (q8() == 7 && (document = this.qa) != null) {
                str4 = document.h("Title");
                str = this.qa.h("Author");
            }
            if (q8() == 0 && (indexOf = (N02 = o50.N0(e50.V1)).indexOf(" - ")) > 0) {
                str4 = N02.substring(0, indexOf).trim();
                str = N02.substring(indexOf + 3).trim();
            }
            String str6 = str4;
            String str7 = str;
            if (str6 != null) {
                g50.q0(new g50.e(str6, e50.V1, str7, str2, str3, "", "", "" + System.currentTimeMillis(), "", "", "", "", "", ""));
            }
        }
    }

    public void lf(int id) {
        Cb("" + id, e50.B6);
        e50.V3 = id;
        Kh();
        P9();
    }

    public void lh(int p7) {
        com.flyersoft.staticlayout.l layout = this.Q1.getLayout();
        if (layout != null) {
            nh(this.Q1.a0(layout.B(p7)));
        }
    }

    private void m5() {
        if (e50.f5 && e50.g5() && e50.V9 == 1 && e50.G4()) {
            int rotation = getWindowManager().getDefaultDisplay().getRotation();
            ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.t2.getLayoutParams();
            marginLayoutParams.leftMargin = rotation == 1 ? e50.Z1() : 0;
            marginLayoutParams.rightMargin = rotation == 3 ? e50.Z1() : 0;
            if (e50.D2 && this.F2 == null) {
                ViewGroup.MarginLayoutParams marginLayoutParams2 = (ViewGroup.MarginLayoutParams) this.b2.getLayoutParams();
                marginLayoutParams2.leftMargin = rotation == 1 ? e50.Z1() : 0;
                marginLayoutParams2.rightMargin = rotation == 3 ? e50.Z1() : 0;
            }
        }
    }

    public void m6() {
        this.a2.a0 = true;
        le();
        this.c8 = true;
        a = null;
        e50.W8 = null;
        DownloadTaskBrowser.destroyWebView(this.ub);
        DownloadTaskBrowser.destroyWebView(this.Nb);
        com.flyersoft.discuss.z.taskReadeTime("" + e50.T4);
        com.flyersoft.discuss.z.taskReadeWords("" + e50.S4);
        if (e50.c5 && this.p1 && Build.VERSION.SDK_INT >= 21) {
            finishAfterTransition();
        } else {
            finish();
        }
    }

    private void m7(String filename) {
        Message message = new Message();
        message.obj = filename;
        new s6(Looper.getMainLooper()).sendMessage(message);
    }

    private void ma(boolean checkExtras) {
        boolean z7;
        long j8;
        int i8;
        int i9;
        boolean z8;
        boolean z9 = false;
        try {
            e50.h7 = false;
            e50.Q9 = false;
            e50.S8 = null;
            e50.W8 = null;
            e50.da = false;
            e50.ca = 0;
            e50.U9 = null;
            this.ma = null;
            this.O9 = 0;
            this.I2 = SystemClock.elapsedRealtime();
            this.K2 = false;
            this.J2 = false;
            this.N2 = "";
            this.z1 = false;
            this.O2 = false;
            this.P2 = "";
            this.a9 = 0;
            this.b9 = 0;
            e50.z6 = false;
            e50.I9 = null;
            e50.L9 = false;
            e50.ra = f.EnumC1090f.sta_none;
            f50.g = false;
            com.flyersoft.staticlayout.j.d = false;
            Yd();
            e50.j2 = -1;
            this.O1 = -1;
            this.W8 = null;
            this.V8 = null;
            e50.T8 = null;
            z7 = true;
        } catch (Exception e8) {
            e50.S0(e8);
        }
        if (checkExtras) {
            e50.W();
            e50.b3(this, true);
            Bundle extras = getIntent().getExtras();
            if (extras != null) {
                this.D1 = extras.getBoolean("fromOuterApp");
                z8 = extras.containsKey("online_book");
                if (extras.containsKey("fromShuku")) {
                    this.E1 = true;
                }
                if (extras.containsKey("bookFile") && !o50.F1(extras.getString("bookFile"))) {
                    e50.V1 = extras.getString("bookFile");
                }
                j8 = extras.containsKey("position") ? extras.getLong("position") : -1L;
                i9 = extras.containsKey("chapter") ? extras.getInt("chapter") : 0;
                i8 = extras.containsKey("splitIndex") ? extras.getInt("splitIndex") : 0;
                if (extras.containsKey("fromWidget") && extras.getBoolean("fromWidget")) {
                    if (e50.b6 && !e50.xa) {
                        e50.y6 = false;
                        e50.z6 = false;
                        e50.e(this);
                        System.exit(0);
                    } else if (e50.B2(e50.V1) == 11 || e50.B2(e50.V1) == 10) {
                        Intent intent = new Intent(this, (Class<?>) PicGalleryShow.class);
                        intent.putExtra("imageFile", e50.V1);
                        startActivityForResult(intent, 0);
                        finish();
                        return;
                    }
                }
                StringBuilder sb = new StringBuilder();
                sb.append(e50.R1);
                sb.append(com.ksdk.ssds.manager.b.b);
                sb.append(e50.r0);
                sb.append(".xml");
                this.F1 = o50.A1(sb.toString());
                if (j8 == -1) {
                    e50.f2 = j8;
                    e50.g2 = i9;
                    e50.h2 = i8;
                    if (getSharedPreferences(e50.r0, 0).contains(e50.V1.toLowerCase())) {
                        this.G1 = true;
                    }
                } else if (!z8) {
                    R8();
                }
                if (!z8 || K4()) {
                    z7 = false;
                }
                if (ActivityMain.g) {
                    z9 = z7;
                } else {
                    ActivityMain.g = false;
                }
                if (z9) {
                    if (q8() != 0) {
                        if (!Ya() && e50.A2() != 13) {
                            createProgressDlg("", getString(R.string.loading) + "...");
                        }
                    } else if (Ea(e50.V1)) {
                        J5(e50.V1);
                    }
                }
                if (e50.y5 && e50.z5 > 0) {
                    this.H1.sendEmptyMessage(I0);
                }
                this.H1.sendEmptyMessageDelayed(h1, 200L);
                e50.e4 = q8() != 7 ? e50.f4 : e50.g4;
            }
        }
        j8 = -1;
        i8 = 0;
        i9 = 0;
        z8 = false;
        StringBuilder sb2 = new StringBuilder();
        sb2.append(e50.R1);
        sb2.append(com.ksdk.ssds.manager.b.b);
        sb2.append(e50.r0);
        sb2.append(".xml");
        this.F1 = o50.A1(sb2.toString());
        if (j8 == -1) {
        }
        if (!z8) {
        }
        z7 = false;
        if (ActivityMain.g) {
        }
        if (z9) {
        }
        if (e50.y5) {
            this.H1.sendEmptyMessage(I0);
        }
        this.H1.sendEmptyMessageDelayed(h1, 200L);
        e50.e4 = q8() != 7 ? e50.f4 : e50.g4;
    }

    private boolean mb(MotionEvent event) {
        if (this.a2.d0.size() == 0) {
            return false;
        }
        int lineHeight = (((this.Q1.getLineHeight() * 80) / 100) * 50) / 70;
        float o9 = o9(event);
        float y7 = event.getY();
        Iterator<e50.j> it = this.a2.d0.iterator();
        while (it.hasNext()) {
            e50.j next = it.next();
            if (o9 > (this.a2.getWidth() - lineHeight) - e50.k0(1.0f)) {
                if (y7 > next.g && y7 < r6 + r0) {
                    String[] strArr = {e50.G3(R.array.catalog_popup_menu, 1), e50.G3(R.array.one_file_bookmark, 1)};
                    String str = next.b;
                    if (str.indexOf(") ") != -1) {
                        str = str.substring(str.indexOf(") ") + 2, str.length());
                    }
                    new m.c(this).z(str).i(strArr, new i5(next)).C();
                    return true;
                }
            }
        }
        return false;
    }

    private String mc(long i8) {
        int i9 = (int) i8;
        String f12 = e50.f1(sc(i9), this.qa.j(i9));
        if (e50.O9) {
            return f12;
        }
        return f12 + " <" + (i8 + 1) + com.ksdk.ssds.manager.b.b + this.qa.k() + ">";
    }

    private int md() {
        int height = this.U1.getHeight();
        float Ic = Ic(-1);
        float f8 = height;
        if (Ic >= f8) {
            return 0;
        }
        return ((int) (f8 - Ic)) / 2;
    }

    private void me(MotionEvent event) {
        MotionEvent motionEvent = this.q9;
        if (motionEvent != null) {
            motionEvent.recycle();
        }
        this.q9 = MotionEvent.obtain(event);
        if (event.getAction() == 0) {
            MotionEvent motionEvent2 = this.r9;
            if (motionEvent2 != null) {
                motionEvent2.recycle();
            }
            this.r9 = MotionEvent.obtain(event);
        }
    }

    private void mg() {
    }

    private void mh(int left, int top, int right, int bottom) {
        int P5;
        if (F7()) {
            if (e50.D2 && left < (P5 = e50.P5())) {
                left = P5;
            }
            int k02 = e50.o8 ? 12 : e50.k0(8.0f);
            if (Yb(this.t2, k02, 0, k02, 0)) {
                this.t2.setPadding(k02, 0, k02, 0);
            }
            if (Yb(this.S1, left, top, left, bottom)) {
                gf(k02, left, bottom);
                this.S1.setPadding(left, top, left, bottom);
                this.T1.setPadding(left, top, left, bottom);
                return;
            }
            return;
        }
        if (Yb(this.t2, 0, 0, 0, 0)) {
            this.t2.setPadding(0, 0, 0, 0);
            gf(0, 0, 0);
        }
        if (Yb(this.S1, left, top, right, bottom)) {
            this.S1.setPadding(left, top, right, bottom);
        }
    }

    public void n5() {
        int y02 = o50.y0(o50.n0(e50.V1));
        WB.clearBookCache(e50.V1);
        if (y02 > o50.y0(o50.n0(e50.V1))) {
            o50.n2(this, getString(R.string.yiqingkongbingshifang) + "\n\n " + Formatter.formatFileSize(this, y02 - r1));
        }
    }

    public void n6(boolean fromLongTap) {
        int i8;
        if (Za()) {
            oc(fromLongTap);
            return;
        }
        MRTextView mRTextView = e50.y8 == this.T1 ? this.R1 : this.Q1;
        if (mRTextView.o0()) {
            g50.f fVar = this.z9;
            if (fVar == null && fromLongTap) {
                o6(mRTextView, -1, -1, true);
                return;
            }
            if (fVar == null) {
                i8 = -1;
            } else if (fVar.m) {
                i8 = 1;
            } else if (fVar.n) {
                i8 = 2;
            } else {
                i8 = fVar.o ? 3 : 0;
            }
            new com.flyersoft.seekbooks.o(this, new p(mRTextView), false, i8, mRTextView.R0).show();
        }
    }

    private int n8() {
        int q8 = q8();
        if (q8 == 0) {
            if (this.K2) {
                return -1;
            }
            return f50.v(new d(), false);
        }
        if (q8 != 1) {
            if (q8 == 7) {
                return f50.q(new f(), false);
            }
            if (q8 != 100) {
                return -1;
            }
            return f50.w(e50.Q1, e50.g2, new e(), false);
        }
        if (this.X8 <= 0 || this.Y8 <= 0) {
            return -1;
        }
        long K8 = K8();
        long j8 = this.X8;
        return (int) ((K8 * (j8 - this.Y8)) / j8);
    }

    public MRTextView n9() {
        return e50.y8 == this.T1 ? this.R1 : this.Q1;
    }

    private void na() {
        if (this.t6) {
            return;
        }
        this.t6 = true;
        this.n6 = new GestureDetector(new o7());
        if (this.o6 == null) {
            this.o6 = VelocityTracker.obtain();
        }
        this.p6 = ViewConfiguration.get(this).getScaledMaximumFlingVelocity();
        this.q6 = getResources().getDisplayMetrics().density * 160.0f * 386.0878f * ViewConfiguration.getScrollFriction();
    }

    public void nc() {
        if ((this.za || this.F2.p0 != null) && jc()) {
            Xc(true);
            this.F2.G(true);
            new com.flyersoft.seekbooks.e(this, null, this.za && !o50.F1(this.F2.i()), new e1()).show();
        }
    }

    public void ne() {
        if (this.i3 != null) {
            e50.M9 = new ArrayList<>();
            for (int i8 = 0; i8 < this.i3.getChildCount() - 1; i8++) {
                View childAt = this.i3.getChildAt(i8);
                childAt.setTag(Integer.valueOf(i8));
                e50.M9.add(new e50.n(((EditText) childAt.findViewById(R.id.editText1)).getText().toString(), ((EditText) childAt.findViewById(R.id.editText2)).getText().toString()));
            }
        }
    }

    private void nf(int visible) {
        View view = this.r2;
        if (view == null || this.y2 == null) {
            return;
        }
        view.setVisibility(visible);
        this.y2.setVisibility(visible);
        if (visible != 8) {
            this.r2.findViewById(R.id.sv).setBackgroundColor(this.b3);
            this.r2.findViewById(R.id.notificationBar).setBackgroundColor(-15658735);
            this.w2.setBackgroundColor(-787410671);
            this.x2.setBackgroundColor(this.b3);
            this.E2.setBackgroundColor(this.b3);
            Af(0);
            Ye();
            this.f2.setTag(null);
            this.f2.setVisibility(this.E6.size() != 0 ? 0 : 8);
        } else if (this.g4 && a5()) {
            return;
        }
        wh();
    }

    private void ng() {
        if (e50.M6) {
            if (e50.Q1.p == S.store) {
                new m.c(this).m("\n当前VIP章节优化阅读暂未成功, 请再次尝试").v(R.string.ok, new p3()).p(e50.W0("原版浏览"), new o3()).C();
                return;
            }
            ScrollView scrollView = (ScrollView) LayoutInflater.from(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.W0("VIP章节优化阅读未成功, 建议切换到原版浏览(如未登录网站, 请先登录). <br><br><small><font color=\"#888888\"><b>提示:</b> 1.使用您在该平台的账号登录并订阅该VIP章节后, 可再切换回优化阅读模式<br>2.点工具栏右上的\"原版/优化\"可切换阅读模式</font></small>")));
            new m.c(this).B(scrollView).w(e50.W0("原版浏览(登录)"), new r3(checkBox)).o(R.string.cancel, new q3(checkBox)).C();
        }
    }

    public void nh(int y7) {
        ya();
        if (this.S1.getScrollY() != y7) {
            U7(this.Q1, y7);
            this.S1.scrollTo(0, y7);
            this.a2.a = -1;
        }
        if (Z4()) {
            pf();
        }
    }

    public void o6(MRTextView tv, int mode, int forceColor, boolean hideDots) {
        if (Za()) {
            pc(-1);
            return;
        }
        if (tv == null) {
            tv = e50.y8 == this.T1 ? this.R1 : this.Q1;
        }
        if (mode == -1) {
            mode = e50.A3;
        }
        g50.f fVar = this.z9;
        if (fVar == null) {
            fVar = F5();
        }
        String str = "" + fVar.m + fVar.n + fVar.o + fVar.h;
        boolean z7 = mode == 1;
        fVar.m = z7;
        boolean z8 = mode == 2;
        fVar.n = z8;
        boolean z9 = mode == 3;
        fVar.o = z9;
        if (this.F2 != null) {
            fVar.d = (int) e50.f2;
            fVar.e = -1;
        }
        if (forceColor == -1) {
            fVar.h = e50.g3;
            if (z7) {
                fVar.h = e50.n3;
            }
            if (z8) {
                fVar.h = e50.p3;
            }
            if (z9) {
                fVar.h = e50.o3;
            }
        } else {
            fVar.h = forceColor;
        }
        if (this.z9 != null) {
            if (!str.equals("" + fVar.m + fVar.n + fVar.o + fVar.h) && !e50.z7(fVar)) {
                e50.e6();
            }
        } else {
            e50.r(fVar);
        }
        if (hideDots) {
            J9();
        } else {
            this.z9 = fVar;
        }
        tv.P0 = -1;
        tv.postInvalidate();
        Td();
    }

    private void oa() {
        this.k3 = e50.e4;
        if (this.z2 == null) {
            View inflate = ((ViewStub) this.y2.findViewById(R.id.stub_font)).inflate();
            this.z2 = inflate;
            inflate.setBackgroundColor(this.b3);
            this.z2.findViewById(R.id.moreFont).setOnClickListener(this.U3);
            this.z2.findViewById(R.id.moreTheme).setOnClickListener(this.U3);
            this.z2.findViewById(R.id.moreTypeset).setOnClickListener(this.U3);
            this.z2.findViewById(R.id.fontsize1).setOnClickListener(this.U3);
            this.z2.findViewById(R.id.fontsize2).setOnClickListener(this.U3);
            this.z2.findViewById(R.id.fontFan).setOnClickListener(this.U3);
            this.z2.findViewById(R.id.fontsizeTv).setOnClickListener(this.U3);
            this.z2.findViewById(R.id.typeset1).setOnClickListener(this.U3);
            this.z2.findViewById(R.id.typeset2).setOnClickListener(this.U3);
            this.z2.findViewById(R.id.typeset3).setOnClickListener(this.U3);
            this.z2.findViewById(R.id.typeset4).setOnClickListener(this.U3);
            this.f4 = this.z2.findViewById(R.id.flipPanel);
            this.X3 = (RoundButton) this.z2.findViewById(R.id.flip1);
            this.Y3 = (RoundButton) this.z2.findViewById(R.id.flip2);
            this.Z3 = (RoundButton) this.z2.findViewById(R.id.flip3);
            this.a4 = (RoundButton) this.z2.findViewById(R.id.moreFlip);
            this.X3.setOnClickListener(this.U3);
            this.Y3.setOnClickListener(this.U3);
            this.Z3.setOnClickListener(this.U3);
            this.a4.setOnClickListener(this.U3);
            this.Y3.setOnLongClickListener(this.T3);
            this.Z3.setOnLongClickListener(this.T3);
            this.b4 = (RoundImage) this.y2.findViewById(R.id.theme1);
            this.c4 = (RoundImage) this.y2.findViewById(R.id.theme2);
            this.d4 = (RoundImage) this.y2.findViewById(R.id.theme3);
            this.e4 = (RoundImage) this.y2.findViewById(R.id.theme4);
            this.b4.setOnClickListener(this.U3);
            this.c4.setOnClickListener(this.U3);
            this.d4.setOnClickListener(this.U3);
            this.e4.setOnClickListener(this.U3);
            ((RoundImage) this.z2.findViewById(R.id.typeset1)).getDrawable().setColorFilter(-4473925, PorterDuff.Mode.SRC_IN);
            ((RoundImage) this.z2.findViewById(R.id.typeset2)).setColorFilter(-4473925, PorterDuff.Mode.SRC_IN);
            ((RoundImage) this.z2.findViewById(R.id.typeset3)).getDrawable().setColorFilter(-4473925, PorterDuff.Mode.SRC_IN);
            this.W3 = (RoundButton) this.z2.findViewById(R.id.fontFan);
            Bh();
            TextView textView = (TextView) this.z2.findViewById(R.id.fontsizeTv);
            this.V3 = textView;
            textView.setText("" + ((int) e50.d3));
            Lh();
            Kh();
            Ch();
            new g4(Looper.getMainLooper()).sendEmptyMessageDelayed(0, 0L);
        }
        this.f4.setVisibility(e50.X5 ? 0 : 8);
    }

    private boolean ob(final String url, String title) {
        if (!e50.c5(url) || !title.equals(getString(R.string.download_url_image))) {
            return false;
        }
        K5(getString(R.string.download_url_image), url, false);
        new c3(url).start();
        return true;
    }

    private void oc(boolean fromLongTap) {
        int i8;
        Page.a selectedAnnot;
        if ((Fa() || this.F2.p0 != null) && jc()) {
            Xc(true);
            this.F2.G(true);
            if (!Fa() && fromLongTap) {
                pc(-1);
                this.F2.f();
                this.F2.G(false);
                e50.h7 = true;
                return;
            }
            if (Fa() && (selectedAnnot = this.F2.b.getSelectedAnnot()) != null) {
                if (selectedAnnot.T() == 9) {
                    i8 = 0;
                } else if (selectedAnnot.T() == 10) {
                    i8 = 1;
                } else if (selectedAnnot.T() == 12) {
                    i8 = 2;
                } else if (selectedAnnot.T() == 11) {
                    i8 = 3;
                }
                com.flyersoft.seekbooks.o oVar = new com.flyersoft.seekbooks.o(this, new g1(), true, i8, null);
                oVar.setOnDismissListener(new h1());
                oVar.show();
            }
            i8 = -1;
            com.flyersoft.seekbooks.o oVar2 = new com.flyersoft.seekbooks.o(this, new g1(), true, i8, null);
            oVar2.setOnDismissListener(new h1());
            oVar2.show();
        }
    }

    private void od(int y7) {
        if (y7 == this.S1.getScrollY()) {
            if (Ka()) {
                O6(false);
                return;
            }
            if (q8() != 100) {
                bc(1);
                return;
            }
            if (this.Z7 == 0) {
                this.Z7 = SystemClock.elapsedRealtime();
                return;
            }
            long elapsedRealtime = (SystemClock.elapsedRealtime() + 1) - this.Z7;
            if (e50.s5 > 10 && elapsedRealtime <= Constants.MINIMAL_AD_INTERVAL) {
                long j8 = (4000 - elapsedRealtime) / 1000;
                if (j8 != this.a8) {
                    this.a8 = j8;
                    o50.p2(this, "" + j8);
                    return;
                }
                return;
            }
            this.Z7 = 0L;
            o50.n1();
            bc(1);
            return;
        }
        this.Z7 = 0L;
    }

    public void of() {
        this.E7.setVisibility((e50.p6 == 10 && e50.q6 == 10) ? 8 : 0);
    }

    private void og() {
        if (this.z6 && e50.N6 && !this.A6) {
            if (!Qa() || e50.Q1.p.webReadLevel <= 1) {
                this.A6 = true;
                ScrollView scrollView = (ScrollView) LayoutInflater.from(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.W0("现在是原版浏览模式, 是否尝试切换到优化阅读模式(重排文本以适应手机阅读)?<br><br><small><font color=\"#888888\"><b>提示:</b> 1.点工具栏右上的\"原版/优化\"可切换阅读模式; <br>2.点击工具栏网址可用外部浏览器打开</font></small>")));
                new m.c(this).B(scrollView).w(e50.W0("优化阅读"), new u3(checkBox)).o(R.string.cancel, new t3(checkBox)).d(false).C();
            }
        }
    }

    private void oh() {
        if (this.Q1.getLayout() != null) {
            MRTextView mRTextView = this.Q1;
            nh(mRTextView.a0(mRTextView.getLayout().B((int) e50.f2)));
        }
    }

    private void p5() {
        if (e50.O9) {
            Tg();
        }
        MRBookView mRBookView = this.C9;
        if (mRBookView != null) {
            mRBookView.f();
        }
        this.O1 = -1;
        a = null;
        e50.M1 = null;
        e50.I1 = null;
        e50.J1 = null;
        e50.K1 = null;
        e50.F1 = null;
        e50.G1 = null;
        e50.H1 = null;
        e50.G9 = new ArrayList<>();
        e50.X();
        e50.W();
        e50.j9 = null;
        NewCurl3D newCurl3D = this.R2;
        if (newCurl3D != null) {
            newCurl3D.M();
        }
        if (Ya() && this.F2 != null) {
            PDFThumbView2 pDFThumbView2 = this.ma;
            if (pDFThumbView2 != null && ((Integer) pDFThumbView2.getTag()).intValue() == Global.m) {
                this.ma.a();
            }
            this.F2.set_thumb(null);
            this.F2.t();
            Document document = this.qa;
            if (document != null) {
                document.d();
            }
            Global.b();
        }
        if (this.E1) {
            WB.notifyRecentListChanged(e50.V1);
        }
    }

    private boolean p6(final boolean fromLeftToRight) {
        String string;
        if ((fromLeftToRight && e50.v4 != 15) || (!fromLeftToRight && e50.w4 != 15)) {
            this.r6 = 1L;
            this.h6 = true;
        }
        if (!e50.L6 || e50.v4 != 3 || e50.w4 != 2) {
            if (fromLeftToRight) {
                return j6(e50.v4);
            }
            return j6(e50.w4);
        }
        if (fromLeftToRight) {
            string = getString(R.string.swipe_hint_1);
        } else {
            string = getString(R.string.swipe_hint_2);
        }
        ScrollView scrollView = (ScrollView) LayoutInflater.from(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(string);
        new m.c(this).z(getString(R.string.swipe_gesture)).B(scrollView).v(R.string.ok, new h7(checkBox, fromLeftToRight)).o(R.string.cancel, new g7(checkBox)).C();
        return true;
    }

    public String p8() {
        String N02;
        int indexOf;
        f50 f50Var = e50.Q1;
        if (f50Var != null) {
            return f50Var.d();
        }
        if (q8() == 0 && (indexOf = (N02 = o50.N0(e50.V1)).indexOf(" - ")) > 0) {
            return N02.substring(0, indexOf).trim();
        }
        return o50.N0(e50.V1);
    }

    private void p9(String siteTag, final boolean forUpdateCur, final boolean showTip) {
        TS.getBookInfo(this.wb.tsBook, new i2(forUpdateCur, showTip));
    }

    private void pa() {
        this.c9 = (HighlightLay) findViewById(R.id.HighlightBar);
        this.j9 = (DotImageView) findViewById(R.id.dot1);
        this.k9 = (DotImageView) findViewById(R.id.dot2);
        this.n9 = (ImageView) findViewById(R.id.penIv);
        this.d9 = (TextView) findViewById(R.id.copyTv);
        this.e9 = (TextView) findViewById(R.id.highlightTv);
        this.f9 = (TextView) findViewById(R.id.noteTv);
        this.g9 = (TextView) findViewById(R.id.dictTv);
        this.h9 = (TextView) findViewById(R.id.shareTv);
        this.i9 = (ColorTemplate) findViewById(R.id.colorTemplate);
        this.m9 = findViewById(R.id.HighlightBar2);
        this.d9.getPaint().setFakeBoldText(true);
        this.e9.getPaint().setFakeBoldText(true);
        this.f9.getPaint().setFakeBoldText(true);
        this.g9.getPaint().setFakeBoldText(true);
        this.h9.getPaint().setFakeBoldText(true);
        this.n9.setOnClickListener(this.t9);
        this.d9.setOnClickListener(this.t9);
        this.e9.setOnClickListener(this.t9);
        this.f9.setOnClickListener(this.t9);
        this.g9.setOnClickListener(this.t9);
        this.h9.setOnClickListener(this.t9);
        this.j9.setOnTouchListener(this.s9);
        this.k9.setOnTouchListener(this.s9);
        Ue(Ya() ? 0 : 8);
        this.e9.setOnLongClickListener(this);
        this.g9.setOnLongClickListener(this);
        this.i9.setVisibility(e50.C3 ? 0 : 8);
        if (e50.C3) {
            ja();
        }
    }

    private boolean pb(int keyCode, KeyEvent event) {
        StoreWebView storeWebView;
        MRBookView mRBookView;
        if (keyCode == 4 && (mRBookView = this.C9) != null && mRBookView.canGoBack()) {
            return true;
        }
        return keyCode == 4 && this.B6 && (storeWebView = this.Jb) != null && storeWebView.canGoBack();
    }

    public boolean pc(int forceColor) {
        int i8;
        int i9;
        boolean annotSetMarkup;
        boolean z7 = false;
        try {
            if (Fa()) {
                Page.a selectedAnnot = this.F2.b.getSelectedAnnot();
                if (selectedAnnot != null) {
                    if (selectedAnnot.T() == 9) {
                        if (forceColor == -1) {
                            forceColor = e50.m3;
                        }
                        selectedAnnot.f0(Page.J1(forceColor));
                    } else if (selectedAnnot.T() == 10) {
                        if (forceColor == -1) {
                            forceColor = e50.n3;
                        }
                        selectedAnnot.s0(forceColor);
                    } else if (selectedAnnot.T() == 12) {
                        if (forceColor == -1) {
                            forceColor = e50.p3;
                        }
                        selectedAnnot.s0(forceColor);
                    } else if (selectedAnnot.T() == 11) {
                        if (forceColor == -1) {
                            forceColor = e50.o3;
                        }
                        selectedAnnot.s0(forceColor);
                    }
                    this.F2.b.refreshCurPage();
                    z7 = true;
                }
            } else {
                if (forceColor != -1) {
                    int i10 = e50.A3;
                    if (i10 == 0) {
                        i8 = e50.m3;
                        e50.m3 = forceColor;
                    } else if (i10 == 1) {
                        i8 = e50.n3;
                        e50.n3 = forceColor;
                    } else if (i10 == 2) {
                        i8 = e50.p3;
                        e50.p3 = forceColor;
                    } else if (i10 == 3) {
                        i8 = e50.o3;
                        e50.o3 = forceColor;
                    }
                    i9 = e50.A3;
                    if (i9 != 0) {
                        annotSetMarkup = this.F2.b.annotSetMarkup(0);
                    } else if (i9 == 1) {
                        annotSetMarkup = this.F2.b.annotSetMarkup(1);
                    } else if (i9 == 2) {
                        annotSetMarkup = this.F2.b.annotSetMarkup(2);
                    } else {
                        annotSetMarkup = i9 == 3 ? this.F2.b.annotSetMarkup(4) : false;
                    }
                    if (annotSetMarkup) {
                        ad("Failed to add highlight!");
                    } else if (jc()) {
                        Qc((int) e50.f2, this.F2.p0, "", e50.A3);
                        e50.qa = true;
                        z7 = true;
                    }
                    if (forceColor != -1) {
                        int i11 = e50.A3;
                        if (i11 == 0) {
                            e50.m3 = i8;
                        } else if (i11 == 1) {
                            e50.n3 = i8;
                        } else if (i11 == 2) {
                            e50.p3 = i8;
                        } else if (i11 == 3) {
                            e50.o3 = i8;
                        }
                    }
                }
                i8 = -1;
                i9 = e50.A3;
                if (i9 != 0) {
                }
                if (annotSetMarkup) {
                }
                if (forceColor != -1) {
                }
            }
            Pc();
        } catch (Exception e8) {
            e50.S0(e8);
        }
        J9();
        return z7;
    }

    public void pf() {
        if (e50.Q2(this.S1, -1) >= T8() - 1) {
            if (this.R1.getVisibility() != 4) {
                this.R1.setVisibility(4);
                return;
            }
            return;
        }
        jh(D8(this.S1.getScrollY()));
    }

    private boolean pg(int type) {
        if (type == 0 && !e50.Q2) {
            return false;
        }
        if (type == 1 && !e50.N2) {
            return false;
        }
        if (this.p7 == null) {
            View inflate = ((ViewStub) findViewById(R.id.tipStub)).inflate();
            this.p7 = inflate;
            View findViewById = inflate.findViewById(R.id.okB);
            this.q7 = findViewById;
            findViewById.setOnClickListener(this);
            this.r7 = (CheckBox) this.p7.findViewById(R.id.ofNeverAskAgain);
            this.s7 = (ImageView) this.p7.findViewById(R.id.imageView1);
            if (e50.V9 == 1 && e50.G4() && e50.Z1() > 0) {
                this.p7.setPadding(0, e50.Z1(), 0, 0);
            }
        }
        this.r7.setChecked(true);
        if (type == 0) {
            this.s7.setImageDrawable(e50.m2(getAssets(), "tips_tts.png", 0));
        }
        if (type == 1) {
            this.s7.setImageDrawable(e50.m2(getAssets(), "tips_autoscroll.png", 0));
        }
        this.v7 = type;
        this.p7.setVisibility(0);
        return true;
    }

    public void ph(CharSequence text) {
        String str;
        this.C4.clear();
        ArrayList<String> arrayList = e50.X8;
        if (arrayList != null) {
            arrayList.clear();
        }
        if (e50.D8 && e50.A2() == 0) {
            text = com.flyersoft.components.i.a(text);
        }
        this.Q1.setText(text);
        if (e50.A2() == 2 && (str = this.n5) != null) {
            this.I9 = (str.indexOf("<audio ") == -1 && this.n5.indexOf("<video ") == -1) ? false : true;
            Jf();
        } else {
            this.I9 = false;
        }
        this.a2.a = -1;
        if (F7()) {
            this.R1.setVisibility(4);
            this.R1.setText(this.Q1.getText());
        }
        Z4();
        if (Hh(e50.g2, this.Q1.getText2(), false)) {
            this.tb = true;
            createProgressDlg("", e50.Q1.h().get(e50.g2).c + "\n" + getString(R.string.downloading_content));
            q5();
            return;
        }
        D7();
    }

    public void q5() {
        this.Q1.setText("");
        this.S1.scrollTo(0, 0);
        this.R1.setText("");
        if (this.Q1.getLayout() == null) {
            try {
                this.Q1.a();
                this.R1.a();
            } catch (Exception e8) {
                e50.S0(e8);
            }
        }
    }

    public boolean q7() {
        int i8;
        int q8 = q8();
        boolean z7 = false;
        if (q8 == 0 || q8 == 1) {
            if (e50.Y3().size() > 0) {
                int X3 = e50.X3(e50.f2, null, null);
                if (X3 > 0) {
                    long j8 = e50.f2;
                    int i9 = X3 - 1;
                    long a8 = e50.Y3().get(i9).a(i9);
                    e50.f2 = a8;
                    if (j8 == a8 && X3 > 1) {
                        int i10 = X3 - 2;
                        e50.f2 = e50.Y3().get(i10).a(i10);
                    }
                    Jd();
                } else if (e50.f2 > 0) {
                    e50.f2 = 0L;
                    Jd();
                }
                z7 = true;
            }
        } else if (q8 != 7) {
            if (q8 == 100 && (i8 = e50.g2) > 0) {
                e50.g2 = i8 - 1;
                e50.f2 = 0L;
                e50.h2 = 0;
                this.k5 = false;
                q5();
                e50.e(this);
                if (Da(e50.g2)) {
                    J5(e50.Q1.h().get(e50.g2).c);
                }
                Jd();
                z7 = true;
            }
        } else if (!Ca()) {
            p7();
            z7 = true;
        }
        if (!z7) {
            if (!Ya()) {
                o50.p2(this, getString(R.string.no_prior_chapter));
            }
        } else {
            Td();
        }
        return z7;
    }

    private void q9(final q50.b cacheItem) {
        TS.getChapter(cacheItem.a, new a2(cacheItem));
    }

    private boolean qb(int keyCode, KeyEvent event) {
        StoreWebView storeWebView;
        MRBookView mRBookView;
        if (keyCode == 4 && (mRBookView = this.C9) != null && mRBookView.canGoBack()) {
            this.C9.goBack();
            return true;
        }
        if (keyCode != 4 || !this.B6 || (storeWebView = this.Jb) == null || !storeWebView.canGoBack()) {
            return false;
        }
        this.Jb.goBack();
        return true;
    }

    private void qc() {
        this.qa.L(new x0());
    }

    private void qd() {
        if (e50.O9 || e50.P9 || !e50.k4 || this.mb == 1) {
            return;
        }
        e50.a6(this);
    }

    public void qf(int id) {
        int i8;
        int i9 = 10;
        if (id != 1) {
            if (id == 2) {
                i8 = 3;
            } else if (id == 3) {
                i8 = 10;
            }
            e50.X3 = i8;
            if (id != 1) {
                i9 = 0;
            } else if (id == 2) {
                i9 = e50.m9;
            }
            e50.Y3 = i9;
            e50.G6(e50.F1);
            e50.G6(e50.G1);
            e50.I6(e50.F1);
            e50.I6(e50.G1);
            o5();
            e50.W3 = id;
            Lh();
            P9();
        }
        i8 = 0;
        e50.X3 = i8;
        if (id != 1) {
        }
        e50.Y3 = i9;
        e50.G6(e50.F1);
        e50.G6(e50.G1);
        e50.I6(e50.F1);
        e50.I6(e50.G1);
        o5();
        e50.W3 = id;
        Lh();
        P9();
    }

    public void qg() {
        if (this.w7 == null) {
            wa();
        } else {
            this.G7.setProgress(((AudioManager) getSystemService("audio")).getStreamVolume(3));
        }
        ah(true);
        sg(true, false);
        this.P7 = false;
        new i6(Looper.getMainLooper()).sendEmptyMessageDelayed(0, 4000L);
    }

    public void qh(float size) {
        Float f8 = this.K9;
        if (f8 != null) {
            size *= f8.floatValue();
        }
        this.Q1.setTextSize(size);
        this.R1.setTextSize(size);
        this.C4.clear();
        this.Ra = true;
    }

    private void r5() {
        this.Xa = null;
        this.Ha = null;
    }

    private void r6() {
        if (this.E6.size() == 0) {
            return;
        }
        m7 m7Var = this.E6.get(0);
        this.E6.remove(0);
        this.c2.setVisibility(4);
        A9(m7Var);
    }

    private int r8(int i8, String file, String id_str, String aUrl, f50.e c8, String htmlContent, int tagIndex) {
        String replace;
        int i9;
        boolean z7;
        String str = "id=\"" + id_str + "\"";
        if (htmlContent == null) {
            replace = e50.Q1.g(i8).replace("\n\"" + id_str, "\"" + id_str);
            if (c8.g.equals(f50.c)) {
                i9 = i8;
                z7 = true;
                if (replace != null) {
                    return -1;
                }
                if (z7) {
                    replace = e50.Q1.t(file);
                    tagIndex = replace.indexOf(str);
                    this.g6 = 0;
                    if (tagIndex == -1) {
                        return -100;
                    }
                } else if (htmlContent == null) {
                    int indexOf = replace.indexOf("<a name=" + file + ">");
                    int indexOf2 = indexOf != -1 ? replace.indexOf(str, indexOf) : -1;
                    if (indexOf2 == -1) {
                        indexOf2 = replace.indexOf(str);
                    }
                    tagIndex = indexOf2;
                }
                if ((this.d6 && jb(replace, str, tagIndex)) || i9 != i8) {
                    return i8;
                }
                try {
                    this.g6 = com.flyersoft.staticlayout.j.c(replace.substring(0, replace.lastIndexOf("<", tagIndex)), this.m5, htmlContent == null ? i8 : e50.g2).length() + 1;
                    if (z7) {
                        return -100;
                    }
                    return i8;
                } catch (Throwable th) {
                    e50.S0(th);
                    return i8;
                }
            }
            String j9 = j9(replace, file, str);
            if (j9 == null) {
                str = "name=\"" + id_str + "\"";
                j9 = j9(replace, file, str);
            }
            if (j9 != null || i8 <= 0 || e50.Q1.h().get(i8 - 1).d.equals(c8.d)) {
                i9 = i8;
            } else {
                i9 = i8 - 1;
                j9 = j9(replace, file, str);
                if (j9 == null) {
                    String str2 = "id=\"" + id_str + "\"";
                    replace = j9(replace, file, str2);
                    str = str2;
                }
            }
            replace = j9;
        } else {
            replace = htmlContent.replace("\n\"" + id_str, "\"" + id_str);
            i9 = i8;
        }
        z7 = false;
        if (replace != null) {
        }
    }

    private String r9() {
        ArrayList<e50.p> arrayList = e50.s9;
        if (arrayList != null && arrayList.size() >= 3) {
            MRTextView mRTextView = this.Q1;
            e50.p pVar = e50.Y3().get(e50.X3(e50.f2, this.Z8, mRTextView.X(mRTextView.getLayout().C(this.S1.getScrollY()))));
            this.Z8 = pVar;
            return PrefChapters.r(pVar.a);
        }
        return o50.v0(e50.V1);
    }

    private void ra() {
        if (this.D2 == null) {
            View inflate = ((ViewStub) this.y2.findViewById(R.id.stub_night)).inflate();
            this.D2 = inflate;
            inflate.setBackgroundColor(this.b3);
            this.D2.findViewById(R.id.nfontColor).setOnClickListener(this.U3);
            this.D2.findViewById(R.id.nbackgroundColor).setOnClickListener(this.U3);
            this.D2.findViewById(R.id.nbackgroundColorTv).setOnClickListener(this.U3);
            this.D2.findViewById(R.id.nbackgroundImage).setOnClickListener(this.U3);
            this.D2.findViewById(R.id.nbackgroundImageTv).setOnClickListener(this.U3);
            this.D2.findViewById(R.id.nbrightIndicator).setOnClickListener(this.U3);
            this.D2.findViewById(R.id.nbrightText).setOnClickListener(this.U3);
            this.D2.findViewById(R.id.nbrightTv).setOnClickListener(this.U3);
            this.D2.findViewById(R.id.nautoCancelNight).setOnClickListener(this.U3);
        }
    }

    public void rg(boolean visible) {
        sg(visible, true);
    }

    private boolean rh() {
        int indexOf;
        if (this.Q1.getText() == null) {
            return false;
        }
        if (this.Q1.getText().length() > 0 && this.Q1.getLineCount() == 0) {
            return true;
        }
        if (this.Q1.getText().length() <= 0 || this.Q1.getLineCount() != 1 || (indexOf = this.Q1.getText2().indexOf("\n")) == -1 || this.Q1.getText2().indexOf("\n", indexOf + 1) == -1) {
            return false;
        }
        e50.N5("#############txtView deep broken, txtView.getLineCount() == 1 only############, lastPosition:" + e50.f2);
        return true;
    }

    private boolean s5(MotionEvent event) {
        if (o9(event) <= this.U1.getWidth() - e50.k0(40.0f) || event.getY() >= e50.k0(40.0f)) {
            return false;
        }
        x5(null, false, true);
        Td();
        return true;
    }

    public void s6() {
        e50.N5("doLongTimeTapEvent");
        e50.da = this.K5;
        if (this.C9 != null) {
            return;
        }
        if ((e50.P5 && this.q9.getPointerCount() >= 2) || mb(this.q9) || Pa(this.q9, false, true) || Ua(this.q9) || ib(this.q9, false)) {
            return;
        }
        Wf(false);
        int i8 = e50.P4;
        if (i8 == 17) {
            xe(false);
            if (e50.E3) {
                this.c9.a(this.q9);
            }
            Gb();
            return;
        }
        j6(i8);
    }

    private int s8() {
        com.flyersoft.staticlayout.l layout;
        if (q8() != 100 || (layout = this.Q1.getLayout()) == null) {
            return -1;
        }
        String substring = this.Q1.getText2().substring(layout.I(layout.C(this.S1.getScrollY())), this.Q1.getText().length());
        if (q8() == 100 && !e50.U5() && e50.h2 < e50.G9.size() - 1) {
            StringBuilder sb = new StringBuilder();
            int i8 = e50.h2;
            while (true) {
                i8++;
                if (i8 >= e50.G9.size()) {
                    break;
                }
                sb.append(e50.G9.get(i8));
            }
            boolean y7 = e50.Q1.y();
            String sb2 = sb.toString();
            if (y7) {
                sb2 = o50.q1(sb2);
            }
            substring = substring + sb2;
        }
        return o50.l1(substring, e50.H8);
    }

    private String s9() {
        String str = e50.z + com.ksdk.ssds.manager.b.b + e50.V1.hashCode() + ".tc";
        if (!o50.A1(str)) {
            return null;
        }
        String p02 = o50.p0(str);
        if (p02.length() < 1000) {
            return null;
        }
        int indexOf = p02.indexOf("|");
        int indexOf2 = p02.indexOf("@");
        int indexOf3 = p02.indexOf("#");
        if (indexOf != -1 && indexOf2 >= indexOf && indexOf3 >= indexOf2) {
            try {
                if (Long.valueOf(p02.substring(0, indexOf)).longValue() != e50.f2) {
                    return null;
                }
                this.Pb = Integer.valueOf(p02.substring(indexOf + 1, indexOf2)).intValue();
                e50.i2 = Integer.valueOf(p02.substring(indexOf2 + 1, indexOf3)).intValue();
                return p02.substring(indexOf3 + 1);
            } catch (Exception e8) {
                e50.S0(e8);
                o50.C(str);
            }
        }
        return null;
    }

    private void sa() {
        this.C8 = findViewById(R.id.txtStatusLay);
        this.E8 = findViewById(R.id.remainingLay);
        this.D8 = findViewById(R.id.txtStatusLayHori);
        this.F8 = findViewById(R.id.statusLeftPanel);
        this.G8 = findViewById(R.id.status2Page);
        this.H8 = (TextView) findViewById(R.id.statusLeft);
        this.I8 = (TextView) findViewById(R.id.statusLeft2);
        this.J8 = (TextView) findViewById(R.id.statusRight);
        this.K8 = (TextView) findViewById(R.id.statusMiddle);
        this.L8 = (TextView) findViewById(R.id.statusMiddle21);
        this.M8 = (TextView) findViewById(R.id.statusMiddle22);
        this.N8 = (TextView) findViewById(R.id.remainingLeft);
        this.O8 = (TextView) findViewById(R.id.remainingRight);
        this.F8.setOnClickListener(this);
        this.J8.setOnClickListener(this);
        this.K8.setOnClickListener(this);
        this.L8.setOnClickListener(this);
        this.M8.setOnClickListener(this);
        this.F8.setOnLongClickListener(this);
        this.J8.setOnLongClickListener(this);
        this.K8.setOnLongClickListener(this);
        this.L8.setOnLongClickListener(this);
        this.M8.setOnLongClickListener(this);
        hf(false);
    }

    public boolean sb() {
        return e50.c5 && System.currentTimeMillis() - this.y1 < Constants.MINIMAL_AD_INTERVAL;
    }

    public void sd(boolean checkY) {
        int i8;
        if (this.Fa) {
            return;
        }
        if (!checkY || this.S1.getScrollY() >= this.Q1.getRealHeight() / 3) {
            int i9 = e50.g2;
            int i10 = e50.h2;
            if (e50.U5() || e50.h2 >= e50.G9.size() - 1) {
                i8 = 0;
                i9++;
                if (q8() == 1 || Ya()) {
                    return;
                }
            } else {
                i8 = i10 + 1;
            }
            if (e50.Q1.z()) {
                f50 f50Var = e50.Q1;
                if (f50Var == null || i9 <= f50Var.h().size() - 1) {
                    if (this.Ha != null && this.Da == i9 && this.Ea == i8) {
                        return;
                    }
                    this.Da = i9;
                    this.Ea = i8;
                    this.Ha = null;
                    j1 j1Var = new j1();
                    j1Var.setPriority(1);
                    j1Var.start();
                }
            }
        }
    }

    private void se(MotionEvent event) {
        if (this.S1.getScrollY() - this.C5 >= e50.h3()) {
            this.C5 = this.S1.getScrollY();
            Ng();
        }
    }

    private void sf() {
        String str;
        if (e50.B3) {
            this.C9.setBackgroundColor(0);
            str = "";
        } else {
            str = "background-color:" + o50.s(e50.k3) + com.lygame.aaa.x1.b;
        }
        MRBookView.b = MRBookView.a.replace("%BACKGROUND", str).replace("%COLOR", o50.s(e50.f3)).replace("%LEFT", "" + e50.D7(e50.c4)).replace("%RIGHT", "" + e50.D7((float) e50.d4)).replace("%TOP", "" + e50.D7((float) e50.a4)).replace("%BOTTOM", "" + e50.D7((float) e50.b4));
    }

    private void sg(boolean visible, boolean animate) {
        TranslateAnimation translateAnimation;
        int i8 = 8;
        if (this.w7 != null) {
            if (!visible && pg(0)) {
                animate = false;
            }
            this.I7 = visible;
            this.w7.setVisibility(visible ? 0 : 8);
            if (e50.O9) {
                int height = this.U1.getHeight();
                if (visible) {
                    translateAnimation = new TranslateAnimation(0.0f, 0.0f, this.U1.getHeight(), this.U1.getHeight() - height);
                } else {
                    translateAnimation = new TranslateAnimation(0.0f, 0.0f, this.U1.getHeight() - height, this.U1.getHeight());
                }
                translateAnimation.setDuration(400L);
                this.w7.startAnimation(translateAnimation);
                if (animate) {
                    AlphaAnimation alphaAnimation = visible ? new AlphaAnimation(1.0f, 0.1f) : new AlphaAnimation(0.1f, 1.0f);
                    alphaAnimation.setDuration(visible ? 300L : 800L);
                    this.e2.startAnimation(alphaAnimation);
                }
            }
        }
        ImageView imageView = this.e2;
        if (e50.O9 && !visible) {
            i8 = 0;
        }
        imageView.setVisibility(i8);
    }

    private void sh() {
        cc(-this.y4, true, false);
        cg(this.y4 != 1 ? -1 : 1);
        this.H1.sendEmptyMessageDelayed(a1, 50L);
    }

    private void t6() {
        boolean z7 = e50.A2() != 2;
        CharSequence[] charSequenceArr = nb() ? new CharSequence[]{getString(R.string.huanyuan), getString(R.string.jinghua), getString(R.string.tihuan), getString(R.string.book_info), e50.W0("分享本书")} : z7 ? new CharSequence[]{getString(R.string.jinghua), getString(R.string.tihuan), getString(R.string.text_encoding), getString(R.string.book_info), e50.W0("分享本书")} : new CharSequence[]{getString(R.string.jinghua), getString(R.string.tihuan), getString(R.string.book_info), e50.W0("分享本书")};
        int length = charSequenceArr.length;
        int[] iArr = new int[length];
        for (int i8 = 0; i8 < length; i8++) {
            iArr[i8] = e50.m1(this.b3, e50.M2 ? -30 : -15);
        }
        for (int i9 = 0; i9 < charSequenceArr.length; i9++) {
            charSequenceArr[i9] = Html.fromHtml("<font color=\"#dddddd\">" + charSequenceArr[i9].toString() + "</font>");
        }
        new com.flyersoft.components.m(this, this.v2, charSequenceArr, null, 0, new o5(z7), iArr, null, true).z(e50.k0(40.0f), -e50.k0(40.0f));
    }

    private int t8(MotionEvent event) {
        int Y = e50.Y(event);
        if (!e50.e5 || Y == 0) {
            return Y;
        }
        return 4;
    }

    private MyUrlSpan t9(int start, int end, int offset, Spanned spanned) {
        int i8;
        MyUrlSpan[] myUrlSpanArr = (MyUrlSpan[]) spanned.getSpans(start, end, MyUrlSpan.class);
        int length = myUrlSpanArr.length;
        MyUrlSpan myUrlSpan = null;
        while (i8 < length) {
            MyUrlSpan myUrlSpan2 = myUrlSpanArr[i8];
            if (myUrlSpan != null) {
                i8 = Math.abs(offset - spanned.getSpanStart(myUrlSpan2)) >= Math.abs(offset - spanned.getSpanStart(myUrlSpan)) ? i8 + 1 : 0;
            }
            myUrlSpan = myUrlSpan2;
        }
        return myUrlSpan;
    }

    private void ta() {
        if (this.C2 == null) {
            View inflate = ((ViewStub) this.y2.findViewById(R.id.stub_space)).inflate();
            this.C2 = inflate;
            inflate.setBackgroundColor(this.b3);
            this.C2.findViewById(R.id.resetSpace).setOnClickListener(this.U3);
            this.o4 = (RoundButton) this.C2.findViewById(R.id.standardT);
            this.p4 = (RoundButton) this.C2.findViewById(R.id.denseT);
            this.C2.findViewById(R.id.standardT).setOnClickListener(this.U3);
            this.C2.findViewById(R.id.denseT).setOnClickListener(this.U3);
            if (Build.VERSION.SDK_INT < 21) {
                this.C2.findViewById(R.id.letterSpaceLay).setVisibility(8);
            }
            this.h4 = (SeekBar) this.C2.findViewById(R.id.lineSK);
            this.j4 = (SeekBar) this.C2.findViewById(R.id.letterSK);
            this.i4 = (SeekBar) this.C2.findViewById(R.id.paraSK);
            this.k4 = (SeekBar) this.C2.findViewById(R.id.leftSK);
            this.l4 = (SeekBar) this.C2.findViewById(R.id.rightSK);
            this.m4 = (SeekBar) this.C2.findViewById(R.id.topSK);
            this.n4 = (SeekBar) this.C2.findViewById(R.id.bottomSK);
            this.h4.setOnSeekBarChangeListener(this.r4);
            this.j4.setOnSeekBarChangeListener(this.r4);
            this.i4.setOnSeekBarChangeListener(this.r4);
            this.k4.setOnSeekBarChangeListener(this.r4);
            this.l4.setOnSeekBarChangeListener(this.r4);
            this.m4.setOnSeekBarChangeListener(this.r4);
            this.n4.setOnSeekBarChangeListener(this.r4);
            this.C2.findViewById(R.id.s11).setTag(11);
            this.C2.findViewById(R.id.s11).setOnClickListener(this.q4);
            this.C2.findViewById(R.id.s12).setTag(12);
            this.C2.findViewById(R.id.s12).setOnClickListener(this.q4);
            this.C2.findViewById(R.id.s21).setTag(21);
            this.C2.findViewById(R.id.s21).setOnClickListener(this.q4);
            this.C2.findViewById(R.id.s22).setTag(22);
            this.C2.findViewById(R.id.s22).setOnClickListener(this.q4);
            this.C2.findViewById(R.id.s31).setTag(31);
            this.C2.findViewById(R.id.s31).setOnClickListener(this.q4);
            this.C2.findViewById(R.id.s32).setTag(32);
            this.C2.findViewById(R.id.s32).setOnClickListener(this.q4);
            this.C2.findViewById(R.id.s41).setTag(41);
            this.C2.findViewById(R.id.s41).setOnClickListener(this.q4);
            this.C2.findViewById(R.id.s42).setTag(42);
            this.C2.findViewById(R.id.s42).setOnClickListener(this.q4);
            this.C2.findViewById(R.id.s51).setTag(51);
            this.C2.findViewById(R.id.s51).setOnClickListener(this.q4);
            this.C2.findViewById(R.id.s52).setTag(52);
            this.C2.findViewById(R.id.s52).setOnClickListener(this.q4);
            this.C2.findViewById(R.id.s61).setTag(61);
            this.C2.findViewById(R.id.s61).setOnClickListener(this.q4);
            this.C2.findViewById(R.id.s62).setTag(62);
            this.C2.findViewById(R.id.s62).setOnClickListener(this.q4);
            this.C2.findViewById(R.id.s71).setTag(71);
            this.C2.findViewById(R.id.s71).setOnClickListener(this.q4);
            this.C2.findViewById(R.id.s72).setTag(72);
            this.C2.findViewById(R.id.s72).setOnClickListener(this.q4);
        }
        Fh(false);
        this.o4.setChecked(!e50.Q3);
        this.p4.setChecked(e50.Q3);
    }

    private void tc() {
        if (this.wa == null) {
            this.wa = new ArrayList<>();
            SharedPreferences sharedPreferences = getSharedPreferences("pdf_toc_failed", 0);
            if (sharedPreferences.contains(e50.V1)) {
                return;
            }
            sharedPreferences.edit().putBoolean(e50.V1, true).commit();
            gc(this.qa.i(), 0);
            sharedPreferences.edit().remove(e50.V1).commit();
            if (this.va) {
                for (int i8 = 0; i8 < this.wa.size(); i8++) {
                    this.wa.get(i8).c++;
                }
            }
        }
        e50.f2 = rc();
        for (int i9 = 0; i9 < this.wa.size() && e50.f2 >= this.wa.get(i9).f; i9++) {
            e50.g2 = i9;
            if (e50.f2 == this.wa.get(i9).f) {
                return;
            }
        }
    }

    private void td() {
        int i8;
        int i9 = e50.g2;
        int i10 = e50.h2;
        if (e50.U5() || e50.h2 <= 0) {
            i9--;
            if (q8() == 1 || Ya()) {
                return;
            } else {
                i8 = -1;
            }
        } else {
            i8 = i10 - 1;
        }
        f50 f50Var = e50.Q1;
        if (f50Var == null || i9 >= 0) {
            if (this.Xa != null && this.Ua == i9 && (this.Va == i8 || i8 == -1)) {
                return;
            }
            this.Ua = i9;
            this.Va = i8;
            this.Xa = null;
            if (i8 != -1) {
                this.m5 = f50Var == null ? G5() : f50Var.p();
                String Q = e50.Q(e50.G9.get(this.Va));
                this.Za = Q;
                this.Xa = com.flyersoft.staticlayout.j.c(Q, this.m5, this.Ua);
                this.Ya = e50.G9;
            } else {
                c8(-1);
            }
            this.Wa = -1;
        }
    }

    public void te(int chapterId, CharSequence text, boolean createCurlCache) {
        this.Ha = text;
        if (!createCurlCache || !e50.Q4() || F7() || e50.Q1 == null) {
            return;
        }
        if (text.length() > 100 || !Va(chapterId, text.toString(), true)) {
            this.H1.removeMessages(M0);
            this.H1.removeMessages(N0);
            this.H1.sendEmptyMessageDelayed(M0, 100L);
        }
    }

    public static void tf(Activity act, e50.i book) {
        uf(act, book, null, false);
    }

    private void th() {
        if (this.o8 != null) {
            ((AudioManager) getSystemService("audio")).abandonAudioFocus(this.o8);
            this.o8 = null;
        }
    }

    public void u5() {
        ScrollImage scrollImage;
        if (e50.O9) {
            Eg(-100);
        }
        if (e50.P9 && ((V8() == 0 || V8() == 1) && (scrollImage = this.U7) != null)) {
            scrollImage.setPage1Bm(O8(true, true));
            this.U7.invalidate();
        }
        if (e50.P9) {
            if (V8() == 2 || V8() == 3) {
                if (e50.s5 > 10) {
                    o50.q2(this, Const.ACTION_COMPLAINT, 0);
                    if (this.q5 == null) {
                        this.q5 = new e5(Looper.getMainLooper());
                    }
                    this.q5.removeCallbacksAndMessages(null);
                    this.q5.sendEmptyMessageDelayed(1, 1000L);
                    this.q5.sendEmptyMessageDelayed(2, 2000L);
                    this.q5.sendEmptyMessageDelayed(3, Constants.MINIMAL_AD_INTERVAL);
                    return;
                }
                P6(true, false);
            }
        }
    }

    private void u6(String url, String title) {
        boolean z7;
        int length;
        int i8;
        int i9;
        int i10;
        String substring = url.substring(5);
        while (substring.startsWith("0")) {
            substring = substring.substring(1);
        }
        try {
            int intValue = Integer.valueOf(substring).intValue();
            int size = e50.Q1.h().size();
            int i11 = 0;
            for (int i12 = 0; i12 < size; i12++) {
                i11 = (int) (i11 + e50.Q1.h().get(i12).h);
                if (i11 >= intValue) {
                    int i13 = e50.g2;
                    int i14 = e50.h2;
                    if (i11 != intValue) {
                        if (intValue > i11 - 200 && i12 < size - 1) {
                            String g8 = e50.Q1.g(i12);
                            if (e50.d6 && g8.indexOf(f50.e) != -1) {
                                g8 = g8.substring(0, g8.indexOf(f50.e));
                            }
                            int length2 = intValue - (i11 - g8.length());
                            if (g8.length() > length2) {
                                String substring2 = g8.substring(length2);
                                int indexOf = substring2.indexOf(">");
                                int indexOf2 = substring2.indexOf("<");
                                if ((indexOf == -1 || indexOf2 != -1) && (indexOf != -1 || indexOf2 == -1)) {
                                    if (indexOf2 > indexOf) {
                                        substring2 = substring2.substring(indexOf2);
                                    }
                                    if (Html.fromHtml(substring2).toString().trim().length() == 0) {
                                    }
                                }
                                z7 = true;
                                if (z7) {
                                    String g9 = e50.Q1.g(i12);
                                    int length3 = (int) ((g9.length() * ((int) (e50.Q1.h().get(i12).h - (i11 - intValue)))) / e50.Q1.h().get(i12).h);
                                    if (length3 >= e50.Z7) {
                                        ArrayList arrayList = new ArrayList();
                                        e50.h0(e50.Q1.g(i12), arrayList);
                                        long j8 = 0;
                                        int i15 = 0;
                                        while (true) {
                                            if (i15 >= arrayList.size()) {
                                                break;
                                            }
                                            j8 += ((String) arrayList.get(i15)).length();
                                            if (j8 > length3) {
                                                g9 = (String) arrayList.get(i15);
                                                length3 -= (int) (j8 - g9.length());
                                                i14 = i15;
                                                break;
                                            }
                                            i15++;
                                        }
                                    } else {
                                        i14 = 0;
                                    }
                                    String trim = title.trim();
                                    int lastIndexOf = g9.lastIndexOf(trim, length3);
                                    int indexOf3 = g9.indexOf(trim, length3);
                                    StringBuilder sb = new StringBuilder();
                                    sb.append("---------------t2:");
                                    sb.append(lastIndexOf);
                                    sb.append(" t:");
                                    sb.append(length3);
                                    sb.append(" t3:");
                                    sb.append(indexOf3);
                                    sb.append("  (t-t2):");
                                    int i16 = length3 - lastIndexOf;
                                    sb.append(i16);
                                    sb.append("  (t3-t):");
                                    int i17 = indexOf3 - length3;
                                    sb.append(i17);
                                    e50.N5(sb.toString());
                                    if (indexOf3 == -1) {
                                        if (lastIndexOf != -1 && i16 < 300) {
                                            length3 = lastIndexOf;
                                        }
                                        int lastIndexOf2 = g9.lastIndexOf("<", length3);
                                        Spanned c8 = com.flyersoft.staticlayout.j.c(g9.substring(0, lastIndexOf2) + "(<a href=\"@@\">#</a>)" + g9.substring(lastIndexOf2), this.m5, i12);
                                        MyUrlSpan[] myUrlSpanArr = (MyUrlSpan[]) c8.getSpans(0, c8.length(), MyUrlSpan.class);
                                        length = myUrlSpanArr.length;
                                        i8 = 0;
                                        while (true) {
                                            if (i8 < length) {
                                                i9 = i12;
                                                i10 = 0;
                                                break;
                                            }
                                            MyUrlSpan myUrlSpan = myUrlSpanArr[i8];
                                            if (myUrlSpan.b().equals("@@")) {
                                                i10 = c8.getSpanStart(myUrlSpan);
                                                i9 = i12;
                                                break;
                                            }
                                            i8++;
                                        }
                                    } else {
                                        if (i17 < 150) {
                                            length3 = indexOf3;
                                        } else if (indexOf3 > 1000) {
                                            if (lastIndexOf != -1) {
                                            }
                                        }
                                        int lastIndexOf22 = g9.lastIndexOf("<", length3);
                                        Spanned c82 = com.flyersoft.staticlayout.j.c(g9.substring(0, lastIndexOf22) + "(<a href=\"@@\">#</a>)" + g9.substring(lastIndexOf22), this.m5, i12);
                                        MyUrlSpan[] myUrlSpanArr2 = (MyUrlSpan[]) c82.getSpans(0, c82.length(), MyUrlSpan.class);
                                        length = myUrlSpanArr2.length;
                                        i8 = 0;
                                        while (true) {
                                            if (i8 < length) {
                                            }
                                            i8++;
                                        }
                                    }
                                    pe(false);
                                    ke(e50.g2, e50.h2, this.n5);
                                    re(true);
                                    if (e50.g2 != i9 && e50.h2 == i14) {
                                        MRTextView mRTextView = this.Q1;
                                        nh(mRTextView.a0(mRTextView.getLayout().B(i10)));
                                    } else {
                                        Of(i9, i14, i10, true);
                                    }
                                    zb();
                                    return;
                                }
                            }
                        }
                        z7 = false;
                        if (z7) {
                        }
                    } else if (i12 >= size - 1) {
                        return;
                    }
                    i9 = i12 + 1;
                    i10 = 0;
                    i14 = 0;
                    pe(false);
                    ke(e50.g2, e50.h2, this.n5);
                    re(true);
                    if (e50.g2 != i9) {
                    }
                    Of(i9, i14, i10, true);
                    zb();
                    return;
                }
            }
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    public void u7() {
        if (wf(4)) {
            this.d7 = false;
            this.c7 = false;
            if (this.C9 != null) {
                return;
            }
            if (e50.O9) {
                Tg();
                return;
            }
            ub(false);
            MRTextView mRTextView = this.Q1;
            int i8 = mRTextView.P0;
            if (i8 == -1) {
                mRTextView = this.R1;
                if (mRTextView.P0 == -1) {
                    mRTextView = null;
                }
            }
            if ((e50.Q6 && (mRTextView == null || e50.S6)) && i8 == -1) {
                if (this.e7 != null) {
                    return;
                }
                if (e50.S6) {
                    e50.S6 = false;
                    o50.a2(this);
                }
                ScrollView scrollView = (ScrollView) LayoutInflater.from(this).inflate(R.layout.tts_options, (ViewGroup) null);
                CheckBox checkBox = (CheckBox) scrollView.findViewById(R.id.ofNeverAskAgain);
                CheckBox checkBox2 = (CheckBox) scrollView.findViewById(R.id.tts_stop_check);
                EditText editText = (EditText) scrollView.findViewById(R.id.tts_stop_time);
                Spinner spinner = (Spinner) scrollView.findViewById(R.id.pmTtsDivides);
                checkBox.setChecked(true);
                if (e50.t6) {
                    checkBox2.setChecked(true);
                    checkBox.setEnabled(false);
                }
                checkBox2.setOnCheckedChangeListener(new b6(checkBox));
                editText.setText("" + e50.r6);
                scrollView.findViewById(R.id.pmSetTTS).setOnClickListener(new c6());
                spinner.setSelection(e50.o6);
                m.c cVar = new m.c(this);
                this.e7 = cVar;
                cVar.B(scrollView).v(R.string.start_speak_button, new e6(checkBox)).o(R.string.cancel, new d6(checkBox)).d(false).C();
                return;
            }
            e50.N5("*TTS start 1");
            ua();
        }
    }

    private String u8() {
        f50 f50Var = e50.Q1;
        if (f50Var != null) {
            return f50Var.h().get(e50.g2).c;
        }
        return (q8() != 0 || o50.G1(e50.s9)) ? "" : r9();
    }

    public boolean u9(boolean front) {
        if (front) {
            this.P4 = null;
        }
        if (!front && this.X2) {
            this.H1.sendEmptyMessageDelayed(p0, 10L);
            return false;
        }
        int i8 = 1;
        try {
            if (front) {
                wd();
                cc(this.y4, true, false);
                pe(true);
                if (this.y4 != 1) {
                    i8 = -1;
                }
                cg(i8);
                return u9(false);
            }
            Message message = this.P4;
            if (message != null) {
                this.P4 = null;
                F9(message);
            }
            return true;
        } catch (Exception e8) {
            e50.S0(e8);
            return false;
        }
    }

    public void ua() {
        Fd();
        this.N6 = new TextToSpeech(this, this.P6);
    }

    private void ub(boolean showTip) {
        if (this.N6 != null) {
            if (showTip) {
                try {
                    o50.p2(this, getString(R.string.tts_stop));
                } catch (Exception e8) {
                    e50.S0(e8);
                }
            }
            this.L7 = true;
            gh();
            this.N6.shutdown();
            this.N6 = null;
        }
    }

    private ArrayList<e50.o> uc() {
        if (this.F2.c) {
            hd(true);
        }
        String viewGetCurPageText = this.F2.b.viewGetCurPageText();
        if (o50.F1(viewGetCurPageText)) {
            return null;
        }
        try {
            Page j8 = this.qa.j(rc());
            j8.P();
            int i8 = 0;
            while (true) {
                int indexOf = viewGetCurPageText.indexOf(pl2.e, i8);
                if (indexOf == -1) {
                    break;
                }
                float[] fArr = new float[4];
                j8.N(indexOf - 1, fArr);
                int i9 = indexOf + 2;
                if (viewGetCurPageText.length() <= i9) {
                    break;
                }
                float[] fArr2 = new float[4];
                j8.N(i9, fArr2);
                if (Math.abs((fArr[3] - fArr[1]) - (fArr2[3] - fArr2[1])) > 1.0f) {
                    viewGetCurPageText = viewGetCurPageText.substring(0, indexOf) + "✔" + viewGetCurPageText.substring(indexOf + 1);
                }
                i8 = i9;
            }
        } catch (Exception e8) {
            e50.S0(e8);
        }
        ArrayList<e50.o> V3 = e50.V3(viewGetCurPageText, true, false, 0);
        if (V3.size() == 0) {
            return null;
        }
        e50.o oVar = V3.get(0);
        this.F2.q0 = null;
        com.radaee.pdfex.b.C(oVar.b, oVar.c);
        this.F2.postInvalidate();
        Gg().sendEmptyMessageDelayed(4, 100L);
        return V3;
    }

    private void ud() {
        if (!(e50.Q1 == null && e50.U5()) && !Ca() && this.C9 == null && this.S1.getScrollY() == 0) {
            td();
        }
    }

    private void ue() {
        e50.M7 = true;
        g50.h e02 = g50.e0(e50.V1);
        long currentTimeMillis = System.currentTimeMillis();
        long j8 = this.C1;
        long j9 = currentTimeMillis - j8;
        int i8 = this.O9;
        if (i8 > 0 && j8 > 0 && j9 > 2000) {
            xd(e02, j9, i8);
            e50.T4 += j9;
            e02.b += j9;
            e02.c += this.O9;
            g50.u0(e02);
        }
        this.O9 = 0;
        this.C1 = System.currentTimeMillis();
    }

    public static void uf(Activity act, e50.i book, f50 ebook, boolean readState) {
        if (readState) {
            g50.h e02 = g50.e0(book.a);
            long j8 = e02.b;
            if (j8 > 0 && e02.c > 0) {
                try {
                    book.e = o50.W(j8);
                    if ((((float) e02.b) / 60.0f) / 1000.0f > 0.0f) {
                        book.f = "" + new DecimalFormat("0").format(((float) e02.c) / r4);
                    }
                } catch (Exception e8) {
                    e50.S0(e8);
                }
            }
        }
        StringBuilder sb = new StringBuilder();
        sb.append("我正在阅读");
        if (!o50.F1(book.c)) {
            book.c = "(作者: " + book.c + ")";
        }
        sb.append("《" + book.b + "》" + book.c);
        boolean D5 = e50.D5(book.a);
        if (!D5 && readState && !o50.F1(book.d)) {
            sb.append(", 已看完" + book.d);
        }
        sb.append("\n");
        if (readState) {
            sb.append(act.getString(R.string.read_hour) + ": " + book.e + "\n");
            sb.append(act.getString(R.string.read_speed) + ": " + book.f + act.getString(R.string.read_speed2) + "\n");
        }
        if (D5) {
            try {
                if (ebook != null) {
                    sb.append(ebook.h().get(e50.g2).c);
                    sb.append("\n书源\"" + ebook.p.name() + "\", 地址:\n");
                    StringBuilder sb2 = new StringBuilder();
                    sb2.append(ebook.h().get(e50.g2).s);
                    sb2.append("\n");
                    sb.append(sb2.toString());
                } else {
                    String H = q50.H(book.a);
                    ArrayList<String> C2 = o50.C2(q50.H(o50.n0(book.a) + "/.sources"));
                    String str = null;
                    int i8 = 0;
                    while (true) {
                        if (i8 >= C2.size()) {
                            break;
                        }
                        String str2 = C2.get(i8);
                        if (str2.contains("*" + H + "#")) {
                            H = str2.substring(0, str2.indexOf("*"));
                            str = str2.substring(str2.indexOf("#") + 1);
                            break;
                        }
                        i8++;
                    }
                    sb.append("书源\"" + H + "\", 地址:\n");
                    StringBuilder sb3 = new StringBuilder();
                    sb3.append(str);
                    sb3.append("\n");
                    sb.append(sb3.toString());
                }
            } catch (Exception e9) {
                e50.S0(e9);
            }
        }
        sb.append("\n(复制这条信息, 打开搜书大师可直接阅读: http://soushu.site)");
        Intent intent = new Intent("android.intent.action.SEND");
        intent.setType("text/plain");
        intent.putExtra("android.intent.extra.SUBJECT", "分享我的阅读: " + e50.D1());
        intent.putExtra("android.intent.extra.TEXT", sb.toString());
        e50.N5(sb.toString());
        act.startActivity(Intent.createChooser(intent, ""));
    }

    private void ug(final String url, final String title, int cIndex) {
        m.c cVar = new m.c(this);
        this.H1.sendEmptyMessageDelayed(G0, 50L);
        cVar.u(new k5());
        TextView textView = new TextView(this);
        float f8 = e50.d3;
        if (f8 > 19.0f) {
            f8 -= 2.0f;
        }
        textView.setTextSize(f8);
        textView.setPadding(e50.k0(4.0f), e50.k0(4.0f), e50.k0(4.0f), e50.k0(4.0f));
        textView.setText(Html.fromHtml(this.c6, e50.Q1.o(), null));
        if (title.length() > 1 || (title.length() == 1 && title.charAt(0) != 65532)) {
            cVar.z(title);
        }
        cVar.B(textView).v(R.string.open_note, new l5(url, title)).o(R.string.cancel, null).d(true).C();
    }

    private void uh() {
        if (this.l8) {
            this.l8 = false;
            try {
                ((AudioManager) getSystemService("audio")).unregisterMediaButtonEventReceiver(this.n8);
                OpenFile_Receiver openFile_Receiver = this.m8;
                if (openFile_Receiver != null) {
                    unregisterReceiver(openFile_Receiver);
                }
            } catch (Exception e8) {
                e50.S0(e8);
            }
        }
    }

    private void v6(int which) {
        za(true);
        switch (which - 1) {
            case -1:
                u7();
                return;
            case 0:
                w7(false);
                return;
            case 1:
                s7();
                return;
            case 2:
                X6();
                return;
            case 3:
                t7(0);
                return;
            case 4:
                q7();
                return;
            case 5:
                i7();
                return;
            case 6:
                r7();
                return;
            case 7:
                j7();
                return;
            case 8:
                Z6();
                return;
            case 9:
                za(false);
                return;
            case 10:
                g7();
                return;
            case 11:
                b7();
                return;
            default:
                return;
        }
    }

    public void v7() {
        za(true);
        ActivityMain.D0(this, this.H1, e50.V1, new f2());
    }

    private Handler v9() {
        if (this.i5 == null) {
            this.i5 = new a5(Looper.getMainLooper());
        }
        return this.i5;
    }

    private boolean va(boolean handle) {
        if (this.r2 != null) {
            return true;
        }
        this.r2 = ((ViewStub) findViewById(R.id.viewStub_top)).inflate();
        this.y2 = (ViewGroup) ((ViewStub) findViewById(R.id.viewStub_bottom)).inflate();
        this.r2.findViewById(R.id.notificationBar).setVisibility(8);
        this.w2 = this.r2.findViewById(R.id.urlLay);
        this.d2 = (ImageView) this.r2.findViewById(R.id.chromeSwitch);
        this.g2 = (ImageView) this.r2.findViewById(R.id.pdfPen);
        this.h2 = (ImageView) this.r2.findViewById(R.id.txtDownload);
        this.z3 = (SeekBar) this.y2.findViewById(R.id.txtSeekBar01);
        this.Y1 = this.r2.findViewById(R.id.txtBackLay);
        this.j2 = (TextView) this.r2.findViewById(R.id.txtTitle);
        this.p2 = (TextView) this.r2.findViewById(R.id.zsSwitch);
        this.l2 = (TextView) this.r2.findViewById(R.id.txtUrl);
        this.m2 = (TextView) this.r2.findViewById(R.id.siteTv);
        this.v2 = this.r2.findViewById(R.id.menuB);
        this.P3 = (TextView) this.r2.findViewById(R.id.b_storeUrl);
        this.Q3 = (TextView) this.r2.findViewById(R.id.b_toShelf);
        this.O3 = this.y2.findViewById(R.id.b_read);
        this.N3 = this.y2.findViewById(R.id.b_write);
        this.R3 = (TextView) this.y2.findViewById(R.id.commentTv);
        if (!o50.F1(e50.b2)) {
            ((TextView) this.y2.findViewById(R.id.shuPingTip)).setText(e50.b2);
        }
        this.E2 = (ListView) this.y2.findViewById(R.id.menu);
        this.x2 = this.y2.findViewById(R.id.func);
        this.f2 = (ImageView) this.y2.findViewById(R.id.nav_return);
        this.k2 = (TextView) this.y2.findViewById(R.id.txtTextViewPercent);
        this.n2 = (TextView) this.y2.findViewById(R.id.priorChapterTv);
        this.o2 = (TextView) this.y2.findViewById(R.id.nextChapterTv);
        this.k2.setVisibility(8);
        this.C3 = (ImageView) this.y2.findViewById(R.id.b0);
        this.D3 = (ImageView) this.y2.findViewById(R.id.b1);
        this.E3 = (ImageView) this.y2.findViewById(R.id.b2);
        this.F3 = (ImageView) this.y2.findViewById(R.id.b3);
        this.G3 = (ImageView) this.y2.findViewById(R.id.b4);
        this.H3 = (ImageView) this.y2.findViewById(R.id.b5);
        this.I3 = (ImageView) this.y2.findViewById(R.id.b6);
        this.J3 = (ImageView) this.y2.findViewById(R.id.b7);
        this.L3 = (ImageView) this.y2.findViewById(R.id.b_daynight);
        this.K3 = (ImageView) this.y2.findViewById(R.id.bMore);
        this.M3 = this.y2.findViewById(R.id.daynightLay);
        this.s2 = this.y2.findViewById(R.id.buttonsLay);
        nf(8);
        this.r2.setVisibility(4);
        this.y2.setVisibility(4);
        this.C3.setOnClickListener(this.a3);
        this.D3.setOnClickListener(this.a3);
        this.E3.setOnClickListener(this.a3);
        this.F3.setOnClickListener(this.a3);
        this.G3.setOnClickListener(this.a3);
        this.H3.setOnClickListener(this.a3);
        this.I3.setOnClickListener(this.a3);
        this.J3.setOnClickListener(this.a3);
        this.K3.setOnClickListener(this);
        this.L3.setOnClickListener(this);
        this.P3.setOnClickListener(this);
        this.Q3.setOnClickListener(this);
        this.O3.setOnClickListener(this);
        this.N3.setOnClickListener(this);
        this.M3.setOnClickListener(this);
        this.M3.setOnLongClickListener(this);
        this.v2.setOnClickListener(this);
        this.d2.setOnLongClickListener(this);
        this.Y1.setOnClickListener(this);
        this.j2.setOnClickListener(this);
        this.p2.setOnClickListener(this);
        this.k2.setOnClickListener(this);
        this.f2.setOnClickListener(this);
        this.z3.setOnSeekBarChangeListener(this.s5);
        this.d2.setOnClickListener(this);
        this.g2.setOnClickListener(this);
        this.l2.setOnClickListener(this);
        this.m2.setOnClickListener(this);
        this.h2.setOnClickListener(this);
        this.n2.setOnClickListener(this.U3);
        this.o2.setOnClickListener(this.U3);
        this.l2.setTextSize(e50.o8 ? 13.0f : 11.0f);
        this.m2.setTextSize(e50.o8 ? 13.0f : 11.0f);
        this.l2.setTextSize(e50.o8 ? 13.0f : 11.0f);
        this.l2.setTextSize(e50.o8 ? 13.0f : 11.0f);
        this.n2.setTextSize(e50.o8 ? 13.0f : 11.0f);
        this.o2.setTextSize(e50.o8 ? 13.0f : 11.0f);
        Ee();
        if (handle) {
            new d4(Looper.getMainLooper()).sendEmptyMessageDelayed(0, 0L);
        }
        return false;
    }

    private boolean vb() {
        int Q2;
        if (F7()) {
            if (!Xa()) {
                return true;
            }
            int height = (e50.Q4() || F7()) ? this.R1.getHeight() : this.R1.getRealHeight();
            if (this.R1.getHeight() - height > e50.h3()) {
                height = this.R1.getHeight();
            }
            if (this.T1.getScrollY() + e50.h3() >= height) {
                return true;
            }
            Q2 = e50.Q2(this.T1, -1);
        } else {
            if (e50.i0()) {
                return true;
            }
            Q2 = e50.Q2(this.S1, -1);
            if (Q2 == T8() - 1 && this.Q1.D0(Q2) && this.S1.getScrollY() + e50.h3() < this.Q1.Z(Q2 + 1)) {
                return false;
            }
        }
        if (Q2 >= T8() - 1) {
            return true;
        }
        if (this.Q1.getLayout().z(Q2) != 0) {
            com.flyersoft.staticlayout.i A = this.Q1.getLayout().A(Q2);
            ScrollView2 scrollView2 = F7() ? this.T1 : this.S1;
            if (A != null && (A.G0 + A.D0) - e50.k0(10.0f) > scrollView2.getScrollY() + e50.h3()) {
                return false;
            }
        }
        if (Q2 >= T8() - 3) {
            String substring = this.Q1.getText2().substring(this.Q1.getLayout().I(Q2 + 1), this.Q1.getText2().length());
            if (e50.L4(substring, 0, substring.length())) {
                return true;
            }
        }
        return false;
    }

    public void ve() {
        new m.c(this).z("保存到").x(new String[]{"位置一", "位置二", "位置三", "位置四"}, this.Db, new v2()).v(R.string.ok, new t2()).o(R.string.cancel, null).C();
    }

    private void vf(View v7) {
        String[] strArr = {getString(R.string.share), getString(R.string.send_file), getString(R.string.bug_report)};
        if (v7 == null) {
            new m.c(this).i(strArr, new r0()).C();
        } else {
            new com.flyersoft.components.m(this, v7, strArr, new c1()).z(e50.k0(40.0f), -e50.k0(40.0f));
        }
    }

    public void w5(String s7) {
        try {
            ((ClipboardManager) getSystemService("clipboard")).setText(s7);
            o50.s2(this, getString(R.string.copy_to_clipboard), s7.replace("\n", "<br>"), 0);
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    private boolean w6(View v7, MotionEvent event) {
        boolean z7 = false;
        if (this.K2 || this.L2 || e50.O9) {
            return false;
        }
        if (!e50.Q4() && !kb()) {
            return false;
        }
        if (Ya() && this.F2.c) {
            return false;
        }
        if (event.getAction() == 0) {
            this.Q4 = false;
            if (X7() || Qh()) {
                return true;
            }
            this.U4 = false;
            this.S4 = false;
            this.T4 = false;
            L9();
            this.V4 = false;
            this.Q4 = true;
            if (Ta(event)) {
                this.Q4 = false;
            }
            if (!this.Q4) {
                return false;
            }
            this.x6 = 0.0f;
            J9();
            this.R4 = true;
            E9(E5(2, event));
        }
        if (e50.da) {
            return false;
        }
        if (this.S4 && event.getAction() == 2) {
            return true;
        }
        if (event.getAction() == 2) {
            if (!this.U4 && ((e50.t5 && M6(event)) || (e50.x5 && N6(event)))) {
                this.Q4 = false;
                Ke();
                this.V4 = true;
                return true;
            }
            if (!this.U4 && (B7() || hb(event))) {
                return true;
            }
            if (Z9(event)) {
                return false;
            }
            if (!this.Q4) {
                if ((Ta(event) || this.S4) && Math.abs(o9(event) - this.u5) > Math.abs(event.getY() - this.t5) && M7(o9(event), this.u5, true)) {
                    this.S4 = true;
                    int i8 = o9(event) > this.u5 ? -1 : 1;
                    this.y4 = i8;
                    bc(i8);
                    return true;
                }
                return !Ta(event);
            }
            Message E5 = E5(3, event);
            if (e50.Q4() && !this.R4) {
                E9(E5);
            } else {
                S5(E5);
            }
        }
        if (!Z9(event)) {
            if (this.w6 == null) {
                this.w6 = new GestureDetector(new n7());
            }
            this.w6.onTouchEvent(event);
        }
        if (event.getAction() == 1 && !this.V4) {
            if (R6(event) && this.h6) {
                if (this.U4) {
                    this.H4.Finished(false);
                }
                return true;
            }
            boolean z8 = this.U4;
            if ((z8 || this.l6 <= 10) && (z8 || this.m6 == -1 || SystemClock.elapsedRealtime() - this.m6 < 800)) {
                if (!this.U4) {
                    boolean ib = ib(event, true);
                    float abs = Math.abs(o9(event) - this.u5);
                    float abs2 = Math.abs(event.getY() - this.t5);
                    if (B7() || s5(event)) {
                        return true;
                    }
                    if (Ta(event) && abs2 < 12.0f && abs < 12.0f) {
                        if (!ib) {
                            za(false);
                        }
                        return true;
                    }
                    z7 = ib;
                }
                if (this.U4 || (this.Q4 && !z7)) {
                    Message E52 = E5(4, event);
                    if (e50.Q4() && !this.R4) {
                        E9(E52);
                    } else {
                        S5(E52);
                    }
                }
            }
            return !Ta(event);
        }
        return true;
    }

    private int w8(MotionEvent event) {
        int i8;
        int t8 = t8(event);
        if (t8 == 1) {
            i8 = e50.p4;
        } else if (t8 == 2) {
            i8 = e50.q4;
        } else if (t8 == 3) {
            i8 = e50.t4;
        } else {
            if (t8 != 4) {
                return 1;
            }
            i8 = e50.u4;
        }
        if (i8 == 15) {
            return 0;
        }
        return i8 == 0 ? -1 : 1;
    }

    private void wa() {
        this.w7 = ((ViewStub) findViewById(R.id.viewStub1)).inflate();
        this.M7 = new g6();
        this.N7 = new h6();
        View findViewById = this.w7.findViewById(R.id.tts_page_up);
        this.C7 = findViewById;
        findViewById.setOnClickListener(this.M7);
        View findViewById2 = this.w7.findViewById(R.id.tts_page_down);
        this.D7 = findViewById2;
        findViewById2.setOnClickListener(this.M7);
        View findViewById3 = this.w7.findViewById(R.id.tts_stop);
        this.x7 = findViewById3;
        findViewById3.setOnClickListener(this.M7);
        View findViewById4 = this.w7.findViewById(R.id.tts_prior);
        this.y7 = findViewById4;
        findViewById4.setOnClickListener(this.M7);
        View findViewById5 = this.w7.findViewById(R.id.tts_play);
        this.z7 = findViewById5;
        findViewById5.setOnClickListener(this.M7);
        View findViewById6 = this.w7.findViewById(R.id.tts_next);
        this.A7 = findViewById6;
        findViewById6.setOnClickListener(this.M7);
        TextView textView = (TextView) this.w7.findViewById(R.id.resetTv);
        this.E7 = textView;
        textView.setOnClickListener(this.M7);
        this.E7.setText(getString(R.string.reset).replace(":", ""));
        of();
        View findViewById7 = this.w7.findViewById(R.id.tts_options);
        this.B7 = findViewById7;
        findViewById7.setOnClickListener(this.M7);
        SeekBar seekBar = (SeekBar) this.w7.findViewById(R.id.tts_speed);
        this.F7 = seekBar;
        seekBar.setOnSeekBarChangeListener(this.N7);
        fh(e50.p6);
        SeekBar seekBar2 = (SeekBar) this.w7.findViewById(R.id.tts_pitch);
        this.H7 = seekBar2;
        seekBar2.setOnSeekBarChangeListener(this.N7);
        this.H7.setProgress(e50.q6);
        this.G7 = (SeekBar) this.w7.findViewById(R.id.tts_volume);
        AudioManager audioManager = (AudioManager) getSystemService("audio");
        this.G7.setMax(audioManager.getStreamMaxVolume(3));
        this.G7.setProgress(audioManager.getStreamVolume(3));
        this.G7.setOnSeekBarChangeListener(this.N7);
    }

    private void wb() {
        if (Ya() || A7()) {
            return;
        }
        TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f, 0.0f, this.y2.getHeight());
        translateAnimation.setDuration(this.S3);
        this.y2.startAnimation(translateAnimation);
        TranslateAnimation translateAnimation2 = new TranslateAnimation(0.0f, 0.0f, this.v8, ((-this.r2.getHeight()) - this.v8) - this.w8);
        translateAnimation2.setDuration(this.S3);
        this.r2.startAnimation(translateAnimation2);
    }

    private void wd() {
        if (this.Y4) {
            return;
        }
        MRTextView mRTextView = this.Ka;
        mRTextView.d = false;
        if (mRTextView.getText() != this.Q1.getText()) {
            this.La.setPadding(this.S1.getPaddingLeft(), this.S1.getPaddingTop(), this.S1.getPaddingRight(), this.S1.getPaddingBottom());
            e50.T6(this.Ka, false);
            e50.Z6(this.Ka);
            e50.I6(this.Ka);
            e50.G6(this.Ka);
            this.Ka.l(0, this.Q1.getTextSize());
            this.Ka.setText(this.Q1.getText());
            this.Z4 = e50.g2;
        }
        U7(this.Ka, this.S1.getScrollY());
        this.La.scrollTo(0, this.S1.getScrollY());
        this.La.d(0.0f, 0.0f, false);
        this.La.setVisibility(0);
        He(true);
        this.H1.removeMessages(a1);
        this.H1.sendEmptyMessageDelayed(a1, 1500L);
        this.X4 = false;
        this.Y4 = true;
    }

    private void we() {
        com.flyersoft.staticlayout.l layout;
        if (q8() == 0 && this.Ob != e50.f2 && (layout = this.Q1.getLayout()) != null && this.O2) {
            this.Ob = e50.f2;
            this.Pb = layout.I(layout.C(this.S1.getScrollY()));
            String str = this.Ob + "|" + this.Pb + "@" + e50.i2 + "#" + this.Q1.getText().toString();
            if (str.length() < 1000) {
                return;
            }
            o50.i2(e50.z + com.ksdk.ssds.manager.b.b + e50.V1.hashCode() + ".tc", str);
        }
    }

    public boolean wf(final int type) {
        return true;
    }

    public void wg() {
        this.B6 = true;
        e50.w(e50.Q1.p.siteTag);
        if (this.Jb == null) {
            StoreWebView storeWebView = new StoreWebView((Activity) this, (StoreWebView.e) new j3(), S.getChromeClient(e50.Q1.p), this.H1);
            this.Jb = storeWebView;
            storeWebView.setDownloadListener(new k3());
            this.Jb.setOnTouchListener(new l3());
            this.U1.addView(this.Jb, new FrameLayout.LayoutParams(-1, -1));
            this.Jb.bringToFront();
            va(true);
            this.r2.bringToFront();
            this.y2.bringToFront();
            this.Z1.bringToFront();
        }
        this.Kb = true;
        this.Jb.clearHistory();
        this.Jb.setVisibility(0);
        StoreWebView storeWebView2 = this.Jb;
        f50 f50Var = e50.Q1;
        Eb(storeWebView2, f50Var.p, f50Var.h().get(e50.g2).s);
    }

    public void wh() {
        int i8 = nb() ? 0 : 8;
        this.h2.setVisibility(i8);
        this.p2.setVisibility(i8);
        this.p2.setText(e50.W0(this.B6 ? "优化" : "原版"));
        this.K3.getDrawable().setColorFilter(-1, PorterDuff.Mode.SRC_IN);
        if (nb()) {
            this.h2.getDrawable().setColorFilter(-1, PorterDuff.Mode.SRC_IN);
        }
        this.w2.setVisibility(i8);
        if (nb()) {
            this.l2.setText(e50.Q1.h().get(e50.g2).s);
            this.m2.setText(e50.Q1.p.name());
        }
    }

    static long x(ActivityTxt activityTxt) {
        long j8 = activityTxt.Q8;
        activityTxt.Q8 = j8 - 1;
        return j8;
    }

    public void x6(String utteranceId) {
        if (utteranceId == null) {
            return;
        }
        com.radaee.pdfex.b.c(false);
        if (e50.O9) {
            if (this.L7) {
                e50.N5("-----------setSpeakOnUtteranceComplete, tts_stopped=true");
                return;
            }
            int intValue = Integer.valueOf(utteranceId).intValue();
            this.Q6 = intValue;
            if (intValue < this.K6.size() - 1) {
                e50.o oVar = this.K6.get(this.Q6 + 1);
                e50.N5(this.Q6 + com.ksdk.ssds.manager.b.b + this.K6.size() + "->" + oVar.a + "##");
                if (Ya() && !ab()) {
                    this.F2.q0 = null;
                    com.radaee.pdfex.b.C(oVar.b, oVar.c);
                    this.F2.postInvalidate();
                    Gg().sendEmptyMessageDelayed(4, 100L);
                    return;
                }
                int i8 = this.G6;
                U9(oVar.b + i8, i8 + oVar.c);
                if (this.I6) {
                    B4(oVar.a);
                }
                if (this.I6 && !this.z1) {
                    MRTextView mRTextView = this.Q1;
                    if (mRTextView.P0 >= 0 && mRTextView.getLayout() != null) {
                        int b02 = this.Q1.b0(this.Q1.getLayout().B(this.Q1.P0));
                        int b03 = this.Q1.b0(this.Q1.getLayout().B(this.Q1.Q0));
                        if (b02 < this.S1.getScrollY() || b03 > (this.S1.getScrollY() + e50.h3()) - this.Q1.getLineHeight()) {
                            lh(this.Q1.P0);
                            this.Q1.postInvalidate();
                            Ih();
                        }
                    }
                }
                if (this.I6 && this.z1) {
                    getSharedPreferences(e50.r0, 0).edit().putString(e50.V1.toLowerCase(), e50.g2 + "@" + e50.h2 + "#" + (this.G6 + oVar.b) + ":" + P8()).commit();
                    return;
                }
                return;
            }
            if (Ka()) {
                this.Q1.post(new y5());
                return;
            }
            if (this.I6) {
                if (e50.Q1 != null) {
                    C6(6, 0);
                    return;
                } else {
                    Hg();
                    return;
                }
            }
            if (this.z1 && q8() == 0) {
                this.Q1.post(new z5());
            } else {
                Hg();
            }
        }
    }

    private void x7() {
        e50.V5 = !e50.V5;
        StringBuilder sb = new StringBuilder();
        sb.append("\"");
        sb.append(getString(R.string.tilt_turn_page));
        sb.append("\" ");
        sb.append(getString(e50.V5 ? R.string.ok : R.string.cancel));
        o50.p2(this, sb.toString());
        com.flyersoft.components.n nVar = this.t8;
        if (nVar != null) {
            nVar.h = e50.V5;
        }
        Ed();
        za(true);
    }

    private long x8() {
        try {
            int q8 = q8();
            if (q8 == 1) {
                if (this.C9 != null) {
                    return r2.getScrollY();
                }
                if (e50.U5()) {
                    return (this.n5.length() * this.S1.getScrollY()) / this.Q1.getRealHeight();
                }
                return (e50.h2 * e50.Z7) + ((this.n5.length() * this.S1.getScrollY()) / this.Q1.getRealHeight());
            }
            if (q8 != 100) {
                return e50.f2;
            }
            if (this.C9 != null) {
                return f50.s(e50.g2) + this.C9.getScrollY();
            }
            if (f50.c(-1) > 0) {
                f50.e eVar = e50.Q1.h().get(e50.g2);
                int c8 = f50.c(e50.g2);
                int C = this.Q1.getLayout().C(this.S1.getScrollY());
                long length = this.Q1.getText().length();
                if (length == 0) {
                    length = 1;
                }
                long I = length - this.Q1.getLayout().I(C);
                if (!e50.U5()) {
                    if (e50.g2 == 0 && e50.h2 == 0 && e50.f2 == 0) {
                        return 0L;
                    }
                    length = 0;
                    long j8 = 0;
                    for (int i8 = 0; i8 < e50.G9.size(); i8++) {
                        length += e50.G9.get(i8).length();
                        if (i8 > e50.h2) {
                            j8 += e50.G9.get(i8).length();
                        }
                    }
                    I += j8;
                }
                long j9 = (r2 - c8) - ((eVar.q * I) / length);
                if (j9 > 0) {
                    return j9;
                }
                return 0L;
            }
            long j10 = e50.f2;
            if (!e50.U5()) {
                j10 = ((this.Q1.getText().length() * this.S1.getScrollY()) / this.Q1.getRealHeight()) + (e50.h2 * e50.Z7);
            } else if (e50.Q1.y() && this.Q1.getText().length() != 0) {
                j10 = (e50.Q1.h().get(e50.g2).h * j10) / this.Q1.getText().length();
            }
            return f50.s(e50.g2) + j10;
        } catch (Exception e8) {
            e50.S0(e8);
            return 0L;
        } catch (OutOfMemoryError e9) {
            e50.S0(e9);
            return 0L;
        }
    }

    public void x9(boolean toChapterBegin) {
        if (SystemClock.elapsedRealtime() - this.G4 > 2000) {
            a6();
            q5();
        }
        ph(this.Ha);
        this.Sa = false;
        if (toChapterBegin) {
            e50.f2 = 0L;
        }
        ec();
        this.z4 = true;
        oh();
        this.X2 = true;
        if (!e50.O9) {
            new l1(Looper.getMainLooper()).sendEmptyMessageDelayed(0, 0L);
        } else {
            y9();
        }
    }

    private void xa() {
        if (this.W5 == null) {
            this.W5 = VelocityTracker.obtain();
        }
    }

    private void xb() {
        if (A7()) {
            return;
        }
        int i8 = -this.r2.getHeight();
        TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f, (i8 - r2) - this.w8, this.v8);
        translateAnimation.setDuration(this.S3);
        this.r2.startAnimation(translateAnimation);
    }

    public void xc() {
        View view = this.u2;
        if (view != null) {
            view.setVisibility(8);
        }
    }

    private void xd(g50.h r7, long readTime, int readWords) {
        long j8;
        int i8;
        long j9;
        int i9;
        long X02 = o50.X0();
        long currentTimeMillis = System.currentTimeMillis() - o50.Z0();
        if (readTime > currentTimeMillis) {
            long j10 = readTime - currentTimeMillis;
            int i10 = (int) ((readWords * j10) / readTime);
            i8 = readWords - i10;
            i9 = i10;
            j8 = currentTimeMillis;
            j9 = j10;
        } else {
            j8 = readTime;
            i8 = readWords;
            j9 = 0;
            i9 = 0;
        }
        if (j9 > 0) {
            y4(r7, X02 - 1, j9, i9);
        }
        y4(r7, X02, j8, i8);
    }

    private void xe(boolean endWithTouch) {
        int C;
        int i8;
        int i9;
        long j8;
        if (Za()) {
            Vc(true);
            return;
        }
        View view = e50.y8;
        ScrollView2 scrollView2 = this.T1;
        if (view != scrollView2) {
            scrollView2 = this.S1;
        }
        MRTextView n9 = n9();
        float width = scrollView2.getWidth() / 2;
        float height = scrollView2.getHeight() / 2;
        MotionEvent motionEvent = this.q9;
        if (motionEvent != null) {
            try {
                width = motionEvent.getX();
                height = this.q9.getY();
            } catch (Exception e8) {
                e50.S0(e8);
                return;
            }
        }
        int scrollY = scrollView2.getScrollY();
        int paddingLeft = scrollView2.getPaddingLeft();
        int paddingTop = (((int) height) + scrollY) - scrollView2.getPaddingTop();
        float f8 = width - paddingLeft;
        com.flyersoft.staticlayout.l layout = n9.getLayout();
        if (layout != null && (C = layout.C(paddingTop)) <= T8() - 1) {
            int T = n9.T(C, f8);
            int i10 = -1;
            if (T == -1) {
                return;
            }
            int I = layout.I(C);
            int M = layout.M(C);
            if (T < I || T >= M || I == M) {
                return;
            }
            g50.f l32 = e50.l3(T);
            this.z9 = l32;
            if (l32 != null) {
                if (q8() == 0) {
                    long j9 = T;
                    j8 = j9 - (e50.d4(j9) - this.z9.f);
                } else {
                    j8 = this.z9.f;
                }
                int i11 = (int) j8;
                W9(true, i11, this.z9.g + i11);
                return;
            }
            if (!endWithTouch && e50.U6 && Character.getType(n9.getText().charAt(T)) == 5) {
                i9 = T - 1;
                i8 = T + 1;
                I = 0;
                this.B9 = i9 + 0 + 1;
            } else {
                String substring = n9.getText2().substring(I, M);
                int i12 = T - I;
                if (!endWithTouch) {
                    while (i12 > 0 && e50.J.indexOf(substring.charAt(i12)) != -1) {
                        i12--;
                    }
                }
                int length = substring.length();
                if (!endWithTouch) {
                    int i13 = i12 - 1;
                    while (true) {
                        if (i13 < 0) {
                            break;
                        }
                        if (fb(substring.charAt(i13))) {
                            i10 = i13;
                            break;
                        }
                        i13--;
                    }
                    this.B9 = i10 + I + 1;
                }
                i8 = i12 + 1;
                while (true) {
                    if (i8 >= substring.length()) {
                        i8 = length;
                        break;
                    } else if (fb(substring.charAt(i8))) {
                        break;
                    } else {
                        i8++;
                    }
                }
                i9 = i10;
            }
            this.A9 = true;
            if (endWithTouch) {
                W9(true, this.B9, i8 + I);
            } else {
                W9(true, i9 + I + 1, i8 + I);
            }
        }
    }

    private void xf() {
        new Timer().schedule(new z4(), 0L, 15L);
    }

    public void xh() {
        if (kg()) {
            try {
                if (!Ya() || bd()) {
                    this.I8.setText(o50.F2(false, e50.j7, e50.Z2()));
                    String str = this.cb;
                    if (str == null) {
                        String Y = o50.Y();
                        yh(Y);
                        if (Y == null) {
                            Dd();
                            return;
                        }
                        return;
                    }
                    yh(str);
                }
            } catch (Exception e8) {
                e50.S0(e8);
            }
        }
    }

    private void y4(g50.h r7, long dayNumber, long readTime, int readWords) {
        boolean z7;
        int indexOf = r7.d.indexOf(dayNumber + "\n");
        if (indexOf == -1) {
            indexOf = r7.d.indexOf(dayNumber + "|");
            z7 = false;
        } else {
            z7 = true;
        }
        if (indexOf == -1) {
            r7.d += dayNumber + "|" + readTime + "@" + readWords + "\n";
            return;
        }
        if (z7) {
            r7.d = r7.d.substring(0, indexOf) + dayNumber + "|" + readTime + "@" + readWords + r7.d.substring(r7.d.indexOf("\n", indexOf));
            return;
        }
        int indexOf2 = r7.d.indexOf("|", indexOf);
        int indexOf3 = r7.d.indexOf("@", indexOf);
        int indexOf4 = r7.d.indexOf("\n", indexOf);
        if (indexOf4 > indexOf2) {
            r7.d = r7.d.substring(0, indexOf) + dayNumber + "|" + (o50.z2(r7.d.substring(indexOf2 + 1, indexOf4)) + readTime) + "@" + ((indexOf3 > 0 ? o50.z2(r7.d.substring(indexOf3 + 1, indexOf4)) : 0) + readWords) + r7.d.substring(indexOf4);
        }
    }

    public void y5(e50.k bms, String bookmark) {
        e50.j jVar = new e50.j(e50.V1, bookmark, e50.g2, e50.h2, e50.f2, System.currentTimeMillis(), e50.I1());
        bms.b.add(jVar);
        g50.b(jVar);
        o50.s2(this, getString(R.string.add_bookmark), bookmark, 0);
    }

    public void y6(int resultId, boolean showDialogAndSaveLinkBack) {
        if (com.flyersoft.seekbooks.n.a == null) {
            return;
        }
        if (showDialogAndSaveLinkBack) {
            ArrayList<m7> arrayList = this.E6;
            if (arrayList != null) {
                arrayList.clear();
            }
            re(true);
        }
        J9();
        n.C0941n c0941n = com.flyersoft.seekbooks.n.a.get(resultId);
        this.h8 = c0941n;
        int i8 = e50.g2;
        int i9 = c0941n.d;
        boolean z7 = i8 == i9 && e50.h2 == c0941n.e;
        e50.g2 = i9;
        e50.h2 = c0941n.e;
        int y8 = y8(this.Q1, this.S1);
        int i10 = c0941n.b;
        int i11 = y8 / 4;
        if (i10 > i11) {
            i10 -= i11;
        } else if (i10 > 80) {
            i10 -= 80;
        }
        e50.f2 = i10;
        int q8 = q8();
        if (q8 == 0) {
            Jd();
            this.Q1.P0 = (int) e50.b4(c0941n.b, false);
            this.Q1.Q0 = (int) e50.b4(c0941n.c, false);
        } else if (q8 == 1 || q8 == 100) {
            if (z7) {
                MRTextView mRTextView = this.Q1;
                MRTextView mRTextView2 = this.R1;
                int i12 = c0941n.b;
                mRTextView2.P0 = i12;
                mRTextView.P0 = i12;
                int i13 = c0941n.c;
                mRTextView2.Q0 = i13;
                mRTextView.Q0 = i13;
                int I = mRTextView.getLayout().I(this.Q1.getLayout().C(this.S1.getScrollY()));
                int y7 = this.Q1.getLayout().y(e50.Q2(Xa() ? this.T1 : this.S1, -1));
                MRTextView mRTextView3 = this.Q1;
                if (mRTextView3.P0 >= I && mRTextView3.Q0 < y7) {
                    mRTextView3.postInvalidate();
                    this.R1.postInvalidate();
                } else {
                    lh(W8());
                }
            } else {
                if (showDialogAndSaveLinkBack) {
                    J5(Html.fromHtml(c0941n.a).toString());
                }
                this.g8 = true;
                Jd();
                MRTextView mRTextView4 = this.Q1;
                mRTextView4.P0 = c0941n.b;
                mRTextView4.Q0 = c0941n.c;
            }
        }
        Ih();
        if (com.flyersoft.seekbooks.n.a.size() > 1) {
            gg();
        }
    }

    public void y7(View v7) {
        z7(v7, true);
    }

    private int y8(MRTextView txtView, ScrollView txtScroll) {
        com.flyersoft.staticlayout.l layout = txtView.getLayout();
        return layout.M(e50.Q2(txtScroll, -1)) - layout.I(layout.C(txtScroll.getScrollY()));
    }

    public void y9() {
        oh();
        if (SystemClock.elapsedRealtime() - this.G4 > 2000 || this.Q1.D0) {
            K7();
        }
        if (this.Ta) {
            this.Ta = false;
            E9(E5(1, null));
        }
        if (this.G4 > 0) {
            o50.f2(this.U2);
            o50.f2(this.V2);
            o50.f2(this.W2);
        }
        this.G4 = 0L;
        this.z4 = false;
        this.X2 = false;
        Og(100, 0);
        Og(100, 100);
        u5();
        this.H1.sendEmptyMessageDelayed(w0, 100L);
    }

    private void ya() {
        e50.M1 = this.U1;
        e50.N1 = this.a2;
        e50.L1 = this.t2;
        e50.F1 = this.Q1;
        e50.I1 = this.S1;
        e50.G1 = this.R1;
        e50.J1 = this.T1;
        e50.K1 = this.La;
        e50.H1 = this.Ka;
    }

    private boolean yc() {
        View view = this.Q9;
        if (view == null || view.getVisibility() != 0) {
            return false;
        }
        this.Q9.setVisibility(8);
        if (!kg()) {
            return true;
        }
        this.C8.setVisibility(0);
        return true;
    }

    private void yd() {
        if (e50.O9 || e50.P9) {
            this.pb = 0L;
            return;
        }
        if (this.pb == 0) {
            this.pb = System.currentTimeMillis();
            return;
        }
        long currentTimeMillis = System.currentTimeMillis() - this.pb;
        this.pb = System.currentTimeMillis();
        if (currentTimeMillis > o50.N1(10L)) {
            this.C1 = System.currentTimeMillis() - o50.N1(1L);
        }
    }

    public void ye() {
        int i8;
        String str = e50.I9;
        if (str == null) {
            str = e50.b3;
        }
        if (str.equals("") || str.equals(e50.V0)) {
            i8 = 0;
        } else {
            i8 = 1;
            while (i8 < e50.K3().length && !e50.K3()[i8].toString().equals(str)) {
                i8++;
            }
        }
        new m.c(this).y(R.string.text_encoding).x(e50.K3(), i8, null).v(R.string.ok, new p5(i8)).o(R.string.cancel, null).C();
    }

    private void yf() {
        ValueAnimator ofInt = ValueAnimator.ofInt(this.c5, this.d5);
        ofInt.setDuration(this.e5);
        ValueAnimator.setFrameDelay(15L);
        ofInt.setInterpolator(new DecelerateInterpolator());
        ofInt.addUpdateListener(new x4());
        ofInt.addListener(new y4());
        ofInt.start();
    }

    public static void yg(String s7) {
        if (o50.D1(a)) {
            return;
        }
        Handler handler = a.H1;
        handler.sendMessage(handler.obtainMessage(y0, s7));
    }

    private void yh(String battery1) {
        if (battery1 != null && battery1.length() > 0) {
            this.H8.setVisibility(0);
            this.H8.setText(battery1.trim());
        } else if (this.H8.getVisibility() == 0) {
            this.H8.setVisibility(8);
        }
    }

    private void z4(final String filename) {
        v vVar = new v(filename);
        vVar.setPriority(1);
        vVar.start();
    }

    private void z6() {
        pe(true);
        d8();
        if (e50.A2) {
            j1 = true;
        }
        ee();
    }

    private int z8() {
        com.flyersoft.staticlayout.l layout = this.Q1.getLayout();
        if (layout == null || layout.v() == 0) {
            return 0;
        }
        int I = layout.I(layout.C(this.S1.getScrollY()));
        int Q2 = e50.Q2(Xa() ? this.T1 : this.S1, -1);
        if (Q2 > this.Q1.getRealLineCount() - 1) {
            Q2 = this.Q1.getRealLineCount() - 1;
        }
        return o50.l1(this.Q1.getText().subSequence(I, layout.M(Q2)).toString(), e50.H8);
    }

    private void z9() {
        a6();
        q5();
        e50.G9 = this.Ya;
        this.n5 = this.Za;
        ph(this.Xa);
        this.X2 = true;
        new m1(Looper.getMainLooper()).sendEmptyMessage(0);
    }

    private void zc(int x12, int y12, int x22, int y22) {
        try {
            if (Global.m == 3) {
                int i8 = this.F2.b.viewGetPos().b;
                x12 += i8;
                x22 += i8;
            }
            this.F2.b.viewSetSel(x12, y12, x22, y22);
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    public void zd() {
        e50.Y6();
        o5();
    }

    public void ze(float y7) {
        if (SystemClock.elapsedRealtime() - this.L5 < 100) {
            return;
        }
        this.L5 = SystemClock.elapsedRealtime();
        int lineHeight = this.Q1.getLineHeight();
        if (e50.r3() - y7 < lineHeight * 1.5d) {
            if (!vb() && this.Q1.getHeight() - this.S1.getScrollY() > lineHeight) {
                nh(this.S1.getScrollY() + lineHeight);
                cg(0);
                if (!this.A9) {
                    View view = this.l9;
                    DotImageView dotImageView = this.j9;
                    if (view == dotImageView) {
                        dotImageView = this.k9;
                    }
                    dotImageView.layout(dotImageView.getLeft(), dotImageView.getTop() - lineHeight, dotImageView.getRight(), dotImageView.getBottom() - lineHeight);
                }
                Td();
                return;
            }
            return;
        }
        if (y7 >= lineHeight || this.S1.getScrollY() <= lineHeight) {
            return;
        }
        nh(this.S1.getScrollY() - lineHeight);
        cg(0);
        if (!this.A9) {
            View view2 = this.l9;
            DotImageView dotImageView2 = this.j9;
            if (view2 == dotImageView2) {
                dotImageView2 = this.k9;
            }
            dotImageView2.layout(dotImageView2.getLeft(), dotImageView2.getTop() + lineHeight, dotImageView2.getRight(), dotImageView2.getBottom() + lineHeight);
        }
        Td();
    }

    public void zg() {
        new m.c(this).z(getString(R.string.tts_filter)).B(N5()).v(android.R.string.ok, new u2()).o(android.R.string.cancel, new j2()).t(new y1()).C();
    }

    public void zh() {
        if (e50.z5 < 0) {
            e50.z5 = 0;
        }
        if (e50.z5 > 100) {
            e50.z5 = 100;
        }
        if (e50.z5 == 0) {
            e50.y5 = false;
        }
        jg();
        SeekBar seekBar = this.B3;
        if (seekBar != null) {
            seekBar.setProgress(e50.z5);
            this.t4.setChecked(e50.y5);
        }
        o50.r2(this, e50.z5 + "%", 0, 17);
    }

    double A8(float x12, float y12, float x22, float y22) {
        float f8 = x12 - x22;
        float f9 = y12 - y22;
        return Math.sqrt((f8 * f8) + (f9 * f9));
    }

    public void Ad() {
        if (this.qb == null) {
            this.qb = new v1(Looper.getMainLooper());
        }
        this.qb.removeMessages(0);
        this.qb.sendEmptyMessageDelayed(0, 250L);
    }

    void Af(int type) {
        View view;
        this.d3 = this.c3;
        this.c3 = type;
        va(false);
        this.y2.findViewById(R.id.shuping_lay).setVisibility(this.Tb ? 0 : 8);
        Hf();
        this.g3 = null;
        this.f3 = null;
        if (type == -1) {
            Dg();
            this.y2.setVisibility(8);
            if (this.g4) {
                a5();
                return;
            }
            return;
        }
        if (type > 0 && this.y2.getVisibility() == 0) {
            for (int i8 = 0; i8 < this.y2.getChildCount(); i8++) {
                if (this.y2.getChildAt(i8) != this.M3 && this.y2.getChildAt(i8).getVisibility() == 0) {
                    this.f3 = this.y2.getChildAt(i8);
                }
            }
        }
        if (type == 1) {
            oa();
        }
        if (type == 2) {
            ga();
        }
        if (type == 4) {
            ia();
        }
        if (type == 5) {
            ta();
        }
        if (type == 6) {
            ra();
        }
        if (type == 2 && this.A2 == null && e50.A5 != -100) {
            o50.r2(this, e50.A5 + "%", 0, 17);
        }
        this.x2.setVisibility(type == 0 ? 0 : 8);
        this.E2.setVisibility(type == 3 ? 0 : 8);
        View view2 = this.z2;
        if (view2 != null) {
            view2.setVisibility(type == 1 ? 0 : 8);
        }
        View view3 = this.A2;
        if (view3 != null) {
            view3.setVisibility(type == 2 ? 0 : 8);
        }
        View view4 = this.B2;
        if (view4 != null) {
            view4.setVisibility(type == 4 ? 0 : 8);
        }
        View view5 = this.C2;
        if (view5 != null) {
            view5.setVisibility(type == 5 ? 0 : 8);
        }
        View view6 = this.D2;
        if (view6 != null) {
            view6.setVisibility(type == 6 ? 0 : 8);
        }
        this.y2.setVisibility(0);
        this.L3.setVisibility((type != 0 || this.r2.getVisibility() == 8) ? 8 : 0);
        this.P3.setVisibility(lg() ? 0 : 8);
        this.Q3.setVisibility(g50.F(e50.V1) == null ? 0 : 8);
        for (int i9 = 0; i9 < this.y2.getChildCount(); i9++) {
            if (this.y2.getChildAt(i9) != this.M3 && this.y2.getChildAt(i9).getVisibility() == 0) {
                this.g3 = this.y2.getChildAt(i9);
            }
        }
        View view7 = this.f3;
        if (view7 != null && (view = this.g3) != null) {
            if (view7 != view) {
                view7.setVisibility(0);
                this.g3.setVisibility(8);
            }
            Dg();
            return;
        }
        Cg();
    }

    public boolean B7() {
        DotImageView dotImageView = this.j9;
        return dotImageView != null && dotImageView.getVisibility() == 0;
    }

    protected void Bb() {
        new j7().start();
    }

    protected void Bd(int book_left, boolean refreshTotalOnly) {
        int i8;
        int i9;
        String str;
        String format;
        f50 f50Var;
        if (eg()) {
            if (refreshTotalOnly) {
                this.J8.setText(P8());
                return;
            }
            if (book_left == -1 && e50.Q1 != null) {
                this.J8.setText("");
            }
            try {
                int s8 = s8();
                if (s8 == -1 && book_left == -1) {
                    return;
                }
                int S8 = S8();
                if (book_left != -1) {
                    if (s8 != -1) {
                        book_left += s8;
                    }
                    int i10 = book_left / S8;
                    i9 = i10 / 60;
                    i8 = i10 % 60;
                } else {
                    i8 = 0;
                    i9 = 0;
                }
                if (s8 != -1 && q8() == 100 && (f50Var = e50.Q1) != null && f50Var.h().size() == 1) {
                    s8 = -1;
                }
                int i11 = s8 != -1 ? s8 / S8 : 0;
                if (this.G8.getVisibility() == 0) {
                    TextView textView = this.L8;
                    StringBuilder sb = new StringBuilder();
                    sb.append(String.format(getString(R.string.remaining_time_chapter) + "", Integer.valueOf(i11)));
                    sb.append((String) this.L8.getTag());
                    textView.setText(sb.toString());
                    TextView textView2 = this.M8;
                    StringBuilder sb2 = new StringBuilder();
                    sb2.append(book_left == -1 ? "..." : String.format(getString(R.string.remaining_time_book), Integer.valueOf(i9), Integer.valueOf(i8)));
                    sb2.append((String) this.M8.getTag());
                    textView2.setText(sb2.toString());
                    this.K8.setText("");
                    return;
                }
                if (e50.l5) {
                    if (book_left == -1) {
                        format = String.format(getString(R.string.remaining_time_chapter) + "", Integer.valueOf(i11));
                    } else if (s8 == -1) {
                        format = String.format(getString(R.string.remaining_time_book), Integer.valueOf(i9), Integer.valueOf(i8));
                    } else {
                        format = String.format(getString(R.string.remaining_time_format), Integer.valueOf(i11), Integer.valueOf(i9), Integer.valueOf(i8));
                    }
                    String str2 = format + ((String) this.K8.getTag());
                    if (Layout.getDesiredWidth(str2, this.K8.getPaint()) < this.K8.getWidth() - e50.k0(4.0f)) {
                        this.K8.setText(str2);
                        return;
                    } else {
                        this.K8.setText(format);
                        return;
                    }
                }
                if (s8 != -1) {
                    str = String.format(getString(R.string.remaining_time_chapter) + "", Integer.valueOf(i11));
                } else {
                    str = "";
                }
                String format2 = book_left != -1 ? String.format(getString(R.string.remaining_time_book), Integer.valueOf(i9), Integer.valueOf(i8)) : "";
                this.N8.setText(str);
                this.O8.setText(format2);
            } catch (Exception e8) {
                e50.S0(e8);
            } catch (OutOfMemoryError e9) {
                e50.S0(e9);
            }
        }
    }

    public void Bg() {
        if (!this.u9) {
            this.u9 = true;
            if (this.h9.getWidth() < ((this.h9.getPaint().measureText(this.h9.getText().toString()) + this.h9.getPaddingLeft()) + this.h9.getPaddingRight()) - e50.k0(1.0f)) {
                if (this.w9 == -1.0f) {
                    this.w9 = this.h9.getTextSize() / e50.g2();
                }
                float f8 = this.w9 - 1.0f;
                this.d9.setTextSize(f8);
                this.e9.setTextSize(f8);
                this.f9.setTextSize(f8);
                this.g9.setTextSize(f8);
                this.h9.setTextSize(f8);
                new n(Looper.getMainLooper()).sendEmptyMessage(0);
            } else {
                Se(true);
            }
        } else {
            Se(true);
        }
        if (e50.C3) {
            this.i9.postInvalidate();
        }
    }

    void Cf(CharSequence[] items, int[] res, int level) {
        this.E2.setAdapter((ListAdapter) new l7(items, res, level));
        if (level == 100) {
            this.L2 = true;
            this.y2.bringToFront();
            this.Z1.bringToFront();
        }
        Af(3);
    }

    public int D4() {
        if (e50.y8 == this.T1) {
            return this.S1.getWidth() + this.t2.getPaddingLeft();
        }
        if (F7()) {
            return this.t2.getPaddingLeft();
        }
        return 0;
    }

    public void Dd() {
        if (isFinishing()) {
            return;
        }
        this.cb = "";
        this.db = new o1();
        registerReceiver(this.db, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
    }

    public void De() {
        if (!e50.D2) {
            if (this.b2.getVisibility() != 8) {
                this.b2.setVisibility(8);
                return;
            }
            return;
        }
        int C8 = C8();
        if (this.G9 != C8) {
            this.G9 = C8;
            if (C8 == -1) {
                this.b2.setBackgroundDrawable(null);
            } else {
                this.b2.setBackgroundResource(C8);
            }
            if (this.b2.getVisibility() != 0) {
                this.b2.setVisibility(0);
            }
        }
    }

    public void Ee() {
        if (this.r2 == null) {
            return;
        }
        this.C3.setVisibility(8);
        this.D3.setVisibility(8);
        this.E3.setVisibility(8);
        this.F3.setVisibility(8);
        this.G3.setVisibility(8);
        this.H3.setVisibility(8);
        this.I3.setVisibility(8);
        this.J3.setVisibility(8);
        Iterator<com.flyersoft.components.DragSort.b> it = ReaderBar.e().iterator();
        int i8 = 0;
        while (it.hasNext()) {
            com.flyersoft.components.DragSort.b next = it.next();
            if (next.b) {
                int i9 = i8 + 1;
                switch (i8) {
                    case 0:
                        this.C3.setVisibility(0);
                        this.C3.setTag(Integer.valueOf(next.a));
                        this.C3.setImageResource(ReaderBar.a(next.a));
                        break;
                    case 1:
                        this.D3.setVisibility(0);
                        this.D3.setTag(Integer.valueOf(next.a));
                        this.D3.setImageResource(ReaderBar.a(next.a));
                        break;
                    case 2:
                        this.E3.setVisibility(0);
                        this.E3.setTag(Integer.valueOf(next.a));
                        this.E3.setImageResource(ReaderBar.a(next.a));
                        break;
                    case 3:
                        this.F3.setVisibility(0);
                        this.F3.setTag(Integer.valueOf(next.a));
                        this.F3.setImageResource(ReaderBar.a(next.a));
                        break;
                    case 4:
                        this.G3.setVisibility(0);
                        this.G3.setTag(Integer.valueOf(next.a));
                        this.G3.setImageResource(ReaderBar.a(next.a));
                        break;
                    case 5:
                        this.H3.setVisibility(0);
                        this.H3.setTag(Integer.valueOf(next.a));
                        this.H3.setImageResource(ReaderBar.a(next.a));
                        break;
                    case 6:
                        this.I3.setVisibility(0);
                        this.I3.setTag(Integer.valueOf(next.a));
                        this.I3.setImageResource(ReaderBar.a(next.a));
                        break;
                    case 7:
                        this.J3.setVisibility(0);
                        this.J3.setTag(Integer.valueOf(next.a));
                        this.J3.setImageResource(ReaderBar.a(next.a));
                        break;
                }
                i8 = i9;
            }
        }
    }

    public void Eh(int topOff) {
        int height = this.c9.getHeight() - this.m9.getHeight();
        if (height > e50.k0(70.0f)) {
            height -= e50.k0(70.0f);
        }
        if (e50.C3) {
            HighlightLay highlightLay = this.c9;
            highlightLay.layout(highlightLay.getLeft(), this.c9.getTop() + topOff, this.c9.getRight(), this.c9.getTop() + this.m9.getHeight() + e50.k0(70.0f) + height + topOff);
        } else {
            HighlightLay highlightLay2 = this.c9;
            highlightLay2.layout(highlightLay2.getLeft(), this.c9.getTop() + topOff, this.c9.getRight(), this.c9.getTop() + this.m9.getHeight() + height + topOff);
        }
        this.c9.requestLayout();
    }

    public boolean F7() {
        return e50.O0() && this.C9 == null && !Ya();
    }

    public boolean Fa() {
        return this.n9.getTag() != null && ((Integer) this.n9.getTag()).intValue() == 1;
    }

    protected void Fc(String filename) {
        if (Global.r(this)) {
            this.pa = Global.a(this, e50.V1);
            Gc(filename);
        } else {
            createProgressDlg("", getString(R.string.pdf_init));
            new t0().start();
        }
    }

    protected void Fe() {
        if (this.A3 != null) {
            int i8 = e50.A5;
            if (i8 < -50) {
                i8 = i9();
            }
            this.A3.setProgress(i8 + 50);
            this.s4.setChecked(e50.A5 == -100);
        }
    }

    void Fg() {
        int d9 = d9(this.O7);
        if (d9 != -1) {
            this.R6 = d9 - 1;
        }
        he();
    }

    protected void G4(int dir) {
        try {
            e50.K6();
            this.H1.removeMessages(D0);
            this.H1.sendEmptyMessageDelayed(D0, 200);
            if (!((dir == 0 && e50.c4 == 0) || (dir == 1 && e50.d4 == 0)) || e50.Q1 == null || this.Cb >= 2) {
                return;
            }
            boolean z7 = false;
            int C = this.Q1.getLayout().C(this.S1.getScrollY());
            if (this.Q1.K(C).a <= 0.0f) {
                if (this.Q1.K(C).c <= 0.0f) {
                    int C2 = this.Q1.getLayout().C(this.S1.getScrollY() + (e50.h3() / 2));
                    if (C2 != C) {
                        if (this.Q1.K(C2).a <= 0.0f) {
                        }
                    }
                    if (z7) {
                        return;
                    }
                    this.Cb++;
                    o50.o2(this, getString(R.string.statubar_margin), Html.fromHtml(getString(R.string.css_margin_tip) + "<br><br>\"<b>设置 -> 排版 -> 精排版书籍选项</b>\" -> \"<b>" + getString(R.string.disable_css) + "</b>\" -> \"<b>" + e50.G3(R.array.disable_css_styles, 6) + "</b>\""));
                    return;
                }
            }
            z7 = true;
            if (z7) {
            }
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    public void Gd() {
        if (e50.o4 != 15 || e50.V5) {
            if (this.u8 == null) {
                this.u8 = (SensorManager) getSystemService("sensor");
            }
            this.u8.registerListener(Z8(), this.u8.getDefaultSensor(1), 3);
        }
    }

    void H4() {
        if (e50.ta) {
            e50.ta = false;
            int M3 = e50.M3(e50.Z8);
            int Y1 = e50.Y1();
            int M32 = e50.M3(e50.b9);
            if (e50.M2) {
                if (Y1 != M3) {
                    if (Y1 != M3) {
                        e50.w6(e50.b9, true);
                    }
                    e50.F6 = e50.A5;
                    if (e50.J6) {
                        int i8 = e50.I6;
                        e50.A5 = i8;
                        Ze(i8, false);
                    }
                    Cb(e50.Z8, e50.B6);
                    this.C6 = true;
                    return;
                }
                return;
            }
            if (Y1 == M3) {
                if (M32 != -1 && M32 != M3) {
                    Cb(e50.b9, e50.B6);
                } else {
                    Cb("2", e50.B6);
                }
                if (e50.A5 != -100 && (e50.F6 == -100 || e50.A5 < e50.F6)) {
                    Ze(e50.F6, false);
                }
                this.C6 = true;
            }
        }
    }

    void H6(int id) {
        if (id == 1) {
            j6(e50.p4);
            return;
        }
        if (id == 2) {
            j6(e50.q4);
        } else if (id == 3) {
            j6(e50.t4);
        } else {
            if (id != 4) {
                return;
            }
            j6(e50.u4);
        }
    }

    public void If() {
    }

    public int J8() {
        if (this.b9 == 0) {
            String q12 = o50.q1(this.P2);
            this.b9 = q12.length();
            this.a9 = o50.l1(q12, e50.H8);
        }
        return this.b9;
    }

    protected boolean Ja() {
        f50 f50Var = e50.Q1;
        if (f50Var == null || !f50Var.x()) {
            return false;
        }
        hideProgressDlg();
        new m.c(this).z(getString(R.string.error)).B(LayoutInflater.from(this).inflate(R.layout.drm, (ViewGroup) null)).v(R.string.ok, new n6()).C();
        return true;
    }

    public int K8() {
        if (this.a9 == 0) {
            String q12 = o50.q1(this.P2);
            this.b9 = q12.length();
            this.a9 = o50.l1(q12, e50.H8);
        }
        return this.a9;
    }

    public void K9() {
        ImageView imageView = this.c2;
        if (imageView == null || imageView.getVisibility() != 0) {
            return;
        }
        this.c2.setVisibility(4);
    }

    Handler L8() {
        if (this.ob == null) {
            this.ob = new t1(Looper.getMainLooper());
        }
        this.ob.removeMessages(0);
        return this.ob;
    }

    public void Lc() {
        if (!Ya() || this.F2 == null || this.ma == null) {
            return;
        }
        za(true);
        try {
            this.F2.set_thumb(null);
            this.ma.setVisibility(8);
            if (((Integer) this.ma.getTag()).intValue() == Global.m) {
                this.ma.a();
            }
            this.na.removeView(this.ma);
        } catch (Exception e8) {
            e50.S0(e8);
        }
        this.ma = null;
    }

    protected void Lf() {
        int i8 = 0;
        SharedPreferences sharedPreferences = getSharedPreferences(e50.w0, 0);
        String[] strArr = new String[sharedPreferences.getAll().size()];
        Iterator<String> it = sharedPreferences.getAll().keySet().iterator();
        while (it.hasNext()) {
            strArr[i8] = it.next();
            i8++;
        }
        new m.c(this).y(R.string.dict_history).i(strArr, new t(strArr)).v(R.string.clear_dict_history, new s()).o(R.string.cancel, null).C();
    }

    void M4(final boolean forceTestUpdate, final boolean collectTagsOnly) {
        if (this.Tb && !AutoCollect.alreadyCollectedRecently(p8(), k8())) {
            com.flyersoft.discuss.z.getBookMeta(p8(), k8(), new b4(forceTestUpdate, collectTagsOnly));
        }
    }

    void Mg(int value) {
        int abs = Math.abs(value);
        if (abs < e50.K0(1.0f)) {
            if (this.a5) {
                e50.N5("---------------onAnimationEnd(2)-----------------");
                this.X4 = true;
                I6();
                return;
            }
            abs = 0;
        }
        int width = this.U1.getWidth();
        long j8 = 600 - (e50.j4 * 10);
        if (abs != 0) {
            j8 = (j8 * (this.X4 ? abs : width - abs)) / width;
        }
        if (j8 < 100) {
            j8 = 100;
        }
        if (this.j5 > 0) {
            e50.N5("===========valueAnimation already start=========");
            return;
        }
        this.H1.removeMessages(a1);
        wd();
        this.b5 = 0;
        this.j5 = SystemClock.elapsedRealtime();
        this.c5 = abs;
        if (this.X4) {
            width = 0;
        }
        this.d5 = width;
        this.e5 = j8;
        ScrollView2 scrollView2 = this.La;
        scrollView2.g = true;
        scrollView2.a0 = 0;
        if (this.f5) {
            yf();
        } else {
            xf();
        }
    }

    public void Mh(boolean showTip) {
        if (isFinishing() || !nb()) {
            return;
        }
        String webBookMeta = WB.getWebBookMeta(e50.V1, e50.Q1.p.siteTag, 0);
        if (!o50.F1(webBookMeta)) {
            c9(e50.Q1.p.siteTag, webBookMeta, true, true, showTip, null);
        }
        if (showTip) {
            o50.q2(this, e50.W0("提示: 可在设置里启用自动检查新章节功能"), 1);
        }
        e50.D(e50.V1);
    }

    public void N7(int delay) {
        e50.M1.setBackgroundDrawable(null);
        if (delay == 0) {
            e50.D6(e50.M1);
        } else {
            new u1(Looper.getMainLooper()).sendEmptyMessageDelayed(delay, delay);
        }
    }

    public void Nh(boolean showToast) {
        MRBookView mRBookView = this.C9;
        if (mRBookView == null) {
            return;
        }
        if (e50.k2 < 1) {
            e50.k2 = 1;
        }
        if (e50.k2 > 72) {
            e50.k2 = 72;
        }
        mRBookView.getSettings().setDefaultFontSize(e50.k2);
        if (showToast) {
            o50.r2(this, "网页字号调整: " + e50.k2, 0, 17);
        }
        e50.N5("------new defaultFontSize:" + e50.k2);
    }

    public Bitmap O8(boolean hideStatusBar, boolean highQuality) {
        NewCurl3D newCurl3D;
        Bitmap bitmap = null;
        try {
            if ((this.i2.getVisibility() == 0 || ((newCurl3D = this.R2) != null && newCurl3D.getVisibility() == 0)) && this.Q1.getHeight() < e50.h3() && this.F2 == null && !e50.O0()) {
                this.Q1.setForceHeight(e50.h3());
            }
            bitmap = Bitmap.createBitmap(this.U1.getWidth(), this.U1.getHeight(), highQuality ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565);
            Canvas canvas = new Canvas(bitmap);
            e50.C6(canvas);
            if (this.b2.getVisibility() == 0) {
                this.b2.draw(canvas);
            }
            this.a2.draw(canvas);
        } catch (OutOfMemoryError e8) {
            e50.S0(e8);
        }
        return bitmap;
    }

    public void Oe() {
        if (this.Q1.getSpanned() != null && ((com.flyersoft.staticlayout.i[]) this.Q1.getSpanned().getSpans(0, this.Q1.getText().length(), com.flyersoft.staticlayout.i.class)).length > 0) {
            Ad();
        } else {
            this.H1.removeMessages(C0);
            this.H1.sendEmptyMessageDelayed(C0, 200);
        }
    }

    protected void Of(int lastChapter, int lastSplitIndex, long lastPosition, boolean reLoad) {
        int i8;
        try {
        } finally {
            try {
            } finally {
            }
        }
        if (e50.Q1.h().size() != 0) {
            this.z4 = true;
            ec();
            if (this.l5) {
                this.l5 = false;
                this.k5 = false;
                lastPosition = 0;
            }
            if (lastChapter < 0) {
                lastChapter = 0;
            }
            if (lastChapter > e50.Q1.h().size() - 1) {
                lastChapter = e50.Q1.h().size() - 1;
            }
            e50.g2 = lastChapter;
            e50.h2 = lastSplitIndex;
            e50.f2 = lastPosition;
            e50.Q1.h().get(e50.g2);
            int length = e50.Q1.g(e50.g2).length();
            if (e50.f2 > length && length > (i8 = e50.Z7)) {
                e50.h2 = length / i8;
            }
            if (this.B6) {
                wg();
                og();
            } else {
                if (reLoad) {
                    if (e50.Q1.y() && e50.g7) {
                        c8(0);
                        Tf(this.n5);
                    } else if (!G9(false, null)) {
                        q5();
                        c8(0);
                    }
                }
                if (!Va(e50.g2, this.Q1.getText2(), true)) {
                    if (this.k5) {
                        this.k5 = false;
                        a6();
                        this.F4.sendEmptyMessageDelayed(1, 50L);
                    } else {
                        B9();
                    }
                }
            }
        }
    }

    boolean Pd() {
        return System.currentTimeMillis() - this.A8 < o50.N1(10L);
    }

    void Q4() {
        if (com.flyersoft.baseapplication.z2.storeLevel <= 2 && S.store != null && nb() && e50.Q1.p != S.store && e50.o5()) {
            if ((!o50.A1(h9()) || (o50.F1(o50.p0(h9())) && System.currentTimeMillis() - o50.t0(h9()) >= o50.B(10L))) && !e50.V1.equals(this.Mb)) {
                this.Mb = e50.V1;
                S.StoreSite storeSite = S.store;
                String encode = S.encode(e50.Q1.d(), storeSite.keyEncode);
                String replace = storeSite.searchUrl.replace("%s", encode);
                String replace2 = !o50.F1(storeSite.postParams) ? storeSite.postParams.replace("%s", encode) : null;
                DownloadTask.Result result = new DownloadTask.Result();
                result.callback = new v3();
                DownloadTaskBrowser.CacheWebView cacheWebView = this.Nb;
                if (cacheWebView == null || cacheWebView.destroyed) {
                    this.Nb = DownloadTaskBrowser.createDownloadWebView();
                }
                DownloadTaskBrowser.CacheWebView cacheWebView2 = this.Nb;
                cacheWebView2.delayed = storeSite.searchDelay;
                cacheWebView2.stop = false;
                DownloadTask.download(cacheWebView2, result, true, 0L, replace, replace2, storeSite.searchAgent);
            }
        }
    }

    protected void Qc(int pageno, String original, String noteText, int type) {
        int i8;
        String D1 = e50.D1();
        String str = e50.V1;
        int i9 = Page.a;
        int i10 = Page.b;
        long j8 = pageno;
        int i11 = i10 - Page.a;
        if (type == 0) {
            i8 = e50.m3;
        } else {
            i8 = type == 1 ? e50.n3 : type == 2 ? e50.p3 : e50.o3;
        }
        e50.r(new g50.f(0, D1, str, i9, i10, j8, i11, i8, System.currentTimeMillis(), "", noteText, original, type == 1, type == 2, type == 3 ? "1" : ""));
    }

    protected void Qf() {
        dh();
    }

    boolean R5() {
        return (this.Ra || o50.I1(this.Ma)) ? false : true;
    }

    protected void Rb(String url, String s7) {
        String str = url;
        Xc(true);
        int i8 = 80;
        if (str.equals("Lingvo")) {
            try {
                T7();
                Intent intent = new Intent("com.abbyy.mobile.lingvo.intent.action.TRANSLATE");
                intent.putExtra("com.abbyy.mobile.lingvo.intent.extra.TEXT", s7);
                if (this.y9 != -1) {
                    int lineHeight = e50.g5() ? 5 - this.Q1.getLineHeight() : 5;
                    if (this.y9 > getResources().getDisplayMetrics().heightPixels / 2) {
                        intent.putExtra("com.abbyy.mobile.lingvo.intent.extra.HEIGHT", (this.y9 - this.Q1.getLineHeight()) - lineHeight);
                        intent.putExtra("com.abbyy.mobile.lingvo.intent.extra.EXTRA_GRAVITY", 48);
                    } else {
                        intent.putExtra("com.abbyy.mobile.lingvo.intent.extra.HEIGHT", ((getResources().getDisplayMetrics().heightPixels - this.y9) - this.Q1.getLineHeight()) - lineHeight);
                        intent.putExtra("com.abbyy.mobile.lingvo.intent.extra.EXTRA_GRAVITY", 80);
                    }
                }
                intent.putExtra("com.abbyy.mobile.lingvo.intent.extra.MARGIN_LEFT", 4);
                intent.putExtra("com.abbyy.mobile.lingvo.intent.extra.MARGIN_RIGHT", 4);
                intent.putExtra("com.abbyy.mobile.lingvo.intent.extra.MARGIN_TOP", 4);
                intent.putExtra("com.abbyy.mobile.lingvo.intent.extra.MARGIN_BOTTOM", 4);
                startActivity(intent);
            } catch (Exception unused) {
                o50.W1(this, "com.abbyy.mobile.lingvo.market");
            }
        }
        if (str.equals("FreeDictionary")) {
            try {
                Intent intent2 = new Intent("android.intent.action.VIEW");
                intent2.setClassName("org.freedictionary", "org.freedictionary.MainActivity");
                intent2.setData(Uri.parse(s7));
                startActivity(intent2);
                return;
            } catch (Exception unused2) {
                o50.W1(this, "org.freedictionary");
                return;
            }
        }
        if (str.equals("Leo")) {
            try {
                Intent intent3 = new Intent("android.intent.action.VIEW");
                intent3.setClassName("org.leo.android.dict", "org.leo.android.dict.LeoDict");
                intent3.setData(Uri.parse(s7));
                startActivity(intent3);
                return;
            } catch (Exception unused3) {
                o50.W1(this, "org.leo.android.dict");
                return;
            }
        }
        if (str.equals("YunCi")) {
            try {
                Intent intent4 = new Intent("android.intent.action.VIEW");
                intent4.setAction("com.yunci.search");
                intent4.putExtra("EXTRA_QUERY", s7);
                if (this.y9 >= getResources().getDisplayMetrics().heightPixels / 2) {
                    i8 = 48;
                }
                intent4.putExtra("EXTRA_GRAVITY", i8);
                startActivity(intent4);
                return;
            } catch (Exception unused4) {
                o50.b2(this, "http://www.yunci4.com/");
                return;
            }
        }
        if (str.equals("ColorDict3")) {
            try {
                T7();
                Intent intent5 = new Intent("colordict.intent.action.SEARCH");
                intent5.putExtra("EXTRA_QUERY", s7);
                if (this.y9 != -1) {
                    int lineHeight2 = e50.g5() ? 5 - this.Q1.getLineHeight() : 5;
                    if (this.y9 > getResources().getDisplayMetrics().heightPixels / 2) {
                        intent5.putExtra("EXTRA_HEIGHT", (this.y9 - this.Q1.getLineHeight()) - lineHeight2);
                        intent5.putExtra("EXTRA_GRAVITY", 48);
                    } else {
                        intent5.putExtra("EXTRA_HEIGHT", ((getResources().getDisplayMetrics().heightPixels - this.y9) - this.Q1.getLineHeight()) - lineHeight2);
                        intent5.putExtra("EXTRA_GRAVITY", 80);
                    }
                }
                intent5.putExtra("EXTRA_MARGIN_LEFT", 4);
                intent5.putExtra("EXTRA_MARGIN_RIGHT", 4);
                intent5.putExtra("EXTRA_MARGIN_TOP", 4);
                intent5.putExtra("EXTRA_MARGIN_BOTTOM", 4);
                startActivity(intent5);
                return;
            } catch (Exception unused5) {
                if (e50.g5()) {
                    new m.c(this).m(Html.fromHtml(e50.W0("是否安装这个离线词典? <br><br>安装完成后请自行在词典应用里<b>设置允许横屏显示词典.</b>"))).v(R.string.ok, new u()).o(R.string.cancel, null).C();
                    return;
                } else {
                    Ub("com.eusoft.eudic");
                    return;
                }
            }
        }
        if (str.equals("ColorDict")) {
            try {
                Intent intent6 = new Intent("android.intent.action.VIEW");
                intent6.setClassName("com.socialnmobile.colordict", "com.socialnmobile.colordict.activity.Main");
                intent6.setData(Uri.parse(s7));
                startActivity(intent6);
                return;
            } catch (Exception unused6) {
                Ub("com.socialnmobile.colordict");
                return;
            }
        }
        if (str.equals("Fora")) {
            try {
                Intent intent7 = new Intent("android.intent.action.VIEW");
                intent7.setAction("com.ngc.fora.action.LOOKUP");
                intent7.putExtra("HEADWORD", s7);
                startActivity(intent7);
                return;
            } catch (Exception unused7) {
                Ub("com.ngc.fora");
                return;
            }
        }
        if (str.equals("youdao")) {
            try {
                Intent intent8 = new Intent("android.intent.action.PROCESS_TEXT");
                intent8.setComponent(new ComponentName("com.youdao.dict", "com.youdao.dict.activity.ProcessTextActivity"));
                intent8.putExtra("android.intent.extra.PROCESS_TEXT", s7);
                startActivity(intent8);
                return;
            } catch (Exception unused8) {
                Ub("com.youdao.dict");
                return;
            }
        }
        if (str.equals("XinHua")) {
            try {
                Intent intent9 = new Intent();
                intent9.setClassName("hugh.android.app.zidian", "hugh.android.app.zidian.ZiDian");
                intent9.putExtra("zi", s7);
                startActivity(intent9);
                return;
            } catch (Exception unused9) {
                Ub("hugh.android.app.zidian");
                return;
            }
        }
        if (str.equals("Google")) {
            str = e50.E;
        }
        if (str.equals("Customized")) {
            str = e50.j6;
        }
        if (str.equals(e50.F) && T4(s7)) {
            return;
        }
        try {
            startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str.replace("%s", Uri.encode(s7)).replace("<SL>", e50.h6).replace("<TL>", e50.i6))));
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    protected boolean S9() {
        FlipImageView flipImageView = this.i2;
        if (!flipImageView.q0) {
            return false;
        }
        flipImageView.q0 = false;
        if (K4()) {
            if (!this.M1) {
                this.M1 = true;
                this.i2.q0 = true;
                this.H1.sendEmptyMessageDelayed(g, e50.Q4() ? 50L : 100L);
                return true;
            }
            if (this.i2.getWidth() == 0) {
                Me(true);
                this.i2.setImageDrawable(null);
                if (Nb()) {
                    fa();
                }
            } else {
                FlipImageView flipImageView2 = this.i2;
                flipImageView2.setBitmap1(o50.M(flipImageView2.getDrawable()));
                this.i2.setBitmap2(null);
                this.i2.setImageDrawable(null);
                this.i2.c(true, -100, new k());
            }
        } else {
            Me(true);
            this.i2.setImageDrawable(null);
        }
        this.a2.setVisibility(0);
        e50.D6(this.U1);
        if (e50.Q4()) {
            hideProgressDlg();
        }
        return true;
    }

    public void Sf(String title, String msg) {
        try {
            ProgressDialog progressDialog = this.Fb;
            if (progressDialog != null) {
                progressDialog.setTitle(title);
                this.Fb.setMessage(msg);
                return;
            }
            ProgressDialog progressDialog2 = !e50.p5() ? new ProgressDialog(this) : new ProgressDialog(this, R.style.MyProgressDialogDark);
            this.Fb = progressDialog2;
            progressDialog2.setTitle(title);
            this.Fb.setMessage(msg);
            this.Fb.setCancelable(false);
            this.Fb.setButton(-1, getString(android.R.string.cancel), new i3());
            this.Fb.show();
        } catch (Throwable th) {
            e50.S0(th);
            this.Fb = null;
        }
    }

    public void T5(final Context context, final boolean showMenu) {
        ScrollView scrollView = (ScrollView) LayoutInflater.from(context).inflate(R.layout.dictionary_select, (ViewGroup) null);
        Spinner spinner = (Spinner) scrollView.findViewById(R.id.cnDictSp);
        Spinner spinner2 = (Spinner) scrollView.findViewById(R.id.cnDictSp2);
        CheckBox checkBox = (CheckBox) scrollView.findViewById(R.id.openDict);
        CheckBox checkBox2 = (CheckBox) scrollView.findViewById(R.id.oneChar);
        ((TextView) scrollView.findViewById(R.id.tv1)).setText(Html.fromHtml(getString(R.string.dictionary) + "1 <small>(" + getString(R.string.single_tap_dict) + ")</small>"));
        ((TextView) scrollView.findViewById(R.id.tv2)).setText(Html.fromHtml(getString(R.string.dictionary) + "2 <small>(" + getString(R.string.long_tap_dict) + ")</small>"));
        checkBox2.setChecked(e50.U6);
        checkBox2.setVisibility(e50.H8 ? 0 : 8);
        checkBox.setChecked(e50.T6);
        String[] stringArray = getResources().getStringArray(R.array.dict_list);
        ArrayAdapter arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, stringArray);
        arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter((SpinnerAdapter) arrayAdapter);
        spinner2.setAdapter((SpinnerAdapter) arrayAdapter);
        int i8 = e50.m6;
        if (i8 == -1 || i8 >= stringArray.length - 1) {
            i8 = 0;
        }
        e50.m6 = i8;
        int i9 = e50.n6;
        if (i9 == -1 || i9 >= stringArray.length - 1) {
            i9 = 0;
        }
        e50.n6 = i9;
        spinner.setSelection(e50.m6);
        spinner2.setSelection(e50.n6);
        new x(Looper.getMainLooper(), stringArray, context, spinner, spinner2).sendEmptyMessage(0);
        e50.M6(scrollView);
        m.c cVar = new m.c(context);
        cVar.z(getString(R.string.customize_dictionary)).B(scrollView).v(R.string.ok, new y(spinner, spinner2, checkBox, checkBox2, showMenu)).o(R.string.cancel, null);
        if (e50.p5()) {
            cVar.e(false);
        }
        cVar.C();
    }

    protected void T6() {
        g50.e F = g50.F(e50.V1);
        if (F == null) {
            F = g50.i(g50.d, e50.V1, false);
        } else if (F.i.equals("")) {
            F.i = g50.d;
        }
        if (F != null) {
            com.flyersoft.seekbooks.c cVar = new com.flyersoft.seekbooks.c(this, new c7(), false, F);
            cVar.setOnDismissListener(new d7());
            cVar.show();
        }
    }

    public void T9() {
        try {
            BroadcastReceiver broadcastReceiver = this.g7;
            if (broadcastReceiver != null) {
                unregisterReceiver(broadcastReceiver);
                this.g7 = null;
            }
            if (this.f7 != null) {
                ((NotificationManager) getSystemService("notification")).cancel(-1889667143);
                this.f7 = null;
            }
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    public void Td() {
        Ud(false, 0);
    }

    public void Tg() {
        Ug(true);
    }

    protected void U6() {
        if (Za()) {
            nc();
            return;
        }
        g50.f fVar = this.z9;
        if (fVar == null) {
            fVar = F5();
        }
        if (this.F2 != null) {
            fVar.d = (int) e50.f2;
            fVar.e = -1;
        }
        new com.flyersoft.seekbooks.e(this, fVar, false, new q(fVar)).show();
    }

    public Handler U8() {
        if (this.r8 == null) {
            this.r8 = new f7(Looper.getMainLooper());
        }
        return this.r8;
    }

    public void Ud(boolean resetCachShot, int delay) {
        Vd(resetCachShot, delay, true);
    }

    public void Uf() {
    }

    public void Ug(boolean showTip) {
        int i8;
        if (e50.P4 != 19 || SystemClock.elapsedRealtime() - this.M6 >= Constants.MINIMAL_AD_INTERVAL) {
            e50.O9 = false;
            com.radaee.pdfex.b.c(true);
            this.G9 = -1;
            this.C4.clear();
            if (F7()) {
                pe(true);
                ee();
            }
            if (this.z1 && (i8 = this.Q1.P0) != -1) {
                kh(i8);
                Ih();
            } else {
                this.Q1.P0 = -1;
            }
            this.F6 = -1;
            rg(false);
            T9();
            O9();
            ub(showTip);
            th();
            this.U1.setKeepScreenOn(e50.h5);
        }
    }

    public void Uh(boolean in) {
        if (this.C9 == null) {
            return;
        }
        if (in) {
            e50.k2++;
        } else {
            e50.k2--;
        }
        Nh(true);
    }

    public void Vd(boolean resetCachShot, int delay, boolean hideCurl3dLay) {
        this.T2 = -1L;
        FlipImageView flipImageView = this.S2;
        if (flipImageView != null) {
            flipImageView.setTag(null);
        }
        if (resetCachShot) {
            C5(delay);
        } else {
            o50.f2(this.W2);
        }
        if (hideCurl3dLay && this.R2 != null && this.W1.getVisibility() == 0) {
            Je(false);
        }
        if (q8() == 0 && !o50.I1(this.W2)) {
            o50.f2(this.W2);
        }
        if (e50.R4()) {
            this.Ka.setText("");
        }
    }

    protected void Vf(View v7) {
    }

    public void W4() {
        this.H1.sendEmptyMessage(E0);
    }

    void W6() {
        if (Z7()) {
            return;
        }
        l6();
    }

    public void W7(boolean pageDown, float tiltSpeed) {
        if (this.C9 != null) {
            if (pageDown) {
                Rh();
                return;
            } else {
                Sh();
                return;
            }
        }
        this.v6 = tiltSpeed;
        if (tiltSpeed == 0.0f) {
            this.u6 = true;
        }
        if (SystemClock.elapsedRealtime() - this.A4 > 500) {
            bc(pageDown ? 1 : -1);
        }
    }

    protected int W8() {
        long j8;
        this.g8 = false;
        n.C0941n c0941n = this.h8;
        if (c0941n == null) {
            j8 = e50.f2;
        } else {
            MRTextView mRTextView = this.Q1;
            if (mRTextView.P0 == -1) {
                mRTextView.P0 = c0941n.b;
                mRTextView.Q0 = c0941n.c;
            }
            j8 = e50.f2;
        }
        return (int) j8;
    }

    public void We(float value, boolean force) {
        if (Build.VERSION.SDK_INT < 8) {
            return;
        }
        if (this.f8 || force) {
            try {
                this.f8 = true;
                WindowManager.LayoutParams attributes = getWindow().getAttributes();
                attributes.getClass().getField("buttonBrightness").set(attributes, Float.valueOf(value));
                getWindow().setAttributes(attributes);
            } catch (Exception e8) {
                this.f8 = false;
                e50.S0(e8);
            }
        }
    }

    public void X4() {
        m5();
        this.S8 = true;
        mh(this.S1.getPaddingLeft(), e50.S3(), this.S1.getPaddingRight(), e50.O1() + (kg() ? this.C8.getHeight() - this.C8.getPaddingTop() : 0));
    }

    void X6() {
        long h8;
        long l9;
        String str;
        String str2;
        String sb;
        String str3;
        String str4;
        String sb2;
        int q8;
        String str5;
        String str6;
        StringBuilder sb3;
        String str7;
        String str8;
        String str9;
        String str10;
        String str11;
        String a02;
        String str12;
        StringBuilder sb4;
        Drawable z12;
        int i8;
        String str13;
        String str14;
        hideProgressDlg();
        boolean C5 = e50.C5();
        try {
            String str15 = "";
            if (Ya()) {
                String h9 = this.qa.h("Author");
                StringBuilder sb5 = new StringBuilder();
                sb5.append("<big><b>");
                sb5.append(e50.D1());
                sb5.append("</b>");
                if (h9 != null && h9.length() != 0) {
                    str14 = " - " + h9;
                    sb5.append(str14);
                    sb5.append("</big><br><br><b>");
                    sb5.append(getString(R.string.filename));
                    sb5.append(":</b>  ");
                    sb5.append(o50.v0(e50.V1));
                    sb5.append("<br><b>");
                    sb5.append(getString(R.string.location));
                    sb5.append(":</b>  ");
                    sb5.append(o50.n0(e50.V1));
                    sb5.append("<br><b>");
                    sb5.append(getString(R.string.file_size));
                    sb5.append(":</b>  ");
                    sb5.append(Formatter.formatFileSize(this, new File(e50.V1).length()));
                    sb5.append("<br><b>");
                    sb5.append(getString(R.string.total_pages));
                    sb5.append(":</b>  ");
                    sb5.append(this.qa.k());
                    sb5.append("<br><b>");
                    sb5.append(getString(R.string.current_page));
                    sb5.append(":</b>  ");
                    sb5.append(rc() + 1);
                    sb5.append("<br><b>Creator:</b>  ");
                    sb5.append(this.qa.h("Creator"));
                    sb5.append("<br><b>Subject:</b>  ");
                    sb5.append(this.qa.h("Subject"));
                    sb5.append("<br><b>Keywords:</b>  ");
                    sb5.append(this.qa.h("Keywords"));
                    sb5.append("<br><b>Producer:</b>  ");
                    sb5.append(this.qa.h("Producer"));
                    sb5.append("<br><b>Version:</b>  ");
                    sb5.append(this.qa.h(MustParam.APP_VERSION));
                    sb2 = sb5.toString();
                    str3 = ":</b>  ";
                    str5 = ":</b> ";
                    str4 = "<b>";
                }
                str14 = "";
                sb5.append(str14);
                sb5.append("</big><br><br><b>");
                sb5.append(getString(R.string.filename));
                sb5.append(":</b>  ");
                sb5.append(o50.v0(e50.V1));
                sb5.append("<br><b>");
                sb5.append(getString(R.string.location));
                sb5.append(":</b>  ");
                sb5.append(o50.n0(e50.V1));
                sb5.append("<br><b>");
                sb5.append(getString(R.string.file_size));
                sb5.append(":</b>  ");
                sb5.append(Formatter.formatFileSize(this, new File(e50.V1).length()));
                sb5.append("<br><b>");
                sb5.append(getString(R.string.total_pages));
                sb5.append(":</b>  ");
                sb5.append(this.qa.k());
                sb5.append("<br><b>");
                sb5.append(getString(R.string.current_page));
                sb5.append(":</b>  ");
                sb5.append(rc() + 1);
                sb5.append("<br><b>Creator:</b>  ");
                sb5.append(this.qa.h("Creator"));
                sb5.append("<br><b>Subject:</b>  ");
                sb5.append(this.qa.h("Subject"));
                sb5.append("<br><b>Keywords:</b>  ");
                sb5.append(this.qa.h("Keywords"));
                sb5.append("<br><b>Producer:</b>  ");
                sb5.append(this.qa.h("Producer"));
                sb5.append("<br><b>Version:</b>  ");
                sb5.append(this.qa.h(MustParam.APP_VERSION));
                sb2 = sb5.toString();
                str3 = ":</b>  ";
                str5 = ":</b> ";
                str4 = "<b>";
            } else {
                long o8 = o8();
                if (q8() != 100 && (q8() != 0 || e50.f4().size() <= 3)) {
                    l9 = (this.Q1.getRealHeight() / e50.h3()) + 1;
                    h8 = ((e50.f2 * l9) / o8) + 1;
                    str = "</b>";
                    long j8 = h8;
                    if (l9 < 10) {
                        sb = "";
                        str2 = ":</b> ";
                    } else {
                        StringBuilder sb6 = new StringBuilder();
                        sb6.append("<br><b>");
                        str2 = ":</b> ";
                        sb6.append(getString(R.string.total_pages));
                        sb6.append(":</b>  ");
                        sb6.append(l9);
                        sb6.append("<br><b>");
                        sb6.append(getString(R.string.current_page));
                        sb6.append(":</b>  ");
                        sb = sb6.toString();
                    }
                    if (C5) {
                        sb2 = "";
                        str3 = ":</b>  ";
                        str4 = "<b>";
                    } else {
                        StringBuilder sb7 = new StringBuilder();
                        sb7.append("<b>");
                        sb7.append(getString(R.string.filename));
                        sb7.append(":</b>  ");
                        sb7.append(o50.v0(e50.V1));
                        sb7.append("<br><b>");
                        sb7.append(getString(R.string.location));
                        sb7.append(":</b>  ");
                        sb7.append(o50.n0(e50.V1));
                        sb7.append("<br><b>");
                        sb7.append(getString(R.string.file_size));
                        sb7.append(":</b>  ");
                        str3 = ":</b>  ";
                        str4 = "<b>";
                        sb7.append(Formatter.formatFileSize(this, new File(e50.V1).length()));
                        sb7.append(sb);
                        sb7.append(j8);
                        sb2 = sb7.toString();
                    }
                    q8 = q8();
                    if (q8 != 0 || q8 == 1) {
                        str5 = str2;
                        if (e50.Y3().size() > 0) {
                            int X3 = e50.X3(e50.f2, null, null);
                            str6 = sb2 + "<br><b>" + getString(R.string.total_chapters) + str5 + e50.Y3().size() + "<br><b>" + getString(R.string._current_chapter) + str5 + (X3 + 1) + "<br>" + e50.Y3().get(X3).a;
                            sb2 = str6;
                        }
                    } else if (q8 != 100) {
                        str5 = str2;
                    } else {
                        String m8 = g50.m(o50.B2(e50.Q1.m));
                        String b8 = e50.Q1.b();
                        StringBuilder sb8 = new StringBuilder();
                        sb8.append("<big><b>");
                        sb8.append(e50.Q1.d());
                        sb8.append(str);
                        if (m8 != null) {
                            sb3 = new StringBuilder();
                            sb3.append("<br>");
                            sb3.append(m8);
                            if (b8.equals("")) {
                                str10 = "";
                            } else {
                                str10 = "<br>" + b8;
                            }
                            sb3.append(str10);
                        } else if (b8.equals("")) {
                            str7 = "";
                            sb8.append(str7);
                            sb8.append("</big>");
                            str8 = e50.Q1.k;
                            if (str8 != null || str8.equals("")) {
                                str9 = "";
                            } else {
                                str9 = "<br><br><i>" + e50.Q1.k + "</i>";
                            }
                            sb8.append(str9);
                            sb8.append("<br><br>");
                            sb8.append(sb2);
                            sb8.append("<br><b>");
                            sb8.append(getString(R.string.total_chapters));
                            str5 = str2;
                            sb8.append(str5);
                            sb8.append(e50.Q1.h().size());
                            sb8.append("<br><b>");
                            sb8.append(getString(R.string._current_chapter));
                            sb8.append(str5);
                            sb8.append(e50.g2 + 1);
                            sb8.append(", ");
                            sb8.append(e50.Q1.h().get(e50.g2).c);
                            str6 = sb8.toString();
                            sb2 = str6;
                        } else {
                            sb3 = new StringBuilder();
                            sb3.append(" - ");
                            sb3.append(b8);
                        }
                        str7 = sb3.toString();
                        sb8.append(str7);
                        sb8.append("</big>");
                        str8 = e50.Q1.k;
                        if (str8 != null) {
                        }
                        str9 = "";
                        sb8.append(str9);
                        sb8.append("<br><br>");
                        sb8.append(sb2);
                        sb8.append("<br><b>");
                        sb8.append(getString(R.string.total_chapters));
                        str5 = str2;
                        sb8.append(str5);
                        sb8.append(e50.Q1.h().size());
                        sb8.append("<br><b>");
                        sb8.append(getString(R.string._current_chapter));
                        sb8.append(str5);
                        sb8.append(e50.g2 + 1);
                        sb8.append(", ");
                        sb8.append(e50.Q1.h().get(e50.g2).c);
                        str6 = sb8.toString();
                        sb2 = str6;
                    }
                }
                h8 = h8(0);
                l9 = l9() / 100000;
                if (l9 == 0) {
                    str = "</b>";
                    l9 = 1;
                    long j82 = h8;
                    if (l9 < 10) {
                    }
                    if (C5) {
                    }
                    q8 = q8();
                    if (q8 != 0) {
                    }
                    str5 = str2;
                    if (e50.Y3().size() > 0) {
                    }
                }
                str = "</b>";
                long j822 = h8;
                if (l9 < 10) {
                }
                if (C5) {
                }
                q8 = q8();
                if (q8 != 0) {
                }
                str5 = str2;
                if (e50.Y3().size() > 0) {
                }
            }
            ue();
            g50.h e02 = g50.e0(e50.V1);
            long j9 = e02.b;
            String str16 = "0";
            if (j9 <= 0 || e02.c <= 0) {
                str11 = "0";
            } else {
                try {
                    str13 = o50.W(j9);
                } catch (Exception e8) {
                    e = e8;
                    str13 = "0";
                }
                try {
                    if ((((float) e02.b) / 60.0f) / 1000.0f > 0.0f) {
                        str16 = "" + new DecimalFormat("0").format(((float) e02.c) / r0);
                    }
                } catch (Exception e9) {
                    e = e9;
                    e50.S0(e);
                    str11 = str16;
                    str16 = str13;
                    a02 = g50.a0(e50.V1, e02);
                    StringBuilder sb9 = new StringBuilder();
                    sb9.append(sb2);
                    sb9.append("<br><b>");
                    sb9.append(getString(R.string.read_hour));
                    sb9.append(str5);
                    sb9.append(str16);
                    sb9.append("<br><b>");
                    sb9.append(getString(R.string.read_speed));
                    sb9.append(": </b>");
                    sb9.append(str11);
                    sb9.append(getString(R.string.read_speed2));
                    sb9.append("<br>");
                    if (a02 == null) {
                    }
                    sb9.append(str15);
                    if (C5) {
                    }
                    sb9.append(sb4.toString());
                    this.k8 = sb9.toString();
                    View inflate = LayoutInflater.from(this).inflate(R.layout.book_info, (ViewGroup) null);
                    this.j8 = inflate;
                    ((TextView) inflate.findViewById(R.id.rdmTextView01)).setText(Html.fromHtml(this.k8));
                    ImageView imageView = (ImageView) this.j8.findViewById(R.id.imageView1);
                    z12 = e50.z1(e50.V1);
                    if (z12 == null) {
                    }
                    i8 = -1;
                    if (C5) {
                    }
                    if (i8 > 0) {
                    }
                    e50.F6(this.j8);
                    m.c cVar = new m.c(this);
                    cVar.z(getString(R.string.book_info)).B(this.j8);
                    cVar.v(R.string.jiarushujia, new x6());
                    if (nb()) {
                    }
                    cVar.r(getString(R.string.more) + "... ", new a7());
                    cVar.t(new b7());
                    cVar.C();
                    za(true);
                }
                str11 = str16;
                str16 = str13;
            }
            a02 = g50.a0(e50.V1, e02);
            StringBuilder sb92 = new StringBuilder();
            sb92.append(sb2);
            sb92.append("<br><b>");
            sb92.append(getString(R.string.read_hour));
            sb92.append(str5);
            sb92.append(str16);
            sb92.append("<br><b>");
            sb92.append(getString(R.string.read_speed));
            sb92.append(": </b>");
            sb92.append(str11);
            sb92.append(getString(R.string.read_speed2));
            sb92.append("<br>");
            if (a02 == null) {
                StringBuilder sb10 = new StringBuilder();
                str12 = str4;
                sb10.append(str12);
                sb10.append(getString(R.string.date_read_history));
                sb10.append("</b><br>");
                sb10.append(a02);
                str15 = sb10.toString();
            } else {
                str12 = str4;
            }
            sb92.append(str15);
            if (C5) {
                sb4 = new StringBuilder();
                sb4.append(str12);
                sb4.append(getString(R.string.chars_in_book));
                sb4.append(str3);
            } else {
                sb4 = new StringBuilder();
                sb4.append("<b>书源: </b>");
                sb4.append(e50.Q1.p.name());
            }
            sb92.append(sb4.toString());
            this.k8 = sb92.toString();
            View inflate2 = LayoutInflater.from(this).inflate(R.layout.book_info, (ViewGroup) null);
            this.j8 = inflate2;
            ((TextView) inflate2.findViewById(R.id.rdmTextView01)).setText(Html.fromHtml(this.k8));
            ImageView imageView2 = (ImageView) this.j8.findViewById(R.id.imageView1);
            z12 = e50.z1(e50.V1);
            if (z12 == null) {
                imageView2.setImageDrawable(z12);
                imageView2.setOnClickListener(new t6());
            } else {
                imageView2.setVisibility(8);
            }
            i8 = -1;
            if (C5) {
                int q82 = q8();
                if (q82 == 0) {
                    i8 = f50.v(new u6(), true);
                } else if (q82 == 1) {
                    Y6();
                } else if (q82 == 7) {
                    i8 = f50.q(new w6(), true);
                } else if (q82 == 100) {
                    i8 = f50.w(e50.Q1, 0, new v6(), true);
                }
            } else {
                this.j8.findViewById(R.id.progressBar3).setVisibility(8);
            }
            if (i8 > 0) {
                Y6();
            }
            e50.F6(this.j8);
            m.c cVar2 = new m.c(this);
            cVar2.z(getString(R.string.book_info)).B(this.j8);
            cVar2.v(R.string.jiarushujia, new x6());
            if (nb()) {
                cVar2.p(e50.D2().contains(e50.V1) ? "取消完本标记" : "标记为已完本", new z6());
            }
            cVar2.r(getString(R.string.more) + "... ", new a7());
            cVar2.t(new b7());
            cVar2.C();
            za(true);
        } catch (Throwable th) {
            System.gc();
            e50.S0(th);
        }
    }

    public void Xb(String url) {
        if (e50.T5(this)) {
            return;
        }
        if (ThirdConfig.isYueWenUrl(url) && !com.flyersoft.seekbooks.q.d()) {
            this.Eb = url;
            com.flyersoft.seekbooks.q.D(this, StoreWebView.STORE_LOGIN2);
            return;
        }
        S.addForceWebSite(e50.Q1.p.siteTag);
        int i8 = e50.g2;
        while (true) {
            i8++;
            if (i8 >= e50.Q1.h().size()) {
                break;
            } else {
                e50.Q1.h().get(i8).f = getString(R.string.downloading_content);
            }
        }
        o5();
        this.Ha = null;
        Intent intent = new Intent(this, (Class<?>) BrowserAct.class);
        intent.putExtra("url", url);
        intent.putExtra("siteTag", e50.Q1.p.siteTag);
        intent.putExtra("title", ThirdConfig.isYueWenUrl(url) ? e50.W0("请选择\"自动订阅\"") : getString(R.string.denglupingtaitishi));
        startActivityForResult(intent, 126);
    }

    public void Xe() {
        if ((e50.v5 || e50.w5) && e50.A5 != -100) {
            We(-1.0f, true);
            if ((!e50.v5 || e50.A5 > e50.E5) && !(e50.w5 && e50.Y1.equals(e50.Z8))) {
                return;
            }
            new m6(Looper.getMainLooper()).sendEmptyMessage(0);
            return;
        }
        We(-1.0f, false);
    }

    public void Xg(String siteTag, String url, boolean forUpdateCur) {
        if (o50.F1(siteTag)) {
            return;
        }
        if (forUpdateCur || !siteTag.equals(e50.Q1.p.siteTag)) {
            if (!e50.o5()) {
                o50.n2(this, getString(R.string.qinglianjiewangluo));
            } else {
                c9(siteTag, url, true, forUpdateCur, true, null);
            }
        }
    }

    void Y4(boolean error) {
        if (this.zb && !isFinishing() && nb()) {
            if (error || this.rb.size() == 0) {
                this.zb = false;
                this.Bb = null;
                this.rb.clear();
                hideProgressDlg();
                if (error) {
                    o50.n2(this, getString(R.string.qingqiehuanshuyuan));
                } else {
                    o50.n2(this, getString(R.string.xiazaiwanchengkongjian) + Formatter.formatFileSize(this, o50.y0(o50.n0(e50.V1))));
                }
                cg(0);
            }
        }
    }

    public int Y8() {
        int i8 = e50.A5;
        if (i8 > 0 || i8 == -100) {
            return 0;
        }
        int i9 = 1 - i8;
        if (i9 > 50) {
            i9 = 50;
        }
        return i9 * 4;
    }

    public boolean Ya() {
        return q8() == 7;
    }

    protected boolean Yf(boolean isPageDown) {
        if (this.w4 > 1 || X7()) {
            return false;
        }
        if (this.X2 && this.i2.getVisibility() == 0) {
            this.H1.removeMessages(u0);
            this.H1.sendEmptyMessageDelayed(u0, 10L);
            return false;
        }
        if (this.Y4 || this.K2) {
            return false;
        }
        FlipImageView flipImageView = this.i2;
        if (flipImageView.d == null) {
            return false;
        }
        if (this.v6 == 0.0f) {
            boolean z7 = !this.u6 ? true : true;
            if (!z7) {
                Me(true);
                return false;
            }
        }
        int i8 = e50.i4;
        if (Ya() && e50.t3 && Global.m == 3 && i8 == 4) {
            i8 = 3;
        }
        if (!this.u6 || !e50.S4()) {
            i8 = e50.e4;
        }
        int i9 = (i8 != 0 || this.v6 == 0.0f) ? i8 : 4;
        if (i9 < 3) {
            Me(true);
            return false;
        }
        this.u6 = false;
        this.j5 = SystemClock.elapsedRealtime();
        this.a2.setAnimationState(true);
        mf(true);
        this.i2.setTag(Integer.valueOf(this.S1.getScrollY()));
        this.T2 = H8();
        cg(0);
        Bitmap O8 = O8(true, true);
        this.V2 = O8;
        this.i2.setBitmap2(O8);
        this.i2.c(isPageDown, i9, new b5());
        return true;
    }

    void Z6() {
        t7(1);
    }

    public boolean Za() {
        PDFReader pDFReader = this.F2;
        return (pDFReader == null || pDFReader.c) ? false : true;
    }

    public void Ze(int brightnessValue, boolean showHint) {
        WindowManager.LayoutParams attributes = getWindow().getAttributes();
        if (brightnessValue == -100) {
            attributes.screenBrightness = -1.0f;
            e50.A5 = brightnessValue;
        } else {
            if (brightnessValue > 100) {
                brightnessValue = 100;
            }
            if (brightnessValue < -50) {
                brightnessValue = -50;
            }
            if (showHint) {
                o50.r2(this, brightnessValue + "%", 0, 17);
            }
            e50.A5 = brightnessValue;
            jg();
            attributes.screenBrightness = (brightnessValue > 0 ? brightnessValue : 1.0f) / 100.0f;
        }
        this.e8 = true;
        getWindow().setAttributes(attributes);
    }

    protected void Zf(String text, int p7) {
        if (this.K2 || this.Q1.getText().length() <= 0) {
            ph(text);
            hh(p7);
        }
    }

    void a7() {
        this.h3 = new ArrayList<>();
        for (int i8 = 0; i8 < ReaderBar.e().size(); i8++) {
            if (!ReaderBar.e().get(i8).b && ReaderBar.e().get(i8).a != 3) {
                this.h3.add(ReaderBar.e().get(i8));
            }
        }
        int size = this.h3.size() + 1;
        CharSequence[] charSequenceArr = new CharSequence[size];
        int[] iArr = new int[this.h3.size() + 1];
        for (int i9 = 0; i9 < this.h3.size(); i9++) {
            charSequenceArr[i9] = ReaderBar.c(this.h3.get(i9).a, false);
            iArr[i9] = this.h3.get(i9).c;
        }
        int i10 = size - 1;
        charSequenceArr[i10] = getString(R.string.shezhi);
        iArr[i10] = R.drawable.b3_options;
        Cf(charSequenceArr, iArr, 0);
    }

    public boolean ab() {
        PDFReader pDFReader = this.F2;
        return pDFReader != null && pDFReader.c;
    }

    protected void ad(String text) {
        if (e50.f5(e50.V1)) {
            new m.c(this).m(Html.fromHtml("<b>" + text + "</b><br><br>" + getString(R.string.copy_pdf_file_to_edit, new Object[]{"<b><font color=\"#FF0000\">/sdcard/Books/Pdf</font></b>"}))).d(false).v(android.R.string.yes, new f1()).o(android.R.string.no, null).C();
            return;
        }
        o50.p2(this, text);
    }

    void af() {
        setRequestedOrientation(e50.s3(e50.n4));
    }

    void ag(String key) {
        J9();
        if (Th()) {
            return;
        }
        if (Ya()) {
            if (this.F2.c) {
                hd(true);
            }
            fd();
            this.ka.setText(key);
            return;
        }
        new com.flyersoft.seekbooks.n(this, new o6(), key).show();
    }

    public String b8() {
        String substring;
        int i8 = e50.C8 ? 38 : 78;
        if (Ya()) {
            substring = mc(rc()).trim();
            if (substring.length() > i8) {
                substring = substring.substring(0, i8);
            }
            if (substring.length() == 0) {
                substring = "" + e50.f2;
            }
        } else {
            int I = this.Q1.getLayout().I(this.Q1.getLayout().C(this.S1.getScrollY()));
            if (I == 0 && nb()) {
                I = e50.Q1.h().get(e50.g2).c.length() + 1;
            }
            String text2 = this.Q1.getText2();
            int i9 = i8 + I;
            if (text2.length() > i9) {
                String substring2 = text2.substring(I, i9);
                int lastIndexOf = substring2.lastIndexOf(" ");
                if (substring2.length() - lastIndexOf < 8) {
                    substring2 = substring2.substring(0, lastIndexOf);
                }
                substring = substring2;
            } else if (text2.length() < 3) {
                substring = o50.y(Long.valueOf(System.currentTimeMillis()));
            } else {
                substring = text2.substring(I, text2.length());
            }
        }
        return substring.replace("\n", " ").replace(e50.H9, ' ').trim() + "...";
    }

    public boolean bd() {
        boolean z7 = true;
        if (!this.F2.c && (Global.m == 0 || e50.r3() - Ic(-1) <= this.C8.getHeight() * 2)) {
            z7 = false;
        }
        if (kg()) {
            id(z7);
        }
        return z7;
    }

    public void bg() {
        try {
            L5();
            this.z8.bringToFront();
            this.z8.setVisibility(0);
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    public boolean c5(int direction, int y7, int y22) {
        int scrollY = this.S1.getScrollY();
        int lineHeight = this.Q1.getLineHeight() - 3;
        if (y22 != -1 && Math.abs(scrollY - y7) >= lineHeight) {
            if (!e50.O9) {
                return false;
            }
            Eg(y7);
            return false;
        }
        if (direction == 1) {
            if (y22 != -1 && scrollY + e50.h3() < this.Q1.getRealHeight() - lineHeight) {
                this.S1.pageScroll(130);
                if (Z4()) {
                    pf();
                }
            } else {
                ac();
            }
        } else {
            dc();
        }
        return true;
    }

    void c7() {
        if (e50.P9) {
            return;
        }
        mg();
    }

    public void cd() {
        if (kg()) {
            new b1(Looper.getMainLooper()).sendEmptyMessage(0);
        }
    }

    public void ce() {
        ActivityMain.b0 = null;
        e50.N5("--------------restartReaderIntent-----------");
        this.t1 = true;
        this.H1.removeCallbacksAndMessages(null);
        Intent intent = new Intent(this, (Class<?>) ActivityTxt.class);
        intent.putExtra("bookFile", e50.V1);
        intent.putExtra("restartReaderIntent", true);
        startActivity(intent);
        finish();
    }

    public void cg(int pageAdd) {
        String str;
        String str2;
        String str3;
        String str4;
        int i8;
        int X5;
        int i9;
        int i10;
        if (!this.I1 && kg() && !this.z1 && this.C9 == null && SystemClock.elapsedRealtime() - this.U8 >= 100) {
            int ih = ih(0) * pageAdd;
            this.U8 = SystemClock.elapsedRealtime();
            pe(false);
            xh();
            this.X8 = -1L;
            this.Y8 = -1L;
            int q8 = q8();
            String str5 = "";
            if (q8 != 0) {
                if (q8 != 1) {
                    if (q8 == 7) {
                        PDFReader pDFReader = this.F2;
                        if (pDFReader == null || pDFReader.b == null) {
                            return;
                        }
                        bd();
                        tc();
                        if (this.wa.size() > 0 && e50.g2 < this.wa.size()) {
                            str = this.wa.get(e50.g2).a;
                        } else {
                            str = e50.D1();
                        }
                    } else if (q8 != 100) {
                        str = "";
                    }
                }
                if (q8() == 1) {
                    str4 = o50.v0(e50.V1);
                } else {
                    f50 f50Var = e50.Q1;
                    if (f50Var == null || !f50Var.z()) {
                        return;
                    } else {
                        str4 = e50.Q1.h().get(e50.g2).c;
                    }
                }
                int realHeight = this.Q1.getRealHeight();
                int h32 = realHeight / e50.h3();
                int i11 = 3;
                if (h32 > 3) {
                    X5 = h32 * e50.X5();
                } else {
                    i11 = 2;
                    if (h32 > 2) {
                        X5 = e50.X5();
                    } else {
                        i8 = 0;
                        i9 = realHeight + i8;
                        if (i9 < 1) {
                            i9 = 1;
                        }
                        long h33 = (i9 / e50.h3()) + 1;
                        this.X8 = h33;
                        this.Y8 = ((h33 * (this.S1.getScrollY() + (e50.h3() / 5))) / i9) + 1;
                        if (!e50.U5()) {
                            if (e50.h2 > e50.G9.size() - 1) {
                                e50.h2 = e50.G9.size() - 1;
                            }
                            int length = e50.G9.get(e50.h2).length();
                            if (this.V8 == null) {
                                this.V8 = new HashMap<>();
                                this.W8 = new HashMap<>();
                            }
                            this.V8.put(Integer.valueOf(e50.h2), Integer.valueOf((int) this.X8));
                            int i12 = e50.h2;
                            if (i12 > 0 && this.V8.containsKey(Integer.valueOf(i12 - 1))) {
                                this.X8 = this.V8.get(Integer.valueOf(e50.h2 - 1)).intValue();
                                length = e50.G9.get(e50.h2 - 1).length();
                                if (this.W8.containsKey(Integer.valueOf(e50.h2 - 1))) {
                                    i10 = this.W8.get(Integer.valueOf(e50.h2 - 1)).intValue();
                                    this.Y8 += i10 <= 0 ? i10 : (this.X8 * Vg(e50.G9, e50.h2)) / length;
                                    long j8 = this.X8;
                                    ArrayList<String> arrayList = e50.G9;
                                    this.X8 = (j8 * Vg(arrayList, arrayList.size())) / length;
                                    if (vb()) {
                                        this.W8.put(Integer.valueOf(e50.h2), Integer.valueOf((int) (this.Y8 + ((F7() && this.R1.getVisibility() == 0) ? 1 : 0))));
                                    }
                                }
                            }
                            i10 = -1;
                            this.Y8 += i10 <= 0 ? i10 : (this.X8 * Vg(e50.G9, e50.h2)) / length;
                            long j82 = this.X8;
                            ArrayList<String> arrayList2 = e50.G9;
                            this.X8 = (j82 * Vg(arrayList2, arrayList2.size())) / length;
                            if (vb()) {
                            }
                        }
                        if (this.Y8 <= this.X8 || (e50.U5() && !F7() && vb())) {
                            this.Y8 = this.X8;
                        }
                        str = str4 + (" (" + this.Y8 + com.ksdk.ssds.manager.b.b + this.X8 + ")");
                    }
                }
                i8 = X5 / i11;
                i9 = realHeight + i8;
                if (i9 < 1) {
                }
                long h332 = (i9 / e50.h3()) + 1;
                this.X8 = h332;
                this.Y8 = ((h332 * (this.S1.getScrollY() + (e50.h3() / 5))) / i9) + 1;
                if (!e50.U5()) {
                }
                if (this.Y8 <= this.X8) {
                }
                this.Y8 = this.X8;
                str = str4 + (" (" + this.Y8 + com.ksdk.ssds.manager.b.b + this.X8 + ")");
            } else {
                String r9 = r9();
                if (this.K2) {
                    str = r9;
                } else {
                    this.X8 = l9() / 100000;
                    long h8 = h8(ih);
                    this.Y8 = h8;
                    long j9 = this.X8;
                    if (h8 > j9) {
                        this.Y8 = j9;
                    }
                    str = r9 + (" (" + this.Y8 + com.ksdk.ssds.manager.b.b + this.X8 + ")");
                }
            }
            int n8 = eg() ? n8() : -1;
            if (nb()) {
                this.J8.setText((e50.g2 + 1) + com.ksdk.ssds.manager.b.b + e50.Q1.h().size() + "章");
            } else if (Ya()) {
                TextView textView = this.J8;
                StringBuilder sb = new StringBuilder();
                sb.append(this.F2.c ? e50.f2 + 1 : rc() + 1);
                sb.append(com.ksdk.ssds.manager.b.b);
                sb.append(this.qa.k());
                textView.setText(sb.toString());
            } else {
                this.J8.setText(this.K2 ? "" : P8());
            }
            if (this.G8.getVisibility() == 0) {
                if (this.X8 != -1) {
                    this.L8.setText(this.Y8 + com.ksdk.ssds.manager.b.b + this.X8);
                    this.L8.setTag(" (" + this.Y8 + com.ksdk.ssds.manager.b.b + this.X8 + ")");
                    if (this.Y8 + 1 > this.X8) {
                        str2 = "";
                    } else {
                        str2 = (this.Y8 + 1) + com.ksdk.ssds.manager.b.b + this.X8;
                    }
                    this.M8.setText(str2);
                    TextView textView2 = this.M8;
                    if (str2.length() > 0) {
                        str3 = " (" + str2 + ")";
                    } else {
                        str3 = "";
                    }
                    textView2.setTag(str3);
                } else {
                    this.L8.setText("");
                    this.M8.setText("");
                }
                this.K8.setText("");
            } else {
                be();
                this.K8.setText(str);
                TextView textView3 = this.K8;
                if (!Ya()) {
                    str5 = " (" + this.Y8 + com.ksdk.ssds.manager.b.b + this.X8 + ")";
                }
                textView3.setTag(str5);
            }
            if (!nb()) {
                Bd(n8, false);
            }
            if (this.z1) {
                return;
            }
            Og(0, ((e50.f5 && e50.E2) ? 30 : 60) * 1000);
        }
    }

    void d7() {
    }

    public void de() {
        fe(100, true, 0L);
    }

    void dg() {
        this.k3 = e50.e4;
        this.o3 = e50.f5;
        this.n3 = e50.E2;
        this.m3 = e50.V9;
        this.p3 = e50.X6;
        this.q3 = e50.b5;
        this.r3 = e50.A2;
        this.s3 = e50.k5;
        this.t3 = e50.m5;
        this.u3 = e50.a3;
        this.v3 = e50.l5;
        this.l3 = e50.i4;
        this.x3 = "" + e50.W6 + e50.Y6 + e50.a7 + e50.Z6 + e50.b7 + e50.c7 + e50.d7 + e50.e7 + e50.f7;
        this.w3 = e50.c5;
        this.y3 = q50.O();
        startActivityForResult(new Intent(this, (Class<?>) ReadingOptionsAct.class), 125);
    }

    public void dh() {
        try {
            if (!o50.D1(ActivityMain.e)) {
                ActivityMain.e.finish();
            }
            ActivityMain.e = null;
            pe(true);
            e50.z6 = false;
            e50.y6 = false;
            o50.C(e50.h8);
            e50.e(this);
            finish();
            a = null;
            System.exit(0);
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    public void e7() {
        za(true);
        String[] strArr = new String[6];
        strArr[0] = getString(R.string.gengxinzhangjieliebiao);
        strArr[1] = getString(R.string.chongxinxiazaibenzhang);
        strArr[2] = e50.W0("缓存后三十章");
        strArr[3] = e50.W0("缓存后面全部章节");
        strArr[4] = e50.W0("缓存全部");
        StringBuilder sb = new StringBuilder();
        sb.append("查看下载链接");
        sb.append(e50.Q1.p.downloadable ? "" : "(未知)");
        strArr[5] = e50.W0(sb.toString());
        new m.c(this).z("章节缓存").x(strArr, 2, null).v(R.string.ok, new m2()).r(getString(R.string.qingkonghuanchun), new l2()).o(R.string.cancel, null).C();
    }

    public void ee() {
        e50.e(this);
        ce();
    }

    protected void f7(final g50.f note) {
        new com.flyersoft.seekbooks.e(this, note, true, new r(note, note.k + note.h + note.n + note.o + note.m)).show();
    }

    public void gg() {
        if (this.h7 == null) {
            View inflate = ((ViewStub) findViewById(R.id.searchStub)).inflate();
            this.h7 = inflate;
            this.k7 = inflate.findViewById(R.id.listB);
            this.l7 = this.h7.findViewById(R.id.closeB);
            this.i7 = this.h7.findViewById(R.id.priorB);
            this.j7 = this.h7.findViewById(R.id.nextB);
            this.m7 = this.h7.findViewById(R.id.nav_return);
            this.n7 = (TextView) this.h7.findViewById(R.id.count);
            EditText editText = (EditText) this.h7.findViewById(R.id.keyEdit);
            this.o7 = editText;
            editText.setVisibility(4);
            this.k7.setOnClickListener(this);
            this.l7.setOnClickListener(this);
            this.i7.setOnClickListener(this);
            this.j7.setOnClickListener(this);
            this.m7.setOnClickListener(this);
        }
        this.o7.setText(e50.O7);
        this.h7.setVisibility(0);
        this.n7.setText((com.flyersoft.seekbooks.n.b + 1) + com.ksdk.ssds.manager.b.b + com.flyersoft.seekbooks.n.a.size());
        e50.R6(true);
    }

    public boolean ha(final boolean forceShow) {
        return false;
    }

    public boolean hb(MotionEvent event) {
        return (e50.t5 && rb(e50.a8, event)) || (e50.x5 && rb(e50.b8, event));
    }

    public void hc(MotionEvent event) {
    }

    public void hf(boolean colorOnly) {
        int i8;
        if (e50.i7) {
            i8 = e50.m7;
        } else {
            i8 = Ya() ? e50.E5(e50.l3) ? -14540254 : -3355444 : e50.f3;
        }
        int m12 = e50.m1(i8, -70);
        this.H8.setTextColor(m12);
        this.I8.setTextColor(m12);
        this.K8.setTextColor(m12);
        this.L8.setTextColor(m12);
        this.M8.setTextColor(m12);
        this.J8.setTextColor(m12);
        int i9 = 8;
        this.D8.setVisibility((e50.k5 || this.G8.getVisibility() == 0 || (eg() && e50.l5)) ? 0 : 8);
        View view = this.E8;
        if (eg() && !e50.l5 && this.G8.getVisibility() == 8) {
            i9 = 0;
        }
        view.setVisibility(i9);
        this.N8.setTextColor(m12);
        this.O8.setTextColor(m12);
        if (!colorOnly) {
            this.H8.setTextSize(e50.k7);
            this.I8.setTextSize(e50.k7);
            this.K8.setTextSize(e50.k7);
            this.J8.setTextSize(e50.k7);
            int k02 = e50.l7 > e50.k0(30.0f) ? e50.k0(30.0f) : e50.l7;
            this.L8.setPadding(k02, 0, k02, e50.l7);
            this.M8.setPadding(k02, 0, k02, e50.l7);
            int k03 = e50.l7 - e50.k0(2.0f);
            View view2 = this.F8;
            if (k03 <= 0) {
                k03 = 0;
            }
            view2.setPadding(k03, 0, k02, e50.l7);
            this.K8.setPadding(e50.k0(30.0f) - k02, 0, e50.k0(30.0f) - k02, e50.l7);
            this.J8.setPadding(k02, 0, e50.l7 + e50.k0(2.0f), e50.l7);
            this.N8.setTextSize(e50.k7);
            this.O8.setTextSize(e50.k7);
            View view3 = this.E8;
            int i10 = e50.l7;
            view3.setPadding(i10, 0, i10, i10 / 2);
            if (e50.i7) {
                this.H8.setTextColor(e50.m1(e50.m7, -50));
                this.I8.setTextColor(e50.m7);
                this.K8.setTextColor(e50.m7);
                this.J8.setTextColor(e50.m7);
                this.H8.setTypeface(e50.h4(e50.u7, 0));
                this.I8.setTypeface(e50.h4(e50.u7, 0));
                this.K8.setTypeface(e50.h4(e50.u7, 0));
                this.J8.setTypeface(e50.h4(e50.u7, 0));
                this.N8.setTypeface(e50.h4(e50.u7, 0));
                this.O8.setTypeface(e50.h4(e50.u7, 0));
            } else {
                this.H8.setTypeface(e50.h4("sans-serif", 0));
                this.I8.setTypeface(e50.h4("sans-serif", 0));
                this.K8.setTypeface(e50.h4("sans-serif", 0));
                this.J8.setTypeface(e50.h4("sans-serif", 0));
                this.N8.setTypeface(e50.h4("sans-serif", 0));
                this.O8.setTypeface(e50.h4("sans-serif", 0));
            }
            this.F8.setClickable(e50.o7 != 15);
            this.K8.setClickable(e50.p7 != 15);
            this.L8.setClickable(e50.p7 != 15);
            this.M8.setClickable(e50.p7 != 15);
            this.J8.setClickable(e50.q7 != 15);
            this.F8.setLongClickable(e50.r7 != 15);
            this.K8.setLongClickable(e50.s7 != 15);
            this.L8.setLongClickable(e50.s7 != 15);
            this.M8.setLongClickable(e50.s7 != 15);
            this.J8.setLongClickable(e50.t7 != 15);
        }
        m1883if();
        if (e50.V4() && e50.f5 && e50.g5) {
            LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.F8.getLayoutParams();
            LinearLayout.LayoutParams layoutParams2 = (LinearLayout.LayoutParams) this.J8.getLayoutParams();
            int k04 = e50.k0(10.0f);
            layoutParams2.rightMargin = k04;
            layoutParams.leftMargin = k04;
        }
    }

    public void hideProgressDlg() {
        this.z4 = false;
        if (this.tb) {
            return;
        }
        ProgressDialog progressDialog = this.G2;
        if (progressDialog != null) {
            this.y8 = progressDialog;
            progressDialog.dismiss();
        }
        this.G2 = null;
        ProgressBar progressBar = this.z8;
        if (progressBar != null) {
            progressBar.setVisibility(8);
        }
    }

    public void m1883if() {
        if (this.G8.getVisibility() == 0) {
            this.D8.setBackgroundDrawable(null);
            this.H8.setBackgroundDrawable(null);
            jf();
        } else {
            this.D8.setBackgroundDrawable(null);
        }
        ((BatteryTextView) this.H8).setBatteryIcon(!(Ya() ? !e50.E5(e50.l3) : e50.E5(e50.f3)));
    }

    public int ih(int add) {
        if (F7()) {
            return add + 2;
        }
        return 1;
    }

    protected void j5() {
        FrameLayout frameLayout = this.U1;
        if (frameLayout != null && e50.h5) {
            if (e50.P9) {
                frameLayout.setKeepScreenOn(true);
                return;
            }
            if (e50.B5 > 30) {
                return;
            }
            if (this.K1 == 0) {
                this.K1 = SystemClock.elapsedRealtime();
                this.U1.setKeepScreenOn(true);
                this.H1.sendEmptyMessageDelayed(o0, 10000L);
            } else {
                if (SystemClock.elapsedRealtime() - this.K1 <= e50.B5 * 60 * 1000 || this.z1) {
                    return;
                }
                e50.N5("*screen awake OFF");
                this.U1.setKeepScreenOn(false);
            }
        }
    }

    public boolean j6(int action) {
        if (action == 15) {
            return false;
        }
        switch (action) {
            case 0:
                p7();
                break;
            case 1:
                o7();
                break;
            case 2:
                r7();
                break;
            case 3:
                j7();
                break;
            case 4:
                s7();
                break;
            case 5:
                Z6();
                break;
            case 6:
                X6();
                break;
            case 7:
                c7();
                break;
            case 8:
                n7(null);
                break;
            case 9:
                Vf(null);
                break;
            case 10:
                g7();
                break;
            case 11:
                t7(0);
                break;
            case 12:
                q7();
                break;
            case 13:
                i7();
                break;
            case 14:
                W6();
                break;
            case 16:
                dh();
                break;
            case 17:
                w7(eb());
                break;
            case 18:
                O6(!e50.P9);
                break;
            case 19:
                u7();
                break;
            case 20:
                b7();
                break;
            case 21:
                vg();
                break;
            case 22:
                If();
                break;
            case 23:
                Uf();
                break;
        }
        return true;
    }

    void j7() {
        int indexOf = e50.x2().indexOf(e50.V1);
        if (indexOf < e50.x2().size() - 1) {
            String str = e50.x2().get(indexOf + 1);
            o50.q2(this, o50.v0(str), 1);
            l7(str);
            return;
        }
        o50.q2(this, getString(R.string.no_next_file), 1);
    }

    Handler j8() {
        if (this.p5 == null) {
            this.p5 = new d5(Looper.getMainLooper());
        }
        return this.p5;
    }

    public void ja() {
        this.i9.setOnClickListener(new i());
        this.i9.setOnLongClickListener(new j());
    }

    public void jd(boolean updateRatio) {
        Re();
        float viewGetRatio = this.F2.b.viewGetRatio();
        f.c viewGetPos = this.F2.b.viewGetPos();
        this.F2.set_viewer(Global.m);
        if (updateRatio) {
            Nc(viewGetPos, viewGetRatio);
        }
    }

    public void jf() {
        int i8 = e50.f3;
        int argb = Color.argb(200, Color.red(i8), Color.green(i8), Color.blue(i8));
        this.L8.setTextColor(argb);
        this.M8.setTextColor(argb);
        this.J8.setTextColor(argb);
        this.H8.setTextColor(argb);
        this.I8.setTextColor(argb);
        int i9 = e50.k7;
        float f8 = i9;
        this.L8.setTextSize(f8);
        this.M8.setTextSize(f8);
        float f9 = i9 - 1;
        this.J8.setTextSize(f9);
        this.H8.setTextSize(f9);
        this.I8.setTextSize(f9);
        Typeface h42 = e50.h4(e50.i7 ? e50.u7 : "sans-serif", 0);
        this.L8.setTypeface(h42);
        this.M8.setTypeface(h42);
        this.H8.setTypeface(h42);
        this.I8.setTypeface(h42);
        this.J8.setTypeface(h42);
    }

    public boolean k6(int action) {
        if (action == 5) {
            x5(null, false, true);
        } else {
            j6(action);
        }
        return true;
    }

    void k7() {
    }

    protected int kd(int progress) {
        if (progress >= this.qa.k()) {
            progress = this.qa.k() - 1;
        }
        if (progress < 0) {
            return 0;
        }
        return progress;
    }

    public boolean kg() {
        return e50.k5 || eg();
    }

    void l7(String nextFile) {
        if (!o50.A1(nextFile)) {
            o50.p2(this, nextFile + getString(R.string.not_exists));
            return;
        }
        if (!e50.V1.equals(nextFile)) {
            pe(true);
        }
        e50.V1 = nextFile;
        if (this.F2 != null) {
            ee();
        }
        e50.W();
        q5();
        r5();
        ma(false);
        if (!Ya()) {
            e50.K5(false);
        }
        Jd();
    }

    boolean lg() {
        if (com.flyersoft.baseapplication.z2.storeLevel > 1 || S.store == null || !nb() || e50.Q1.p == S.store || !o50.A1(h9()) || o50.F1(o50.p0(h9()))) {
            return false;
        }
        this.P3.setText("" + S.store.name() + "");
        return true;
    }

    void m8() {
        if (this.Tb) {
            com.flyersoft.discuss.z.getBookCommentCount(p8(), k8(), new a4());
        }
    }

    int m9() {
        int C;
        if (Za()) {
            return -1;
        }
        View view = e50.y8;
        ScrollView2 scrollView2 = this.T1;
        if (view != scrollView2) {
            scrollView2 = this.S1;
        }
        MRTextView n9 = n9();
        float width = scrollView2.getWidth() / 2;
        float height = scrollView2.getHeight() / 2;
        MotionEvent motionEvent = this.q9;
        if (motionEvent != null) {
            try {
                width = motionEvent.getX();
                height = this.q9.getY();
            } catch (Exception e8) {
                e50.S0(e8);
                return -1;
            }
        }
        int scrollY = scrollView2.getScrollY();
        int paddingLeft = scrollView2.getPaddingLeft();
        int paddingTop = (((int) height) + scrollY) - scrollView2.getPaddingTop();
        float f8 = width - paddingLeft;
        com.flyersoft.staticlayout.l layout = n9.getLayout();
        if (layout != null && (C = layout.C(paddingTop)) <= T8() - 1) {
            return n9.T(C, f8);
        }
        return -1;
    }

    protected void mf(boolean paused) {
        com.flyersoft.components.n nVar = this.t8;
        if (nVar != null) {
            nVar.u = paused;
        }
    }

    void n7(View v7) {
        Xf(v7);
    }

    public boolean nb() {
        f50 f50Var = e50.Q1;
        return (f50Var == null || f50Var.p == null || !(f50Var instanceof q50)) ? false : true;
    }

    void nd(float add) {
        com.radaee.pdfex.f fVar;
        PDFReader pDFReader = this.F2;
        if (pDFReader == null || (fVar = pDFReader.b) == null) {
            return;
        }
        float viewGetRatio = fVar.viewGetRatio() + add;
        f.c viewGetPos = this.F2.b.viewGetPos();
        this.F2.b.viewSetRatio(viewGetRatio, viewGetPos.b, viewGetPos.c, false);
    }

    public void o5() {
        Td();
        this.Ra = true;
    }

    public void o7() {
        if (Rh() || e50.P9) {
            return;
        }
        bc(1);
    }

    public long o8() {
        try {
            int q8 = q8();
            if (q8 == 1) {
                return this.C9 != null ? r0.getContentHeight() : this.P2.length();
            }
            if (q8 == 7) {
                return this.qa.k();
            }
            if (q8 != 100) {
                return e50.x7();
            }
            return E8();
        } catch (Exception e8) {
            e50.S0(e8);
            return 1L;
        }
    }

    public float o9(MotionEvent event) {
        return event.getX() + D4();
    }

    protected void oe(boolean forceVisible) {
        if (this.K2) {
            return;
        }
        if (!forceVisible) {
            if (e50.O9 || e50.P9) {
                return;
            }
            boolean z7 = this.u6;
            if (!z7 && e50.e4 < 3) {
                return;
            }
            if ((z7 && e50.e4 < 3 && e50.i4 < 3) || kb()) {
                return;
            }
        }
        za(true);
        View view = this.r2;
        if (view != null) {
            view.setAnimation(null);
        }
        ViewGroup viewGroup = this.y2;
        if (viewGroup != null) {
            viewGroup.setAnimation(null);
        }
        if (forceVisible || !Y9(this.y4, false)) {
            boolean z8 = this.T2 == H8() && !o50.I1(this.V2);
            if (!z8) {
                o50.f2(this.V2);
            }
            Bitmap bitmap = z8 ? this.V2 : null;
            if (!forceVisible) {
                this.a2.setAnimationState(false);
                if (bitmap == null) {
                    bitmap = O8(true, true);
                }
                this.i2.setBitmap1(bitmap);
                this.i2.o0 = 0;
            } else if (bitmap == null) {
                bitmap = O8(true, true);
            }
            if (bitmap != null) {
                this.i2.setImageBitmap(bitmap);
                if (this.v6 != 0.0f && e50.S4()) {
                    try {
                        this.i2.setBitmap1(bitmap.copy(bitmap.getConfig(), false));
                    } catch (OutOfMemoryError unused) {
                        System.gc();
                    }
                }
                this.i2.setVisibility(0);
                this.i2.invalidate();
                return;
            }
            e50.N5("*************saveFlipShot failed***********");
        }
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        StoreWebView storeWebView;
        super.onActivityResult(requestCode, resultCode, data);
        try {
            if (requestCode != 45001 && requestCode != 45002) {
                if (requestCode == 1) {
                    String str = e50.X1;
                    if (str != null) {
                        if (str.equals(e50.V1)) {
                            m7 m7Var = this.D6;
                            if (m7Var != null && this.E6.indexOf(m7Var) == -1) {
                                this.E6.add(0, this.D6);
                            }
                            int q8 = q8();
                            if (q8 == 0) {
                                tg(e50.f2, null);
                                Ih();
                            } else if (q8 != 1) {
                                if (q8 == 7) {
                                    vc((int) e50.f2, true);
                                    if (ab() && e50.h2 == 10000) {
                                        kh(e50.g2);
                                    }
                                    Ih();
                                } else if (q8 == 100) {
                                    this.O2 = false;
                                    this.k5 = false;
                                    Of(e50.g2, e50.h2, e50.f2, true);
                                    this.O2 = true;
                                }
                            } else if (e50.U5()) {
                                nh(this.Q1.a0(this.Q1.getLayout().B((int) e50.f2)));
                                Ih();
                            } else {
                                m7(e50.X1);
                            }
                        } else {
                            m7(e50.X1);
                        }
                    } else if (q8() == 0 && F7()) {
                        tg(e50.f2, null);
                    }
                    Td();
                }
                if (requestCode == 124) {
                    this.z1 = false;
                    this.a2.postInvalidate();
                }
                if (requestCode == 125) {
                    h5();
                }
                if (requestCode == 126 && nb()) {
                    Md();
                }
                if (requestCode == 127 && e50.o8 && e50.A2 && e50.Ba > System.currentTimeMillis() - 10000) {
                    e50.N5("******splashAd in dualPageMode: restart intent******");
                    ce();
                    return;
                }
                return;
            }
            if (requestCode == 45001 && (storeWebView = this.Jb) != null) {
                storeWebView.returnLoginToken();
            }
            com.flyersoft.seekbooks.q.v(false);
            if (com.flyersoft.seekbooks.q.d()) {
                o50.C(com.flyersoft.seekbooks.q.s());
                ActivityMain.G1();
                if (requestCode != 45002 || o50.F1(this.Eb)) {
                    return;
                }
                Xb(this.Eb);
            }
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    @Override
    public void onClick(View v7) {
        int i8;
        if (v7 == this.h2) {
            e7();
        }
        if (v7 == this.l2) {
            o50.b2(this, e50.Q1.h().get(e50.g2).s);
        }
        if (v7 == this.m2) {
            v7();
        }
        if (v7 == this.Y1) {
            W6();
        }
        if (v7 == this.j2) {
            X6();
        }
        if (v7 == this.p2) {
            bh(!this.B6);
        }
        if (v7 == this.k2) {
            h7();
        }
        if (v7 == this.F8) {
            j6(e50.o7);
        }
        if (v7 == this.K8 || v7 == this.L8 || v7 == this.M8) {
            j6(e50.p7);
        }
        if (v7 == this.J8) {
            j6(e50.q7);
        }
        if (v7 == this.L3) {
            if (!e50.M2 && L4()) {
                return;
            } else {
                h6();
            }
        }
        if (v7 == this.P3) {
            Yg();
        }
        if (v7 == this.Q3) {
            T6();
            za(true);
        }
        if (v7 == this.O3) {
            com.flyersoft.discuss.z.curChapterText = this.Q1.getText2();
            com.flyersoft.discuss.z.showShuPing(this, p8(), k8(), u8(), e50.z3(e50.V1));
        }
        if (v7 == this.N3) {
            com.flyersoft.discuss.z.curChapterText = this.Q1.getText2();
            com.flyersoft.discuss.z.addSubShuPing(this, p8(), k8(), u8(), e50.z3(e50.V1));
        }
        if (v7 == this.M3) {
            za(true);
        }
        if (v7 == this.d2) {
            f6(false);
        }
        if (v7 == this.v2) {
            t6();
        }
        if (v7 == this.K3) {
            a7();
        }
        if (v7 == this.c2) {
            r6();
        }
        if (v7 == this.g2) {
            za(true);
            Zc();
        }
        if (v7 == this.f2) {
            Lb();
            za(true);
        }
        if (v7 == this.e2) {
            if (this.w7 == null) {
                wa();
            }
            rg(true);
        }
        if (v7 == this.q7) {
            O9();
        }
        if (v7 == this.k7) {
            ag(null);
        }
        if (v7 == this.l7) {
            M9();
        }
        if (v7 == this.i7 && !o50.G1(com.flyersoft.seekbooks.n.a) && (i8 = com.flyersoft.seekbooks.n.b) > 0) {
            int i9 = i8 - 1;
            com.flyersoft.seekbooks.n.b = i9;
            y6(i9, false);
        }
        if (v7 == this.j7 && !o50.G1(com.flyersoft.seekbooks.n.a) && com.flyersoft.seekbooks.n.b < com.flyersoft.seekbooks.n.a.size() - 1) {
            int i10 = com.flyersoft.seekbooks.n.b + 1;
            com.flyersoft.seekbooks.n.b = i10;
            y6(i10, false);
        }
        if (v7 == this.m7) {
            r6();
            M9();
        }
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        e50.v = System.currentTimeMillis();
        this.q1 = true;
        e50.N5("-txt:onConfigurationChanged, isPaused:" + this.z1 + ", landscape:" + e50.g5());
        e50.t3(this);
        e50.ca = 0;
        if (Ae()) {
            return;
        }
        if (e50.C2 && e50.B2) {
            new Handler(Looper.getMainLooper()).postDelayed(new v4(), 50L);
        }
        if (SystemClock.elapsedRealtime() - this.r1 < 2000 && !isFinishing() && (this.s1 || e50.g5())) {
            e50.N5("===============multi window state changed, restart txt============");
            ce();
            return;
        }
        if (this.z1) {
            if (Aa() && this.O2) {
                e50.M5("******AUTO-SENSOR onConfigurationChanged in background******", true);
                Kd();
                return;
            }
            return;
        }
        if (Aa()) {
            if (this.F2 != null) {
                ee();
                return;
            } else {
                ce();
                return;
            }
        }
        try {
            this.W8 = null;
            this.V8 = null;
            Yd();
            this.u9 = false;
            this.G9 = -1;
            Xc(false);
            e50.va = SystemClock.elapsedRealtime();
            Z4();
            d5();
            if (this.O2) {
                if (!this.y6 && !j1) {
                    if (Aa()) {
                        if (this.x1 != -1 && System.currentTimeMillis() - this.x1 > 1000 && Da(e50.g2)) {
                            J5(e50.Q1.h().get(e50.g2).c);
                        }
                        Td();
                        this.O2 = false;
                        this.H1.removeCallbacksAndMessages(null);
                        this.H1.postDelayed(this, 10L);
                    }
                    Og(1, 150);
                }
                j1 = false;
                this.y6 = false;
                this.H1.removeCallbacksAndMessages(null);
                if (F7()) {
                    new g5(Looper.getMainLooper()).sendEmptyMessageDelayed(0, 100L);
                } else {
                    this.H1.postDelayed(this, 10L);
                }
            }
            if (e50.P9) {
                O6(false);
            }
            if (Ya() && this.F2 != null) {
                Lc();
                Yc(true);
            }
            if (this.R2 != null) {
                ka(true);
            }
            Me(true);
        } catch (Exception e8) {
            e50.S0(e8);
        }
        if (e50.V9 == 1 && e50.G4()) {
            Og(1, 100);
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        this.y1 = System.currentTimeMillis();
        e50.s6("-txt:onCreate");
        if (t5(savedInstanceState)) {
            return;
        }
        f5();
        super.onCreate(savedInstanceState);
        requestWindowFeature(1);
        a = this;
        int i8 = Build.VERSION.SDK_INT;
        if (i8 >= 11) {
            getWindow().addFlags(16777216);
            if (i8 >= 17) {
                e50.fa = true;
            }
        }
        if (i8 >= 21) {
            e50.F0(this);
            getWindow().setNavigationBarColor(ViewCompat.MEASURED_STATE_MASK);
            boolean booleanExtra = getIntent().getBooleanExtra("hasActTrans", false);
            this.o1 = booleanExtra;
            if (e50.c5 && ActivityMain.b0 != null) {
                this.n1 = booleanExtra;
            }
            setEnterSharedElementCallback(new g3());
        }
        Sd();
        setContentView(R.layout.show_txt);
        ma(true);
        initView();
        if (getIntent().getExtras() != null && getIntent().getExtras().getBoolean("noad")) {
            ActivityMain.b0 = null;
        } else {
            Handler handler = this.H1;
            handler.sendMessage(handler.obtainMessage(b1, 1, 0));
        }
        if (i8 >= 28) {
            getWindow().getDecorView().addOnAttachStateChangeListener(new k4());
        }
        new Thread(this).start();
        a();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    protected void onDestroy() {
        e50.s6("-txt:destroy");
        o50.f2(this.i2.d);
        o50.f2(this.i2.e);
        o50.f2(this.U2);
        o50.f2(this.V2);
        ContentLay contentLay = this.a2;
        if (contentLay != null) {
            contentLay.d();
        }
        FlipImageView flipImageView = this.i2;
        if (flipImageView != null) {
            flipImageView.setBitmap1(null);
            this.i2.setBitmap2(null);
        }
        this.O1 = -1;
        MediaPlayer mediaPlayer = this.lb;
        if (mediaPlayer != null) {
            mediaPlayer.stop();
        }
        uh();
        BroadcastReceiver broadcastReceiver = this.db;
        if (broadcastReceiver != null) {
            unregisterReceiver(broadcastReceiver);
            this.db = null;
            this.cb = null;
        }
        ProgressDialog progressDialog = this.G2;
        if (progressDialog != null) {
            progressDialog.dismiss();
        }
        super.onDestroy();
        o50.C(e50.h8);
        if (this.D1 || !o50.D1(ActivityMain.e) || SystemClock.elapsedRealtime() - ActivityMain.H0 <= 1000) {
            return;
        }
        e50.z6 = true;
        e50.e(this);
        startActivity(new Intent(this, (Class<?>) ActivityMain.class));
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        int i8 = 0;
        if (this.z1) {
            return false;
        }
        if (this.L2 && Ga(keyCode)) {
            return super.onKeyDown(keyCode, event);
        }
        this.A1 = true;
        yd();
        this.K1 = 0L;
        this.w4++;
        j5();
        if (pb(keyCode, event)) {
            return true;
        }
        this.v4 = false;
        if (keyCode == 4) {
            if (this.c3 > 0 && this.y2.getVisibility() == 0) {
                if (this.r2.getVisibility() == 0) {
                    int i9 = this.c3;
                    if (i9 == 6) {
                        i8 = this.d3 == 4 ? 4 : 2;
                    } else if (i9 == 4 || i9 == 5) {
                        i8 = 1;
                    }
                    Af(i8);
                    this.e3 = true;
                } else {
                    Af(-1);
                }
                return true;
            }
            if (O9() || wc(true, true) || J9() || yc() || M9()) {
                return true;
            }
            if (e50.P9) {
                O6(false);
                return true;
            }
            if (e50.O9) {
                if (this.I7) {
                    rg(false);
                } else {
                    Tg();
                }
                return true;
            }
            if (this.L2) {
                za(true);
                if (this.e3) {
                    this.e3 = false;
                    return true;
                }
                if (!e50.g5) {
                    return true;
                }
            }
            if (Pg()) {
                return true;
            }
            e50.z6 = true;
            this.v4 = true;
        }
        if (keyCode == 24 || keyCode == 92 || keyCode == 105) {
            if (e50.O9 || this.mb == 1) {
                return false;
            }
            if (e50.P9) {
                N4(-1, true);
                return true;
            }
            if (this.z4) {
                return true;
            }
            if (this.L2 && e50.k4) {
                J4(true);
                return true;
            }
        }
        if (keyCode == 25 || keyCode == 93 || keyCode == 106) {
            if (e50.O9 || this.mb == 1) {
                return false;
            }
            if (e50.P9) {
                N4(1, true);
                return true;
            }
            if (this.z4) {
                return true;
            }
            if (this.L2 && e50.k4) {
                J4(false);
                return true;
            }
        }
        if (q6(keyCode)) {
            this.v4 = false;
            return true;
        }
        if (Ga(keyCode)) {
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }

    @Override
    public boolean onKeyUp(int keyCode, KeyEvent event) {
        if (this.z1) {
            return false;
        }
        if (this.L2 && Ga(keyCode)) {
            return super.onKeyUp(keyCode, event);
        }
        this.w4 = 0;
        if (qb(keyCode, event)) {
            return true;
        }
        if (this.L2) {
            switch (keyCode) {
                case 19:
                case 20:
                case 21:
                case 22:
                case 23:
                    return false;
            }
        }
        if (keyCode != 3) {
            if (keyCode != 4) {
                if (keyCode != 27) {
                    if (keyCode == 82) {
                        if (e50.N4 == 15) {
                            za(false);
                        }
                        return true;
                    }
                    if (keyCode != 84) {
                        if (keyCode != 92) {
                            if (keyCode != 93) {
                                if (keyCode != 105) {
                                    if (keyCode != 106) {
                                        switch (keyCode) {
                                            case 21:
                                                if (e50.D4 != 15) {
                                                    return true;
                                                }
                                                break;
                                            case 22:
                                                if (e50.E4 != 15) {
                                                    return true;
                                                }
                                                break;
                                            case 23:
                                                if (e50.F4 != 15) {
                                                    return true;
                                                }
                                                break;
                                        }
                                    }
                                }
                            }
                            if (e50.O9 || this.mb == 1) {
                                return false;
                            }
                            if (e50.P9 || this.z4 || e50.A4 != 15) {
                                return true;
                            }
                        }
                        if (e50.O9 || this.mb == 1) {
                            return false;
                        }
                        if (e50.P9 || this.z4 || e50.z4 != 15) {
                            return true;
                        }
                    } else {
                        if (e50.M4 != 15) {
                        }
                        return true;
                    }
                } else if (e50.O4 != 15) {
                    return true;
                }
            } else if (this.v4) {
                if (e50.L4 == 15 && !Z7()) {
                    l6();
                }
                return true;
            }
        } else if (e50.G4 != 15) {
            return true;
        }
        if (Ga(keyCode)) {
            return true;
        }
        return super.onKeyUp(keyCode, event);
    }

    @Override
    public boolean onLongClick(final View v7) {
        if (v7 == this.M3 && e50.a) {
            M4(true, false);
        }
        if (v7 == this.e9) {
            n6(true);
            return true;
        }
        if (v7 == this.g9) {
            ig();
            if (e50.v6) {
                i6(true);
            } else {
                T5(this, true);
            }
            return true;
        }
        if (v7 == this.F8) {
            return k6(e50.r7);
        }
        if (v7 != this.K8 && v7 != this.L8 && v7 != this.M8) {
            if (v7 == this.J8) {
                return k6(e50.t7);
            }
            if (v7 != this.d2 || this.C9 == null) {
                return false;
            }
            f6(true);
            return true;
        }
        return k6(e50.s7);
    }

    @Override
    public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
        super.onMultiWindowModeChanged(isInMultiWindowMode);
        e50.N5("-txt:onMultiWindowModeChanged:" + isInMultiWindowMode + ", isPaused:" + this.z1 + ", landscape:" + e50.g5());
        this.r1 = SystemClock.elapsedRealtime();
        this.s1 = e50.g5();
        Td();
        this.Ra = true;
        if (!e50.g5() || isFinishing()) {
            return;
        }
        e50.N5("----------------multi window state changed, restart txt----------");
        ce();
    }

    @Override
    protected void onPause() {
        PDFReader pDFReader;
        super.onPause();
        this.z1 = true;
        this.B1 = System.currentTimeMillis();
        e50.K6 = System.currentTimeMillis();
        this.y6 = false;
        e50.s6("-txt:pause");
        try {
            if (!this.t1) {
                pe(true);
            }
            if (e50.o4 != 19 || !e50.O9) {
                vh();
            }
            ue();
            if (e50.P9) {
                O6(false);
            }
            if (this.c8) {
                e50.z6 = true;
                o50.C(e50.h8);
            } else {
                e50.z6 = false;
            }
            e50.y6 = false;
            e50.e(this);
            Ag();
            we();
            if (Ya() && (pDFReader = this.F2) != null) {
                pDFReader.b0 = true;
                if (e50.qa) {
                    e50.N5("****SAVE PDF DOCUMENT****");
                    e50.qa = false;
                    this.qa.I();
                    this.Ca = SystemClock.elapsedRealtime();
                } else {
                    kc();
                }
            }
            if (this.c8) {
                p5();
            }
            this.Q1.t();
            this.R1.t();
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    @Override
    public void onRequestPermissionsResult(int permsRequestCode, String[] permissions, int[] grantResults) {
    }

    @Override
    protected void onRestoreInstanceState(Bundle savedInstanceState) {
        e50.N5("-txt:onRestoreInstanceState");
        try {
            super.onRestoreInstanceState(savedInstanceState);
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    @Override
    protected void onResume() {
        PDFReader pDFReader;
        try {
            super.onResume();
            e50.N5("-txt:resume, isPaused:" + this.z1);
            this.u1 = e50.u3();
            this.v1 = e50.q3();
            this.w1 = getResources().getConfiguration().orientation;
            a = this;
            this.A1 = false;
            this.x1 = System.currentTimeMillis();
            this.Vb = System.currentTimeMillis();
            long currentTimeMillis = System.currentTimeMillis();
            this.C1 = currentTimeMillis;
            this.pb = currentTimeMillis;
            e50.L5 = SystemClock.elapsedRealtime();
            if (Ya() && (pDFReader = this.F2) != null) {
                pDFReader.b0 = false;
            }
            this.y6 = false;
            e50.t3(this);
            if (e50.t5) {
                Ze(e50.A5, false);
                Xe();
            }
            com.flyersoft.components.n nVar = this.t8;
            if (nVar != null) {
                nVar.t = 0;
                nVar.s = 10000.0f;
            }
            Ed();
            if (kg() && this.O2) {
                xh();
            }
            if (e50.X7) {
                dh();
            }
            if (e50.O9) {
                int i8 = this.Q1.P0;
                if (i8 != -1) {
                    kh(i8);
                }
                Ih();
                C4();
            }
            e50.R6(true);
            this.K1 = 0L;
            j5();
            Xc(false);
            Be();
            if (this.z1 && this.Q1 != null) {
                boolean rh = rh();
                if (this.Q1.getLayout() == null || rh) {
                    if (!e50.E()) {
                        e50.M5("******txtView.getLayout()==null or broken******" + this.Q1.getLayout() + ", broken:" + rh + ", lastPosition:" + e50.f2, true);
                    }
                    this.z1 = false;
                    q5();
                    Td();
                    if (q8() == 0) {
                        e50.f4().clear();
                    }
                    this.H1.removeCallbacksAndMessages(null);
                    this.H1.postDelayed(this, rh ? 500L : 250L);
                }
            }
            this.H1.sendEmptyMessageDelayed(Z0, 500L);
            this.z1 = false;
        } catch (Exception e8) {
            e50.S0(e8);
        }
        FrameLayout frameLayout = this.U1;
        if (frameLayout != null && frameLayout.getHeight() > 0) {
            e50.ca = this.U1.getHeight();
        }
        Handler handler = this.H1;
        handler.sendMessage(handler.obtainMessage(b1, 0, 0));
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        e50.N5("-txt:onSaveInstanceState");
        try {
            super.onSaveInstanceState(outState);
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    @Override
    protected void onStart() {
        if (Build.VERSION.SDK_INT >= 21 && !this.n1 && getWindow().getSharedElementEnterTransition() != null) {
            this.n1 = true;
        }
        e50.N5("-txt:onStart, hasTrans: " + this.n1);
        super.onStart();
        af();
        if (!this.O2) {
            e5();
        }
        if (e50.b()) {
            this.U1.postDelayed(new r5(), 100L);
        }
    }

    @Override
    protected void onStop() {
        e50.N5("-txt:stop");
        super.onStop();
        if (this.c8) {
            o50.C(e50.h8);
            return;
        }
        o50.i2(e50.h8, "" + System.currentTimeMillis());
    }

    @Override
    public boolean onTouch(View v7, MotionEvent event) {
        boolean z7;
        float f8;
        float f9;
        boolean z8;
        this.A1 = true;
        yd();
        int action = event.getAction();
        this.B5 = action;
        if (action == 1) {
            this.K1 = 0L;
            j5();
        }
        if (e50.S4() && X7()) {
            return true;
        }
        try {
            me(event);
            ie(event);
            e50.y8 = v7;
            if (this.C9 == null && !this.B6 && !Ya()) {
                z7 = false;
                boolean Ba = Ba();
                if (!Sg(v7, event)) {
                    return true;
                }
                if (!Ba && !z7 && Kb(event)) {
                    return true;
                }
                if (this.C9 == null && Ma(v7, event)) {
                    return true;
                }
                if (!Ba && this.C9 == null && !this.B6 && w6(v7, event)) {
                    hc(event);
                    return true;
                }
                float abs = Math.abs(o9(event) - this.u5);
                float abs2 = Math.abs(event.getY() - this.t5);
                int i8 = this.B5;
                if (i8 == 1) {
                    f8 = abs2;
                    f9 = abs;
                    if ((!(v7 instanceof ScrollView) || !R6(event)) && !B7()) {
                        this.r6 = 0L;
                        if (this.l6 <= 20 && f8 < e50.k0(10.0f) && f9 < e50.k0(10.0f) && SystemClock.elapsedRealtime() - this.s6 > 500) {
                            int i9 = this.C9 != null ? 200 : e50.T0;
                            if (this.m6 == -1 || SystemClock.elapsedRealtime() - this.m6 < i9) {
                                this.r6 = SystemClock.elapsedRealtime();
                                S6(event);
                                MRBookView mRBookView = this.C9;
                                if (mRBookView != null) {
                                    mRBookView.f = SystemClock.elapsedRealtime();
                                }
                            }
                        } else if (this.H5) {
                            this.u6 = true;
                            bc(this.G5 > 0.0f ? -1 : 1);
                            e50.da = true;
                            z8 = true;
                            this.s6 = 0L;
                            this.l6 = 0;
                            this.F5 = -1.0f;
                            this.E5 = -1.0f;
                            this.D5 = -1.0f;
                            Wf(false);
                            if (z8) {
                                return true;
                            }
                        }
                        z8 = false;
                        this.s6 = 0L;
                        this.l6 = 0;
                        this.F5 = -1.0f;
                        this.E5 = -1.0f;
                        this.D5 = -1.0f;
                        Wf(false);
                        if (z8) {
                        }
                    }
                } else if (i8 != 2) {
                    f8 = abs2;
                    f9 = abs;
                } else {
                    if (this.Y5 && !this.N5) {
                        return false;
                    }
                    if (!this.K2 && SystemClock.elapsedRealtime() - this.s6 > 500) {
                        if (e50.t5 && M6(event)) {
                            return true;
                        }
                        if (e50.x5 && N6(event)) {
                            return true;
                        }
                        if (!this.L2 && this.l6 > 10) {
                            fg(true);
                        }
                    }
                    if (this.S4) {
                        return true;
                    }
                    if (!Ba && !z7 && db(abs, abs2, event)) {
                        return true;
                    }
                    f8 = abs2;
                    f9 = abs;
                    g5(v7, event, z7, Ba, abs, f8);
                }
                if (!Ba && !z7) {
                    na();
                    if (this.n6.onTouchEvent(event)) {
                        return true;
                    }
                    if (this.B5 == 2) {
                        if (Ha()) {
                            return true;
                        }
                        if (Ia() && !Ta(event)) {
                            return true;
                        }
                        if (!e50.da && f9 > f8 * 0.7d) {
                            return true;
                        }
                        if (this.r6 != 0) {
                            if (f8 < e50.k0(5.0f)) {
                                return true;
                            }
                            this.r6 = 0L;
                        }
                        if (f9 != 0.0f || f8 != 0.0f) {
                            e50.da = true;
                        }
                        this.C4.clear();
                        if (f8 > e50.k0(5.0f)) {
                            se(event);
                        }
                    }
                } else if (Ya()) {
                    if (e50.t3) {
                        na();
                        if (this.n6.onTouchEvent(event)) {
                            return true;
                        }
                    }
                    hc(event);
                }
                if (this.B5 == 1 && (v7 instanceof ScrollView) && !this.L2) {
                    fg(false);
                }
                return false;
            }
            z7 = true;
            boolean Ba2 = Ba();
            if (!Sg(v7, event)) {
            }
        } catch (Throwable th) {
            e50.S0(th);
            return true;
        }
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        try {
            if (Kb(event)) {
                return true;
            }
            int action = event.getAction();
            if (action == 0) {
                this.j6 = o9(event);
                this.i6 = event.getY();
                this.k6 = true;
            } else if (action != 1) {
                if (action == 2 && (Math.abs(event.getY() - this.i6) > 10.0f || Math.abs(o9(event) - this.j6) > 10.0f)) {
                    this.x5 = false;
                    this.k6 = false;
                    J9();
                }
            } else if (!B7()) {
                if (this.k6) {
                    S6(event);
                }
                this.k6 = false;
            }
            return true;
        } catch (Exception e8) {
            e50.S0(e8);
            return true;
        }
    }

    public void p7() {
        if (Sh() || e50.P9) {
            return;
        }
        if (e50.e4 > 2) {
            ud();
        }
        bc(-1);
    }

    public void pd(String file) {
        e50.N5("play mp3:" + file);
        this.nb = file;
        qa();
        this.fb.setVisibility(0);
        Ib();
        this.a2.postInvalidate();
    }

    public void pe(boolean saveToFile) {
        if (this.d8) {
            return;
        }
        if (Ya()) {
            if (this.F2 == null || !saveToFile) {
                return;
            }
            Rc();
            return;
        }
        qe(saveToFile, false);
    }

    boolean q6(int keyCode) {
        int i8;
        int i9;
        if (keyCode == 3) {
            return j6(e50.G4);
        }
        if (keyCode == 4) {
            return (e50.P9 || e50.O9 || !j6(e50.L4)) ? false : true;
        }
        if (keyCode == 27) {
            return j6(e50.O4);
        }
        if (keyCode == 82) {
            return j6(e50.N4);
        }
        if (keyCode != 84) {
            if (keyCode != 92) {
                if (keyCode != 93) {
                    if (keyCode != 105) {
                        if (keyCode != 106) {
                            switch (keyCode) {
                                case 19:
                                    return j6(e50.B4);
                                case 20:
                                    return j6(e50.C4);
                                case 21:
                                    return j6(e50.D4);
                                case 22:
                                    return j6(e50.E4);
                                case 23:
                                    return j6(e50.F4);
                                case 24:
                                    break;
                                case 25:
                                    break;
                                default:
                                    return false;
                            }
                        }
                    }
                }
                if (this.L2) {
                    return false;
                }
                if (e50.ea && e50.f5 && ((i9 = e50.A4) == 1 || i9 == 0)) {
                    N9();
                }
                if (e50.z4 != 20) {
                    return j6(e50.A4);
                }
                Ze(e50.A5 - 1, true);
                return true;
            }
            if (this.L2) {
                return false;
            }
            if (e50.ea && e50.f5 && ((i8 = e50.z4) == 0 || i8 == 1)) {
                N9();
            }
            int i10 = e50.z4;
            if (i10 != 20) {
                return j6(i10);
            }
            Ze(e50.A5 + 1, true);
            return true;
        }
        if (!e50.O9 || e50.M4 == 19) {
            return j6(e50.M4);
        }
        rg(true);
        return true;
    }

    public int q8() {
        if (this.O1 == -1) {
            this.O1 = e50.G1();
        }
        return this.O1;
    }

    void qa() {
        this.mb = 0;
        if (this.fb != null) {
            this.ib.setText("00:00");
            this.jb.setText("00:00");
            this.gb.setImageResource(R.drawable.tts_play);
            this.lb.stop();
            return;
        }
        View inflate = ((ViewStub) findViewById(R.id.mp3Stub)).inflate();
        this.fb = inflate;
        this.gb = (ImageView) inflate.findViewById(R.id.imageView1);
        this.hb = (ImageView) this.fb.findViewById(R.id.imageView2);
        this.ib = (TextView) this.fb.findViewById(R.id.time1);
        this.jb = (TextView) this.fb.findViewById(R.id.time2);
        SeekBar seekBar = (SeekBar) this.fb.findViewById(R.id.seekBar1);
        this.kb = seekBar;
        seekBar.setThumb(null);
        this.lb = new MediaPlayer();
        this.gb.setOnClickListener(new p1());
        this.hb.setOnClickListener(new q1());
        this.kb.setOnSeekBarChangeListener(new r1());
        this.lb.setOnCompletionListener(new s1());
    }

    public void qe(boolean saveToFile, boolean ignoreZero) {
        if (this.d8 || SystemClock.elapsedRealtime() - this.N1 < 2000 || this.I1) {
            return;
        }
        if ((this.z4 && !saveToFile) || this.Q1 == null || rh()) {
            return;
        }
        boolean z7 = true;
        if (!this.A1 && (System.currentTimeMillis() - this.x1 < Constants.MINIMAL_AD_INTERVAL || System.currentTimeMillis() - this.y1 < Constants.MINIMAL_AD_INTERVAL)) {
            if (saveToFile) {
                e50.N5("=================force NOT saveToFile=============");
                return;
            }
            return;
        }
        MRBookView mRBookView = this.C9;
        if (mRBookView == null) {
            com.flyersoft.staticlayout.l layout = this.Q1.getLayout();
            if (layout == null || !this.O2) {
                saveToFile = false;
            } else {
                int I = layout.I(layout.C(this.S1.getScrollY()));
                if (q8() == 0) {
                    e50.f2 = e50.d4(I);
                } else {
                    e50.f2 = I;
                }
                if (!saveToFile || (ignoreZero && I == 0)) {
                    z7 = false;
                }
                saveToFile = z7;
            }
        } else {
            e50.j2 = e50.M3 ? mRBookView.getScrollX() : mRBookView.getScrollY();
        }
        if (saveToFile && !this.K2 && this.s8 == -1) {
            SharedPreferences.Editor edit = getSharedPreferences(e50.r0, 0).edit();
            edit.putString(e50.V1.toLowerCase(), e50.g2 + "@" + e50.h2 + "#" + e50.f2 + ":" + P8());
            if (this.C9 != null) {
                edit.putInt(e50.V1.toLowerCase() + 2, e50.j2);
            }
            edit.apply();
        }
    }

    void r7() {
        int indexOf = e50.x2().indexOf(e50.V1);
        if (indexOf > 1) {
            String str = e50.x2().get(indexOf - 1);
            o50.q2(this, o50.v0(str), 1);
            l7(str);
            return;
        }
        o50.q2(this, getString(R.string.no_prior_file), 1);
    }

    public boolean rb(int edge, MotionEvent event) {
        int F8 = F8();
        int width = this.U1.getWidth();
        int height = this.U1.getHeight();
        float o9 = o9(event);
        float y7 = event.getY();
        if (edge == 0) {
            float f8 = F8;
            return o9 < f8 && this.u5 < f8;
        }
        if (edge == 1) {
            float f9 = width - F8;
            return o9 > f9 && this.u5 > f9;
        }
        if (edge != 2) {
            float f10 = height - F8;
            return y7 > f10 && this.t5 > f10;
        }
        float f11 = F8;
        return y7 < f11 && this.t5 < f11;
    }

    public int rc() {
        com.radaee.pdfex.f fVar;
        PDFReader pDFReader = this.F2;
        if (pDFReader != null && !pDFReader.c && (fVar = pDFReader.b) != null) {
            this.ya = fVar.viewGetCurPageNo();
        } else {
            this.ya = (int) e50.f2;
        }
        int i8 = this.ya;
        return i8 == -1 ? (int) e50.f2 : i8;
    }

    public void rd(String file) {
        this.z1 = true;
        this.a2.invalidate();
        Intent intent = new Intent(this, (Class<?>) MediaAct.class);
        intent.putExtra("video", file);
        startActivityForResult(intent, 124);
    }

    public m7 re(boolean addToList) {
        String sb;
        String str = "";
        pe(false);
        try {
            if (Ya()) {
                int i8 = PDFReader.a;
                if (i8 >= 0) {
                    e50.f2 = i8;
                } else {
                    e50.f2 = rc();
                }
                sb = getString(R.string.page) + " " + (e50.f2 + 1);
            } else {
                if (this.Q1.getText2().length() == 0) {
                    return null;
                }
                int I = this.Q1.getLayout().I(this.Q1.getLayout().C(this.S1.getScrollY()));
                if (I == 0 && nb()) {
                    I = e50.Q1.h().get(e50.g2).c.length() + 1;
                }
                String str2 = this.Q1.getText2().substring(I).replace("\n", "").replace(e50.H9, ' ').trim() + "...";
                int i9 = e50.H8 ? 15 : 20;
                if (str2.length() > i9) {
                    str2 = str2.substring(0, i9);
                }
                StringBuilder sb2 = new StringBuilder();
                if (!nb()) {
                    str = "(" + P8() + ") ";
                }
                sb2.append(str);
                sb2.append(str2);
                sb = sb2.toString();
            }
            String str3 = sb;
            Iterator<m7> it = this.E6.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                m7 next = it.next();
                if (next.a.equals(str3)) {
                    this.E6.remove(next);
                    break;
                }
            }
            m7 m7Var = new m7(str3, e50.V1, e50.g2, e50.h2, e50.f2);
            this.D6 = m7Var;
            if (addToList) {
                this.E6.add(0, m7Var);
                return this.D6;
            }
        } catch (Throwable th) {
            e50.S0(th);
        }
        return null;
    }

    void rf(int value, boolean verify, boolean post) {
        int i8;
        wd();
        if (verify && (((i8 = this.y4) == 1 && value > 0) || (i8 == -1 && value < 0))) {
            this.u5 = this.q9.getX();
            value = 0;
        }
        int abs = Math.abs(value);
        int width = this.U1.getWidth();
        this.U1.getHeight();
        if (abs > 0) {
            He(false);
        }
        int i9 = e50.S4() ? e50.i4 : e50.e4;
        if (i9 == 3) {
            int i10 = this.y4;
            if (i10 == 1) {
                int i11 = width - abs;
                ScrollView2.c(0, i11, i10);
                this.La.d(-abs, 0.0f, post);
                this.S1.d(i11, 0.0f, post);
            } else {
                ScrollView2.c(abs, width, i10);
                this.La.d(abs, 0.0f, post);
                this.S1.d(abs - width, 0.0f, post);
            }
        }
        if (i9 == 6) {
            int i12 = this.y4;
            if (i12 == 1) {
                ScrollView2.c(0, width - abs, i12);
                this.La.d(-abs, 0.0f, post);
                this.S1.d(0.0f, 0.0f, post);
            } else {
                ScrollView2.c(abs, width, i12);
                this.La.d(0.0f, 0.0f, post);
                this.S1.d(abs - width, 0.0f, post);
            }
        }
    }

    @Override
    public void run() {
        this.Q8 = -1L;
        this.O1 = -1;
        e50.v = 0L;
        this.H1.sendEmptyMessageDelayed(o0, 60000L);
        int q8 = q8();
        if (q8 == 0) {
            if (e50.f4().size() == 0) {
                Ab(e50.V1);
            }
            this.H1.sendEmptyMessageDelayed(101, b9());
            return;
        }
        if (q8 == 1) {
            if (this.P2.equals("") && !e50.g7) {
                Ab(e50.V1);
            }
            this.H1.sendEmptyMessageDelayed(102, b9());
            return;
        }
        if (q8 == 7) {
            Ab(e50.V1);
            this.H1.sendEmptyMessageDelayed(105, b9());
        } else {
            if (q8 != 100) {
                return;
            }
            if (e50.Q1 == null) {
                Ab(e50.V1);
            }
            this.H1.sendEmptyMessageDelayed(103, b9());
        }
    }

    void s7() {
        za(true);
        if (Ya()) {
            if (this.F2.c) {
                hd(true);
            }
            fd();
            return;
        }
        ag(null);
    }

    public String sc(int i8) {
        try {
            Page j8 = this.qa.j(i8);
            j8.P();
            String O = j8.O(0, j8.K());
            return O == null ? "" : O;
        } catch (Exception e8) {
            e50.S0(e8);
            return "";
        }
    }

    public boolean t5(Bundle savedInstanceState) {
        if (!o50.D1(a)) {
            try {
                e50.N5("--------->>>Prior ActivityTxt isn't null, close it");
                ActivityTxt activityTxt = a;
                if (!activityTxt.z1 && activityTxt.Q1 != null) {
                    activityTxt.qe(true, true);
                    e50.N5("==========>>>Save Prior TXT");
                }
                if (e50.P9) {
                    a.P6(false, false);
                }
                if (e50.O9) {
                    a.Ug(false);
                }
                e50.O9 = false;
                e50.P9 = false;
                a.finish();
                a = null;
            } catch (Exception e8) {
                e50.S0(e8);
            }
        }
        return false;
    }

    void t7(int tab) {
        String str = null;
        try {
            int q8 = q8();
            if (q8 == 0 || q8 == 1) {
                if (e50.Y3().size() == 0) {
                    str = getString(R.string.no_chapter_found);
                }
            } else if (q8 != 7) {
                if (q8 == 100 && e50.Q1.h().size() == 0) {
                    str = getString(R.string.no_chapter_found);
                }
            } else {
                tc();
                if (this.wa.size() == 0) {
                    str = getString(R.string.no_chapter_found);
                }
            }
            a = this;
            PrefChapters prefChapters = new PrefChapters(this, tab, new p6(), false);
            this.i8 = prefChapters;
            prefChapters.setOnDismissListener(new q6());
            this.i8.show();
            e50.da = false;
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    protected void tb() {
        View view = this.w7;
        if (view == null) {
            return;
        }
        this.P7 = true;
        view.setAnimation(null);
        this.w7.setVisibility(0);
        this.e2.setVisibility(8);
        this.I7 = true;
    }

    protected void tg(long position, String veri) {
        int i8;
        if (q8() != 0) {
            return;
        }
        int b42 = (int) e50.b4(position, true);
        try {
            if (e50.f4().size() <= 0 || (i8 = e50.i2) < 0 || i8 >= e50.f4().size()) {
                return;
            }
            String Q = e50.Q(e50.y1(e50.i2));
            if (this.K2) {
                this.K2 = false;
                if (Q.equals(this.Q1.getText().toString())) {
                    return;
                }
                pe(false);
                long j8 = e50.f2;
            }
            ph(Q);
            if (veri != null && Q.length() > veri.length() + b42) {
                String substring = Q.substring(b42, veri.length() + b42);
                if (!substring.equals(veri)) {
                    e50.N5("showTxtByPosition veri error, cur [" + substring + "], should be [" + veri + "]");
                    int lastIndexOf = Q.lastIndexOf(veri, b42);
                    if (lastIndexOf != -1 && b42 - lastIndexOf > 200) {
                        lastIndexOf = -1;
                    }
                    int indexOf = Q.indexOf(veri, b42);
                    if (indexOf - b42 > 200) {
                        indexOf = -1;
                    }
                    if (lastIndexOf == -1 || indexOf == -1) {
                        if (lastIndexOf == -1) {
                        }
                        b42 = lastIndexOf;
                    } else {
                        if (b42 - lastIndexOf < indexOf - b42) {
                            b42 = lastIndexOf;
                        }
                        b42 = indexOf;
                    }
                }
            }
            if (b42 > Q.length() - 1) {
                b42 = Q.length() - 1;
            }
            com.flyersoft.staticlayout.l layout = this.Q1.getLayout();
            if (this.O2 && layout != null) {
                lh(b42);
            } else {
                hh(b42);
            }
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    protected void v5(Message msg) {
        String str = msg.arg1 == 1 ? this.Z5 : this.c6;
        Object obj = msg.obj;
        if (obj != null && (obj instanceof f50.f)) {
            str = ((f50.f) obj).c;
        }
        if (str == null) {
            return;
        }
        if (str.startsWith("<h3>")) {
            str = str.substring(str.indexOf("</h3>") + 5);
        }
        String obj2 = Html.fromHtml(str).toString();
        while (obj2.indexOf("\n\n") != -1) {
            obj2 = obj2.replace("\n\n", "\n");
        }
        while (obj2.length() > 0 && obj2.charAt(0) == '\n') {
            obj2 = obj2.substring(1);
        }
        while (obj2.length() > 0 && obj2.charAt(obj2.length() - 1) == '\n') {
            obj2 = obj2.substring(0, obj2.length() - 1);
        }
        w5(obj2);
    }

    int v8() {
        com.flyersoft.staticlayout.l layout = this.Q1.getLayout();
        if (layout == null) {
            return 0;
        }
        pe(false);
        return layout.I(layout.C(this.S1.getScrollY()));
    }

    protected void vc(int i8, boolean sameRatio) {
        try {
            int kd = kd(i8);
            PDFReader pDFReader = this.F2;
            if (pDFReader.c) {
                this.Q1.setText(mc(kd));
            } else if (sameRatio) {
                f.c viewGetPos = pDFReader.b.viewGetPos();
                Mc(viewGetPos);
                viewGetPos.a = kd;
                this.F2.b.viewGoto(viewGetPos);
            } else {
                pDFReader.b.viewGotoPage(kd);
            }
            e50.f2 = kd;
        } catch (Exception e8) {
            e50.S0(e8);
        }
    }

    protected void vd() {
        if (e50.s9 != null) {
            return;
        }
        runOnUiThread(new y6());
    }

    public void vg() {
    }

    public void vh() {
        SensorManager sensorManager = this.u8;
        if (sensorManager != null) {
            sensorManager.unregisterListener(Z8());
        }
    }

    protected void w7(boolean lookup) {
        MRBookView mRBookView = this.C9;
        if (mRBookView != null) {
            mRBookView.g();
            return;
        }
        za(true);
        xe(false);
        if (lookup) {
            Gb();
        }
    }

    protected int w9(int progress) {
        if (progress > 30) {
            return ((progress - 30) * 2) + 30;
        }
        if (progress > 0) {
            return progress;
        }
        return 1;
    }

    protected boolean wc(boolean hideTop, boolean hideBottom) {
        View view;
        View view2;
        boolean z7 = false;
        if (!Ya()) {
            return false;
        }
        if (hideBottom && (view2 = this.S9) != null && view2.getVisibility() == 0) {
            this.S9.setVisibility(8);
            z7 = true;
        }
        if (!hideTop || (view = this.R9) == null || view.getVisibility() != 0) {
            return z7;
        }
        this.R9.setVisibility(8);
        return true;
    }

    public void x5(String bookmark, boolean createNewAfterDeleteOld, boolean ask) {
        int L1 = e50.L1(e50.V1);
        e50.k kVar = L1 == -1 ? new e50.k(e50.V1) : e50.J1().get(L1);
        if (L1 == -1) {
            e50.J1().add(kVar);
        }
        if (Ya()) {
            e50.f2 = rc();
        }
        boolean z7 = false;
        pe(false);
        Iterator<e50.j> it = kVar.b.iterator();
        while (it.hasNext()) {
            e50.j next = it.next();
            if (next.c == e50.f2 && (Ya() || (next.d == e50.g2 && next.e == e50.h2))) {
                kVar.a(next);
                z7 = true;
                break;
            }
        }
        if (!z7 || createNewAfterDeleteOld) {
            if (bookmark == null) {
                bookmark = "(" + z5() + ") " + b8();
            }
            if (ask && e50.S2) {
                new com.flyersoft.seekbooks.d(this, bookmark, new r6(kVar), null);
            } else {
                y5(kVar, bookmark);
            }
        }
        e50.h7 = true;
        if (Dh()) {
            return;
        }
        this.a2.postInvalidate();
    }

    protected void xg() {
        Drawable z12;
        if ((K4() || !(Ya() || e50.C5())) && (z12 = e50.z1(e50.V1)) != null) {
            FlipImageView flipImageView = this.i2;
            this.L1 = true;
            flipImageView.q0 = true;
            flipImageView.setBackgroundDrawable(null);
            this.i2.setImageDrawable(z12);
            this.i2.setVisibility(0);
            this.a2.setVisibility(4);
            this.U1.setBackgroundDrawable(null);
        }
    }

    public void yb() {
        int i8;
        int i9;
        int top = this.j9.getTop();
        int top2 = this.k9.getTop();
        if (top > top2) {
            top2 = top;
            top = top2;
        }
        int height = this.j9.getHeight();
        int height2 = this.c9.getHeight();
        int lineHeight = this.Q1.getLineHeight() + height2;
        if (top > e50.k0(20.0f) + lineHeight) {
            i8 = top - (lineHeight + e50.k0(15.0f));
        } else {
            i8 = (this.U1.getHeight() - top2) - height > height2 + (-24) ? height + top2 : ((top + height) + ((((top2 - top) - height) - height2) / 2)) - (height / 5);
        }
        int width = this.c9.getWidth();
        if (Za() || this.n9.getVisibility() != 0) {
            i9 = -1;
        } else {
            i9 = D9();
            width -= i9;
        }
        int I8 = I8();
        if (this.l9 == null) {
            this.l9 = this.j9.getTop() > this.k9.getTop() ? this.j9 : this.k9;
        }
        if (i8 < e50.k0(2.0f) || i8 > (this.U1.getHeight() - height2) - e50.k0(1.0f)) {
            i8 = (e50.r3() - height2) / 2;
        }
        if ((i8 < top && i8 + height2 > top) || (i8 < top2 && i8 + height2 > top2)) {
            int left = this.j9.getLeft();
            int left2 = this.k9.getLeft();
            if (left <= left2) {
                left2 = left;
                left = left2;
            }
            if (left - left2 < this.j9.getWidth() + width) {
                if (left2 > width) {
                    I8 = left2 - width;
                } else if (left < (this.U1.getWidth() - width) - this.j9.getWidth()) {
                    I8 = left + this.j9.getWidth();
                } else if (top > this.U1.getHeight() - top2) {
                    i8 = e50.k0(2.0f);
                } else {
                    i8 = (this.U1.getHeight() - height2) - e50.k0(1.0f);
                }
            }
        }
        int i10 = width + I8;
        int i11 = height2 + i8;
        this.c9.layout(I8, i8, i10, i11);
        if (i9 != -1 && D9() > i9) {
            this.c9.layout(I8, i8, i10 - (D9() - i9), i11);
        }
        this.n9.setTag(0);
        Te(false);
        Ue(Za() ? 0 : 8);
        Bg();
    }

    public String z5() {
        if (nb()) {
            return e50.Q1.h().get(e50.g2).c;
        }
        if (!Ya()) {
            return P8();
        }
        return (e50.f2 + 1) + com.ksdk.ssds.manager.b.b + this.qa.k();
    }

    public void z7(View v7, boolean showPanel) {
        this.q8 = false;
        if (showPanel) {
            tb();
        }
        if (v7 == this.C7) {
            ah(true);
            this.L7 = true;
            gh();
            this.F6 = -1;
            Ig();
        }
        if (v7 == this.D7) {
            ah(true);
            this.L7 = true;
            gh();
            this.F6 = -1;
            Hg();
        }
        if (v7 == this.x7) {
            Tg();
        }
        if (v7 == this.y7) {
            ah(true);
            e50.N5("tts_utteranceId 1:" + this.Q6);
            int i8 = this.Q6;
            if (i8 > -1) {
                int i9 = i8 - 1;
                this.Q6 = i9;
                this.R6 = i9;
                he();
            } else {
                this.K7 = true;
                this.L7 = true;
                gh();
                Ig();
            }
        }
        if (v7 == this.z7) {
            if (this.J7) {
                he();
            } else {
                fc();
            }
        }
        if (v7 == this.A7) {
            ah(true);
            if (this.K6 != null && this.Q6 < r7.size() - 2) {
                int i10 = this.Q6 + 1;
                this.Q6 = i10;
                this.R6 = i10;
                he();
            } else {
                this.L7 = true;
                if (this.N6 != null) {
                    gh();
                    Hg();
                }
            }
        }
        if (v7 == this.B7) {
            Ef();
        }
        if (v7 == this.E7) {
            e50.p6 = 10;
            fh(10);
            e50.q6 = 10;
            this.H7.setProgress(10);
            of();
            if (e50.O9) {
                he();
            }
        }
    }

    public void za(boolean forceHide) {
        xh();
        S9();
        yc();
        M9();
        if (this.K2) {
            if (forceHide || new File(e50.V1).length() <= e50.U0) {
                return;
            }
            this.J2 = true;
            o50.p2(this, getString(R.string.loading_info));
            return;
        }
        if (!this.L2) {
            e50.ca = this.U1.getHeight();
        }
        if (forceHide || this.M2 == 0 || SystemClock.elapsedRealtime() - this.M2 > 500) {
            boolean z7 = this.L2;
            if (z7 || forceHide) {
                if (z7) {
                    ge(true);
                    if (e50.f5 && !e50.E2) {
                        getWindow().clearFlags(2048);
                    }
                    if (this.r2.getVisibility() == 0) {
                        wb();
                    }
                    gd(false);
                    dd(false);
                    nf(8);
                    Ge(false);
                    this.L2 = false;
                    this.M2 = SystemClock.elapsedRealtime();
                    e50.R6(true);
                    Xc(false);
                    e50.da = this.K5;
                    return;
                }
                return;
            }
            if (e50.P9) {
                O6(false);
            }
            if (e50.O9) {
                Tg();
            }
            if (e50.f5 && !e50.E2) {
                getWindow().addFlags(2048);
            }
            if (va(true)) {
                this.e3 = false;
                Me(true);
                Ke();
                ge(false);
                Xc(true);
                Qe(true);
                nf(0);
                xb();
                gd(true);
                dd(true);
                Ge(true);
                this.L2 = true;
                hg();
                this.M2 = SystemClock.elapsedRealtime();
                K9();
                Bf();
                e50.R6(false);
                this.j5 = 0L;
                e50.da = this.K5;
                e50.O6(this, true);
            }
        }
    }

    public void zb() {
        this.c2.setImageResource(R.drawable.linkback_button);
        this.c2.setVisibility(0);
    }

    protected void zf(int progress) {
        int i8;
        boolean z7;
        String str;
        try {
            int q8 = q8();
            if (q8 == 0) {
                tg((e50.x7() * progress) / 1000, null);
            } else if (q8 != 1) {
                if (q8 == 100) {
                    if (nb()) {
                        int size = (e50.Q1.h().size() * progress) / 1000;
                        e50.g2 = size;
                        if (size > e50.Q1.h().size() - 1) {
                            e50.g2 = e50.Q1.h().size() - 1;
                        }
                        Of(e50.g2, 0, 0L, true);
                    } else {
                        long E8 = (E8() * (progress - 1)) / 1000;
                        long j8 = 0;
                        while (i8 < e50.Q1.h().size()) {
                            int i9 = e50.Q1.h().get(i8).q;
                            long j9 = i9 > 0 ? i9 : e50.Q1.h().get(i8).h;
                            if (j9 <= 0) {
                                j9 = 1;
                            }
                            j8 += j9;
                            i8 = (j8 <= E8 && i8 != e50.Q1.h().size() - 1) ? i8 + 1 : 0;
                            long j10 = j9 - (j8 - E8);
                            if (e50.Q1.y() && i9 < 0) {
                                j10 = (o50.q1(e50.Q1.g(i8)).length() * j10) / j9;
                            }
                            if (progress == 1000) {
                                e50.f2 = j8;
                            } else {
                                e50.f2 = j10 % e50.Z7;
                            }
                            if (e50.g2 != i8) {
                                this.z4 = true;
                                e50.g2 = i8;
                                int i10 = e50.Z7;
                                e50.h2 = j10 < ((long) i10) ? 0 : (int) (j10 / i10);
                                if (Da(i8)) {
                                    J5(e50.Q1.h().get(i8).c);
                                }
                                Jd();
                                return;
                            }
                            int g9 = g9(j10);
                            if (e50.U5() && g9 == e50.h2) {
                                z7 = false;
                                if (!z7) {
                                    e50.h2 = g9;
                                    StringBuilder sb = new StringBuilder();
                                    sb.append(e50.Q1.h().get(i8).c);
                                    sb.append(" (");
                                    sb.append(g9 + 1);
                                    if (e50.U5()) {
                                        str = "";
                                    } else {
                                        str = com.ksdk.ssds.manager.b.b + e50.G9.size();
                                    }
                                    sb.append(str);
                                    sb.append(")");
                                    J5(sb.toString());
                                    Jd();
                                    return;
                                }
                                Of(e50.g2, g9, e50.f2, z7);
                                return;
                            }
                            z7 = true;
                            if (!z7) {
                            }
                        }
                    }
                }
            } else if (e50.U5()) {
                nh((this.Q1.getRealHeight() * progress) / 1000);
            } else {
                int length = (int) ((this.P2.length() * progress) / 1000);
                int i11 = length / e50.Z7;
                if (i11 < e50.G9.size() && e50.G9.size() > 0 && i11 >= 0) {
                    e50.h2 = i11;
                    String str2 = e50.G9.get(i11);
                    this.n5 = str2;
                    String Q = e50.Q(str2);
                    this.n5 = Q;
                    ph(com.flyersoft.staticlayout.j.c(Q, G5(), -1));
                    int i12 = length % e50.Z7;
                    Handler handler = this.F4;
                    handler.sendMessageDelayed(handler.obtainMessage(2, Integer.valueOf(i12)), 100L);
                }
            }
        } catch (Exception e8) {
            e50.S0(e8);
        }
        this.z4 = false;
    }
}