PhotoPreviewImageList.java 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. package epson.print.phlayout;
  2. import android.support.annotation.NonNull;
  3. import android.support.annotation.Nullable;
  4. import epson.print.EPImage;
  5. import java.util.ArrayList;
  6. import java.util.Iterator;
  7. public class PhotoPreviewImageList {
  8. private ArrayList<EpImageWrapper> mEpImageWrapperList = new ArrayList<>();
  9. /* access modifiers changed from: private */
  10. public ArrayList<LayoutInfo> mLayoutInfoList = new ArrayList<>();
  11. public void clearExceptSrcFileName() {
  12. }
  13. public int size() {
  14. return this.mEpImageWrapperList.size();
  15. }
  16. public void add(@NonNull String str, int i) {
  17. add(new EpImageWrapper(str, (String) null, i));
  18. }
  19. public void add(@NonNull EpImageWrapper epImageWrapper) {
  20. this.mEpImageWrapperList.add(epImageWrapper);
  21. this.mLayoutInfoList.add(new LayoutInfo());
  22. }
  23. public void addOrgNameEpOrgName(@NonNull EpImageWrapper epImageWrapper) {
  24. this.mEpImageWrapperList.add(new EpImageWrapper(epImageWrapper.epImage.getOriginalFileName(), epImageWrapper.orgFilename, epImageWrapper.epImage.index));
  25. this.mLayoutInfoList.add(new LayoutInfo());
  26. }
  27. public void setList(@Nullable ArrayList<EpImageWrapper> arrayList) {
  28. clear();
  29. if (arrayList != null) {
  30. Iterator<EpImageWrapper> it = arrayList.iterator();
  31. while (it.hasNext()) {
  32. addOrgNameEpOrgName(it.next());
  33. }
  34. }
  35. }
  36. @NonNull
  37. public ArrayList<String> getGalleryFileList() {
  38. ArrayList<String> arrayList = new ArrayList<>();
  39. for (int i = 0; i < size(); i++) {
  40. EPImage ePImage = this.mEpImageWrapperList.get(i).epImage;
  41. if (ePImage == null) {
  42. arrayList.add((Object) null);
  43. } else {
  44. arrayList.add(ePImage.getOriginalFileName());
  45. }
  46. }
  47. return arrayList;
  48. }
  49. @Nullable
  50. public EPImage get(int i) {
  51. return this.mEpImageWrapperList.get(i).epImage;
  52. }
  53. public ArrayList<String> getArgumentFileList() {
  54. ArrayList<String> arrayList = new ArrayList<>();
  55. Iterator<EpImageWrapper> it = this.mEpImageWrapperList.iterator();
  56. while (it.hasNext()) {
  57. arrayList.add(it.next().getArgumentFilename());
  58. }
  59. return arrayList;
  60. }
  61. public void set(int i, @NonNull EPImage ePImage) {
  62. this.mEpImageWrapperList.get(i).epImage = ePImage;
  63. }
  64. public void clear() {
  65. this.mEpImageWrapperList.clear();
  66. this.mLayoutInfoList.clear();
  67. }
  68. public void remove(int i) {
  69. this.mEpImageWrapperList.remove(i);
  70. this.mLayoutInfoList.remove(i);
  71. }
  72. @NonNull
  73. public Element getElement(int i) {
  74. if (i >= 0 && i <= this.mEpImageWrapperList.size()) {
  75. return new Element(i);
  76. }
  77. throw new IndexOutOfBoundsException();
  78. }
  79. private static class LayoutInfo {
  80. int fitMode = 0;
  81. LayoutInfo() {
  82. }
  83. }
  84. public class Element {
  85. private int mIndex;
  86. @VisibleForTesting
  87. Element(int i) {
  88. this.mIndex = i;
  89. }
  90. public EPImage getEPImage() {
  91. return PhotoPreviewImageList.this.get(this.mIndex);
  92. }
  93. public void setFitMode(int i) {
  94. ((LayoutInfo) PhotoPreviewImageList.this.mLayoutInfoList.get(this.mIndex)).fitMode = i;
  95. }
  96. public int getFitMode() {
  97. return ((LayoutInfo) PhotoPreviewImageList.this.mLayoutInfoList.get(this.mIndex)).fitMode;
  98. }
  99. }
  100. public static class EpImageWrapper {
  101. public EPImage epImage;
  102. public String orgFilename;
  103. public EpImageWrapper(@NonNull String str, @Nullable String str2, int i) {
  104. this.epImage = new EPImage(str, i);
  105. this.orgFilename = str2;
  106. }
  107. public String getArgumentFilename() {
  108. String str = this.orgFilename;
  109. if (str != null) {
  110. return str;
  111. }
  112. return this.epImage.getOriginalFileName();
  113. }
  114. }
  115. }