package defpackage;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.media3.container.NalUnitUtil;
import androidx.media3.exoplayer.upstream.CmcdData;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.materialswitch.MaterialSwitch;
import com.strmr.ps.R;
import com.strmr.ps.data.local.entity.RowConfigEntity;
import com.strmr.ps.data.local.entity.RowConfigExtensionsKt;
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 = {"Li66;", "Landroidx/recyclerview/widget/RecyclerView$g;", "Li66$a;", CmcdData.OBJECT_TYPE_AUDIO_ONLY, "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
public final class i66 extends RecyclerView.g<a> {
    public final z36 a;
    public final z36 b;
    public final z36 c;
    public final z36 d;
    public ArrayList e = new ArrayList();
    public boolean f;

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\b\u0087\u0004\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Li66$a;", "Landroidx/recyclerview/widget/RecyclerView$ag;", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    @SuppressLint({"ClickableViewAccessibility"})
    public final class a extends RecyclerView.ag {
        public static final /* synthetic */ int g = 0;
        public final ImageView a;
        public final TextView b;
        public final TextView c;
        public final MaterialButton d;
        public final MaterialSwitch e;

        public a(View view) {
            super(view);
            View viewFindViewById = view.findViewById(R.id.drag_handle);
            cr4.f(viewFindViewById, "findViewById(...)");
            this.a = (ImageView) viewFindViewById;
            View viewFindViewById2 = view.findViewById(R.id.row_title);
            cr4.f(viewFindViewById2, "findViewById(...)");
            this.b = (TextView) viewFindViewById2;
            View viewFindViewById3 = view.findViewById(R.id.row_type);
            cr4.f(viewFindViewById3, "findViewById(...)");
            this.c = (TextView) viewFindViewById3;
            View viewFindViewById4 = view.findViewById(R.id.btn_orientation);
            cr4.f(viewFindViewById4, "findViewById(...)");
            this.d = (MaterialButton) viewFindViewById4;
            View viewFindViewById5 = view.findViewById(R.id.row_toggle);
            cr4.f(viewFindViewById5, "findViewById(...)");
            this.e = (MaterialSwitch) viewFindViewById5;
        }
    }

    public i66(z36 z36Var, z36 z36Var2, z36 z36Var3, z36 z36Var4) {
        this.a = z36Var;
        this.b = z36Var2;
        this.c = z36Var3;
        this.d = z36Var4;
    }

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

    @Override // androidx.recyclerview.widget.RecyclerView.g
    public final void onBindViewHolder(RecyclerView.ag agVar, int i) {
        a aVar = (a) agVar;
        cr4.g(aVar, "holder");
        RowConfigEntity rowConfigEntity = (RowConfigEntity) this.e.get(i);
        Integer numValueOf = Integer.valueOf(R.drawable.ic_portrait);
        TextView textView = aVar.c;
        MaterialSwitch materialSwitch = aVar.e;
        i66 i66Var = i66.this;
        MaterialButton materialButton = aVar.d;
        cr4.g(rowConfigEntity, "row");
        TextView textView2 = aVar.b;
        Context context = aVar.itemView.getContext();
        cr4.f(context, "getContext(...)");
        textView2.setText(RowConfigExtensionsKt.resolveTitle(rowConfigEntity, context));
        if (cr4.b(rowConfigEntity.getPresentation(), "calendar")) {
            textView.setText("Calendar");
            materialButton.setVisibility(8);
        } else {
            materialButton.setVisibility(0);
            String presentation = rowConfigEntity.getPresentation();
            q07 q07Var = (!cr4.b(presentation, "portrait") && cr4.b(presentation, "landscape")) ? new q07("Landscape", Integer.valueOf(R.drawable.ic_landscape)) : new q07("Portrait", numValueOf);
            String str = (String) q07Var.a;
            int iIntValue = ((Number) q07Var.b).intValue();
            textView.setText(str);
            materialButton.setIconResource(iIntValue);
            materialButton.setOnClickListener(new rb5(i66Var, rowConfigEntity, 21));
        }
        materialSwitch.setOnCheckedChangeListener(null);
        materialSwitch.setChecked(rowConfigEntity.getEnabled());
        materialSwitch.setOnCheckedChangeListener(new td(i66Var, rowConfigEntity, 2));
        aVar.a.setOnTouchListener(new gy5(i66Var, aVar, 2));
        aVar.itemView.setAlpha(rowConfigEntity.getEnabled() ? 1.0f : 0.5f);
        aVar.itemView.setOnLongClickListener(new dv1(rowConfigEntity, i66Var, 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_mobile_row_config, viewGroup, false);
        cr4.d(viewD);
        return new a(viewD);
    }
}
