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

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


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

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import androidx.core.internal.view.SupportMenu;
import androidx.core.view.InputDeviceCompat;
import com.tencent.common.manifest.EventEmiter;
import com.tencent.common.manifest.EventMessage;
import com.tencent.common.manifest.annotation.CreateMethod;
import com.tencent.common.manifest.annotation.EventReceiver;
import com.tencent.common.task.Continuation;
import com.tencent.common.task.QBTask;
import com.tencent.common.threadpool.BrowserExecutorSupplier;
import com.tencent.common.utils.ThreadUtils;
import com.tencent.imsdk.BaseConstants;
import com.tencent.mtt.R;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.ui.widget.QBWebImageView;
import com.tencent.mtt.browser.bookmark.engine.Bookmarks;
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.dex.base.ReaderMessage;
import com.tencent.mtt.external.reader.dex.base.services.InteractionRecord;
import com.tencent.mtt.external.reader.dex.component.MttFileLoadingDialog;
import com.tencent.mtt.external.reader.dex.internal.ReaderUserBehaviorUtils;
import com.tencent.mtt.external.reader.pdf.PDFLogRecorder;
import com.tencent.mtt.external.setting.base.RotateScreenManager;
import com.tencent.mtt.newskin.SimpleSkinBuilder;
import com.tencent.mtt.tool.FilePreferenceManager;
import com.tencent.mtt.view.dialog.alert.NewQBAlertDialogBuilder;
import com.tencent.mtt.view.dialog.alert.QBAlertDialog;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;

public class ReaderPdfView extends ReaderDefaultView {
    private int A;
    private MttFileLoadingDialog B;

    boolean f56882a;

    boolean f56883b;

    boolean f56884c;
    private ReaderMessage y;
    private ReaderMessage.MessageEvent z;

    public ReaderPdfView(Context context) {
        super(context);
        this.f56882a = false;
        this.f56883b = false;
        this.y = new ReaderMessage();
        this.z = null;
        EventEmiter.getDefault().register("on_pdf_sig_selected", this);
    }

    private void C() {
        this.z = new ReaderMessage.MessageEvent() {
            @Override
            public void a(Message message) {
            }
        };
        this.y.a(this.z);
    }

    private void F() {
        this.f.e(3);
        this.f.m();
        Bundle bundle = new Bundle();
        bundle.putInt("AnnoMode", -1);
        e(11003, bundle, null);
    }

    private void a(int i, int i2, boolean z) {
        this.f.a(i, i2, z);
    }

    private void a(Bundle bundle) {
        int i = bundle.getInt("AnnoMode", -1);
        bundle.putInt("AnnoColor", (i == 0 || i == 1 || i == 4) ? SupportMenu.CATEGORY_MASK : InputDeviceCompat.SOURCE_ANY);
        e(11003, bundle, null);
        b(i);
    }

    public void a(String str) {
        Bundle bundle = new Bundle();
        bundle.putInt("AnnoMode", 5);
        bundle.putString("sigPath", str);
        e(11003, bundle, null);
    }

    private void b(int i) {
        String str;
        String str2;
        String str3;
        if (i == 3) {
            str = "HAS_HL_TEXT_ANNO_DIALOG_SHOWED";
            if (FilePreferenceManager.a().getBoolean("HAS_HL_TEXT_ANNO_DIALOG_SHOWED", false)) {
                return;
            }
            str2 = "https://static.res.qq.com/nav/file/reader_anno_highlight_text_guide.png";
            str3 = "在文字区域长按,即可高亮对应文字。";
        } else {
            if (i != 2) {
                return;
            }
            str = "HAS_HL_RECT_ANNO_DIALOG_SHOWED";
            if (FilePreferenceManager.a().getBoolean("HAS_HL_RECT_ANNO_DIALOG_SHOWED", false)) {
                return;
            }
            str2 = "https://static.res.qq.com/nav/file/reader_anno_hightlight_rect_guide.gif";
            str3 = "手指在页面滑动将出现选框";
        }
        b(str2, str3);
        FilePreferenceManager.a().setBoolean(str, true);
    }

