导航菜单

页面标题

页面副标题

RummyCircle v11000.89 - OverlayWebviewActivity.java 源代码

正在查看: RummyCircle v11000.89 应用的 OverlayWebviewActivity.java JAVA 源代码文件

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


package com.games24x7.pgwebview.ui;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.view.animation.AnimationSet;
import android.view.animation.LinearInterpolator;
import android.view.animation.ScaleAnimation;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebViewClient;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.activity.r;
import androidx.activity.w;
import androidx.appcompat.widget.b0;
import androidx.camera.camera2.internal.S0;
import androidx.camera.camera2.internal.Z;
import androidx.camera.camera2.internal.p;
import androidx.camera.core.A;
import androidx.camera.core.B;
import androidx.core.graphics.b;
import androidx.core.view.G0;
import androidx.core.view.X;
import androidx.core.view.g0;
import androidx.core.view.j0;
import androidx.core.view.l0;
import androidx.core.view.q0;
import androidx.fragment.app.FragmentActivity;
import com.games24x7.pgwebview.R;
import com.games24x7.pgwebview.communication.WebviewRequestEventHandler;
import com.games24x7.pgwebview.communication.external.eventbus.events.JsInterfaceHolder;
import com.games24x7.pgwebview.communication.internal.eventbus.event.OverlayReqEvent;
import com.games24x7.pgwebview.communication.internal.eventbus.event.OverlayWebviewEvent;
import com.games24x7.pgwebview.custom.PGWebView;
import com.games24x7.pgwebview.enums.WebviewEventType;
import com.games24x7.pgwebview.models.CustomWebviewResponse;
import com.games24x7.pgwebview.models.WebViewConfiguration;
import com.games24x7.pgwebview.util.a;
import com.games24x7.pgwebview.webviewHost.a;
import com.google.android.gms.common.ConnectionResult;
import com.google.firebase.perf.v1.h;
import com.google.gson.d;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.WeakHashMap;
import java.util.concurrent.ExecutionException;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.Unit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import org.greenrobot.eventbus.ThreadMode;
import org.greenrobot.eventbus.i;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;

@Metadata
public final class OverlayWebviewActivity extends FragmentActivity {
    private boolean aspectRatioBasedCalcNeeded;
    private ImageButton btncancel;
    private final boolean clearPreviousSession;
    private CustomWebviewResponse customWebviewResponse;
    private boolean drawBehindSafeArea;
    private boolean fullOldCalc;
    private ImageView imgView;
    private boolean inProgress;
    private RelativeLayout innerOverlayRelativeLayout;
    private final boolean interceptReq;
    private boolean isBackGroundTransparent;
    private boolean isOffScreenLoad;
    private boolean isOpenShowOverlay;
    private boolean isPLOWebview;
    private long loaderStartTimeStamp;
    private TextView loaderText;
    private String mCameraPhotoPath;
    private Uri mCapturedImageURI;
    private ValueCallback<Uri[]> mFilePathCallback;
    private ValueCallback<Uri> mUploadMessage;
    private String orientation;
    private RelativeLayout overlay;
    private int overlayBackgroundColor;
    private long ploCloseTimeStamp;
    private long ploLoadingTimeStamp;
    private boolean showLoaderView;
    private String url;
    private boolean useNewCloseButton;
    private WebViewConfiguration webViewConfiguration;
    private RelativeLayout webViewLayout;
    private PGWebView webview;
    private boolean webviewLoadError;

    @NotNull
    private String webviewId = "";

    @NotNull
    private JSONObject webviewMetadata = new JSONObject();
    private final String TAG = "OverlayWebviewActivity";
    private final int FILECHOOSER_RESULTCODE = 2888;

    @NotNull
    private JSONObject metaData = new JSONObject();

    @NotNull
    private final String removeMandateMobileHeader = "";
    private boolean isOverlayAnimationRequired = true;
    private final boolean shouldHandleBack = true;
    private boolean showCloseButton = true;
    private boolean isFirstLoad = true;
    private long ploEntryAnimDuration = 1000;
    private long ploExitAnimDuration = 550;
    private final int maxOverlayWidth = 100;
    private final int maxOverlayHeight = 100;
    private final int minOverlayWidth = 39;
    private final int minOverlayHeight = 39;
    private int overlayHeight = 85;
    private int overlayWidth = 85;
    private final double aspectRatioDefault = 1.7757575757575759d;
    private double aspectRatio = 1.7757575757575759d;

