package defpackage;

import android.animation.ValueAnimator;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.media3.container.NalUnitUtil;
import androidx.media3.exoplayer.upstream.CmcdData;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.imageview.ShapeableImageView;
import com.strmr.ps.R;
import com.strmr.ps.data.local.entity.ContentImageOverrideEntity;
import com.strmr.ps.data.local.entity.PlayerSettings;
import com.strmr.ps.data.model.tmdb.TMDBLogo;
import java.util.ArrayList;
import kotlin.Metadata;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0018\u00002\f\u0012\b\u0012\u00060\u0002R\u00020\u00000\u0001:\u0001\u0003¨\u0006\u0004"}, d2 = {"Lbi4;", "Landroidx/recyclerview/widget/RecyclerView$g;", "Lbi4$a;", CmcdData.OBJECT_TYPE_AUDIO_ONLY, "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
public final class bi4 extends RecyclerView.g<a> {
    public final ArrayList a;
    public final co b;
    public final int c;
    public final int d;
    public final String e;

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\b\u0086\u0004\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lbi4$a;", "Landroidx/recyclerview/widget/RecyclerView$ag;", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public final class a extends RecyclerView.ag {
        public static final /* synthetic */ int d = 0;
        public final ShapeableImageView a;
        public ValueAnimator b;

        public a(View view, ShapeableImageView shapeableImageView) {
            super(view);
            this.a = shapeableImageView;
        }
    }

    public bi4(ArrayList arrayList, String str, co coVar) {
        cr4.g(str, "imageType");
        this.a = arrayList;
        this.b = coVar;
        boolean zEquals = str.equals(ContentImageOverrideEntity.TYPE_POSTER);
        this.c = zEquals ? PlayerSettings.SKIP_DURATION_120S : 220;
        this.d = zEquals ? 180 : 124;
        this.e = zEquals ? "w185" : "w500";
    }

    @Override // androidx.recyclerview.widget.RecyclerView.g
    public final int getItemCount() {
        return this.a.size();
    }

    @Override // androidx.recyclerview.widget.RecyclerView.g
    public final void onBindViewHolder(RecyclerView.ag agVar, int i) {
        a aVar = (a) agVar;
        cr4.g(aVar, "holder");
        TMDBLogo tMDBLogo = (TMDBLogo) this.a.get(i);
        bi4 bi4Var = bi4.this;
        ShapeableImageView shapeableImageView = aVar.a;
        cr4.g(tMDBLogo, "logo");
        String filePath = tMDBLogo.getFilePath();
        if (filePath == null || n89.ab(filePath)) {
            shapeableImageView.setImageDrawable(null);
            return;
        }
        ((l08) com.bumptech.glide.a.f(shapeableImageView.getContext()).n(vw2.ab("https://image.tmdb.org/t/p/", bi4Var.e, filePath)).e(dc2.a)).ah(shapeableImageView);
        shapeableImageView.setOnClickListener(new rb5(bi4Var, tMDBLogo, 9));
        shapeableImageView.setOnFocusChangeListener(new fb(aVar, 4));
    }

    @Override // androidx.recyclerview.widget.RecyclerView.g
    public final RecyclerView.ag onCreateViewHolder(ViewGroup viewGroup, int i) {
        View viewD = n41.d(viewGroup, "parent", R.layout.item_image_picker, viewGroup, false);
        ShapeableImageView shapeableImageView = (ShapeableImageView) viewD.findViewById(R.id.picker_image);
        float f = viewGroup.getResources().getDisplayMetrics().density;
        ViewGroup.LayoutParams layoutParams = shapeableImageView.getLayoutParams();
        cr4.e(layoutParams, "null cannot be cast to non-null type android.widget.FrameLayout.LayoutParams");
        FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) layoutParams;
        layoutParams2.width = (int) (this.c * f);
        layoutParams2.height = (int) (this.d * f);
        shapeableImageView.setLayoutParams(layoutParams2);
        return new a(viewD, shapeableImageView);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.g
    public final void onViewRecycled(RecyclerView.ag agVar) {
        a aVar = (a) agVar;
        cr4.g(aVar, "holder");
        ShapeableImageView shapeableImageView = aVar.a;
        com.bumptech.glide.a.f(shapeableImageView.getContext()).k(shapeableImageView);
    }
}
