package epson.scan.activity;

import android.content.Context;

import com.epson.lib.escani2.EscanI2Lib;
import com.epson.lib.escani2.ScanSize;
import com.epson.mobilephone.common.PrintingLib.define.Constants;

import epson.print.R;
import epson.scan.lib.ScanSizeHelper;

public class DisplayIdConverter {
    public static int getYesNoStringId(Context context, boolean z) {
        return z ? R.string.str_yes : R.string.str_no;
    }

    public static int getColorStringId(EscanI2Lib.ColorMode colorMode) {
        switch (colorMode) {
            case COLOR_24BIT:
                return R.string.str_settings_color_color;
            case GRAYSCALE_8BIT:
                return R.string.str_settings_color_grayscale;
            case MONO_1BIT:
                return R.string.str_settings_color_monochrome;
            default:
                return 0;
        }
    }

    public static int[] getColorModeItemIdArray(EscanI2Lib.ColorMode[] colorModeArr) {
        if (colorModeArr == null) {
            return null;
        }
        int[] iArr = new int[colorModeArr.length];
        int i = 0;
        for (EscanI2Lib.ColorMode colorStringId : colorModeArr) {
            int colorStringId2 = getColorStringId(colorStringId);
            if (colorStringId2 == 0) {
                colorStringId2 = R.string.str_blank;
            }
            iArr[i] = colorStringId2;
            i++;
        }
        return iArr;
    }

    public static int getInputUnitStringId(EscanI2Lib.InputUnit inputUnit) {
        switch (inputUnit) {
            case FLATBED:
                return R.string.str_settings_source_doctable;
            case ADF:
                return R.string.str_settings_source_adf;
            default:
                return 0;
        }
    }

    public static int[] getInputUnitItemIdArray(EscanI2Lib.InputUnit[] inputUnitArr) {
        if (inputUnitArr == null) {
            return null;
        }
        int[] iArr = new int[inputUnitArr.length];
        int i = 0;
        for (EscanI2Lib.InputUnit inputUnitStringId : inputUnitArr) {
            int inputUnitStringId2 = getInputUnitStringId(inputUnitStringId);
            if (inputUnitStringId2 == 0) {
                inputUnitStringId2 = R.string.str_blank;
            }
            iArr[i] = inputUnitStringId2;
            i++;
        }
        return iArr;
    }

    public static int getScanSizeStringId(ScanSize scanSize) {
        if (scanSize == null) {
            return R.string.str_settings_undefine_scansize;
        }
        return getScanSizeStringId(scanSize.getSize());
    }

    public static int getScanSizeStringId(ScanSize.PaperSize paperSize) {
        return (paperSize == null || paperSize == ScanSize.PaperSize.PIXEL) ? R.string.str_settings_undefine_scansize : ScanSizeHelper.getScanSizeName(getEpsMediaId(paperSize));
    }

    public static int getEpsMediaId(ScanSize.PaperSize paperSize) {
        switch (paperSize) {
            case A4:
                return Constants.PaperName.EPS_MSID_A4.getCode();
            case LETTER:
                return Constants.PaperName.EPS_MSID_LETTER.getCode();
            case LEGAL:
                return Constants.PaperName.EPS_MSID_LEGAL.getCode();
            case B5:
                return Constants.PaperName.EPS_MSID_B5.getCode();
            case B6:
                return Constants.PaperName.EPS_MSID_B6.getCode();
            case A5:
                return Constants.PaperName.EPS_MSID_A5.getCode();
            case A6:
                return Constants.PaperName.EPS_MSID_A6.getCode();
            case A3:
                return Constants.PaperName.EPS_MSID_A3.getCode();
            case MEISHI:
                return Constants.PaperName.EPS_MSID_BUZCARD_55X91.getCode();
            case MAX:
                return Constants.PaperName.EPS_MSID_USER.getCode();
            default:
                return -1;
        }
    }

    public static int[] getScanSizeIdArray(ScanSize[] scanSizeArr) {
        if (scanSizeArr == null) {
            return null;
        }
        int[] iArr = new int[scanSizeArr.length];
        int i = 0;
        for (ScanSize scanSizeStringId : scanSizeArr) {
            int scanSizeStringId2 = getScanSizeStringId(scanSizeStringId);
            if (scanSizeStringId2 == 0) {
                scanSizeStringId2 = R.string.str_blank;
            }
            iArr[i] = scanSizeStringId2;
            i++;
        }
        return iArr;
    }

    public static String[] getScanResolutionStrings(Context context, Integer[] numArr) {
        String[] strArr = new String[numArr.length];
        int i = 0;
        for (Integer intValue : numArr) {
            strArr[i] = getScanResolutionStrings(context, intValue.intValue());
            i++;
        }
        return strArr;
    }

    public static String getScanResolutionStrings(Context context, int i) {
        if (i <= 0) {
            return context.getString(R.string.str_blank);
        }
        return context.getString(R.string.str_settings_resolution, new Object[]{Integer.valueOf(i)});
    }

    public static int[] getYesNoStringIdArray(Context context, Boolean[] boolArr) {
        int[] iArr = new int[boolArr.length];
        int i = 0;
        for (Boolean booleanValue : boolArr) {
            iArr[i] = getYesNoStringId(context, booleanValue.booleanValue());
            i++;
        }
        return iArr;
    }

    public static int[] getGammaStringIdArray(Context context, EscanI2Lib.Gamma[] gammaArr) {
        int[] iArr = new int[gammaArr.length];
        int i = 0;
        for (EscanI2Lib.Gamma gammaStringId : gammaArr) {
            iArr[i] = getGammaStringId(gammaStringId);
            i++;
        }
        return iArr;
    }

    public static int getGammaStringId(EscanI2Lib.Gamma gamma) {
        switch (gamma) {
            case GAMMA_100:
                return R.string.str_settings_gamma_10;
            case GAMMA_180:
                return R.string.str_settings_gamma_18;
            default:
                return 0;
        }
    }
}