    private void b(String str, String str2) {
        NewQBAlertDialogBuilder newQBAlertDialogBuilder = new NewQBAlertDialogBuilder();
        newQBAlertDialogBuilder.b(str2);
        newQBAlertDialogBuilder.a("我知道了", 1);
        newQBAlertDialogBuilder.c(false);
        final QBAlertDialog a2 = newQBAlertDialogBuilder.a();
        a2.setCanceledOnTouchOutside(true);
        a2.h(true);
        a2.a(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                if (view.getId() == 100) {
                    a2.dismiss();
                }
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        if (!TextUtils.isEmpty(str)) {
            QBWebImageView qBWebImageView = new QBWebImageView(this.k);
            qBWebImageView.setUrl(str);
            a2.a(qBWebImageView, new FrameLayout.LayoutParams(MttResources.s(280), MttResources.s(149)));
            SimpleSkinBuilder.a((ImageView) qBWebImageView).f();
        }
        a2.show();
    }

    void B() {
        this.f.b(true);
        this.f.d(false);
        this.f.b((String) null);
        this.A = 0;
        a(false, false);
        QBTask.a(20L).a((Continuation<Void, TContinuationResult>) new Continuation<Void, Object>() {
            @Override
            public Object then(QBTask<Void> qBTask) throws Exception {
                RotateScreenManager.a().b((Activity) ReaderPdfView.this.k, 4, 2);
                return null;
            }
        }, 6);
        a(true);
        d(true);
    }

    @Override
    public int a() {
        super.a();
        C();
        this.f.g(true);
        this.f.f(2);
        Bundle bundle = new Bundle();
        e(22, null, bundle);
        if (bundle.containsKey("support")) {
            this.f56883b = bundle.getBoolean("support", false);
        }
        Object p = MttResources.p(R.drawable.b26);
        Object p2 = MttResources.p(R.drawable.b2h);
        Object p3 = MttResources.p(R.drawable.b2g);
        e(11005, p, null);
        e(11006, p2, null);
        e(IReader.SET_ANNOTATION_ROTATE_BMP, p3, null);
        a(true);
        d(true);
        this.w = 0;
        return 0;
    }

    @Override
    public void a(int i, int i2) {
        if (this.f.e()) {
            return;
        }
        if (this.f.j()) {
            if (this.A == 0) {
                a(true, true);
                return;
            } else {
                this.f.b(false, true);
                return;
            }
        }
        if (this.A != 0) {
            this.f.a(false, true);
        } else {
            if (this.g) {
                return;
            }
            this.f.a(true, true);
        }
    }

    @Override
    public void a(int i, Object obj, Object obj2) {
        if (i != 3048 || !(obj instanceof Bundle)) {
            super.a(i, obj, obj2);
            return;
        }
        this.f.e(3);
        this.f.m();
        e(11003, obj, null);
        this.v.m("doc_pdf_mark");
    }

    void a(boolean z) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("enable", z);
        e(BaseConstants.ERR_SVR_GROUP_REQ_ALLREADY_BEEN_PROCESSED, bundle, null);
    }

    @Override
    public void b() {
        ((InteractionRecord) this.v.a(InteractionRecord.class)).a();
        if (this.f.j()) {
            if (this.A == 0) {
                a(true, true);
            } else {
                this.f.b(false, true);
            }
        }
    }

