导航菜单

页面标题

页面副标题

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

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

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


package com.olxgroup.panamera.app.common.activities;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Bundle;
import android.view.ViewGroup;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import com.olx.southasia.databinding.i7;
import com.olx.southasia.p;
import com.olxgroup.panamera.app.common.helpers.DialogHelper;
import com.olxgroup.panamera.app.common.infra.m2;
import com.olxgroup.panamera.app.common.utils.r0;
import olx.com.delorean.domain.utils.TextUtils;

public class ExternalSiteActivity extends androidx.appcompat.app.d implements com.olxgroup.panamera.app.common.presentationContracts.a {
    private WebView Q;
    private String R = "";
    com.olxgroup.panamera.app.common.presenters.a S;
    private String T;
    private androidx.browser.customtabs.c U;
    private i7 V;

    class a extends WebViewClient {
        a() {
        }

        @Override
        public void onPageFinished(WebView webView, String str) {
            super.onPageFinished(webView, str);
            ExternalSiteActivity.this.hideProgress();
        }

        @Override
        public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
            sslErrorHandler.cancel();
            ExternalSiteActivity.this.hideProgress();
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            ExternalSiteActivity.this.hideProgress();
            return ExternalSiteActivity.this.S.b(str);
        }
    }

    public ExternalSiteActivity() {
        m2 m2Var = m2.a;
        this.S = new com.olxgroup.panamera.app.common.presenters.a(m2Var.M2(), m2Var.E2());
    }

    private void i2() {
        WebView webView = new WebView(this);
        this.Q = webView;
        webView.getSettings().setJavaScriptEnabled(true);
        this.Q.getSettings().setDomStorageEnabled(true);
        this.Q.getSettings().setSupportZoom(false);
        this.Q.getSettings().setBuiltInZoomControls(false);
        this.Q.getSettings().setAllowContentAccess(false);
        this.Q.getSettings().setAllowFileAccess(false);
        this.Q.getSettings().setAllowFileAccessFromFileURLs(false);
        this.Q.getSettings().setAllowUniversalAccessFromFileURLs(false);
        this.Q.setWebViewClient(new a());
    }

    private void j2() {
        showProgress();
        if (this.Q == null) {
            i2();
        }
        if (this.Q.getParent() != null) {
            ((ViewGroup) this.Q.getParent()).removeView(this.Q);
        }
        this.V.B.addView(this.Q);
        String str = this.T;
        this.R = str;
        this.Q.loadUrl(str);
        if (r0.b(this)) {
            return;
        }
        hideProgress();
        Toast.makeText((Context) this, p.connection_error_title, 0).show();
    }

    @Override
    public void I1(String str) {
        Intent intent = new Intent("android.intent.action.VIEW");
        intent.setData(Uri.parse(str));
        if (intent.resolveActivity(getPackageManager()) != null) {
            startActivity(intent);
            finish();
        } else {
            Toast.makeText((Context) this, (CharSequence) getString(p.connection_error_title), 0).show();
            finish();
        }
    }

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

    public void h2() {
        if (TextUtils.isEmpty(this.R)) {
            this.V.A.setVisibility(8);
            j2();
        }
    }

    public void hideProgress() {
        DialogHelper.e(this);
    }

    public void onCreate(Bundle bundle) {
        super/*androidx.fragment.app.r*/.onCreate(bundle);
        this.V = (i7) androidx.databinding.g.j(this, com.olx.southasia.k.fragment_external_site);
        this.T = getIntent().getStringExtra("target_url");
        if (bundle != null) {
            this.R = bundle.getString("loaded_url");
        }
        this.S.setView(this);
    }

    public void onDestroy() {
        androidx.browser.customtabs.c cVar = this.U;
        if (cVar != null) {
            unbindService(cVar);
            this.U = null;
        }
        super.onDestroy();
    }

    public void onResume() {
        super/*androidx.fragment.app.r*/.onResume();
        h2();
    }

    public void onSaveInstanceState(Bundle bundle) {
        super/*androidx.activity.ComponentActivity*/.onSaveInstanceState(bundle);
        bundle.putString("loaded_url", this.R);
    }

    public void showProgress() {
        DialogHelper.j(this, null, getResources().getString(p.connecting));
    }
}