Slot Master Star-Bg Game v0.0.1版本的 MD5 值为:fc952409a1e6c71e7b668607b0f3fde9

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


package com.onevcat.uniwebview;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.text.Editable;
import android.util.Log;
import android.view.Display;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;
import android.view.inputmethod.InputMethodManager;
import android.webkit.DownloadListener;
import android.webkit.JavascriptInterface;
import android.webkit.JsPromptResult;
import android.webkit.JsResult;
import android.webkit.PermissionRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.EditText;
import android.widget.FrameLayout;
import com.adjust.sdk.Constants;
import com.unity3d.player.UnityPlayer;
import java.util.ArrayList;
import java.util.HashMap;
public class UniWebViewDialog extends Dialog {
    public static final int ANIMATION_EDGE_BOTTOM = 3;
    public static final int ANIMATION_EDGE_LEFT = 2;
    public static final int ANIMATION_EDGE_NONE = 0;
    public static final int ANIMATION_EDGE_RIGHT = 4;
    public static final int ANIMATION_EDGE_TOP = 1;
    private AlertDialog _alertDialog;
    private boolean _animating;
    private boolean _backButtonEnable;
    private int _backgroundColor;
    private int _bottom;
    private boolean _canGoBack;
    private boolean _canGoForward;
    private FrameLayout _content;
    private String _currentUrl;
    private String _currentUserAgent;
    private boolean _immersiveMode;
    private boolean _isLoading;
    private int _left;
    private DialogListener _listener;
    private boolean _loadingInterrupted;
    private boolean _manualHide;
    private boolean _openLinksInExternalBrowser;
    private int _right;
    private boolean _showSpinnerWhenLoading;
    private ProgressDialog _spinner;
    private String _spinnerText;
    private int _top;
    private UniWebView _uniWebView;
    private float alpha;
    private HashMap<String, String> headers;
    public ArrayList<String> schemes;
    private ArrayList<String> trustSites;

    public interface DialogListener {
        void onAnimationFinished(UniWebViewDialog uniWebViewDialog, String str);

        void onDialogClose(UniWebViewDialog uniWebViewDialog);

        void onDialogKeyDown(UniWebViewDialog uniWebViewDialog, int i);

        void onDialogShouldCloseByBackButton(UniWebViewDialog uniWebViewDialog);

        void onHideTransitionFinished(UniWebViewDialog uniWebViewDialog);

        void onJavaScriptFinished(UniWebViewDialog uniWebViewDialog, String str);

        void onPageFinished(UniWebViewDialog uniWebViewDialog, String str);

        void onPageStarted(UniWebViewDialog uniWebViewDialog, String str);

        void onReceivedError(UniWebViewDialog uniWebViewDialog, int i, String str, String str2);

        void onShowTransitionFinished(UniWebViewDialog uniWebViewDialog);

        boolean shouldOverrideUrlLoading(UniWebViewDialog uniWebViewDialog, String str);
    }

    public UniWebView getWebView() {
        return this._uniWebView;
    }

