package com.google.android.tv.ads.controls;

import aa.e;
import aa.f;
import aa.g;
import aa.h;
import android.animation.AnimatorInflater;
import android.animation.AnimatorSet;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.e0;
import androidx.fragment.app.s0;
import ba.b;
import com.bumptech.glide.c;
import com.bumptech.glide.r;
import com.google.android.gms.internal.atv_ads_framework.o;
import com.google.android.tv.ads.controls.SideDrawerFragment;
import j5.l;
import j5.s;

/* JADX INFO: loaded from: classes2.dex */
public final class SideDrawerFragment extends e0 {
    public static final /* synthetic */ int K0 = 0;
    public ConstraintLayout D0;
    public ConstraintLayout E0;
    public ConstraintLayout F0;
    public ImageView G0;
    public Button H0;
    public ConstraintLayout I0;
    public Button J0;

    public SideDrawerFragment() {
        this.f2435y0 = h.fragment_side_drawer;
    }

    @Keep
    public float getBackgroundAlpha() {
        return this.D0.getAlpha();
    }

    @Keep
    public float getDrawerTranslationX() {
        return this.E0.getTranslationX() / this.E0.getWidth();
    }

    @Override // androidx.fragment.app.e0
    @NonNull
    public final View onCreateView(@NonNull LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
        viewGroup.getClass();
        final int i10 = 0;
        View viewInflate = layoutInflater.inflate(h.fragment_side_drawer, viewGroup, false);
        ConstraintLayout constraintLayout = (ConstraintLayout) viewInflate.findViewById(g.side_drawer_base_layout);
        constraintLayout.getClass();
        this.D0 = constraintLayout;
        ConstraintLayout constraintLayout2 = (ConstraintLayout) viewInflate.findViewById(g.side_drawer_frame_layout);
        constraintLayout2.getClass();
        this.E0 = constraintLayout2;
        ConstraintLayout constraintLayout3 = (ConstraintLayout) viewInflate.findViewById(g.why_this_ad_layout);
        constraintLayout3.getClass();
        this.F0 = constraintLayout3;
        ConstraintLayout constraintLayout4 = (ConstraintLayout) viewInflate.findViewById(g.error_message_layout);
        constraintLayout4.getClass();
        this.I0 = constraintLayout4;
        ImageView imageView = (ImageView) viewInflate.findViewById(g.wta_image_view);
        imageView.getClass();
        this.G0 = imageView;
        Button button = (Button) viewInflate.findViewById(g.why_this_ad_back_button);
        button.getClass();
        this.H0 = button;
        Button button2 = (Button) viewInflate.findViewById(g.error_message_back_button);
        button2.getClass();
        this.J0 = button2;
        boolean z10 = requireArguments().getBoolean("render_error_message");
        String string = requireArguments().getString("wta_uri");
        AnimatorSet animatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(requireContext(), e.animator_drawer_in);
        animatorSet.setTarget(this);
        animatorSet.start();
        final AnimatorSet animatorSet2 = (AnimatorSet) AnimatorInflater.loadAnimator(requireContext(), e.animator_drawer_out);
        animatorSet2.setTarget(this);
        animatorSet2.addListener(new l.e(this, 14));
        this.H0.setOnClickListener(new View.OnClickListener() { // from class: ba.a
            @Override // android.view.View.OnClickListener
            public final void onClick(View view) {
                int i11 = i10;
                AnimatorSet animatorSet3 = animatorSet2;
                switch (i11) {
                    case 0:
                        int i12 = SideDrawerFragment.K0;
                        animatorSet3.start();
                        break;
                    default:
                        int i13 = SideDrawerFragment.K0;
                        animatorSet3.start();
                        break;
                }
            }
        });
        final int i11 = 1;
        this.J0.setOnClickListener(new View.OnClickListener() { // from class: ba.a
            @Override // android.view.View.OnClickListener
            public final void onClick(View view) {
                int i112 = i11;
                AnimatorSet animatorSet3 = animatorSet2;
                switch (i112) {
                    case 0:
                        int i12 = SideDrawerFragment.K0;
                        animatorSet3.start();
                        break;
                    default:
                        int i13 = SideDrawerFragment.K0;
                        animatorSet3.start();
                        break;
                }
            }
        });
        requireActivity().getOnBackPressedDispatcher().a(this, new s0(animatorSet2));
        if (z10 || string == null) {
            this.F0.setVisibility(8);
            this.I0.setVisibility(0);
            this.J0.requestFocus();
        } else {
            this.F0.setVisibility(0);
            this.H0.requestFocus();
            String string2 = requireArguments().getString("wta_uri");
            int i12 = com.google.android.gms.internal.atv_ads_framework.g.f19927a;
            if (string2 == null) {
                string2 = "";
            }
            String string3 = requireArguments().getString("wta_alt_text");
            if (!TextUtils.isEmpty(string3)) {
                this.G0.setContentDescription(string3);
            }
            r rVar = (r) c.g(this).load(o.a(string2)).placeholder(getResources().getDrawable(f.placeholder_image, requireContext().getTheme()));
            rVar.getClass();
            ((r) rVar.k(l.f28659a, new s(), true)).into(new b(this, this.G0), null, t5.g.f32964a);
        }
        return viewInflate;
    }

    @Keep
    public void setBackgroundAlpha(float f10) {
        this.D0.setAlpha(f10);
        this.D0.invalidate();
    }

    @Keep
    public void setDrawerTranslationX(float f10) {
        this.E0.setTranslationX(r0.getWidth() * f10);
        this.E0.invalidate();
    }
}
