package epson.print.widgets;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AlphabetIndexer;
import android.widget.TextView;
import epson.print.R;
import epson.print.EPPrinterInfo;
import epson.print.EPPrinterManager;
import epson.print.MyPrinter;
import java.util.ArrayList;
import java.util.Vector;

public class PrinterInfoIpBuilder extends AbstractListBuilder {
    private static final int ACTIVE = 2;

    /* renamed from: IP */
    private static final int f410IP = 1;
    private static final int NAME = 0;
    public static final int PRINTER = 0;
    public static final int SCANNER = 1;
    private int kind;
    private ArrayList<EPPrinterInfo> printerList;
    private EPPrinterManager printerManager;
    String selectedKey;

    public void addPrinter(String[] strArr) {
    }

    public AlphabetIndexer getIndexer() {
        return null;
    }

    protected void notifyDataChange() {
    }

    public PrinterInfoIpBuilder(Context context, ViewGroup viewGroup, int i) {
        super(context, viewGroup);
        this.printerManager = null;
        this.printerList = null;
        this.kind = 0;
        this.selectedKey = null;
        this.printerManager = new EPPrinterManager(this.mContext);
        this.kind = i;
    }

    protected void buildData() {
        this.mData.clear();
        this.printerList = this.printerManager.getIpPrinterList();
        for (int i = 0; i < this.printerList.size(); i++) {
            EPPrinterInfo ePPrinterInfo = this.printerList.get(i);
            MyPrinter myPrinter = new MyPrinter(ePPrinterInfo.printerName, ePPrinterInfo.printerIP, ePPrinterInfo.printerID, ePPrinterInfo.printerSerialNo, ePPrinterInfo.printerEmailAddress, 3);
            myPrinter.setScannerId(ePPrinterInfo.scannerID);
            this.mData.add(myPrinter);
        }
        this.mAdapter.notifyDataSetChanged();
    }

    public View buildViewHolder() {
        return this.mLayoutInflater.inflate(R.layout.printer_item, (ViewGroup) null);
    }

    public Vector<View> buildViewHolderContent(View view) {
        Vector<View> vector = new Vector<>();
        vector.add(view.findViewById(R.id.name));
        vector.add(view.findViewById(R.id.f336ip));
        vector.add(view.findViewById(R.id.active_icon));
        return vector;
    }

    public void buildViewHolderContentData(int i, Vector<View> vector, Vector<Object> vector2) {
        int i2 = 0;
        ((TextView) vector.elementAt(0)).setText(((MyPrinter) vector2.elementAt(i)).getUserDefName(this.mContext));
        int i3 = 8;
        if (this.kind != 1) {
            View elementAt = vector.elementAt(2);
            if (!((MyPrinter) vector2.elementAt(i)).getPrinterId().equals(this.selectedKey)) {
                i2 = 8;
            }
            elementAt.setVisibility(i2);
        } else {
            String scannerId = ((MyPrinter) vector2.elementAt(i)).getScannerId();
            if (scannerId != null) {
                View elementAt2 = vector.elementAt(2);
                if (scannerId.equals(this.selectedKey)) {
                    i3 = 0;
                }
                elementAt2.setVisibility(i3);
                ((TextView) vector.elementAt(0)).setTextColor(this.mContext.getResources().getColor(R.color.all_black));
            } else {
                vector.elementAt(2).setVisibility(8);
                ((TextView) vector.elementAt(0)).setTextColor(this.mContext.getResources().getColor(R.color.light_gray));
            }
        }
        ((TextView) vector.elementAt(1)).setText(((MyPrinter) vector2.elementAt(i)).getIp());
    }

    public void setResource(Object obj) {
        this.selectedKey = (String) obj;
    }
}
