QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

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


package com.tencent.mtt.external.reader.dex.base;

import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.SparseIntArray;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import com.huawei.hms.actions.SearchIntents;
import com.tencent.common.featuretoggle.FeatureToggle;
import com.tencent.common.http.ContentType;
import com.tencent.common.http.MttRequestBase;
import com.tencent.common.threadpool.BrowserExecutorSupplier;
import com.tencent.common.utils.FileUtils;
import com.tencent.common.utils.StringUtils;
import com.tencent.common.utils.TbsMode;
import com.tencent.common.utils.UrlUtils;
import com.tencent.mtt.R;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.utils.PlatformStatUtils;
import com.tencent.mtt.base.webview.common.FindListener;
import com.tencent.mtt.base.wup.PreferenceData;
import com.tencent.mtt.browser.bookmark.engine.Bookmarks;
import com.tencent.mtt.browser.engine.clipboard.ClipboardManager;
import com.tencent.mtt.browser.file.facade.IFileStatService;
import com.tencent.mtt.browser.utils.FileLog;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.cmc.CMC;
import com.tencent.mtt.docscan.export.DirectBitmapProvider;
import com.tencent.mtt.docscan.export.DocScanExport;
import com.tencent.mtt.docscan.export.FileBitmapProvider;
import com.tencent.mtt.docscan.export.IDocScanBitmapProvider;
import com.tencent.mtt.docscan.export.IDocScanExportRequest;
import com.tencent.mtt.external.reader.FileUserBehaviorPV;
import com.tencent.mtt.external.reader.IReader;
import com.tencent.mtt.external.reader.IReaderCallbackListener;
import com.tencent.mtt.external.reader.ReaderConstantsDefine;
import com.tencent.mtt.external.reader.ReaderFileStatistic;
import com.tencent.mtt.external.reader.dex.base.ReaderMessage;
import com.tencent.mtt.external.reader.dex.base.services.AutoSaver;
import com.tencent.mtt.external.reader.dex.base.services.InteractionRecord;
import com.tencent.mtt.external.reader.dex.component.ReaderFindDialog;
import com.tencent.mtt.external.reader.dex.internal.menu.datasource.shortcut.ShortCutFileManager;
import com.tencent.mtt.external.reader.dex.view.MttSelectView;
import com.tencent.mtt.external.reader.image.facade.IImageReaderOpen;
import com.tencent.mtt.external.reader.image.facade.ImageDataObject;
import com.tencent.mtt.external.reader.image.facade.ReadImageParam;
import com.tencent.mtt.external.reader.pdf.FreeTextFontDownloader;
import com.tencent.mtt.external.reader.pdf.anno.PDFAnnoUtils;
import com.tencent.mtt.external.reader.stat.func.ReaderFuncStat;
import com.tencent.mtt.external.reader.translation.TranslationResultDialog;
import com.tencent.mtt.external.reader.widget.DocWidgetGuideManager;
import com.tencent.mtt.file.page.homepage.Android11Compat;
import com.tencent.mtt.file.page.statistics.ToolStatHelper;
import com.tencent.mtt.frequence.visit.IVisit;
import com.tencent.mtt.javaswitch.FeatureSwitcher;
import com.tencent.mtt.log.access.Logs;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.translate.sogou.SoGouTranslatorCallback;
import com.tencent.mtt.translate.sogou.SogouTranslateData;
import com.tencent.mtt.translate.sogou.SogouTranslatorProxy;
import com.tencent.mtt.view.common.QBImageTextView;
import com.tencent.mtt.view.common.QBTextView;
import com.tencent.mtt.view.common.QBView;
import com.tencent.mtt.view.dialog.alert.MttInputTextDialog;
import com.tencent.mtt.view.dialog.alert.MttLoadingDialog;
import com.tencent.mtt.view.dialog.alert.NewQBAlertDialogBuilder;
import com.tencent.mtt.view.dialog.alert.QBAlertDialog;
import com.tencent.mtt.view.dialog.alert.QBAlertDialogBase;
import com.tencent.mtt.view.dialog.alert.QBLinearDialogClickListener;
import com.tencent.mtt.view.dialog.alert.QBListDialog;
import com.tencent.mtt.view.dialog.alert.QbListDialogBuilder;
import com.tencent.mtt.view.dialog.newui.SimpleDialogBuilder;
import com.tencent.mtt.view.dialog.newui.dialog.DialogBase;
import com.tencent.mtt.view.dialog.newui.view.ViewOnClickListener;
import com.tencent.mtt.view.layout.QBLinearLayout;
import com.tencent.mtt.view.toast.MttToaster;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import com.xiaomi.mipush.sdk.Constants;
import java.io.File;
import java.net.URLEncoder;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import qb.a.e;
import qb.a.f;
import qb.a.h;
import qb.file.BuildConfig;

public class ReaderDefaultView extends ReaderTypeView implements MttSelectView.SelectViewCallBack {
    protected static final SparseIntArray e = new SparseIntArray();
    protected ReaderFeatureWrapper f;
    Context k;
    protected boolean g = false;
    protected String h = "unknown";
    protected boolean i = false;
    IReaderEvent j = null;
    boolean l = false;
    MttInputTextDialog.IIputTextMessageBoxHandler m = null;
    boolean n = false;
    boolean o = false;

    private ReaderConstantsDefine.ReqPluginBmpFor f56797a = ReaderConstantsDefine.ReqPluginBmpFor.NONE;
    ReaderController p = null;
    ReaderPipe q = null;

    private boolean f56798b = false;
    ReaderMessage r = new ReaderMessage();

    private ReaderMessage.MessageEvent f56799c = null;
    MttInputTextDialog s = null;
    MttLoadingDialog t = null;

    static {
        e.put(ReaderConstantsDefine.READER_EVENT_SET_FONT_MODE, IReader.ENTER_STYLE_SET_MODE);
        e.put(ReaderConstantsDefine.READER_EVENT_EDIT_SET_STYLE, IReader.EDIT_SET_STYLE);
        e.put(3040, IReader.QRY_SUPPORT_EDIT_STYLE);
        e.put(4030, 350);
        e.put(2008, IReader.SET_FREETEXT_FONT);
        e.put(6002, 353);
        e.put(6001, 353);
        e.put(6003, 10033);
        e.put(6004, 10031);
        e.put(6005, 10032);
        e.put(6006, 58);
        e.put(6008, 354);
        e.put(6009, 10034);
        e.put(6010, 11006);
        e.put(6011, 11005);
    }

    public ReaderDefaultView(Context context) {
        this.f = null;
        this.k = null;
        this.k = context;
        this.f = new ReaderFeatureWrapper(context);
        p();
        a(this.j);
        J();
    }

