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 com.epson.mobilephone.common.escpr.MediaInfo;

import java.util.Vector;

import epson.print.R;

public class PrinterInfoDetailBuilder extends AbstractListBuilder {
    private static final int ACTIVE = 1;
    private static final int NAME = 0;
    int curValue = -1;
    private MediaInfo.AbstractInfo mLookupTable;

    public void addPrinter(String[] strArr) {
    }

    public AlphabetIndexer getIndexer() {
        return null;
    }

    protected void notifyDataChange() {
    }

    public PrinterInfoDetailBuilder(Context context, ViewGroup viewGroup) {
        super(context, viewGroup);
    }

    protected void buildData() {
        mData.clear();
    }

    public View buildViewHolder() {
        return mLayoutInflater.inflate(R.layout.printer_info_detail_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.active_icon));
        return vector;
    }

    public void buildViewHolderContentData(int i, Vector<View> vector, Vector<Object> vector2) {
        int value = ((CommonDataKinds.PrinterInfo) vector2.elementAt(i)).getValue();
        int stringId = mLookupTable.getStringId(value);
        int i2 = 0;
        if (stringId != -1) {
            ((TextView) vector.elementAt(0)).setText(this.mContext.getString(stringId));
        }
        View elementAt = vector.elementAt(1);
        if (value != curValue) {
            i2 = 8;
        }
        elementAt.setVisibility(i2);
    }

    public void setResource(Object obj) {
        curValue = ((Integer) obj).intValue();
    }

    public void addPrinterInfo(int[] iArr, MediaInfo.AbstractInfo abstractInfo) {
        mLookupTable = abstractInfo;
        for (int printerInfo : iArr) {
            mData.add(new CommonDataKinds.PrinterInfo(printerInfo));
        }
        mAdapter.notifyDataSetChanged();
    }

    public void refresh() {
        buildData();
    }

    public void destructor() {
        super.destructor();
        MediaInfo.AbstractInfo abstractInfo = mLookupTable;
        if (abstractInfo != null) {
            abstractInfo.destructor();
        }
    }
}
