package y3;

import M.AbstractC0195z;
import M.B;
import M.J;
import W2.g;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import com.martsnew.tv.R;
import h3.AbstractC1031a;
import java.lang.reflect.Field;
import s3.k;

/* JADX INFO: loaded from: classes.dex */
public abstract class d extends FrameLayout {

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public static final c f18978v = new c();

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public int f18979q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final float f18980r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final float f18981s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public ColorStateList f18982t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public PorterDuff.Mode f18983u;

    public d(Context context, AttributeSet attributeSet) {
        super(A3.a.a(context, attributeSet, 0, 0), attributeSet);
        Context context2 = getContext();
        TypedArray typedArrayObtainStyledAttributes = context2.obtainStyledAttributes(attributeSet, AbstractC1031a.f13416w);
        if (typedArrayObtainStyledAttributes.hasValue(6)) {
            float dimensionPixelSize = typedArrayObtainStyledAttributes.getDimensionPixelSize(6, 0);
            Field field = J.f4065a;
            B.j(this, dimensionPixelSize);
        }
        this.f18979q = typedArrayObtainStyledAttributes.getInt(2, 0);
        this.f18980r = typedArrayObtainStyledAttributes.getFloat(3, 1.0f);
        setBackgroundTintList(s7.d.q(context2, typedArrayObtainStyledAttributes, 4));
        setBackgroundTintMode(k.f(typedArrayObtainStyledAttributes.getInt(5, -1), PorterDuff.Mode.SRC_IN));
        this.f18981s = typedArrayObtainStyledAttributes.getFloat(1, 1.0f);
        typedArrayObtainStyledAttributes.recycle();
        setOnTouchListener(f18978v);
        setFocusable(true);
        if (getBackground() == null) {
            float dimension = getResources().getDimension(R.dimen.mtrl_snackbar_background_corner_radius);
            GradientDrawable gradientDrawable = new GradientDrawable();
            gradientDrawable.setShape(0);
            gradientDrawable.setCornerRadius(dimension);
            gradientDrawable.setColor(g.z(getBackgroundOverlayColorAlpha(), g.s(this, R.attr.colorSurface), g.s(this, R.attr.colorOnSurface)));
            ColorStateList colorStateList = this.f18982t;
            if (colorStateList != null) {
                gradientDrawable.setTintList(colorStateList);
            }
            Field field2 = J.f4065a;
            setBackground(gradientDrawable);
        }
    }

    public float getActionTextColorAlpha() {
        return this.f18981s;
    }

    public int getAnimationMode() {
        return this.f18979q;
    }

    public float getBackgroundOverlayColorAlpha() {
        return this.f18980r;
    }

    @Override // android.view.ViewGroup, android.view.View
    public final void onAttachedToWindow() {
        super.onAttachedToWindow();
        Field field = J.f4065a;
        AbstractC0195z.c(this);
    }

    @Override // android.view.ViewGroup, android.view.View
    public final void onDetachedFromWindow() {
        super.onDetachedFromWindow();
    }

    @Override // android.widget.FrameLayout, android.view.ViewGroup, android.view.View
    public final void onLayout(boolean z8, int i, int i5, int i8, int i9) {
        super.onLayout(z8, i, i5, i8, i9);
    }

    public void setAnimationMode(int i) {
        this.f18979q = i;
    }

    @Override // android.view.View
    public void setBackground(Drawable drawable) {
        setBackgroundDrawable(drawable);
    }

    @Override // android.view.View
    public void setBackgroundDrawable(Drawable drawable) {
        if (drawable != null && this.f18982t != null) {
            drawable = drawable.mutate();
            drawable.setTintList(this.f18982t);
            drawable.setTintMode(this.f18983u);
        }
        super.setBackgroundDrawable(drawable);
    }

    @Override // android.view.View
    public void setBackgroundTintList(ColorStateList colorStateList) {
        this.f18982t = colorStateList;
        if (getBackground() != null) {
            Drawable drawableMutate = getBackground().mutate();
            drawableMutate.setTintList(colorStateList);
            drawableMutate.setTintMode(this.f18983u);
            if (drawableMutate != getBackground()) {
                super.setBackgroundDrawable(drawableMutate);
            }
        }
    }

    @Override // android.view.View
    public void setBackgroundTintMode(PorterDuff.Mode mode) {
        this.f18983u = mode;
        if (getBackground() != null) {
            Drawable drawableMutate = getBackground().mutate();
            drawableMutate.setTintMode(mode);
            if (drawableMutate != getBackground()) {
                super.setBackgroundDrawable(drawableMutate);
            }
        }
    }

    @Override // android.view.View
    public void setOnClickListener(View.OnClickListener onClickListener) {
        setOnTouchListener(onClickListener != null ? null : f18978v);
        super.setOnClickListener(onClickListener);
    }

    public void setOnAttachStateChangeListener(InterfaceC1754a interfaceC1754a) {
    }

    public void setOnLayoutChangeListener(b bVar) {
    }
}
