package epson.print;

import android.graphics.Bitmap;
import android.os.Parcel;
import android.os.Parcelable;

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

        public ImageItem[] newArray(int i) {
            return new ImageItem[i];
        }
    };
    private Bitmap bitmap;
    private long databaseId;
    private String path;
    private int selected;

    public int describeContents() {
        return 0;
    }

    public ImageItem() {
        this.bitmap = null;
        this.selected = 0;
        this.path = null;
        this.databaseId = -1;
    }

    public ImageItem(Bitmap bitmap2, int i, String str, long j) {
        this.bitmap = bitmap2;
        this.selected = i;
        this.path = str;
        this.databaseId = j;
    }

    public ImageItem(Parcel parcel) {
        readFromParcel(parcel);
    }

    public Bitmap getBitmap() {
        return this.bitmap;
    }

    public void setBitmap(Bitmap bitmap2) {
        this.bitmap = bitmap2;
    }

    public int getSelected() {
        return this.selected;
    }

    public void setSelected(int i) {
        this.selected = i;
    }

    public String getPath() {
        return this.path;
    }

    public void setPath(String str) {
        this.path = str;
    }

    public long getDatabaseId() {
        return this.databaseId;
    }

    public void setDatabaseId(long j) {
        this.databaseId = j;
    }

    public static Creator getCREATOR() {
        return CREATOR;
    }

    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeParcelable(this.bitmap, 0);
        parcel.writeInt(this.selected);
        parcel.writeString(this.path);
        parcel.writeLong(this.databaseId);
    }

    public void readFromParcel(Parcel parcel) {
        this.bitmap = (Bitmap) parcel.readParcelable(getClass().getClassLoader());
        this.selected = parcel.readInt();
        this.path = parcel.readString();
        this.databaseId = parcel.readLong();
    }

    public void release() {
        Bitmap bitmap2 = this.bitmap;
        if (bitmap2 != null) {
            bitmap2.recycle();
            this.bitmap = null;
        }
    }

    public boolean equals(Object obj) {
        if ((obj instanceof ImageItem) && getDatabaseId() == ((ImageItem) obj).getDatabaseId()) {
            return true;
        }
        return false;
    }
}
