导航菜单

页面标题

页面副标题

RummyCircle v11000.89 - f.java 源代码

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

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


package com.games24x7.pgwebview.controller;

import android.R;
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.view.View;
import android.webkit.WebView;
import android.widget.FrameLayout;
import androidx.activity.result.e;
import androidx.appcompat.widget.L;
import androidx.camera.camera2.internal.S0;
import androidx.camera.camera2.internal.compat.B;
import androidx.camera.camera2.internal.p;
import androidx.camera.camera2.internal.s;
import androidx.camera.camera2.internal.t;
import androidx.camera.core.impl.c0;
import androidx.camera.core.p0;
import androidx.emoji2.text.j;
import androidx.room.u;
import com.appsflyer.internal.C;
import com.games24x7.pgwebview.communication.WebviewRequestEventHandler;
import com.games24x7.pgwebview.communication.external.eventbus.events.AnimatedMoveWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.AnimatedScaleAndMoveWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.AnimatedScaleWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.CanGoBackWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.CanGoForwardWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.CloseWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.CreateWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.ExecuteScriptWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.GoBackWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.GoForwardWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.HideLoaderWebViewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.JsInterfaceHolder;
import com.games24x7.pgwebview.communication.external.eventbus.events.LoadDataWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.LoadFileWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.LoadHtmlWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.LoadUrlWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.PositionWebivewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.ReloadWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.ScaleToFitWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.SetBackgroundColorWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.SetBackgroundResourceWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.SetJavaScriptInterfaceSchemaWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.ShowLoaderWebViewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.StopLoadingWebviewPGEvent;
import com.games24x7.pgwebview.communication.external.eventbus.events.VisibilityWebviewPGEvent;
import com.games24x7.pgwebview.communication.internal.eventbus.event.WindowWebviewEvent;
import com.games24x7.pgwebview.custom.c;
import com.games24x7.pgwebview.custom.d;
import com.games24x7.pgwebview.enums.WebviewEventType;
import com.games24x7.pgwebview.models.WebViewConfiguration;
import com.google.android.gms.common.ConnectionResult;
import java.util.HashMap;
import java.util.List;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.Dispatchers;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;

public final class f extends a implements d {

    @NotNull
    public final com.games24x7.pgwebview.d b;

    @NotNull
    public final HashMap<String, c> c;
    public final String d;

    @NotNull
    public Activity e;
    public int f;
    public int g;
    public int h;
    public int i;
    public boolean j;

    @NotNull
    public final FrameLayout k;
    public boolean l;
    public int m;
    public int n;
    public double o;
    public boolean p;

    public f(@NotNull Context context, @NotNull com.games24x7.pgwebview.b managerCallbacks) {
        super(managerCallbacks);
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(managerCallbacks, "managerCallbacks");
        this.b = managerCallbacks;
        this.c = new HashMap<>();
        this.d = "f";
        Activity activity = (Activity) context;
        this.e = activity;
        this.f = 720;
        this.g = 1080;
        this.j = true;
        View findViewById = activity.getWindow().getDecorView().findViewById(R.id.content);
        Intrinsics.checkNotNullExpressionValue(findViewById, "hostActivity.window.deco…yId(android.R.id.content)");
        this.k = (FrameLayout) findViewById;
        this.o = 1.0d;
        this.f = c();
        this.g = b();
    }

    public final int b() {
        return this.g;
    }

    public final int c() {
        return this.f;
    }

    public final void d(@NotNull String webviewId, @NotNull String url) {
        Intrinsics.checkNotNullParameter(webviewId, "webviewId");
        Intrinsics.checkNotNullParameter(url, "url");
        String str = this.d;
        StringBuilder k = B.k("loadUrlWebview :: Loading url into webviewId as ", webviewId, " :: Url is ", url, " :: UseEvaluateJS is ");
        k.append(this.l);
        Log.i(str, k.toString());
        if (this.l && StringsKt.E(url, "javascript:", false)) {
            c(webviewId, url);
        } else {
            this.e.runOnUiThread(new j(1, this, webviewId, url));
        }
    }

    public final c a(String str) {
        return this.c.get(str);
    }

    public final void b(@NotNull WindowWebviewEvent windowWebviewEvent) {
        Intrinsics.checkNotNullParameter(windowWebviewEvent, "windowWebviewEvent");
        Log.d(this.d, "Window WebviewEvent: id-" + windowWebviewEvent + ".id \neventType-" + windowWebviewEvent + ".eventType \npgWebview-" + windowWebviewEvent + ".pgWebView \nextraJson-" + windowWebviewEvent.getExtraJson());
        this.b.a(windowWebviewEvent.getEventType(), windowWebviewEvent.getId(), windowWebviewEvent.getExtraJson());
    }

