package com.ss.android.ugc.aweme.ecommerce.widget.regionpicker.adapter;

import X.0CB;
import X.0CH;
import X.0FB;
import X.3Ct;
import X.5An;
import X.6Is;
import X.BJ3;
import X.BTH;
import X.C3401BIv;
import X.C3402BIw;
import X.C3403BIx;
import X.C3404BIy;
import X.C3X;
import X.C3Y;
import X.C3Z;
import X.C5538C3a;
import X.Crj;
import X.DV0;
import X.DrK;
import X.DrS;
import X.J8H;
import X.LsD;
import X.M12;
import X.Qeg;
import android.view.View;
import android.widget.RadioButton;
import android.widget.TextView;
import com.bytedance.covode.number.Covode;
import com.bytedance.jedi.ext.adapter.JediSimpleViewHolder;
import com.bytedance.jedi.ext.adapter.JediViewHolder;
import com.ss.android.ugc.aweme.ecommerce.widget.regionpicker.model.District;
import com.ss.android.ugc.aweme.ecommerce.widget.regionpicker.viewmodel.DistrictPickerViewModel;
import java.util.Objects;
import kotlin.h.b.n;

public final class RegionAdapter extends DrS<Object> {
    public final 0CH LIZLLL;

    static {
        Covode.recordClassIndex(72918);
    }

    public final class DistrictViewHolder extends JediSimpleViewHolder<District> implements 6Is {
        public final /* synthetic */ RegionAdapter LJFF;
        public final Crj LJI;

        static {
            Covode.recordClassIndex(72919);
        }

        public final DistrictPickerViewModel LJIIL() {
            return (DistrictPickerViewModel) this.LJI.getValue();
        }

        public final void onStateChanged(0CH r1, 0CB r2) {
            super.onStateChanged(r1, r2);
        }

        public final void LJ() {
            RegionAdapter.super.LJ();
            View view = this.itemView;
            View view2 = this.itemView;
            n.LIZIZ(view2, "");
            view.setBackground(3Ct.LIZLLL(view2.getContext()));
        }

        /* JADX WARNING: type inference failed for: r0v15, types: [X.BIx, android.view.View$OnClickListener] */
        public final /* synthetic */ void LIZ(Object obj) {
            int i;
            District district = (District) obj;
            M12.LIZ(district);
            BJ3 bj3 = BTH.LIZLLL;
            View view = this.itemView;
            n.LIZIZ(view, "");
            boolean z = true;
            int i2 = 0;
            if (this.LJIIIIZZ == this.LJFF.getItemCount() - 1) {
                z = false;
            }
            bj3.LIZ(view, z);
            withState(LJIIL(), new C3402BIw(this, district));
            View view2 = this.itemView;
            n.LIZIZ(view2, "");
            RadioButton radioButton = (RadioButton) view2.findViewById(2131369230);
            n.LIZIZ(radioButton, "");
            if (LJIIL().LIZJ()) {
                i = 8;
            } else {
                i = 0;
            }
            radioButton.setVisibility(i);
            View view3 = this.itemView;
            n.LIZIZ(view3, "");
            J8H findViewById = view3.findViewById(2131365151);
            n.LIZIZ(findViewById, "");
            if (!LJIIL().LIZJ()) {
                i2 = 8;
            }
            findViewById.setVisibility(i2);
            View view4 = this.itemView;
            n.LIZIZ(view4, "");
            Qeg findViewById2 = view4.findViewById(2131366765);
            n.LIZIZ(findViewById2, "");
            findViewById2.setText(district.LIZLLL);
            View view5 = this.itemView;
            n.LIZIZ(view5, "");
            view5.setOnClickListener(new C3403BIx(this, district));
            DV0.LIZ(this, LJIIL(), C3404BIy.LIZ, new C3401BIv(district));
        }

