package o;

import android.animation.ObjectAnimator;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewPropertyAnimator;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.Toast;
import com.google.android.gms.common.R;
import ir.devixor.app.activity.WebViewActivity;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final /* synthetic */ class Tk0 implements Runnable {
    public final /* synthetic */ int l;
    public final /* synthetic */ WebViewActivity m;

    public /* synthetic */ Tk0(WebViewActivity webViewActivity, int i) {
        this.l = i;
        this.m = webViewActivity;
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // java.lang.Runnable
    public final void run() {
        ViewPropertyAnimator viewPropertyAnimatorAnimate;
        ViewPropertyAnimator viewPropertyAnimatorAlpha;
        ViewPropertyAnimator viewPropertyAnimatorTranslationY;
        ViewPropertyAnimator duration;
        ViewPropertyAnimator interpolator;
        int i = this.l;
        Object[] objArr = 0;
        WebViewActivity webViewActivity = this.m;
        switch (i) {
            case 0:
                WebView webView = webViewActivity.m;
                if (webView == null) {
                    webView = null;
                }
                if (!F3.c(webView.getUrl(), "about:blank")) {
                    WebView webView2 = webViewActivity.m;
                    if (webView2 == null) {
                        webView2 = null;
                    }
                    webView2.loadUrl("about:blank");
                }
                LayoutInflater layoutInflater = webViewActivity.getLayoutInflater();
                FrameLayout frameLayout = webViewActivity.f33o;
                if (frameLayout == null) {
                    frameLayout = null;
                }
                View viewInflate = layoutInflater.inflate(R.layout.layout_no_internet, (ViewGroup) frameLayout, false);
                ImageView imageView = (ImageView) viewInflate.findViewById(R.id.iconNoInternet);
                Button button = (Button) viewInflate.findViewById(R.id.btnRetry);
                ObjectAnimator objectAnimatorOfFloat = ObjectAnimator.ofFloat(imageView, "alpha", 0.3f, 1.0f);
                objectAnimatorOfFloat.setDuration(1500L);
                objectAnimatorOfFloat.setRepeatCount(-1);
                objectAnimatorOfFloat.setRepeatMode(2);
                objectAnimatorOfFloat.setInterpolator(new AccelerateDecelerateInterpolator());
                objectAnimatorOfFloat.start();
                button.setOnClickListener(new ViewOnClickListenerC0604Xh(5, webViewActivity));
                viewInflate.setAlpha(0.0f);
                viewInflate.setTranslationY(300.0f);
                webViewActivity.p = viewInflate;
                FrameLayout frameLayout2 = webViewActivity.f33o;
                (frameLayout2 != null ? frameLayout2 : null).addView(viewInflate);
                View view = webViewActivity.p;
                if (view != null && (viewPropertyAnimatorAnimate = view.animate()) != null && (viewPropertyAnimatorAlpha = viewPropertyAnimatorAnimate.alpha(1.0f)) != null && (viewPropertyAnimatorTranslationY = viewPropertyAnimatorAlpha.translationY(0.0f)) != null && (duration = viewPropertyAnimatorTranslationY.setDuration(400L)) != null && (interpolator = duration.setInterpolator(new AccelerateDecelerateInterpolator())) != null) {
                    interpolator.start();
                    break;
                }
                break;
            case 1:
                FrameLayout frameLayout3 = webViewActivity.f33o;
                if (frameLayout3 == null) {
                    frameLayout3 = null;
                }
                frameLayout3.removeView(webViewActivity.p);
                webViewActivity.p = null;
                break;
            case 2:
                if (!webViewActivity.isFinishing() && !webViewActivity.isDestroyed() && webViewActivity.p != null) {
                    Toast.makeText(webViewActivity, "اینترنت وصل شد", 0).show();
                    webViewActivity.g();
                    WebView webView3 = webViewActivity.m;
                    if (webView3 == null) {
                        webView3 = null;
                    }
                    webView3.clearHistory();
                    WebView webView4 = webViewActivity.m;
                    if (webView4 == null) {
                        webView4 = null;
                    }
                    webView4.clearCache(true);
                    AbstractC1692kh0.C(AbstractC0662Zn.w(webViewActivity), null, new Uk0(webViewActivity, objArr == true ? 1 : 0, 3), 3);
                    break;
                }
                break;
            default:
                if (!webViewActivity.isFinishing() && !webViewActivity.isDestroyed()) {
                    Toast.makeText(webViewActivity, "اتصال اینترنت قطع شد", 0).show();
                    WebView webView5 = webViewActivity.m;
                    if (webView5 != null) {
                        webView5.stopLoading();
                        webViewActivity.k();
                        break;
                    }
                }
                break;
        }
    }
}
