package epson.print;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;

public class EPImageList implements Parcelable {
    public static final Creator<EPImageList> CREATOR = new Creator<EPImageList>() {
        public EPImageList createFromParcel(Parcel parcel) {
            return new EPImageList(parcel);
        }

        public EPImageList[] newArray(int i) {
            return new EPImageList[i];
        }
    };
    public int apfModeInPrinting;
    public ArrayList<EPImage> imageList;
    private int mClearlyVivid;
    private boolean mMultiFileMode;
    private int mRenderingMode;
    private int mSharpness;
    private int paperHeight;
    private int paperWidth;

    public int describeContents() {
        return 0;
    }

    public EPImageList() {
        this.imageList = new ArrayList<>();
        this.paperWidth = 0;
        this.paperHeight = 0;
        this.mMultiFileMode = false;
        this.mMultiFileMode = false;
        this.apfModeInPrinting = 0;
        this.mSharpness = 0;
        this.mClearlyVivid = 0;
        this.mRenderingMode = 0;
    }

    public int getSharpness() {
        return this.mSharpness;
    }

    public void setSharpness(int i) {
        this.mSharpness = i;
    }

    public int getClearlyVivid() {
        return this.mClearlyVivid;
    }

    public void setClearlyVivid(int i) {
        this.mClearlyVivid = i;
    }

    public boolean add(String str) {
        ArrayList<EPImage> arrayList = this.imageList;
        return arrayList.add(new EPImage(str, arrayList.size()));
    }

    public boolean add(EPImage ePImage) {
        return this.imageList.add(ePImage);
    }

    public boolean add(int i, EPImage ePImage) {
        if (i >= this.imageList.size()) {
            return this.imageList.add(ePImage);
        }
        this.imageList.add(i, ePImage);
        return true;
    }

    public EPImage set(int i, String str) {
        if (i < 0 || i >= this.imageList.size()) {
            return null;
        }
        return this.imageList.set(i, new EPImage(str, i));
    }

    public EPImage set(int i, EPImage ePImage) {
        if (i < 0 || i >= this.imageList.size()) {
            return null;
        }
        return this.imageList.set(i, ePImage);
    }

    public EPImage remove(int i) {
        if (i < 0 || i >= this.imageList.size()) {
            return null;
        }
        return this.imageList.remove(i);
    }

    public EPImage remove(String str) {
        for (int i = 0; i < this.imageList.size(); i++) {
            if (this.imageList.get(i).loadImageFileName.equalsIgnoreCase(str)) {
                return this.imageList.remove(i);
            }
        }
        return null;
    }

    public void clear() {
        this.imageList.clear();
    }

    public void setFileType(int i) {
        for (int i2 = 0; i2 < this.imageList.size(); i2++) {
            this.imageList.get(i2).setType(i);
        }
    }

    public void setMultifileMode(boolean z) {
        this.mMultiFileMode = z;
    }

    public boolean isMultifileMode() {
        return this.mMultiFileMode;
    }

    public void clearExceptSrcFileName() {
        ArrayList<EPImage> arrayList = new ArrayList<>();
        for (int i = 0; i < this.imageList.size(); i++) {
            arrayList.add(new EPImage(this.imageList.get(i).loadImageFileName, arrayList.size()));
        }
        this.imageList = null;
        System.gc();
        this.imageList = arrayList;
    }

    public int size() {
        return this.imageList.size();
    }

    public EPImage get(int i) {
        if (i < 0 || i >= this.imageList.size()) {
            return null;
        }
        return this.imageList.get(i);
    }

    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeTypedList(this.imageList);
        parcel.writeInt(getPaperWidth());
        parcel.writeInt(getPaperHeight());
        parcel.writeBooleanArray(new boolean[]{this.mMultiFileMode});
        parcel.writeInt(this.apfModeInPrinting);
        parcel.writeInt(this.mSharpness);
        parcel.writeInt(this.mClearlyVivid);
        parcel.writeInt(this.mRenderingMode);
    }

    private EPImageList(Parcel parcel) {
        this.imageList = new ArrayList<>();
        this.paperWidth = 0;
        this.paperHeight = 0;
        this.mMultiFileMode = false;
        this.imageList = parcel.createTypedArrayList(EPImage.CREATOR);
        setPaperWidth(parcel.readInt());
        setPaperHeight(parcel.readInt());
        boolean[] zArr = new boolean[1];
        parcel.readBooleanArray(zArr);
        this.mMultiFileMode = zArr[0];
        this.apfModeInPrinting = parcel.readInt();
        this.mSharpness = parcel.readInt();
        this.mClearlyVivid = parcel.readInt();
        this.mRenderingMode = parcel.readInt();
    }

    public EPImageList(ArrayList<EPImage> arrayList, int i) {
        this.imageList = new ArrayList<>();
        this.paperWidth = 0;
        this.paperHeight = 0;
        this.mMultiFileMode = false;
        this.imageList = arrayList;
    }

    public int getPaperWidth() {
        return this.paperWidth;
    }

    public void setPaperWidth(int i) {
        this.paperWidth = i;
    }

    public int getPaperHeight() {
        return this.paperHeight;
    }

    public void setPaperHeight(int i) {
        this.paperHeight = i;
    }

    public void setRenderingMode(int i) {
        this.mRenderingMode = i;
    }

    public int getRenderingMode() {
        return this.mRenderingMode;
    }
}
