package com.ifpdos.autotest;

import android.content.Context;
import android.graphics.Color;
import android.net.NetworkInfo;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;

/* JADX INFO: compiled from: WifiInfoAdapter.java */
/* JADX INFO: loaded from: classes.dex */
public class i0 extends BaseAdapter {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final int f1989c = Color.parseColor("#1285CA");

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private List<com.ifpdos.autotest.p0.b.f> f1990d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private Context f1991e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private LayoutInflater f1992f;

    /* JADX INFO: compiled from: WifiInfoAdapter.java */
    static class a {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        ImageView f1993a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        ImageView f1994b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        TextView f1995c;

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        TextView f1996d;

        a() {
        }
    }

    public i0(Context context, List<com.ifpdos.autotest.p0.b.f> list) {
        this.f1991e = context;
        this.f1990d = list;
        this.f1992f = LayoutInflater.from(context);
    }

    private String a(com.ifpdos.autotest.p0.b.f fVar) {
        NetworkInfo networkInfoD = fVar.d();
        return networkInfoD != null ? networkInfoD.getDetailedState() == NetworkInfo.DetailedState.FAILED ? networkInfoD.getReason() : "已连接" : fVar.c() == -1 ? "" : "已保存";
    }

    public void b(List<com.ifpdos.autotest.p0.b.f> list) {
        this.f1990d = list;
        notifyDataSetChanged();
    }

    @Override // android.widget.Adapter
    public int getCount() {
        return this.f1990d.size();
    }

    @Override // android.widget.Adapter
    public Object getItem(int i) {
        return this.f1990d.get(i);
    }

    @Override // android.widget.Adapter
    public long getItemId(int i) {
        return i;
    }

    @Override // android.widget.Adapter
    public View getView(int i, View view, ViewGroup viewGroup) {
        View viewInflate;
        a aVar;
        if (view == null) {
            aVar = new a();
            viewInflate = this.f1992f.inflate(R.layout.item_wifi_list, viewGroup, false);
            aVar.f1995c = (TextView) viewInflate.findViewById(R.id.wifi_ssid);
            aVar.f1993a = (ImageView) viewInflate.findViewById(R.id.signal);
            aVar.f1994b = (ImageView) viewInflate.findViewById(R.id.lock);
            aVar.f1996d = (TextView) viewInflate.findViewById(R.id.wifi_state);
            viewInflate.setTag(aVar);
        } else {
            viewInflate = view;
            aVar = (a) view.getTag();
        }
        com.ifpdos.autotest.p0.b.f fVar = this.f1990d.get(i);
        aVar.f1994b.setImageResource(fVar.g() == com.ifpdos.autotest.p0.b.c.NONE ? R.drawable.ic_unlock : R.drawable.ic_lock);
        aVar.f1993a.setImageLevel(fVar.f(5));
        aVar.f1995c.setText(fVar.h());
        NetworkInfo networkInfoD = fVar.d();
        aVar.f1995c.setTextColor((networkInfoD == null || networkInfoD.getDetailedState() != NetworkInfo.DetailedState.CONNECTED) ? -1 : f1989c);
        aVar.f1996d.setText(a(fVar));
        return viewInflate;
    }
}
