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 java.util.ArrayList;
import java.util.Vector;

import epson.print.EPPrinterInfo;
import epson.print.EPPrinterManager;
import epson.print.MyPrinter;
import epson.print.R;

public class PrinterInfoECBuilder extends AbstractListBuilder {
    private static final int ACTIVE = 4;

    /* renamed from: IP */
    private static final int f409IP = 1;
    private static final int NAME = 0;
    private static final int PRINT_LOCAL = 3;
    private static final int PRINT_REMOTE = 2;
    String curPrinterId;
    private ArrayList<EPPrinterInfo> printerList;
    private EPPrinterManager printerManager;

    public void addPrinter(String[] strArr) {
    }

    public AlphabetIndexer getIndexer() {
        return null;
    }

    protected void notifyDataChange() {
    }

    public PrinterInfoECBuilder(Context context, ViewGroup viewGroup) {
        super(context, viewGroup);
        printerManager = null;
        printerList = null;
        curPrinterId = null;
        printerManager = new EPPrinterManager(this.mContext);
    }

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

    public View buildViewHolder() {
        return mLayoutInflater.inflate(R.layout.epsonconnect_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.print_remote_icon));
        vector.add(view.findViewById(R.id.print_local_icon));
        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));
        View elementAt = vector.elementAt(4);
        if (!((MyPrinter) vector2.elementAt(i)).getEmailAddress().equals(this.curPrinterId)) {
            i2 = 8;
        }
        elementAt.setVisibility(i2);
        vector.elementAt(3).setVisibility(8);
        vector.elementAt(2).setVisibility(8);
        ((TextView) vector.elementAt(1)).setText(((MyPrinter) vector2.elementAt(i)).getEmailAddress());
    }

    public void setResource(Object obj) {
        curPrinterId = (String) obj;
    }

    public void destructor() {
        super.destructor();
        printerList = null;
    }
}
