package com.epson.cameracopy.printlayout;

import android.content.Context;
import android.graphics.Point;
import com.epson.cameracopy.printlayout.ManuscriptSize;
import com.epson.mobilephone.common.escpr.MediaInfo;
import epson.common.Info_paper;


/* compiled from: ManuscriptSize */
class IdManuscriptSize implements ManuscriptSize.ManuscriptTypeAdapter {
    static final /* synthetic */ boolean $assertionsDisabled = false;
    protected DocumentSizeInfo mDocumentSizeInfo;

    public boolean displayLength() {
        return false;
    }

    public IdManuscriptSize(DocumentSizeInfo documentSizeInfo) {
        mDocumentSizeInfo = documentSizeInfo;
    }

    public static Point get360DpiPaperSizeById(int i) {
        Point point = new Point();
        Info_paper info_paper = Info_paper.get360DpiPaperSizeInfo(i);
        if (info_paper == null) {
            return point;
        }
        point.x = info_paper.getPaper_width();
        point.y = info_paper.getPaper_height();
        return point;
    }

    protected static Point getDpiPaperSizeById(int i, int i2) {
        Point point = get360DpiPaperSizeById(i);
        if (i2 == 360 || i2 == 0) {
            return point;
        }
        double d = (double) i2;
        point.x = (int) (((((double) point.x) * d) / 360.0d) + 0.5d);
        point.y = (int) (((((double) point.y) * d) / 360.0d) + 0.5d);
        return point;
    }

    public Point getBasePixelSize(int i) {
        return getDpiPaperSizeById(mDocumentSizeInfo.getPaperId(), i);
    }

    public String getSizeName(Context context) {
        if (mDocumentSizeInfo.getDocSizeName(context).equalsIgnoreCase(context.getString(R.string.papersize_passport))) {
            return mDocumentSizeInfo.getDocSizeName(context);
        }
        return context.getString(new MediaInfo.PaperSize().getStringId(mDocumentSizeInfo.getPaperId()));
    }

    public int getUnitType(Context context) {
        return getSizeName(context).matches(".*in *$") ? 2 : 1;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        IdManuscriptSize idManuscriptSize = (IdManuscriptSize) obj;
        DocumentSizeInfo documentSizeInfo = mDocumentSizeInfo;
        if (documentSizeInfo == null) {
            if (idManuscriptSize.mDocumentSizeInfo != null) {
                return false;
            }
        } else if (!documentSizeInfo.equals(idManuscriptSize.mDocumentSizeInfo)) {
            return false;
        }
        return true;
    }
}
