导航菜单

页面标题

页面副标题

OLX India v19.42.007 - CustomWebViewActivity.java 源代码

正在查看: OLX India v19.42.007 应用的 CustomWebViewActivity.java JAVA 源代码文件

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


package com.adtmonetize.sdk.web.activity;

import android.app.Activity;
import android.os.Bundle;
import android.widget.FrameLayout;
import androidx.annotation.Keep;
import androidx.lifecycle.CoroutineLiveDataKt;
import com.adtmonetize.sdk.code.InterfaceC0363;
import com.adtmonetize.sdk.common.notch.NotchScreenManager;
import com.adtmonetize.sdk.common.util.ContextUtils;
import com.adtmonetize.sdk.common.util.ScreenUtils;
import com.adtmonetize.sdk.common.util.ThreadManager;
import com.adtmonetize.sdk.common.util.log.DevLog;
import com.adtmonetize.sdk.web.CustomWebController;
import com.adtmonetize.sdk.web.view.CloseButton;
import com.adtmonetize.sdk.web.view.OnCloseBtnClickListener;

@Keep
public class CustomWebViewActivity extends Activity implements InterfaceC0363 {
    private CustomWebController mWebController;
    private FrameLayout mFrameLayout = null;
    private CloseButton mCloseButton = null;
    private boolean mAllowBack = false;

    private void addCloseBtnToAct() {
        if (this.mWebController != null) {
            this.mCloseButton = new CloseButton(this);
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ScreenUtils.dip2px(this, 36.0f), ScreenUtils.dip2px(this, 36.0f));
            layoutParams.gravity = 8388661;
            layoutParams.topMargin = ScreenUtils.getStatusBarHeight(this);
            this.mCloseButton.setVisibility(8);
            this.mCloseButton.setOnCloseBtnClickListener(new OnCloseBtnClickListener() {
                @Override
                public final void closeActivity() {
                    CustomWebViewActivity.this.finish();
                }
            });
            addContentView(this.mCloseButton, layoutParams);
            closeBtnRefreshVisibilityDelay();
        }
    }

    private void closeBtnRefreshVisibilityDelay() {
        CloseButton closeButton = this.mCloseButton;
        if (closeButton != null) {
            closeButton.postDelayed(new Runnable() {
                @Override
                public final void run() {
                    CustomWebViewActivity.this.lambda$closeBtnRefreshVisibilityDelay$0();
                }
            }, CoroutineLiveDataKt.DEFAULT_TIMEOUT);
        }
    }

    public void lambda$closeBtnRefreshVisibilityDelay$0() {
        CloseButton closeButton;
        int i;
        CustomWebController customWebController = this.mWebController;
        if (customWebController == null || this.mCloseButton == null) {
            return;
        }
        if (customWebController.isCloseVisible()) {
            this.mAllowBack = true;
            closeButton = this.mCloseButton;
            i = 0;
        } else {
            closeButton = this.mCloseButton;
            i = 8;
        }
        closeButton.setVisibility(i);
    }

    public void lambda$setCloseVisible$1() {
        CloseButton closeButton;
        int i;
        CustomWebController customWebController = this.mWebController;
        if (customWebController == null || this.mCloseButton == null) {
            return;
        }
        if (customWebController.isCloseVisible()) {
            this.mAllowBack = true;
            closeButton = this.mCloseButton;
            i = 0;
        } else {
            closeButton = this.mCloseButton;
            i = 8;
        }
        closeButton.setVisibility(i);
    }

    @Override
    public void close() {
        finish();
    }

    @Override
    public void onBackPressed() {
        CustomWebController customWebController = this.mWebController;
        if (customWebController != null) {
            customWebController.onBackPressed();
            if (!this.mAllowBack) {
                return;
            }
        }
        super.onBackPressed();
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        try {
            NotchScreenManager.getInstance().setDisplayInNotch(this);
            FrameLayout frameLayout = new FrameLayout(this);
            this.mFrameLayout = frameLayout;
            setContentView(frameLayout);
            String stringExtra = getIntent().getStringExtra("Url");
            CustomWebController customWebController = new CustomWebController(getApplicationContext(), this);
            this.mWebController = customWebController;
            this.mFrameLayout.addView(customWebController.getWebView(), new FrameLayout.LayoutParams(-1, -1));
            this.mWebController.loadUrl(stringExtra);
            addCloseBtnToAct();
        } catch (Throwable th) {
            DevLog.logW("WebViewActivity create CustomWebController error: " + th.getLocalizedMessage());
            finish();
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        FrameLayout frameLayout = this.mFrameLayout;
        if (frameLayout != null) {
            frameLayout.removeAllViews();
        }
        CustomWebController customWebController = this.mWebController;
        if (customWebController != null) {
            customWebController.destroy();
        }
    }

    @Override
    public void onPause() {
        super.onPause();
        CustomWebController customWebController = this.mWebController;
        if (customWebController != null) {
            customWebController.onPause(this);
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        CustomWebController customWebController = this.mWebController;
        if (customWebController != null) {
            customWebController.onResume(this);
        }
    }

    @Override
    public void ready() {
    }

    @Override
    public void setCloseVisible(boolean z) {
        if (ContextUtils.isDestroyed(this) || this.mWebController == null || this.mCloseButton == null) {
            return;
        }
        ThreadManager.getInstance().runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                CustomWebViewActivity.this.lambda$setCloseVisible$1();
            }
        });
    }
}