        /* JADX WARNING: Illegal instructions before constructor call */
        /* Code decompiled incorrectly, please refer to instructions dump. */
        public DistrictViewHolder(com.ss.android.ugc.aweme.ecommerce.widget.regionpicker.adapter.RegionAdapter r4, android.view.ViewGroup r5) {
            /*
                r3 = this;
                X.M12.LIZ(r5)
                r3.LJFF = r4
                android.content.Context r0 = r5.getContext()
                android.view.LayoutInflater r2 = android.view.LayoutInflater.from(r0)
                r1 = 2131559038(0x7f0d027e, float:1.8743409E38)
                r0 = 0
                android.view.View r1 = X.0HH.LIZ(r2, r1, r5, r0)
                java.lang.String r0 = ""
                kotlin.h.b.n.LIZIZ(r1, r0)
                r3.<init>(r1)
                java.lang.Class<com.ss.android.ugc.aweme.ecommerce.widget.regionpicker.viewmodel.DistrictPickerViewModel> r1 = com.ss.android.ugc.aweme.ecommerce.widget.regionpicker.viewmodel.DistrictPickerViewModel.class
                X.KEN r0 = X.KEM.LIZ
                X.D1G r1 = r0.LIZ(r1)
                X.BIj r0 = new X.BIj
                r0.<init>(r3, r1, r1)
                X.Crj r0 = X.7he.LIZ(r0)
                r3.LJI = r0
                return
            */
            throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.ecommerce.widget.regionpicker.adapter.RegionAdapter.DistrictViewHolder.<init>(com.ss.android.ugc.aweme.ecommerce.widget.regionpicker.adapter.RegionAdapter, android.view.ViewGroup):void");
        }
    }

    public final class IndicatorViewHolder extends JediSimpleViewHolder<String> implements 6Is {
        public final /* synthetic */ RegionAdapter LJFF;

        static {
            Covode.recordClassIndex(72924);
        }

        public final void onStateChanged(0CH r1, 0CB r2) {
            super.onStateChanged(r1, r2);
        }

        public final void LJ() {
            RegionAdapter.super.LJ();
            BJ3 bj3 = BTH.LIZLLL;
            View view = this.itemView;
            n.LIZIZ(view, "");
            bj3.LIZ(view, false);
        }

        public final /* synthetic */ void LIZ(Object obj) {
            String str = (String) obj;
            M12.LIZ(str);
            View view = this.itemView;
            Objects.requireNonNull(view, "null cannot be cast to non-null type android.widget.TextView");
            ((TextView) view).setText(str);
        }

        /* JADX WARNING: Illegal instructions before constructor call */
        /* Code decompiled incorrectly, please refer to instructions dump. */
        public IndicatorViewHolder(com.ss.android.ugc.aweme.ecommerce.widget.regionpicker.adapter.RegionAdapter r4, android.view.ViewGroup r5) {
            /*
                r3 = this;
                X.M12.LIZ(r5)
                r3.LJFF = r4
                android.content.Context r0 = r5.getContext()
                android.view.LayoutInflater r2 = android.view.LayoutInflater.from(r0)
                r1 = 2131559037(0x7f0d027d, float:1.8743407E38)
                r0 = 0
                android.view.View r1 = X.0HH.LIZ(r2, r1, r5, r0)
                java.lang.String r0 = ""
                kotlin.h.b.n.LIZIZ(r1, r0)
                r3.<init>(r1)
                return
            */
            throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.ecommerce.widget.regionpicker.adapter.RegionAdapter.IndicatorViewHolder.<init>(com.ss.android.ugc.aweme.ecommerce.widget.regionpicker.adapter.RegionAdapter, android.view.ViewGroup):void");
        }
    }

    public final int getBasicItemViewType(int i) {
        return this.LIZ.LIZIZ(i);
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public RegionAdapter(0CH r3) {
        super(r3, (0FB) null, 6);
        M12.LIZ(r3);
        this.LIZLLL = r3;
    }

    public final void LIZ(DrK<JediViewHolder<? extends 5An, ?>> drK) {
        M12.LIZ(drK);
        DrK unused = drK.LIZ(new C3Z(this), (LsD) null, new C3X(this));
        DrK unused2 = drK.LIZ(new C3Y(this), (LsD) null, new C5538C3a(this));
    }
}
