package androidx.core.view;

import android.view.View;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.view.animation.PathInterpolator;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public final class h2 extends k2 {

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final PathInterpolator f1761d = new PathInterpolator(0.0f, 1.1f, 0.0f, 1.0f);

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static final l1.a f1762e = new l1.a();

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static final DecelerateInterpolator f1763f = new DecelerateInterpolator();

    public h2(int i10, @Nullable Interpolator interpolator, long j10) {
        super(i10, interpolator, j10);
    }

    public static void e(View view, l2 l2Var) {
        d2 callback = getCallback(view);
        if (callback != null) {
            ((com.google.android.material.bottomsheet.q) callback).f22335c.setTranslationY(0.0f);
            if (callback.f1726b == 0) {
                return;
            }
        }
        if (view instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) view;
            for (int i10 = 0; i10 < viewGroup.getChildCount(); i10++) {
                e(viewGroup.getChildAt(i10), l2Var);
            }
        }
    }

    public static void f(View view, l2 l2Var, WindowInsets windowInsets, boolean z10) {
        d2 callback = getCallback(view);
        if (callback != null) {
            callback.f1725a = windowInsets;
            if (!z10) {
                com.google.android.material.bottomsheet.q qVar = (com.google.android.material.bottomsheet.q) callback;
                View view2 = qVar.f22335c;
                int[] iArr = qVar.f22338f;
                view2.getLocationOnScreen(iArr);
                qVar.f22336d = iArr[1];
                z10 = callback.f1726b == 0;
            }
        }
        if (view instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) view;
            for (int i10 = 0; i10 < viewGroup.getChildCount(); i10++) {
                f(viewGroup.getChildAt(i10), l2Var, windowInsets, z10);
            }
        }
    }

    public static void g(View view, f3 f3Var, List list) {
        d2 callback = getCallback(view);
        if (callback != null) {
            callback.a(f3Var, list);
            if (callback.f1726b == 0) {
                return;
            }
        }
        if (view instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) view;
            for (int i10 = 0; i10 < viewGroup.getChildCount(); i10++) {
                g(viewGroup.getChildAt(i10), f3Var, list);
            }
        }
    }

    @Nullable
    public static d2 getCallback(View view) {
        Object tag = view.getTag(e0.e.tag_window_insets_animation_callback);
        if (tag instanceof g2) {
            return ((g2) tag).f1754a;
        }
        return null;
    }

    public static void h(View view, l2 l2Var, fe.h hVar) {
        d2 callback = getCallback(view);
        if (callback != null) {
            com.google.android.material.bottomsheet.q qVar = (com.google.android.material.bottomsheet.q) callback;
            View view2 = qVar.f22335c;
            int[] iArr = qVar.f22338f;
            view2.getLocationOnScreen(iArr);
            int i10 = qVar.f22336d - iArr[1];
            qVar.f22337e = i10;
            view2.setTranslationY(i10);
            if (callback.f1726b == 0) {
                return;
            }
        }
        if (view instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) view;
            for (int i11 = 0; i11 < viewGroup.getChildCount(); i11++) {
                h(viewGroup.getChildAt(i11), l2Var, hVar);
            }
        }
    }

    public static WindowInsets i(View view, WindowInsets windowInsets) {
        return view.getTag(e0.e.tag_on_apply_window_listener) != null ? windowInsets : view.onApplyWindowInsets(windowInsets);
    }

    public static void setCallback(@NonNull View view, @Nullable d2 d2Var) {
        Object tag = view.getTag(e0.e.tag_on_apply_window_listener);
        if (d2Var == null) {
            view.setTag(e0.e.tag_window_insets_animation_callback, null);
            if (tag == null) {
                view.setOnApplyWindowInsetsListener(null);
                return;
            }
            return;
        }
        View.OnApplyWindowInsetsListener g2Var = new g2(view, d2Var);
        view.setTag(e0.e.tag_window_insets_animation_callback, g2Var);
        if (tag == null) {
            view.setOnApplyWindowInsetsListener(g2Var);
        }
    }
}