    private void B() {
        final QBAlertDialog qBAlertDialog = new QBAlertDialog(this.k, null, MttResources.l(R.string.b64), 1, MttResources.l(R.string.a94), 3, null, 3, QBAlertDialogBase.BackGroundStyle.WHITE_WITHOUT_HEADER, true, MttRequestBase.REQUEST_NORMAL, -1, null, false);
        qBAlertDialog.a(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                int id = view.getId();
                if (id != 100) {
                    if (id == 101) {
                        Bundle bundle = new Bundle();
                        bundle.putString("saveresult", "cancel");
                        if (ReaderDefaultView.this.f != null) {
                            ReaderDefaultView.this.f.d(bundle);
                        }
                    }
                    EventCollector.getInstance().onViewClicked(view);
                }
                Logs.c("ReaderDefaultView", "[ID855977701SaveAs] showSaveCacheFileDialog.onClick button=saveAs");
                ReaderDefaultView.this.v.m("doc_cache_clk");
                ReaderDefaultView.this.f.n();
                qBAlertDialog.dismiss();
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        qBAlertDialog.a(MttResources.l(R.string.b5r), true);
        qBAlertDialog.show();
        this.v.e(ReaderConstantsDefine.SaveModifyFileFor.SAVEAS_FOR_BACKUP_CACHE);
        this.v.m("doc_cache_expose");
    }

    public boolean C() {
        if (!this.v.n() && !this.v.o()) {
            return false;
        }
        this.f.D();
        return true;
    }

    private void F() {
        if (ReaderFindDialog.b() == null || !ReaderFindDialog.b().isShowing()) {
            return;
        }
        ReaderFindDialog.b().d();
    }

    private void G() {
        try {
            Bundle bundle = new Bundle();
            bundle.putBoolean("extra_scroll_query_support", true);
            Bundle bundle2 = new Bundle();
            e(58, bundle, bundle2);
            if (!this.g) {
                this.g = bundle2.getBoolean("extra_supported", false);
            }
        } catch (Exception unused) {
        }
        this.l = true;
        d();
        this.p.j();
        this.f.B();
    }

    private void H() {
        DocWidgetGuideManager docWidgetGuideManager = new DocWidgetGuideManager();
        if (docWidgetGuideManager.a()) {
            docWidgetGuideManager.a(this.k);
        }
    }

    private void I() {
        this.v.a(new Runnable() {
            @Override
            public void run() {
                if (ReaderDefaultView.this.v.C <= 0 || ReaderDefaultView.this.v.f56752a == null || ReaderDefaultView.this.v.f56752a.intValue() != 0 || !ReaderDefaultView.this.v.A()) {
                    return;
                }
                if (ReaderDefaultView.this.v.C()) {
                    ReaderDefaultView.this.v.z();
                    ReaderDefaultView.this.f.t();
                } else if (ReaderDefaultView.this.v.D()) {
                    ReaderDefaultView.this.v.z();
                    ReaderDefaultView.this.f.u();
                } else if (ReaderDefaultView.this.v.E()) {
                    ReaderDefaultView.this.v.z();
                    ReaderDefaultView.this.f.v();
                }
            }
        }, 1000);
    }

    private void J() {
        this.f56799c = new ReaderMessage.MessageEvent() {
            @Override
            public void a(Message message) {
            }
        };
        this.r.a(this.f56799c);
    }

    private int a(Bundle bundle, int i) {
        if (!bundle.getBoolean("pdfCanAnno", false)) {
            return i;
        }
        int i2 = i | 1024;
        return this.v.aN() ? i2 | 2048 : i2;
    }

    private void a(Bitmap bitmap) {
        a(new ImageDataObject("file://doc/open/" + ReaderConfig.a(), bitmap));
    }

    private void a(IDocScanBitmapProvider iDocScanBitmapProvider) {
        ReaderConfig readerConfig = this.v;
        if (readerConfig == null) {
            return;
        }
        String str = "doc_" + readerConfig.o;
        HashMap hashMap = new HashMap();
        hashMap.put("tools_from", str);
        hashMap.put(IFileStatService.EVENT_REPORT_FROM_WHERE, readerConfig.t);
        hashMap.put(IFileStatService.EVENT_REPORT_CALLER_NAME, readerConfig.u);
        IDocScanExportRequest a2 = DocScanExport.a(iDocScanBitmapProvider, hashMap);
        a2.a(false);
        a2.a("DSE_callFrom", 3);
        if (readerConfig.S()) {
            a2.a("DSE_isThirdCall", true);
        }
        a2.f();
        ToolStatHelper.a(str, "pic_ocr_words", "tool_42", this.v.t, this.v.u);
    }

    private void a(ImageDataObject imageDataObject) {
        LinkedList<ImageDataObject> linkedList = new LinkedList<>();
        linkedList.add(imageDataObject);
        IImageReaderOpen iImageReaderOpen = (IImageReaderOpen) QBContext.getInstance().getService(IImageReaderOpen.class);
        ReadImageParam readImageParam = new ReadImageParam();
        readImageParam.from = 11;
        readImageParam.isNeedSaveButton = true;
        readImageParam.isNeedShareButon = true;
        if (StringUtils.b(PreferenceData.a("EXP_IMAGEVIEW_OCRBUTTON_KEY"), 1) == 1) {
            readImageParam.isNeedDocScanButton = true;
        }
        readImageParam.isNeedDetailButon = false;
        readImageParam.isOpenDeleteAction = false;
        readImageParam.isNeedDeleteButton = false;
        readImageParam.isNeedEncyrptSaveButton = false;
        readImageParam.isNeedAiScanButton = false;
        readImageParam.isNeedThumbnails = false;
        readImageParam.isRealDelele = false;
        readImageParam.externData = this.v;
        readImageParam.unit = "file_image";
        readImageParam.scene = ToolStatHelper.a(this.v);
        readImageParam.unitTitle = this.v == null ? "" : this.v.u();
        iImageReaderOpen.showImgUrlsWithThumpImgsWithParam(linkedList, 0, readImageParam, null);
    }

    private void a(Object obj, Integer num) {
        int intValue;
        ReaderErrorInfo readerErrorInfo;
        Context context;
        Context context2;
        if (obj != null && (obj instanceof Bundle)) {
            Bundle bundle = (Bundle) obj;
            if (bundle.containsKey(IReaderCallbackListener.KEY_ERR_CODE)) {
                readerErrorInfo = new ReaderErrorInfo();
                readerErrorInfo.f56851a = bundle.getInt(IReaderCallbackListener.KEY_ERR_CODE);
                readerErrorInfo.f56852b = bundle.getString(IReaderCallbackListener.KEY_ERR_MSG);
                Bundle bundle2 = bundle.getBundle(IReaderCallbackListener.KEY_ERR_EXTRA);
                if (bundle2 != null) {
                    readerErrorInfo.f56854d.putAll(bundle2);
                }
                readerErrorInfo.f56853c = bundle.getString(IReaderCallbackListener.KEY_ERR_CATEGORY);
                if (readerErrorInfo.f56851a != -100) {
                    try {
                        if (((Bundle) obj).containsKey(IReaderCallbackListener.KEY_REAL_TYPE)) {
                            this.h = ((Bundle) obj).getString(IReaderCallbackListener.KEY_REAL_TYPE);
                        }
                        if (this.p != null && this.p.g != null) {
                            this.p.g.b(this.h);
                        }
                        FileUserBehaviorPV.a("AHNGX24_" + this.v.o + Constants.ACCEPT_TIME_SEPARATOR_SERVER + this.h, 1);
                    } catch (Exception unused) {
                    }
                }
                intValue = (TextUtils.isEmpty(readerErrorInfo.f56853c) || !readerErrorInfo.f56853c.equalsIgnoreCase("UNEXPECTEDFILE")) ? readerErrorInfo.f56851a : -101;
                if (this.v.S() && intValue == 0) {
                    PlatformStatUtils.a("FR_TRD_OPEN_SUC");
                    this.v.G.c(1);
                }
                if (intValue == 0 && !ShortCutFileManager.a(this.v)) {
                    ((IVisit) QBContext.getInstance().getService(IVisit.class)).visitFile(this.v.o, this.v.t(), this.v.u());
                }
                if (FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_WIDGET_868685937) && intValue == 0 && this.v.T() && !Android11Compat.a()) {
                    H();
                }
                b(intValue);
                s();
                if (intValue == 0) {
                    if (intValue == -100 && this.v.aC()) {
                        this.v.bk();
                        d();
                        t();
                        this.v.m("doc_password");
                        this.p.i();
                        return;
                    }
                    ReaderController readerController = this.p;
                    if (readerController != null) {
                        if (1001 == intValue && readerController.g != null) {
                            this.p.g.a("ReaderDefaultView:onUiEvent:err", intValue, "");
                        }
                        if (readerErrorInfo != null) {
                            this.p.a(readerErrorInfo);
                            return;
                        } else {
                            this.p.d(intValue);
                            return;
                        }
                    }
                    return;
                }
                int a2 = a(this.v.aB() ? 512 : 0);
                if (this.v.aF()) {
                    a2 |= 4;
                }
                if (this.v.aE()) {
                    a2 |= 4096;
                }
                if (this.v.G()) {
                    a2 |= 2097152;
                } else if (this.v.C() && (context = this.k) != null) {
                    MttToaster.show(context.getResources().getString(R.string.b40), 0);
                }
                if (this.v.H()) {
                    a2 |= 4194304;
                } else if (this.v.D() && (context2 = this.k) != null) {
                    MttToaster.show(context2.getResources().getString(R.string.b40), 0);
                }
                if (this.v.aI() && A()) {
                    a2 |= 8192;
                }
                if (this.v.aO()) {
                    this.f.e(true);
                } else {
                    this.f.e(false);
                }
                if (a2 > 0) {
                    this.f.h(a2);
                }
                this.f.i(true);
                if (this.p != null) {
                    Bundle bundle3 = new Bundle();
                    bundle3.putInt("extra_title_height", this.p.d());
                    bundle3.putInt("extra_bottom_height", this.p.e());
                    bundle3.putBoolean("extra_single_page_center", true);
                    e(58, bundle3, null);
                }
                this.f.r();
                this.v.f56752a = Integer.valueOf(intValue);
                I();
                return;
            }
        }
        intValue = num.intValue();
        readerErrorInfo = null;
        if (this.v.S()) {
            PlatformStatUtils.a("FR_TRD_OPEN_SUC");
            this.v.G.c(1);
        }
        if (intValue == 0) {
            ((IVisit) QBContext.getInstance().getService(IVisit.class)).visitFile(this.v.o, this.v.t(), this.v.u());
        }
        if (FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_WIDGET_868685937)) {
            H();
        }
        b(intValue);
        s();
        if (intValue == 0) {
        }
    }

    public void a(final String str) {
        final QBAlertDialog qBAlertDialog = new QBAlertDialog(this.k, null, "翻译", 1, "取消", 3, null, 3, QBAlertDialogBase.BackGroundStyle.WHITE_WITHOUT_HEADER, true, MttRequestBase.REQUEST_NORMAL, -1, null, false);
        qBAlertDialog.a(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                int id = view.getId();
                if (id == 100) {
                    ReaderDefaultView.this.v.m("doc_trans_002");
                    String str2 = "";
                    try {
                        str2 = URLEncoder.encode("翻译 " + str, "UTF-8");
                    } catch (Exception unused) {
                    }
                    try {
                        UrlParams urlParams = new UrlParams("https://so.html5.qq.com/page/real/search_result?jump_from=986&entryScene=986&q=" + str2);
                        urlParams.b(2);
                        ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(urlParams);
                    } catch (Exception e2) {
                        if (ReaderDefaultView.this.p != null && ReaderDefaultView.this.p.g != null) {
                            ReaderDefaultView.this.p.g.a("ReaderDefaultView:onUiEvent", e2);
                        }
                    }
                }
                qBAlertDialog.dismiss();
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        qBAlertDialog.a(this.v.S() ? "需打开QQ浏览器访问翻译结果,确定翻译?" : "翻译需要关闭当前文档,继续翻译?", true);
        qBAlertDialog.show();
    }

    private void b(int i) {
        ReaderFileStatistic readerFileStatistic;
        int i2;
        ReaderController readerController = this.p;
        if (readerController == null || readerController.g == null) {
            return;
        }
        this.p.g.setErrCode(i);
        this.p.g.f();
        if (i == 0) {
            this.p.g.setOpenResult(1);
            return;
        }
        if (i != 1001) {
            if (i != 1003) {
                switch (i) {
                    case -102:
                        break;
                    case -101:
                        readerFileStatistic = this.p.g;
                        i2 = 10;
                        break;
                    case -100:
                        this.p.g.a(true);
                        readerFileStatistic = this.p.g;
                        i2 = 9;
                        break;
                    default:
                        readerFileStatistic = this.p.g;
                        i2 = 4;
                        break;
                }
            } else {
                readerFileStatistic = this.p.g;
                i2 = 13;
            }
            readerFileStatistic.setOpenResult(i2);
        }
        readerFileStatistic = this.p.g;
        i2 = 12;
        readerFileStatistic.setOpenResult(i2);
    }

    private void c(Object obj) {
        if (obj instanceof Bundle) {
            Bundle bundle = (Bundle) obj;
            String string = bundle.getString("type");
            String string2 = bundle.getString("code");
            if (TextUtils.isEmpty(string) || TextUtils.isEmpty(string2)) {
                return;
            }
            if (string.equalsIgnoreCase(IReaderCallbackListener.STATISTICS_TYPE_1) || string.equalsIgnoreCase(IReaderCallbackListener.STATISTICS_TYPE_3)) {
                FileUserBehaviorPV.a(string2);
            }
        }
    }

    private void c(Object obj, final Object obj2) {
        if (obj instanceof Bundle) {
            Bundle bundle = (Bundle) obj;
            String string = bundle.getString("type");
            final String string2 = bundle.getString("path");
            if ("bitmap".equalsIgnoreCase(string) && (obj2 instanceof Bitmap)) {
                if (this.f56797a == ReaderConstantsDefine.ReqPluginBmpFor.NONE) {
                    this.v.m("doc_pic_006");
                } else {
                    if (this.f56797a != ReaderConstantsDefine.ReqPluginBmpFor.IMAGE_VIEWER) {
                        if (this.f56797a == ReaderConstantsDefine.ReqPluginBmpFor.SAVE_TO_LOCAL) {
                            this.f56797a = ReaderConstantsDefine.ReqPluginBmpFor.NONE;
                            BrowserExecutorSupplier.forIoTasks().execute(new Runnable() {
                                @Override
                                public void run() {
                                    final String b2 = ReaderConfig.b(new Date().getTime() + ".jpg");
                                    Logs.c("ReaderDefaultView", "[ID855977701IMG] onCallbackAction savePath=" + b2);
                                    final boolean a2 = FileUtils.a(new File(b2), (Bitmap) obj2, Bitmap.CompressFormat.JPEG);
                                    Logs.c("ReaderDefaultView", "[ID855977701IMG] onCallbackAction saveRuslt=" + a2);
                                    BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
                                        @Override
                                        public void run() {
                                            if (a2) {
                                                ReaderUtils.a(b2, ReaderDefaultView.this.v, false);
                                            } else {
                                                MttToaster.show(MttResources.l(R.string.b57), 0);
                                            }
                                        }
                                    });
                                }
                            });
                            return;
                        } else {
                            if (this.f56797a == ReaderConstantsDefine.ReqPluginBmpFor.DOC_SCAN) {
                                this.f56797a = ReaderConstantsDefine.ReqPluginBmpFor.NONE;
                                a((IDocScanBitmapProvider) new DirectBitmapProvider((Bitmap) obj2));
                                return;
                            }
                            return;
                        }
                    }
                    this.f56797a = ReaderConstantsDefine.ReqPluginBmpFor.NONE;
                }
                a((Bitmap) obj2);
                return;
            }
            if (TextUtils.isEmpty(string2)) {
                MttToaster.show(MttResources.l(R.string.b55), 0);
                return;
            }
            if (this.f56797a == ReaderConstantsDefine.ReqPluginBmpFor.NONE) {
                this.v.m("doc_pic_006");
            } else {
                if (this.f56797a != ReaderConstantsDefine.ReqPluginBmpFor.IMAGE_VIEWER) {
                    if (this.f56797a == ReaderConstantsDefine.ReqPluginBmpFor.SAVE_TO_LOCAL) {
                        this.f56797a = ReaderConstantsDefine.ReqPluginBmpFor.NONE;
                        BrowserExecutorSupplier.forIoTasks().execute(new Runnable() {
                            @Override
                            public void run() {
                                final String b2 = ReaderConfig.b(new Date().getTime() + ".png");
                                Logs.c("ReaderDefaultView", "[ID855977701IMG] onCallbackAction savePath=" + b2);
                                final boolean b3 = FileUtils.b(string2, b2);
                                Logs.c("ReaderDefaultView", "[ID855977701IMG] onCallbackAction saveRuslt=" + b3);
                                BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
                                    @Override
                                    public void run() {
                                        if (b3) {
                                            ReaderUtils.a(b2, ReaderDefaultView.this.v, false);
                                        } else {
                                            MttToaster.show(MttResources.l(R.string.b57), 0);
                                        }
                                    }
                                });
                            }
                        });
                        return;
                    } else {
                        if (this.f56797a == ReaderConstantsDefine.ReqPluginBmpFor.DOC_SCAN) {
                            this.f56797a = ReaderConstantsDefine.ReqPluginBmpFor.NONE;
                            a((IDocScanBitmapProvider) new FileBitmapProvider(new File(string2)));
                            return;
                        }
                        return;
                    }
                }
                this.f56797a = ReaderConstantsDefine.ReqPluginBmpFor.NONE;
            }
            f(string2);
        }
    }

    private void d(Object obj) {
        if (obj instanceof Bundle) {
            Bundle bundle = (Bundle) obj;
            this.v.C = bundle.getInt("totalpage", 0);
            this.v.D = bundle.getBoolean("finish", true);
            I();
        }
    }

    private void d(Object obj, Object obj2) {
        if (!(obj instanceof Bundle)) {
            if (!(obj2 instanceof Boolean) || ((Boolean) obj2).booleanValue()) {
                return;
            }
            this.f.j(true);
            return;
        }
        Bundle bundle = (Bundle) obj;
        int a2 = a(bundle, 4144);
        if (this.f.f == null) {
            this.f.a(this.u, a2, this.v);
        }
        this.f.f.setFromFlag(2);
        this.f.f.setCallBack(this);
        this.f.i(a2);
        this.f.j(false);
        this.f.a(new Rect(bundle.getInt("left"), bundle.getInt("top"), bundle.getInt("right"), bundle.getInt("bottom")), "");
        this.v.m("doc_pic_001");
        Logs.c("ReaderDefaultView", "[ID855977701IMG] onCallbackAction show dialog");
    }

    private void e(Object obj) {
        if (obj instanceof Bundle) {
            String string = ((Bundle) obj).getString("copy", "");
            if (TextUtils.isEmpty(string)) {
                return;
            }
            ClipboardManager.getInstance().setText(string);
            MttToaster.show(MttResources.l(h.A), 0);
        }
    }

    private void e(Object obj, Object obj2) {
        if (!(obj instanceof Bundle)) {
            this.f.j(true);
            return;
        }
        Bundle bundle = (Bundle) obj;
        int i = bundle.getInt("menuFlag");
        if (i == 0) {
            this.f.j(true);
            return;
        }
        if (this.f.f == null) {
            this.f.a(this.u, i, this.v);
        }
        this.f.f.setFromFlag(8);
        this.f.f.setCallBack(this);
        this.f.i(i);
        this.f.j(false);
        this.f.a(new Rect(bundle.getInt("left"), bundle.getInt("top"), bundle.getInt("right"), bundle.getInt("bottom")), "");
    }

    private void f(Object obj) {
        if (obj instanceof Bundle) {
            v();
            if (((Bundle) obj).getBoolean("validpass", false)) {
                return;
            }
            a(MttResources.l(R.string.b6v), MttResources.l(R.string.b6y));
        }
    }

    private void f(Object obj, Object obj2) {
        if (!(obj instanceof Bundle)) {
            if (!(obj2 instanceof Boolean) || ((Boolean) obj2).booleanValue()) {
                return;
            }
            this.f.j(true);
            return;
        }
        Bundle bundle = (Bundle) obj;
        e(32, bundle, null);
        boolean z = bundle.getBoolean("supportedit", false);
        boolean z2 = bundle.getBoolean("onlyCopy", false);
        boolean z3 = bundle.getBoolean("getCopyNeedRequest", false);
        boolean z4 = bundle.getBoolean("isEditMenu", false);
        boolean z5 = bundle.getBoolean("isSingleCursor", false);
        if (!this.o) {
            this.o = true;
            this.v.m(z4 ? "doc_view_001" : "doc_view_popup");
        }
        int a2 = a(bundle, 0);
        int i = (z4 && z5 && this.v.aH()) ? a2 | 256 : z3 ? a2 | 1 : a2 | 2;
        if (!z2 && z && !z4) {
            i |= 8;
        }
        if (!z4) {
            i = i | 4 | 64;
        }
        if (z4 && this.v.aG() && !TextUtils.isEmpty(ClipboardManager.getInstance().getLastText())) {
            i |= 128;
        }
        if (this.f.f == null) {
            this.f.a(this.u, i, this.v);
        }
        this.f.f.setFromFlag(1);
        this.f.f.setCallBack(this);
        this.f.i(i);
        this.f.j(false);
        this.f.a(new Rect(bundle.getInt("left"), bundle.getInt("top"), bundle.getInt("right"), bundle.getInt("bottom")), bundle.getString("selectContent"));
    }

    private void f(String str) {
        a(new ImageDataObject(str, null));
    }

    private void g(Object obj) {
        if (obj instanceof Bundle) {
            Bundle bundle = (Bundle) obj;
            int i = bundle.getInt(IReaderCallbackListener.KEY_ERR_CODE);
            String string = bundle.getString(IReaderCallbackListener.KEY_ERR_MSG);
            if (this.v != null) {
                this.v.H.d("errCode: " + i + ", errMsg: " + string);
            }
            ReaderController readerController = this.p;
            if (readerController == null || readerController.g == null) {
                return;
            }
            this.p.g.a("ReaderDefaultView:onUiEvent", i, string);
        }
    }

    private void g(Object obj, Object obj2) {
        if (!(obj instanceof Bundle)) {
            if (!(obj2 instanceof Boolean) || ((Boolean) obj2).booleanValue()) {
                return;
            }
            this.f.y();
            return;
        }
        Bundle bundle = (Bundle) obj;
        Rect rect = new Rect(bundle.getInt("left"), bundle.getInt("top"), bundle.getInt("right"), bundle.getInt("bottom"));
        if (this.f.g == null) {
            this.f.a(this.u, bundle);
        }
        this.f.a(this.v.f, this.v.f56755d, this.v.e);
        this.f.a(rect);
    }

    private void h(Object obj) {
        if (obj == null || !(obj instanceof Bundle)) {
            return;
        }
        Bundle bundle = (Bundle) obj;
        int i = bundle.getInt("find_curIdx");
        int i2 = bundle.getInt("find_total");
        if (ReaderFindDialog.b() == null || ReaderFindDialog.b().c() == null) {
            return;
        }
        ReaderFindDialog.b().a(i, i2, false);
    }

    private void i(Object obj) {
        if (obj == null || !(obj instanceof Bundle)) {
            return;
        }
        MttToaster.show(((Bundle) obj).getString(IReaderCallbackListener.KEY_ERR_MSG), 0);
    }

    public boolean A() {
        return this.v.T() ? StringUtils.b(PreferenceData.a("WX_PDF_ANNO_SWITCH"), 2) == 2 : (this.v.k || this.v.P()) ? false : true;
    }

    @Override
    public int a() {
        int i = this.v.f56755d;
        int i2 = this.v.e;
        boolean z = true;
        e(43, new Boolean(true), null);
        e(31, MttResources.c(this.v.f, i, i2), null);
        e(IReader.SETSELECTLEFTBARBITMAP, MttResources.p(R.drawable.b_v), 1);
        e(346, MttResources.p(R.drawable.b_w), 1);
        this.f.o();
        Bundle bundle = new Bundle();
        e(59, null, bundle);
        int i3 = bundle.getInt("screen_timeOut");
        if (i3 == 0) {
            i3 = 120000;
        }
        z = false;
        this.f.b(i3, z);
        return 0;
    }

    public int a(int i) {
        if (this.v.k) {
            return i;
        }
        return 0;
    }

    protected void a(float f) {
        this.f.h();
        this.f.B();
        ((InteractionRecord) this.v.a(InteractionRecord.class)).a();
    }

    public void a(int i, int i2) {
        if (this.f.e()) {
            return;
        }
        if (this.f.j()) {
            this.f.a(this.g ? 0 : 2);
            a(true, true);
        } else {
            this.f.a(this.g ? 0 : 2);
            if (!this.g) {
                this.f.a(true, true);
            }
        }
        this.f.B();
    }

    public void a(int i, Object obj, Object obj2) {
        int i2;
        Bundle bundle;
        ((InteractionRecord) this.v.a(InteractionRecord.class)).a();
        switch (i) {
            case 3040:
                i2 = ((obj2 instanceof Boolean) && ((Boolean) obj2).booleanValue()) ? 10005 : 33;
                e(i2, null, null);
                return;
            case 3041:
            case ReaderConstantsDefine.READER_EVENT_BTN_ANNO_EDIT:
            default:
                return;
            case ReaderConstantsDefine.READER_EVENT_BTN_SEARCH:
                b((String) obj);
                return;
            case ReaderConstantsDefine.READER_EVENT_BTN_IMG_VIEW:
                Logs.c("ReaderDefaultView", "[ID855977701IMG] onSelectViewCallBack key=READER_EVENT_BTN_IMG_VIEW");
                this.f56797a = ReaderConstantsDefine.ReqPluginBmpFor.IMAGE_VIEWER;
                bundle = new Bundle();
                break;
            case ReaderConstantsDefine.READER_EVENT_BTN_IMG_SAVE:
                Logs.c("ReaderDefaultView", "[ID855977701IMG] onSelectViewCallBack key=READER_EVENT_BTN_IMG_SAVE");
                this.f56797a = ReaderConstantsDefine.ReqPluginBmpFor.SAVE_TO_LOCAL;
                bundle = new Bundle();
                break;
            case ReaderConstantsDefine.READER_EVENT_BTN_FANYI:
                a((String) obj, (Rect) obj2);
                return;
            case ReaderConstantsDefine.READER_EVENT_BTN_PASTE:
                e(10019, ClipboardManager.getInstance().getLastText(), null);
                return;
            case ReaderConstantsDefine.READER_EVENT_BTN_SELECT:
                i2 = 342;
                e(i2, null, null);
                return;
            case ReaderConstantsDefine.READER_EVENT_BTN_IMG_DOC_SCAN:
                Logs.c("ReaderDefaultView", "[ID855977701IMG] onSelectViewCallBack key=READER_EVENT_BTN_IMG_DOC_SCAN");
                this.f56797a = ReaderConstantsDefine.ReqPluginBmpFor.DOC_SCAN;
                bundle = new Bundle();
                break;
            case ReaderConstantsDefine.READER_EVENT_BTN_BITMAP_DELETE:
                i2 = 10038;
                e(i2, null, null);
                return;
        }
        e(334, null, bundle);
    }

    public void a(ReaderController readerController) {
        this.p = readerController;
    }

    public void a(ReaderMenuController readerMenuController) {
        if (readerMenuController != null) {
            readerMenuController.a(this.j);
        }
        this.f.a(readerMenuController);
    }

    public void a(ReaderPipe readerPipe) {
        this.q = readerPipe;
    }

    protected void a(SogouTranslateData sogouTranslateData, final String str, Rect rect) {
        if (sogouTranslateData != null) {
            PlatformStatUtils.a("WORD_TRANSLATOR_REPORT_onResult code = " + sogouTranslateData.code);
        }
        if (sogouTranslateData == null || sogouTranslateData.code != 0) {
            SimpleDialogBuilder.d(this.k).e(sogouTranslateData != null ? sogouTranslateData.msg : "插件加载失败").b(true).a("去网页翻译").a_(new ViewOnClickListener() {
                @Override
                public void onClick(View view, DialogBase dialogBase) {
                    dialogBase.dismiss();
                    ReaderDefaultView.this.a(str);
                }
            }).c(MttResources.l(h.l)).c(new ViewOnClickListener() {
                @Override
                public void onClick(View view, DialogBase dialogBase) {
                    dialogBase.dismiss();
                }
            }).e();
        } else {
            new TranslationResultDialog(this.k, str, sogouTranslateData, rect, this.u != null ? this.u.getHeight() : 0, this.v).show();
        }
    }

    public void a(Object obj) {
        this.f.b(0, obj instanceof Bundle ? ((Bundle) obj).getInt("animationMenuId") : -1);
    }

    public void a(Object obj, Object obj2) {
        if (!(obj instanceof Bundle)) {
            if (!(obj2 instanceof Boolean) || ((Boolean) obj2).booleanValue()) {
                return;
            }
            this.f.j(true);
            return;
        }
        Bundle bundle = (Bundle) obj;
        int a2 = a(bundle, 0);
        if (a2 == 0) {
            return;
        }
        if (this.f.f == null) {
            this.f.a(this.u, a2, this.v);
        }
        this.f.f.setFromFlag(4);
        this.f.f.setCallBack(this);
        this.f.i(a2);
        this.f.j(false);
        this.f.a(new Rect(bundle.getInt("left"), bundle.getInt("top"), bundle.getInt("right"), bundle.getInt("bottom")), "");
    }

    public void a(Object obj, final boolean z) {
        ReaderConfig readerConfig = this.v;
        if (readerConfig != null && (obj instanceof Bundle)) {
            final Bundle bundle = (Bundle) obj;
            final String string = bundle.getString("saveresult");
            if ("failed".equalsIgnoreCase(string) || "success".equalsIgnoreCase(string)) {
                final ReaderFuncStat readerFuncStat = readerConfig.H;
                if (readerFuncStat.a() > 0) {
                    readerFuncStat.a("costTime", Long.valueOf(System.currentTimeMillis() - readerFuncStat.a()));
                }
                new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        int i = bundle.getInt("errCode", -1);
                        if (!"failed".equalsIgnoreCase(string)) {
                            i = 1;
                        }
                        String string2 = bundle.getString(IReaderCallbackListener.KEY_ERR_MSG, "");
                        if (!string2.isEmpty()) {
                            readerFuncStat.d("  errmsg:" + string2);
                        }
                        readerFuncStat.a(z ? 2 : 1, i);
                    }
                }, 300L);
            }
        }
    }

    public void a(final String str, final Rect rect) {
        ToolStatHelper.a("doc_" + this.v.o, "translate_doc", "tool_44", this.v.t, this.v.u);
        if (!FeatureSwitcher.a(qb.javaswitch.BuildConfig.FEATURE_SWITCHER_KEY_TRANSLATION_SOGOU_DIALOG)) {
            a(str);
            return;
        }
        this.f.j(true);
        SogouTranslatorProxy.b().a(str, "auto", "zh-CHS", new SoGouTranslatorCallback() {
            @Override
            public void onResult(SogouTranslateData sogouTranslateData) {
                ReaderDefaultView.this.a(sogouTranslateData, str, rect);
            }
        });
        this.v.m("doc_trans_001");
    }

    protected void a(String str, String str2) {
        NewQBAlertDialogBuilder newQBAlertDialogBuilder = new NewQBAlertDialogBuilder();
        newQBAlertDialogBuilder.a(str2, 1);
        final QBAlertDialog a2 = newQBAlertDialogBuilder.a();
        a2.a(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                if (view.getId() == 100) {
                    ReaderDefaultView.this.t();
                } else if (view.getId() == 101) {
                    a2.dismiss();
                }
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        a2.a(str, true);
        a2.show();
    }

    public void a(String str, boolean z) {
        Context context = this.k;
        if (context == null) {
            return;
        }
        QBAlertDialog qBAlertDialog = new QBAlertDialog(context, null, MttResources.l(h.i), 1, null, 0, null, 3, QBAlertDialogBase.BackGroundStyle.WHITE_WITHOUT_HEADER, true, MttRequestBase.REQUEST_NORMAL, -1, null, false);
        qBAlertDialog.a(str, true);
        qBAlertDialog.a(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                if (view.getId() == 100 && ReaderDefaultView.this.p != null) {
                    ReaderDefaultView.this.p.k();
                }
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        qBAlertDialog.show();
    }

    public void a(boolean z, boolean z2) {
        if (!this.g && this.f.j()) {
            this.f.b(z, z);
        }
    }

    public void b() {
        this.f.b(this.u);
        this.f.g();
        a(true, true);
        this.f.B();
        ((InteractionRecord) this.v.a(InteractionRecord.class)).a();
    }

    final void b(float f) {
        this.f.a(f);
    }

    @Override
    public void b(int i, Object obj, Object obj2) {
        Bundle bundle;
        String str;
        switch (i) {
            case 2:
                this.f.a(this.u, this.j);
                this.g = true;
                e();
                return;
            case 5:
                this.f.i();
                return;
            case 11:
                ((Bundle) obj2).putBoolean("gesture", !this.f.j());
                return;
            case 12:
                if (!this.l && this.v != null) {
                    this.v.bn();
                }
                if (this.p == null) {
                    return;
                }
                G();
                return;
            case 19:
                a(obj, (Integer) obj2);
                return;
            case 20:
                f(obj, obj2);
                return;
            case 21:
                this.f.j(true);
                return;
            case 23:
                this.f.x();
                return;
            case 24:
            default:
                return;
            case 32:
                F();
                return;
            case 44:
                if (obj2 != null && (obj2 instanceof Bundle)) {
                    bundle = (Bundle) obj2;
                    str = "support_prompt";
                    break;
                } else {
                    return;
                }
            case 50:
                Bundle bundle2 = (Bundle) obj;
                bundle2.getFloat("touch_x");
                bundle2.getFloat("touch_y");
                return;
            case 62:
                if (this.v != null) {
                    this.v.bo();
                    if (this.v.al()) {
                        new FreeTextFontDownloader(this.k).a();
                        return;
                    }
                    return;
                }
                return;
            case 101:
                h(obj);
                return;
            case 102:
                e(obj);
                return;
            case 210:
                g(obj);
                return;
            case 220:
                f(obj);
                return;
            case 226:
                i(obj2);
                return;
            case IReaderCallbackListener.SHOW_WATERDROP:
                g(obj, obj2);
                return;
            case 302:
                ReaderController readerController = this.p;
                if (readerController != null) {
                    readerController.a(obj, obj2);
                    return;
                }
                return;
            case 303:
                d(obj2);
                return;
            case 306:
                d(obj, obj2);
                return;
            case 307:
                c(obj, obj2);
                return;
            case 311:
                e(obj, obj2);
                return;
            case 312:
                if (obj2 != null && (obj2 instanceof Bundle)) {
                    bundle = (Bundle) obj2;
                    str = "encrypt_support";
                    break;
                } else {
                    return;
                }
            case 313:
                ReaderController readerController2 = this.p;
                if (readerController2 == null) {
                    return;
                }
                readerController2.b(obj, obj2);
                return;
            case 314:
                ReaderController readerController3 = this.p;
                if (readerController3 == null) {
                    return;
                }
                readerController3.m();
                return;
            case 315:
                if (obj instanceof Bundle) {
                    this.f.b((Bundle) obj);
                    return;
                }
                return;
            case 318:
                if (obj instanceof Bundle) {
                    this.f.f(!((Bundle) obj).getBoolean("support"));
                    return;
                }
                return;
            case 321:
                ReaderController readerController4 = this.p;
                if (readerController4 == null) {
                    return;
                }
                readerController4.c(obj, obj2);
                return;
            case 500:
                b(obj, obj2);
                return;
            case 505:
                a(obj, obj2);
                return;
            case 1000:
                this.f.a((String) obj);
                return;
            case 3000:
                c(obj);
                return;
        }
        bundle.putBoolean(str, true);
    }

    public void b(Object obj, Object obj2) {
        if (!(obj instanceof Bundle)) {
            if (!(obj2 instanceof Boolean) || ((Boolean) obj2).booleanValue()) {
                return;
            }
            this.f.j(true);
            return;
        }
        if (this.f.f == null) {
            this.f.a(this.u, 512, this.v);
        }
        this.f.f.setCallBack(this);
        this.f.i(512);
        this.f.j(false);
        Bundle bundle = (Bundle) obj;
        Rect rect = new Rect(bundle.getInt("left"), bundle.getInt("top"), bundle.getInt("right"), bundle.getInt("bottom"));
        this.v.n("doc_mark_edit");
        this.f.a(rect, "");
    }

    public void b(final String str) {
        final QBAlertDialog qBAlertDialog = new QBAlertDialog(this.k, null, "搜索", 1, "取消", 3, null, 3, QBAlertDialogBase.BackGroundStyle.WHITE_WITHOUT_HEADER, true, MttRequestBase.REQUEST_NORMAL, -1, null, false);
        qBAlertDialog.a(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String str2;
                EventCollector.getInstance().onViewClickedBefore(view);
                int id = view.getId();
                if (id == 100) {
                    ReaderDefaultView.this.v.m("doc_seach_002");
                    try {
                        str2 = URLEncoder.encode(str, "UTF-8");
                    } catch (Exception unused) {
                        str2 = "";
                    }
                    UrlParams urlParams = new UrlParams("https://so.html5.qq.com/page/real/search_result?jump_from=985&entryScene=985&q=" + str2);
                    urlParams.b(2);
                    ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(urlParams);
                }
                qBAlertDialog.dismiss();
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        qBAlertDialog.a(this.v.S() ? "需打开QQ浏览器访问搜索结果,确定搜索?" : "搜索需要关闭当前文档,继续搜索?", true);
        qBAlertDialog.show();
        this.v.m("doc_seach_001");
    }

    public void b(String str, boolean z) {
        Bundle bundle;
        this.n = true;
        if (TextUtils.isEmpty(str)) {
            bundle = this.v.ay();
            if (bundle == null) {
                bundle = new Bundle();
            }
        } else {
            Bundle bundle2 = new Bundle();
            bundle2.putString("destfile", str);
            bundle = bundle2;
        }
        if (z) {
            bundle.putBoolean("exitedit", z);
        }
        e(317, bundle, null);
        this.p.l();
    }

    protected void b(final boolean z) {
        QBLinearLayout qBLinearLayout = new QBLinearLayout(this.k);
        qBLinearLayout.setOrientation(1);
        qBLinearLayout.setLayoutParams(new ViewGroup.LayoutParams(-1, -2));
        QBTextView qBTextView = new QBTextView(this.k);
        qBTextView.setGravity(17);
        qBTextView.setLayoutParams(new ViewGroup.LayoutParams(-1, MttResources.s(80)));
        this.v.ax();
        String[] strArr = {"保存", "不保存", "取消"};
        qBTextView.setText("是否保存对文档的修改?");
        qBTextView.setTextSize(MttResources.h(f.cG));
        qBTextView.setTextColorNormalIds(e.n);
        QBView qBView = new QBView(this.k);
        qBView.setBackgroundNormalIds(0, e.Q);
        qBView.setLayoutParams(new ViewGroup.LayoutParams(-1, 1));
        qBLinearLayout.addView(qBTextView);
        qBLinearLayout.addView(qBView);
        QbListDialogBuilder qbListDialogBuilder = new QbListDialogBuilder();
        qbListDialogBuilder.a("https://static.res.qq.com/qbt/file/reader_dialog_when_exit_edit.png", MttResources.s(280), MttResources.s(149));
        qbListDialogBuilder.a(strArr);
        qbListDialogBuilder.a(strArr.length - 1);
        qbListDialogBuilder.a(qBLinearLayout);
        final QBListDialog a2 = qbListDialogBuilder.a();
        a2.a(0, MttResources.c(e.f));
        QBLinearLayout qBLinearLayout2 = null;
        if (a2.a() != null && a2.a().x != null) {
            qBLinearLayout2 = a2.a().x;
        }
        if (qBLinearLayout2 != null) {
            for (int i = 0; i < qBLinearLayout2.getChildCount(); i++) {
                View childAt = qBLinearLayout2.getChildAt(i);
                if (childAt instanceof QBImageTextView) {
                    ViewGroup.LayoutParams layoutParams = childAt.getLayoutParams();
                    layoutParams.height = MttResources.s(48);
                    childAt.setLayoutParams(layoutParams);
                }
            }
        }
        a2.a(new QBLinearDialogClickListener() {
            @Override
            public void a(int i2) {
                if (i2 == 0) {
                    ReaderDefaultView.this.v.m("doc_unsave_clk");
                    if (ReaderDefaultView.this.p != null) {
                        if (z) {
                            ReaderDefaultView.this.f.n();
                        } else {
                            ReaderDefaultView.this.c(true);
                            ReaderDefaultView.this.p.a(MttResources.l(R.string.b68));
                        }
                    }
                } else if (i2 == 1) {
                    ReaderDefaultView.this.v.aU();
                    BrowserExecutorSupplier.forIoTasks().execute(new Runnable() {
                        @Override
                        public void run() {
                            ((AutoSaver) ReaderDefaultView.this.v.a(AutoSaver.class)).c();
                        }
                    });
                    if (ReaderDefaultView.this.C()) {
                        return;
                    }
                    if (ReaderDefaultView.this.p != null) {
                        ReaderDefaultView.this.x();
                        Bundle bundle = new Bundle();
                        bundle.putString("saveresult", "cancel");
                        if (ReaderDefaultView.this.f != null) {
                            ReaderDefaultView.this.f.d(bundle);
                        }
                    }
                }
                a2.c();
            }
        });
        a2.b();
        this.v.m("doc_unsave_expose");
    }

    public boolean b(Object obj) {
        if (this.v != null && (obj instanceof Bundle)) {
            AutoSaver autoSaver = (AutoSaver) this.v.a(AutoSaver.class);
            if (autoSaver.b()) {
                autoSaver.a((Bundle) obj);
                return true;
            }
        }
        return false;
    }

    public void c(boolean z) {
        b((String) null, z);
    }

    public boolean c() {
        if (this.n) {
            return true;
        }
        ReaderFeatureWrapper readerFeatureWrapper = this.f;
        if (readerFeatureWrapper == null) {
            return false;
        }
        if (readerFeatureWrapper.l()) {
            l();
            return true;
        }
        if (m() && !this.f56798b && this.v.R() && !this.v.aw()) {
            this.f56798b = true;
            B();
            return true;
        }
        Object a2 = CMC.a("cmc://appstoreguide/m?cmd=showGuide&scene=docs", null);
        if (a2 instanceof Integer) {
            try {
                if (((Integer) a2).intValue() == 0) {
                    return true;
                }
            } catch (Exception unused) {
            }
        }
        if (this.v.N() || !this.v.j) {
            if (!n()) {
                return false;
            }
            o();
            return true;
        }
        this.v.aX();
        ReaderMainTabJumper.b("10012", 14, this.v.u(), TbsMode.PR_QB, "dstPath=" + UrlUtils.encode(this.v.t()), this.v);
        return true;
    }

    public boolean c(int i, Object obj, Object obj2) {
        if (i == 3013) {
            a(true, false);
        } else if (i == 4014) {
            this.f.q();
        } else if (i == 4022) {
            this.j.onUiEvent(2001, null, null);
        } else if (i == 4105) {
            a(obj);
        }
        return false;
    }

    public boolean c(String str) {
        ReaderController readerController = this.p;
        if (readerController == null) {
            return false;
        }
        if (readerController == null || readerController.g != null) {
            return (!TextUtils.isEmpty(this.h) ? this.h : this.p.g.d()).equalsIgnoreCase(str);
        }
        return false;
    }

    public void d() {
        ReaderController readerController = this.p;
        if (readerController != null) {
            readerController.g();
        }
    }

    public void d(String str) {
        ReaderFeatureWrapper readerFeatureWrapper = this.f;
        if (readerFeatureWrapper == null || readerFeatureWrapper.e == null) {
            return;
        }
        this.f.e.a(str, "https://bbs.mb.qq.com/mobilefb/fbTree?desc=%E6%96%87%E6%A1%A3%3E%E6%96%87%E6%A1%A3%E7%BC%96%E8%BE%91%E5%90%8E%E4%BF%9D%E5%AD%98%E5%A4%B1%E8%B4%A5&serviceId=5&levelinfos=0fc2eb96-8d17-4e3b-a48d-81516b64ba4c&tname=%E6%96%87%E6%A1%A3%E7%BC%96%E8%BE%91%E5%90%8E%E4%BF%9D%E5%AD%98%E5%A4%B1%E8%B4%A5&level=0fc2eb96-8d17-4e3b-a48d-81516b64ba4c&levelName=%E6%96%87%E6%A1%A3%E7%BC%96%E8%BE%91%E5%90%8E%E4%BF%9D%E5%AD%98%E5%A4%B1%E8%B4%A5&pl=%E8%AF%B7%E5%8A%A1%E5%BF%85%E7%95%99%E4%B8%8BQQ%E5%8F%B7%E6%88%96%E5%BE%AE%E4%BF%A1%E5%8F%B7%EF%BC%8C%E4%BE%BF%E4%BA%8E%E6%88%91%E4%BB%AC%E5%AE%9A%E4%BD%8D%E9%97%AE%E9%A2%98%EF%BC%81&from=file&dr=fb");
        this.v.m("doc_save_fail");
    }

    void e() {
        ReaderController readerController = this.p;
        if (readerController != null) {
            readerController.h();
            this.f.a(true, false);
        }
    }

    public void e(final String str) {
        this.v.aX();
        QbListDialogBuilder qbListDialogBuilder = new QbListDialogBuilder();
        String[] strArr = {MttResources.l(R.string.a93), MttResources.l(R.string.a94)};
        qbListDialogBuilder.a(MttResources.l(this.v.aa() ? R.string.b5u : R.string.b5t));
        qbListDialogBuilder.a(strArr);
        qbListDialogBuilder.a(strArr.length - 1);
        final QBListDialog a2 = qbListDialogBuilder.a();
        a2.a(0, MttResources.c(e.f));
        a2.a(new QBLinearDialogClickListener() {
            @Override
            public void a(int i) {
                if (i == 100) {
                    ReaderDefaultView.this.v.m("doc_link_002");
                    ReaderJumper.c(str);
                }
                a2.c();
            }
        });
        a2.b();
        this.v.m("doc_link_001");
    }

    @Override
    public void f() {
        this.r.a();
        a((ReaderController) null);
        a((ReaderMenuController) null);
        this.k = null;
        a((IReaderEvent) null);
        this.f.a();
        v();
    }

    @Override
    public void g() {
        this.f.b();
        if (this.v != null) {
            e(31, MttResources.c(this.v.f, this.v.f56755d, this.v.e), null);
        }
    }

    public void h() {
    }

    public void i() {
    }

    protected void j() {
        this.f.h();
    }

    protected void k() {
        this.f.g();
    }

    public void l() {
        if (w()) {
            if (this.v.ax()) {
                this.v.e(ReaderConstantsDefine.SaveModifyFileFor.SAVEAS_FOR_EXIT_EDIT);
                b(true);
                return;
            } else {
                this.v.e(ReaderConstantsDefine.SaveModifyFileFor.SAVE_FOR_EXIT_EDIT);
                b(false);
                return;
            }
        }
        if (!C() && this.f.l()) {
            this.f.x();
            this.f.e(0);
            this.v.m("doc_exit_edit");
        }
    }

    protected boolean m() {
        return true;
    }

    boolean n() {
        return this.v.R() && (this.v.af() || "pdf".equalsIgnoreCase(this.v.o) || this.v.ak());
    }

    void o() {
        this.v.aX();
        ReaderMainTabJumper.b("10010", 15, this.v.u(), TbsMode.PR_QB, "dstPath=" + UrlUtils.encode(this.v.t()), this.v);
    }

    final void p() {
        this.j = new IReaderEvent() {
            @Override
            public void onUiEvent(int i, Object obj, Object obj2) {
                ReaderDefaultView readerDefaultView;
                int i2;
                int i3;
                if (ReaderDefaultView.e.indexOfKey(i) >= 0) {
                    ReaderDefaultView.this.e(ReaderDefaultView.e.get(i), obj, obj2);
                    return;
                }
                if (i == 2001) {
                    ReaderDefaultView.this.q();
                    return;
                }
                if (i != 3029) {
                    if (i == 3046) {
                        String string = obj instanceof Bundle ? ((Bundle) obj).getString(ContentType.TYPE_TEXT) : "";
                        if (TextUtils.isEmpty(string)) {
                            string = ClipboardManager.getInstance().getLastText();
                        }
                        ReaderDefaultView.this.e(10019, string, null);
                        return;
                    }
                    if (i == 3049) {
                        Logs.c("ReaderDefaultView", "[ID855977701IMG] onSelectViewCallBack key=READER_EVENT_BTN_IMG_DOC_SCAN");
                        ReaderDefaultView.this.f56797a = ReaderConstantsDefine.ReqPluginBmpFor.DOC_SCAN;
                        ReaderDefaultView.this.e(334, null, new Bundle());
                        return;
                    }
                    if (i == 4025) {
                        ReaderDefaultView.this.f.E();
                        return;
                    }
                    if (i != 4027) {
                        if (i == 4104) {
                            ((Bundle) obj2).putBoolean("result", !ReaderDefaultView.this.c());
                            return;
                        }
                        if (i == 4108) {
                            ReaderDefaultView.this.l();
                            return;
                        }
                        if (i == 6007) {
                            ReaderDefaultView.this.f.j(true);
                            return;
                        }
                        if (i != 10001) {
                            if (i == 3036) {
                                ((InteractionRecord) ReaderDefaultView.this.v.a(InteractionRecord.class)).a();
                                ReaderDefaultView.this.f.x();
                                return;
                            }
                            if (i == 3037) {
                                if (ReaderDefaultView.this.v.n()) {
                                    ReaderDefaultView.this.v.d(ReaderDefaultView.this.E());
                                    return;
                                }
                                return;
                            }
                            switch (i) {
                                case 3000:
                                    Bundle bundle = (Bundle) obj;
                                    int i4 = -1;
                                    if (bundle != null) {
                                        i4 = bundle.getInt("tap_x");
                                        i3 = bundle.getInt("tap_y");
                                    } else {
                                        i3 = -1;
                                    }
                                    if (ReaderDefaultView.this.l) {
                                        ReaderDefaultView.this.a(i4, i3);
                                        return;
                                    }
                                    return;
                                case 3001:
                                    ReaderDefaultView.this.b();
                                    return;
                                case 3002:
                                    ReaderDefaultView.this.j();
                                    return;
                                case 3003:
                                    Bundle bundle2 = (Bundle) obj;
                                    if (bundle2 != null) {
                                        ReaderDefaultView.this.b(bundle2.getFloat("ratio"));
                                        return;
                                    }
                                    return;
                                case 3004:
                                    ReaderDefaultView.this.k();
                                    return;
                                case 3005:
                                    ReaderDefaultView.this.a(0.0f);
                                    return;
                                case 3006:
                                    Bundle bundle3 = (Bundle) obj;
                                    if (bundle3 != null) {
                                        ReaderDefaultView.this.f.b(bundle3.getFloat("ratio"));
                                        return;
                                    }
                                    return;
                                default:
                                    switch (i) {
                                        case 3015:
                                            if (ReaderDefaultView.this.f.f56858d != null && ReaderDefaultView.this.f.f56858d.f56944b != null) {
                                                ReaderDefaultView.this.f.f56858d.f56944b.findAllAsync((String) obj);
                                                return;
                                            }
                                            Bundle bundle4 = new Bundle();
                                            bundle4.putString("find_text", (String) obj);
                                            ReaderDefaultView.this.e(321, bundle4, obj2);
                                            return;
                                        case 3016:
                                            if (ReaderDefaultView.this.f.f56858d != null && ReaderDefaultView.this.f.f56858d.f56944b != null) {
                                                ReaderDefaultView.this.f.f56858d.f56944b.findNext(true);
                                            }
                                            readerDefaultView = ReaderDefaultView.this;
                                            i2 = IReader.SET_FIND_NEXT;
                                            break;
                                        case 3017:
                                            if (ReaderDefaultView.this.f.f56858d != null && ReaderDefaultView.this.f.f56858d.f56944b != null) {
                                                ReaderDefaultView.this.f.f56858d.f56944b.findNext(false);
                                            }
                                            readerDefaultView = ReaderDefaultView.this;
                                            i2 = 322;
                                            break;
                                        case 3018:
                                            if (ReaderDefaultView.this.f.f56858d != null && ReaderDefaultView.this.f.f56858d.f56944b != null) {
                                                ReaderDefaultView.this.f.f56858d.f56944b.clearMatches();
                                            }
                                            ReaderDefaultView.this.e(310, false, null);
                                            return;
                                        case ReaderConstantsDefine.READER_EVENT_SET_FIND_LISTENER:
                                            ReaderDefaultView.this.e(310, true, null);
                                            if (obj instanceof FindListener) {
                                                FindListener findListener = (FindListener) obj;
                                                if (ReaderDefaultView.this.f.f56858d == null || ReaderDefaultView.this.f.f56858d.f56944b == null) {
                                                    return;
                                                }
                                                ReaderDefaultView.this.f.f56858d.f56944b.setFindListener(findListener);
                                                return;
                                            }
                                            return;
                                        case ReaderConstantsDefine.READER_EVENT_WEBVIEW_PROMPT:
                                            ReaderDefaultView.this.e(44, obj, obj2);
                                            return;
                                        case ReaderConstantsDefine.READER_EVENT_WEBVIEW_GET_TITLE_HEIGHT:
                                            if (ReaderDefaultView.this.p == null || obj2 == null || !(obj2 instanceof Bundle)) {
                                                return;
                                            }
                                            ((Bundle) obj2).putInt("title_height", ReaderDefaultView.this.p.d());
                                            return;
                                        case ReaderConstantsDefine.READER_EVENT_WEBVIEW_SET_TITLE_VISIBLE_HEIGHT:
                                            if (obj == null || !(obj instanceof Bundle)) {
                                                return;
                                            }
                                            int i5 = ((Bundle) obj).getInt("title_visiable_height");
                                            if (ReaderDefaultView.this.f != null) {
                                                ReaderDefaultView.this.f.d(i5);
                                                return;
                                            }
                                            return;
                                        case ReaderConstantsDefine.READER_EVENT_WEBVIEW_GET_TITLE_VISIBLE_HEIGHT:
                                            return;
                                        default:
                                            ReaderDefaultView.this.c(i, obj, obj2);
                                            return;
                                    }
                            }
                        }
                    }
                    ReaderDefaultView.this.f.n();
                    return;
                }
                readerDefaultView = ReaderDefaultView.this;
                i2 = 10008;
                readerDefaultView.e(i2, null, null);
            }
        };
    }

    void q() {
        boolean r = r();
        Bundle bundle = new Bundle();
        boolean z = !r;
        bundle.putBoolean("mode", z);
        e(10003, bundle, null);
        FileUserBehaviorPV.a("AHNGS2");
        int p = this.f.p();
        int i = z ? (p & (-5)) | 65536 : ((-65537) & p) | 4;
        int i2 = this.v.aE() ? i | 4096 : i & (-4097);
        if (p != i2) {
            this.f.g(i2);
        }
    }

    public boolean r() {
        Bundle bundle = new Bundle();
        e(IReader.QRY_FITSCREEN_MODE, null, bundle);
        if (bundle.containsKey("fitscreen")) {
            return bundle.getBoolean("fitscreen", false);
        }
        Bundle bundle2 = new Bundle();
        bundle2.putString(SearchIntents.EXTRA_QUERY, "mode");
        Bundle bundle3 = new Bundle();
        e(10003, bundle2, bundle3);
        return bundle3.getBoolean("fitscreen", false);
    }

    public void s() {
        Bundle bundle = new Bundle();
        e(311, null, bundle);
        int i = (bundle.containsKey("findSupport") && bundle.getBoolean("findSupport")) ? 1 : 0;
        Bundle bundle2 = new Bundle();
        e(312, null, bundle2);
        if (bundle2.containsKey("encryptEnabled") && bundle2.getBoolean("encryptEnabled")) {
            i |= 2;
        }
        Bundle bundle3 = new Bundle();
        e(10023, null, bundle3);
        if (!bundle3.containsKey("support")) {
            Bundle bundle4 = new Bundle();
            bundle4.putString(SearchIntents.EXTRA_QUERY, "support");
            Bundle bundle5 = new Bundle();
            e(10003, bundle4, bundle5);
            if (bundle5.containsKey("support") && bundle5.getBoolean("support")) {
                i |= 32;
            }
            bundle3 = bundle5;
        } else if (bundle3.getBoolean("support", false)) {
            i |= 32;
        }
        e(332, new Bundle(), bundle3);
        if (bundle3.containsKey("can_page2bmp") && bundle3.getBoolean("can_page2bmp")) {
            i |= 4;
        }
        Bundle bundle6 = new Bundle();
        Bundle bundle7 = new Bundle();
        bundle6.putString(SearchIntents.EXTRA_QUERY, "support");
        e(10018, bundle6, bundle7);
        if (bundle7.getBoolean("new_edit_ui", false)) {
            i |= 8;
        }
        Bundle bundle8 = new Bundle();
        e(10021, null, bundle8);
        if (bundle8.getBoolean("support", false)) {
            i |= 64;
        }
        Bundle bundle9 = new Bundle();
        e(IReader.QRY_SUPPORT_SELECT_TXT, null, bundle9);
        if (bundle9.getBoolean("support", false)) {
            i |= 128;
        }
        Bundle bundle10 = new Bundle();
        e(11001, null, bundle10);
        if (bundle10.getBoolean("support_annotation", false)) {
            i |= 256;
        }
        Bundle bundle11 = new Bundle();
        e(IReader.QRY_SUPPORT_INK, null, bundle11);
        if (bundle11.getBoolean("support_ink", false)) {
            i |= 512;
        }
        Bundle bundle12 = new Bundle();
        e(IReader.QRY_SUPPORT_ARROW, null, bundle12);
        if (bundle12.getBoolean("support_arrow", false)) {
            i |= 65536;
        }
        Bundle bundle13 = new Bundle();
        e(IReader.QRY_SUPPORT_SIGNATURE, null, bundle13);
        if (bundle13.getBoolean("support_signature", false)) {
            i |= 1024;
        }
        Bundle bundle14 = new Bundle();
        e(IReader.QRY_SUPPORT_FREETEXT, null, bundle14);
        if (bundle14.getBoolean("support_freetext", false)) {
            i |= 4096;
        }
        Bundle bundle15 = new Bundle();
        e(IReader.QRY_SUPPORT_STRIKEOUT, null, bundle15);
        if (bundle15.getBoolean("support_strikeout", false)) {
            i |= 8192;
        }
        Bundle bundle16 = new Bundle();
        e(IReader.QRY_SUPPORT_UNDERLINE, null, bundle16);
        if (bundle16.getBoolean("support_underline", false)) {
            i |= 16384;
        }
        Bundle bundle17 = new Bundle();
        e(IReader.QRY_PDF_SUPPORT_SET_COLOR, null, bundle17);
        if (bundle17.getBoolean("support_set_color", false)) {
            PDFAnnoUtils.b(bundle17);
            i |= 32768;
        }
        Bundle bundle18 = new Bundle();
        e(IReader.QRY_PDF_SUPPORT_WATERMARK, null, bundle18);
        if (bundle18.getBoolean("support_watermark", false)) {
            i |= 131072;
        }
        Bundle bundle19 = new Bundle();
        e(IReader.QRY_PDF_SUPPORT_INSERTIMAGE, null, bundle19);
        if (bundle19.getBoolean("support_insert_image", false)) {
            i |= 262144;
        }
        Bundle bundle20 = new Bundle();
        e(IReader.QRY_PDF_SUPPORT_STAMP, null, bundle20);
        if (bundle20.getBoolean("support_stamp", false)) {
            i |= 524288;
        }
        Bundle bundle21 = new Bundle();
        e(IReader.QRY_SUPPORT_SCROLLBAR, null, bundle21);
        if (bundle21.getBoolean("support_scrollBar", false)) {
            i |= 2048;
        }
        this.v.d(i);
    }

    protected void t() {
        if (this.k == null) {
            return;
        }
        this.m = new MttInputTextDialog.IIputTextMessageBoxHandler() {
            @Override
            public void a() {
                String b2;
                if (ReaderDefaultView.this.s == null || (b2 = ReaderDefaultView.this.s.b()) == null || TextUtils.isEmpty(b2)) {
                    return;
                }
                Bundle bundle = new Bundle();
                bundle.putString("pwd", b2);
                ReaderDefaultView.this.v.J = b2;
                Bundle bundle2 = new Bundle();
                ReaderDefaultView.this.e(309, bundle, bundle2);
                ReaderDefaultView.this.s = null;
                if (!bundle2.containsKey("validpass")) {
                    ReaderDefaultView.this.u();
                } else {
                    if (bundle2.getBoolean("validpass", false)) {
                        return;
                    }
                    PlatformStatUtils.a("FILE_READER_PWD_ERROR");
                    ReaderDefaultView.this.a(MttResources.l(R.string.b6v), MttResources.l(R.string.b6y));
                }
            }

            @Override
            public void b() {
                if (ReaderDefaultView.this.s == null) {
                    return;
                }
                ReaderDefaultView readerDefaultView = ReaderDefaultView.this;
                readerDefaultView.s = null;
                if (readerDefaultView.p != null) {
                    ReaderDefaultView.this.p.k();
                }
                PlatformStatUtils.a("FILE_READER_PWD_CANCEL");
            }
        };
        if (this.s == null) {
            this.s = new MttInputTextDialog(this.k, MttResources.l(R.string.b5g), this.m);
        }
        this.s.show();
        PlatformStatUtils.a("FILE_READER_PWD_SHOW");
    }

    void u() {
        Context context = this.k;
        if (context != null) {
            this.t = new MttLoadingDialog(context);
            this.t.a(MttResources.l(R.string.b3l));
            this.t.setOnKeyListener(new DialogInterface.OnKeyListener() {
                @Override
                public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
                    if (keyEvent.getAction() != 0 || i != 4 || keyEvent.getRepeatCount() != 0) {
                        return false;
                    }
                    ReaderDefaultView.this.v();
                    if (ReaderDefaultView.this.p == null) {
                        return true;
                    }
                    ReaderDefaultView.this.p.k();
                    return true;
                }
            });
            this.t.show();
        }
    }

    void v() {
        MttLoadingDialog mttLoadingDialog = this.t;
        if (mttLoadingDialog != null) {
            mttLoadingDialog.dismiss();
            this.t = null;
        }
    }

    public boolean w() {
        Bundle bundle = new Bundle();
        e(320, null, bundle);
        return bundle.containsKey(Bookmarks.COLUMN_MODIFIED) && bundle.getBoolean(Bookmarks.COLUMN_MODIFIED);
    }

    protected void x() {
        e(IReader.REVERT_ALL_MODIFICATION, null, null);
        if (this.f.l()) {
            this.f.e(0);
            this.v.m("doc_exit_edit");
        }
    }

    public void y() {
        if (!z()) {
            FileLog.a("ThirdCallReader", "AutoSave: do not save, because not support");
            return;
        }
        AutoSaver autoSaver = (AutoSaver) this.v.a(AutoSaver.class);
        if (autoSaver.b()) {
            FileLog.a("ThirdCallReader", "AutoSave: do not save, because already does");
        } else {
            autoSaver.a(new Function1<String, Unit>() {
                @Override
                public Unit invoke(String str) {
                    Bundle bundle = new Bundle();
                    bundle.putBoolean("clearRevert", false);
                    bundle.putString("destfile", str);
                    ReaderDefaultView.this.e(317, bundle, null);
                    return Unit.INSTANCE;
                }
            });
        }
    }

    protected boolean z() {
        Bundle bundle = new Bundle();
        e(10030, null, bundle);
        return bundle.getBoolean("support", false);
    }
}