    public final void c(@NotNull String webviewId, @NotNull String js) {
        Intrinsics.checkNotNullParameter(webviewId, "webviewId");
        Intrinsics.checkNotNullParameter(js, "js");
        this.e.runOnUiThread(new u(1, this, webviewId, js));
    }

    public static final void b(f this$0, String webviewId, String url) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(webviewId, "$webviewId");
        Intrinsics.checkNotNullParameter(url, "$url");
        c a = this$0.a(webviewId);
        if (a != null) {
            a.loadUrl(url);
        }
    }

    public final void a(@NotNull AnimatedScaleAndMoveWebviewPGEvent animatedScaleAndMoveRequest) {
        Intrinsics.checkNotNullParameter(animatedScaleAndMoveRequest, "animatedScaleAndMoveRequest");
        a(animatedScaleAndMoveRequest.getParsedPayload().getId(), animatedScaleAndMoveRequest.getParsedPayload().getDuration(), animatedScaleAndMoveRequest.getParsedPayload().getFromScale(), animatedScaleAndMoveRequest.getParsedPayload().getToScale(), animatedScaleAndMoveRequest.getParsedPayload().getPosX(), animatedScaleAndMoveRequest.getParsedPayload().getPosY(), animatedScaleAndMoveRequest.getParsedPayload().getHeight());
    }

    public static final void b(f this$0, String webviewId, boolean z) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(webviewId, "$webviewId");
        Log.e(this$0.d, "setVisibleWebview :: WebviewId is " + webviewId + " :: Webview Visibility is Changing in Host Activity :: " + z);
        c a = this$0.a(webviewId);
        if (a == null) {
            return;
        }
        a.setVisibility(z ? 0 : 4);
    }

    public final void a(@NotNull AnimatedScaleWebviewPGEvent animatedScaleRequest) {
        Intrinsics.checkNotNullParameter(animatedScaleRequest, "animatedScaleRequest");
        a(animatedScaleRequest.getParsedPayload().getId(), animatedScaleRequest.getParsedPayload().getDuration(), animatedScaleRequest.getParsedPayload().getFromScale(), animatedScaleRequest.getParsedPayload().getToScale());
    }

    public final void a(@NotNull ExecuteScriptWebviewPGEvent executeScriptRequest) {
        Intrinsics.checkNotNullParameter(executeScriptRequest, "executeScriptRequest");
        c(executeScriptRequest.getParsedPayload().getId(), executeScriptRequest.getParsedPayload().getScript());
    }

    public final void b(@NotNull String id, @NotNull String requestId) {
        Intrinsics.checkNotNullParameter(id, "id");
        Intrinsics.checkNotNullParameter(requestId, "requestId");
        Log.i(this.d, "minimize called on wrong controller");
    }

    public final void a(@NotNull GoBackWebviewPGEvent goBackRequest) {
        Intrinsics.checkNotNullParameter(goBackRequest, "goBackRequest");
        this.e.runOnUiThread(new s(this, goBackRequest, 6));
    }

    public final void b(@NotNull final String webviewId, final boolean z) {
        Intrinsics.checkNotNullParameter(webviewId, "webviewId");
        try {
            this.e.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    f.b(f.this, webviewId, z);
                }
            });
        } catch (Exception e) {
            String str = this.d;
            StringBuilder sb = new StringBuilder("setVisibleWebview :: Got Exception in webviewId as ");
            sb.append(webviewId);
            sb.append(" :: Exception is :: ");
            e.printStackTrace();
            sb.append(Unit.a);
            Log.e(str, sb.toString());
        }
    }

    public final void a(@NotNull GoForwardWebviewPGEvent goForwardRequest) {
        Intrinsics.checkNotNullParameter(goForwardRequest, "goForwardRequest");
        this.e.runOnUiThread(new S0(this, goForwardRequest, 9));
    }

    public final void a(@NotNull HideLoaderWebViewPGEvent hideLoaderRequest) {
        Intrinsics.checkNotNullParameter(hideLoaderRequest, "hideLoaderRequest");
        Log.i(this.d, "hideLoader called on wrong controller");
    }

    public final void a(@NotNull LoadDataWebviewPGEvent loadDataRequest) {
        Intrinsics.checkNotNullParameter(loadDataRequest, "loadDataRequest");
        this.e.runOnUiThread(new p(this, loadDataRequest, 8));
    }

    public final void a(@NotNull LoadFileWebviewPGEvent loadFileRequest) {
        Intrinsics.checkNotNullParameter(loadFileRequest, "loadFileRequest");
        this.e.runOnUiThread(new androidx.camera.camera2.internal.compat.p(this, loadFileRequest, 7));
    }

    public final void a(@NotNull LoadHtmlWebviewPGEvent loadHtml) {
        Intrinsics.checkNotNullParameter(loadHtml, "loadHtml");
        this.e.runOnUiThread(new c0(this, loadHtml, 3));
    }

    public final void a(@NotNull LoadUrlWebviewPGEvent loadUrlRequest) {
        Intrinsics.checkNotNullParameter(loadUrlRequest, "loadUrlRequest");
        d(loadUrlRequest.getParsedPayload().getId(), loadUrlRequest.getParsedPayload().getUrl());
    }

    public final void a(@NotNull ReloadWebviewPGEvent reloadRequest) {
        Intrinsics.checkNotNullParameter(reloadRequest, "reloadRequest");
        this.e.runOnUiThread(new t(this, reloadRequest, 6));
    }

    public final void a(@NotNull ScaleToFitWebviewPGEvent scaleToFitRequest) {
        Intrinsics.checkNotNullParameter(scaleToFitRequest, "scaleToFitRequest");
        a(scaleToFitRequest.getParsedPayload().getId(), scaleToFitRequest.getParsedPayload().getScaleToFit());
    }

    public final void a(@NotNull SetBackgroundColorWebviewPGEvent setBackgroundColorRequest) {
        Intrinsics.checkNotNullParameter(setBackgroundColorRequest, "setBackgroundColorRequest");
        Log.e(this.d, "setBackgroundColor :: Called on wrong Controller...");
    }

    public final void a(@NotNull SetBackgroundResourceWebviewPGEvent setBackgroundRequest) {
        Intrinsics.checkNotNullParameter(setBackgroundRequest, "setBackgroundRequest");
        this.e.runOnUiThread(new p0(this, setBackgroundRequest, 4));
    }

    public final void a(@NotNull SetJavaScriptInterfaceSchemaWebviewPGEvent setJsSchemaRequest) {
        Intrinsics.checkNotNullParameter(setJsSchemaRequest, "setJsSchemaRequest");
        this.e.runOnUiThread(new p0(this, setJsSchemaRequest, 5));
    }

    public final void a(@NotNull ShowLoaderWebViewPGEvent showLoaderRequest) {
        Intrinsics.checkNotNullParameter(showLoaderRequest, "showLoaderRequest");
        Log.i(this.d, "showLoader called on wrong controller");
    }

    public final void a(@NotNull StopLoadingWebviewPGEvent stopLoadingRequest) {
        Intrinsics.checkNotNullParameter(stopLoadingRequest, "stopLoadingRequest");
        this.e.runOnUiThread(new androidx.camera.camera2.internal.compat.p(this, stopLoadingRequest, 6));
    }

    public final void a(@NotNull VisibilityWebviewPGEvent visibilityRequest) {
        Intrinsics.checkNotNullParameter(visibilityRequest, "visibilityRequest");
        b(visibilityRequest.getParsedPayload().getId(), visibilityRequest.getParsedPayload().getVisibility());
    }

    public final void a(@NotNull WindowWebviewEvent event) {
        Intrinsics.checkNotNullParameter(event, "event");
        Log.d(this.d, "Window WebviewEvent received at Controller ::  " + event);
        if (event.getEventType() == WebviewEventType.WEBVIEW_CRASH) {
            this.e.runOnUiThread(new m(event, this, 0));
        }
        a(event.getId(), event.getEventType(), event.getExtraJson());
    }

    public static final void a(WindowWebviewEvent event, f this$0) {
        Intrinsics.checkNotNullParameter(event, "$event");
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        String optString = new JSONObject(String.valueOf(event.getExtraJson())).optString("webviewId");
        this$0.k.removeView(event.getPgWebView());
        this$0.c.remove(optString);
    }

    public static final void a(f this$0, CloseWebviewPGEvent closeRequest) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(closeRequest, "$closeRequest");
        c a = this$0.a(closeRequest.getParsedPayload().getId());
        this$0.b(new WindowWebviewEvent(closeRequest.getParsedPayload().getId(), WebviewEventType.CLOSED, null, a, 4, null));
        if (a != null) {
            a.stopLoading();
        }
        if (a != null) {
            a.destroy();
        }
        this$0.k.removeView(this$0.a(closeRequest.getParsedPayload().getId()));
        this$0.c.remove(closeRequest.getParsedPayload().getId());
    }

    public static final void a(f this$0, CreateWebviewPGEvent webviewCreateRequest) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(webviewCreateRequest, "$webviewCreateRequest");
        if (this$0.c.containsKey(webviewCreateRequest.getParsedPayload().getId())) {
            Log.i(this$0.d, "create :: Webview Already exist and we need to destroy it.");
            c a = this$0.a(webviewCreateRequest.getParsedPayload().getId());
            this$0.c.remove(webviewCreateRequest.getParsedPayload().getId());
            if (a != null) {
                a.stopLoading();
            }
            if (a != null) {
                a.destroy();
            }
        }
    }

    public static final void a(f this$0, GoBackWebviewPGEvent goBackRequest) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(goBackRequest, "$goBackRequest");
        c a = this$0.a(goBackRequest.getParsedPayload().getId());
        if (a != null) {
            a.goBack();
        }
    }

    public static final void a(f this$0, GoForwardWebviewPGEvent goForwardRequest) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(goForwardRequest, "$goForwardRequest");
        c a = this$0.a(goForwardRequest.getParsedPayload().getId());
        if (a != null) {
            a.goForward();
        }
    }

    public static final void a(f this$0, LoadDataWebviewPGEvent loadDataRequest) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(loadDataRequest, "$loadDataRequest");
        c a = this$0.a(loadDataRequest.getParsedPayload().getId());
        if (a != null) {
            a.loadDataWithBaseURL(loadDataRequest.getParsedPayload().getUrl(), loadDataRequest.getParsedPayload().getData(), loadDataRequest.getParsedPayload().getMimetype(), loadDataRequest.getParsedPayload().getEncoding(), null);
        }
    }

    public static final void a(f this$0, LoadFileWebviewPGEvent loadFileRequest) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(loadFileRequest, "$loadFileRequest");
        c a = this$0.a(loadFileRequest.getParsedPayload().getId());
        if (a != null) {
            a.loadUrl(loadFileRequest.getParsedPayload().getFilePath());
        }
    }

    public static final void a(f this$0, LoadHtmlWebviewPGEvent loadHtml) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(loadHtml, "$loadHtml");
        c a = this$0.a(loadHtml.getParsedPayload().getId());
        if (a != null) {
            a.loadDataWithBaseURL(loadHtml.getParsedPayload().getUrl(), loadHtml.getParsedPayload().getHtml(), null, null, null);
        }
    }

    public static final void a(f this$0, ReloadWebviewPGEvent reloadRequest) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(reloadRequest, "$reloadRequest");
        c a = this$0.a(reloadRequest.getParsedPayload().getId());
        if (a != null) {
            a.reload();
        }
    }

    public static final void a(f this$0, SetBackgroundResourceWebviewPGEvent setBackgroundRequest) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(setBackgroundRequest, "$setBackgroundRequest");
        c a = this$0.a(setBackgroundRequest.getParsedPayload().getId());
        if (a != null) {
            a.setBackgroundResource(setBackgroundRequest.getParsedPayload().getResId());
        }
    }

    public static final void a(f this$0, SetJavaScriptInterfaceSchemaWebviewPGEvent setJsSchemaRequest) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(setJsSchemaRequest, "$setJsSchemaRequest");
        c a = this$0.a(setJsSchemaRequest.getParsedPayload().getId());
        if (a != null) {
            a.setJavascriptInterfaceScheme(setJsSchemaRequest.getParsedPayload().getSchema());
        }
    }

    public static final void a(f this$0, StopLoadingWebviewPGEvent stopLoadingRequest) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(stopLoadingRequest, "$stopLoadingRequest");
        c a = this$0.a(stopLoadingRequest.getParsedPayload().getId());
        if (a != null) {
            a.stopLoading();
        }
    }

    public static final void a(f this$0, String webviewId, float f, float f2, float f3) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(webviewId, "$webviewId");
        c a = this$0.a(webviewId);
        if (a != null) {
            a.a((int) (f * ConnectionResult.DRIVE_EXTERNAL_STORAGE_REQUIRED), f2, f3);
        }
    }

    public static final void a(f this$0, String webviewId, String js) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(webviewId, "$webviewId");
        Intrinsics.checkNotNullParameter(js, "$js");
        Log.e(this$0.d, "evaluateJS :: WebviewId is :: " + webviewId + " :: JS is :: " + js);
        c a = this$0.a(webviewId);
        if (a != null) {
            a.evaluateJavascript(js, null);
        }
    }

    public static final void a(f this$0, String id, boolean z) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(id, "$id");
        c a = this$0.a(id);
        if (a != null) {
            a.setScalesPageToFit(z);
        }
    }

    public final void a(String str, float f, float f2, float f3) {
        Log.i(this.d, "scaleToAnimate :: " + str + ' ' + f + ' ' + f2 + ' ' + f3);
        this.e.runOnUiThread(new i(this, str, f, f2, f3));
    }

    public final void a(String str, float f, float f2, float f3, int i, int i2, int i3) {
        Log.i(this.d, "scaleToAnimate :: " + str + ' ' + f + ' ' + f2 + ' ' + f3);
        this.e.runOnUiThread(new l(this, str, f, f2, f3, i, i2, i3));
    }

    public final void a(@NotNull final String webviewId, final float f, final float f2, final int i, final int i2, int i3, int i4, final boolean z) {
        Intrinsics.checkNotNullParameter(webviewId, "webviewId");
        String str = this.d;
        StringBuilder sb = new StringBuilder("setWebViewFrame :: x=");
        sb.append(f);
        sb.append("  y=");
        sb.append(f2);
        sb.append("  width=");
        android.support.v4.media.a.l(sb, i, "  height=", i2, "  windowHeight=");
        sb.append(i4);
        sb.append("  windowWidth=");
        sb.append(i3);
        Log.i(str, sb.toString());
        this.e.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                f.a(f.this, webviewId, f, f2, i2, i, z);
            }
        });
    }

    public final void a(String str, float f, int i, int i2, int i3, int i4, int i5, boolean z, boolean z2) {
        Log.i(this.d, "animateMove :: " + str + ' ' + f + ' ' + i + ' ' + i2 + ' ' + i4 + ' ' + i5);
        this.e.runOnUiThread(new g(z2, this, i, str, f, i2, z, i3));
    }

    public final void a(@NotNull String id, @NotNull String requestId) {
        Intrinsics.checkNotNullParameter(id, "id");
        Intrinsics.checkNotNullParameter(requestId, "requestId");
        Log.i(this.d, "maximize called on wrong controller");
    }

    public final void a(String str, boolean z) {
        this.e.runOnUiThread(new j(this, str, z));
    }

    public static final void a(boolean z, f this$0, int i, String webviewId, float f, int i2, boolean z2, int i3) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(webviewId, "$webviewId");
        if (z) {
            String str = this$0.d;
            StringBuilder b = L.b("animateMove :: For Notch enabled area, adjsuting the notch area... Original posX :: ", i, " :: New posx :: ");
            String str2 = com.games24x7.pgwebview.util.b.a;
            b.append((com.games24x7.pgwebview.util.b.c(this$0.e) / 2) + i);
            Log.e(str, b.toString());
            c a = this$0.a(webviewId);
            if (a != null) {
                a.a((int) (f * ConnectionResult.DRIVE_EXTERNAL_STORAGE_REQUIRED), (com.games24x7.pgwebview.util.b.c(this$0.e) / 2) + i, i2);
                return;
            }
            return;
        }
        if (!z2 || !this$0.j) {
            this$0.a();
            c a2 = this$0.a(webviewId);
            if (a2 != null) {
                a2.a((int) (f * ConnectionResult.DRIVE_EXTERNAL_STORAGE_REQUIRED), i, i2);
                return;
            }
            return;
        }
        this$0.a();
        c a3 = this$0.a(webviewId);
        if (a3 != null) {
            double d = this$0.o;
            a3.a((int) (f * ConnectionResult.DRIVE_EXTERNAL_STORAGE_REQUIRED), ((int) (i * d)) + this$0.m, this$0.g - ((((int) (i2 * d)) + this$0.n) + ((int) (i3 * d))));
        }
    }

    public final boolean a(@NotNull CanGoBackWebviewPGEvent canGoBackRequest) {
        Intrinsics.checkNotNullParameter(canGoBackRequest, "canGoBackRequest");
        boolean booleanValue = ((Boolean) BuildersKt.runBlocking(Dispatchers.getMain(), new a(this, canGoBackRequest, (Continuation) null))).booleanValue();
        b(new WindowWebviewEvent(canGoBackRequest.getParsedPayload().getId(), WebviewEventType.CANGOBACK, new JSONObject().put("value", booleanValue), null, 8, null));
        return booleanValue;
    }

    public final boolean a(@NotNull CanGoForwardWebviewPGEvent canGoForwardRequest) {
        boolean z;
        Intrinsics.checkNotNullParameter(canGoForwardRequest, "canGoForwardRequest");
        try {
            c a = a(canGoForwardRequest.getParsedPayload().getId());
            Intrinsics.c(a);
            z = a.canGoForward();
        } catch (Exception unused) {
            z = false;
        }
        b(new WindowWebviewEvent(canGoForwardRequest.getParsedPayload().getId(), WebviewEventType.CANGOFORWARD, new JSONObject().put("value", z), null, 8, null));
        return z;
    }

    public final void a(@NotNull AnimatedMoveWebviewPGEvent animatedMoveRequest) {
        Intrinsics.checkNotNullParameter(animatedMoveRequest, "animatedMoveRequest");
        String id = animatedMoveRequest.getParsedPayload().getId();
        float duration = animatedMoveRequest.getParsedPayload().getDuration();
        int posX = animatedMoveRequest.getParsedPayload().getPosX();
        int posY = animatedMoveRequest.getParsedPayload().getPosY();
        int height = animatedMoveRequest.getParsedPayload().getHeight();
        int i = this.f;
        int i2 = this.g;
        Boolean isScaleRequired = animatedMoveRequest.getParsedPayload().isScaleRequired();
        boolean booleanValue = isScaleRequired != null ? isScaleRequired.booleanValue() : true;
        Boolean enableNotchArea = animatedMoveRequest.getParsedPayload().getEnableNotchArea();
        a(id, duration, posX, posY, height, i, i2, booleanValue, enableNotchArea != null ? enableNotchArea.booleanValue() : false);
    }

    public final void a() {
        double d = this.f / this.h;
        double d2 = this.g / this.i;
        String str = this.d;
        StringBuilder a = com.games24x7.pgwebview.a.a("calculateScale :: deviceWidth = ");
        a.append(this.f);
        a.append(" :: unityCanvasWidth = ");
        a.append(this.h);
        Log.e(str, a.toString());
        String str2 = this.d;
        StringBuilder a2 = com.games24x7.pgwebview.a.a("calculateScale :: deviceHeight = ");
        a2.append(this.g);
        a2.append(" :: unityCanvasHeight = ");
        a2.append(this.i);
        Log.e(str2, a2.toString());
        String str3 = this.d;
        StringBuilder sb = new StringBuilder("calculateScale :: ScaleX = ");
        sb.append(d);
        sb.append(" :: ScaleY = ");
        sb.append(d2);
        sb.append(" :: Notch height is :: ");
        String str4 = com.games24x7.pgwebview.util.b.a;
        sb.append(com.games24x7.pgwebview.util.b.c(this.e));
        Log.e(str3, sb.toString());
        if (d > d2) {
            this.m = this.j ? (int) (((d - d2) / 2) * this.h) : 0;
            this.n = 0;
            this.o = d2;
            if (this.p) {
                Log.e(this.d, "calculateScale :: Notch Area is enabled...");
                this.m = com.games24x7.pgwebview.util.b.c(this.e);
                return;
            }
            return;
        }
        if (d2 > d) {
            this.m = 0;
            this.n = this.j ? (int) (((d2 - d) / 2) * this.i) : 0;
            this.o = d;
            String str5 = this.d;
            StringBuilder a3 = com.games24x7.pgwebview.a.a("calculateScale :: offsetTop =  ");
            a3.append(this.n);
            Log.e(str5, a3.toString());
            return;
        }
        this.o = d;
        String str6 = this.d;
        StringBuilder a4 = com.games24x7.pgwebview.a.a("useScale=");
        a4.append(this.j);
        a4.append(", offsetLeft=");
        a4.append(this.m);
        a4.append(", offsetTop=");
        a4.append(this.n);
        a4.append(", scaleX=");
        a4.append(d);
        Log.d(str6, a4.toString());
    }

    public final void a(@NotNull CloseWebviewPGEvent closeRequest) {
        Intrinsics.checkNotNullParameter(closeRequest, "closeRequest");
        String str = this.d;
        StringBuilder a = com.games24x7.pgwebview.a.a("close :: Closing Webview with id as ");
        a.append(closeRequest.getParsedPayload().getId());
        Log.i(str, a.toString());
        this.e.runOnUiThread(new S0(this, closeRequest, 10));
    }

    public final void a(@NotNull CreateWebviewPGEvent webviewCreateRequest) {
        Intrinsics.checkNotNullParameter(webviewCreateRequest, "webviewCreateRequest");
        String str = this.d;
        StringBuilder a = com.games24x7.pgwebview.a.a("create :: Creating Webview for Webview Id as :: ");
        a.append(webviewCreateRequest.getParsedPayload().getId());
        Log.i(str, a.toString());
        String str2 = this.d;
        StringBuilder a2 = com.games24x7.pgwebview.a.a("create ::Payload is :: ");
        a2.append(new com.google.gson.d().s(webviewCreateRequest));
        Log.i(str2, a2.toString());
        this.e.runOnUiThread(new h(this, webviewCreateRequest, 0));
        this.i = new JSONObject(webviewCreateRequest.getParsedPayload().getMetaData()).optInt("unityCanvasHeight");
        this.h = new JSONObject(webviewCreateRequest.getParsedPayload().getMetaData()).optInt("unityCanvasWidth");
        this.p = new JSONObject(webviewCreateRequest.getParsedPayload().getMetaData()).optBoolean("enableNotchArea");
        this.i = new JSONObject(webviewCreateRequest.getParsedPayload().getMetaData()).optInt("unityCanvasHeight");
        this.h = new JSONObject(webviewCreateRequest.getParsedPayload().getMetaData()).optInt("unityCanvasWidth");
        String id = webviewCreateRequest.getParsedPayload().getId();
        WebviewEventType webviewEventType = WebviewEventType.ON_CREATE;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("webviewId", webviewCreateRequest.getParsedPayload().getId());
        jSONObject.put("url", webviewCreateRequest.getParsedPayload().getUrl());
        Unit unit = Unit.a;
        b(new WindowWebviewEvent(id, webviewEventType, jSONObject, null, 8, null));
        this.e.runOnUiThread(new C(webviewCreateRequest, this, 1));
    }

    public static final void a(CreateWebviewPGEvent webviewCreateRequest, f this$0) {
        String id;
        String url;
        Boolean enableEvaluateJs;
        Intrinsics.checkNotNullParameter(webviewCreateRequest, "$webviewCreateRequest");
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        if (Intrinsics.a(webviewCreateRequest.getParsedPayload().getOrientation(), "portrait")) {
            this$0.j = false;
        }
        WebViewConfiguration webViewConfiguration = webviewCreateRequest.getParsedPayload().getWebViewConfiguration();
        this$0.l = (webViewConfiguration == null || (enableEvaluateJs = webViewConfiguration.getEnableEvaluateJs()) == null) ? false : enableEvaluateJs.booleanValue();
        String orientation = webviewCreateRequest.getParsedPayload().getOrientation();
        Intrinsics.checkNotNullParameter(orientation, "orientation");
        Log.d(this$0.d, "updateDimensions :: Started Fetching device heigth and width");
        String str = com.games24x7.pgwebview.util.b.a;
        this$0.g = com.games24x7.pgwebview.util.b.a(this$0.e);
        this$0.f = com.games24x7.pgwebview.util.b.b(this$0.e);
        String str2 = this$0.d;
        StringBuilder a = com.games24x7.pgwebview.a.a("updateDimensions :: Original deviceWidth=");
        a.append(this$0.f);
        a.append(" :: Original deviceHeight=");
        a.append(this$0.g);
        Log.d(str2, a.toString());
        Log.e(this$0.d, "updateDimension :: Orientation is :: " + orientation);
        if (Intrinsics.a(orientation, "portrait")) {
            int i = this$0.f;
            int i2 = this$0.g;
            if (i > i2) {
                this$0.g = i;
                this$0.f = i2;
            }
        } else {
            int i3 = this$0.g;
            int i4 = this$0.f;
            if (i3 > i4) {
                this$0.g = i4;
                this$0.f = i3;
            }
        }
        String str3 = this$0.d;
        StringBuilder a2 = com.games24x7.pgwebview.a.a("deviceWidth=");
        a2.append(this$0.f);
        a2.append(", deviceHeight=");
        a2.append(this$0.g);
        Log.d(str3, a2.toString());
        Activity activity = this$0.e;
        String id2 = webviewCreateRequest.getParsedPayload().getId();
        WebViewConfiguration webViewConfiguration2 = webviewCreateRequest.getParsedPayload().getWebViewConfiguration();
        Intrinsics.c(webViewConfiguration2);
        c cVar = new c(activity, id2, webViewConfiguration2, this$0, webviewCreateRequest.getParsedPayload().getCustomWebviewResponse());
        String str4 = this$0.d;
        StringBuilder a3 = com.games24x7.pgwebview.a.a("webview created :: Loading url into webviewId as ");
        a3.append(webviewCreateRequest.getParsedPayload().getId());
        a3.append(" :: Url is ");
        a3.append(webviewCreateRequest.getParsedPayload().getUrl());
        a3.append(" :: UseEvaluateJS is ");
        a3.append(this$0.l);
        Log.e(str4, a3.toString());
        List<JsInterfaceHolder> jsInterfaceList = WebviewRequestEventHandler.Companion.getJsInterfaceList(webviewCreateRequest.getParsedPayload().getId());
        if (jsInterfaceList != null) {
            for (JsInterfaceHolder jsInterfaceHolder : jsInterfaceList) {
                cVar.addJavascriptInterface(jsInterfaceHolder.getJsClass(), jsInterfaceHolder.getJsName());
            }
        }
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
        WebView.setWebContentsDebuggingEnabled(false);
        this$0.k.addView(cVar, layoutParams);
        this$0.c.put(webviewCreateRequest.getParsedPayload().getId(), cVar);
        String str5 = this$0.d;
        StringBuilder a4 = com.games24x7.pgwebview.a.a("createWebview :: Added Webview into WindowWebview :: WebviewId is :: ");
        a4.append(webviewCreateRequest.getParsedPayload().getId());
        Log.e(str5, a4.toString());
        this$0.b(new WindowWebviewEvent(webviewCreateRequest.getParsedPayload().getId(), WebviewEventType.CREATED, null, cVar, 4, null));
        String id3 = webviewCreateRequest.getParsedPayload().getId();
        float intValue = webviewCreateRequest.getParsedPayload().getPosX() != null ? r0.intValue() : 0.0f;
        float intValue2 = webviewCreateRequest.getParsedPayload().getPosX() != null ? r0.intValue() : 0.0f;
        Integer width = webviewCreateRequest.getParsedPayload().getWidth();
        int intValue3 = width != null ? width.intValue() : 0;
        Integer height = webviewCreateRequest.getParsedPayload().getHeight();
        this$0.a(id3, intValue, intValue2, intValue3, height != null ? height.intValue() : 0, this$0.f, this$0.g, true);
        if (webviewCreateRequest.getParsedPayload().getUrl().length() == 0) {
            String str6 = com.games24x7.pgwebview.util.b.a;
            if (!com.games24x7.pgwebview.util.b.d(this$0.e)) {
                Log.d(this$0.d, "Empty url with Non debuggable build");
                this$0.b(webviewCreateRequest.getParsedPayload().getId(), false);
            } else {
                Log.d(this$0.d, "Empty url with Debuggable build");
                id = webviewCreateRequest.getParsedPayload().getId();
                url = "about:blank";
            }
        } else {
            id = webviewCreateRequest.getParsedPayload().getId();
            url = webviewCreateRequest.getParsedPayload().getUrl();
        }
        this$0.d(id, url);
        this$0.b(webviewCreateRequest.getParsedPayload().getId(), false);
    }

    public static final void a(f this$0, String webviewId, float f, float f2, float f3, int i, int i2, int i3) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(webviewId, "$webviewId");
        this$0.a();
        c a = this$0.a(webviewId);
        if (a != null) {
            double d = this$0.o;
            a.a((int) (f * ConnectionResult.DRIVE_EXTERNAL_STORAGE_REQUIRED), f2, f3, ((int) (i * d)) + this$0.m, this$0.g - ((((int) (i2 * d)) + this$0.n) + ((int) (i3 * d))));
        }
    }

    public final void a(@NotNull PositionWebivewPGEvent positionRequest) {
        Intrinsics.checkNotNullParameter(positionRequest, "positionRequest");
        String id = positionRequest.getParsedPayload().getId();
        float posX = positionRequest.getParsedPayload().getPosX();
        float posY = positionRequest.getParsedPayload().getPosY();
        int width = positionRequest.getParsedPayload().getWidth();
        int height = positionRequest.getParsedPayload().getHeight();
        int i = this.f;
        int i2 = this.g;
        Boolean isScaleRequired = positionRequest.getParsedPayload().isScaleRequired();
        a(id, posX, posY, width, height, i, i2, isScaleRequired != null ? isScaleRequired.booleanValue() : true);
    }

    public static final void a(f this$0, String webviewId, float f, float f2, int i, int i2, boolean z) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(webviewId, "$webviewId");
        this$0.a();
        c a = this$0.a(webviewId);
        double d = this$0.o;
        int i3 = ((int) (f * d)) + this$0.m;
        int i4 = (int) (i * d);
        int i5 = this$0.g - ((((int) (f2 * d)) + this$0.n) + i4);
        int i6 = (int) (i2 * d);
        String str = this$0.d;
        StringBuilder e = e.e("setWebViewFrame :: scaledX=", i3, "  scaledY=", i5, "  scaledXSize=");
        e.append(i6);
        e.append("  scaledYSize=");
        e.append(i4);
        Log.i(str, e.toString());
        if (z && this$0.j) {
            if (a != null) {
                a.a(i3, i5, i6, i4, true);
            }
        } else if (a != null) {
            a.a((int) f, (int) f2, i2, i, true);
        }
    }
}