    @Override
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (i == 4) {
            if (this._backButtonEnable && !goBack()) {
                this._listener.onDialogShouldCloseByBackButton(this);
            }
            return true;
        }
        return super.onKeyDown(i, keyEvent);
    }

    @Override
    public boolean dispatchKeyEvent(KeyEvent keyEvent) {
        Log.d("UniWebView", "onKeyDown " + keyEvent);
        if (keyEvent.getAction() == 0) {
            this._listener.onDialogKeyDown(this, keyEvent.getKeyCode());
        }
        return super.dispatchKeyEvent(keyEvent);
    }

    public UniWebViewDialog(Context context, DialogListener dialogListener) {
        super(context, 16973932);
        this._showSpinnerWhenLoading = true;
        this._spinnerText = "Loading...";
        this._currentUrl = "";
        this._backgroundColor = -1;
        this._backButtonEnable = true;
        this._animating = false;
        this.alpha = 1.0f;
        this._immersiveMode = true;
        this._listener = dialogListener;
        ArrayList<String> arrayList = new ArrayList<>();
        this.schemes = arrayList;
        arrayList.add("uniwebview");
        this.trustSites = new ArrayList<>();
        this.headers = new HashMap<>();
        Window window = getWindow();
        window.setBackgroundDrawable(new ColorDrawable(0));
        window.addFlags(32);
        window.setSoftInputMode(16);
        if (Build.VERSION.SDK_INT < 16) {
            window.addFlags(1024);
        } else {
            HideSystemUI();
        }
        window.setFlags(1024, 1024);
        createContent();
        createWebView();
        createSpinner();
        addContentView(this._content, new ViewGroup.LayoutParams(-1, -1));
        this._content.addView(this._uniWebView);
        Log.d("UniWebView", "Create a new UniWebView Dialog");
        this._content.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                Rect rect = new Rect();
                UniWebViewDialog.this._content.getWindowVisibleDisplayFrame(rect);
                if (Math.abs(rect.height() - UniWebViewDialog.this._content.getHeight()) > 128) {
                    UniWebViewDialog.this.HideSystemUI();
                }
            }
        });
    }

    public void HideSystemUI() {
        if (Build.VERSION.SDK_INT >= 16) {
            final View decorView = getWindow().getDecorView();
            final int i = 4;
            decorView.setSystemUiVisibility((Build.VERSION.SDK_INT < 19 || !this._immersiveMode) ? 4 : 3846);
            if (Build.VERSION.SDK_INT >= 19 && this._immersiveMode) {
                i = 5894;
            }
            decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
                @Override
                public void onSystemUiVisibilityChange(int i2) {
                    decorView.setOnSystemUiVisibilityChangeListener(null);
                    decorView.setSystemUiVisibility(i);
                }
            });
        }
    }

    public void changeInsets(int i, int i2, int i3, int i4) {
        this._top = i;
        this._left = i2;
        this._bottom = i3;
        this._right = i4;
        updateContentSize();
    }

    public void load(String str) {
        Log.d("UniWebView", str);
        this._uniWebView.loadUrl(str, this.headers);
    }

    public void postUrl(String str, byte[] bArr) {
        this._uniWebView.postUrl(str, bArr);
    }

    public void addJs(String str) {
        if (str == null) {
            Log.d("UniWebView", "Trying to add a null js. Abort.");
        } else {
            load(String.format("javascript:%s", str));
        }
    }

    public void loadJS(String str) {
        if (str == null) {
            Log.d("UniWebView", "Trying to eval a null js. Abort.");
            return;
        }
        String trim = str.trim();
        while (trim.endsWith(";") && trim.length() != 0) {
            trim = trim.substring(0, trim.length() - 1);
        }
        load(String.format("javascript:android.onData(%s)", trim));
    }

    public void loadHTMLString(String str, String str2) {
        this._uniWebView.loadDataWithBaseURL(str2, str, "text/html", Constants.ENCODING, null);
    }

    public void cleanCache() {
        this._uniWebView.clearCache(true);
    }

    public boolean goBack() {
        if (this._uniWebView.canGoBack()) {
            this._uniWebView.goBack();
            return true;
        }
        return false;
    }

    public boolean goForward() {
        if (this._uniWebView.canGoForward()) {
            this._uniWebView.goForward();
            return true;
        }
        return false;
    }

    public void destroy() {
        this._uniWebView.loadUrl("about:blank");
        UniWebViewManager.Instance().removeShowingWebViewDialog(this);
        dismiss();
    }

    @Override
    protected void onStop() {
        this._listener.onDialogClose(this);
    }

    private void showDialog() {
        if (Build.VERSION.SDK_INT >= 19 && this._immersiveMode) {
            getWindow().setFlags(8, 8);
            show();
            getWindow().getDecorView().setSystemUiVisibility(getWindow().getDecorView().getSystemUiVisibility());
            getWindow().clearFlags(8);
            return;
        }
        show();
    }

    public void setShow(final boolean z, boolean z2, int i, float f) {
        int i2;
        int i3;
        if (this._animating) {
            Log.d("UniWebView", "Trying to animate but another transition animation is not finished yet. Ignore this one.");
            return;
        }
        int i4 = 0;
        if (z) {
            showDialog();
            if (this._showSpinnerWhenLoading && this._isLoading) {
                showSpinner();
            }
            UniWebViewManager.Instance().addShowingWebViewDialog(this);
            this._manualHide = false;
        } else {
            ((InputMethodManager) UnityPlayer.currentActivity.getSystemService("input_method")).hideSoftInputFromWindow(this._uniWebView.getWindowToken(), 0);
            this._spinner.hide();
            this._manualHide = true;
        }
        if (!z2 && i == 0) {
            if (z) {
                this._listener.onShowTransitionFinished(this);
                return;
            }
            hide();
            this._listener.onHideTransitionFinished(this);
            return;
        }
        this._animating = true;
        final View childAt = ((ViewGroup) getWindow().getDecorView()).getChildAt(0);
        AnimationSet animationSet = new AnimationSet(false);
        int i5 = (int) (f * 1000.0f);
        if (z2) {
            AlphaAnimation alphaAnimation = new AlphaAnimation(z ? 0.0f : 1.0f, z ? 1.0f : 0.0f);
            alphaAnimation.setFillAfter(true);
            alphaAnimation.setDuration(i5);
            animationSet.addAnimation(alphaAnimation);
        }
        Point displaySize = displaySize();
        if (i == 1) {
            i3 = -displaySize.y;
        } else {
            if (i == 2) {
                i2 = -displaySize.x;
            } else if (i == 3) {
                i3 = displaySize.y;
            } else if (i == 4) {
                i2 = displaySize.x;
            } else {
                if (i != 0) {
                    Log.d("UniWebView", "Unknown direction. You should send 0~5");
                    return;
                }
                i3 = 0;
            }
            i4 = i2;
            i3 = 0;
        }
        if (i != 0) {
            TranslateAnimation translateAnimation = new TranslateAnimation(z ? i4 : 0.0f, z ? 0.0f : i4, z ? i3 : 0.0f, z ? 0.0f : i3);
            translateAnimation.setFillAfter(true);
            translateAnimation.setDuration(i5);
            animationSet.addAnimation(translateAnimation);
        }
        childAt.startAnimation(animationSet);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                UniWebViewDialog.this._animating = false;
                childAt.clearAnimation();
                if (z) {
                    UniWebViewDialog.this._listener.onShowTransitionFinished(UniWebViewDialog.this);
                    return;
                }
                UniWebViewDialog.this.hide();
                UniWebViewDialog.this._listener.onHideTransitionFinished(UniWebViewDialog.this);
            }
        }, i5);
    }

    Point displaySize() {
        Display defaultDisplay = getWindow().getWindowManager().getDefaultDisplay();
        if (Build.VERSION.SDK_INT >= 19 && this._immersiveMode) {
            Point point = new Point();
            defaultDisplay.getRealSize(point);
            return point;
        } else if (Build.VERSION.SDK_INT >= 13) {
            Point point2 = new Point();
            defaultDisplay.getSize(point2);
            return point2;
        } else {
            return new Point(defaultDisplay.getWidth(), defaultDisplay.getHeight());
        }
    }

    public void updateContentSize() {
        Window window = getWindow();
        Point displaySize = displaySize();
        int max = Math.max(0, (displaySize.x - this._left) - this._right);
        int max2 = Math.max(0, (displaySize.y - this._top) - this._bottom);
        if (max == 0 || max2 == 0) {
            Log.d("UniWebView", "The inset is lager then screen size. Webview will not show. Please check your insets setting.");
            return;
        }
        window.setLayout(max, max2);
        WindowManager.LayoutParams attributes = window.getAttributes();
        attributes.gravity = 51;
        attributes.x = this._left;
        attributes.y = this._top;
        window.setAttributes(attributes);
    }

    public void setSpinnerShowWhenLoading(boolean z) {
        this._showSpinnerWhenLoading = z;
    }

    public void setSpinnerText(String str) {
        if (str != null) {
            this._spinnerText = str;
        } else {
            this._spinnerText = "";
        }
        this._spinner.setMessage(str);
    }

    public void showSpinner() {
        if (Build.VERSION.SDK_INT >= 19 && this._immersiveMode) {
            this._spinner.getWindow().setFlags(8, 8);
            this._spinner.show();
            this._spinner.getWindow().getDecorView().setSystemUiVisibility(getWindow().getDecorView().getSystemUiVisibility());
            this._spinner.getWindow().clearFlags(8);
            return;
        }
        this._spinner.show();
    }

    private void createContent() {
        FrameLayout frameLayout = new FrameLayout(getContext());
        this._content = frameLayout;
        frameLayout.setVisibility(0);
    }

    private void createSpinner() {
        ProgressDialog progressDialog = new ProgressDialog(getContext());
        this._spinner = progressDialog;
        progressDialog.setCanceledOnTouchOutside(true);
        this._spinner.requestWindowFeature(1);
        this._spinner.setMessage(this._spinnerText);
    }

    private void createWebView() {
        this._uniWebView = new UniWebView(getContext());
        this._uniWebView.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
                UniWebViewDialog.this._canGoBack = webView.canGoBack();
                UniWebViewDialog.this._canGoForward = webView.canGoForward();
                Log.d("UniWebView", "Start Loading URL: " + str);
                super.onPageStarted(webView, str, bitmap);
                if (UniWebViewDialog.this._showSpinnerWhenLoading && UniWebViewDialog.this.isShowing()) {
                    UniWebViewDialog.this.showSpinner();
                }
                UniWebViewDialog.this._isLoading = true;
                UniWebViewDialog.this._listener.onPageStarted(UniWebViewDialog.this, str);
                UniWebViewDialog.this.HideSystemUI();
            }

            @Override
            public void onPageFinished(WebView webView, String str) {
                UniWebViewDialog.this._canGoBack = webView.canGoBack();
                UniWebViewDialog.this._canGoForward = webView.canGoForward();
                UniWebViewDialog.this._spinner.hide();
                UniWebViewDialog.this._currentUrl = str;
                UniWebViewDialog uniWebViewDialog = UniWebViewDialog.this;
                uniWebViewDialog._currentUserAgent = uniWebViewDialog._uniWebView.getSettings().getUserAgentString();
                UniWebViewDialog.this._listener.onPageFinished(UniWebViewDialog.this, str);
                UniWebViewDialog.this._isLoading = false;
                UniWebViewDialog.this._uniWebView.setWebViewBackgroundColor(UniWebViewDialog.this._backgroundColor);
                UniWebViewDialog.this.HideSystemUI();
            }

            @Override
            public void onReceivedError(WebView webView, int i, String str, String str2) {
                UniWebViewDialog.this._canGoBack = webView.canGoBack();
                UniWebViewDialog.this._canGoForward = webView.canGoForward();
                UniWebViewDialog.this.HideSystemUI();
                UniWebViewDialog.this._spinner.hide();
                UniWebViewDialog.this._currentUrl = str2;
                UniWebViewDialog uniWebViewDialog = UniWebViewDialog.this;
                uniWebViewDialog._currentUserAgent = uniWebViewDialog._uniWebView.getSettings().getUserAgentString();
                UniWebViewDialog.this._listener.onReceivedError(UniWebViewDialog.this, i, str, str2);
                UniWebViewDialog.this._isLoading = false;
            }

            @Override
            public boolean shouldOverrideUrlLoading(WebView webView, String str) {
                Log.d("UniWebView", "shouldOverrideUrlLoading: " + str);
                return UniWebViewDialog.this._listener.shouldOverrideUrlLoading(UniWebViewDialog.this, str);
            }
        });
        FrameLayout frameLayout = new FrameLayout(getContext());
        frameLayout.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
        addContentView(frameLayout, new ViewGroup.LayoutParams(-1, -1));
        this._uniWebView.setWebChromeClient(new UniWebChromeClient(this._content, frameLayout, null, this._uniWebView) {
            @Override
            public void onPermissionRequest(final PermissionRequest permissionRequest) {
                Log.d("UniWebView", "onPermissionRequest");
                AndroidPlugin.getUnityActivity_().runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        String uri = permissionRequest.getOrigin().toString();
                        Log.d("UniWebView", "Request from url: " + uri);
                        if (UniWebViewDialog.this.trustSites.contains(uri)) {
                            PermissionRequest permissionRequest2 = permissionRequest;
                            permissionRequest2.grant(permissionRequest2.getResources());
                            return;
                        }
                        permissionRequest.deny();
                    }
                });
            }

            @Override
            public boolean onJsAlert(WebView webView, String str, String str2, final JsResult jsResult) {
                AlertDialog.Builder builder = new AlertDialog.Builder(UniWebViewDialog.this.getContext());
                UniWebViewDialog.this._alertDialog = builder.setTitle(str).setMessage(str2).setCancelable(false).setIcon(17301543).setPositiveButton(17039370, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        dialogInterface.dismiss();
                        jsResult.confirm();
                        UniWebViewDialog.this._alertDialog = null;
                    }
                }).create();
                if (Build.VERSION.SDK_INT < 19 || !UniWebViewDialog.this._immersiveMode) {
                    UniWebViewDialog.this._alertDialog.show();
                    return true;
                }
                UniWebViewDialog.this._alertDialog.getWindow().setFlags(8, 8);
                UniWebViewDialog.this._alertDialog.show();
                UniWebViewDialog.this._alertDialog.getWindow().getDecorView().setSystemUiVisibility(UniWebViewDialog.this.getWindow().getDecorView().getSystemUiVisibility());
                UniWebViewDialog.this._alertDialog.getWindow().clearFlags(8);
                return true;
            }

            @Override
            public boolean onJsConfirm(WebView webView, String str, String str2, final JsResult jsResult) {
                AlertDialog.Builder builder = new AlertDialog.Builder(UniWebViewDialog.this.getContext());
                UniWebViewDialog.this._alertDialog = builder.setTitle(str).setMessage(str2).setIcon(17301659).setCancelable(false).setPositiveButton(17039379, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        dialogInterface.dismiss();
                        jsResult.confirm();
                        UniWebViewDialog.this._alertDialog = null;
                    }
                }).setNegativeButton(17039369, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        dialogInterface.dismiss();
                        jsResult.cancel();
                        UniWebViewDialog.this._alertDialog = null;
                    }
                }).show();
                return true;
            }

            @Override
            public boolean onJsPrompt(WebView webView, String str, String str2, String str3, final JsPromptResult jsPromptResult) {
                AlertDialog.Builder builder = new AlertDialog.Builder(UniWebViewDialog.this.getContext());
                builder.setTitle(str).setMessage(str2).setIcon(17301659).setCancelable(false);
                final EditText editText = new EditText(UniWebViewDialog.this.getContext());
                editText.setSingleLine();
                builder.setView(editText);
                builder.setPositiveButton(17039379, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        Editable text = editText.getText();
                        String obj = text != null ? text.toString() : "";
                        dialogInterface.dismiss();
                        jsPromptResult.confirm(obj);
                        UniWebViewDialog.this._alertDialog = null;
                    }
                });
                builder.setNegativeButton(17039369, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        dialogInterface.dismiss();
                        jsPromptResult.cancel();
                        UniWebViewDialog.this._alertDialog = null;
                    }
                });
                UniWebViewDialog.this._alertDialog = builder.show();
                return true;
            }
        });
        this._uniWebView.setDownloadListener(new DownloadListener() {
            @Override
            public void onDownloadStart(String str, String str2, String str3, String str4, long j) {
                Intent intent = new Intent("android.intent.action.VIEW");
                intent.setData(Uri.parse(str));
                AndroidPlugin.getUnityActivity_().startActivity(intent);
            }
        });
        this._uniWebView.setVisibility(0);
        this._uniWebView.addJavascriptInterface(this, "android");
        setBounces(false);
    }

    @JavascriptInterface
    public void onData(String str) {
        Log.d("UniWebView", "receive a call back from js: " + str);
        this._listener.onJavaScriptFinished(this, str);
    }

    public void goBackGround() {
        if (this._isLoading) {
            this._loadingInterrupted = true;
            this._uniWebView.stopLoading();
        }
        AlertDialog alertDialog = this._alertDialog;
        if (alertDialog != null) {
            alertDialog.hide();
        }
        hide();
        if (Build.VERSION.SDK_INT >= 11) {
            this._uniWebView.onPause();
        }
    }

    public void goForeGround() {
        if (!this._manualHide) {
            if (this._loadingInterrupted) {
                this._uniWebView.reload();
                this._loadingInterrupted = false;
            }
            show();
            AlertDialog alertDialog = this._alertDialog;
            if (alertDialog != null) {
                alertDialog.show();
            }
        }
        if (Build.VERSION.SDK_INT >= 11) {
            this._uniWebView.onResume();
        }
    }

    public void setTransparent(boolean z) {
        Log.d("UniWebView", "SetTransparentBackground is already deprecated and there is no guarantee it will work in later versions. You should use SetBackgroundColor instead.");
        if (z) {
            this._backgroundColor = Color.argb(0, 0, 0, 0);
        } else {
            this._backgroundColor = Color.argb(255, 255, 255, 255);
        }
        this._uniWebView.setWebViewBackgroundColor(this._backgroundColor);
    }

    public void setBackgroundColor(float f, float f2, float f3, float f4) {
        int argb = Color.argb((int) (f4 * 255.0f), (int) (f * 255.0f), (int) (f2 * 255.0f), (int) (f3 * 255.0f));
        this._backgroundColor = argb;
        this._uniWebView.setWebViewBackgroundColor(argb);
    }

    public String getUrl() {
        return this._currentUrl;
    }

    public void setBackButtonEnable(boolean z) {
        this._backButtonEnable = z;
    }

    public void setBounces(boolean z) {
        if (Build.VERSION.SDK_INT <= 8) {
            Log.d("UniWebView", "WebView over scroll effect supports after API 9");
        } else if (z) {
            this._uniWebView.setOverScrollMode(0);
        } else {
            this._uniWebView.setOverScrollMode(2);
        }
    }

    public void setZoomEnable(boolean z) {
        this._uniWebView.getSettings().setBuiltInZoomControls(z);
    }

    public void reload() {
        this._uniWebView.reload();
    }

    public void addUrlScheme(String str) {
        if (this.schemes.contains(str)) {
            return;
        }
        this.schemes.add(str);
    }

    public void removeUrlScheme(String str) {
        if (this.schemes.contains(str)) {
            this.schemes.remove(str);
        }
    }

    public void stop() {
        this._uniWebView.stopLoading();
    }

    public void useWideViewPort(boolean z) {
        this._uniWebView.getSettings().setUseWideViewPort(z);
    }

    public void loadWithOverviewMode(boolean z) {
        this._uniWebView.getSettings().setLoadWithOverviewMode(z);
    }

    public String getUserAgent() {
        return this._currentUserAgent;
    }

    public void setAlpha(float f) {
        this.alpha = f;
        if (Build.VERSION.SDK_INT < 11) {
            float f2 = this.alpha;
            AlphaAnimation alphaAnimation = new AlphaAnimation(f2, f2);
            alphaAnimation.setDuration(0L);
            alphaAnimation.setFillAfter(true);
            this._uniWebView.startAnimation(alphaAnimation);
            return;
        }
        this._uniWebView.setAlpha(this.alpha);
    }

    public float getAlpha() {
        return this.alpha;
    }

    public void setImmersiveModeEnabled(boolean z) {
        this._immersiveMode = z;
    }

    public void AddPermissionRequestTrustSite(String str) {
        if (str == null || str.length() == 0) {
            return;
        }
        this.trustSites.add(str);
    }

    public boolean canGoBack() {
        return this._canGoBack;
    }

    public boolean canGoForward() {
        return this._canGoForward;
    }

    public void setPosition(int i, int i2) {
        Window window = getWindow();
        WindowManager.LayoutParams attributes = window.getAttributes();
        attributes.x = i;
        attributes.y = i2;
        window.setAttributes(attributes);
    }

    public void setSize(int i, int i2) {
        if (i < 0 || i2 < 0) {
            Log.d("UniWebView", "The width or height of size is less than 0. Webview will not show. Please check your setting. Input width: " + i + ", input height: " + i2);
            return;
        }
        getWindow().setLayout(i, i2);
    }

    public void animateTo(int i, int i2, float f, float f2, final String str) {
        View childAt = ((ViewGroup) getWindow().getDecorView()).getChildAt(0);
        int i3 = (int) (f * 1000.0f);
        int i4 = (int) (f2 * 1000.0f);
        TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, i, 0.0f, i2);
        translateAnimation.setFillAfter(true);
        translateAnimation.setDuration(i3);
        translateAnimation.setStartOffset(i4);
        childAt.startAnimation(translateAnimation);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                UniWebViewDialog.this._listener.onAnimationFinished(UniWebViewDialog.this, str);
            }
        }, i3 + i4);
    }

    public void setHeaderField(String str, String str2) {
        if (str2 == null || str2.length() == 0) {
            this.headers.remove(str);
        } else if (str == null || str.length() == 0) {
        } else {
            this.headers.put(str, str2);
        }
    }

    public void setVerticalScrollBarShow(boolean z) {
        this._uniWebView.setVerticalScrollBarEnabled(z);
    }

    public void setHorizontalScrollBarShow(boolean z) {
        this._uniWebView.setHorizontalScrollBarEnabled(z);
    }

    public boolean getOpenLinksInExternalBrowser() {
        return this._openLinksInExternalBrowser;
    }

    public void setOpenLinksInExternalBrowser(boolean z) {
        this._openLinksInExternalBrowser = z;
    }
}