    private final boolean canGoBack(String str) {
        boolean z;
        PGWebView pGWebView;
        try {
            pGWebView = this.webview;
        } catch (InterruptedException | ExecutionException unused) {
            z = false;
        }
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        z = pGWebView.canGoBack();
        sendWebviewEvent(new OverlayWebviewEvent(str, WebviewEventType.CANGOBACK, new JSONObject().put("value", z), (PGWebView) null, false, 24, (DefaultConstructorMarker) null));
        return z;
    }

    private final boolean canGoForward(String str) {
        boolean z;
        PGWebView pGWebView;
        try {
            pGWebView = this.webview;
        } catch (InterruptedException | ExecutionException unused) {
            z = false;
        }
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        z = pGWebView.canGoForward();
        sendWebviewEvent(new OverlayWebviewEvent(str, WebviewEventType.CANGOFORWARD, new JSONObject().put("value", z), (PGWebView) null, false, 24, (DefaultConstructorMarker) null));
        return z;
    }

    private final void configure() {
        throw new UnsupportedOperationException("Method not decompiled: com.games24x7.pgwebview.ui.OverlayWebviewActivity.configure():void");
    }

    public static final void m12configure$lambda3(OverlayWebviewActivity this$0, View view) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        this$0.closeOverlay();
    }

    public final void configureWebviewUI() {
        RelativeLayout relativeLayout;
        View view;
        if (this.fullOldCalc) {
            WindowManager.LayoutParams attributes = getWindow().getAttributes();
            attributes.dimAmount = 0.0f;
            getWindow().setAttributes(attributes);
            getWindow().addFlags(2);
            DisplayMetrics displayMetrics = new DisplayMetrics();
            getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
            RelativeLayout relativeLayout2 = this.overlay;
            if (relativeLayout2 == null) {
                Intrinsics.q("overlay");
                throw null;
            }
            WeakHashMap<View, g0> weakHashMap = X.a;
            q0 a = X.e.a(relativeLayout2);
            b f = a != null ? a.a.f(128) : null;
            int i = (f != null ? f.b : 0) * 2;
            int i2 = (f != null ? f.a : 0) * 2;
            int i3 = Build.VERSION.SDK_INT;
            int i4 = displayMetrics.heightPixels;
            if (i3 > 34) {
                i4 -= i;
            }
            int i5 = displayMetrics.widthPixels;
            if (i3 > 34) {
                i5 -= i2;
            }
            attributes.width = i5;
            attributes.height = i4;
            getWindow().setLayout(i5, i4);
            getWindow().setGravity(17);
        }
        this.isOpenShowOverlay = true;
        if (this.isOverlayAnimationRequired) {
            ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, 1, 0.5f, 1, 0.5f);
            scaleAnimation.setInterpolator(new LinearInterpolator());
            scaleAnimation.setDuration(this.isPLOWebview ? this.ploEntryAnimDuration : 200L);
            scaleAnimation.setAnimationListener(new configureWebviewUI.1(this));
            AnimationSet animationSet = new AnimationSet(false);
            animationSet.addAnimation(scaleAnimation);
            if (this.fullOldCalc) {
                relativeLayout = this.overlay;
                if (relativeLayout == null) {
                    Intrinsics.q("overlay");
                    throw null;
                }
            } else {
                relativeLayout = this.innerOverlayRelativeLayout;
                if (relativeLayout == null) {
                    Intrinsics.q("innerOverlayRelativeLayout");
                    throw null;
                }
            }
            relativeLayout.setAnimation(animationSet);
            view = this.overlay;
            if (view == null) {
                Intrinsics.q("overlay");
                throw null;
            }
        } else {
            RelativeLayout relativeLayout3 = this.overlay;
            if (relativeLayout3 == null) {
                Intrinsics.q("overlay");
                throw null;
            }
            relativeLayout3.setVisibility(0);
            if (!this.showCloseButton) {
                ImageButton imageButton = this.btncancel;
                if (imageButton != null) {
                    imageButton.setVisibility(4);
                    return;
                } else {
                    Intrinsics.q("btncancel");
                    throw null;
                }
            }
            view = this.btncancel;
            if (view == null) {
                Intrinsics.q("btncancel");
                throw null;
            }
        }
        view.setVisibility(0);
    }

    public final File createImageFile() {
        File imageFile = File.createTempFile("JPEG_" + new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + '_', ".jpg", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES));
        StringBuilder sb = new StringBuilder("image: ");
        sb.append(imageFile);
        Log.d("imagefile", sb.toString());
        Intrinsics.checkNotNullExpressionValue(imageFile, "imageFile");
        return imageFile;
    }

    public final void dismissAlertOverlay() {
        if (this.webview != null) {
            this.isOpenShowOverlay = false;
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    private final void evaluateJS(String str, String str2) {
        runOnUiThread(new B(this, str2, 8));
    }

    public static final void m13evaluateJS$lambda18(OverlayWebviewActivity this$0, String js) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(js, "$js");
        PGWebView pGWebView = this$0.webview;
        if (pGWebView != null) {
            pGWebView.evaluateJavascript(js, null);
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    private final void getConfig() {
        int i;
        String str;
        Intent intent = getIntent();
        String stringExtra = intent.getStringExtra("url");
        this.url = stringExtra;
        if (stringExtra == null) {
            Uri data = intent.getData();
            if (data == null || (str = data.toString()) == null) {
                str = "";
            }
            this.url = str;
        }
        this.overlayHeight = intent.getIntExtra("height", 0);
        this.overlayWidth = intent.getIntExtra("width", 0);
        this.isBackGroundTransparent = intent.getBooleanExtra("isBackGroundTransparent", false);
        this.orientation = intent.getStringExtra("orientation");
        String stringExtra2 = intent.getStringExtra("id");
        this.webviewId = stringExtra2 != null ? stringExtra2 : "";
        try {
            String stringExtra3 = intent.getStringExtra("metaData");
            if (stringExtra3 == null) {
                stringExtra3 = "{}";
            }
            JSONObject jSONObject = new JSONObject(stringExtra3);
            this.webviewMetadata = jSONObject;
            this.showCloseButton = jSONObject.optBoolean("showCloseButton");
            this.isPLOWebview = this.webviewMetadata.optBoolean("isPLOWebview");
            this.drawBehindSafeArea = this.webviewMetadata.optBoolean("drawBehindSafeArea");
            this.useNewCloseButton = this.webviewMetadata.optBoolean("useNewCloseButton");
            this.ploEntryAnimDuration = this.webviewMetadata.optLong("ploEntryAnimDuration", 1000L);
            this.ploExitAnimDuration = this.webviewMetadata.optLong("ploExitAnimDuration", 550L);
            if (this.webviewMetadata.has("aspectRatio")) {
                this.aspectRatio = this.webviewMetadata.optDouble("aspectRatio", this.aspectRatioDefault);
                this.aspectRatioBasedCalcNeeded = true;
            }
            try {
                i = Color.parseColor(this.webviewMetadata.optString("overlayBackgroundColor", "#00000000"));
            } catch (Exception unused) {
                Log.e(this.TAG, " getConfig :: exception while getting overlay bg color");
                i = 0;
            }
            this.overlayBackgroundColor = i;
            this.showLoaderView = this.webviewMetadata.optBoolean("showLoaderView", false);
            this.isOffScreenLoad = this.webviewMetadata.optBoolean("offScreenLoad", false);
            this.fullOldCalc = this.webviewMetadata.optBoolean("useFullOldCalc", false);
            try {
                this.isOverlayAnimationRequired = this.webviewMetadata.getBoolean("isOverlayAnimationRequired");
            } catch (Exception unused2) {
                Log.e(this.TAG, "getConfig :: Exception while getting the isEntryAnimationRequired JSON Object");
            }
            Log.e(this.TAG, "getConfig :: Value of MetaData is :: " + this.webviewMetadata);
            Log.e(this.TAG, "getConfig :: Value of ShowButton Close is :: " + this.showCloseButton);
            Log.e(this.TAG, "getConfig :: Value of isPLOWebview is :: " + this.isPLOWebview);
            Log.e(this.TAG, "getConfig :: Value of isOverlayAnimationRequired is :: " + this.isOverlayAnimationRequired);
            Log.e(this.TAG, "getConfig :: AspectRatio Calc Needed : " + this.aspectRatioBasedCalcNeeded + " Value of aspectRatio : " + this.aspectRatio + ' ');
        } catch (Exception unused3) {
            String str2 = this.TAG;
            StringBuilder a = com.games24x7.pgwebview.a.a("getConfig :: Got Exception while getting the data :: Metadata value is ");
            a.append(intent.getStringExtra("metaData"));
            Log.e(str2, a.toString());
        }
        this.customWebviewResponse = (CustomWebviewResponse) new d().k(intent.getStringExtra("webviewResponse"), new getConfig.1().getType());
        Object k = new d().k(intent.getStringExtra("webviewConfig"), new getConfig.2().getType());
        Intrinsics.checkNotNullExpressionValue(k, "Gson().fromJson(\n       …tion>() {}.type\n        )");
        this.webViewConfiguration = (WebViewConfiguration) k;
    }

    private final void goBack(String str) {
        goBackWebView();
    }

    private final void goBackWebView() {
        PGWebView pGWebView = this.webview;
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        if (!pGWebView.canGoBack()) {
            Log.i(this.TAG, "BACK BUTTON : can not go back, Finish");
            finish();
            return;
        }
        Log.i(this.TAG, "BACK BUTTON : can go back");
        PGWebView pGWebView2 = this.webview;
        if (pGWebView2 != null) {
            pGWebView2.goBack();
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    private final void goForward(String str) {
        runOnUiThread(new r(this, 7));
    }

    public static final void m14goForward$lambda17(OverlayWebviewActivity this$0) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        PGWebView pGWebView = this$0.webview;
        if (pGWebView != null) {
            pGWebView.goForward();
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    private final void hideSystemUI() {
        int i = Build.VERSION.SDK_INT;
        if (i >= 30) {
            j0.a(getWindow(), false);
            G0 g0 = new G0(getWindow(), getWindow().getDecorView());
            g0.a(7);
            g0.d();
        } else {
            View decorView = getWindow().getDecorView();
            Intrinsics.checkNotNullExpressionValue(decorView, "window.decorView");
            decorView.setSystemUiVisibility(3846);
        }
        if (!this.drawBehindSafeArea || i < 28) {
            return;
        }
        w.f(getWindow().getAttributes());
    }

    private final void initialize() {
        WebViewClient webViewClient = new initialize.client.1(this);
        WebChromeClient webChromeClient = new initialize.webChromeClient.1(this);
        List<JsInterfaceHolder> jsInterfaceList = WebviewRequestEventHandler.Companion.getJsInterfaceList(this.webviewId);
        if (jsInterfaceList != null) {
            for (JsInterfaceHolder jsInterfaceHolder : jsInterfaceList) {
                PGWebView pGWebView = this.webview;
                if (pGWebView == null) {
                    Intrinsics.q("webview");
                    throw null;
                }
                pGWebView.addJavascriptInterface(jsInterfaceHolder.getJsClass(), jsInterfaceHolder.getJsName());
            }
        }
        PGWebView pGWebView2 = this.webview;
        if (pGWebView2 == null) {
            Intrinsics.q("webview");
            throw null;
        }
        pGWebView2.setWebViewClient(webViewClient);
        PGWebView pGWebView3 = this.webview;
        if (pGWebView3 == null) {
            Intrinsics.q("webview");
            throw null;
        }
        pGWebView3.setWebChromeClient(webChromeClient);
    }

    private final void loadData(String str, String str2, String str3, String str4, String str5) {
        runOnUiThread(new h(this, str5, str2, str3, str4));
    }

    public static final void m15loadData$lambda12(OverlayWebviewActivity this$0, String baseUrl, String data, String mimeType, String encoding) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(baseUrl, "$baseUrl");
        Intrinsics.checkNotNullParameter(data, "$data");
        Intrinsics.checkNotNullParameter(mimeType, "$mimeType");
        Intrinsics.checkNotNullParameter(encoding, "$encoding");
        PGWebView pGWebView = this$0.webview;
        if (pGWebView != null) {
            pGWebView.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, null);
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    private final void loadFile(String str, String str2) {
        runOnUiThread(new S0(this, str2, 11));
    }

    public static final void m16loadFile$lambda14(OverlayWebviewActivity this$0, String filePath) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(filePath, "$filePath");
        PGWebView pGWebView = this$0.webview;
        if (pGWebView != null) {
            pGWebView.loadUrl(filePath);
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    private final void loadHtml(String str, String str2, String str3) {
        runOnUiThread(new i(this, str3, str2, 0));
    }

    public static final void m17loadHtml$lambda13(OverlayWebviewActivity this$0, String baseUrl, String html) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(baseUrl, "$baseUrl");
        Intrinsics.checkNotNullParameter(html, "$html");
        PGWebView pGWebView = this$0.webview;
        if (pGWebView != null) {
            pGWebView.loadDataWithBaseURL(baseUrl, html, null, null, null);
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    private final void loadUrl(String str, String str2) {
        Log.e(this.TAG, "loadUrl :: Id is " + str + " :: Url is :: " + str2);
        WebViewConfiguration webViewConfiguration = this.webViewConfiguration;
        if (webViewConfiguration == null) {
            Intrinsics.q("webViewConfiguration");
            throw null;
        }
        if (Intrinsics.a(webViewConfiguration.getEnableEvaluateJs(), Boolean.TRUE) && StringsKt.E(str2, "javascript:", false)) {
            evaluateJS(this.webviewId, str2);
        } else {
            runOnUiThread(new p(this, str2, 9));
        }
    }

    public static final void m18loadUrl$lambda19(OverlayWebviewActivity this$0, String url) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(url, "$url");
        PGWebView pGWebView = this$0.webview;
        if (pGWebView != null) {
            pGWebView.loadUrl(url);
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    private final void reload(String str) {
        runOnUiThread(new A(this, 4));
    }

    public static final void m19reload$lambda16(OverlayWebviewActivity this$0) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        PGWebView pGWebView = this$0.webview;
        if (pGWebView != null) {
            pGWebView.reload();
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    private final void sendWebviewCreatedEvent(PGWebView pGWebView) {
        sendWebviewEvent(new OverlayWebviewEvent(this.webviewId, WebviewEventType.CREATED, (JSONObject) null, pGWebView, false, 20, (DefaultConstructorMarker) null));
    }

    public final void sendWebviewEvent(OverlayWebviewEvent overlayWebviewEvent) {
        String str = this.TAG;
        StringBuilder a = com.games24x7.pgwebview.a.a("sendWebviewEvent :: Sending Event to the Controller :: Event is ");
        a.append(overlayWebviewEvent.getEventType());
        Log.e(str, a.toString());
        org.greenrobot.eventbus.b.c().i(overlayWebviewEvent);
    }

    private final void setBackgroundResource(String str, JSONObject jSONObject) {
        Log.e(this.TAG, "setBackgroundResource :: Setting Background Resource");
        try {
            Intrinsics.c(jSONObject);
            int optInt = jSONObject.optInt("resId");
            PGWebView pGWebView = this.webview;
            if (pGWebView != null) {
                pGWebView.setBackgroundResource(optInt);
            } else {
                Intrinsics.q("webview");
                throw null;
            }
        } catch (Exception e) {
            Log.e(this.TAG, "setBackgroundResource :: Exception while parsing the Resource Id");
            e.printStackTrace();
        }
    }

    @SuppressLint({"SourceLockedOrientationActivity"})
    private final void setOrientation() {
        try {
            setRequestedOrientation(Intrinsics.a("portrait", this.orientation) ? 1 : 0);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private final void showDialog(String str) {
        new AlertDialog.Builder(this).setMessage(str).setPositiveButton("Ok", (DialogInterface.OnClickListener) null).show();
    }

    private final void showFullScreen() {
        j0.a(getWindow(), false);
        RelativeLayout relativeLayout = this.overlay;
        if (relativeLayout == null) {
            Intrinsics.q("overlay");
            throw null;
        }
        Z z = new Z(7);
        WeakHashMap<View, g0> weakHashMap = X.a;
        X.d.u(relativeLayout, z);
        G0 g0 = new G0(getWindow(), getWindow().getDecorView());
        g0.a(7);
        g0.d();
        g0.c(false);
        g0.b(false);
    }

    public static final q0 m20showFullScreen$lambda23(View view, q0 q0Var) {
        view.setPadding(view.getPaddingLeft(), q0Var.a.f(128).b, view.getPaddingRight(), view.getPaddingBottom());
        return q0Var;
    }

    private final void stopLoading(String str) {
        runOnUiThread(new b0(this, 6));
    }

    public static final void m21stopLoading$lambda15(OverlayWebviewActivity this$0) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        PGWebView pGWebView = this$0.webview;
        if (pGWebView != null) {
            pGWebView.stopLoading();
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    public final void closeOverlay() {
        RelativeLayout relativeLayout;
        if (this.isPLOWebview) {
            this.ploCloseTimeStamp = System.currentTimeMillis();
        }
        if (!this.isOverlayAnimationRequired) {
            sendWebviewEvent(new OverlayWebviewEvent(this.webviewId, WebviewEventType.CLOSED, (JSONObject) null, (PGWebView) null, false, 28, (DefaultConstructorMarker) null));
            dismissAlertOverlay();
            finish();
            RelativeLayout relativeLayout2 = this.overlay;
            if (relativeLayout2 == null) {
                Intrinsics.q("overlay");
                throw null;
            }
            relativeLayout2.setVisibility(4);
            ImageButton imageButton = this.btncancel;
            if (imageButton != null) {
                imageButton.setVisibility(8);
                return;
            } else {
                Intrinsics.q("btncancel");
                throw null;
            }
        }
        if (this.overlay == null) {
            Intrinsics.q("overlay");
            throw null;
        }
        ImageButton imageButton2 = this.btncancel;
        if (imageButton2 == null) {
            Intrinsics.q("btncancel");
            throw null;
        }
        imageButton2.setVisibility(8);
        ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f, 1, 0.5f, 1, 0.5f);
        scaleAnimation.setDuration(this.isPLOWebview ? this.ploExitAnimDuration : 150L);
        scaleAnimation.setAnimationListener(new closeOverlay.1.1(this));
        if (this.fullOldCalc) {
            relativeLayout = this.overlay;
            if (relativeLayout == null) {
                Intrinsics.q("overlay");
                throw null;
            }
        } else {
            relativeLayout = this.innerOverlayRelativeLayout;
            if (relativeLayout == null) {
                Intrinsics.q("innerOverlayRelativeLayout");
                throw null;
            }
        }
        relativeLayout.startAnimation(scaleAnimation);
    }

    @Override
    public boolean dispatchTouchEvent(@NotNull MotionEvent ev) {
        Intrinsics.checkNotNullParameter(ev, "ev");
        if (this.inProgress) {
            return true;
        }
        return super.dispatchTouchEvent(ev);
    }

    @Override
    public void finish() {
        RelativeLayout relativeLayout = this.innerOverlayRelativeLayout;
        if (relativeLayout == null) {
            Intrinsics.q("innerOverlayRelativeLayout");
            throw null;
        }
        PGWebView pGWebView = this.webview;
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        relativeLayout.removeView(pGWebView);
        PGWebView pGWebView2 = this.webview;
        if (pGWebView2 == null) {
            Intrinsics.q("webview");
            throw null;
        }
        pGWebView2.destroy();
        String str = this.webviewId;
        WebviewEventType webviewEventType = WebviewEventType.FINISH;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("webviewId", this.webviewId);
        PGWebView pGWebView3 = this.webview;
        if (pGWebView3 == null) {
            Intrinsics.q("webview");
            throw null;
        }
        String url = pGWebView3.getUrl();
        if (url == null) {
            url = "";
        }
        jSONObject.put("url", url);
        Unit unit = Unit.a;
        sendWebviewEvent(new OverlayWebviewEvent(str, webviewEventType, jSONObject, (PGWebView) null, true, 8, (DefaultConstructorMarker) null));
        if (this.isOffScreenLoad) {
            a.a.a((PGWebView) null);
        }
        super.finish();
    }

    public final boolean getInProgress() {
        return this.inProgress;
    }

    @NotNull
    public final Pair<Integer, Integer> getWidthAndHeight() {
        Pair<Integer, Integer> pair;
        if (Build.VERSION.SDK_INT >= 30) {
            Rect c = l0.c(androidx.camera.camera2.internal.b.f(getWindowManager()));
            Intrinsics.checkNotNullExpressionValue(c, "windowManager.currentWindowMetrics.bounds");
            pair = new Pair<>(Integer.valueOf(c.width()), Integer.valueOf(c.height()));
        } else {
            DisplayMetrics displayMetrics = new DisplayMetrics();
            getWindowManager().getDefaultDisplay().getRealMetrics(displayMetrics);
            pair = new Pair<>(Integer.valueOf(displayMetrics.widthPixels), Integer.valueOf(displayMetrics.heightPixels));
        }
        boolean a = Intrinsics.a(this.orientation, "portrait");
        Integer num = pair.b;
        Integer num2 = pair.a;
        if (a && num2.intValue() > num.intValue()) {
            String str = this.TAG;
            StringBuilder a2 = com.games24x7.pgwebview.a.a("Swap overlay for portrait width : ");
            a2.append(num2.intValue());
            a2.append(", height: ");
            a2.append(num.intValue());
            Log.d(str, a2.toString());
            return new Pair<>(num, num2);
        }
        if (!Intrinsics.a(this.orientation, "landscape") || num.intValue() <= num2.intValue()) {
            Log.d(this.TAG, "Return original dimension");
            return pair;
        }
        String str2 = this.TAG;
        StringBuilder a3 = com.games24x7.pgwebview.a.a("Swap overlay for landscape width : ");
        a3.append(num2.intValue());
        a3.append(", height: ");
        a3.append(num.intValue());
        Log.d(str2, a3.toString());
        return new Pair<>(num, num2);
    }

    public final boolean isBackGroundTransparent() {
        return this.isBackGroundTransparent;
    }

    @Override
    public void onActivityResult(int r12, int r13, android.content.Intent r14) {
        throw new UnsupportedOperationException("Method not decompiled: com.games24x7.pgwebview.ui.OverlayWebviewActivity.onActivityResult(int, int, android.content.Intent):void");
    }

    @Override
    public void onBackPressed() {
        Log.i(this.TAG, "BACK CLICKED");
        String str = this.webviewId;
        WebviewEventType webviewEventType = WebviewEventType.ON_BACK_PRESSED;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("webviewId", this.webviewId);
        PGWebView pGWebView = this.webview;
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        String url = pGWebView.getUrl();
        if (url == null) {
            url = "";
        }
        jSONObject.put("url", url);
        Unit unit = Unit.a;
        sendWebviewEvent(new OverlayWebviewEvent(str, webviewEventType, jSONObject, (PGWebView) null, true, 8, (DefaultConstructorMarker) null));
    }

    @Override
    public void onCreate(Bundle bundle) {
        this.overlayHeight = getIntent().getIntExtra("height", 0);
        int intExtra = getIntent().getIntExtra("width", 0);
        this.overlayWidth = intExtra;
        setTheme((intExtra == 100 && this.overlayHeight == 100) ? R.style.LoadWebViewActivityTheme : R.style.OverlayWebviewTheme);
        super.onCreate(bundle);
        getConfig();
        if (this.drawBehindSafeArea && Build.VERSION.SDK_INT >= 28) {
            w.f(getWindow().getAttributes());
        }
        Log.e(this.TAG, "create :: OnCreate on OverlayActivity is called...");
        if (this.showLoaderView) {
            this.loaderStartTimeStamp = System.currentTimeMillis();
            getWindow().getDecorView().setBackgroundColor(this.overlayBackgroundColor);
        }
        if (this.isPLOWebview) {
            this.ploLoadingTimeStamp = System.currentTimeMillis();
        }
        String str = this.webviewId;
        WebviewEventType webviewEventType = WebviewEventType.ON_CREATE;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("webviewId", this.webviewId);
        jSONObject.put("url", this.url);
        Unit unit = Unit.a;
        sendWebviewEvent(new OverlayWebviewEvent(str, webviewEventType, jSONObject, (PGWebView) null, true, 8, (DefaultConstructorMarker) null));
        setOrientation();
        setContentView(R.layout.activity_overlay_close);
        configure();
        if (Build.VERSION.SDK_INT >= 35) {
            showFullScreen();
        }
        a.C0040a.a(this);
        if (this.isOffScreenLoad) {
            return;
        }
        initialize();
        String str2 = this.url;
        if (str2 != null) {
            PGWebView pGWebView = this.webview;
            if (pGWebView != null) {
                pGWebView.loadUrl(str2);
            } else {
                Intrinsics.q("webview");
                throw null;
            }
        }
    }

    @Override
    public void onNewIntent(@NotNull Intent intent) {
        Intrinsics.checkNotNullParameter(intent, "intent");
        super.onNewIntent(intent);
        Uri data = intent.getData();
        if (data == null) {
            return;
        }
        String uri = data.toString();
        Intrinsics.checkNotNullExpressionValue(uri, "uri.toString()");
        PGWebView pGWebView = this.webview;
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        if (pGWebView != null) {
            pGWebView.loadUrl(uri);
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    @Override
    public void onPause() {
        super.onPause();
        String str = this.webviewId;
        WebviewEventType webviewEventType = WebviewEventType.ON_PAUSE;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("webviewId", this.webviewId);
        PGWebView pGWebView = this.webview;
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        String url = pGWebView.getUrl();
        if (url == null) {
            url = "";
        }
        jSONObject.put("url", url);
        Unit unit = Unit.a;
        sendWebviewEvent(new OverlayWebviewEvent(str, webviewEventType, jSONObject, (PGWebView) null, true, 8, (DefaultConstructorMarker) null));
    }

    @i(threadMode = ThreadMode.MAIN_ORDERED)
    public final void onRequest(@NotNull OverlayReqEvent event) {
        String string;
        Intrinsics.checkNotNullParameter(event, "event");
        Log.e(this.TAG, "onRequested " + event);
        switch (WhenMappings.$EnumSwitchMapping$0[event.getWebReqEventType().ordinal()]) {
            case 2:
                closeOverlay();
                break;
            case 3:
                JSONObject payload = event.getPayload();
                string = payload != null ? payload.getString("url") : null;
                loadUrl(event.getId(), string != null ? string : "");
                break;
            case 4:
                JSONObject payload2 = event.getPayload();
                string = payload2 != null ? payload2.getString("script") : null;
                evaluateJS(event.getId(), string != null ? string : "");
                break;
            case 5:
                JSONObject payload3 = event.getPayload();
                String string2 = payload3 != null ? payload3.getString("data") : null;
                String str = string2 == null ? "" : string2;
                JSONObject payload4 = event.getPayload();
                String string3 = payload4 != null ? payload4.getString("mimeType") : null;
                String str2 = string3 == null ? "" : string3;
                JSONObject payload5 = event.getPayload();
                String string4 = payload5 != null ? payload5.getString("encoding") : null;
                String str3 = string4 == null ? "" : string4;
                JSONObject payload6 = event.getPayload();
                string = payload6 != null ? payload6.getString("baseUrl") : null;
                loadData(event.getId(), str, str2, str3, string == null ? "" : string);
                break;
            case 6:
                JSONObject payload7 = event.getPayload();
                String string5 = payload7 != null ? payload7.getString("html") : null;
                if (string5 == null) {
                    string5 = "";
                }
                JSONObject payload8 = event.getPayload();
                string = payload8 != null ? payload8.getString("baseUrl") : null;
                loadHtml(event.getId(), string5, string != null ? string : "");
                break;
            case 7:
                JSONObject payload9 = event.getPayload();
                string = payload9 != null ? payload9.getString("filePath") : null;
                loadFile(event.getId(), string != null ? string : "");
                break;
            case 8:
                stopLoading(event.getId());
                break;
            case 9:
                reload(event.getId());
                break;
            case 10:
                canGoBack(event.getId());
                break;
            case 11:
                canGoForward(event.getId());
                break;
            case h.CUSTOM_ATTRIBUTES_FIELD_NUMBER:
                goForward(event.getId());
                break;
            case 13:
                goBack(event.getId());
                break;
            case ConnectionResult.TIMEOUT:
                setBackgroundResource(event.getId(), event.getPayload());
                break;
        }
    }

    @Override
    public void onRestart() {
        super.onRestart();
        String str = this.webviewId;
        WebviewEventType webviewEventType = WebviewEventType.ON_RESTART;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("webviewId", this.webviewId);
        jSONObject.put("url", this.url);
        Unit unit = Unit.a;
        sendWebviewEvent(new OverlayWebviewEvent(str, webviewEventType, jSONObject, (PGWebView) null, true, 8, (DefaultConstructorMarker) null));
    }

    @Override
    public void onResume() {
        super.onResume();
        String str = this.webviewId;
        WebviewEventType webviewEventType = WebviewEventType.ON_RESUME;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("webviewId", this.webviewId);
        jSONObject.put("url", this.url);
        Unit unit = Unit.a;
        sendWebviewEvent(new OverlayWebviewEvent(str, webviewEventType, jSONObject, (PGWebView) null, true, 8, (DefaultConstructorMarker) null));
    }

    @Override
    public void onStart() {
        super.onStart();
        org.greenrobot.eventbus.b.c().m(this);
    }

    @Override
    public void onStop() {
        super.onStop();
        org.greenrobot.eventbus.b.c().o(this);
    }

    @Override
    public void onWindowFocusChanged(boolean z) {
        super.onWindowFocusChanged(z);
        if (z) {
            hideSystemUI();
        }
    }

    public final void setBackGroundTransparent(boolean z) {
        this.isBackGroundTransparent = z;
    }

    public final void setInProgress(boolean z) {
        this.inProgress = z;
    }
}