Active IQ v6.7.1版本的 MD5 值为:5082594ca2b69fbfbe64e6d6ee2159a7

以下内容为反编译后的 BiometricAgreementActivity.java 源代码,内容仅作参考


package com.netapp.myautosupport.presentation.login.biometricagreement;

import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.databinding.DataBindingUtil;
import android.net.http.SslError;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.View;
import android.webkit.CookieManager;
import android.webkit.JavascriptInterface;
import android.webkit.SslErrorHandler;
import android.webkit.ValueCallback;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;
import com.netapp.myautosupport.MyAsupApplication;
import com.netapp.myautosupport.R;
import com.netapp.myautosupport.common.AppConstants;
import com.netapp.myautosupport.common.Utils;
import com.netapp.myautosupport.databinding.ActivityFpaggrementBinding;
import com.netapp.myautosupport.presentation.base.BaseActivity;
import com.netapp.myautosupport.presentation.login.biometricagreement.BiometricAgreementContract;
public class BiometricAgreementActivity extends BaseActivity implements AppConstants, BiometricAgreementContract.View {
    private BiometricAgreementPresenter agreementPresenter;
    private Context ctx;
    private ActivityFpaggrementBinding fPAggrementABinding;
    private String url;
    private String username;

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.fPAggrementABinding = (ActivityFpaggrementBinding) DataBindingUtil.setContentView(this, R.layout.activity_fpaggrement);
        String simpleName = BiometricAgreementActivity.class.getSimpleName();
        this.ctx = this;
        this.username = getIntent().getStringExtra("USER");
        this.agreementPresenter = new BiometricAgreementPresenter();
        this.agreementPresenter.attachView(this);
        this.fPAggrementABinding.activityBiometricAgreementYesTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                BiometricAgreementActivity.this.agreementPresenter.acceptAgreement();
            }
        });
        this.fPAggrementABinding.activityBiometricAgreementNoTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (BiometricAgreementActivity.this.fPAggrementABinding.activityBiometricAgreementDoNotShowCheckbox.isChecked()) {
                    SharedPreferences.Editor edit = BiometricAgreementActivity.this.getSharedPreferences(AppConstants.FINGER_PRINT_AGREEMENT_AGREED, 0).edit();
                    edit.putString(BiometricAgreementActivity.this.username.trim(), "NO");
                    edit.commit();
                }
                BiometricAgreementActivity.this.finish();
            }
        });
        String string = getResources().getString(R.string.url);
        this.url = string + "mobile/user/fingerprint/agreement/content?" + AppConstants.API_VERSION;
        setCookieSettings();
        showLoading();
        this.fPAggrementABinding.activityBiometricAgreementWebview.setInitialScale(1);
        this.fPAggrementABinding.activityBiometricAgreementWebview.getSettings().setLoadWithOverviewMode(true);
        this.fPAggrementABinding.activityBiometricAgreementWebview.getSettings().setBuiltInZoomControls(true);
        this.fPAggrementABinding.activityBiometricAgreementWebview.getSettings().setSupportZoom(true);
        this.fPAggrementABinding.activityBiometricAgreementWebview.getSettings().setDisplayZoomControls(true);
        this.fPAggrementABinding.activityBiometricAgreementWebview.getSettings().setJavaScriptEnabled(true);
        this.fPAggrementABinding.activityBiometricAgreementWebview.getSettings().setUseWideViewPort(true);
        this.fPAggrementABinding.activityBiometricAgreementWebview.getSettings().setPluginState(WebSettings.PluginState.ON);
        this.fPAggrementABinding.activityBiometricAgreementWebview.getSettings().setDomStorageEnabled(true);
        this.fPAggrementABinding.activityBiometricAgreementWebview.setBackgroundResource(R.color.background_gray);
        WebSettings settings = this.fPAggrementABinding.activityBiometricAgreementWebview.getSettings();
        settings.setDefaultFontSize((int) getResources().getDimension(R.dimen.detail_screen_textsize12));
        settings.setRenderPriority(WebSettings.RenderPriority.HIGH);
        settings.setCacheMode(2);
        settings.setAppCacheEnabled(false);
        settings.setBlockNetworkImage(true);
        settings.setLoadsImagesAutomatically(true);
        settings.setGeolocationEnabled(false);
        settings.setNeedInitialFocus(false);
        settings.setSaveFormData(false);
        settings.setFixedFontFamily("Montserrat-Regular");
        this.fPAggrementABinding.activityBiometricAgreementWebview.loadUrl(this.url);
        this.fPAggrementABinding.activityBiometricAgreementWebview.setWebViewClient(new AnonymousClass3(simpleName));
    }

    class AnonymousClass3 extends WebViewClient {
        final String val$TAG;

        AnonymousClass3(String str) {
            this.val$TAG = str;
        }

        @Override
        @RequiresApi(api = 21)
        public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) {
            webView.loadUrl(webResourceRequest.getUrl().toString());
            webView.setBackgroundResource(R.color.background_gray);
            return true;
        }

        @Override
        public void onPageFinished(WebView webView, String str) {
            super.onPageFinished(webView, str);
            Log.e(this.val$TAG, "onPageFinished: ");
            WebView webView2 = BiometricAgreementActivity.this.fPAggrementABinding.activityBiometricAgreementWebview;
            webView2.loadUrl("javascript:document.getElementById('navigationText')style.fontFamily =src:url('file:///android_asset/fonts/Montserrat-Regular.ttf');");
            BiometricAgreementActivity.this.hideLoading();
        }

        @Override
        @RequiresApi(api = 23)
        public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
            super.onReceivedError(webView, webResourceRequest, webResourceError);
            Log.e(this.val$TAG, "onReceivedError: ");
            BiometricAgreementActivity.this.hideLoading();
            Utils.getInstance().showDialogWithOneButton(BiometricAgreementActivity.this.ctx, webResourceError.getDescription().toString());
        }

        @Override
        public void onReceivedSslError(WebView webView, final SslErrorHandler sslErrorHandler, SslError sslError) {
            AlertDialog.Builder builder = new AlertDialog.Builder(BiometricAgreementActivity.this.ctx);
            builder.setMessage(R.string.notification_error_ssl_cert_invalid);
            builder.setPositiveButton("continue", new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    sslErrorHandler.proceed();
                }
            });
            builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    sslErrorHandler.cancel();
                }
            });
            builder.create().show();
        }
    }

    @JavascriptInterface
    public void showData(String str) {
        hideLoading();
        Log.d(AppConstants.TAG, "showToast: JavaScript Variable Data: " + str);
        this.fPAggrementABinding.activityBiometricAgreementWebview.loadData(str, "text/plain", "UTF-8");
    }

    @Override
    public void success(String str) {
        if (str.equalsIgnoreCase("success")) {
            SharedPreferences.Editor edit = getSharedPreferences(AppConstants.FINGER_PRINT_AGREEMENT_AGREED, 0).edit();
            edit.putString(this.username.trim(), "YES");
            edit.commit();
            finish();
        }
    }

    private void setCookieSettings() {
        CookieManager cookieManager = CookieManager.getInstance();
        cookieManager.setAcceptCookie(true);
        if (Build.VERSION.SDK_INT >= 24) {
            cookieManager.setCookie(this.url, MyAsupApplication.SSO_COOKIE);
        } else if (Build.VERSION.SDK_INT >= 21) {
            cookieManager.setCookie(this.url, MyAsupApplication.SSO_COOKIE, new ValueCallback<Boolean>() {
                @Override
                public void onReceiveValue(Boolean bool) {
                    StringBuilder sb = new StringBuilder();
                    sb.append("onReceiveValue: Is cookie set? ");
                    sb.append(bool.booleanValue() ? "Yes." : "No.");
                    Log.d(AppConstants.TAG, sb.toString());
                }
            });
        } else {
            cookieManager.setCookie(this.url, MyAsupApplication.SSO_COOKIE);
        }
    }

    @Override
    public void failed(String str, String str2, String str3, int i) {
        if (i != 0) {
            this.agreementPresenter.LogError(str3, str2, str, i);
        }
        disPlayErrorScreen(str);
    }

    private void disPlayErrorScreen(String str) {
        hideLoading();
        findViewById(R.id.license_layout).setVisibility(8);
        findViewById(R.id.Error_View).setVisibility(0);
        ((TextView) findViewById(R.id.dialog_error_error_txt)).setText(str);
        findViewById(R.id.dialog_error_retry_btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                BiometricAgreementActivity.this.showLoading();
                BiometricAgreementActivity.this.agreementPresenter.acceptAgreement();
            }
        });
        findViewById(R.id.dialog_error_close_img).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                BiometricAgreementActivity.this.findViewById(R.id.license_layout).setVisibility(0);
                BiometricAgreementActivity.this.findViewById(R.id.Error_View).setVisibility(8);
            }
        });
    }
}