package mf;

import android.R;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.fragment.app.FragmentActivity;
import ie.x2;
import java.util.ArrayList;
import java.util.Map;
import xyz.stream.view.OnItemListener;
import xyz.stream.view.SingleTypeAdapter;

/* JADX INFO: loaded from: classes3.dex */
public final class l extends SingleTypeAdapter {

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public Map f30693c;

    public l(ArrayList arrayList, FragmentActivity fragmentActivity) {
        super(arrayList, fragmentActivity);
        this.f30692b = 0;
    }

    public static void e(l lVar, int i10, x2 x2Var, View view, boolean z10) {
        if (!z10) {
            lVar.getClass();
            x2Var.f27675a.setBackgroundResource(R.color.transparent);
            Activity activity = lVar.context;
            int i11 = lVar.f30692b == i10 ? org.drive_hunter.R.color.white : org.drive_hunter.R.color.color_write_80;
            Object obj = g0.d.f26125a;
            int color = activity.getColor(i11);
            TextView textView = x2Var.f27676b;
            textView.setTextColor(color);
            textView.setTypeface(null, lVar.f30692b == i10 ? 1 : 0);
            return;
        }
        OnItemListener onItemListener = lVar.onItemListener;
        if (onItemListener != null) {
            onItemListener.onItemFocus(view, i10);
        }
        x2Var.f27675a.setBackgroundResource(org.drive_hunter.R.drawable.shape_category_focus);
        Activity activity2 = lVar.context;
        Object obj2 = g0.d.f26125a;
        int color2 = activity2.getColor(org.drive_hunter.R.color.black);
        TextView textView2 = x2Var.f27676b;
        textView2.setTextColor(color2);
        textView2.setTypeface(null, lVar.f30692b == i10 ? 1 : 0);
    }

    @Override // xyz.stream.view.SingleTypeAdapter
    public final v3.a createBinding(ViewGroup viewGroup) {
        return x2.inflate(LayoutInflater.from(this.context), viewGroup, false);
    }

    @Override // xyz.stream.view.SingleTypeAdapter
    public final void onBindData(v3.a aVar, Object obj, int i10) {
        x2 x2Var = (x2) aVar;
        String str = (String) obj;
        if (str == null) {
            return;
        }
        TextView textView = x2Var.f27676b;
        Map map = this.f30693c;
        if (map != null && map.containsKey(str)) {
            str = (String) this.f30693c.get(str);
        }
        textView.setText(str);
        FrameLayout frameLayout = x2Var.f27675a;
        boolean zIsFocused = frameLayout.isFocused();
        TextView textView2 = x2Var.f27676b;
        if (zIsFocused) {
            frameLayout.setBackgroundResource(org.drive_hunter.R.drawable.shape_category_focus);
            Activity activity = this.context;
            Object obj2 = g0.d.f26125a;
            textView2.setTextColor(activity.getColor(org.drive_hunter.R.color.black));
        } else {
            frameLayout.setBackgroundResource(R.color.transparent);
            Activity activity2 = this.context;
            int i11 = this.f30692b == i10 ? org.drive_hunter.R.color.white : org.drive_hunter.R.color.color_write_80;
            Object obj3 = g0.d.f26125a;
            textView2.setTextColor(activity2.getColor(i11));
        }
        textView2.setTypeface(null, this.f30692b == i10 ? 1 : 0);
        frameLayout.setOnFocusChangeListener(new oe.h(this, i10, x2Var, 20));
    }

    public final void setSelectedPosition(int i10) {
        int i11 = this.f30692b;
        this.f30692b = i10;
        if (i11 >= 0 && i11 < this.dataList.size()) {
            notifyItemChanged(i11);
        }
        if (i10 < 0 || i10 >= this.dataList.size()) {
            return;
        }
        notifyItemChanged(i10);
    }
}