    @Override
    public void b(int i, Object obj, Object obj2) {
        boolean z = true;
        if (i != 50 && i != 1 && i != 101) {
            PDFLogRecorder.a().a(i, obj, obj2);
        }
        if (i == 1) {
            Bundle bundle = (Bundle) obj;
            if (this.v.aO()) {
                return;
            }
            if (this.A == 0) {
                this.f.a(bundle);
            } else {
                this.f.a(this.u);
                this.f.b(0);
                this.f.a(bundle.getInt("cur_page"), bundle.getInt("page_count"));
                this.f.d();
            }
            this.f.B();
            z = false;
        } else if (i == 12) {
            d();
        } else if (i != 19) {
            if (i != 104) {
                if (i == 221) {
                    boolean b2 = b(obj2);
                    a(obj2, b2);
                    if (!b2) {
                        MttFileLoadingDialog mttFileLoadingDialog = this.B;
                        if (mttFileLoadingDialog != null) {
                            mttFileLoadingDialog.dismiss();
                            this.B = null;
                        }
                        if (this.p != null) {
                            this.p.g();
                        }
                        this.n = false;
                        if (obj2 instanceof Bundle) {
                            Bundle bundle2 = (Bundle) obj2;
                            String string = bundle2.getString("saveresult", "failed");
                            int i2 = bundle2.getInt("errCode", -1);
                            if (!TextUtils.isEmpty(string)) {
                                if (string.equalsIgnoreCase("failed")) {
                                    if (this.p != null && this.p.g != null) {
                                        this.p.g.a(1);
                                        this.p.g.b(i2);
                                        this.p.g.addToStatManager(false);
                                    }
                                } else if (string.equalsIgnoreCase("success") && this.p != null && this.p.g != null) {
                                    this.p.g.a(0);
                                    this.p.g.b(0);
                                }
                            }
                            this.f.d(bundle2);
                        }
                    }
                } else if (i != 506) {
                    if (i != 507) {
                        switch (i) {
                            case 204:
                                this.f56882a = ((Bundle) obj).getBoolean(IReaderCallbackListener.BOOLEAN_FLAG_KEY);
                                break;
                            case 205:
                                if (this.p != null) {
                                    this.p.b(obj);
                                    break;
                                }
                                break;
                            case 206:
                                break;
                            default:
                                switch (i) {
                                    case 501:
                                        this.f.F();
                                        break;
                                    case 502:
                                        this.f.G();
                                        break;
                                    case 503:
                                        if (obj instanceof Bundle) {
                                            this.f.e((Bundle) obj);
                                            break;
                                        }
                                        break;
                                    case 504:
                                        if (obj instanceof String) {
                                            this.f.c((String) obj);
                                            break;
                                        }
                                        break;
                                }
                        }
                    } else {
                        this.f.H();
                    }
                } else if (obj instanceof Bundle) {
                    this.f.f((Bundle) obj);
                }
            } else if (obj instanceof Bundle) {
                this.v.aV();
                if (this.p != null && this.p.g != null) {
                    this.p.g.b(true);
                }
                Bundle bundle3 = (Bundle) obj;
                boolean z2 = bundle3.getBoolean(Bookmarks.COLUMN_MODIFIED, false);
                this.f.c(z2, bundle3.getBoolean("save", false));
                this.i = z2;
            }
        } else if (((Integer) obj2).intValue() == 0) {
            int i3 = this.f56882a ? 1024 : 0;
            if (this.f56883b) {
                i3 |= 8388608;
            }
            this.f.h(i3);
        }
        if (!z || this.f56884c) {
            return;
        }
        super.b(i, obj, obj2);
    }

    @Override
    public boolean c() {
        if (this.v.Y()) {
            return false;
        }
        if (this.A != 1) {
            return super.c();
        }
        B();
        if (this.g) {
            this.f.a(true, false);
        }
        return true;
    }

