导航菜单

页面标题

页面副标题

Mint v5.7.3 - PDFViewerActivity.java 源代码

正在查看: Mint v5.7.3 应用的 PDFViewerActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.htmedia.mint.ui.activity;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import com.htmedia.mint.AppController;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import x4.gj0;

public class PDFViewerActivity extends com.htmedia.mint.ui.activity.a {
    gj0 a;
    Context b;
    String c;
    ProgressDialog d;
    public int e = 0;
    boolean f = false;
    boolean g = false;
    private final String h = "javascript:(function() {document.querySelector('[role=\"toolbar\"]').remove();})()";
    CountDownTimer i;

    class a extends WebViewClient {
        boolean a = false;
        final String b;

        a(String str) {
            this.b = str;
        }

        @Override
        public void onPageFinished(WebView webView, String str) {
            if (!this.a) {
                PDFViewerActivity.this.L(this.b);
                return;
            }
            PDFViewerActivity pDFViewerActivity = PDFViewerActivity.this;
            pDFViewerActivity.f = true;
            CountDownTimer countDownTimer = pDFViewerActivity.i;
            if (countDownTimer != null) {
                countDownTimer.cancel();
            }
            PDFViewerActivity.this.a.i.loadUrl("javascript:(function() {document.querySelector('[role=\"toolbar\"]').remove();})()");
            PDFViewerActivity.this.M(false);
        }

        @Override
        public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
            this.a = true;
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            return false;
        }
    }

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

        @Override
        public void onCancel(DialogInterface dialogInterface) {
            PDFViewerActivity pDFViewerActivity = PDFViewerActivity.this;
            if (pDFViewerActivity.f) {
                return;
            }
            pDFViewerActivity.J("Canceling from on Dialog Cancel Listener");
            PDFViewerActivity pDFViewerActivity2 = PDFViewerActivity.this;
            pDFViewerActivity2.g = true;
            pDFViewerActivity2.M(false);
            PDFViewerActivity.this.a.i.stopLoading();
            PDFViewerActivity.this.a.i.setVisibility(8);
            PDFViewerActivity.this.a.d.setVisibility(0);
        }
    }

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

        @Override
        public void onClick(View view) {
            PDFViewerActivity.this.finish();
        }
    }

    class d extends CountDownTimer {
        d(long j, long j2) {
            super(j, j2);
        }

        @Override
        public void onFinish() {
            PDFViewerActivity pDFViewerActivity = PDFViewerActivity.this;
            if (pDFViewerActivity.f) {
                return;
            }
            pDFViewerActivity.J("Canceling on timer completion");
            PDFViewerActivity pDFViewerActivity2 = PDFViewerActivity.this;
            pDFViewerActivity2.g = true;
            pDFViewerActivity2.M(false);
            PDFViewerActivity.this.a.i.stopLoading();
            PDFViewerActivity.this.a.i.setVisibility(8);
            PDFViewerActivity.this.a.d.setVisibility(0);
        }

        @Override
        public void onTick(long j) {
            PDFViewerActivity pDFViewerActivity = PDFViewerActivity.this;
            pDFViewerActivity.e++;
            pDFViewerActivity.J("TIMER TICK - " + PDFViewerActivity.this.e);
        }
    }

    public void M(boolean z) {
        try {
            J("InSHowProgressDialog " + z);
            if (!z || this.g) {
                ProgressDialog progressDialog = this.d;
                if (progressDialog != null) {
                    progressDialog.dismiss();
                }
            } else {
                ProgressDialog progressDialog2 = this.d;
                if (progressDialog2 != null && progressDialog2.isShowing()) {
                    J("Skipping dialog");
                }
                ProgressDialog progressDialog3 = new ProgressDialog(this);
                this.d = progressDialog3;
                progressDialog3.setMessage("Please wait!");
                this.d.setIndeterminate(false);
                this.d.setCancelable(true);
                this.d.setCanceledOnTouchOutside(false);
                this.d.setOnCancelListener(new b());
                this.d.show();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void setupToolbarAndDrawer(String str) {
        this.a.e.setContentInsetStartWithNavigation(0);
        setSupportActionBar(this.a.e);
        getSupportActionBar().setDisplayShowTitleEnabled(false);
        this.a.e.setTitle("Back");
        this.a.h.setText(str);
        this.a.e.setOnClickListener(new c());
        if (AppController.j().E()) {
            getWindow().setStatusBarColor(-16777216);
            getWindow().getDecorView().setSystemUiVisibility(0);
            this.a.e.setBackgroundColor(getResources().getColor(2131100008));
            this.a.e.setTitleTextColor(getResources().getColor(2131101002));
            this.a.e.setNavigationIcon(2131231333);
            this.a.h.setTextColor(getResources().getColor(2131101009));
            return;
        }
        getWindow().setStatusBarColor(-1);
        getWindow().getDecorView().setSystemUiVisibility(8192);
        this.a.e.setBackgroundColor(getResources().getColor(2131101002));
        this.a.e.setTitleTextColor(-16777216);
        this.a.e.setNavigationIcon(2131231330);
        this.a.h.setTextColor(getResources().getColor(2131101008));
    }

    public void J(String str) {
        com.htmedia.mint.utils.o1.a("MFHOLDING ", "--> " + str);
    }

    public void K() {
        try {
            this.i = new d(30000L, 1000L).start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void L(String str) {
        M(true);
        this.a.i.invalidate();
        this.a.i.getSettings().setJavaScriptEnabled(true);
        this.a.i.getSettings().setBuiltInZoomControls(true);
        this.a.i.getSettings().setDisplayZoomControls(false);
        this.a.i.loadUrl("http://docs.google.com/gview?embedded=true&url=" + this.c);
        this.a.i.setWebViewClient(new a(str));
    }

    public void onBackPressed() {
        finish();
    }

    public void onConfigurationChanged(@NonNull Configuration configuration) {
        super.onConfigurationChanged(configuration);
        AppController.e(getIntent(), this);
    }

    protected void onCreate(@Nullable Bundle bundle) {
        super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
        this.a = DataBindingUtil.setContentView(this, 2131625121);
        try {
            this.b = this;
            K();
            setupToolbarAndDrawer(BuildConfig.FLAVOR);
            if (getIntent().getExtras() == null || !getIntent().getExtras().containsKey("url")) {
                J("No Extras");
            } else {
                this.c = getIntent().getExtras().getString("url");
                J("Extras " + this.c);
                L(this.c);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() != 16908332) {
            return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
        }
        finish();
        return true;
    }
}