ImageItem.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. package epson.print;
  2. import android.graphics.Bitmap;
  3. import android.os.Parcel;
  4. import android.os.Parcelable;
  5. public class ImageItem implements Parcelable {
  6. public static final Creator CREATOR = new Creator() {
  7. public ImageItem createFromParcel(Parcel parcel) {
  8. return new ImageItem(parcel);
  9. }
  10. public ImageItem[] newArray(int i) {
  11. return new ImageItem[i];
  12. }
  13. };
  14. private Bitmap bitmap;
  15. private long databaseId;
  16. private String path;
  17. private int selected;
  18. public int describeContents() {
  19. return 0;
  20. }
  21. public ImageItem() {
  22. bitmap = null;
  23. selected = 0;
  24. path = null;
  25. databaseId = -1;
  26. }
  27. public ImageItem(Bitmap bitmap2, int i, String str, long j) {
  28. bitmap = bitmap2;
  29. selected = i;
  30. path = str;
  31. databaseId = j;
  32. }
  33. public ImageItem(Parcel parcel) {
  34. readFromParcel(parcel);
  35. }
  36. public Bitmap getBitmap() {
  37. return bitmap;
  38. }
  39. public void setBitmap(Bitmap bitmap2) {
  40. bitmap = bitmap2;
  41. }
  42. public int getSelected() {
  43. return selected;
  44. }
  45. public void setSelected(int i) {
  46. selected = i;
  47. }
  48. public String getPath() {
  49. return path;
  50. }
  51. public void setPath(String str) {
  52. path = str;
  53. }
  54. public long getDatabaseId() {
  55. return databaseId;
  56. }
  57. public void setDatabaseId(long j) {
  58. databaseId = j;
  59. }
  60. public static Creator getCREATOR() {
  61. return CREATOR;
  62. }
  63. public void writeToParcel(Parcel parcel, int i) {
  64. parcel.writeParcelable(bitmap, 0);
  65. parcel.writeInt(selected);
  66. parcel.writeString(path);
  67. parcel.writeLong(databaseId);
  68. }
  69. public void readFromParcel(Parcel parcel) {
  70. bitmap = (Bitmap) parcel.readParcelable(getClass().getClassLoader());
  71. selected = parcel.readInt();
  72. path = parcel.readString();
  73. databaseId = parcel.readLong();
  74. }
  75. public void release() {
  76. Bitmap bitmap2 = bitmap;
  77. if (bitmap2 != null) {
  78. bitmap2.recycle();
  79. bitmap = null;
  80. }
  81. }
  82. public boolean equals(Object obj) {
  83. if ((obj instanceof ImageItem) && getDatabaseId() == ((ImageItem) obj).getDatabaseId()) {
  84. return true;
  85. }
  86. return false;
  87. }
  88. }