    @Override
    public boolean c(int i, Object obj, Object obj2) {
        ReaderConfig readerConfig;
        String str;
        int i2;
        int i3;
        int i4;
        if (i != 2002) {
            String str2 = null;
            if (i == 2003) {
                e(308, null, null);
                FileUserBehaviorPV.a("BMLLA67_" + ReaderUserBehaviorUtils.b(this.v.t()));
                readerConfig = this.v;
                str = "doc_catalogue_clk";
            } else {
                if (i != 2006) {
                    if (i != 2007) {
                        if (i == 3025) {
                            c(obj instanceof Bundle ? ((Bundle) obj).getBoolean("exitedit", false) : false);
                            this.B = new MttFileLoadingDialog(this.k);
                            this.B.a("保存中");
                            this.B.show();
                        } else if (i == 3027) {
                            if (obj instanceof Bundle) {
                                Bundle bundle = (Bundle) obj;
                                str2 = bundle.getString("savePath");
                                r2 = bundle.getBoolean("exitedit", false);
                            }
                            b(str2, r2);
                        } else if (i != 3032) {
                            if (i == 3035) {
                                i2 = 11004;
                            } else if (i == 3041) {
                                y();
                            } else if (i == 4009) {
                                e(307, obj, null);
                            } else if (i == 4014) {
                                this.f.q();
                            } else if (i != 4105) {
                                if (i != 5024) {
                                    if (i == 4011) {
                                        e(308, null, null);
                                    } else if (i != 4012) {
                                        switch (i) {
                                            case 2009:
                                                i2 = IReader.SET_ANNO_COLOR;
                                                break;
                                            case 2010:
                                                i2 = IReader.SET_ANNO_STROKE_WIDTH;
                                                break;
                                            case 2011:
                                                i2 = IReader.SET_ANNO_WATERMARK;
                                                break;
                                            default:
                                                switch (i) {
                                                    case 4031:
                                                        F();
                                                        break;
                                                    case ReaderConstantsDefine.READER_REQ_PDF_HIGHLIGHT:
                                                        F();
                                                        a(1, -1, true);
                                                        break;
                                                    case ReaderConstantsDefine.READER_REQ_PDF_SCRAWL:
                                                        F();
                                                        i3 = 2;
                                                        a(i3, -1, true);
                                                        break;
                                                    case ReaderConstantsDefine.READER_REQ_PDF_SIGN:
                                                        F();
                                                        i4 = 3;
                                                        a(5, i4, true);
                                                        break;
                                                    default:
                                                        switch (i) {
                                                            case ReaderConstantsDefine.READER_REQ_PDF_IMG_POPMENU:
                                                                this.f.E();
                                                                break;
                                                            case ReaderConstantsDefine.READER_REQ_PDF_FREETEXT:
                                                                F();
                                                                i3 = 4;
                                                                a(i3, -1, true);
                                                                break;
                                                            case ReaderConstantsDefine.READER_REQ_PDF_WATERMARK:
                                                                F();
                                                                i4 = 34;
                                                                a(5, i4, true);
                                                                break;
                                                            default:
                                                                return false;
                                                        }
                                                }
                                        }
                                    }
                                }
                            } else if (this.A == 0) {
                                this.f.A();
                                this.f.c(0);
                            } else {
                                if (this.v.Y()) {
                                    this.p.k();
                                    return true;
                                }
                                B();
                                if (this.g) {
                                    this.f.a(true, false);
                                }
                                this.f.A();
                            }
                            e(i2, obj, obj2);
                        } else if (w() && (obj2 instanceof Bundle)) {
                            ((Bundle) obj2).putBoolean("handledmodified", true);
                        }
                    } else if (obj instanceof Bundle) {
                        a((Bundle) obj);
                    }
                    return true;
                }
                F();
                readerConfig = this.v;
                str = "doc_pdf_mark";
            }
            readerConfig.m(str);
            return true;
        }
        boolean j = this.f.j();
        if (this.A == 0) {
            this.A = 1;
            this.f.b(false);
            this.f.d(true);
            this.f.b("退出全屏");
            this.f.c(true);
            if (j) {
                this.f.a(true, false, false);
            }
            a(false);
            d(false);
            QBTask.a(i == 4012 ? 200L : 20L).a((Continuation<Void, TContinuationResult>) new Continuation<Void, Object>() {
                @Override
                public Object then(QBTask<Void> qBTask) {
                    RotateScreenManager.a().a((Activity) ReaderPdfView.this.k, 4, 2);
                    return null;
                }
            }, 6);
            StatManager.b().c("AHNGP2");
            this.f.z();
        }
        return true;
    }

    public void d(boolean z) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("enable", z && A());
        e(IReader.SET_ENABLE_ANNO_MENU, bundle, null);
    }

    @Override
    public void f() {
        super.f();
        this.y.a();
        EventEmiter.getDefault().unregister("on_pdf_sig_selected", this);
    }

    @Override
    public void h() {
        if (this.f.j()) {
            this.f.g(true);
        }
        this.f.f(2);
        this.f.a(1024, this.f56882a);
        this.w = 0;
    }

    @Override
    public void i() {
        this.f.f(0);
        this.f.a(1024, false);
        this.f.g(false);
    }

    @Override
    protected void k() {
        if (this.f.j()) {
            if (this.A == 0) {
                a(false, true);
            } else {
                this.f.b(true, true);
            }
        }
    }

    @EventReceiver(createMethod = CreateMethod.NONE, eventName = "on_pdf_sig_selected")
    public void onSignatureSelected(EventMessage eventMessage) {
        ReaderConfig readerConfig;
        String str;
        if (eventMessage.arg instanceof String) {
            final String str2 = (String) eventMessage.arg;
            if (TextUtils.isEmpty(str2)) {
                return;
            }
            if (ThreadUtils.isMainThread()) {
                a(str2);
            } else {
                BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
                    @Override
                    public void run() {
                        ReaderPdfView.this.a(str2);
                    }
                });
            }
            int i = eventMessage.arg0;
            if (this.v != null) {
                if (i == 1) {
                    readerConfig = this.v;
                    str = "doc_pdfsign_003";
                } else {
                    if (i != 2) {
                        return;
                    }
                    readerConfig = this.v;
                    str = "doc_pdfsign_005";
                }
                readerConfig.n(str);
            }
        }
    }
}