liuyuqi-dellpc 3 years ago
parent
commit
8c8ceeb088
100 changed files with 21976 additions and 1 deletions
  1. 47 1
      app/src/main/AndroidManifest.xml
  2. 10 0
      app/src/main/java/com/epson/cameracopy/alt/AdditionalPrinterInfo.java
  3. 606 0
      app/src/main/java/com/epson/cameracopy/alt/BmpFileInfo.java
  4. 86 0
      app/src/main/java/com/epson/cameracopy/alt/FileUtils.java
  5. 7 0
      app/src/main/java/com/epson/cameracopy/alt/LicenseAction.java
  6. 73 0
      app/src/main/java/com/epson/cameracopy/alt/SimpleBmpMerger.java
  7. 22 0
      app/src/main/java/com/epson/cameracopy/alt/UiCommon.java
  8. 158 0
      app/src/main/java/com/epson/cameracopy/device/AptSensorAdapter.java
  9. 91 0
      app/src/main/java/com/epson/cameracopy/device/CameraFile.java
  10. 153 0
      app/src/main/java/com/epson/cameracopy/device/CameraPreviewControl.java
  11. 55 0
      app/src/main/java/com/epson/cameracopy/device/CameraSizeList.java
  12. 27 0
      app/src/main/java/com/epson/cameracopy/device/Log.java
  13. 215 0
      app/src/main/java/com/epson/cameracopy/device/OpenCvCameraView.java
  14. 118 0
      app/src/main/java/com/epson/cameracopy/device/PaperContourDetector.java
  15. 640 0
      app/src/main/java/com/epson/cameracopy/device/PortraitCameraView.java
  16. 86 0
      app/src/main/java/com/epson/cameracopy/device/PreviewResolutionSelector.java
  17. 22 0
      app/src/main/java/com/epson/cameracopy/device/RectangleDetector.java
  18. 19 0
      app/src/main/java/com/epson/cameracopy/device/SimpleSize.java
  19. 7 0
      app/src/main/java/com/epson/cameracopy/device/SizeWrapper.java
  20. 20 0
      app/src/main/java/com/epson/cameracopy/p006ui/AreaComparator.java
  21. 45 0
      app/src/main/java/com/epson/cameracopy/p006ui/CameraCopyProgressParams.java
  22. 36 0
      app/src/main/java/com/epson/cameracopy/p006ui/CameraFileAdapter.java
  23. 67 0
      app/src/main/java/com/epson/cameracopy/p006ui/CameraPreviewActivity.java
  24. 554 0
      app/src/main/java/com/epson/cameracopy/p006ui/CameraPreviewFragment.java
  25. 182 0
      app/src/main/java/com/epson/cameracopy/p006ui/CameraPreviewOptionActivity.java
  26. 1100 0
      app/src/main/java/com/epson/cameracopy/p006ui/CameraPrintProgress.java
  27. 2755 0
      app/src/main/java/com/epson/cameracopy/p006ui/CameraPrintSettingActivity.java
  28. 1469 0
      app/src/main/java/com/epson/cameracopy/p006ui/CropImageActivity.java
  29. 39 0
      app/src/main/java/com/epson/cameracopy/p006ui/CurrentFolderName.java
  30. 325 0
      app/src/main/java/com/epson/cameracopy/p006ui/DocumentSizeEditActivity.java
  31. 263 0
      app/src/main/java/com/epson/cameracopy/p006ui/DocumentSizeSettingActivity.java
  32. 143 0
      app/src/main/java/com/epson/cameracopy/p006ui/FolderInformation.java
  33. 172 0
      app/src/main/java/com/epson/cameracopy/p006ui/FolderSelectActivity.java
  34. 1485 0
      app/src/main/java/com/epson/cameracopy/p006ui/ImageCollectView.java
  35. 89 0
      app/src/main/java/com/epson/cameracopy/p006ui/ImageFolderFile.java
  36. 53 0
      app/src/main/java/com/epson/cameracopy/p006ui/ImageFolderFileViewModel.java
  37. 427 0
      app/src/main/java/com/epson/cameracopy/p006ui/ImagePreviewActivity.java
  38. 17 0
      app/src/main/java/com/epson/cameracopy/p006ui/ImagePreviewFile.java
  39. 31 0
      app/src/main/java/com/epson/cameracopy/p006ui/ItemData.java
  40. 32 0
      app/src/main/java/com/epson/cameracopy/p006ui/ItemDataAdapter.java
  41. 37 0
      app/src/main/java/com/epson/cameracopy/p006ui/MenuControl.java
  42. 173 0
      app/src/main/java/com/epson/cameracopy/p006ui/PictureResolutionDialogFragment.java
  43. 826 0
      app/src/main/java/com/epson/cameracopy/p006ui/PrintPreviewActivity.java
  44. 37 0
      app/src/main/java/com/epson/cameracopy/p006ui/SimpleMessageDialogFragment.java
  45. 34 0
      app/src/main/java/com/epson/cameracopy/printlayout/AutoManuscriptSize.java
  46. 72 0
      app/src/main/java/com/epson/cameracopy/printlayout/CustomManuscriptSize.java
  47. 192 0
      app/src/main/java/com/epson/cameracopy/printlayout/DocumentSizeInfo.java
  48. 78 0
      app/src/main/java/com/epson/cameracopy/printlayout/IdManuscriptSize.java
  49. 580 0
      app/src/main/java/com/epson/cameracopy/printlayout/ImageAndLayout.java
  50. 155 0
      app/src/main/java/com/epson/cameracopy/printlayout/ManuscriptSize.java
  51. 410 0
      app/src/main/java/com/epson/cameracopy/printlayout/PreviewPosition.java
  52. 409 0
      app/src/main/java/com/epson/cameracopy/printlayout/PreviewView.java
  53. 432 0
      app/src/main/java/com/epson/cameracopy/printlayout/RegistedDocumentSizeList.java
  54. 441 0
      app/src/main/java/com/epson/iprint/prtlogger/Analytics.java
  55. 40 0
      app/src/main/java/com/epson/iprint/prtlogger/AnalyticsPreferences.java
  56. 24 0
      app/src/main/java/com/epson/iprint/prtlogger/CommonLog.java
  57. 49 0
      app/src/main/java/com/epson/iprint/prtlogger/LoggerRecord.java
  58. 55 0
      app/src/main/java/com/epson/iprint/prtlogger/NewLoggerController.java
  59. 56 0
      app/src/main/java/com/epson/iprint/prtlogger/PrintLog.java
  60. 15 0
      app/src/main/java/com/epson/lib/escani2/AdfCapability.java
  61. 476 0
      app/src/main/java/com/epson/lib/escani2/EscanI2Lib.java
  62. 70 0
      app/src/main/java/com/epson/lib/escani2/EscanI2NativeIf.java
  63. 52 0
      app/src/main/java/com/epson/lib/escani2/EscanI2NativeInterface.java
  64. 7 0
      app/src/main/java/com/epson/lib/escani2/FlatbedCapability.java
  65. 32 0
      app/src/main/java/com/epson/lib/escani2/I2LibScannerInfoAndCapability.java
  66. 35 0
      app/src/main/java/com/epson/lib/escani2/ScanI2Params.java
  67. 45 0
      app/src/main/java/com/epson/lib/escani2/ScanI2PropertyTaker.java
  68. 222 0
      app/src/main/java/com/epson/lib/escani2/ScanI2Runner.java
  69. 264 0
      app/src/main/java/com/epson/lib/escani2/ScanSize.java
  70. 10 0
      app/src/main/java/com/epson/lib/escani2/ScannerI2Capability.java
  71. 71 0
      app/src/main/java/com/epson/lib/escani2/ScannerI2Info.java
  72. 44 0
      app/src/main/java/com/epson/memcardacc/AltAlertDialogFragment.java
  73. 150 0
      app/src/main/java/com/epson/memcardacc/AltViewImageAdapter.java
  74. 258 0
      app/src/main/java/com/epson/memcardacc/BitmapCache.java
  75. 18 0
      app/src/main/java/com/epson/memcardacc/CacheHashMap.java
  76. 457 0
      app/src/main/java/com/epson/memcardacc/CifsAccess.java
  77. 36 0
      app/src/main/java/com/epson/memcardacc/CifsFileInfo.java
  78. 43 0
      app/src/main/java/com/epson/memcardacc/CifsLib.java
  79. 626 0
      app/src/main/java/com/epson/memcardacc/ConfirmReadMemcard.java
  80. 720 0
      app/src/main/java/com/epson/memcardacc/ConfirmWriteMemcard.java
  81. 389 0
      app/src/main/java/com/epson/memcardacc/CopyTask.java
  82. 24 0
      app/src/main/java/com/epson/memcardacc/DirectoryCache.java
  83. 122 0
      app/src/main/java/com/epson/memcardacc/DirectorySelecterActivity.java
  84. 98 0
      app/src/main/java/com/epson/memcardacc/EscprLibPrinter.java
  85. 93 0
      app/src/main/java/com/epson/memcardacc/FileConvertTask.java
  86. 78 0
      app/src/main/java/com/epson/memcardacc/FileConvertViewModel.java
  87. 261 0
      app/src/main/java/com/epson/memcardacc/ImageFileListAdapter.java
  88. 38 0
      app/src/main/java/com/epson/memcardacc/ImageUtil.java
  89. 18 0
      app/src/main/java/com/epson/memcardacc/LimitedHashMap.java
  90. 71 0
      app/src/main/java/com/epson/memcardacc/LocalAlertDialogFragment.java
  91. 48 0
      app/src/main/java/com/epson/memcardacc/LocalImageSelectActivity.java
  92. 42 0
      app/src/main/java/com/epson/memcardacc/LocalProgressDialogFragment.java
  93. 13 0
      app/src/main/java/com/epson/memcardacc/LogData.java
  94. 94 0
      app/src/main/java/com/epson/memcardacc/MemCardWriteConvertViewModel.java
  95. 25 0
      app/src/main/java/com/epson/memcardacc/MemcardBitmapCache.java
  96. 220 0
      app/src/main/java/com/epson/memcardacc/MemcardCheckTask.java
  97. 18 0
      app/src/main/java/com/epson/memcardacc/MemcardConfig.java
  98. 16 0
      app/src/main/java/com/epson/memcardacc/MemcardDialog.java
  99. 737 0
      app/src/main/java/com/epson/memcardacc/MemcardImageGrid.java
  100. 74 0
      app/src/main/java/com/epson/memcardacc/MemcardPhotocopyTop.java

+ 47 - 1
app/src/main/AndroidManifest.xml

@@ -1,6 +1,52 @@
 <?xml version="1.0" encoding="utf-8"?>
+
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="epson.print">
+    <!--    网络-->
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+    <!--    读写-->
+    <uses-permission android:name="android.permission.VIBRATE" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+
+    <uses-permission android:name="android.permission.NFC" />
+    <uses-permission android:name="android.permission.CAMERA" />
+    <uses-permission android:name="android.permission.BLUETOOTH" />
+    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
+    <uses-permission android:name="android.permission.WAKE_LOCK" />
+    <!--    定位-->
+    <uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION" />
+    <uses-permission-sdk-23 android:name="android.permission.ACCESS_COARSE_LOCATION" />
+
+    <!--    硬件请求-->
+    <uses-feature
+        android:name="android.hardware.location"
+        android:required="false" />
+    <uses-feature
+        android:name="android.hardware.location.network"
+        android:required="false" />
+    <uses-feature
+        android:name="android.hardware.wifi"
+        android:required="true" />
+    <uses-feature
+        android:name="android.hardware.camera"
+        android:required="false" />
+    <uses-feature
+        android:name="android.hardware.camera.autofocus"
+        android:required="false" />
+    <uses-feature
+        android:name="android.hardware.bluetooth_le"
+        android:required="false" />
+
+    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
+    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
+    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
+    <uses-permission android:name="com.sony.mobile.permission.SYSTEM_UI_VISIBILITY_EXTENSION" />
+
 
     <application
         android:allowBackup="true"
@@ -9,7 +55,7 @@
         android:roundIcon="@mipmap/ic_launcher_round"
         android:supportsRtl="true"
         android:theme="@style/Theme.Print">
-        <activity android:name=".MainActivity">
+        <activity android:name=".WellcomeScreenActivity">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 

+ 10 - 0
app/src/main/java/com/epson/cameracopy/alt/AdditionalPrinterInfo.java

@@ -0,0 +1,10 @@
+package com.epson.cameracopy.alt;
+
+import android.content.Context;
+import epson.print.MyPrinter;
+
+public class AdditionalPrinterInfo {
+    public static int getCurrentPrintModeResolution(Context context) {
+        return MyPrinter.getCurPrinter(context).getLang() == 1 ? 360 : 300;
+    }
+}

+ 606 - 0
app/src/main/java/com/epson/cameracopy/alt/BmpFileInfo.java

@@ -0,0 +1,606 @@
+package com.epson.cameracopy.alt;
+
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.channels.FileChannel;
+import java.nio.channels.WritableByteChannel;
+
+/* compiled from: SimpleBmpMerger */
+class BmpFileInfo {
+    static final /* synthetic */ boolean $assertionsDisabled = false;
+    private int mBitPerPixel;
+    private int mDataOffset;
+    private String mFileName;
+    private int mFileSize;
+    private int mHeaderSize;
+    private int mHeight;
+    private int mImageDataBytes;
+    private RandomAccessFile mOfs;
+    private int mWidth;
+    private FileChannel mWriteChannel;
+
+    BmpFileInfo() {
+    }
+
+    /* JADX WARNING: Removed duplicated region for block: B:130:0x01bf A[SYNTHETIC, Splitter:B:130:0x01bf] */
+    /* JADX WARNING: Removed duplicated region for block: B:134:0x01c6 A[SYNTHETIC, Splitter:B:134:0x01c6] */
+    /* JADX WARNING: Removed duplicated region for block: B:141:0x01cd A[SYNTHETIC, Splitter:B:141:0x01cd] */
+    /* JADX WARNING: Removed duplicated region for block: B:145:0x01d4 A[SYNTHETIC, Splitter:B:145:0x01d4] */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    public boolean readParams(java.lang.String r11) {
+        /*
+            r10 = this;
+            r10.mFileName = r11
+            java.io.File r0 = new java.io.File
+            r0.<init>(r11)
+            long r0 = r0.length()
+            r2 = 0
+            r3 = 0
+            java.io.FileInputStream r4 = new java.io.FileInputStream     // Catch:{ IOException -> 0x01ca, all -> 0x01bb }
+            r4.<init>(r11)     // Catch:{ IOException -> 0x01ca, all -> 0x01bb }
+            java.nio.channels.FileChannel r2 = r4.getChannel()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r11 = 512(0x200, float:7.175E-43)
+            java.nio.ByteBuffer r11 = java.nio.ByteBuffer.allocate(r11)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r11.clear()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.nio.ByteOrder r5 = java.nio.ByteOrder.LITTLE_ENDIAN     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r11.order(r5)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r5 = r2.read(r11)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            long r5 = (long) r5
+            r7 = 30
+            int r9 = (r5 > r7 ? 1 : (r5 == r7 ? 0 : -1))
+            if (r9 >= 0) goto L_0x0038
+            r4.close()     // Catch:{ IOException -> 0x0032 }
+        L_0x0032:
+            if (r2 == 0) goto L_0x0037
+            r2.close()     // Catch:{ IOException -> 0x0037 }
+        L_0x0037:
+            return r3
+        L_0x0038:
+            r11.flip()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            byte r5 = r11.get()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.Byte r5 = java.lang.Byte.valueOf(r5)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            byte r6 = r11.get()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.Byte r6 = java.lang.Byte.valueOf(r6)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            byte r5 = r5.byteValue()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r7 = 66
+            if (r5 != r7) goto L_0x01ae
+            byte r5 = r6.byteValue()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r6 = 77
+            if (r5 == r6) goto L_0x005d
+            goto L_0x01ae
+        L_0x005d:
+            int r5 = r11.getInt()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r10.mFileSize = r5     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r5 = r10.mFileSize     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            long r5 = (long) r5     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r7 = (r5 > r0 ? 1 : (r5 == r0 ? 0 : -1))
+            if (r7 == 0) goto L_0x0098
+            java.io.PrintStream r11 = java.lang.System.out     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.StringBuilder r5 = new java.lang.StringBuilder     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r5.<init>()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.String r6 = "filesize error. header filesize <"
+            r5.append(r6)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r6 = r10.mFileSize     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r5.append(r6)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.String r6 = ">. actual file size <"
+            r5.append(r6)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r5.append(r0)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.String r0 = ">"
+            r5.append(r0)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.String r0 = r5.toString()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r11.println(r0)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r4.close()     // Catch:{ IOException -> 0x0092 }
+        L_0x0092:
+            if (r2 == 0) goto L_0x0097
+            r2.close()     // Catch:{ IOException -> 0x0097 }
+        L_0x0097:
+            return r3
+        L_0x0098:
+            r0 = 0
+        L_0x0099:
+            r1 = 2
+            if (r0 >= r1) goto L_0x00ae
+            short r1 = r11.getShort()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            if (r1 == 0) goto L_0x00ab
+            r4.close()     // Catch:{ IOException -> 0x00a5 }
+        L_0x00a5:
+            if (r2 == 0) goto L_0x00aa
+            r2.close()     // Catch:{ IOException -> 0x00aa }
+        L_0x00aa:
+            return r3
+        L_0x00ab:
+            int r0 = r0 + 1
+            goto L_0x0099
+        L_0x00ae:
+            int r0 = r11.getInt()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r10.mDataOffset = r0     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r0 = r11.getInt()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r10.mHeaderSize = r0     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r0 = r10.mHeaderSize     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r5 = 40
+            if (r0 >= r5) goto L_0x00c9
+            r4.close()     // Catch:{ IOException -> 0x00c3 }
+        L_0x00c3:
+            if (r2 == 0) goto L_0x00c8
+            r2.close()     // Catch:{ IOException -> 0x00c8 }
+        L_0x00c8:
+            return r3
+        L_0x00c9:
+            int r0 = r11.getInt()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r10.mWidth = r0     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r0 = r11.getInt()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r10.mHeight = r0     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            short r0 = r11.getShort()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r5 = 1
+            if (r0 == r5) goto L_0x0100
+            java.io.PrintStream r11 = java.lang.System.out     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r1.<init>()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.String r5 = "plain error <"
+            r1.append(r5)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r1.append(r0)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.String r0 = "> != 1"
+            r1.append(r0)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.String r0 = r1.toString()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r11.println(r0)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r4.close()     // Catch:{ IOException -> 0x00fa }
+        L_0x00fa:
+            if (r2 == 0) goto L_0x00ff
+            r2.close()     // Catch:{ IOException -> 0x00ff }
+        L_0x00ff:
+            return r3
+        L_0x0100:
+            short r0 = r11.getShort()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r10.mBitPerPixel = r0     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r0 = r11.getInt()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            if (r0 == 0) goto L_0x0130
+            java.io.PrintStream r11 = java.lang.System.out     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r1.<init>()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.String r5 = "compression error <"
+            r1.append(r5)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r1.append(r0)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.String r0 = "> != 0"
+            r1.append(r0)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.String r0 = r1.toString()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r11.println(r0)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r4.close()     // Catch:{ IOException -> 0x012a }
+        L_0x012a:
+            if (r2 == 0) goto L_0x012f
+            r2.close()     // Catch:{ IOException -> 0x012f }
+        L_0x012f:
+            return r3
+        L_0x0130:
+            int r11 = r11.getInt()     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r10.mImageDataBytes = r11     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r11 = r10.mImageDataBytes     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r0 = 4
+            r6 = 3
+            if (r11 != 0) goto L_0x0163
+            int r11 = r10.mBitPerPixel     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r7 = 8
+            if (r11 == r7) goto L_0x0151
+            r7 = 24
+            if (r11 == r7) goto L_0x014f
+            r4.close()     // Catch:{ IOException -> 0x0149 }
+        L_0x0149:
+            if (r2 == 0) goto L_0x014e
+            r2.close()     // Catch:{ IOException -> 0x014e }
+        L_0x014e:
+            return r3
+        L_0x014f:
+            r11 = 3
+            goto L_0x0152
+        L_0x0151:
+            r11 = 1
+        L_0x0152:
+            int r7 = r10.mWidth     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r11 = r11 * r7
+            r7 = r11 & 3
+            if (r7 == 0) goto L_0x015d
+            int r7 = 4 - r7
+            int r11 = r11 + r7
+        L_0x015d:
+            int r7 = r10.mHeight     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r11 = r11 * r7
+            r10.mImageDataBytes = r11     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+        L_0x0163:
+            int r11 = r10.mDataOffset     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r7 = r10.mImageDataBytes     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r11 = r11 + r7
+            int r7 = r10.mFileSize     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            if (r11 == r7) goto L_0x01a5
+            java.io.PrintStream r11 = java.lang.System.out     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.String r7 = "unsupported data size, file size."
+            r11.println(r7)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.io.PrintStream r11 = java.lang.System.out     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.util.Locale r7 = java.util.Locale.US     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.String r8 = " file size <%d>, data size <%d> data offset <%d>. sum <%d>"
+            java.lang.Object[] r0 = new java.lang.Object[r0]     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r9 = r10.mFileSize     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.Integer r9 = java.lang.Integer.valueOf(r9)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r0[r3] = r9     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r9 = r10.mImageDataBytes     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.Integer r9 = java.lang.Integer.valueOf(r9)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r0[r5] = r9     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r9 = r10.mDataOffset     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.Integer r9 = java.lang.Integer.valueOf(r9)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r0[r1] = r9     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r1 = r10.mImageDataBytes     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r9 = r10.mDataOffset     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            int r1 = r1 + r9
+            java.lang.Integer r1 = java.lang.Integer.valueOf(r1)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r0[r6] = r1     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            java.lang.String r0 = java.lang.String.format(r7, r8, r0)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+            r11.println(r0)     // Catch:{ IOException -> 0x01b9, all -> 0x01b7 }
+        L_0x01a5:
+            r4.close()     // Catch:{ IOException -> 0x01a8 }
+        L_0x01a8:
+            if (r2 == 0) goto L_0x01ad
+            r2.close()     // Catch:{ IOException -> 0x01ad }
+        L_0x01ad:
+            return r5
+        L_0x01ae:
+            r4.close()     // Catch:{ IOException -> 0x01b1 }
+        L_0x01b1:
+            if (r2 == 0) goto L_0x01b6
+            r2.close()     // Catch:{ IOException -> 0x01b6 }
+        L_0x01b6:
+            return r3
+        L_0x01b7:
+            r11 = move-exception
+            goto L_0x01bd
+        L_0x01b9:
+            goto L_0x01cb
+        L_0x01bb:
+            r11 = move-exception
+            r4 = r2
+        L_0x01bd:
+            if (r4 == 0) goto L_0x01c4
+            r4.close()     // Catch:{ IOException -> 0x01c3 }
+            goto L_0x01c4
+        L_0x01c3:
+        L_0x01c4:
+            if (r2 == 0) goto L_0x01c9
+            r2.close()     // Catch:{ IOException -> 0x01c9 }
+        L_0x01c9:
+            throw r11
+        L_0x01ca:
+            r4 = r2
+        L_0x01cb:
+            if (r4 == 0) goto L_0x01d2
+            r4.close()     // Catch:{ IOException -> 0x01d1 }
+            goto L_0x01d2
+        L_0x01d1:
+        L_0x01d2:
+            if (r2 == 0) goto L_0x01d7
+            r2.close()     // Catch:{ IOException -> 0x01d7 }
+        L_0x01d7:
+            return r3
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.alt.BmpFileInfo.readParams(java.lang.String):boolean");
+    }
+
+    public int getFileSize() {
+        return this.mFileSize;
+    }
+
+    public int getWidth() {
+        return this.mWidth;
+    }
+
+    public int getHeight() {
+        return this.mHeight;
+    }
+
+    public int getBitPerPixel() {
+        return this.mBitPerPixel;
+    }
+
+    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r0v3, resolved type: java.nio.channels.FileChannel} */
+    /* JADX WARNING: type inference failed for: r0v2 */
+    /* JADX WARNING: type inference failed for: r0v4, types: [java.io.FileInputStream] */
+    /* JADX WARNING: type inference failed for: r0v5 */
+    /* JADX WARNING: type inference failed for: r0v6 */
+    /* JADX WARNING: type inference failed for: r0v7 */
+    /* JADX WARNING: type inference failed for: r0v8 */
+    /* JADX WARNING: type inference failed for: r0v10 */
+    /* JADX WARNING: type inference failed for: r0v11 */
+    /* JADX WARNING: type inference failed for: r0v12 */
+    /* JADX WARNING: Multi-variable type inference failed */
+    /* JADX WARNING: Removed duplicated region for block: B:38:0x004f A[SYNTHETIC, Splitter:B:38:0x004f] */
+    /* JADX WARNING: Removed duplicated region for block: B:42:0x0056 A[SYNTHETIC, Splitter:B:42:0x0056] */
+    /* JADX WARNING: Removed duplicated region for block: B:49:0x0060 A[SYNTHETIC, Splitter:B:49:0x0060] */
+    /* JADX WARNING: Removed duplicated region for block: B:53:0x0067 A[SYNTHETIC, Splitter:B:53:0x0067] */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    public int transferImageData(java.nio.channels.WritableByteChannel r12) {
+        /*
+            r11 = this;
+            int r0 = r11.mImageDataBytes
+            r1 = 0
+            if (r0 <= 0) goto L_0x006b
+            int r0 = r11.mDataOffset
+            if (r0 > 0) goto L_0x000b
+            goto L_0x006b
+        L_0x000b:
+            r0 = 0
+            java.io.FileInputStream r2 = new java.io.FileInputStream     // Catch:{ IOException -> 0x0048, all -> 0x0045 }
+            java.lang.String r3 = r11.mFileName     // Catch:{ IOException -> 0x0048, all -> 0x0045 }
+            r2.<init>(r3)     // Catch:{ IOException -> 0x0048, all -> 0x0045 }
+            java.nio.channels.FileChannel r0 = r2.getChannel()     // Catch:{ IOException -> 0x0040, all -> 0x003e }
+            int r3 = r11.mDataOffset     // Catch:{ IOException -> 0x0040, all -> 0x003e }
+            long r5 = (long) r3     // Catch:{ IOException -> 0x0040, all -> 0x003e }
+            int r3 = r11.mImageDataBytes     // Catch:{ IOException -> 0x0040, all -> 0x003e }
+            long r7 = (long) r3     // Catch:{ IOException -> 0x0040, all -> 0x003e }
+            r4 = r0
+            r9 = r12
+            long r3 = r4.transferTo(r5, r7, r9)     // Catch:{ IOException -> 0x0040, all -> 0x003e }
+            int r12 = r11.mImageDataBytes     // Catch:{ IOException -> 0x0040, all -> 0x003e }
+            long r5 = (long) r12
+            int r12 = (r3 > r5 ? 1 : (r3 == r5 ? 0 : -1))
+            if (r12 >= 0) goto L_0x0033
+            r2.close()     // Catch:{ IOException -> 0x002d }
+        L_0x002d:
+            if (r0 == 0) goto L_0x0032
+            r0.close()     // Catch:{ IOException -> 0x0032 }
+        L_0x0032:
+            return r1
+        L_0x0033:
+            r2.close()     // Catch:{ IOException -> 0x0036 }
+        L_0x0036:
+            if (r0 == 0) goto L_0x003b
+            r0.close()     // Catch:{ IOException -> 0x003b }
+        L_0x003b:
+            int r12 = r11.mImageDataBytes
+            return r12
+        L_0x003e:
+            r12 = move-exception
+            goto L_0x005e
+        L_0x0040:
+            r12 = move-exception
+            r10 = r2
+            r2 = r0
+            r0 = r10
+            goto L_0x004a
+        L_0x0045:
+            r12 = move-exception
+            r2 = r0
+            goto L_0x005e
+        L_0x0048:
+            r12 = move-exception
+            r2 = r0
+        L_0x004a:
+            r12.printStackTrace()     // Catch:{ all -> 0x005a }
+            if (r0 == 0) goto L_0x0054
+            r0.close()     // Catch:{ IOException -> 0x0053 }
+            goto L_0x0054
+        L_0x0053:
+        L_0x0054:
+            if (r2 == 0) goto L_0x0059
+            r2.close()     // Catch:{ IOException -> 0x0059 }
+        L_0x0059:
+            return r1
+        L_0x005a:
+            r12 = move-exception
+            r10 = r2
+            r2 = r0
+            r0 = r10
+        L_0x005e:
+            if (r2 == 0) goto L_0x0065
+            r2.close()     // Catch:{ IOException -> 0x0064 }
+            goto L_0x0065
+        L_0x0064:
+        L_0x0065:
+            if (r0 == 0) goto L_0x006a
+            r0.close()     // Catch:{ IOException -> 0x006a }
+        L_0x006a:
+            throw r12
+        L_0x006b:
+            return r1
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.alt.BmpFileInfo.transferImageData(java.nio.channels.WritableByteChannel):int");
+    }
+
+    public boolean transferImageData(BmpFileInfo bmpFileInfo) {
+        int transferImageData = transferImageData(bmpFileInfo.getWritableChannelChannel());
+        if (transferImageData <= 0) {
+            return false;
+        }
+        bmpFileInfo.addSize(transferImageData, this.mHeight);
+        return true;
+    }
+
+    private void writeHeader(FileChannel fileChannel) throws IOException {
+        ByteBuffer allocate = ByteBuffer.allocate(54);
+        allocate.clear();
+        allocate.order(ByteOrder.LITTLE_ENDIAN);
+        allocate.put((byte) 66);
+        allocate.put((byte) 77);
+        allocate.putInt(this.mFileSize);
+        allocate.putShort(0);
+        allocate.putShort(0);
+        allocate.putInt(this.mDataOffset);
+        allocate.putInt(this.mHeaderSize);
+        allocate.putInt(this.mWidth);
+        allocate.putInt(0);
+        allocate.putShort(1);
+        allocate.putShort((short) this.mBitPerPixel);
+        allocate.putInt(0);
+        allocate.putInt(this.mImageDataBytes);
+        allocate.putInt(0);
+        allocate.putInt(0);
+        allocate.putInt(0);
+        allocate.putInt(0);
+        fileChannel.position(0);
+        allocate.rewind();
+        fileChannel.write(allocate);
+    }
+
+    public boolean prepareAppendData() {
+        this.mWriteChannel = null;
+        try {
+            this.mOfs = new RandomAccessFile(this.mFileName, "rw");
+            this.mWriteChannel = this.mOfs.getChannel();
+            writeHeader(this.mWriteChannel);
+            this.mWriteChannel.position((long) this.mDataOffset);
+            return true;
+        } catch (IOException e) {
+            e.printStackTrace();
+            RandomAccessFile randomAccessFile = this.mOfs;
+            if (randomAccessFile != null) {
+                try {
+                    randomAccessFile.close();
+                } catch (IOException unused) {
+                }
+            }
+            FileChannel fileChannel = this.mWriteChannel;
+            if (fileChannel == null) {
+                return false;
+            }
+            try {
+                fileChannel.close();
+            } catch (IOException unused2) {
+            }
+            this.mWriteChannel = null;
+            return false;
+        }
+    }
+
+    public void closeWriteableChannel() {
+        FileChannel fileChannel = this.mWriteChannel;
+        if (fileChannel != null) {
+            try {
+                fileChannel.close();
+            } catch (IOException unused) {
+            }
+            this.mWriteChannel = null;
+        }
+        RandomAccessFile randomAccessFile = this.mOfs;
+        if (randomAccessFile != null) {
+            try {
+                randomAccessFile.close();
+            } catch (IOException unused2) {
+            }
+            this.mOfs = null;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public WritableByteChannel getWritableChannelChannel() {
+        return this.mWriteChannel;
+    }
+
+    public boolean updateHeader() {
+        ByteBuffer allocate = ByteBuffer.allocate(38);
+        allocate.clear();
+        allocate.order(ByteOrder.LITTLE_ENDIAN);
+        try {
+            this.mWriteChannel.position(0);
+            if (((long) this.mWriteChannel.read(allocate)) < 38) {
+                FileChannel fileChannel = this.mWriteChannel;
+                if (fileChannel != null) {
+                    try {
+                        fileChannel.close();
+                    } catch (IOException unused) {
+                    }
+                    this.mWriteChannel = null;
+                }
+                RandomAccessFile randomAccessFile = this.mOfs;
+                if (randomAccessFile != null) {
+                    try {
+                        randomAccessFile.close();
+                    } catch (IOException unused2) {
+                    }
+                    this.mOfs = null;
+                }
+                return false;
+            }
+            allocate.position(2);
+            allocate.putInt(this.mFileSize);
+            allocate.position(22);
+            allocate.putInt(this.mHeight);
+            allocate.position(34);
+            allocate.putInt(this.mImageDataBytes);
+            allocate.rewind();
+            this.mWriteChannel.position(0);
+            this.mWriteChannel.write(allocate);
+            FileChannel fileChannel2 = this.mWriteChannel;
+            if (fileChannel2 != null) {
+                try {
+                    fileChannel2.close();
+                } catch (IOException unused3) {
+                }
+                this.mWriteChannel = null;
+            }
+            RandomAccessFile randomAccessFile2 = this.mOfs;
+            if (randomAccessFile2 == null) {
+                return true;
+            }
+            try {
+                randomAccessFile2.close();
+            } catch (IOException unused4) {
+            }
+            this.mOfs = null;
+            return true;
+        } catch (IOException e) {
+            e.printStackTrace();
+            FileChannel fileChannel3 = this.mWriteChannel;
+            if (fileChannel3 != null) {
+                try {
+                    fileChannel3.close();
+                } catch (IOException unused5) {
+                }
+                this.mWriteChannel = null;
+            }
+            RandomAccessFile randomAccessFile3 = this.mOfs;
+            if (randomAccessFile3 != null) {
+                try {
+                    randomAccessFile3.close();
+                } catch (IOException unused6) {
+                }
+                this.mOfs = null;
+            }
+            return false;
+        } catch (Throwable th) {
+            FileChannel fileChannel4 = this.mWriteChannel;
+            if (fileChannel4 != null) {
+                try {
+                    fileChannel4.close();
+                } catch (IOException unused7) {
+                }
+                this.mWriteChannel = null;
+            }
+            RandomAccessFile randomAccessFile4 = this.mOfs;
+            if (randomAccessFile4 != null) {
+                try {
+                    randomAccessFile4.close();
+                } catch (IOException unused8) {
+                }
+                this.mOfs = null;
+            }
+            throw th;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void addSize(int i, int i2) {
+        this.mFileSize += i;
+        this.mImageDataBytes += i;
+        this.mHeight += i2;
+    }
+
+    public static BmpFileInfo createH0Instance(int i, int i2, String str) {
+        BmpFileInfo bmpFileInfo = new BmpFileInfo();
+        bmpFileInfo.mFileName = str;
+        bmpFileInfo.mHeaderSize = 40;
+        bmpFileInfo.mDataOffset = 54;
+        bmpFileInfo.mWidth = i;
+        bmpFileInfo.mHeight = 0;
+        bmpFileInfo.mBitPerPixel = i2;
+        bmpFileInfo.mImageDataBytes = 0;
+        bmpFileInfo.mFileSize = bmpFileInfo.mDataOffset;
+        return bmpFileInfo;
+    }
+}

+ 86 - 0
app/src/main/java/com/epson/cameracopy/alt/FileUtils.java

@@ -0,0 +1,86 @@
+package com.epson.cameracopy.alt;
+
+import android.content.Context;
+import android.os.Environment;
+import android.support.annotation.NonNull;
+import epson.common.ExternalFileUtils;
+import java.io.File;
+
+public class FileUtils {
+    public static final String TEMPRARY_DIRECOTRY = "tempCamera";
+
+    public static boolean checkExternalStorage() {
+        return "mounted".equals(Environment.getExternalStorageState());
+    }
+
+    public static File getNewTemporaryJpegFile(@NonNull Context context) {
+        File file = new File(getCameracopyTempDir(context).getPath(), "temp.jpg");
+        if (file.exists()) {
+            file.delete();
+        }
+        return file;
+    }
+
+    @NonNull
+    public static File getCameracopyTempDir(@NonNull Context context) {
+        File file = new File(context.getExternalCacheDir(), TEMPRARY_DIRECOTRY);
+        ExternalFileUtils.getInstance(context).createTempFolder(file.getPath());
+        return file;
+    }
+
+    /* JADX WARNING: Removed duplicated region for block: B:23:0x003a A[SYNTHETIC, Splitter:B:23:0x003a] */
+    /* JADX WARNING: Removed duplicated region for block: B:27:0x0041 A[SYNTHETIC, Splitter:B:27:0x0041] */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    public static void copy(java.io.File r9, java.io.File r10) throws java.io.IOException {
+        /*
+            r0 = 0
+            java.io.FileInputStream r1 = new java.io.FileInputStream     // Catch:{ all -> 0x0036 }
+            r1.<init>(r9)     // Catch:{ all -> 0x0036 }
+            java.nio.channels.FileChannel r9 = r1.getChannel()     // Catch:{ all -> 0x0036 }
+            java.io.FileOutputStream r1 = new java.io.FileOutputStream     // Catch:{ all -> 0x0030 }
+            r1.<init>(r10)     // Catch:{ all -> 0x0030 }
+            java.nio.channels.FileChannel r10 = r1.getChannel()     // Catch:{ all -> 0x0030 }
+            r3 = 0
+            long r5 = r9.size()     // Catch:{ all -> 0x002b }
+            r2 = r9
+            r7 = r10
+            r2.transferTo(r3, r5, r7)     // Catch:{ all -> 0x002b }
+            if (r9 == 0) goto L_0x0025
+            r9.close()     // Catch:{ IOException -> 0x0024 }
+            goto L_0x0025
+        L_0x0024:
+        L_0x0025:
+            if (r10 == 0) goto L_0x002a
+            r10.close()     // Catch:{ IOException -> 0x002a }
+        L_0x002a:
+            return
+        L_0x002b:
+            r0 = move-exception
+            r8 = r0
+            r0 = r9
+            r9 = r8
+            goto L_0x0038
+        L_0x0030:
+            r10 = move-exception
+            r8 = r0
+            r0 = r9
+            r9 = r10
+            r10 = r8
+            goto L_0x0038
+        L_0x0036:
+            r9 = move-exception
+            r10 = r0
+        L_0x0038:
+            if (r0 == 0) goto L_0x003f
+            r0.close()     // Catch:{ IOException -> 0x003e }
+            goto L_0x003f
+        L_0x003e:
+        L_0x003f:
+            if (r10 == 0) goto L_0x0044
+            r10.close()     // Catch:{ IOException -> 0x0044 }
+        L_0x0044:
+            throw r9
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.alt.FileUtils.copy(java.io.File, java.io.File):void");
+    }
+}

+ 7 - 0
app/src/main/java/com/epson/cameracopy/alt/LicenseAction.java

@@ -0,0 +1,7 @@
+package com.epson.cameracopy.alt;
+
+public interface LicenseAction {
+    void agreeAction();
+
+    void disagreeAction();
+}

+ 73 - 0
app/src/main/java/com/epson/cameracopy/alt/SimpleBmpMerger.java

@@ -0,0 +1,73 @@
+package com.epson.cameracopy.alt;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+public class SimpleBmpMerger {
+    public static boolean margeBmpFile(String str, Iterator<File> it) {
+        if (!it.hasNext()) {
+            System.out.println("no bmp file");
+            return false;
+        }
+        File next = it.next();
+        BmpFileInfo bmpFileInfo = new BmpFileInfo();
+        if (!bmpFileInfo.readParams(next.toString())) {
+            PrintStream printStream = System.out;
+            printStream.println("<" + next.toString() + "> bmp format error");
+            return false;
+        }
+        BmpFileInfo createH0Instance = BmpFileInfo.createH0Instance(bmpFileInfo.getWidth(), bmpFileInfo.getBitPerPixel(), str);
+        if (!createH0Instance.prepareAppendData() || !bmpFileInfo.transferImageData(createH0Instance)) {
+            return false;
+        }
+        while (it.hasNext()) {
+            try {
+                File next2 = it.next();
+                BmpFileInfo bmpFileInfo2 = new BmpFileInfo();
+                if (!bmpFileInfo2.readParams(next2.toString())) {
+                    PrintStream printStream2 = System.out;
+                    printStream2.println("<" + next2.toString() + "> bmp format error");
+                    createH0Instance.closeWriteableChannel();
+                    return false;
+                } else if (bmpFileInfo2.getWidth() != createH0Instance.getWidth()) {
+                    System.out.println("width not correspond");
+                    createH0Instance.closeWriteableChannel();
+                    return false;
+                } else if (!bmpFileInfo2.transferImageData(createH0Instance)) {
+                    return false;
+                } else {
+                    next2.delete();
+                }
+            } finally {
+                createH0Instance.closeWriteableChannel();
+            }
+        }
+        if (!createH0Instance.updateHeader()) {
+            createH0Instance.closeWriteableChannel();
+            return false;
+        }
+        createH0Instance.closeWriteableChannel();
+        System.out.println("convert done.");
+        return true;
+    }
+
+    public static void main(String[] strArr) {
+        LinkedList linkedList = new LinkedList();
+        linkedList.addFirst(new File("c:/tmp/bo0.bmp"));
+        linkedList.addFirst(new File("c:/tmp/bo1.bmp"));
+        linkedList.addFirst(new File("c:/tmp/bo2.bmp"));
+        linkedList.addFirst(new File("c:/tmp/bo3.bmp"));
+        linkedList.addFirst(new File("c:/tmp/bo4.bmp"));
+        linkedList.addFirst(new File("c:/tmp/bo5.bmp"));
+        linkedList.addFirst(new File("c:/tmp/bo6.bmp"));
+        linkedList.addFirst(new File("c:/tmp/bo7.bmp"));
+        linkedList.addFirst(new File("c:/tmp/bo8.bmp"));
+        if (margeBmpFile("c:/tmp/tbo-all.bmp", linkedList.iterator())) {
+            System.out.println("marge ok.");
+        } else {
+            System.out.println("marge failed");
+        }
+    }
+}

+ 22 - 0
app/src/main/java/com/epson/cameracopy/alt/UiCommon.java

@@ -0,0 +1,22 @@
+package com.epson.cameracopy.alt;
+
+import android.widget.Button;
+import android.widget.ImageButton;
+
+public class UiCommon {
+    public static void setButtonEnabled(Button button, boolean z) {
+        if (z) {
+            button.setEnabled(true);
+        } else {
+            button.setEnabled(false);
+        }
+    }
+
+    public static void setImageButtonEnabled(ImageButton imageButton, boolean z) {
+        if (z) {
+            imageButton.setEnabled(true);
+        } else {
+            imageButton.setEnabled(false);
+        }
+    }
+}

+ 158 - 0
app/src/main/java/com/epson/cameracopy/device/AptSensorAdapter.java

@@ -0,0 +1,158 @@
+package com.epson.cameracopy.device;
+
+import android.content.Context;
+import android.hardware.Sensor;
+import android.hardware.SensorEvent;
+import android.hardware.SensorEventListener;
+import android.hardware.SensorManager;
+
+public class AptSensorAdapter implements SensorEventListener {
+    static final /* synthetic */ boolean $assertionsDisabled = false;
+    private float m2BaseValue = ((float) Math.pow(0.4d, 2.0d));
+    private int mDisplayRotation;
+    private boolean mIsValidValue;
+    private long mLastOverTime;
+    private long mLastOverTime2;
+    private float mPosX;
+    private float mPosY;
+    private float mPreD0;
+    private float mPreD1;
+    private float mPreD2;
+    private double mReferenceAccelaration;
+    private final int mSensorDelay = 2;
+    private SensorManager mSensorManager;
+
+    public void onAccuracyChanged(Sensor sensor, int i) {
+    }
+
+    public static boolean hasAptSensor(SensorManager sensorManager) {
+        return (sensorManager.getDefaultSensor(1) == null || sensorManager.getDefaultSensor(10) == null) ? false : true;
+    }
+
+    public static boolean hasAptSensor(Context context) {
+        return hasAptSensor((SensorManager) context.getSystemService("sensor"));
+    }
+
+    public void setSensorManager(SensorManager sensorManager) {
+        this.mSensorManager = sensorManager;
+    }
+
+    public void start() {
+        Sensor defaultSensor = this.mSensorManager.getDefaultSensor(1);
+        if (defaultSensor != null) {
+            this.mSensorManager.registerListener(this, defaultSensor, 2);
+        }
+        Sensor defaultSensor2 = this.mSensorManager.getDefaultSensor(10);
+        if (defaultSensor2 != null) {
+            this.mSensorManager.registerListener(this, defaultSensor2, 2);
+        }
+        this.mLastOverTime = 0;
+        this.mLastOverTime2 = 0;
+    }
+
+    public void stop() {
+        this.mSensorManager.unregisterListener(this);
+    }
+
+    public static double getRangeCompValue(int i) {
+        return Math.pow(Math.sin((((double) i) * 3.141592653589793d) / 180.0d) * 9.806650161743164d, 2.0d);
+    }
+
+    public void setDisplayRotation(int i) {
+        this.mDisplayRotation = i;
+    }
+
+    public void setReferenceAccelaration(double d) {
+        this.mReferenceAccelaration = d;
+        this.mLastOverTime = 0;
+    }
+
+    public void resetTime() {
+        this.mLastOverTime = 0;
+    }
+
+    public boolean isTerminalAngleInRange(double d) {
+        if (!this.mIsValidValue) {
+            return false;
+        }
+        float f = this.mPosX;
+        float f2 = this.mPosY;
+        if (d >= ((double) ((f * f) + (f2 * f2)))) {
+            return true;
+        }
+        return false;
+    }
+
+    public float getPosX() {
+        return this.mPosX;
+    }
+
+    public float getPosY() {
+        return this.mPosY;
+    }
+
+    public void onSensorChanged(SensorEvent sensorEvent) {
+        int type = sensorEvent.sensor.getType();
+        if (type == 1) {
+            updateAccValue(sensorEvent);
+        } else if (type == 10) {
+            updateLinearAccelValue(sensorEvent);
+        }
+    }
+
+    private void updateLinearAccelValue(SensorEvent sensorEvent) {
+        int i = 0;
+        while (true) {
+            if (i >= 3) {
+                break;
+            } else if (((double) Math.abs(sensorEvent.values[i])) > this.mReferenceAccelaration) {
+                this.mLastOverTime = System.currentTimeMillis();
+                break;
+            } else {
+                i++;
+            }
+        }
+        if (this.mLastOverTime == 0) {
+            this.mLastOverTime = System.currentTimeMillis();
+        }
+    }
+
+    private void updateAccValue(SensorEvent sensorEvent) {
+        this.mIsValidValue = true;
+        switch (this.mDisplayRotation) {
+            case 0:
+                this.mPosX = sensorEvent.values[0];
+                this.mPosY = sensorEvent.values[1];
+                break;
+            case 1:
+                this.mPosX = -sensorEvent.values[1];
+                this.mPosY = sensorEvent.values[0];
+                break;
+            case 2:
+                this.mPosX = -sensorEvent.values[0];
+                this.mPosY = -sensorEvent.values[1];
+                break;
+            case 3:
+                this.mPosX = sensorEvent.values[1];
+                this.mPosY = -sensorEvent.values[0];
+                break;
+        }
+        float f = sensorEvent.values[0];
+        float f2 = sensorEvent.values[1];
+        float f3 = sensorEvent.values[2];
+        this.mPreD0 = f;
+        this.mPreD1 = f2;
+        this.mPreD2 = f3;
+        if (((float) (Math.pow((double) (this.mPreD0 - f), 2.0d) + Math.pow((double) (this.mPreD1 - f2), 2.0d) + Math.pow((double) (this.mPreD2 - f3), 2.0d))) > this.m2BaseValue) {
+            this.mLastOverTime2 = System.currentTimeMillis();
+        }
+    }
+
+    public long getLastOverTime2() {
+        return this.mLastOverTime2;
+    }
+
+    public long getLastAccelOverTime() {
+        return this.mLastOverTime;
+    }
+}

+ 91 - 0
app/src/main/java/com/epson/cameracopy/device/CameraFile.java

@@ -0,0 +1,91 @@
+package com.epson.cameracopy.device;
+
+import com.epson.cameracopy.alt.FileUtils;
+import java.io.File;
+import java.io.IOException;
+import java.io.Serializable;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+public class CameraFile implements Serializable {
+    static final /* synthetic */ boolean $assertionsDisabled = false;
+    private static final long serialVersionUID = 1;
+    private File mDstFile;
+    private final Date mFileCreateDate;
+    private String mTempFileName;
+
+    public CameraFile(Date date, String str) {
+        this.mFileCreateDate = date;
+        this.mTempFileName = str;
+    }
+
+    public String getFileName(String str) {
+        File file = new File(str);
+        if ((!file.exists() && !file.mkdirs()) || !file.isDirectory()) {
+            return null;
+        }
+        String format = new SimpleDateFormat("yyyyMMddHHmm", Locale.US).format(this.mFileCreateDate);
+        for (int i = 0; i < 100; i++) {
+            File file2 = new File(file, String.format(Locale.US, "%s_%02d.jpg", new Object[]{format, Integer.valueOf(i)}));
+            if (!file2.exists()) {
+                return file2.toString();
+            }
+        }
+        return null;
+    }
+
+    public boolean moveTo(String str) {
+        String fileName;
+        if (this.mTempFileName == null || (fileName = getFileName(str)) == null) {
+            return false;
+        }
+        File file = new File(this.mTempFileName);
+        File file2 = new File(fileName);
+        if (file.renameTo(file2)) {
+            this.mDstFile = file2;
+            this.mTempFileName = null;
+            return true;
+        }
+        try {
+            FileUtils.copy(file, file2);
+            file.delete();
+            this.mDstFile = file2;
+            this.mTempFileName = null;
+            return true;
+        } catch (IOException unused) {
+            return false;
+        }
+    }
+
+    public boolean isMovable() {
+        return this.mTempFileName != null;
+    }
+
+    public String getValidFileName() {
+        String str = this.mTempFileName;
+        if (str != null) {
+            return str;
+        }
+        File file = this.mDstFile;
+        if (file != null) {
+            return file.toString();
+        }
+        return null;
+    }
+
+    public boolean isMoved() {
+        return this.mDstFile != null;
+    }
+
+    public void deleteTemporaryFile() {
+        String str = this.mTempFileName;
+        if (str != null) {
+            File file = new File(str);
+            if (file.exists()) {
+                file.delete();
+            }
+            this.mTempFileName = null;
+        }
+    }
+}

+ 153 - 0
app/src/main/java/com/epson/cameracopy/device/CameraPreviewControl.java

@@ -0,0 +1,153 @@
+package com.epson.cameracopy.device;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.graphics.Point;
+import android.hardware.Camera;
+import android.os.Environment;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+public class CameraPreviewControl {
+    @SuppressLint({"SdCardPath"})
+    private static String DEFAULT_SAVE_DIRECTORY = "/EpsonCameraCapture";
+    private static final String KEY_AUTO_PICTURE_MODE = "auto_picture_mode";
+    private static final String KEY_GUIDE_MODE = "guide_mode";
+    private static final String KEY_PICTURE_HEIGHT = "picture_size_height";
+    private static final String KEY_PICTURE_RESOLUTION_MODE = "picture_resolution_mode";
+    private static final String KEY_PICTURE_SIZE_LIST = "picture_size_list";
+    private static final String KEY_PICTURE_WIDTH = "picture_size_width";
+    private static final String KEY_SAVE_DIRECTORY = "save_directory";
+    public static final int PICTURE_RESOLUTION_MODE_AUTO = 0;
+    public static final int PICTURE_RESOLUTION_MODE_MANUAL = 1;
+    private static final String PREFS_NAME = "camera_preview_option";
+    private static CameraPreviewControl sCameraPreviewControl;
+    private final Context mContext;
+
+    public static CameraPreviewControl getInstance(Context context) {
+        if (sCameraPreviewControl == null) {
+            sCameraPreviewControl = new CameraPreviewControl(context);
+        }
+        return sCameraPreviewControl;
+    }
+
+    private CameraPreviewControl(Context context) {
+        this.mContext = context.getApplicationContext();
+    }
+
+    public static boolean hasBackCamera() {
+        int numberOfCameras = Camera.getNumberOfCameras();
+        Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
+        for (int i = 0; i < numberOfCameras; i++) {
+            Camera.getCameraInfo(i, cameraInfo);
+            if (cameraInfo.facing == 0) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public boolean hasAutoPictureHardware(Context context) {
+        if (hasBackCamera() && AptSensorAdapter.hasAptSensor(context)) {
+            return true;
+        }
+        return false;
+    }
+
+    public boolean getGuideMode() {
+        return this.mContext.getSharedPreferences(PREFS_NAME, 0).getBoolean(KEY_GUIDE_MODE, true);
+    }
+
+    public void setGuideMode(boolean z) {
+        this.mContext.getSharedPreferences(PREFS_NAME, 0).edit().putBoolean(KEY_GUIDE_MODE, z).commit();
+    }
+
+    public boolean getAutoPictureMode() {
+        return this.mContext.getSharedPreferences(PREFS_NAME, 0).getBoolean(KEY_AUTO_PICTURE_MODE, false);
+    }
+
+    public void setAutoPictureMode(Boolean bool) {
+        this.mContext.getSharedPreferences(PREFS_NAME, 0).edit().putBoolean(KEY_AUTO_PICTURE_MODE, bool.booleanValue()).commit();
+    }
+
+    public String getSaveDirecotry() {
+        return this.mContext.getSharedPreferences(PREFS_NAME, 0).getString(KEY_SAVE_DIRECTORY, Environment.getExternalStorageDirectory().getAbsolutePath() + DEFAULT_SAVE_DIRECTORY);
+    }
+
+    public void setSaveDirecotry(String str) {
+        this.mContext.getSharedPreferences(PREFS_NAME, 0).edit().putString(KEY_SAVE_DIRECTORY, str).commit();
+    }
+
+    public void setPictureSize(Camera.Size size) {
+        if (size != null) {
+            setPictureSize(new Point(size.width, size.height));
+        }
+    }
+
+    public void setPictureSize(Point point) {
+        if (point != null) {
+            SharedPreferences.Editor edit = this.mContext.getSharedPreferences(PREFS_NAME, 0).edit();
+            edit.putInt(KEY_PICTURE_WIDTH, point.x);
+            edit.putInt(KEY_PICTURE_HEIGHT, point.y);
+            edit.commit();
+            setPictureResolutionMode(1);
+        }
+    }
+
+    public Point getPictureSize() {
+        Point point = new Point();
+        SharedPreferences sharedPreferences = this.mContext.getSharedPreferences(PREFS_NAME, 0);
+        point.x = sharedPreferences.getInt(KEY_PICTURE_WIDTH, -1);
+        point.y = sharedPreferences.getInt(KEY_PICTURE_HEIGHT, -1);
+        return point;
+    }
+
+    public int getPictureResolutionMode() {
+        return this.mContext.getSharedPreferences(PREFS_NAME, 0).getInt(KEY_PICTURE_RESOLUTION_MODE, 0);
+    }
+
+    private void setPictureResolutionMode(int i) {
+        this.mContext.getSharedPreferences(PREFS_NAME, 0).edit().putInt(KEY_PICTURE_RESOLUTION_MODE, i).commit();
+    }
+
+    public void setPictureResolutionModeAuto() {
+        setPictureResolutionMode(0);
+    }
+
+    public void setCameraPictureSizes(List<Camera.Size> list) {
+        if (list != null) {
+            StringBuilder sb = new StringBuilder();
+            for (Camera.Size next : list) {
+                if (sb.length() > 0) {
+                    sb.append(":");
+                }
+                sb.append(Integer.toString(next.width));
+                sb.append(PreferencesConstants.COOKIE_DELIMITER);
+                sb.append(Integer.toString(next.height));
+            }
+            this.mContext.getSharedPreferences(PREFS_NAME, 0).edit().putString(KEY_PICTURE_SIZE_LIST, sb.toString()).commit();
+        }
+    }
+
+    public List<Point> getCameraPictureSizes() {
+        String[] split = this.mContext.getSharedPreferences(PREFS_NAME, 0).getString(KEY_PICTURE_SIZE_LIST, "").split(":");
+        ArrayList arrayList = new ArrayList();
+        for (String split2 : split) {
+            String[] split3 = split2.split(PreferencesConstants.COOKIE_DELIMITER);
+            if (split3.length >= 2) {
+                int parseInt = Integer.parseInt(split3[0]);
+                int parseInt2 = Integer.parseInt(split3[1]);
+                if (parseInt > 0 && parseInt2 > 0) {
+                    arrayList.add(new Point(parseInt, parseInt2));
+                }
+            }
+        }
+        return arrayList;
+    }
+
+    public static String getPictureSizeString(int i, int i2) {
+        return String.format(Locale.US, "%4.1fM %dx%d", new Object[]{Double.valueOf(((double) (i2 * i)) / 1000000.0d), Integer.valueOf(i), Integer.valueOf(i2)});
+    }
+}

+ 55 - 0
app/src/main/java/com/epson/cameracopy/device/CameraSizeList.java

@@ -0,0 +1,55 @@
+package com.epson.cameracopy.device;
+
+import android.hardware.Camera;
+import java.util.Iterator;
+import java.util.List;
+
+public class CameraSizeList implements Iterable<SizeWrapper> {
+    List<Camera.Size> mCameraSizeList;
+
+    public static class CameraSizeWarpper implements SizeWrapper {
+        static final /* synthetic */ boolean $assertionsDisabled = false;
+        Camera.Size mCameraSize;
+
+        static {
+            Class<CameraSizeList> cls = CameraSizeList.class;
+        }
+
+        public CameraSizeWarpper(Camera.Size size) {
+            this.mCameraSize = size;
+        }
+
+        public int getWidth() {
+            return this.mCameraSize.width;
+        }
+
+        public int getHeight() {
+            return this.mCameraSize.height;
+        }
+    }
+
+    public CameraSizeList(List<Camera.Size> list) {
+        this.mCameraSizeList = list;
+    }
+
+    public Iterator<SizeWrapper> iterator() {
+        return new Iterator<SizeWrapper>() {
+            int mIndex = 0;
+
+            public void remove() {
+            }
+
+            public boolean hasNext() {
+                return this.mIndex < CameraSizeList.this.mCameraSizeList.size();
+            }
+
+            public SizeWrapper next() {
+                if (this.mIndex >= CameraSizeList.this.mCameraSizeList.size()) {
+                    return null;
+                }
+                this.mIndex++;
+                return new CameraSizeWarpper(CameraSizeList.this.mCameraSizeList.get(this.mIndex));
+            }
+        };
+    }
+}

+ 27 - 0
app/src/main/java/com/epson/cameracopy/device/Log.java

@@ -0,0 +1,27 @@
+package com.epson.cameracopy.device;
+
+public class Log {
+    /* renamed from: d */
+    public static void m52d(String str, String str2) {
+    }
+
+    /* renamed from: e */
+    public static void m53e(String str, String str2) {
+    }
+
+    /* renamed from: e */
+    public static void m54e(String str, String str2, Throwable th) {
+    }
+
+    /* renamed from: i */
+    public static void m55i(String str, String str2) {
+    }
+
+    /* renamed from: v */
+    public static void m56v(String str, String str2) {
+    }
+
+    /* renamed from: w */
+    public static void m57w(String str, String str2) {
+    }
+}

+ 215 - 0
app/src/main/java/com/epson/cameracopy/device/OpenCvCameraView.java

@@ -0,0 +1,215 @@
+package com.epson.cameracopy.device;
+
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.hardware.Camera;
+import android.util.AttributeSet;
+
+public class OpenCvCameraView extends PortraitCameraView implements Camera.PictureCallback, Camera.ShutterCallback, Camera.AutoFocusCallback {
+    private static final String TAG = "OpenCvCameraView";
+    private AutoFocusCallBack mAutoFocusCallBack;
+    private boolean mHasAutoFocus;
+    private volatile boolean mInAutofocus;
+    private String mPictureFileName;
+    private MyPictureTakeCallback mPictureTakeCallback;
+    private boolean mPictureTaking;
+    private boolean mTakePictuerAutofocus;
+
+    public interface AutoFocusCallBack {
+        void onAutoFocusCompleted(boolean z);
+    }
+
+    public interface MyPictureTakeCallback {
+        void onMyPictureTaken(boolean z, String str);
+    }
+
+    public void onShutter() {
+    }
+
+    public void setDisplayOriantation(int i) {
+    }
+
+    public boolean isInAutofocus() {
+        return this.mInAutofocus;
+    }
+
+    public OpenCvCameraView(Context context, AttributeSet attributeSet) {
+        super(context, attributeSet);
+        PackageManager packageManager = context.getPackageManager();
+        if (packageManager != null) {
+            this.mHasAutoFocus = packageManager.hasSystemFeature("android.hardware.camera.autofocus");
+        }
+    }
+
+    public Camera getCamera() {
+        return this.mCamera;
+    }
+
+    /* JADX WARNING: Removed duplicated region for block: B:18:0x0037 A[Catch:{ all -> 0x0061 }] */
+    /* JADX WARNING: Removed duplicated region for block: B:20:0x003c A[SYNTHETIC, Splitter:B:20:0x003c] */
+    /* JADX WARNING: Removed duplicated region for block: B:27:0x0052  */
+    /* JADX WARNING: Removed duplicated region for block: B:30:0x0057  */
+    /* JADX WARNING: Removed duplicated region for block: B:35:0x0064 A[SYNTHETIC, Splitter:B:35:0x0064] */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    public void onPictureTaken(byte[] r4, android.hardware.Camera r5) {
+        /*
+            r3 = this;
+            android.hardware.Camera r5 = r3.mCamera
+            r5.startPreview()
+            android.hardware.Camera r5 = r3.mCamera
+            r5.setPreviewCallback(r3)
+            r5 = 0
+            r0 = 0
+            java.io.FileOutputStream r1 = new java.io.FileOutputStream     // Catch:{ IOException -> 0x0025, all -> 0x0022 }
+            java.lang.String r2 = r3.mPictureFileName     // Catch:{ IOException -> 0x0025, all -> 0x0022 }
+            r1.<init>(r2)     // Catch:{ IOException -> 0x0025, all -> 0x0022 }
+            r1.write(r4)     // Catch:{ IOException -> 0x0020 }
+            r1.close()     // Catch:{ IOException -> 0x001a }
+            goto L_0x001e
+        L_0x001a:
+            r4 = move-exception
+            r4.printStackTrace()
+        L_0x001e:
+            r4 = 1
+            goto L_0x0045
+        L_0x0020:
+            r4 = move-exception
+            goto L_0x0027
+        L_0x0022:
+            r4 = move-exception
+            r1 = r5
+            goto L_0x0062
+        L_0x0025:
+            r4 = move-exception
+            r1 = r5
+        L_0x0027:
+            r4.printStackTrace()     // Catch:{ all -> 0x0061 }
+            java.io.File r4 = new java.io.File     // Catch:{ all -> 0x0061 }
+            java.lang.String r2 = r3.mPictureFileName     // Catch:{ all -> 0x0061 }
+            r4.<init>(r2)     // Catch:{ all -> 0x0061 }
+            boolean r2 = r4.exists()     // Catch:{ all -> 0x0061 }
+            if (r2 == 0) goto L_0x003a
+            r4.delete()     // Catch:{ all -> 0x0061 }
+        L_0x003a:
+            if (r1 == 0) goto L_0x0044
+            r1.close()     // Catch:{ IOException -> 0x0040 }
+            goto L_0x0044
+        L_0x0040:
+            r4 = move-exception
+            r4.printStackTrace()
+        L_0x0044:
+            r4 = 0
+        L_0x0045:
+            java.io.File r1 = new java.io.File
+            java.lang.String r2 = r3.mPictureFileName
+            r1.<init>(r2)
+            boolean r1 = r1.exists()
+            if (r1 != 0) goto L_0x0053
+            r4 = 0
+        L_0x0053:
+            com.epson.cameracopy.device.OpenCvCameraView$MyPictureTakeCallback r1 = r3.mPictureTakeCallback
+            if (r1 == 0) goto L_0x005e
+            java.lang.String r2 = r3.mPictureFileName
+            r1.onMyPictureTaken(r4, r2)
+            r3.mPictureTakeCallback = r5
+        L_0x005e:
+            r3.mPictureTaking = r0
+            return
+        L_0x0061:
+            r4 = move-exception
+        L_0x0062:
+            if (r1 == 0) goto L_0x006c
+            r1.close()     // Catch:{ IOException -> 0x0068 }
+            goto L_0x006c
+        L_0x0068:
+            r5 = move-exception
+            r5.printStackTrace()
+        L_0x006c:
+            throw r4
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.device.OpenCvCameraView.onPictureTaken(byte[], android.hardware.Camera):void");
+    }
+
+    public synchronized void takePicture(String str, MyPictureTakeCallback myPictureTakeCallback) {
+        this.mPictureTaking = true;
+        if (!this.mInAutofocus) {
+            this.mInAutofocus = true;
+            this.mPictureFileName = str;
+            this.mPictureTakeCallback = myPictureTakeCallback;
+            if (!this.mHasAutoFocus) {
+                this.mCamera.setPreviewCallback((Camera.PreviewCallback) null);
+                this.mCamera.takePicture(this, (Camera.PictureCallback) null, this);
+                this.mPictureTaking = false;
+                this.mInAutofocus = false;
+                return;
+            }
+            this.mTakePictuerAutofocus = true;
+            localAutofocus();
+        }
+    }
+
+    private void localAutofocus() {
+        if (!this.mHasAutoFocus) {
+            this.mInAutofocus = false;
+            return;
+        }
+        try {
+            this.mCamera.autoFocus(this);
+        } catch (Exception unused) {
+            onAutoFocus(false, this.mCamera);
+        }
+    }
+
+    private void localCancelAutofocus() {
+        if (!this.mHasAutoFocus) {
+            this.mInAutofocus = false;
+        } else if (this.mCamera != null) {
+            this.mCamera.cancelAutoFocus();
+        }
+    }
+
+    public void onAutoFocus(boolean z, Camera camera) {
+        if (this.mTakePictuerAutofocus) {
+            this.mTakePictuerAutofocus = false;
+            this.mCamera.setPreviewCallback((Camera.PreviewCallback) null);
+            this.mCamera.takePicture(this, (Camera.PictureCallback) null, this);
+        } else {
+            AutoFocusCallBack autoFocusCallBack = this.mAutoFocusCallBack;
+            if (autoFocusCallBack != null) {
+                autoFocusCallBack.onAutoFocusCompleted(z);
+                this.mAutoFocusCallBack = null;
+            }
+        }
+        this.mInAutofocus = false;
+    }
+
+    public synchronized void doAutofocus(AutoFocusCallBack autoFocusCallBack) {
+        if (!this.mInAutofocus && !this.mPictureTaking) {
+            this.mAutoFocusCallBack = autoFocusCallBack;
+            this.mInAutofocus = true;
+            localAutofocus();
+        }
+    }
+
+    public void cancelAutofocus() {
+        localCancelAutofocus();
+        this.mInAutofocus = false;
+        this.mAutoFocusCallBack = null;
+        this.mTakePictuerAutofocus = false;
+        this.mPictureTaking = false;
+        this.mPictureTakeCallback = null;
+    }
+
+    public void enableView() {
+        super.enableView();
+        this.mInAutofocus = false;
+        this.mPictureTaking = false;
+    }
+
+    public float getScale() {
+        if (this.mScale <= 0.0f) {
+            return 1.0f;
+        }
+        return this.mScale;
+    }
+}

+ 118 - 0
app/src/main/java/com/epson/cameracopy/device/PaperContourDetector.java

@@ -0,0 +1,118 @@
+package com.epson.cameracopy.device;
+
+import android.util.Pair;
+import java.util.ArrayList;
+import java.util.List;
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfPoint;
+import org.opencv.core.MatOfPoint2f;
+import org.opencv.core.Point;
+import org.opencv.core.Size;
+import org.opencv.imgproc.Imgproc;
+
+public class PaperContourDetector {
+    private static final double DETECT_AREA_RATIO = 0.8d;
+
+    public static Pair<Point[], Boolean> detectPaperContour(Mat mat) {
+        List<MatOfPoint> findPaperContourCandidate = findPaperContourCandidate(mat);
+        if (findPaperContourCandidate.size() <= 0) {
+            return null;
+        }
+        return findPaperRect(mat, findMax(findPaperContourCandidate));
+    }
+
+    public static List<MatOfPoint> findPaperContourCandidate(Mat mat) {
+        Mat mat2 = new Mat();
+        Imgproc.Canny(mat, mat2, 1.0d, 120.0d);
+        Mat mat3 = new Mat();
+        Imgproc.morphologyEx(mat2, mat2, 4, mat3, new Point(-1.0d, -1.0d), 1);
+        mat3.release();
+        ArrayList arrayList = new ArrayList();
+        Mat mat4 = new Mat();
+        Imgproc.findContours(mat2, arrayList, mat4, 1, 4);
+        mat4.release();
+        mat2.release();
+        return arrayList;
+    }
+
+    private static MatOfPoint findMax(List<MatOfPoint> list) {
+        double d = 0.0d;
+        MatOfPoint matOfPoint = null;
+        for (MatOfPoint next : list) {
+            if (next.cols() * next.rows() >= 4) {
+                double contourArea = Imgproc.contourArea(next);
+                if (contourArea > d) {
+                    matOfPoint = next;
+                    d = contourArea;
+                }
+            }
+        }
+        return matOfPoint;
+    }
+
+    private static Pair<Point[], Boolean> findPaperRect(Mat mat, MatOfPoint matOfPoint) {
+        boolean z;
+        if (matOfPoint == null || matOfPoint.rows() < 1 || matOfPoint.cols() < 1) {
+            return null;
+        }
+        MatOfPoint2f matOfPoint2f = new MatOfPoint2f(matOfPoint.toArray());
+        MatOfPoint2f matOfPoint2f2 = new MatOfPoint2f();
+        for (int i = 300; i >= 100; i -= 100) {
+            Imgproc.approxPolyDP(matOfPoint2f, matOfPoint2f2, (double) i, true);
+            if (matOfPoint2f2.rows() * matOfPoint2f2.cols() >= 4) {
+                break;
+            }
+        }
+        matOfPoint2f.release();
+        Point[] array = matOfPoint2f2.toArray();
+        MatOfPoint matOfPoint2 = new MatOfPoint(array);
+        if (array.length == 4) {
+            matOfPoint2f2.release();
+            boolean isContourConvex = Imgproc.isContourConvex(matOfPoint2);
+            matOfPoint2.release();
+            if (!isContourConvex) {
+                return null;
+            }
+            Size size = mat.size();
+            double d = size.width;
+            double d2 = size.height;
+            int length = array.length;
+            double d3 = 0.0d;
+            double d4 = d2;
+            double d5 = 0.0d;
+            double d6 = d;
+            int i2 = 0;
+            while (true) {
+                if (i2 >= length) {
+                    z = true;
+                    break;
+                }
+                Point point = array[i2];
+                int i3 = i2;
+                if (size.width <= 1.0d && size.height <= 1.0d) {
+                    z = false;
+                    break;
+                }
+                if (d6 > point.f432x) {
+                    d6 = point.f432x;
+                }
+                if (d3 < point.f432x) {
+                    d3 = point.f432x;
+                }
+                if (d4 > point.f433y) {
+                    d4 = point.f433y;
+                }
+                if (d5 < point.f433y) {
+                    d5 = point.f433y;
+                }
+                i2 = i3 + 1;
+            }
+            if (z) {
+                z = (d3 - d6) / size.width >= DETECT_AREA_RATIO || (d5 - d4) / size.height >= DETECT_AREA_RATIO;
+            }
+            return new Pair<>(array, Boolean.valueOf(z));
+        }
+        int length2 = array.length;
+        return null;
+    }
+}

+ 640 - 0
app/src/main/java/com/epson/cameracopy/device/PortraitCameraView.java

@@ -0,0 +1,640 @@
+package com.epson.cameracopy.device;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.ImageFormat;
+import android.graphics.Point;
+import android.graphics.SurfaceTexture;
+import android.hardware.Camera;
+import android.os.Build;
+import android.util.AttributeSet;
+import android.view.SurfaceHolder;
+import epson.common.ImageUtil;
+import java.util.ArrayList;
+import java.util.List;
+import org.opencv.android.CameraBridgeViewBase;
+import org.opencv.core.Core;
+import org.opencv.core.CvType;
+import org.opencv.core.Mat;
+import org.opencv.imgproc.Imgproc;
+
+public class PortraitCameraView extends CameraBridgeViewBase implements Camera.PreviewCallback {
+    @SuppressLint({"InlinedApi"})
+    private static final String[] FAVORITE_FOCUS_MODES = {"continuous-video", "continuous-picture", "auto"};
+    private static final int MAGIC_TEXTURE_ID = 10;
+    private static final String TAG = "portCameraView";
+    private byte[] mBuffer;
+    protected Camera mCamera;
+    protected JavaCameraFrame[] mCameraFrame;
+    /* access modifiers changed from: private */
+    public boolean mCameraFrameReady = false;
+    /* access modifiers changed from: private */
+    public int mChainIdx = 0;
+    /* access modifiers changed from: private */
+    public Mat[] mFrameChain;
+    /* access modifiers changed from: private */
+    public boolean mStopThread;
+    private SurfaceTexture mSurfaceTexture;
+    private Thread mThread;
+
+    private boolean isInRange(double d, double d2, double d3) {
+        return d - d2 <= d3 && d + d2 >= d3;
+    }
+
+    public static class JavaCameraSizeAccessor implements CameraBridgeViewBase.ListItemAccessor {
+        public int getWidth(Object obj) {
+            return ((Camera.Size) obj).width;
+        }
+
+        public int getHeight(Object obj) {
+            return ((Camera.Size) obj).height;
+        }
+    }
+
+    public PortraitCameraView(Context context, int i) {
+        super(context, i);
+    }
+
+    public PortraitCameraView(Context context, AttributeSet attributeSet) {
+        super(context, attributeSet);
+    }
+
+    /* access modifiers changed from: protected */
+    /* JADX WARNING: Removed duplicated region for block: B:12:0x0024  */
+    /* JADX WARNING: Removed duplicated region for block: B:17:0x002e  */
+    /* JADX WARNING: Removed duplicated region for block: B:30:0x007a  */
+    /* JADX WARNING: Removed duplicated region for block: B:9:0x001a  */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    public org.opencv.core.Size calculateCameraFrameSize(java.util.List<?> r19, org.opencv.android.CameraBridgeViewBase.ListItemAccessor r20, int r21, int r22) {
+        /*
+            r18 = this;
+            r7 = r18
+            r8 = r20
+            int r0 = r7.mMaxWidth
+            r1 = -1
+            if (r0 == r1) goto L_0x0013
+            int r0 = r7.mMaxWidth
+            r2 = r21
+            if (r0 >= r2) goto L_0x0015
+            int r0 = r7.mMaxWidth
+            r9 = r0
+            goto L_0x0016
+        L_0x0013:
+            r2 = r21
+        L_0x0015:
+            r9 = r2
+        L_0x0016:
+            int r0 = r7.mMaxHeight
+            if (r0 == r1) goto L_0x0024
+            int r0 = r7.mMaxHeight
+            r1 = r22
+            if (r0 >= r1) goto L_0x0026
+            int r0 = r7.mMaxHeight
+            r10 = r0
+            goto L_0x0027
+        L_0x0024:
+            r1 = r22
+        L_0x0026:
+            r10 = r1
+        L_0x0027:
+            r12 = 0
+        L_0x0028:
+            int r0 = r19.size()
+            if (r12 >= r0) goto L_0x006c
+            r13 = r19
+            java.lang.Object r0 = r13.get(r12)
+            int r1 = r8.getWidth(r0)
+            int r0 = r8.getHeight(r0)
+            r2 = 650(0x28a, float:9.11E-43)
+            if (r1 >= r2) goto L_0x0067
+            r2 = 300(0x12c, float:4.2E-43)
+            if (r1 < r2) goto L_0x0067
+            r2 = 4608683618675807573(0x3ff5555555555555, double:1.3333333333333333)
+            r4 = 4585925428558828667(0x3fa47ae147ae147b, double:0.04)
+            double r14 = (double) r1
+            double r0 = (double) r0
+            double r16 = r14 / r0
+            r22 = r12
+            r11 = r0
+            r0 = r18
+            r1 = r2
+            r3 = r4
+            r5 = r16
+            boolean r0 = r0.isInRange(r1, r3, r5)
+            if (r0 == 0) goto L_0x0069
+            org.opencv.core.Size r0 = new org.opencv.core.Size
+            r0.<init>(r14, r11)
+            return r0
+        L_0x0067:
+            r22 = r12
+        L_0x0069:
+            int r12 = r22 + 1
+            goto L_0x0028
+        L_0x006c:
+            r13 = r19
+            java.util.Iterator r0 = r19.iterator()
+            r1 = 0
+            r2 = 0
+        L_0x0074:
+            boolean r3 = r0.hasNext()
+            if (r3 == 0) goto L_0x0091
+            java.lang.Object r3 = r0.next()
+            int r4 = r8.getWidth(r3)
+            int r3 = r8.getHeight(r3)
+            if (r4 > r9) goto L_0x0074
+            if (r3 > r10) goto L_0x0074
+            if (r4 < r1) goto L_0x0074
+            if (r3 < r2) goto L_0x0074
+            r2 = r3
+            r1 = r4
+            goto L_0x0074
+        L_0x0091:
+            org.opencv.core.Size r0 = new org.opencv.core.Size
+            double r3 = (double) r1
+            double r1 = (double) r2
+            r0.<init>(r3, r1)
+            return r0
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.device.PortraitCameraView.calculateCameraFrameSize(java.util.List, org.opencv.android.CameraBridgeViewBase$ListItemAccessor, int, int):org.opencv.core.Size");
+    }
+
+    /* access modifiers changed from: package-private */
+    public Camera.Size selectPreviewSize(List<Camera.Size> list, double d) {
+        Camera.Size size = null;
+        double d2 = 0.0d;
+        for (Camera.Size next : list) {
+            if (Math.abs((((double) next.width) / ((double) next.height)) - d) < 0.05d) {
+                double d3 = ((double) (next.width * next.height)) / 307200.0d;
+                if (d3 > 1.0d) {
+                    d3 = 1.0d / d3;
+                }
+                if (d3 > d2) {
+                    size = next;
+                    d2 = d3;
+                }
+            }
+        }
+        return size;
+    }
+
+    /* access modifiers changed from: protected */
+    public boolean setPreviewSize(List<Camera.Size> list, Camera.Parameters parameters) {
+        Point screenSize = getScreenSize();
+        Camera.Size selectPreviewSize = selectPreviewSize(list, ((double) screenSize.y) / ((double) screenSize.x));
+        if (selectPreviewSize == null) {
+            return false;
+        }
+        parameters.setPreviewSize(selectPreviewSize.width, selectPreviewSize.height);
+        return true;
+    }
+
+    /* access modifiers changed from: package-private */
+    public Point getScreenSize() {
+        return ImageUtil.getDisplaySize(((Activity) getContext()).getWindowManager().getDefaultDisplay());
+    }
+
+    /* access modifiers changed from: protected */
+    @SuppressLint({"NewApi"})
+    public boolean initializeCamera(int i, int i2) {
+        boolean z;
+        Log.m52d(TAG, "Initialize java camera");
+        synchronized (this) {
+            this.mCamera = openBackCamera();
+            z = false;
+            if (this.mCamera == null) {
+                return false;
+            }
+            try {
+                Camera.Parameters parameters = this.mCamera.getParameters();
+                Log.m52d(TAG, "getSupportedPreviewSizes()");
+                List<Camera.Size> supportedPreviewSizes = parameters.getSupportedPreviewSizes();
+                if (supportedPreviewSizes != null) {
+                    parameters.setPreviewFormat(17);
+                    if (!setPictureAndPreviewResolutionManualMode(parameters)) {
+                        setPreviewSize(supportedPreviewSizes, parameters);
+                        setPictureSize(parameters.getPreviewSize(), parameters);
+                    }
+                    parameters.setJpegQuality(95);
+                    int i3 = Build.VERSION.SDK_INT;
+                    setForcusMode(parameters);
+                    parameters.setRotation(90);
+                    this.mCamera.setParameters(parameters);
+                    Camera.Parameters parameters2 = this.mCamera.getParameters();
+                    this.mFrameWidth = parameters2.getPreviewSize().height;
+                    this.mFrameHeight = parameters2.getPreviewSize().width;
+                    int i4 = this.mFrameHeight;
+                    int i5 = this.mFrameWidth;
+                    if (getLayoutParams().width == -1 && getLayoutParams().height == -1) {
+                        this.mScale = Math.min(((float) i2) / ((float) this.mFrameHeight), ((float) i) / ((float) this.mFrameWidth));
+                    } else {
+                        this.mScale = 0.0f;
+                    }
+                    if (this.mFpsMeter != null) {
+                        this.mFpsMeter.setResolution(this.mFrameWidth, this.mFrameHeight);
+                    }
+                    this.mBuffer = new byte[(((this.mFrameWidth * this.mFrameHeight) * ImageFormat.getBitsPerPixel(parameters2.getPreviewFormat())) / 8)];
+                    this.mCamera.addCallbackBuffer(this.mBuffer);
+                    this.mCamera.setPreviewCallbackWithBuffer(this);
+                    this.mFrameChain = new Mat[2];
+                    this.mFrameChain[0] = new Mat((i5 / 2) + i5, i4, CvType.CV_8UC1);
+                    this.mFrameChain[1] = new Mat(i5 + (i5 / 2), i4, CvType.CV_8UC1);
+                    AllocateCache();
+                    this.mCameraFrame = new JavaCameraFrame[2];
+                    this.mCameraFrame[0] = new JavaCameraFrame(this.mFrameChain[0], this.mFrameWidth, this.mFrameHeight);
+                    this.mCameraFrame[1] = new JavaCameraFrame(this.mFrameChain[1], this.mFrameWidth, this.mFrameHeight);
+                    if (Build.VERSION.SDK_INT >= 11) {
+                        this.mSurfaceTexture = new SurfaceTexture(10);
+                        this.mCamera.setPreviewTexture(this.mSurfaceTexture);
+                    } else {
+                        this.mCamera.setPreviewDisplay((SurfaceHolder) null);
+                    }
+                    Log.m52d(TAG, "startPreview");
+                    this.mCamera.startPreview();
+                    z = true;
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return z;
+    }
+
+    private static Camera openBackCamera() {
+        int numberOfCameras = Camera.getNumberOfCameras();
+        Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
+        Camera camera = null;
+        boolean z = false;
+        for (int i = 0; i < numberOfCameras; i++) {
+            Camera.getCameraInfo(i, cameraInfo);
+            if (cameraInfo.facing == 0) {
+                try {
+                    camera = Camera.open(i);
+                    z = true;
+                } catch (RuntimeException e) {
+                    Log.m53e(TAG, "Camera #" + i + "failed to open: " + e.getMessage());
+                }
+                if (z) {
+                    return camera;
+                }
+            }
+        }
+        return null;
+    }
+
+    public boolean checkBackCamera() {
+        disconnectCamera();
+        Camera openBackCamera = openBackCamera();
+        if (openBackCamera == null) {
+            return false;
+        }
+        openBackCamera.release();
+        return true;
+    }
+
+    /* access modifiers changed from: package-private */
+    public void setForcusMode(Camera.Parameters parameters) {
+        boolean autoPictureMode = CameraPreviewControl.getInstance(getContext()).getAutoPictureMode();
+        List<String> supportedFocusModes = parameters.getSupportedFocusModes();
+        if (supportedFocusModes != null) {
+            if (autoPictureMode || !supportedFocusModes.contains("auto")) {
+                for (String str : FAVORITE_FOCUS_MODES) {
+                    if (supportedFocusModes.contains(str)) {
+                        parameters.setFocusMode(str);
+                        return;
+                    }
+                }
+                return;
+            }
+            parameters.setFocusMode("auto");
+        }
+    }
+
+    private Point OLDselectPreviewSizeFromPictureSize(double d, List<Camera.Size> list) {
+        int i;
+        if (list == null || list.size() <= 0 || d <= 0.0d) {
+            return null;
+        }
+        Point point = new Point();
+        for (Camera.Size next : list) {
+            if (next.height * next.width >= 76800 && Math.abs((((double) next.width) / ((double) next.height)) - d) < 0.05d && next.width > point.x) {
+                point.x = next.width;
+                point.y = next.height;
+            }
+        }
+        if (point.x > 0) {
+            return point;
+        }
+        int i2 = 0;
+        Camera.Size size = list.get(0);
+        point.x = size.width;
+        point.y = size.height;
+        double d2 = Double.MAX_VALUE;
+        for (Camera.Size next2 : list) {
+            if (next2.height > 0) {
+                double abs = Math.abs((((double) next2.width) / ((double) next2.height)) - d);
+                if (d2 > abs + 0.05d) {
+                    i2 = next2.width * next2.height;
+                    point.x = next2.width;
+                    point.y = next2.height;
+                    d2 = abs;
+                } else if (d2 > abs - 0.05d && i2 < (i = next2.width * next2.height)) {
+                    point.x = next2.width;
+                    point.y = next2.height;
+                    d2 = abs;
+                    i2 = i;
+                }
+            }
+        }
+        return point;
+    }
+
+    private SizeWrapper selectPreviewSizeFromPictureSize(double d, List<Camera.Size> list) {
+        if (list == null || d <= 0.0d) {
+            return null;
+        }
+        CameraSizeList cameraSizeList = new CameraSizeList(list);
+        int height = getHeight();
+        int width = getWidth();
+        SizeWrapper selectSize01 = PreviewResolutionSelector.selectSize01(d, cameraSizeList, height, width);
+        if (selectSize01 != null) {
+            return selectSize01;
+        }
+        return PreviewResolutionSelector.selectSize02(d, cameraSizeList, height, width);
+    }
+
+    private boolean setPictureAndPreviewResolutionManualMode(Camera.Parameters parameters) {
+        CameraPreviewControl instance = CameraPreviewControl.getInstance(getContext());
+        if (instance.getPictureResolutionMode() != 1) {
+            return false;
+        }
+        Point pictureSize = instance.getPictureSize();
+        if (pictureSize.x <= 0 || pictureSize.y <= 0) {
+            return false;
+        }
+        parameters.setPictureSize(pictureSize.x, pictureSize.y);
+        SizeWrapper selectPreviewSizeFromPictureSize = selectPreviewSizeFromPictureSize(((double) pictureSize.x) / ((double) pictureSize.y), parameters.getSupportedPreviewSizes());
+        if (selectPreviewSizeFromPictureSize != null) {
+            parameters.setPreviewSize(selectPreviewSizeFromPictureSize.getWidth(), selectPreviewSizeFromPictureSize.getHeight());
+        }
+        return true;
+    }
+
+    static void setPictureSize(Camera.Size size, Camera.Parameters parameters) {
+        Camera.Size pictureSize01 = setPictureSize01(parameters.getSupportedPictureSizes(), ((double) size.width) / ((double) size.height));
+        if (pictureSize01 != null) {
+            parameters.setPictureSize(pictureSize01.width, pictureSize01.height);
+        } else {
+            setPictureSize02(size, parameters);
+        }
+    }
+
+    static Camera.Size setPictureSize01(List<Camera.Size> list, double d) {
+        int i = 0;
+        Camera.Size size = null;
+        for (Camera.Size next : list) {
+            if (Math.abs((((double) next.width) / ((double) next.height)) - d) < 0.05d && i < next.width) {
+                i = next.width;
+                size = next;
+            }
+        }
+        return size;
+    }
+
+    static void setPictureSize02(Camera.Size size, Camera.Parameters parameters) {
+        List<Camera.Size> supportedPictureSizes = parameters.getSupportedPictureSizes();
+        ArrayList arrayList = new ArrayList(supportedPictureSizes.size());
+        for (Camera.Size next : supportedPictureSizes) {
+            arrayList.add(new Point(next.width, next.height));
+        }
+        Point selectSize = selectSize(new Point(size.width, size.height), arrayList);
+        if (selectSize != null) {
+            parameters.setPictureSize(selectSize.x, selectSize.y);
+        }
+    }
+
+    static Point selectSize(Point point, List<Point> list) {
+        double d = ((double) point.x) / ((double) point.y);
+        if (list == null) {
+            return null;
+        }
+        double[] dArr = new double[list.size()];
+        for (int i = 0; i < list.size(); i++) {
+            Point point2 = list.get(i);
+            dArr[i] = ((double) point2.x) * ((double) point2.y) * getRate(d, ((double) point2.x) / ((double) point2.y));
+        }
+        int maxIndex = getMaxIndex(dArr);
+        if (maxIndex < 0 || maxIndex >= dArr.length) {
+            return null;
+        }
+        return list.get(maxIndex);
+    }
+
+    static int getMaxIndex(double[] dArr) {
+        if (dArr == null || dArr.length < 1) {
+            return -1;
+        }
+        double d = dArr[0];
+        int i = 0;
+        for (int i2 = 0; i2 < dArr.length; i2++) {
+            double d2 = dArr[i2];
+            if (d < d2) {
+                i = i2;
+                d = d2;
+            }
+        }
+        return i;
+    }
+
+    static double getRate(double d, double d2) {
+        if (d <= 0.0d || d2 <= 0.0d) {
+            return 1.0d;
+        }
+        double d3 = d2 / d;
+        if (d3 > 1.0d) {
+            d3 = 1.0d / d3;
+        }
+        return 1.0d / (Math.pow((d3 - 1.0d) * 10.0d, 2.0d) + 1.0d);
+    }
+
+    public Camera.Size getCameraPictureSize() {
+        Camera camera = this.mCamera;
+        if (camera == null) {
+            return null;
+        }
+        try {
+            Camera.Parameters parameters = camera.getParameters();
+            if (parameters != null) {
+                return parameters.getPictureSize();
+            }
+            return null;
+        } catch (Exception unused) {
+            return null;
+        }
+    }
+
+    public List<Camera.Size> getPictureSizeList() {
+        Camera camera = this.mCamera;
+        if (camera == null) {
+            return null;
+        }
+        try {
+            Camera.Parameters parameters = camera.getParameters();
+            if (parameters == null) {
+                return null;
+            }
+            return parameters.getSupportedPictureSizes();
+        } catch (Exception unused) {
+            return null;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void releaseCamera() {
+        synchronized (this) {
+            if (this.mCamera != null) {
+                this.mCamera.stopPreview();
+                this.mCamera.setPreviewCallback((Camera.PreviewCallback) null);
+                this.mCamera.release();
+            }
+            this.mCamera = null;
+            if (this.mFrameChain != null) {
+                this.mFrameChain[0].release();
+                this.mFrameChain[1].release();
+            }
+            if (this.mCameraFrame != null) {
+                this.mCameraFrame[0].release();
+                this.mCameraFrame[1].release();
+            }
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public boolean connectCamera(int i, int i2) {
+        Log.m52d(TAG, "Connecting to camera");
+        if (!initializeCamera(i, i2)) {
+            return false;
+        }
+        this.mCameraFrameReady = false;
+        Log.m52d(TAG, "Starting processing thread");
+        this.mStopThread = false;
+        this.mThread = new Thread(new CameraWorker(), "CameraWorker");
+        this.mThread.start();
+        return true;
+    }
+
+    /* access modifiers changed from: protected */
+    public void disconnectCamera() {
+        Log.m52d(TAG, "Disconnecting from camera");
+        try {
+            this.mStopThread = true;
+            Log.m52d(TAG, "Notify thread");
+            synchronized (this) {
+                notify();
+            }
+            Log.m52d(TAG, "Wating for thread");
+            if (this.mThread != null) {
+                this.mThread.join();
+            }
+        } catch (InterruptedException e) {
+            try {
+                e.printStackTrace();
+            } catch (Throwable th) {
+                this.mThread = null;
+                throw th;
+            }
+        }
+        this.mThread = null;
+        releaseCamera();
+        this.mCameraFrameReady = false;
+    }
+
+    public void onPreviewFrame(byte[] bArr, Camera camera) {
+        synchronized (this) {
+            this.mFrameChain[this.mChainIdx].put(0, 0, bArr);
+            this.mCameraFrameReady = true;
+            notify();
+        }
+        Camera camera2 = this.mCamera;
+        if (camera2 != null) {
+            camera2.addCallbackBuffer(this.mBuffer);
+        }
+    }
+
+    private class JavaCameraFrame implements CameraBridgeViewBase.CvCameraViewFrame {
+        private int mHeight;
+        private Mat mRgba = new Mat();
+        private Mat mRotated;
+        private int mWidth;
+        private Mat mYuvFrameData;
+
+        public Mat gray() {
+            Mat mat = this.mRotated;
+            if (mat != null) {
+                mat.release();
+            }
+            this.mRotated = this.mYuvFrameData.submat(0, this.mWidth, 0, this.mHeight);
+            this.mRotated = this.mRotated.mo42753t();
+            Mat mat2 = this.mRotated;
+            Core.flip(mat2, mat2, 1);
+            return this.mRotated;
+        }
+
+        public Mat rgba() {
+            Imgproc.cvtColor(this.mYuvFrameData, this.mRgba, 96, 4);
+            Mat mat = this.mRotated;
+            if (mat != null) {
+                mat.release();
+            }
+            this.mRotated = this.mRgba.mo42753t();
+            Mat mat2 = this.mRotated;
+            Core.flip(mat2, mat2, 1);
+            return this.mRotated;
+        }
+
+        public JavaCameraFrame(Mat mat, int i, int i2) {
+            this.mWidth = i;
+            this.mHeight = i2;
+            this.mYuvFrameData = mat;
+        }
+
+        public void release() {
+            this.mRgba.release();
+            Mat mat = this.mRotated;
+            if (mat != null) {
+                mat.release();
+            }
+        }
+    }
+
+    private class CameraWorker implements Runnable {
+        private CameraWorker() {
+        }
+
+        public void run() {
+            boolean z;
+            do {
+                synchronized (PortraitCameraView.this) {
+                    while (!PortraitCameraView.this.mCameraFrameReady && !PortraitCameraView.this.mStopThread) {
+                        try {
+                            PortraitCameraView.this.wait();
+                        } catch (InterruptedException e) {
+                            e.printStackTrace();
+                        }
+                    }
+                    z = false;
+                    if (PortraitCameraView.this.mCameraFrameReady) {
+                        int unused = PortraitCameraView.this.mChainIdx = 1 - PortraitCameraView.this.mChainIdx;
+                        boolean unused2 = PortraitCameraView.this.mCameraFrameReady = false;
+                        z = true;
+                    }
+                }
+                if (!PortraitCameraView.this.mStopThread && z && !PortraitCameraView.this.mFrameChain[1 - PortraitCameraView.this.mChainIdx].empty()) {
+                    PortraitCameraView portraitCameraView = PortraitCameraView.this;
+                    portraitCameraView.deliverAndDrawFrame(portraitCameraView.mCameraFrame[1 - PortraitCameraView.this.mChainIdx]);
+                }
+            } while (!PortraitCameraView.this.mStopThread);
+            Log.m52d(PortraitCameraView.TAG, "Finish processing thread");
+        }
+    }
+}

+ 86 - 0
app/src/main/java/com/epson/cameracopy/device/PreviewResolutionSelector.java

@@ -0,0 +1,86 @@
+package com.epson.cameracopy.device;
+
+import com.epson.mobilephone.common.wifidirect.ActivityControlWiFi;
+import java.util.Iterator;
+import org.opencv.videoio.Videoio;
+
+public class PreviewResolutionSelector {
+    static SizeWrapper selectSize01(double d, Iterable<SizeWrapper> iterable, int i, int i2) {
+        int score01;
+        if (iterable == null || d < 1.0d) {
+            return null;
+        }
+        int i3 = 0;
+        SizeWrapper simpleSize = new SimpleSize(0, 0);
+        for (SizeWrapper next : iterable) {
+            int width = next.getWidth();
+            int height = next.getHeight();
+            if (width <= i && height > 0 && Math.abs((((double) width) / ((double) height)) - d) < 0.05d && i3 < (score01 = getScore01(height, i2))) {
+                simpleSize = next;
+                i3 = score01;
+            }
+        }
+        if (simpleSize.getWidth() <= 0) {
+            return null;
+        }
+        return simpleSize;
+    }
+
+    static int getScore01(int i, int i2) {
+        if (i < 400 || i > i2) {
+            return 0;
+        }
+        if (i <= 600) {
+            return ((i - 400) * 5) + 9000;
+        }
+        return i2 <= 600 ? ActivityControlWiFi.SCANNING_TIMEOUT : (((i - Videoio.CAP_UNICAP) * -1000) / (i2 - Videoio.CAP_UNICAP)) + ActivityControlWiFi.SCANNING_TIMEOUT;
+    }
+
+    static SizeWrapper selectSize02(double d, Iterable<SizeWrapper> iterable, int i, int i2) {
+        if (iterable == null || d < 1.0d) {
+            return null;
+        }
+        Iterator<SizeWrapper> it = iterable.iterator();
+        if (!it.hasNext()) {
+            return null;
+        }
+        SizeWrapper next = it.next();
+        double score03 = getScore03(next.getWidth(), next.getHeight(), i, i2, d);
+        while (it.hasNext()) {
+            SizeWrapper next2 = it.next();
+            double score032 = getScore03(next2.getWidth(), next2.getHeight(), i, i2, d);
+            if (score03 < score032) {
+                next = next2;
+                score03 = score032;
+            }
+        }
+        return next;
+    }
+
+    static double getScore03(int i, int i2, int i3, int i4, double d) {
+        int score02 = i <= i3 ? getScore02(i2, i4) : 0;
+        if (score02 <= 0) {
+            return 0.0d;
+        }
+        return ((double) score02) * getAspectScore(((double) i) / ((double) i2), d);
+    }
+
+    static int getScore02(int i, int i2) {
+        int score01 = getScore01(i, i2);
+        if (score01 > 0) {
+            return score01;
+        }
+        if (i >= 200 && i < 400) {
+            return ((i - 200) * 90) / 2;
+        }
+        return 0;
+    }
+
+    static double getAspectScore(double d, double d2) {
+        double abs = (Math.abs(d2 - d) * -0.5d) + 1.0d;
+        if (abs < 0.0d) {
+            return 0.0d;
+        }
+        return abs;
+    }
+}

+ 22 - 0
app/src/main/java/com/epson/cameracopy/device/RectangleDetector.java

@@ -0,0 +1,22 @@
+package com.epson.cameracopy.device;
+
+import android.graphics.Point;
+
+public class RectangleDetector {
+    public static native int bcsCorrection(long j, long j2, long j3, double d, double d2, double d3);
+
+    public static native int detectAndDrawRectangle(long j, boolean z);
+
+    public static native int detectAndDrawRectangle2(long j, int i, int i2, boolean z);
+
+    public static native Point getDefaultPaperWhiteCorrection();
+
+    public static native int paperWhiteCorrection(long j, long j2);
+
+    public static native int paperWhiteCorrection(long j, long j2, Point point);
+
+    static {
+        System.loadLibrary("opencv_java3");
+        System.loadLibrary("rectdetector");
+    }
+}

+ 19 - 0
app/src/main/java/com/epson/cameracopy/device/SimpleSize.java

@@ -0,0 +1,19 @@
+package com.epson.cameracopy.device;
+
+public class SimpleSize implements SizeWrapper {
+    private int mHeight;
+    private int mWidth;
+
+    public SimpleSize(int i, int i2) {
+        this.mWidth = i;
+        this.mHeight = i2;
+    }
+
+    public int getWidth() {
+        return this.mWidth;
+    }
+
+    public int getHeight() {
+        return this.mHeight;
+    }
+}

+ 7 - 0
app/src/main/java/com/epson/cameracopy/device/SizeWrapper.java

@@ -0,0 +1,7 @@
+package com.epson.cameracopy.device;
+
+interface SizeWrapper {
+    int getHeight();
+
+    int getWidth();
+}

+ 20 - 0
app/src/main/java/com/epson/cameracopy/p006ui/AreaComparator.java

@@ -0,0 +1,20 @@
+package com.epson.cameracopy.p006ui;
+
+import android.graphics.Point;
+import java.util.Comparator;
+
+/* renamed from: com.epson.cameracopy.ui.AreaComparator */
+/* compiled from: PictureResolutionDialogFragment */
+class AreaComparator implements Comparator<Point> {
+    AreaComparator() {
+    }
+
+    public int compare(Point point, Point point2) {
+        int i = point.x * point.y;
+        int i2 = point2.x * point2.y;
+        if (i > i2) {
+            return -1;
+        }
+        return i == i2 ? 0 : 1;
+    }
+}

+ 45 - 0
app/src/main/java/com/epson/cameracopy/p006ui/CameraCopyProgressParams.java

@@ -0,0 +1,45 @@
+package com.epson.cameracopy.p006ui;
+
+import android.content.Context;
+import android.os.RemoteException;
+import com.epson.iprint.prtlogger.PrintLog;
+import epson.print.screen.PrintProgress;
+import epson.print.screen.PrintSetting;
+import epson.print.service.IEpsonService;
+
+/* renamed from: com.epson.cameracopy.ui.CameraCopyProgressParams */
+public class CameraCopyProgressParams implements PrintProgress.ProgressParams {
+    public boolean getApfMode() {
+        return false;
+    }
+
+    public boolean getEpsonColorMode() {
+        return false;
+    }
+
+    public int getOriginalSheetSize() {
+        return 1;
+    }
+
+    public PrintSetting.Kind getPrintSettingType() {
+        return null;
+    }
+
+    public boolean isPaperLandscape() {
+        return false;
+    }
+
+    public boolean print(IEpsonService iEpsonService, boolean z) throws RemoteException {
+        return false;
+    }
+
+    public PrintLog getPrintLog() {
+        PrintLog printLog = new PrintLog();
+        printLog.uiRoute = 5;
+        return printLog;
+    }
+
+    public PrintSetting getPrintSetting(Context context) {
+        return new PrintSetting(context, PrintSetting.Kind.cameracopy);
+    }
+}

+ 36 - 0
app/src/main/java/com/epson/cameracopy/p006ui/CameraFileAdapter.java

@@ -0,0 +1,36 @@
+package com.epson.cameracopy.p006ui;
+
+import android.content.Context;
+import com.epson.cameracopy.device.CameraFile;
+import java.io.Serializable;
+
+/* renamed from: com.epson.cameracopy.ui.CameraFileAdapter */
+/* compiled from: ImagePreviewActivity */
+class CameraFileAdapter implements ImagePreviewFile, Serializable {
+    private static final long serialVersionUID = 1;
+    private CameraFile mCameraFile;
+
+    public CameraFileAdapter(CameraFile cameraFile) {
+        this.mCameraFile = cameraFile;
+    }
+
+    public String getImageProcFileName(Context context) {
+        return this.mCameraFile.getValidFileName();
+    }
+
+    public String getPrintFileName() {
+        return this.mCameraFile.getValidFileName();
+    }
+
+    public void deleteTemporaryFile() {
+        this.mCameraFile.deleteTemporaryFile();
+    }
+
+    public boolean needSaveButton() {
+        return this.mCameraFile.isMovable();
+    }
+
+    public boolean doSave(String str) {
+        return this.mCameraFile.moveTo(str);
+    }
+}

+ 67 - 0
app/src/main/java/com/epson/cameracopy/p006ui/CameraPreviewActivity.java

@@ -0,0 +1,67 @@
+package com.epson.cameracopy.p006ui;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.p000v4.app.Fragment;
+import android.view.Menu;
+import android.view.MenuItem;
+import epson.print.ActivityIACommon;
+import epson.print.ActivityRequestPermissions;
+import epson.print.C2135R;
+
+/* renamed from: com.epson.cameracopy.ui.CameraPreviewActivity */
+public class CameraPreviewActivity extends ActivityIACommon {
+    public static final String PARAM_APP_INIT = "app_init";
+    private static final int RESULT_RUNTIMEPERMMISSION = 1;
+
+    public boolean onCreateOptionsMenu(Menu menu) {
+        return true;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        setContentView((int) C2135R.layout.activity_camera_preview);
+        setActionBar((int) C2135R.string.capture_title, true);
+        if (bundle == null) {
+            if (ActivityRequestPermissions.isRuntimePermissionSupported()) {
+                String[] strArr = {"android.permission.CAMERA"};
+                ActivityRequestPermissions.Permission permission = new ActivityRequestPermissions.Permission(strArr[0], new String[]{getString(C2135R.string.permission_dialog_title), getString(C2135R.string.permission_dialog_title)}, new String[]{ActivityRequestPermissions.DialogParameter.setMessage2((Context) this, getString(C2135R.string.permission_dialog_message_camera)), ActivityRequestPermissions.DialogParameter.setMessage3A((Context) this, getString(C2135R.string.permission_dialog_message_camera), getString(C2135R.string.permission_function_camera))});
+                if (!ActivityRequestPermissions.checkPermission(this, strArr)) {
+                    ActivityRequestPermissions.requestPermission((Activity) this, permission, 1);
+                    return;
+                }
+            }
+            prepareCameraPreviewFragment();
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public void prepareCameraPreviewFragment() {
+        boolean booleanExtra = getIntent().getBooleanExtra(PARAM_APP_INIT, true);
+        CameraPreviewFragment cameraPreviewFragment = new CameraPreviewFragment();
+        cameraPreviewFragment.setAppInitFlag(booleanExtra);
+        getSupportFragmentManager().beginTransaction().add((int) C2135R.C2137id.container, (Fragment) cameraPreviewFragment).commit();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onActivityResult(int i, int i2, Intent intent) {
+        super.onActivityResult(i, i2, intent);
+        if (i == 1) {
+            prepareCameraPreviewFragment();
+        }
+    }
+
+    public boolean onOptionsItemSelected(MenuItem menuItem) {
+        menuItem.getItemId();
+        return super.onOptionsItemSelected(menuItem);
+    }
+
+    public void onBackPressed() {
+        if (((CameraPreviewFragment) getSupportFragmentManager().findFragmentById(C2135R.C2137id.container)).onBackPressed()) {
+            super.onBackPressed();
+        }
+    }
+}

+ 554 - 0
app/src/main/java/com/epson/cameracopy/p006ui/CameraPreviewFragment.java

@@ -0,0 +1,554 @@
+package com.epson.cameracopy.p006ui;
+
+import android.content.Intent;
+import android.hardware.Camera;
+import android.hardware.SensorManager;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.support.p000v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.WindowManager;
+import android.widget.Button;
+import com.epson.cameracopy.alt.FileUtils;
+import com.epson.cameracopy.alt.UiCommon;
+import com.epson.cameracopy.device.AptSensorAdapter;
+import com.epson.cameracopy.device.CameraFile;
+import com.epson.cameracopy.device.CameraPreviewControl;
+import com.epson.cameracopy.device.OpenCvCameraView;
+import com.epson.cameracopy.device.RectangleDetector;
+import epson.print.C2135R;
+import epson.print.imgsel.CameraCopyImageSelectActivity;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import org.opencv.android.CameraBridgeViewBase;
+import org.opencv.android.OpenCVLoader;
+import org.opencv.core.CvType;
+import org.opencv.core.Mat;
+import org.opencv.core.Point;
+import org.opencv.core.Scalar;
+import org.opencv.core.Size;
+import org.opencv.imgproc.Imgproc;
+
+/* renamed from: com.epson.cameracopy.ui.CameraPreviewFragment */
+public class CameraPreviewFragment extends Fragment implements CameraBridgeViewBase.CvCameraViewListener2, OpenCvCameraView.AutoFocusCallBack {
+    private static final Scalar COLOR_BLACK = new Scalar(0.0d, 0.0d, 0.0d, 255.0d);
+    private static final Scalar[] PAPER_SQUARE_COLOR = {new Scalar(255.0d, 0.0d, 0.0d, 255.0d), new Scalar(0.0d, 255.0d, 0.0d, 255.0d)};
+    private static final Point POSITION_0_0 = new Point(0.0d, 0.0d);
+    private static final double REFERENCE_ACCELARATION = 0.45d;
+    private static final String TAG = "CameraPreviewFragment";
+    private final double AUTO_PICTURE_RANGE_VALUE = AptSensorAdapter.getRangeCompValue(20);
+    private final int INIT_SPAN = 2;
+    private final double PAPER_DETECT_VALUE = AptSensorAdapter.getRangeCompValue(45);
+    private boolean isFragmentVisible;
+    private boolean mAutoPhotoMode;
+    private final long mAutoPictureStillTime = 3000;
+    private SimpleMessageDialogFragment mCameraPictureLowResolutionDialog;
+    private CameraPreviewControl mCameraPreviewControl;
+    private boolean mDisableSettingsButton = false;
+    private float mDisplayDensity;
+    private int mDisplayRotation;
+    private View mFunctionBarView;
+    private final Scalar mGridColor = new Scalar(255.0d, 163.0d, 0.0d, 255.0d);
+    private final int mGridColorWidth = 1;
+    private boolean mHasCamera;
+    private int mInitCount;
+    private OpenCvCameraView mOpenCvCameraView;
+    private long mPAfTime;
+    private final int mPaperSquareCircleSize = 20;
+    private Button mPhotoSelectButton;
+    private Button mPhtographButton;
+    /* access modifiers changed from: private */
+    public volatile boolean mPictureTaking;
+    private final Scalar mPositionCursorColor = new Scalar(255.0d, 0.0d, 0.0d, 255.0d);
+    private final float mPositionCursorDispRate = 0.05098581f;
+    private volatile boolean mPreviewActivityStarted;
+    private Mat mRgba;
+    private final Point mScreenSize = new Point();
+    /* access modifiers changed from: private */
+    public final AptSensorAdapter mSensorEventListener = new AptSensorAdapter();
+    private TakePictureTask mTakePictureTask;
+    private boolean noCameraDialog;
+
+    private void startInformationActivity() {
+    }
+
+    static {
+        OpenCVLoader.initDebug();
+    }
+
+    public void setAppInitFlag(boolean z) {
+        if (z) {
+            this.noCameraDialog = true;
+        }
+    }
+
+    public boolean isPreviewActivityStarted() {
+        return this.mPreviewActivityStarted;
+    }
+
+    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
+        View inflate = layoutInflater.inflate(C2135R.layout.fragment_camera_preview, viewGroup, false);
+        setHasOptionsMenu(true);
+        setButtonListener(inflate);
+        this.mOpenCvCameraView = (OpenCvCameraView) inflate.findViewById(C2135R.C2137id.view1);
+        if (CameraPreviewControl.hasBackCamera()) {
+            this.mHasCamera = true;
+            this.mOpenCvCameraView.setCvCameraViewListener((CameraBridgeViewBase.CvCameraViewListener2) this);
+        } else {
+            this.mHasCamera = false;
+            UiCommon.setButtonEnabled(this.mPhtographButton, false);
+            if (bundle == null && this.noCameraDialog) {
+                this.noCameraDialog = false;
+                SimpleMessageDialogFragment.newInstance(C2135R.string.back_camera_not_exists_message).show(getFragmentManager(), "error-dialog");
+            }
+        }
+        this.mOpenCvCameraView.setVisibility(0);
+        this.mDisplayRotation = ((WindowManager) getActivity().getSystemService("window")).getDefaultDisplay().getRotation();
+        this.mSensorEventListener.setDisplayRotation(this.mDisplayRotation);
+        this.mSensorEventListener.setSensorManager((SensorManager) getActivity().getSystemService("sensor"));
+        this.mSensorEventListener.setReferenceAccelaration(REFERENCE_ACCELARATION);
+        this.mFunctionBarView = inflate.findViewById(C2135R.C2137id.function_bar);
+        this.mDisplayDensity = getActivity().getResources().getDisplayMetrics().density;
+        return inflate;
+    }
+
+    private void setButtonListener(View view) {
+        this.mPhotoSelectButton = (Button) view.findViewById(C2135R.C2137id.photo_select_button);
+        this.mPhotoSelectButton.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View view) {
+                if (!CameraPreviewFragment.this.mPictureTaking) {
+                    CameraPreviewFragment.this.startPhotoSelectActivity();
+                }
+            }
+        });
+        this.mPhtographButton = (Button) view.findViewById(C2135R.C2137id.photograph_button);
+        this.mPhtographButton.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View view) {
+                if (!CameraPreviewFragment.this.mPictureTaking) {
+                    CameraPreviewFragment.this.takePicture();
+                }
+            }
+        });
+    }
+
+    private void startSettingActivity() {
+        startActivity(new Intent(getActivity(), CameraPreviewOptionActivity.class));
+    }
+
+    /* access modifiers changed from: private */
+    public void startPhotoSelectActivity() {
+        startActivity(new Intent(getActivity(), CameraCopyImageSelectActivity.class));
+    }
+
+    public void onCameraViewStarted(int i, int i2) {
+        this.mRgba = new Mat(i, i2, CvType.CV_8UC4);
+        savePictureSizeList();
+        checkPictureSize();
+    }
+
+    private void savePictureSizeList() {
+        List<Camera.Size> pictureSizeList;
+        OpenCvCameraView openCvCameraView = this.mOpenCvCameraView;
+        if (openCvCameraView != null && (pictureSizeList = openCvCameraView.getPictureSizeList()) != null) {
+            Iterator<Camera.Size> it = pictureSizeList.iterator();
+            while (it.hasNext()) {
+                Camera.Size next = it.next();
+                if (next.width * next.height < 1000000) {
+                    it.remove();
+                }
+            }
+            CameraPreviewControl.getInstance(getActivity()).setCameraPictureSizes(pictureSizeList);
+        }
+    }
+
+    private void checkPictureSize() {
+        OpenCvCameraView openCvCameraView;
+        Camera.Size cameraPictureSize;
+        CameraPreviewControl instance = CameraPreviewControl.getInstance(getActivity());
+        if (instance.getPictureResolutionMode() == 0 && (openCvCameraView = this.mOpenCvCameraView) != null && (cameraPictureSize = openCvCameraView.getCameraPictureSize()) != null && cameraPictureSize.width * cameraPictureSize.height < 1000000) {
+            int i = C2135R.string.camera_picture_low_message;
+            List<android.graphics.Point> cameraPictureSizes = instance.getCameraPictureSizes();
+            if (cameraPictureSizes == null || cameraPictureSizes.size() <= 0) {
+                i = C2135R.string.has_no_hireso_picture_message;
+            }
+            this.mCameraPictureLowResolutionDialog = SimpleMessageDialogFragment.newInstance(i);
+            this.mCameraPictureLowResolutionDialog.show(getFragmentManager(), "camera-resolution-warning-dialog");
+        }
+    }
+
+    public void onCameraViewStopped() {
+        this.mRgba.release();
+        SimpleMessageDialogFragment simpleMessageDialogFragment = this.mCameraPictureLowResolutionDialog;
+        if (simpleMessageDialogFragment != null) {
+            simpleMessageDialogFragment.dismiss();
+            this.mCameraPictureLowResolutionDialog = null;
+        }
+    }
+
+    private void drawSensorPos(Mat mat, boolean z) {
+        int i;
+        int height = mat.height();
+        if (height > 0) {
+            double scale = (double) (1.0f / this.mOpenCvCameraView.getScale());
+            int height2 = (int) (((double) this.mFunctionBarView.getHeight()) * scale);
+            int height3 = (int) (((double) this.mOpenCvCameraView.getHeight()) * scale);
+            double d = (double) height;
+            if (height2 + 0 + height > height3) {
+                i = (int) (((double) 0) - (((double) (height3 - height)) / 2.0d));
+                d = (double) ((height3 - 0) - height2);
+            } else {
+                i = 0;
+            }
+            Size size = this.mRgba.size();
+            double d2 = size.width / 2.0d;
+            double d3 = d / 10.0d;
+            double d4 = scale;
+            double d5 = (double) i;
+            Point point = new Point();
+            double d6 = d / 2.0d;
+            Point point2 = new Point();
+            double d7 = size.width / 10.0d;
+            double d8 = d2 - 1.0d;
+            point.f432x = d8;
+            point.f433y = d5 + d3;
+            point2.f432x = d8;
+            double d9 = d5 + d;
+            point2.f433y = d9 - d3;
+            Imgproc.line(this.mRgba, point, point2, this.mGridColor, 1);
+            double d10 = d7;
+            point.f432x = d10;
+            double d11 = d5 + d6;
+            point.f433y = d11;
+            Size size2 = size;
+            double d12 = d2;
+            point2.f432x = size2.width - d10;
+            point2.f433y = d11;
+            Imgproc.line(this.mRgba, point, point2, this.mGridColor, 1);
+            double d13 = size2.width / 20.0d;
+            double d14 = d / 20.0d;
+            double d15 = d13 * 3.0d;
+            double d16 = d14 + d5;
+            double d17 = 3.0d * d14;
+            double d18 = size2.width - d13;
+            double d19 = d5 + d17;
+            double d20 = d5;
+            double d21 = d9 - d17;
+            double d22 = d9 - d14;
+            point.f432x = d13;
+            double d23 = d16;
+            point.f433y = d23;
+            point2.f432x = d15;
+            point2.f433y = d23;
+            double d24 = d21;
+            Imgproc.line(this.mRgba, point, point2, this.mGridColor, 2);
+            double d25 = size2.width - d15;
+            point.f432x = d25;
+            point.f433y = d23;
+            double d26 = d19;
+            double d27 = d18;
+            point2.f432x = d27;
+            point2.f433y = d23;
+            Imgproc.line(this.mRgba, point, point2, this.mGridColor, 2);
+            point.f432x = d13;
+            double d28 = d23;
+            double d29 = d22;
+            point.f433y = d29;
+            point2.f432x = d15;
+            point2.f433y = d29;
+            Imgproc.line(this.mRgba, point, point2, this.mGridColor, 2);
+            point.f432x = d25;
+            point.f433y = d29;
+            point2.f432x = d27;
+            point2.f433y = d29;
+            Imgproc.line(this.mRgba, point, point2, this.mGridColor, 2);
+            point.f432x = d13;
+            double d30 = d28;
+            point.f433y = d30;
+            point2.f432x = d13;
+            double d31 = d26;
+            point2.f433y = d31;
+            Imgproc.line(this.mRgba, point, point2, this.mGridColor, 2);
+            point.f432x = d13;
+            double d32 = d24;
+            point.f433y = d32;
+            point2.f432x = d13;
+            point2.f433y = d29;
+            Imgproc.line(this.mRgba, point, point2, this.mGridColor, 2);
+            point.f432x = d27;
+            point.f433y = d30;
+            point2.f432x = d27;
+            point2.f433y = d31;
+            Imgproc.line(this.mRgba, point, point2, this.mGridColor, 2);
+            point.f432x = d27;
+            point.f433y = d32;
+            point2.f432x = d27;
+            point2.f433y = d29;
+            Imgproc.line(this.mRgba, point, point2, this.mGridColor, 2);
+            if (z) {
+                double posX = d12 - (((double) (this.mSensorEventListener.getPosX() * 0.05098581f)) * d12);
+                double posY = d6 + (((double) (this.mSensorEventListener.getPosY() * 0.05098581f)) * d6) + d20;
+                int i2 = (int) (d4 * 20.0d * ((double) this.mDisplayDensity));
+                Imgproc.circle(this.mRgba, new Point(posX, posY), i2, this.mPositionCursorColor, 1);
+                double d33 = (double) i2;
+                Imgproc.line(this.mRgba, new Point(posX, posY - d33), new Point(posX, posY + d33), this.mPositionCursorColor);
+                Imgproc.line(this.mRgba, new Point(posX - d33, posY), new Point(posX + d33, posY), this.mPositionCursorColor);
+            }
+        }
+    }
+
+    private void myDrawRect(Mat mat, Point[] pointArr, boolean z) {
+        if (pointArr != null && pointArr.length >= 1 && pointArr.length >= 2) {
+            Scalar[] scalarArr = PAPER_SQUARE_COLOR;
+            Scalar scalar = scalarArr[0];
+            if (z) {
+                scalar = scalarArr[1];
+            }
+            Imgproc.line(mat, pointArr[0], pointArr[1], scalar, 2);
+            if (pointArr.length >= 3) {
+                Imgproc.line(mat, pointArr[1], pointArr[2], scalar, 2);
+                if (pointArr.length >= 4) {
+                    Imgproc.line(mat, pointArr[0], pointArr[3], scalar, 2);
+                    Imgproc.line(mat, pointArr[2], pointArr[3], scalar, 2);
+                }
+            }
+        }
+    }
+
+    private boolean checkAutoPictureAngle() {
+        return this.mSensorEventListener.isTerminalAngleInRange(this.AUTO_PICTURE_RANGE_VALUE);
+    }
+
+    private boolean checkAccelerrationTime() {
+        long lastOverTime2 = this.mSensorEventListener.getLastOverTime2();
+        if (lastOverTime2 > 0 && System.currentTimeMillis() - lastOverTime2 >= 3000) {
+            return true;
+        }
+        return false;
+    }
+
+    private boolean autofousTime() {
+        return System.currentTimeMillis() - this.mSensorEventListener.getLastOverTime2() >= 500;
+    }
+
+    private void sensorAndCamera() {
+        if (this.isFragmentVisible) {
+            long currentTimeMillis = System.currentTimeMillis();
+            if (this.mAutoPhotoMode && this.mSensorEventListener.isTerminalAngleInRange(this.PAPER_DETECT_VALUE)) {
+                boolean checkAutoPictureAngle = checkAutoPictureAngle();
+                int detectAndDrawRectangle2 = RectangleDetector.detectAndDrawRectangle2(this.mRgba.getNativeObjAddr(), 0, this.mFunctionBarView.getHeight(), checkAutoPictureAngle);
+                if (checkAutoPictureAngle && detectAndDrawRectangle2 == 1 && checkAccelerrationTime()) {
+                    takePicture();
+                    return;
+                } else if (detectAndDrawRectangle2 != 0) {
+                    this.mPAfTime = currentTimeMillis;
+                }
+            }
+            if (!this.mPictureTaking && !this.mAutoPhotoMode && !this.mPictureTaking && currentTimeMillis - this.mPAfTime > 4000 && !this.mOpenCvCameraView.isInAutofocus() && autofousTime()) {
+                this.mOpenCvCameraView.doAutofocus(this);
+                this.mPAfTime = currentTimeMillis;
+            }
+        }
+    }
+
+    public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame cvCameraViewFrame) {
+        this.mRgba = cvCameraViewFrame.rgba();
+        if (!this.mHasCamera || this.mPictureTaking) {
+            return this.mRgba;
+        }
+        int i = this.mInitCount;
+        if (i < 2) {
+            this.mInitCount = i + 1;
+            this.mScreenSize.f432x = (double) this.mRgba.width();
+            this.mScreenSize.f433y = (double) this.mRgba.height();
+            Imgproc.rectangle(this.mRgba, POSITION_0_0, this.mScreenSize, COLOR_BLACK, -1);
+        }
+        sensorAndCamera();
+        if (this.mCameraPreviewControl.getGuideMode()) {
+            drawSensorPos(this.mRgba, this.mSensorEventListener.isTerminalAngleInRange(this.PAPER_DETECT_VALUE));
+        }
+        return this.mRgba;
+    }
+
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        this.mCameraPreviewControl = CameraPreviewControl.getInstance(getActivity());
+        this.mPictureTaking = false;
+    }
+
+    public void onResume() {
+        super.onResume();
+        if (this.mHasCamera) {
+            enableAllButton();
+            if (this.mOpenCvCameraView.checkBackCamera()) {
+                this.mOpenCvCameraView.enableView();
+                this.mSensorEventListener.start();
+                this.mPAfTime = 0;
+            } else {
+                UiCommon.setButtonEnabled(this.mPhtographButton, false);
+                disableSettingButton(true);
+                SimpleMessageDialogFragment.newInstance(C2135R.string.back_camera_not_exists_message).show(getFragmentManager(), "error-dialog");
+            }
+            this.mPictureTaking = false;
+        }
+        this.mInitCount = 0;
+        if (this.mPreviewActivityStarted) {
+            this.mPreviewActivityStarted = false;
+            this.mPictureTaking = false;
+            enableAllButton();
+        }
+        this.mAutoPhotoMode = this.mCameraPreviewControl.getAutoPictureMode();
+        this.isFragmentVisible = true;
+    }
+
+    public void onPause() {
+        this.isFragmentVisible = false;
+        this.mSensorEventListener.stop();
+        TakePictureTask takePictureTask = this.mTakePictureTask;
+        if (takePictureTask != null) {
+            takePictureTask.cancel(false);
+            this.mTakePictureTask = null;
+        }
+        OpenCvCameraView openCvCameraView = this.mOpenCvCameraView;
+        if (openCvCameraView != null) {
+            openCvCameraView.cancelAutofocus();
+            this.mOpenCvCameraView.disableView();
+        }
+        this.mPictureTaking = false;
+        super.onPause();
+    }
+
+    public void onDestroy() {
+        OpenCvCameraView openCvCameraView = this.mOpenCvCameraView;
+        if (openCvCameraView != null) {
+            openCvCameraView.cancelAutofocus();
+            this.mOpenCvCameraView.disableView();
+            this.mOpenCvCameraView.setCvCameraViewListener((CameraBridgeViewBase.CvCameraViewListener2) null);
+            this.mOpenCvCameraView = null;
+        }
+        super.onDestroy();
+    }
+
+    /* access modifiers changed from: private */
+    public void showErrorDialog() {
+        SimpleMessageDialogFragment.newInstance(C2135R.string.file_save_error_message).show(getFragmentManager(), "error-dialog");
+    }
+
+    public void takePicture() {
+        if (!this.mPictureTaking) {
+            this.mPictureTaking = true;
+            getActivity().runOnUiThread(new Runnable() {
+                public void run() {
+                    CameraPreviewFragment.this.disableAllButton();
+                }
+            });
+            this.mSensorEventListener.stop();
+            this.mTakePictureTask = new TakePictureTask(this.mOpenCvCameraView);
+            this.mTakePictureTask.execute(new Void[0]);
+        }
+    }
+
+    /* access modifiers changed from: private */
+    public void takePictureStep2() {
+        this.mOpenCvCameraView.takePicture(FileUtils.getNewTemporaryJpegFile(getActivity()).getPath(), new OpenCvCameraView.MyPictureTakeCallback() {
+            public void onMyPictureTaken(boolean z, String str) {
+                if (!z || str == null) {
+                    CameraPreviewFragment.this.enableAllButton();
+                    CameraPreviewFragment.this.mSensorEventListener.start();
+                    boolean unused = CameraPreviewFragment.this.mPictureTaking = false;
+                    CameraPreviewFragment.this.showErrorDialog();
+                    return;
+                }
+                CameraPreviewFragment.this.startPictureViewActivity(str);
+            }
+        });
+    }
+
+    /* access modifiers changed from: private */
+    public void enableAllButton() {
+        if (CameraPreviewControl.hasBackCamera()) {
+            UiCommon.setButtonEnabled(this.mPhtographButton, true);
+            disableSettingButton(false);
+        }
+        UiCommon.setButtonEnabled(this.mPhotoSelectButton, true);
+    }
+
+    /* access modifiers changed from: private */
+    public void disableAllButton() {
+        UiCommon.setButtonEnabled(this.mPhtographButton, false);
+        disableSettingButton(true);
+        UiCommon.setButtonEnabled(this.mPhotoSelectButton, false);
+    }
+
+    /* access modifiers changed from: private */
+    public void startPictureViewActivity(String str) {
+        Intent intent = new Intent(getActivity(), ImagePreviewActivity.class);
+        intent.putExtra(ImagePreviewActivity.PARAM_CAMERA_FILE, new CameraFile(new Date(), str));
+        startActivity(intent);
+        this.mPreviewActivityStarted = true;
+    }
+
+    public void onAutoFocusCompleted(boolean z) {
+        this.mPAfTime = System.currentTimeMillis();
+    }
+
+    /* access modifiers changed from: package-private */
+    public void disableSettingButton(boolean z) {
+        this.mDisableSettingsButton = z;
+        getActivity().invalidateOptionsMenu();
+    }
+
+    public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
+        if (!this.mDisableSettingsButton) {
+            menuInflater.inflate(C2135R.C2138menu.camera_menu, menu);
+        }
+        super.onCreateOptionsMenu(menu, menuInflater);
+    }
+
+    public boolean onOptionsItemSelected(MenuItem menuItem) {
+        if (menuItem.getItemId() != C2135R.C2137id.camera_setting) {
+            return super.onOptionsItemSelected(menuItem);
+        }
+        if (this.mPictureTaking) {
+            return false;
+        }
+        startSettingActivity();
+        return true;
+    }
+
+    public boolean onBackPressed() {
+        return !this.mPictureTaking;
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.CameraPreviewFragment$TakePictureTask */
+    class TakePictureTask extends AsyncTask<Void, Void, Void> {
+        private OpenCvCameraView mMyOpenCvCameraView;
+
+        public TakePictureTask(OpenCvCameraView openCvCameraView) {
+            this.mMyOpenCvCameraView = openCvCameraView;
+        }
+
+        /* access modifiers changed from: protected */
+        public Void doInBackground(Void... voidArr) {
+            System.currentTimeMillis();
+            while (!isCancelled() && this.mMyOpenCvCameraView.isInAutofocus()) {
+                try {
+                    Thread.sleep(100);
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+            return null;
+        }
+
+        /* access modifiers changed from: protected */
+        public void onPostExecute(Void voidR) {
+            CameraPreviewFragment.this.takePictureStep2();
+        }
+    }
+}

+ 182 - 0
app/src/main/java/com/epson/cameracopy/p006ui/CameraPreviewOptionActivity.java

@@ -0,0 +1,182 @@
+package com.epson.cameracopy.p006ui;
+
+import android.content.Intent;
+import android.graphics.Point;
+import android.os.Bundle;
+import android.support.p000v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.CompoundButton;
+import android.widget.LinearLayout;
+import android.widget.Switch;
+import android.widget.TextView;
+import com.epson.cameracopy.device.CameraPreviewControl;
+import com.epson.cameracopy.p006ui.PictureResolutionDialogFragment;
+import epson.print.ActivityIACommon;
+import epson.print.C2135R;
+import java.io.File;
+
+/* renamed from: com.epson.cameracopy.ui.CameraPreviewOptionActivity */
+public class CameraPreviewOptionActivity extends ActivityIACommon implements PictureResolutionDialogFragment.OnItemSelectedListener {
+    private static final int CODE_DIRECTORY_SELECT = 1;
+    PlaceholderFragment mFragment;
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        setContentView((int) C2135R.layout.activity_camera_preview_option);
+        setActionBar((int) C2135R.string.camera_option_title, true);
+        if (bundle == null) {
+            this.mFragment = new PlaceholderFragment();
+            getSupportFragmentManager().beginTransaction().add((int) C2135R.C2137id.container, (Fragment) this.mFragment).commit();
+        }
+    }
+
+    public void onItemSelected(boolean z, int i, Point point) {
+        PlaceholderFragment placeholderFragment;
+        if (z && (placeholderFragment = this.mFragment) != null) {
+            placeholderFragment.changeSelectedCameraPictureResolution(i, point);
+        }
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.CameraPreviewOptionActivity$PlaceholderFragment */
+    public static class PlaceholderFragment extends Fragment {
+        Switch mAutoPhotoToggleButton;
+        private int mCameraPictureResolutionMode;
+        private Point mCameraPictureSize;
+        private CameraPreviewControl mCameraPreviewControl;
+        Switch mGuideToggleButton;
+        private TextView mPictureResolutionText;
+        String mSaveDirectoryName;
+        private TextView mSaveDirectoryText;
+
+        public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
+            View inflate = layoutInflater.inflate(C2135R.layout.fragment_camera_preview_option, viewGroup, false);
+            this.mCameraPreviewControl = CameraPreviewControl.getInstance(getActivity());
+            setHasOptionsMenu(true);
+            this.mGuideToggleButton = (Switch) inflate.findViewById(C2135R.C2137id.guideToggleButton);
+            this.mGuideToggleButton.setChecked(this.mCameraPreviewControl.getGuideMode());
+            this.mGuideToggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+                public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
+                    PlaceholderFragment.this.changeAutoPhotoToggleButtonStatus(z);
+                }
+            });
+            this.mAutoPhotoToggleButton = (Switch) inflate.findViewById(C2135R.C2137id.autoPictureToggleButton);
+            this.mAutoPhotoToggleButton.setChecked(this.mCameraPreviewControl.getAutoPictureMode());
+            changeAutoPhotoToggleButtonStatus(this.mGuideToggleButton.isChecked());
+            ((LinearLayout) inflate.findViewById(C2135R.C2137id.save_directory_layout)).setOnClickListener(new View.OnClickListener() {
+                public void onClick(View view) {
+                    PlaceholderFragment.this.startSaveDirectoryActivity();
+                }
+            });
+            this.mSaveDirectoryText = (TextView) inflate.findViewById(C2135R.C2137id.saveDirectoryText);
+            setSaveDirectoryText(this.mCameraPreviewControl.getSaveDirecotry());
+            inflate.findViewById(C2135R.C2137id.picture_resolution_layout).setOnClickListener(new View.OnClickListener() {
+                public void onClick(View view) {
+                    PlaceholderFragment.this.openPictureResolutionDialog();
+                }
+            });
+            this.mPictureResolutionText = (TextView) inflate.findViewById(C2135R.C2137id.pictureResolutionText);
+            setCameraPictureResolutionModeFromCameraPreviewControl();
+            setPictureResolutionText();
+            return inflate;
+        }
+
+        public void changeSelectedCameraPictureResolution(int i, Point point) {
+            this.mCameraPictureResolutionMode = i;
+            if (this.mCameraPictureResolutionMode == 0) {
+                this.mCameraPictureSize = null;
+            } else {
+                this.mCameraPictureSize = point;
+            }
+            setPictureResolutionText();
+        }
+
+        private void setPictureResolutionText() {
+            if (this.mCameraPictureResolutionMode == 0) {
+                this.mPictureResolutionText.setText(C2135R.string.picture_size_auto);
+                return;
+            }
+            Point point = this.mCameraPictureSize;
+            if (point == null || point.x <= 0 || this.mCameraPictureSize.y <= 0) {
+                this.mPictureResolutionText.setText("");
+                return;
+            }
+            this.mPictureResolutionText.setText(CameraPreviewControl.getPictureSizeString(this.mCameraPictureSize.x, this.mCameraPictureSize.y));
+        }
+
+        private void setCameraPictureResolutionModeFromCameraPreviewControl() {
+            this.mCameraPictureResolutionMode = this.mCameraPreviewControl.getPictureResolutionMode();
+            this.mCameraPictureSize = null;
+            if (this.mCameraPictureResolutionMode == 1) {
+                this.mCameraPictureSize = this.mCameraPreviewControl.getPictureSize();
+            }
+        }
+
+        /* access modifiers changed from: private */
+        public void openPictureResolutionDialog() {
+            PictureResolutionDialogFragment.newInstance(this.mCameraPictureResolutionMode, this.mCameraPictureSize).show(getActivity().getSupportFragmentManager(), "picture-resolution");
+        }
+
+        private void changeValueAndFinish() {
+            this.mCameraPreviewControl.setGuideMode(this.mGuideToggleButton.isChecked());
+            this.mCameraPreviewControl.setAutoPictureMode(Boolean.valueOf(this.mAutoPhotoToggleButton.isChecked()));
+            this.mCameraPreviewControl.setSaveDirecotry(this.mSaveDirectoryName);
+            if (this.mCameraPictureResolutionMode == 0) {
+                this.mCameraPreviewControl.setPictureResolutionModeAuto();
+            } else {
+                this.mCameraPreviewControl.setPictureSize(this.mCameraPictureSize);
+            }
+            getActivity().finish();
+        }
+
+        /* access modifiers changed from: private */
+        public void changeAutoPhotoToggleButtonStatus(boolean z) {
+            if (z && this.mCameraPreviewControl.hasAutoPictureHardware(getActivity())) {
+                this.mAutoPhotoToggleButton.setEnabled(true);
+                return;
+            }
+            this.mAutoPhotoToggleButton.setChecked(false);
+            this.mAutoPhotoToggleButton.setEnabled(false);
+        }
+
+        private void setSaveDirectoryText(String str) {
+            this.mSaveDirectoryName = str;
+            this.mSaveDirectoryText.setText(new File(this.mSaveDirectoryName).getName());
+        }
+
+        public void startSaveDirectoryActivity() {
+            startActivityForResult(new Intent(getActivity(), FolderSelectActivity.class), 1);
+        }
+
+        public void onActivityResult(int i, int i2, Intent intent) {
+            if (i == 1) {
+                if (i2 == -1 && intent != null) {
+                    String stringExtra = intent.getStringExtra("SELECT_Folder");
+                    if (stringExtra != null) {
+                        setSaveDirectoryText(stringExtra);
+                    }
+                } else if (i2 == 1) {
+                    SimpleMessageDialogFragment.newInstance(C2135R.string.file_save_error_message).show(getFragmentManager(), "error-dialog");
+                }
+            }
+        }
+
+        public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
+            menuInflater.inflate(C2135R.C2138menu.menu_done, menu);
+            super.onCreateOptionsMenu(menu, menuInflater);
+        }
+
+        public boolean onOptionsItemSelected(MenuItem menuItem) {
+            if (menuItem.getItemId() != C2135R.C2137id.menuSettingsDone) {
+                return super.onOptionsItemSelected(menuItem);
+            }
+            changeValueAndFinish();
+            return true;
+        }
+    }
+}

+ 1100 - 0
app/src/main/java/com/epson/cameracopy/p006ui/CameraPrintProgress.java

@@ -0,0 +1,1100 @@
+package com.epson.cameracopy.p006ui;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.RemoteException;
+import android.view.KeyEvent;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+import com.epson.cameracopy.printlayout.ImageAndLayout;
+import com.epson.iprint.prtlogger.Analytics;
+import com.epson.mobilephone.common.escpr.MediaInfo;
+import com.epson.mobilephone.common.wifidirect.NfcTagUtils;
+import epson.common.Utils;
+import epson.print.C2135R;
+import epson.print.CommonDefine;
+import epson.print.MyPrinter;
+import epson.print.Util.EPLog;
+import epson.print.screen.PrintProgress;
+import epson.print.screen.PrintSetting;
+import epson.print.service.IEpsonService;
+import epson.print.service.IEpsonServiceCallback;
+import epson.print.widgets.CustomTitleAlertDialogBuilder;
+import java.util.ArrayList;
+
+/* renamed from: com.epson.cameracopy.ui.CameraPrintProgress */
+public class CameraPrintProgress extends Activity implements CommonDefine {
+    private static final int DIALOG_CONFIRM = 1;
+    private static final int DIALOG_INFORM = 0;
+    public static final int END_PRINT = 4;
+    public static final String KEY_IMAGE_AND_LAYOUT = "image_and_layout";
+    public static final String PARAM_PRINT_PROGRESS = "progress-params";
+    public static final String PREFS_NAME = "PrintSetting";
+    public static final int RESULT_ERROR = 1000;
+    /* access modifiers changed from: private */
+    public static boolean bRestartactivity = false;
+    static int copies = 0;
+    static int curError = 0;
+    static int fileIndex = 0;
+    static boolean isBkRetry = false;
+    static boolean isContinue = false;
+    static boolean isDocument = false;
+    /* access modifiers changed from: private */
+    public static final Object lockBCancel = new Object();
+    /* access modifiers changed from: private */
+    public static IEpsonServiceCallback mCallback;
+    /* access modifiers changed from: private */
+    public static ServiceConnection mEpsonConnection;
+    /* access modifiers changed from: private */
+    public static IEpsonService mEpsonService = null;
+    /* access modifiers changed from: private */
+    public static final Object mLock = new Object();
+    private static final Object mLockInit = new Object();
+    static ProgressBar mProgressCopies;
+    static ProgressBar mProgressPage;
+    static ProgressBar mProgressPercent;
+    private final int CHECK_PRINTER = 6;
+    private final int CHECK_PRINTER_CONTINUE = 10;
+    private final int CONFIRM = 7;
+    private final int CONNECTED_SIMPLEAP = 1;
+    private final int CONTINUE_PRINT = 3;
+    private final int ECC_LIB_ERROR = 9;
+    private final int EPS_DUPLEX_NONE = 0;
+    private final int EPS_JOB_CANCELED = 40;
+    private final int ERROR = 4;
+    private final int FINISH = 5;
+    private final String PERCENT = "PERCENT";
+    private final int PRINT_NEXT_PAGE = 1;
+    private final int SHOW_COMPLETE_DIALOG = 8;
+    private final int START_PRINT = 2;
+    private final int UPDATE_PERCENT = 0;
+    boolean bCancel = false;
+    /* access modifiers changed from: private */
+    public boolean bSearching = false;
+    /* access modifiers changed from: private */
+    public boolean bSearchingPrinter = false;
+    /* access modifiers changed from: private */
+    public Context context = null;
+    /* access modifiers changed from: private */
+    public int curCopy = 1;
+    /* access modifiers changed from: private */
+    public int curSheet = 1;
+    int duplex = 0;
+    /* access modifiers changed from: private */
+    public boolean isDialogOpen = false;
+    /* access modifiers changed from: private */
+    public boolean isRemotePrinter = false;
+    Button mCancelButton;
+    boolean mCanceled = false;
+    TextView mCopies;
+    /* access modifiers changed from: private */
+    public volatile boolean mError = false;
+    Handler mHandler = new Handler(new Handler.Callback() {
+        /* JADX WARNING: Can't fix incorrect switch cases order */
+        /* JADX WARNING: Code restructure failed: missing block: B:32:0x020e, code lost:
+            if (com.epson.mobilephone.common.wifidirect.WiFiDirectManager.reconnect(r8.this$0, com.epson.mobilephone.common.wifidirect.WiFiDirectManager.DEVICE_TYPE_PRINTER, 1) == false) goto L_0x0212;
+         */
+        /* Code decompiled incorrectly, please refer to instructions dump. */
+        public boolean handleMessage(android.os.Message r9) {
+            /*
+                r8 = this;
+                com.epson.cameracopy.ui.CameraPrintProgress r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                boolean r0 = r0.mCanceled
+                r1 = 5
+                r2 = 1
+                if (r0 == 0) goto L_0x002a
+                int r0 = r9.what
+                if (r0 == r1) goto L_0x0019
+                r9 = 8
+                if (r0 == r9) goto L_0x0011
+                return r2
+            L_0x0011:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                android.os.Handler r9 = r9.mHandler
+                r9.sendEmptyMessage(r1)
+                return r2
+            L_0x0019:
+                com.epson.cameracopy.ui.CameraPrintProgress r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                android.content.Context r0 = r0.context
+                java.lang.String r3 = "printer"
+                com.epson.cameracopy.ui.CameraPrintProgress r4 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                java.lang.String r4 = r4.printerIp
+                com.epson.mobilephone.common.wifidirect.WiFiDirectManager.disconnect(r0, r3, r4)
+            L_0x002a:
+                int r0 = r9.what
+                r3 = 4
+                r4 = 2
+                r5 = 100
+                r7 = 0
+                switch(r0) {
+                    case 0: goto L_0x0459;
+                    case 1: goto L_0x0034;
+                    case 2: goto L_0x03ff;
+                    case 3: goto L_0x0034;
+                    case 4: goto L_0x03ae;
+                    case 5: goto L_0x027f;
+                    case 6: goto L_0x01ed;
+                    case 7: goto L_0x0034;
+                    case 8: goto L_0x018c;
+                    case 9: goto L_0x0036;
+                    case 10: goto L_0x0212;
+                    default: goto L_0x0034;
+                }
+            L_0x0034:
+                goto L_0x0573
+            L_0x0036:
+                com.epson.cameracopy.ui.CameraPrintProgress r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                boolean unused = r0.mError = r2
+                int r0 = r9.arg1
+                r1 = -1100(0xfffffffffffffbb4, float:NaN)
+                if (r0 == r1) goto L_0x0173
+                r1 = -1056(0xfffffffffffffbe0, float:NaN)
+                r3 = 2131624019(0x7f0e0053, float:1.8875206E38)
+                r4 = 2131624018(0x7f0e0052, float:1.8875204E38)
+                r5 = 2131624020(0x7f0e0054, float:1.8875208E38)
+                r6 = 2131624021(0x7f0e0055, float:1.887521E38)
+                if (r0 == r1) goto L_0x0136
+                switch(r0) {
+                    case -1209: goto L_0x00f9;
+                    case -1208: goto L_0x00f9;
+                    default: goto L_0x0054;
+                }
+            L_0x0054:
+                switch(r0) {
+                    case -1206: goto L_0x00e5;
+                    case -1205: goto L_0x00d1;
+                    case -1204: goto L_0x0136;
+                    case -1203: goto L_0x00bd;
+                    case -1202: goto L_0x00a9;
+                    case -1201: goto L_0x0095;
+                    case -1200: goto L_0x0136;
+                    default: goto L_0x0057;
+                }
+            L_0x0057:
+                com.epson.cameracopy.ui.CameraPrintProgress r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                java.lang.String r0 = r0.getString(r6)
+                java.lang.StringBuilder r1 = new java.lang.StringBuilder
+                r1.<init>()
+                com.epson.cameracopy.ui.CameraPrintProgress r6 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                java.lang.String r5 = r6.getString(r5)
+                r1.append(r5)
+                com.epson.cameracopy.ui.CameraPrintProgress r5 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                java.lang.String r4 = r5.getString(r4)
+                r1.append(r4)
+                java.lang.String r4 = "0X"
+                r1.append(r4)
+                int r9 = r9.arg1
+                java.lang.String r9 = java.lang.Integer.toHexString(r9)
+                java.lang.String r9 = r9.toUpperCase()
+                r1.append(r9)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                java.lang.String r9 = r9.getString(r3)
+                r1.append(r9)
+                java.lang.String r9 = r1.toString()
+                goto L_0x0185
+            L_0x0095:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r0 = 2131624025(0x7f0e0059, float:1.8875218E38)
+                java.lang.String r0 = r9.getString(r0)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r1 = 2131624024(0x7f0e0058, float:1.8875216E38)
+                java.lang.String r9 = r9.getString(r1)
+                goto L_0x0185
+            L_0x00a9:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r0 = 2131624028(0x7f0e005c, float:1.8875224E38)
+                java.lang.String r0 = r9.getString(r0)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r1 = 2131624027(0x7f0e005b, float:1.8875222E38)
+                java.lang.String r9 = r9.getString(r1)
+                goto L_0x0185
+            L_0x00bd:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r0 = 2131624023(0x7f0e0057, float:1.8875214E38)
+                java.lang.String r0 = r9.getString(r0)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r1 = 2131624022(0x7f0e0056, float:1.8875212E38)
+                java.lang.String r9 = r9.getString(r1)
+                goto L_0x0185
+            L_0x00d1:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r0 = 2131624016(0x7f0e0050, float:1.88752E38)
+                java.lang.String r0 = r9.getString(r0)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r1 = 2131624012(0x7f0e004c, float:1.8875192E38)
+                java.lang.String r9 = r9.getString(r1)
+                goto L_0x0185
+            L_0x00e5:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r0 = 2131624787(0x7f0e0353, float:1.8876764E38)
+                java.lang.String r0 = r9.getString(r0)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r1 = 2131624786(0x7f0e0352, float:1.8876762E38)
+                java.lang.String r9 = r9.getString(r1)
+                goto L_0x0185
+            L_0x00f9:
+                com.epson.cameracopy.ui.CameraPrintProgress r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r1 = 2131624009(0x7f0e0049, float:1.8875186E38)
+                java.lang.String r0 = r0.getString(r1)
+                java.lang.StringBuilder r1 = new java.lang.StringBuilder
+                r1.<init>()
+                com.epson.cameracopy.ui.CameraPrintProgress r3 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r4 = 2131624007(0x7f0e0047, float:1.8875182E38)
+                java.lang.String r3 = r3.getString(r4)
+                r1.append(r3)
+                java.lang.String r3 = "0X"
+                r1.append(r3)
+                int r9 = r9.arg1
+                java.lang.String r9 = java.lang.Integer.toHexString(r9)
+                java.lang.String r9 = r9.toUpperCase()
+                r1.append(r9)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r3 = 2131624008(0x7f0e0048, float:1.8875184E38)
+                java.lang.String r9 = r9.getString(r3)
+                r1.append(r9)
+                java.lang.String r9 = r1.toString()
+                goto L_0x0185
+            L_0x0136:
+                com.epson.cameracopy.ui.CameraPrintProgress r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                java.lang.String r0 = r0.getString(r6)
+                java.lang.StringBuilder r1 = new java.lang.StringBuilder
+                r1.<init>()
+                com.epson.cameracopy.ui.CameraPrintProgress r6 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                java.lang.String r5 = r6.getString(r5)
+                r1.append(r5)
+                com.epson.cameracopy.ui.CameraPrintProgress r5 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                java.lang.String r4 = r5.getString(r4)
+                r1.append(r4)
+                java.lang.String r4 = "0X"
+                r1.append(r4)
+                int r9 = r9.arg1
+                java.lang.String r9 = java.lang.Integer.toHexString(r9)
+                java.lang.String r9 = r9.toUpperCase()
+                r1.append(r9)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                java.lang.String r9 = r9.getString(r3)
+                r1.append(r9)
+                java.lang.String r9 = r1.toString()
+                goto L_0x0185
+            L_0x0173:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r0 = 2131624032(0x7f0e0060, float:1.8875232E38)
+                java.lang.String r0 = r9.getString(r0)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r1 = 2131624031(0x7f0e005f, float:1.887523E38)
+                java.lang.String r9 = r9.getString(r1)
+            L_0x0185:
+                com.epson.cameracopy.ui.CameraPrintProgress r1 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r1.showErrorDialog(r0, r9)
+                goto L_0x0573
+            L_0x018c:
+                android.app.AlertDialog$Builder r9 = new android.app.AlertDialog$Builder
+                com.epson.cameracopy.ui.CameraPrintProgress r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                android.content.Context r0 = r0.context
+                r9.<init>(r0)
+                android.app.AlertDialog$Builder r9 = r9.setCancelable(r7)
+                java.lang.StringBuilder r0 = new java.lang.StringBuilder
+                r0.<init>()
+                com.epson.cameracopy.ui.CameraPrintProgress r1 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r3 = 2131624796(0x7f0e035c, float:1.8876782E38)
+                java.lang.String r1 = r1.getString(r3)
+                r0.append(r1)
+                java.lang.String r1 = "\n"
+                r0.append(r1)
+                com.epson.cameracopy.ui.CameraPrintProgress r1 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r3 = 2131624797(0x7f0e035d, float:1.8876784E38)
+                java.lang.String r1 = r1.getString(r3)
+                r0.append(r1)
+                java.lang.String r1 = "\n\n"
+                r0.append(r1)
+                com.epson.cameracopy.ui.CameraPrintProgress r1 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r3 = 2131624798(0x7f0e035e, float:1.8876786E38)
+                java.lang.String r1 = r1.getString(r3)
+                r0.append(r1)
+                java.lang.String r0 = r0.toString()
+                android.app.AlertDialog$Builder r9 = r9.setMessage(r0)
+                com.epson.cameracopy.ui.CameraPrintProgress r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r1 = 2131625202(0x7f0e04f2, float:1.8877605E38)
+                java.lang.String r0 = r0.getString(r1)
+                com.epson.cameracopy.ui.CameraPrintProgress$4$1 r1 = new com.epson.cameracopy.ui.CameraPrintProgress$4$1
+                r1.<init>()
+                android.app.AlertDialog$Builder r9 = r9.setPositiveButton(r0, r1)
+                r9.show()
+                goto L_0x0573
+            L_0x01ed:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                int unused = r9.curSheet = r2
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                int unused = r9.curCopy = r2
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                android.content.Context r9 = r9.context
+                java.lang.String r0 = "printer"
+                boolean r9 = com.epson.mobilephone.common.wifidirect.WiFiDirectManager.isNeedConnect(r9, r0)
+                if (r9 != 0) goto L_0x0206
+                goto L_0x0212
+            L_0x0206:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                java.lang.String r0 = "printer"
+                boolean r9 = com.epson.mobilephone.common.wifidirect.WiFiDirectManager.reconnect(r9, r0, r2)
+                if (r9 == 0) goto L_0x0212
+                goto L_0x0573
+            L_0x0212:
+                epson.print.service.IEpsonService r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.mEpsonService
+                if (r9 == 0) goto L_0x0274
+                java.lang.String r9 = "Epson"
+                java.lang.String r0 = "begin probe printer before printing"
+                epson.print.Util.EPLog.m307e((java.lang.String) r9, (java.lang.String) r0)     // Catch:{ RemoteException -> 0x026e }
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this     // Catch:{ RemoteException -> 0x026e }
+                epson.print.MyPrinter r9 = epson.print.MyPrinter.getCurPrinter(r9)     // Catch:{ RemoteException -> 0x026e }
+                java.lang.String r0 = r9.getPrinterId()     // Catch:{ RemoteException -> 0x026e }
+                java.lang.String r1 = r9.getIp()     // Catch:{ RemoteException -> 0x026e }
+                if (r0 == 0) goto L_0x0243
+                int r5 = r9.getLocation()     // Catch:{ RemoteException -> 0x026e }
+                if (r5 != r2) goto L_0x0243
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this     // Catch:{ RemoteException -> 0x026e }
+                boolean unused = r9.bSearching = r2     // Catch:{ RemoteException -> 0x026e }
+                epson.print.service.IEpsonService r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.mEpsonService     // Catch:{ RemoteException -> 0x026e }
+                r9.searchPrinters(r0, r1, r2)     // Catch:{ RemoteException -> 0x026e }
+                goto L_0x0573
+            L_0x0243:
+                if (r1 == 0) goto L_0x025a
+                int r9 = r9.getLocation()     // Catch:{ RemoteException -> 0x026e }
+                r5 = 3
+                if (r9 != r5) goto L_0x025a
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this     // Catch:{ RemoteException -> 0x026e }
+                boolean unused = r9.bSearching = r2     // Catch:{ RemoteException -> 0x026e }
+                epson.print.service.IEpsonService r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.mEpsonService     // Catch:{ RemoteException -> 0x026e }
+                r9.searchPrinters(r0, r1, r4)     // Catch:{ RemoteException -> 0x026e }
+                goto L_0x0573
+            L_0x025a:
+                com.epson.cameracopy.p006ui.CameraPrintProgress.isContinue = r7     // Catch:{ RemoteException -> 0x026e }
+                r9 = -1351(0xfffffffffffffab9, float:NaN)
+                com.epson.cameracopy.p006ui.CameraPrintProgress.curError = r9     // Catch:{ RemoteException -> 0x026e }
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this     // Catch:{ RemoteException -> 0x026e }
+                boolean unused = r9.mError = r2     // Catch:{ RemoteException -> 0x026e }
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this     // Catch:{ RemoteException -> 0x026e }
+                android.os.Handler r9 = r9.mHandler     // Catch:{ RemoteException -> 0x026e }
+                r9.sendEmptyMessage(r3)     // Catch:{ RemoteException -> 0x026e }
+                goto L_0x0573
+            L_0x026e:
+                r9 = move-exception
+                r9.printStackTrace()
+                goto L_0x0573
+            L_0x0274:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                android.os.Handler r9 = r9.mHandler
+                r0 = 10
+                r9.sendEmptyMessageDelayed(r0, r5)
+                goto L_0x0573
+            L_0x027f:
+                java.lang.String r9 = "PrintProgress"
+                java.lang.StringBuilder r0 = new java.lang.StringBuilder
+                r0.<init>()
+                java.lang.String r4 = "message FINISH : mError => "
+                r0.append(r4)
+                com.epson.cameracopy.ui.CameraPrintProgress r4 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                boolean r4 = r4.mError
+                r0.append(r4)
+                java.lang.String r4 = " mCanceled =>"
+                r0.append(r4)
+                com.epson.cameracopy.ui.CameraPrintProgress r4 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                boolean r4 = r4.mCanceled
+                r0.append(r4)
+                java.lang.String r0 = r0.toString()
+                epson.print.Util.EPLog.m305d(r9, r0)
+                epson.print.service.IEpsonService r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.mEpsonService
+                if (r9 == 0) goto L_0x034d
+                java.lang.Object r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.mLock     // Catch:{ RemoteException -> 0x031f }
+                monitor-enter(r9)     // Catch:{ RemoteException -> 0x031f }
+                com.epson.cameracopy.ui.CameraPrintProgress r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.this     // Catch:{ all -> 0x031c }
+                boolean r0 = r0.bSearchingPrinter     // Catch:{ all -> 0x031c }
+                if (r0 == 0) goto L_0x02da
+                boolean r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.bRestartactivity     // Catch:{ all -> 0x031c }
+                if (r0 != 0) goto L_0x02da
+                epson.print.service.IEpsonService r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.mEpsonService     // Catch:{ all -> 0x031c }
+                boolean r0 = r0.isSearchingPrinter()     // Catch:{ all -> 0x031c }
+                if (r0 == 0) goto L_0x02da
+                java.lang.String r0 = "PrintProgress"
+                java.lang.String r4 = "message FINISH: mEpsonService.cancelSearchPrinter()"
+                epson.print.Util.EPLog.m307e((java.lang.String) r0, (java.lang.String) r4)     // Catch:{ all -> 0x031c }
+                epson.print.service.IEpsonService r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.mEpsonService     // Catch:{ all -> 0x031c }
+                r0.cancelSearchPrinter()     // Catch:{ all -> 0x031c }
+                r0 = 1
+                goto L_0x02db
+            L_0x02da:
+                r0 = 0
+            L_0x02db:
+                monitor-exit(r9)     // Catch:{ all -> 0x031c }
+                epson.print.service.IEpsonService r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.mEpsonService     // Catch:{ RemoteException -> 0x031f }
+                if (r9 == 0) goto L_0x0301
+                epson.print.service.IEpsonService r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.mEpsonService     // Catch:{ RemoteException -> 0x031f }
+                boolean r9 = r9.isPrinting()     // Catch:{ RemoteException -> 0x031f }
+                if (r9 == 0) goto L_0x0301
+                boolean r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.bRestartactivity     // Catch:{ RemoteException -> 0x031f }
+                if (r9 != 0) goto L_0x0301
+                java.lang.String r9 = "PrintProgress"
+                java.lang.String r0 = "message FINISH: mEpsonService.confirmCancel(true) call"
+                epson.print.Util.EPLog.m305d(r9, r0)     // Catch:{ RemoteException -> 0x031f }
+                epson.print.service.IEpsonService r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.mEpsonService     // Catch:{ RemoteException -> 0x031f }
+                r9.confirmCancel(r2)     // Catch:{ RemoteException -> 0x031f }
+                r0 = 1
+            L_0x0301:
+                if (r0 == 0) goto L_0x0323
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this     // Catch:{ RemoteException -> 0x031f }
+                boolean r9 = r9.mWaitEpsonServiceForFinish     // Catch:{ RemoteException -> 0x031f }
+                if (r9 == 0) goto L_0x0323
+                java.lang.String r9 = "PrintProgress"
+                java.lang.String r0 = "on message FINISH: sendEmptyMessageDelayed(FINISH...)"
+                epson.print.Util.EPLog.m305d(r9, r0)     // Catch:{ RemoteException -> 0x031f }
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this     // Catch:{ RemoteException -> 0x031f }
+                android.os.Handler r9 = r9.mHandler     // Catch:{ RemoteException -> 0x031f }
+                r4 = 500(0x1f4, double:2.47E-321)
+                r9.sendEmptyMessageDelayed(r1, r4)     // Catch:{ RemoteException -> 0x031f }
+                return r2
+            L_0x031c:
+                r0 = move-exception
+                monitor-exit(r9)     // Catch:{ all -> 0x031c }
+                throw r0     // Catch:{ RemoteException -> 0x031f }
+            L_0x031f:
+                r9 = move-exception
+                r9.printStackTrace()
+            L_0x0323:
+                epson.print.service.IEpsonService r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.mEpsonService     // Catch:{ RemoteException -> 0x0349 }
+                if (r9 == 0) goto L_0x034d
+                java.lang.String r9 = "PrintProgress"
+                java.lang.String r0 = "message FINISH: mEpsonService.unregisterCallback() call"
+                epson.print.Util.EPLog.m307e((java.lang.String) r9, (java.lang.String) r0)     // Catch:{ RemoteException -> 0x0349 }
+                epson.print.service.IEpsonService r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.mEpsonService     // Catch:{ RemoteException -> 0x0349 }
+                epson.print.service.IEpsonServiceCallback r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.mCallback     // Catch:{ RemoteException -> 0x0349 }
+                r9.unregisterCallback(r0)     // Catch:{ RemoteException -> 0x0349 }
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this     // Catch:{ RemoteException -> 0x0349 }
+                android.content.ServiceConnection r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.mEpsonConnection     // Catch:{ RemoteException -> 0x0349 }
+                r9.unbindService(r0)     // Catch:{ RemoteException -> 0x0349 }
+                r9 = 0
+                epson.print.service.IEpsonService unused = com.epson.cameracopy.p006ui.CameraPrintProgress.mEpsonService = r9     // Catch:{ RemoteException -> 0x0349 }
+                goto L_0x034d
+            L_0x0349:
+                r9 = move-exception
+                r9.printStackTrace()
+            L_0x034d:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                boolean r9 = r9.mCanceled
+                if (r9 == 0) goto L_0x0355
+                r3 = 0
+                goto L_0x035f
+            L_0x0355:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                boolean r9 = r9.mError
+                if (r9 == 0) goto L_0x035f
+                r3 = 1000(0x3e8, float:1.401E-42)
+            L_0x035f:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                android.app.Activity r9 = r9.getParent()
+                if (r9 != 0) goto L_0x036d
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r9.setResult(r3)
+                goto L_0x0376
+            L_0x036d:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                android.app.Activity r9 = r9.getParent()
+                r9.setResult(r3)
+            L_0x0376:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                boolean unused = r9.bSearching = r7
+                java.lang.String r9 = "PrintProgress"
+                java.lang.StringBuilder r0 = new java.lang.StringBuilder
+                r0.<init>()
+                java.lang.String r1 = "finish with return code => "
+                r0.append(r1)
+                r0.append(r3)
+                java.lang.String r0 = r0.toString()
+                epson.print.Util.EPLog.m305d(r9, r0)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                android.content.Context r9 = r9.context
+                java.lang.String r0 = "printer"
+                com.epson.cameracopy.ui.CameraPrintProgress r1 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                java.lang.String r1 = r1.printerIp
+                com.epson.mobilephone.common.wifidirect.WiFiDirectManager.disconnect(r9, r0, r1)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r9.sendPrintLog()
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r9.finish()
+                goto L_0x0573
+            L_0x03ae:
+                java.lang.String r9 = "Epson"
+                java.lang.String r0 = "NOTIFY ERROR"
+                epson.print.Util.EPLog.m307e((java.lang.String) r9, (java.lang.String) r0)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                boolean r9 = r9.isDialogOpen
+                if (r9 != 0) goto L_0x03d6
+                java.lang.String r9 = "Epson"
+                java.lang.StringBuilder r0 = new java.lang.StringBuilder
+                r0.<init>()
+                java.lang.String r1 = "Show Error code:"
+                r0.append(r1)
+                int r1 = com.epson.cameracopy.p006ui.CameraPrintProgress.curError
+                r0.append(r1)
+                java.lang.String r0 = r0.toString()
+                epson.print.Util.EPLog.m307e((java.lang.String) r9, (java.lang.String) r0)
+                goto L_0x03f3
+            L_0x03d6:
+                java.lang.String r9 = "Epson"
+                java.lang.StringBuilder r0 = new java.lang.StringBuilder
+                r0.<init>()
+                java.lang.String r1 = "Remove and show Error code:"
+                r0.append(r1)
+                int r1 = com.epson.cameracopy.p006ui.CameraPrintProgress.curError
+                r0.append(r1)
+                java.lang.String r0 = r0.toString()
+                epson.print.Util.EPLog.m307e((java.lang.String) r9, (java.lang.String) r0)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r9.removeDialog(r7)
+            L_0x03f3:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                boolean unused = r9.isDialogOpen = r2
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r9.showDialog(r7)
+                goto L_0x0573
+            L_0x03ff:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                boolean unused = r9.mError = r7
+                epson.print.service.IEpsonService r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.mEpsonService
+                if (r9 == 0) goto L_0x0426
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this     // Catch:{ Exception -> 0x0420 }
+                boolean unused = r9.bSearching = r7     // Catch:{ Exception -> 0x0420 }
+                epson.print.service.IEpsonService r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.mEpsonService     // Catch:{ Exception -> 0x0420 }
+                com.epson.cameracopy.ui.CameraPrintProgress r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.this     // Catch:{ Exception -> 0x0420 }
+                java.util.ArrayList r0 = r0.mImageAndLayoutList     // Catch:{ Exception -> 0x0420 }
+                boolean r1 = com.epson.cameracopy.p006ui.CameraPrintProgress.isBkRetry     // Catch:{ Exception -> 0x0420 }
+                r9.printWithImagesAndLayouts(r0, r1)     // Catch:{ Exception -> 0x0420 }
+                goto L_0x0573
+            L_0x0420:
+                r9 = move-exception
+                r9.printStackTrace()
+                goto L_0x0573
+            L_0x0426:
+                java.lang.String r9 = "Epson"
+                java.lang.String r0 = "Service or resource file not ready, please wait..."
+                epson.print.Util.EPLog.m313i(r9, r0)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                android.widget.TextView r9 = r9.mPercent
+                java.lang.StringBuilder r0 = new java.lang.StringBuilder
+                r0.<init>()
+                com.epson.cameracopy.ui.CameraPrintProgress r1 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                java.lang.String r1 = r1.percentString
+                r0.append(r1)
+                java.lang.String r1 = "         0%"
+                r0.append(r1)
+                java.lang.String r0 = r0.toString()
+                r9.setText(r0)
+                android.widget.ProgressBar r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.mProgressPercent
+                r9.setProgress(r7)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                android.os.Handler r9 = r9.mHandler
+                r9.sendEmptyMessageDelayed(r4, r5)
+                goto L_0x0573
+            L_0x0459:
+                android.os.Bundle r9 = r9.getData()
+                java.lang.String r0 = "PERCENT"
+                int r9 = r9.getInt(r0)
+                r0 = 100
+                if (r9 < r0) goto L_0x0469
+                r9 = 100
+            L_0x0469:
+                if (r9 > 0) goto L_0x0548
+                android.widget.ProgressBar r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.mProgressPercent
+                r9.setProgress(r7)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                android.widget.TextView r9 = r9.mPercent
+                java.lang.StringBuilder r1 = new java.lang.StringBuilder
+                r1.<init>()
+                com.epson.cameracopy.ui.CameraPrintProgress r3 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                java.lang.String r3 = r3.percentString
+                r1.append(r3)
+                java.lang.String r3 = "         0%"
+                r1.append(r3)
+                java.lang.String r1 = r1.toString()
+                r9.setText(r1)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                int r9 = r9.sheets
+                if (r9 <= r2) goto L_0x04e2
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                android.widget.TextView r9 = r9.mPage
+                java.lang.StringBuilder r1 = new java.lang.StringBuilder
+                r1.<init>()
+                com.epson.cameracopy.ui.CameraPrintProgress r3 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r4 = 2131624963(0x7f0e0403, float:1.887712E38)
+                java.lang.String r3 = r3.getString(r4)
+                r1.append(r3)
+                java.lang.String r3 = ": "
+                r1.append(r3)
+                com.epson.cameracopy.ui.CameraPrintProgress r3 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                int r3 = r3.curSheet
+                r1.append(r3)
+                java.lang.String r3 = "/"
+                r1.append(r3)
+                com.epson.cameracopy.ui.CameraPrintProgress r3 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                int r3 = r3.sheets
+                r1.append(r3)
+                java.lang.String r1 = r1.toString()
+                r9.setText(r1)
+                android.widget.ProgressBar r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.mProgressPage
+                com.epson.cameracopy.ui.CameraPrintProgress r1 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                int r1 = r1.curSheet
+                int r1 = r1 * 100
+                com.epson.cameracopy.ui.CameraPrintProgress r3 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                int r3 = r3.sheets
+                int r1 = r1 / r3
+                r9.setProgress(r1)
+            L_0x04e2:
+                int r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.copies
+                if (r9 <= r2) goto L_0x052a
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                android.widget.TextView r9 = r9.mCopies
+                java.lang.StringBuilder r1 = new java.lang.StringBuilder
+                r1.<init>()
+                com.epson.cameracopy.ui.CameraPrintProgress r3 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                r4 = 2131624716(0x7f0e030c, float:1.887662E38)
+                java.lang.String r3 = r3.getString(r4)
+                r1.append(r3)
+                java.lang.String r3 = ": "
+                r1.append(r3)
+                com.epson.cameracopy.ui.CameraPrintProgress r3 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                int r3 = r3.curCopy
+                r1.append(r3)
+                java.lang.String r3 = "/"
+                r1.append(r3)
+                int r3 = com.epson.cameracopy.p006ui.CameraPrintProgress.copies
+                r1.append(r3)
+                java.lang.String r1 = r1.toString()
+                r9.setText(r1)
+                android.widget.ProgressBar r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.mProgressCopies
+                com.epson.cameracopy.ui.CameraPrintProgress r1 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                int r1 = r1.curCopy
+                int r1 = r1 * 100
+                int r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.copies
+                int r1 = r1 / r0
+                r9.setProgress(r1)
+            L_0x052a:
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                com.epson.cameracopy.p006ui.CameraPrintProgress.access$1208(r9)
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                int r9 = r9.curSheet
+                com.epson.cameracopy.ui.CameraPrintProgress r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                int r0 = r0.sheets
+                if (r9 <= r0) goto L_0x0573
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                int unused = r9.curSheet = r2
+                com.epson.cameracopy.ui.CameraPrintProgress r9 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                com.epson.cameracopy.p006ui.CameraPrintProgress.access$1308(r9)
+                goto L_0x0573
+            L_0x0548:
+                android.widget.ProgressBar r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.mProgressPercent
+                r0.setProgress(r9)
+                com.epson.cameracopy.ui.CameraPrintProgress r0 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                android.widget.TextView r0 = r0.mPercent
+                java.lang.StringBuilder r1 = new java.lang.StringBuilder
+                r1.<init>()
+                com.epson.cameracopy.ui.CameraPrintProgress r3 = com.epson.cameracopy.p006ui.CameraPrintProgress.this
+                java.lang.String r3 = r3.percentString
+                r1.append(r3)
+                java.lang.String r3 = "         "
+                r1.append(r3)
+                r1.append(r9)
+                java.lang.String r9 = "%"
+                r1.append(r9)
+                java.lang.String r9 = r1.toString()
+                r0.setText(r9)
+            L_0x0573:
+                return r2
+            */
+            throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.p006ui.CameraPrintProgress.C08464.handleMessage(android.os.Message):boolean");
+        }
+    });
+    /* access modifiers changed from: private */
+    public ArrayList<ImageAndLayout> mImageAndLayoutList;
+    TextView mPage;
+    TextView mPercent;
+    /* access modifiers changed from: private */
+    public volatile boolean mWaitEpsonServiceForFinish = false;
+    /* access modifiers changed from: private */
+    public String percentString = "";
+    /* access modifiers changed from: private */
+    public String printerIp;
+    /* access modifiers changed from: private */
+    public int sheets;
+
+    public static boolean isPrintSuccess(int i) {
+        return i == 4;
+    }
+
+    static /* synthetic */ int access$1208(CameraPrintProgress cameraPrintProgress) {
+        int i = cameraPrintProgress.curSheet;
+        cameraPrintProgress.curSheet = i + 1;
+        return i;
+    }
+
+    static /* synthetic */ int access$1308(CameraPrintProgress cameraPrintProgress) {
+        int i = cameraPrintProgress.curCopy;
+        cameraPrintProgress.curCopy = i + 1;
+        return i;
+    }
+
+    /* JADX WARNING: Code restructure failed: missing block: B:10:0x000e, code lost:
+        epson.print.Util.EPLog.m307e("Epson", "mEpsonService = null");
+        mCallback = new com.epson.cameracopy.p006ui.CameraPrintProgress.C08391(r3);
+        mEpsonConnection = new com.epson.cameracopy.p006ui.CameraPrintProgress.C08442(r3);
+        epson.print.Util.EPLog.m307e("Epson", "bindService() call");
+        bindService(new android.content.Intent(r3, epson.print.service.EpsonService.class), mEpsonConnection, 1);
+        epson.print.Util.EPLog.m307e("Epson", "bindService() finish");
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:18:?, code lost:
+        return;
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:19:?, code lost:
+        return;
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:9:0x000c, code lost:
+        if (mEpsonService != null) goto L_?;
+     */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    private void init() {
+        /*
+            r3 = this;
+            java.lang.Object r0 = mLockInit
+            monitor-enter(r0)
+            epson.print.service.IEpsonService r1 = mEpsonService     // Catch:{ all -> 0x003f }
+            if (r1 == 0) goto L_0x0009
+            monitor-exit(r0)     // Catch:{ all -> 0x003f }
+            return
+        L_0x0009:
+            monitor-exit(r0)     // Catch:{ all -> 0x003f }
+            epson.print.service.IEpsonService r0 = mEpsonService
+            if (r0 != 0) goto L_0x003e
+            java.lang.String r0 = "Epson"
+            java.lang.String r1 = "mEpsonService = null"
+            epson.print.Util.EPLog.m307e((java.lang.String) r0, (java.lang.String) r1)
+            com.epson.cameracopy.ui.CameraPrintProgress$1 r0 = new com.epson.cameracopy.ui.CameraPrintProgress$1
+            r0.<init>()
+            mCallback = r0
+            com.epson.cameracopy.ui.CameraPrintProgress$2 r0 = new com.epson.cameracopy.ui.CameraPrintProgress$2
+            r0.<init>()
+            mEpsonConnection = r0
+            java.lang.String r0 = "Epson"
+            java.lang.String r1 = "bindService() call"
+            epson.print.Util.EPLog.m307e((java.lang.String) r0, (java.lang.String) r1)
+            android.content.Intent r0 = new android.content.Intent
+            java.lang.Class<epson.print.service.EpsonService> r1 = epson.print.service.EpsonService.class
+            r0.<init>(r3, r1)
+            android.content.ServiceConnection r1 = mEpsonConnection
+            r2 = 1
+            r3.bindService(r0, r1, r2)
+            java.lang.String r0 = "Epson"
+            java.lang.String r1 = "bindService() finish"
+            epson.print.Util.EPLog.m307e((java.lang.String) r0, (java.lang.String) r1)
+        L_0x003e:
+            return
+        L_0x003f:
+            r1 = move-exception
+            monitor-exit(r0)     // Catch:{ all -> 0x003f }
+            throw r1
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.p006ui.CameraPrintProgress.init():void");
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        EPLog.m307e("Epson", "PrintProgress.java: onCreate() call");
+        EPLog.m307e("Epson", "addFlags : FLAG_KEEP_SCREEN_ON ");
+        getWindow().addFlags(128);
+        super.onCreate(bundle);
+        Utils.setFInishOnTOuchOutside(this, false);
+        this.mError = false;
+        curError = 0;
+        this.mWaitEpsonServiceForFinish = false;
+        synchronized (mLockInit) {
+            EPLog.m307e("Epson", "PrintProgress.java: onCreate() call init() funciton");
+            init();
+        }
+        isDocument = getIntent().getExtras().getBoolean(PrintProgress.PARAM_DOCUMENT_MODE, false);
+        isDocument = true;
+        PrintSetting printSetting = new PrintSetting(this, PrintSetting.Kind.cameracopy);
+        printSetting.loadSettings();
+        copies = printSetting.copiesValue;
+        this.mImageAndLayoutList = getIntent().getExtras().getParcelableArrayList(KEY_IMAGE_AND_LAYOUT);
+        ArrayList<ImageAndLayout> arrayList = this.mImageAndLayoutList;
+        if (arrayList == null) {
+            finish();
+            return;
+        }
+        this.sheets = arrayList.size();
+        this.isRemotePrinter = MyPrinter.isRemotePrinter(this);
+        setContentView(C2135R.layout.progress_layout);
+        this.context = this;
+        mProgressPercent = (ProgressBar) findViewById(C2135R.C2137id.progress_percent);
+        this.mPercent = (TextView) findViewById(C2135R.C2137id.percent);
+        mProgressCopies = (ProgressBar) findViewById(C2135R.C2137id.progress_copies);
+        this.mCopies = (TextView) findViewById(C2135R.C2137id.copies);
+        this.mPage = (TextView) findViewById(C2135R.C2137id.page);
+        mProgressPage = (ProgressBar) findViewById(C2135R.C2137id.progress_page);
+        if (this.sheets > 1) {
+            TextView textView = this.mPage;
+            textView.setText(getString(C2135R.string.page) + ": " + this.curSheet + CommonDefine.SLASH + this.sheets);
+            mProgressPage.setProgress((this.curSheet * 100) / this.sheets);
+        } else {
+            mProgressPage.setVisibility(4);
+            this.mPage.setVisibility(4);
+        }
+        if (copies <= 1 || this.isRemotePrinter) {
+            mProgressCopies.setVisibility(4);
+            this.mCopies.setVisibility(4);
+            copies = 1;
+        } else {
+            TextView textView2 = this.mCopies;
+            textView2.setText(getString(C2135R.string.copies) + ": " + this.curCopy + CommonDefine.SLASH + copies);
+            mProgressCopies.setProgress((this.curCopy * 100) / copies);
+        }
+        this.mCancelButton = (Button) findViewById(C2135R.C2137id.cancel_button);
+        this.mCancelButton.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View view) {
+                CameraPrintProgress.this.CancelPrint();
+            }
+        });
+        this.bSearching = false;
+        if (this.isRemotePrinter) {
+            this.percentString = getString(C2135R.string.epsonconnect_str_remote_print_file_uploading);
+        } else {
+            this.percentString = getString(C2135R.string.printing);
+        }
+        TextView textView3 = this.mPercent;
+        textView3.setText(this.percentString + "         0%");
+        mProgressPercent.setProgress(0);
+        findViewById(C2135R.C2137id.epsonColorImageView).setVisibility(8);
+        if (this.isRemotePrinter) {
+            this.mHandler.sendEmptyMessage(2);
+        } else {
+            this.mHandler.sendEmptyMessage(6);
+        }
+        EPLog.m313i("Epson", "printProgress.java: onCreate() finish");
+    }
+
+    /* access modifiers changed from: private */
+    public void triggerPrint() {
+        this.mHandler.sendEmptyMessage(2);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onDestroy() {
+        super.onDestroy();
+        EPLog.m307e("Epson", "PrintProgress.java: onDestroy()call");
+        EPLog.m307e("Epson", "clearFlags : FLAG_KEEP_SCREEN_ON ");
+        getWindow().clearFlags(128);
+        this.mHandler.removeMessages(1);
+        this.mHandler.removeMessages(3);
+        this.mHandler.removeMessages(2);
+        this.mHandler.removeMessages(4);
+        EPLog.m307e("Epson", "PrintProgress.java: onDestroy() finish");
+    }
+
+    /* access modifiers changed from: protected */
+    public void onStop() {
+        super.onStop();
+        if (mEpsonService == null) {
+            EPLog.m307e("Epson", "set bRestartactivity = true (2)");
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onResume() {
+        super.onResume();
+        EPLog.m307e("Epson", "PrintProgress.java call onResume()");
+        NfcTagUtils.enableForegroundDispatch(this, (IntentFilter[]) null, (String[][]) null);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPause() {
+        super.onPause();
+        NfcTagUtils.disableForegroundDispatch(this);
+    }
+
+    /* access modifiers changed from: protected */
+    public Dialog onCreateDialog(int i) {
+        switch (i) {
+            case 0:
+                EPLog.m307e("Epson", "show dialog: " + curError + " cancontinue: " + isContinue);
+                removeDialog(1);
+                Integer[] stringId = MediaInfo.ErrorTable.getStringId(curError);
+                if (stringId == null) {
+                    stringId = new Integer[]{Integer.valueOf(C2135R.string.NOT_IMPLEMENT), Integer.valueOf(C2135R.string.NOT_IMPLEMENT_TITLE), 1};
+                }
+                String[] replaceMessage = Utils.replaceMessage(stringId, curError, getApplicationContext());
+                if (!isContinue) {
+                    EPLog.m307e("Epson", "show str_cancel button");
+                    AlertDialog.Builder negativeButton = new CustomTitleAlertDialogBuilder(this).setCancelable(false).setTitle(replaceMessage[1]).setMessage(replaceMessage[0]).setNegativeButton(getString(C2135R.string.str_cancel), new DialogInterface.OnClickListener() {
+                        public void onClick(DialogInterface dialogInterface, int i) {
+                            try {
+                                CameraPrintProgress.mEpsonService.confirmContinueable(false);
+                            } catch (RemoteException e) {
+                                e.printStackTrace();
+                            }
+                            EPLog.m307e("Epson", "user click str_cancel button");
+                            CameraPrintProgress.curError = 0;
+                            boolean unused = CameraPrintProgress.this.isDialogOpen = false;
+                            CameraPrintProgress.this.removeDialog(0);
+                            CameraPrintProgress.this.mHandler.sendEmptyMessage(5);
+                        }
+                    });
+                    negativeButton.setOnKeyListener(new DialogInterface.OnKeyListener() {
+                        public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
+                            return keyEvent.getKeyCode() == 84;
+                        }
+                    });
+                    return negativeButton.create();
+                }
+                AlertDialog.Builder negativeButton2 = new CustomTitleAlertDialogBuilder(this).setTitle((CharSequence) replaceMessage[1]).setMessage(replaceMessage[0]).setCancelable(false).setPositiveButton(getString(C2135R.string.str_continue), new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialogInterface, int i) {
+                        try {
+                            if (CameraPrintProgress.curError == 109) {
+                                CameraPrintProgress.isBkRetry = true;
+                                CameraPrintProgress.this.triggerPrint();
+                            }
+                            CameraPrintProgress.mEpsonService.confirmContinueable(true);
+                            CameraPrintProgress.curError = 0;
+                            boolean unused = CameraPrintProgress.this.mError = false;
+                        } catch (RemoteException e) {
+                            e.printStackTrace();
+                        }
+                        boolean unused2 = CameraPrintProgress.this.isDialogOpen = false;
+                        CameraPrintProgress.this.removeDialog(0);
+                    }
+                }).setNegativeButton(getString(C2135R.string.str_cancel), new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialogInterface, int i) {
+                        boolean unused = CameraPrintProgress.this.isDialogOpen = false;
+                        CameraPrintProgress.this.removeDialog(0);
+                        try {
+                            CameraPrintProgress.mEpsonService.confirmContinueable(false);
+                            CameraPrintProgress.curError = 0;
+                        } catch (RemoteException e) {
+                            e.printStackTrace();
+                        }
+                        boolean unused2 = CameraPrintProgress.this.mWaitEpsonServiceForFinish = true;
+                        boolean unused3 = CameraPrintProgress.this.mError = true;
+                        EPLog.m305d("PrintProgress", "cont/cancel dialog. cancel clicked");
+                        CameraPrintProgress.this.mHandler.sendEmptyMessage(5);
+                    }
+                });
+                negativeButton2.setOnKeyListener(new DialogInterface.OnKeyListener() {
+                    public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
+                        return keyEvent.getKeyCode() == 84;
+                    }
+                });
+                return negativeButton2.create();
+            case 1:
+                if (this.isDialogOpen) {
+                    return null;
+                }
+                AlertDialog.Builder negativeButton3 = new AlertDialog.Builder(this).setTitle((CharSequence) null).setCancelable(false).setMessage(getString(C2135R.string.str_msg_scan_cancel)).setPositiveButton(getString(C2135R.string.str_yes), new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialogInterface, int i) {
+                        CameraPrintProgress.this.mHandler.removeMessages(1);
+                        try {
+                            EPLog.m307e("Epson", "user choice cancel print from GUI");
+                            if ((CameraPrintProgress.mEpsonService != null ? CameraPrintProgress.mEpsonService.confirmCancel(true) : 0) == 0) {
+                                synchronized (CameraPrintProgress.lockBCancel) {
+                                    EPLog.m307e("Epson", "===> set bCancel = true");
+                                }
+                            }
+                        } catch (RemoteException e) {
+                            e.printStackTrace();
+                        }
+                        CameraPrintProgress.this.removeDialog(1);
+                        CameraPrintProgress cameraPrintProgress = CameraPrintProgress.this;
+                        cameraPrintProgress.mCanceled = true;
+                        cameraPrintProgress.mCancelButton.setVisibility(4);
+                        CameraPrintProgress.this.mCancelButton.setEnabled(false);
+                        if (CameraPrintProgress.this.bSearching) {
+                            CameraPrintProgress.this.mHandler.sendEmptyMessage(5);
+                            boolean unused = CameraPrintProgress.this.bSearching = false;
+                        }
+                    }
+                }).setNegativeButton(getString(C2135R.string.str_no), new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialogInterface, int i) {
+                        CameraPrintProgress.this.removeDialog(1);
+                    }
+                });
+                negativeButton3.setOnKeyListener(new DialogInterface.OnKeyListener() {
+                    public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
+                        return keyEvent.getKeyCode() == 84;
+                    }
+                });
+                return negativeButton3.create();
+            default:
+                return null;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onActivityResult(int i, int i2, Intent intent) {
+        super.onActivityResult(i, i2, intent);
+        if (i == 1) {
+            switch (i2) {
+                case -1:
+                    this.mHandler.sendEmptyMessage(10);
+                    return;
+                case 0:
+                    this.mHandler.sendEmptyMessage(5);
+                    return;
+                default:
+                    return;
+            }
+        }
+    }
+
+    /* access modifiers changed from: private */
+    public void CancelPrint() {
+        try {
+            if (mEpsonService != null) {
+                mEpsonService.cancelPrint();
+            }
+        } catch (RemoteException e) {
+            e.printStackTrace();
+        }
+        showDialog(1);
+    }
+
+    public void onBackPressed() {
+        EPLog.m307e("Epson", "onBackPressed()call");
+    }
+
+    public boolean onKeyDown(int i, KeyEvent keyEvent) {
+        EPLog.m307e("Epson", "onKeyDown() call");
+        if (keyEvent.getAction() != 0 || i != 84) {
+            return false;
+        }
+        EPLog.m307e("Epson", "onKeyDown() KEYCODE_SEARCH key press");
+        return true;
+    }
+
+    public void showErrorDialog(String str, String str2) {
+        new CustomTitleAlertDialogBuilder(this).setCancelable(false).setTitle(str).setMessage(str2).setNegativeButton(getString(C2135R.string.ok_button), new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialogInterface, int i) {
+                dialogInterface.cancel();
+                CameraPrintProgress.this.mHandler.sendEmptyMessage(5);
+            }
+        }).create().show();
+    }
+
+    /* access modifiers changed from: private */
+    public void sendPrintLog() {
+        Analytics.sendPrintLog(this, new CameraCopyProgressParams());
+    }
+}

+ 2755 - 0
app/src/main/java/com/epson/cameracopy/p006ui/CameraPrintSettingActivity.java

@@ -0,0 +1,2755 @@
+package com.epson.cameracopy.p006ui;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.content.SharedPreferences;
+import android.content.res.Configuration;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.os.SystemClock;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import com.epson.mobilephone.common.escpr.EscprError;
+import com.epson.mobilephone.common.escpr.MediaInfo;
+import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
+import epson.common.Constants;
+import epson.common.ExternalFileUtils;
+import epson.common.Utils;
+import epson.print.ActivityIACommon;
+import epson.print.C2135R;
+import epson.print.EPPrinterManager;
+import epson.print.MyPrinter;
+import epson.print.Util.EPLog;
+import epson.print.inkrpln.InkRplnRepository;
+import epson.print.screen.PageRangeSetting;
+import epson.print.screen.PrintProgress;
+import epson.print.screen.PrintSetting;
+import epson.print.screen.PrinterInfoDetail;
+import epson.print.screen.SearchPrinterScr;
+import epson.print.service.EpsonService;
+import epson.print.service.IEpsonService;
+import epson.print.service.IEpsonServiceCallback;
+import epson.print.widgets.CustomTitleAlertDialogBuilder;
+import epson.print.widgets.LongTapRepeatAdapter;
+import java.io.File;
+import java.util.ArrayList;
+
+/* renamed from: com.epson.cameracopy.ui.CameraPrintSettingActivity */
+public class CameraPrintSettingActivity extends ActivityIACommon implements View.OnClickListener {
+    private static final String EXTRA_PRINTER = "myprinter";
+    private static final String EXTRA_SIMPLEAP = "simpleap";
+    private static final int REQUEST_CODE_INFO = 1;
+    private static final int REQUEST_CODE_INK_REPLENISH_PROGRESS = 4;
+    private static final int REQUEST_CODE_PAGE_RANGE = 2;
+    private static final int REQUEST_CODE_PRINTER = 0;
+    public static final String TAG = "CameraPrintSetting";
+    private final int COLOR_VALUE_MAX = 50;
+    private final int COLOR_VALUE_MIN = -50;
+    private final int COPIES_MAX = 30;
+    private final int COPIES_MIN = 1;
+    private final int EPS_ERR_COMM_ERROR = -1100;
+    private final int EPS_ERR_NONE = 0;
+    private final int EPS_ERR_OPR_FAIL = -1000;
+    private final int EPS_ERR_PRINTER_NOT_SET = EscprError.EPS_ERR_PRINTER_NOT_SET;
+    private final int GET_ADVANCED = 64;
+    private final int GET_COLOR = 6;
+    private final int GET_DUPLEX = 32;
+    private final int GET_LAYOUT = 3;
+    private final int GET_PAPER_SIZE = 1;
+    private final int GET_PAPER_SOURCE = 5;
+    private final int GET_PAPER_TYPE = 2;
+    private final int GET_QUALITY = 4;
+    private final int GET_SUPPORTED_MEDIA = 0;
+    private final int PROBE_PRINTER = 17;
+    private final int SEARCH_BY_ID = 7;
+    private final int SEARCH_ERROR = 16;
+    private final int SETTING_DONE = 3;
+    private final int SHOW_ERROR_DIALOG = 18;
+    /* access modifiers changed from: private */
+    public String autoConnectSsid = null;
+    /* access modifiers changed from: private */
+    public TextView brightness;
+    /* access modifiers changed from: private */
+    public Button brightnessMinus;
+    /* access modifiers changed from: private */
+    public Button brightnessPlus;
+    /* access modifiers changed from: private */
+    public int brightnessValue;
+    /* access modifiers changed from: private */
+    public int color;
+    /* access modifiers changed from: private */
+    public TextView colorInfo;
+    /* access modifiers changed from: private */
+    public int[] color_info = null;
+    /* access modifiers changed from: private */
+    public TextView contrast;
+    /* access modifiers changed from: private */
+    public Button contrastMinus;
+    /* access modifiers changed from: private */
+    public Button contrastPlus;
+    /* access modifiers changed from: private */
+    public int contrastValue;
+    private TextView copies;
+    private Button copiesMinus;
+    private Button copiesPlus;
+    private int copiesValue;
+    private boolean disablePrintArea = false;
+    /* access modifiers changed from: private */
+    public int duplex;
+    /* access modifiers changed from: private */
+    public TextView duplexInfo;
+    /* access modifiers changed from: private */
+    public int[] duplex_info = null;
+    private boolean enableShowPreview = false;
+    /* access modifiers changed from: private */
+    public int endValue;
+    /* access modifiers changed from: private */
+    public int feedDirection;
+    /* access modifiers changed from: private */
+    public TextView feedDirectionInfo;
+    /* access modifiers changed from: private */
+    public int[] info = null;
+    /* access modifiers changed from: private */
+    public boolean isDocumentSetting = true;
+    boolean isInfoAvai = false;
+    Boolean isNotLoading = true;
+    private boolean isRetryAfterConnectSimpleAp = false;
+    private boolean isTryConnectSimpleAp = false;
+    /* access modifiers changed from: private */
+    public int lang = 1;
+    /* access modifiers changed from: private */
+    public int layout;
+    /* access modifiers changed from: private */
+    public TextView layoutInfo;
+    /* access modifiers changed from: private */
+    public int[] layout_info = null;
+    /* access modifiers changed from: private */
+    public final IEpsonServiceCallback mCallback = new IEpsonServiceCallback.Stub() {
+        public void onGetInkState() throws RemoteException {
+        }
+
+        public void onGetStatusState() throws RemoteException {
+        }
+
+        public void onNotifyEndJob(int i) throws RemoteException {
+        }
+
+        public void onNotifyProgress(int i, int i2) throws RemoteException {
+        }
+
+        public void onFindPrinterResult(String str, String str2, String str3, String str4, String str5) throws RemoteException {
+            String unused = CameraPrintSettingActivity.this.printerIp = str2;
+        }
+
+        public void onNotifyContinueable(int i) throws RemoteException {
+            EPLog.m313i("IEpsonServiceCallback", "onNotifyContinueable code = " + i);
+            if (i == 0) {
+                CameraPrintSettingActivity cameraPrintSettingActivity = CameraPrintSettingActivity.this;
+                cameraPrintSettingActivity.isInfoAvai = true;
+                int unused = cameraPrintSettingActivity.lang = cameraPrintSettingActivity.getPrinterLang();
+                CameraPrintSettingActivity cameraPrintSettingActivity2 = CameraPrintSettingActivity.this;
+                cameraPrintSettingActivity2.undoFlag = false;
+                cameraPrintSettingActivity2.mHandler.sendEmptyMessage(0);
+            }
+        }
+
+        public void onNotifyError(int i, int i2, boolean z) throws RemoteException {
+            EPLog.m313i("IEpsonServiceCallback", "onNotifyError errorCode = " + i2);
+            CameraPrintSettingActivity cameraPrintSettingActivity = CameraPrintSettingActivity.this;
+            cameraPrintSettingActivity.isInfoAvai = true;
+            int unused = cameraPrintSettingActivity.lang = cameraPrintSettingActivity.getPrinterLang();
+            CameraPrintSettingActivity cameraPrintSettingActivity2 = CameraPrintSettingActivity.this;
+            cameraPrintSettingActivity2.undoFlag = false;
+            cameraPrintSettingActivity2.mHandler.sendEmptyMessage(0);
+        }
+    };
+    private final boolean mCameraCopy = true;
+    /* access modifiers changed from: private */
+    public Context mContext = null;
+    private final ServiceConnection mEpsonConnection = new ServiceConnection() {
+        public void onServiceDisconnected(ComponentName componentName) {
+            EPLog.m316v("SettingScr", "onServiceDisconnected");
+            try {
+                CameraPrintSettingActivity.this.mEpsonService.unregisterCallback(CameraPrintSettingActivity.this.mCallback);
+            } catch (RemoteException e) {
+                e.printStackTrace();
+            }
+            IEpsonService unused = CameraPrintSettingActivity.this.mEpsonService = null;
+        }
+
+        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
+            IEpsonService unused = CameraPrintSettingActivity.this.mEpsonService = IEpsonService.Stub.asInterface(iBinder);
+            EPLog.m316v("SettingScr", "onServiceConnected");
+            if (CameraPrintSettingActivity.this.mEpsonService != null) {
+                try {
+                    CameraPrintSettingActivity.this.mEpsonService.registerCallback(CameraPrintSettingActivity.this.mCallback);
+                } catch (RemoteException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    };
+    /* access modifiers changed from: private */
+    public IEpsonService mEpsonService = null;
+    Handler mHandler = new Handler(new Handler.Callback() {
+        /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r1v4, resolved type: boolean} */
+        /* JADX WARNING: type inference failed for: r1v1 */
+        /* JADX WARNING: type inference failed for: r1v5 */
+        /* JADX WARNING: type inference failed for: r1v14, types: [int] */
+        /* JADX WARNING: type inference failed for: r1v28 */
+        /* JADX WARNING: Multi-variable type inference failed */
+        /* JADX WARNING: Removed duplicated region for block: B:156:0x052e  */
+        /* JADX WARNING: Removed duplicated region for block: B:159:0x054b  */
+        /* JADX WARNING: Removed duplicated region for block: B:163:0x055f  */
+        /* JADX WARNING: Removed duplicated region for block: B:171:0x058c  */
+        /* JADX WARNING: Removed duplicated region for block: B:175:0x05a4 A[LOOP:6: B:173:0x059e->B:175:0x05a4, LOOP_END] */
+        /* Code decompiled incorrectly, please refer to instructions dump. */
+        public boolean handleMessage(android.os.Message r15) {
+            /*
+                r14 = this;
+                java.lang.String r0 = "SettingScr"
+                java.lang.String r1 = "handleMessage call setScreenState = false"
+                epson.print.Util.EPLog.m313i(r0, r1)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r1 = 0
+                java.lang.Boolean r2 = java.lang.Boolean.valueOf(r1)
+                r0.setScreenState(r2)
+                epson.print.screen.PrintSetting r0 = new epson.print.screen.PrintSetting
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                epson.print.screen.PrintSetting$Kind r3 = epson.print.screen.PrintSetting.Kind.cameracopy
+                r0.<init>(r2, r3)
+                int r2 = r15.what
+                r3 = 64
+                r4 = 32
+                r5 = 0
+                r6 = 3
+                r7 = 100
+                r9 = 2
+                r10 = 1
+                if (r2 == r4) goto L_0x0b25
+                if (r2 == r3) goto L_0x09cd
+                r3 = 6
+                r11 = 5
+                r12 = 4
+                r13 = 8
+                switch(r2) {
+                    case 0: goto L_0x09b0;
+                    case 1: goto L_0x0801;
+                    case 2: goto L_0x05e8;
+                    case 3: goto L_0x0450;
+                    case 4: goto L_0x033f;
+                    case 5: goto L_0x022c;
+                    case 6: goto L_0x012a;
+                    default: goto L_0x0032;
+                }
+            L_0x0032:
+                switch(r2) {
+                    case 17: goto L_0x00d5;
+                    case 18: goto L_0x0067;
+                    default: goto L_0x0035;
+                }
+            L_0x0035:
+                java.lang.String r15 = "SettingScr"
+                java.lang.String r0 = "default"
+                epson.print.Util.EPLog.m313i(r15, r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.TextView r15 = r15.printerName
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r1 = 2131625174(0x7f0e04d6, float:1.8877549E38)
+                java.lang.String r0 = r0.getString(r1)
+                r15.setText(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r0 = 2131231128(0x7f080198, float:1.8078328E38)
+                android.view.View r15 = r15.findViewById(r0)
+                android.widget.ImageView r15 = (android.widget.ImageView) r15
+                r15.setVisibility(r13)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                java.lang.Boolean r0 = java.lang.Boolean.valueOf(r10)
+                r15.setScreenState(r0)
+                goto L_0x0c90
+            L_0x0067:
+                int r0 = r15.arg1
+                r2 = -1100(0xfffffffffffffbb4, float:NaN)
+                if (r0 == r2) goto L_0x00b7
+                r2 = -1000(0xfffffffffffffc18, float:NaN)
+                if (r0 == r2) goto L_0x00b7
+                int r15 = r15.arg1
+                java.lang.Integer[] r15 = com.epson.mobilephone.common.escpr.MediaInfo.ErrorTable.getStringId(r15)
+                if (r15 != 0) goto L_0x0093
+                java.lang.Integer[] r15 = new java.lang.Integer[r6]
+                r0 = 2131624506(0x7f0e023a, float:1.8876194E38)
+                java.lang.Integer r0 = java.lang.Integer.valueOf(r0)
+                r15[r1] = r0
+                r0 = 2131624507(0x7f0e023b, float:1.8876196E38)
+                java.lang.Integer r0 = java.lang.Integer.valueOf(r0)
+                r15[r10] = r0
+                java.lang.Integer r0 = java.lang.Integer.valueOf(r10)
+                r15[r9] = r0
+            L_0x0093:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r2 = r15[r10]
+                int r2 = r2.intValue()
+                java.lang.CharSequence r2 = r0.getText(r2)
+                java.lang.String r2 = r2.toString()
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r3 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r15 = r15[r1]
+                int r15 = r15.intValue()
+                java.lang.CharSequence r15 = r3.getText(r15)
+                java.lang.String r15 = r15.toString()
+                r0.showErrorDialog(r2, r15)
+                goto L_0x00ce
+            L_0x00b7:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r0 = 2131624778(0x7f0e034a, float:1.8876745E38)
+                java.lang.String r15 = r15.getString(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r1 = 2131624777(0x7f0e0349, float:1.8876743E38)
+                java.lang.String r0 = r0.getString(r1)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r1 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r1.showErrorDialog(r15, r0)
+            L_0x00ce:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r15.resetSettings()
+                goto L_0x0c90
+            L_0x00d5:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                epson.print.service.IEpsonService r15 = r15.mEpsonService
+                r0 = 17
+                if (r15 == 0) goto L_0x0121
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x011b }
+                int r15 = r15.printerLocation     // Catch:{ RemoteException -> 0x011b }
+                if (r15 == r9) goto L_0x0112
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x011b }
+                epson.print.service.IEpsonService r15 = r15.mEpsonService     // Catch:{ RemoteException -> 0x011b }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r1 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x011b }
+                java.lang.String r1 = r1.printerId     // Catch:{ RemoteException -> 0x011b }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x011b }
+                java.lang.String r2 = r2.printerIp     // Catch:{ RemoteException -> 0x011b }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r3 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x011b }
+                int r3 = r3.printerLocation     // Catch:{ RemoteException -> 0x011b }
+                if (r3 != r6) goto L_0x0102
+                goto L_0x0103
+            L_0x0102:
+                r9 = 1
+            L_0x0103:
+                int r15 = r15.searchPrinters(r1, r2, r9)     // Catch:{ RemoteException -> 0x011b }
+                if (r15 == 0) goto L_0x0c90
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x011b }
+                android.os.Handler r15 = r15.mHandler     // Catch:{ RemoteException -> 0x011b }
+                r15.sendEmptyMessageDelayed(r0, r7)     // Catch:{ RemoteException -> 0x011b }
+                goto L_0x0c90
+            L_0x0112:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x011b }
+                android.os.Handler r15 = r15.mHandler     // Catch:{ RemoteException -> 0x011b }
+                r15.sendEmptyMessage(r1)     // Catch:{ RemoteException -> 0x011b }
+                goto L_0x0c90
+            L_0x011b:
+                r15 = move-exception
+                r15.printStackTrace()
+                goto L_0x0c90
+            L_0x0121:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.os.Handler r15 = r15.mHandler
+                r15.sendEmptyMessageDelayed(r0, r7)
+                goto L_0x0c90
+            L_0x012a:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                epson.print.service.IEpsonService r15 = r15.mEpsonService
+                if (r15 != 0) goto L_0x013b
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.os.Handler r15 = r15.mHandler
+                r15.sendEmptyMessageDelayed(r3, r7)
+                goto L_0x0c90
+            L_0x013b:
+                java.lang.String r15 = "SettingScr"
+                java.lang.String r0 = "GET_COLOR"
+                epson.print.Util.EPLog.m313i(r15, r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] unused = r15.color_info = r5
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x0174 }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x0174 }
+                epson.print.service.IEpsonService r0 = r0.mEpsonService     // Catch:{ RemoteException -> 0x0174 }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x0174 }
+                int r2 = r2.printerLocation     // Catch:{ RemoteException -> 0x0174 }
+                if (r2 != r9) goto L_0x0159
+                r2 = 1
+                goto L_0x015a
+            L_0x0159:
+                r2 = 0
+            L_0x015a:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r3 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x0174 }
+                int r3 = r3.mRemoteSrcType     // Catch:{ RemoteException -> 0x0174 }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r5 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x0174 }
+                int r5 = r5.sizeIndex     // Catch:{ RemoteException -> 0x0174 }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r6 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x0174 }
+                int r6 = r6.typeIndex     // Catch:{ RemoteException -> 0x0174 }
+                int[] r0 = r0.getColor(r2, r3, r5, r6)     // Catch:{ RemoteException -> 0x0174 }
+                int[] unused = r15.color_info = r0     // Catch:{ RemoteException -> 0x0174 }
+                goto L_0x017c
+            L_0x0174:
+                r15 = move-exception
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r0.undoFlag = r10
+                r15.printStackTrace()
+            L_0x017c:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.color_info
+                if (r15 != 0) goto L_0x0188
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r15.undoFlag = r10
+            L_0x0188:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.color_info
+                if (r15 == 0) goto L_0x0199
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.color_info
+                int r15 = r15.length
+                if (r15 > 0) goto L_0x01b0
+            L_0x0199:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = new int[r9]
+                int[] unused = r15.color_info = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.color_info
+                r15[r1] = r1
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.color_info
+                r15[r10] = r10
+            L_0x01b0:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.color_info
+                if (r15 == 0) goto L_0x0c90
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.color_info
+                int r15 = r15.length
+                if (r15 <= 0) goto L_0x0c90
+                r15 = 0
+            L_0x01c2:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.color_info
+                int r0 = r0.length
+                if (r15 >= r0) goto L_0x01df
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.color
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.color_info
+                r2 = r2[r15]
+                if (r0 != r2) goto L_0x01dc
+                goto L_0x01df
+            L_0x01dc:
+                int r15 = r15 + 1
+                goto L_0x01c2
+            L_0x01df:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.color_info
+                int r0 = r0.length
+                if (r15 < r0) goto L_0x01f3
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r15.color_info
+                r0 = r0[r1]
+                int unused = r15.color = r0
+            L_0x01f3:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$Color r0 = new com.epson.mobilephone.common.escpr.MediaInfo$Color
+                r0.<init>()
+                com.epson.mobilephone.common.escpr.MediaInfo.AbstractInfo unused = r15.mLookupTable = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.TextView r15 = r15.colorInfo
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r1 = r0.mLookupTable
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r2 = r2.color
+                int r1 = r1.getStringId(r2)
+                java.lang.String r0 = r0.getString(r1)
+                r15.setText(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r15 = r15.mLookupTable
+                r15.destructor()
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.os.Handler r15 = r15.mHandler
+                r15.sendEmptyMessage(r4)
+                goto L_0x0c90
+            L_0x022c:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                epson.print.service.IEpsonService r15 = r15.mEpsonService
+                if (r15 != 0) goto L_0x023d
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.os.Handler r15 = r15.mHandler
+                r15.sendEmptyMessageDelayed(r11, r7)
+                goto L_0x0c90
+            L_0x023d:
+                java.lang.String r15 = "SettingScr"
+                java.lang.String r0 = "GET_PAPER_SOURCE"
+                epson.print.Util.EPLog.m313i(r15, r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] unused = r15.paper_source_info = r5
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x026b }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x026b }
+                epson.print.service.IEpsonService r0 = r0.mEpsonService     // Catch:{ RemoteException -> 0x026b }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x026b }
+                int r2 = r2.sizeIndex     // Catch:{ RemoteException -> 0x026b }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r4 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x026b }
+                int r4 = r4.typeIndex     // Catch:{ RemoteException -> 0x026b }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r5 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x026b }
+                int r5 = r5.printerLocation     // Catch:{ RemoteException -> 0x026b }
+                int[] r0 = r0.getPaperSource(r2, r4, r5)     // Catch:{ RemoteException -> 0x026b }
+                int[] unused = r15.paper_source_info = r0     // Catch:{ RemoteException -> 0x026b }
+                goto L_0x0273
+            L_0x026b:
+                r15 = move-exception
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r0.undoFlag = r10
+                r15.printStackTrace()
+            L_0x0273:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.paper_source_info
+                if (r15 != 0) goto L_0x028e
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r15.undoFlag = r10
+                int[] r0 = new int[r10]
+                int[] unused = r15.paper_source_info = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.paper_source_info
+                r0 = 128(0x80, float:1.794E-43)
+                r15[r1] = r0
+            L_0x028e:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.paper_source_info
+                if (r15 == 0) goto L_0x0c90
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.paper_source_info
+                int r15 = r15.length
+                if (r15 <= 0) goto L_0x0c90
+                r15 = 0
+            L_0x02a0:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.paper_source_info
+                int r0 = r0.length
+                if (r15 >= r0) goto L_0x02bd
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.paperSource
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.paper_source_info
+                r2 = r2[r15]
+                if (r0 != r2) goto L_0x02ba
+                goto L_0x02bd
+            L_0x02ba:
+                int r15 = r15 + 1
+                goto L_0x02a0
+            L_0x02bd:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.paper_source_info
+                int r0 = r0.length
+                if (r15 < r0) goto L_0x02d1
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r15.paper_source_info
+                r0 = r0[r1]
+                int unused = r15.paperSource = r0
+            L_0x02d1:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int unused = r15.paperSource
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.paper_source_info
+                if (r15 == 0) goto L_0x02f8
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.paper_source_info
+                int r15 = r15.length
+                if (r15 > r10) goto L_0x02f8
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r0 = 2131231313(0x7f080251, float:1.8078703E38)
+                android.view.View r15 = r15.findViewById(r0)
+                android.widget.ImageView r15 = (android.widget.ImageView) r15
+                r15.setVisibility(r13)
+                r15 = 128(0x80, float:1.794E-43)
+                goto L_0x030c
+            L_0x02f8:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r0 = 2131231313(0x7f080251, float:1.8078703E38)
+                android.view.View r15 = r15.findViewById(r0)
+                android.widget.ImageView r15 = (android.widget.ImageView) r15
+                r15.setVisibility(r1)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r15 = r15.paperSource
+            L_0x030c:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$PaperSource r1 = new com.epson.mobilephone.common.escpr.MediaInfo$PaperSource
+                r1.<init>()
+                com.epson.mobilephone.common.escpr.MediaInfo.AbstractInfo unused = r0.mLookupTable = r1
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.TextView r0 = r0.paperSourceInfo
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r1 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r2 = r1.mLookupTable
+                int r15 = r2.getStringId(r15)
+                java.lang.String r15 = r1.getString(r15)
+                r0.setText(r15)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r15 = r15.mLookupTable
+                r15.destructor()
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.os.Handler r15 = r15.mHandler
+                r15.sendEmptyMessage(r3)
+                goto L_0x0c90
+            L_0x033f:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                epson.print.service.IEpsonService r15 = r15.mEpsonService
+                if (r15 != 0) goto L_0x0350
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.os.Handler r15 = r15.mHandler
+                r15.sendEmptyMessageDelayed(r12, r7)
+                goto L_0x0c90
+            L_0x0350:
+                java.lang.String r15 = "SettingScr"
+                java.lang.String r0 = "GET_QUALITY"
+                epson.print.Util.EPLog.m313i(r15, r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] unused = r15.info = r5
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x0378 }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x0378 }
+                epson.print.service.IEpsonService r0 = r0.mEpsonService     // Catch:{ RemoteException -> 0x0378 }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x0378 }
+                int r2 = r2.sizeIndex     // Catch:{ RemoteException -> 0x0378 }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r3 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x0378 }
+                int r3 = r3.typeIndex     // Catch:{ RemoteException -> 0x0378 }
+                int[] r0 = r0.getQuality(r2, r3)     // Catch:{ RemoteException -> 0x0378 }
+                int[] unused = r15.info = r0     // Catch:{ RemoteException -> 0x0378 }
+                goto L_0x0380
+            L_0x0378:
+                r15 = move-exception
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r0.undoFlag = r10
+                r15.printStackTrace()
+            L_0x0380:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.info
+                if (r15 != 0) goto L_0x0399
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r15.undoFlag = r10
+                int[] r0 = new int[r10]
+                int[] unused = r15.info = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.info
+                r15[r1] = r9
+            L_0x0399:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.info
+                if (r15 == 0) goto L_0x0c90
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.info
+                int r15 = r15.length
+                if (r15 <= 0) goto L_0x0c90
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.info
+                int r15 = r15.length
+                if (r15 > r10) goto L_0x03c2
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r0 = 2131231394(0x7f0802a2, float:1.8078868E38)
+                android.view.View r15 = r15.findViewById(r0)
+                android.widget.ImageView r15 = (android.widget.ImageView) r15
+                r15.setVisibility(r13)
+                goto L_0x03d0
+            L_0x03c2:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r0 = 2131231394(0x7f0802a2, float:1.8078868E38)
+                android.view.View r15 = r15.findViewById(r0)
+                android.widget.ImageView r15 = (android.widget.ImageView) r15
+                r15.setVisibility(r1)
+            L_0x03d0:
+                r15 = 0
+            L_0x03d1:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.info
+                int r0 = r0.length
+                if (r15 >= r0) goto L_0x03ee
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.quality
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.info
+                r2 = r2[r15]
+                if (r0 != r2) goto L_0x03eb
+                goto L_0x03ee
+            L_0x03eb:
+                int r15 = r15 + 1
+                goto L_0x03d1
+            L_0x03ee:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.info
+                int r0 = r0.length
+                if (r15 < r0) goto L_0x0402
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r15.info
+                r0 = r0[r1]
+                int unused = r15.quality = r0
+            L_0x0402:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r15.info
+                int r0 = r0.length
+                int[] r0 = new int[r0]
+                int[] unused = r15.quality_info = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r15.info
+                int[] unused = r15.quality_info = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$Quality r0 = new com.epson.mobilephone.common.escpr.MediaInfo$Quality
+                r0.<init>()
+                com.epson.mobilephone.common.escpr.MediaInfo.AbstractInfo unused = r15.mLookupTable = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.TextView r15 = r15.qualityInfo
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r1 = r0.mLookupTable
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r2 = r2.quality
+                int r1 = r1.getStringId(r2)
+                java.lang.String r0 = r0.getString(r1)
+                r15.setText(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r15 = r15.mLookupTable
+                r15.destructor()
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.os.Handler r15 = r15.mHandler
+                r15.sendEmptyMessage(r11)
+                goto L_0x0c90
+            L_0x0450:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                epson.print.service.IEpsonService r15 = r15.mEpsonService
+                if (r15 != 0) goto L_0x0461
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.os.Handler r15 = r15.mHandler
+                r15.sendEmptyMessageDelayed(r6, r7)
+                goto L_0x0c90
+            L_0x0461:
+                java.lang.String r15 = "SettingScr"
+                java.lang.String r0 = "GET_LAYOUT"
+                epson.print.Util.EPLog.m313i(r15, r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] unused = r15.info = r5
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x0489 }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x0489 }
+                epson.print.service.IEpsonService r0 = r0.mEpsonService     // Catch:{ RemoteException -> 0x0489 }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x0489 }
+                int r2 = r2.sizeIndex     // Catch:{ RemoteException -> 0x0489 }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r3 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x0489 }
+                int r3 = r3.typeIndex     // Catch:{ RemoteException -> 0x0489 }
+                int[] r0 = r0.getLayout(r2, r3)     // Catch:{ RemoteException -> 0x0489 }
+                int[] unused = r15.info = r0     // Catch:{ RemoteException -> 0x0489 }
+                goto L_0x0491
+            L_0x0489:
+                r15 = move-exception
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r0.undoFlag = r10
+                r15.printStackTrace()
+            L_0x0491:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                boolean unused = r15.isDocumentSetting
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.info
+                if (r15 != 0) goto L_0x04b2
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r15.undoFlag = r10
+                int[] r15 = r15.info
+                if (r15 != 0) goto L_0x04b2
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = new int[r9]
+                r0 = {2, 1} // fill-array
+                int[] unused = r15.info = r0
+            L_0x04b2:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.info
+                if (r15 == 0) goto L_0x0c90
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.info
+                int r15 = r15.length
+                if (r15 <= 0) goto L_0x0c90
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.info
+                int r15 = r15.length
+                if (r15 > r10) goto L_0x04db
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r0 = 2131231162(0x7f0801ba, float:1.8078397E38)
+                android.view.View r15 = r15.findViewById(r0)
+                android.widget.ImageView r15 = (android.widget.ImageView) r15
+                r15.setVisibility(r13)
+                goto L_0x04e9
+            L_0x04db:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r0 = 2131231162(0x7f0801ba, float:1.8078397E38)
+                android.view.View r15 = r15.findViewById(r0)
+                android.widget.ImageView r15 = (android.widget.ImageView) r15
+                r15.setVisibility(r1)
+            L_0x04e9:
+                r15 = 0
+            L_0x04ea:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.info
+                int r0 = r0.length
+                if (r15 >= r0) goto L_0x0525
+                java.lang.String r0 = "layout info"
+                java.lang.StringBuilder r2 = new java.lang.StringBuilder
+                r2.<init>()
+                java.lang.String r3 = "layout info "
+                r2.append(r3)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r3 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r3 = r3.info
+                r3 = r3[r15]
+                r2.append(r3)
+                java.lang.String r2 = r2.toString()
+                epson.print.Util.EPLog.m316v(r0, r2)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.layout
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.info
+                r2 = r2[r15]
+                if (r0 != r2) goto L_0x0522
+                goto L_0x0525
+            L_0x0522:
+                int r15 = r15 + 1
+                goto L_0x04ea
+            L_0x0525:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.info
+                int r0 = r0.length
+                if (r15 < r0) goto L_0x0539
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r15.info
+                r0 = r0[r1]
+                int unused = r15.layout = r0
+            L_0x0539:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$Layout r0 = new com.epson.mobilephone.common.escpr.MediaInfo$Layout
+                r0.<init>()
+                com.epson.mobilephone.common.escpr.MediaInfo.AbstractInfo unused = r15.mLookupTable = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r15 = r15.layout
+                if (r15 != r13) goto L_0x0550
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int unused = r15.layout = r9
+            L_0x0550:
+                java.util.ArrayList r15 = new java.util.ArrayList
+                r15.<init>()
+                r0 = 0
+            L_0x0556:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.info
+                int r2 = r2.length
+                if (r0 >= r2) goto L_0x057b
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.info
+                r2 = r2[r0]
+                if (r2 == r13) goto L_0x0578
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.info
+                r2 = r2[r0]
+                java.lang.Integer r2 = java.lang.Integer.valueOf(r2)
+                r15.add(r2)
+            L_0x0578:
+                int r0 = r0 + 1
+                goto L_0x0556
+            L_0x057b:
+                java.lang.Integer r0 = java.lang.Integer.valueOf(r12)
+                boolean r0 = r15.remove(r0)
+                if (r0 == 0) goto L_0x0586
+                goto L_0x057b
+            L_0x0586:
+                int r0 = r15.size()
+                if (r0 != 0) goto L_0x0593
+                java.lang.Integer r0 = java.lang.Integer.valueOf(r9)
+                r15.add(r0)
+            L_0x0593:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r2 = r15.size()
+                int[] r2 = new int[r2]
+                int[] unused = r0.layout_info = r2
+            L_0x059e:
+                int r0 = r15.size()
+                if (r1 >= r0) goto L_0x05b9
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.layout_info
+                java.lang.Object r2 = r15.get(r1)
+                java.lang.Integer r2 = (java.lang.Integer) r2
+                int r2 = r2.intValue()
+                r0[r1] = r2
+                int r1 = r1 + 1
+                goto L_0x059e
+            L_0x05b9:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.TextView r15 = r15.layoutInfo
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r1 = r0.mLookupTable
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r2 = r2.layout
+                int r1 = r1.getStringId(r2)
+                java.lang.String r0 = r0.getString(r1)
+                r15.setText(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r15 = r15.mLookupTable
+                r15.destructor()
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.os.Handler r15 = r15.mHandler
+                r15.sendEmptyMessage(r12)
+                goto L_0x0c90
+            L_0x05e8:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                epson.print.service.IEpsonService r15 = r15.mEpsonService
+                if (r15 != 0) goto L_0x05f9
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.os.Handler r15 = r15.mHandler
+                r15.sendEmptyMessageDelayed(r9, r7)
+                goto L_0x0c90
+            L_0x05f9:
+                java.lang.String r15 = "SettingScr"
+                java.lang.String r2 = "GET_PAPER_TYPE"
+                epson.print.Util.EPLog.m313i(r15, r2)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] unused = r15.info = r5
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x061b }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x061b }
+                epson.print.service.IEpsonService r2 = r2.mEpsonService     // Catch:{ RemoteException -> 0x061b }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r3 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x061b }
+                int r3 = r3.sizeIndex     // Catch:{ RemoteException -> 0x061b }
+                int[] r2 = r2.getPaperType(r3)     // Catch:{ RemoteException -> 0x061b }
+                int[] unused = r15.info = r2     // Catch:{ RemoteException -> 0x061b }
+                goto L_0x0623
+            L_0x061b:
+                r15 = move-exception
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r2.undoFlag = r10
+                r15.printStackTrace()
+            L_0x0623:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r15.info
+                int[] r2 = r14.removeCddvdMedia(r2)
+                int[] unused = r15.info = r2
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.info
+                if (r15 != 0) goto L_0x0659
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r15.undoFlag = r10
+                int[] r15 = r15.info
+                if (r15 != 0) goto L_0x0659
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = new int[r9]
+                com.epson.mobilephone.common.PrintingLib.define.Constants$MediaName r3 = com.epson.mobilephone.common.PrintingLib.define.Constants.MediaName.EPS_MTID_PLAIN
+                int r3 = r3.getCode()
+                r2[r1] = r3
+                com.epson.mobilephone.common.PrintingLib.define.Constants$MediaName r3 = com.epson.mobilephone.common.PrintingLib.define.Constants.MediaName.EPS_MTID_PGPHOTO
+                int r3 = r3.getCode()
+                r2[r10] = r3
+                int[] unused = r15.info = r2
+            L_0x0659:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.info
+                if (r15 == 0) goto L_0x0c90
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.info
+                int r15 = r15.length
+                if (r15 <= 0) goto L_0x0c90
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.info
+                int r15 = r15.length
+                if (r15 > r10) goto L_0x0682
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r2 = 2131231316(0x7f080254, float:1.807871E38)
+                android.view.View r15 = r15.findViewById(r2)
+                android.widget.ImageView r15 = (android.widget.ImageView) r15
+                r15.setVisibility(r13)
+                goto L_0x0690
+            L_0x0682:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r2 = 2131231316(0x7f080254, float:1.807871E38)
+                android.view.View r15 = r15.findViewById(r2)
+                android.widget.ImageView r15 = (android.widget.ImageView) r15
+                r15.setVisibility(r1)
+            L_0x0690:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int unused = r15.typeIndex = r1
+            L_0x0695:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r15 = r15.typeIndex
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.info
+                int r2 = r2.length
+                if (r15 >= r2) goto L_0x06c1
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r15 = r15.paperType
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.info
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r3 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r3 = r3.typeIndex
+                r2 = r2[r3]
+                if (r15 != r2) goto L_0x06bb
+                goto L_0x06c1
+            L_0x06bb:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.cameracopy.p006ui.CameraPrintSettingActivity.access$1608(r15)
+                goto L_0x0695
+            L_0x06c1:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r15 = r15.typeIndex
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.info
+                int r2 = r2.length
+                if (r15 < r2) goto L_0x0704
+                int r15 = r0.getDefaultPaperType()
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int unused = r0.typeIndex = r1
+            L_0x06d9:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.typeIndex
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.info
+                int r2 = r2.length
+                if (r0 >= r2) goto L_0x0704
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.info
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r2 = r2.typeIndex
+                r0 = r0[r2]
+                if (r15 != r0) goto L_0x06fe
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int unused = r0.paperType = r15
+                goto L_0x0704
+            L_0x06fe:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.cameracopy.p006ui.CameraPrintSettingActivity.access$1608(r0)
+                goto L_0x06d9
+            L_0x0704:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r15 = r15.typeIndex
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.info
+                int r0 = r0.length
+                if (r15 < r0) goto L_0x078e
+                com.epson.mobilephone.common.PrintingLib.define.Constants$MediaName r15 = com.epson.mobilephone.common.PrintingLib.define.Constants.MediaName.EPS_MTID_PLAIN1
+                int r15 = r15.getCode()
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int unused = r0.typeIndex = r1
+            L_0x071e:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.typeIndex
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.info
+                int r2 = r2.length
+                if (r0 >= r2) goto L_0x0749
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.info
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r2 = r2.typeIndex
+                r0 = r0[r2]
+                if (r15 != r0) goto L_0x0743
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int unused = r0.paperType = r15
+                goto L_0x0749
+            L_0x0743:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.cameracopy.p006ui.CameraPrintSettingActivity.access$1608(r0)
+                goto L_0x071e
+            L_0x0749:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r15 = r15.typeIndex
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.info
+                int r0 = r0.length
+                if (r15 < r0) goto L_0x078e
+                com.epson.mobilephone.common.PrintingLib.define.Constants$MediaName r15 = com.epson.mobilephone.common.PrintingLib.define.Constants.MediaName.EPS_MTID_AUTO_PLAIN
+                int r15 = r15.getCode()
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int unused = r0.typeIndex = r1
+            L_0x0763:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.typeIndex
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.info
+                int r2 = r2.length
+                if (r0 >= r2) goto L_0x078e
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.info
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r2 = r2.typeIndex
+                r0 = r0[r2]
+                if (r15 != r0) goto L_0x0788
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int unused = r0.paperType = r15
+                goto L_0x078e
+            L_0x0788:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.cameracopy.p006ui.CameraPrintSettingActivity.access$1608(r0)
+                goto L_0x0763
+            L_0x078e:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r15 = r15.typeIndex
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.info
+                int r0 = r0.length
+                if (r15 < r0) goto L_0x07b3
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int unused = r15.typeIndex = r1
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r15.info
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r1 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r1 = r1.typeIndex
+                r0 = r0[r1]
+                int unused = r15.paperType = r0
+            L_0x07b3:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r15.info
+                int r0 = r0.length
+                int[] r0 = new int[r0]
+                int[] unused = r15.paper_type_info = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r15.info
+                int[] unused = r15.paper_type_info = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$PaperType r0 = new com.epson.mobilephone.common.escpr.MediaInfo$PaperType
+                r0.<init>()
+                com.epson.mobilephone.common.escpr.MediaInfo.AbstractInfo unused = r15.mLookupTable = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.TextView r15 = r15.paperTypeInfo
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r1 = r0.mLookupTable
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r2 = r2.paperType
+                int r1 = r1.getStringId(r2)
+                java.lang.String r0 = r0.getString(r1)
+                r15.setText(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r15 = r15.mLookupTable
+                r15.destructor()
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.os.Handler r15 = r15.mHandler
+                r15.sendEmptyMessage(r6)
+                goto L_0x0c90
+            L_0x0801:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                epson.print.service.IEpsonService r15 = r15.mEpsonService
+                if (r15 != 0) goto L_0x0812
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.os.Handler r15 = r15.mHandler
+                r15.sendEmptyMessageDelayed(r10, r7)
+                goto L_0x0c90
+            L_0x0812:
+                java.lang.String r15 = "SettingScr"
+                java.lang.String r2 = "GET_PAPER_SIZE"
+                epson.print.Util.EPLog.m313i(r15, r2)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] unused = r15.info = r5
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x082e }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x082e }
+                epson.print.service.IEpsonService r2 = r2.mEpsonService     // Catch:{ RemoteException -> 0x082e }
+                int[] r2 = r2.getPaperSize()     // Catch:{ RemoteException -> 0x082e }
+                int[] unused = r15.info = r2     // Catch:{ RemoteException -> 0x082e }
+                goto L_0x0836
+            L_0x082e:
+                r15 = move-exception
+                r15.printStackTrace()
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r15.undoFlag = r10
+            L_0x0836:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.info
+                if (r15 != 0) goto L_0x0892
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r15.undoFlag = r10
+                r2 = 9
+                int[] r2 = new int[r2]
+                com.epson.mobilephone.common.PrintingLib.define.Constants$PaperName r4 = com.epson.mobilephone.common.PrintingLib.define.Constants.PaperName.EPS_MSID_A4
+                int r4 = r4.getCode()
+                r2[r1] = r4
+                com.epson.mobilephone.common.PrintingLib.define.Constants$PaperName r4 = com.epson.mobilephone.common.PrintingLib.define.Constants.PaperName.EPS_MSID_A3
+                int r4 = r4.getCode()
+                r2[r10] = r4
+                com.epson.mobilephone.common.PrintingLib.define.Constants$PaperName r4 = com.epson.mobilephone.common.PrintingLib.define.Constants.PaperName.EPS_MSID_B4
+                int r4 = r4.getCode()
+                r2[r9] = r4
+                com.epson.mobilephone.common.PrintingLib.define.Constants$PaperName r4 = com.epson.mobilephone.common.PrintingLib.define.Constants.PaperName.EPS_MSID_B5
+                int r4 = r4.getCode()
+                r2[r6] = r4
+                com.epson.mobilephone.common.PrintingLib.define.Constants$PaperName r4 = com.epson.mobilephone.common.PrintingLib.define.Constants.PaperName.EPS_MSID_LETTER
+                int r4 = r4.getCode()
+                r2[r12] = r4
+                com.epson.mobilephone.common.PrintingLib.define.Constants$PaperName r4 = com.epson.mobilephone.common.PrintingLib.define.Constants.PaperName.EPS_MSID_LEGAL
+                int r4 = r4.getCode()
+                r2[r11] = r4
+                com.epson.mobilephone.common.PrintingLib.define.Constants$PaperName r4 = com.epson.mobilephone.common.PrintingLib.define.Constants.PaperName.EPS_MSID_POSTCARD
+                int r4 = r4.getCode()
+                r2[r3] = r4
+                r3 = 7
+                com.epson.mobilephone.common.PrintingLib.define.Constants$PaperName r4 = com.epson.mobilephone.common.PrintingLib.define.Constants.PaperName.EPS_MSID_4X6
+                int r4 = r4.getCode()
+                r2[r3] = r4
+                com.epson.mobilephone.common.PrintingLib.define.Constants$PaperName r3 = com.epson.mobilephone.common.PrintingLib.define.Constants.PaperName.EPS_MSID_L
+                int r3 = r3.getCode()
+                r2[r13] = r3
+                int[] unused = r15.info = r2
+            L_0x0892:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.info
+                if (r15 == 0) goto L_0x0c90
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.info
+                int r15 = r15.length
+                if (r15 <= 0) goto L_0x0c90
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.info
+                int r15 = r15.length
+                if (r15 > r10) goto L_0x08bb
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r2 = 2131231309(0x7f08024d, float:1.8078695E38)
+                android.view.View r15 = r15.findViewById(r2)
+                android.widget.ImageView r15 = (android.widget.ImageView) r15
+                r15.setVisibility(r13)
+                goto L_0x08c9
+            L_0x08bb:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r2 = 2131231309(0x7f08024d, float:1.8078695E38)
+                android.view.View r15 = r15.findViewById(r2)
+                android.widget.ImageView r15 = (android.widget.ImageView) r15
+                r15.setVisibility(r1)
+            L_0x08c9:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int unused = r15.sizeIndex = r1
+            L_0x08ce:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r15 = r15.sizeIndex
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.info
+                int r2 = r2.length
+                if (r15 >= r2) goto L_0x08fa
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r15 = r15.paperSize
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.info
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r3 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r3 = r3.sizeIndex
+                r2 = r2[r3]
+                if (r15 != r2) goto L_0x08f4
+                goto L_0x08fa
+            L_0x08f4:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.cameracopy.p006ui.CameraPrintSettingActivity.access$1108(r15)
+                goto L_0x08ce
+            L_0x08fa:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r15 = r15.sizeIndex
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.info
+                int r2 = r2.length
+                if (r15 < r2) goto L_0x093d
+                int r15 = r0.getDefaultPaperSize()
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int unused = r0.sizeIndex = r1
+            L_0x0912:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.sizeIndex
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.info
+                int r2 = r2.length
+                if (r0 >= r2) goto L_0x093d
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.info
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r2 = r2.sizeIndex
+                r0 = r0[r2]
+                if (r15 != r0) goto L_0x0937
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int unused = r0.paperSize = r15
+                goto L_0x093d
+            L_0x0937:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.cameracopy.p006ui.CameraPrintSettingActivity.access$1108(r0)
+                goto L_0x0912
+            L_0x093d:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r15 = r15.sizeIndex
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.info
+                int r0 = r0.length
+                if (r15 < r0) goto L_0x0962
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int unused = r15.sizeIndex = r1
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r15.info
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r1 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r1 = r1.sizeIndex
+                r0 = r0[r1]
+                int unused = r15.paperSize = r0
+            L_0x0962:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r15.info
+                int r0 = r0.length
+                int[] r0 = new int[r0]
+                int[] unused = r15.paper_size_info = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r15.info
+                int[] unused = r15.paper_size_info = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$PaperSize r0 = new com.epson.mobilephone.common.escpr.MediaInfo$PaperSize
+                r0.<init>()
+                com.epson.mobilephone.common.escpr.MediaInfo.AbstractInfo unused = r15.mLookupTable = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.TextView r15 = r15.paperSizeInfo
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r1 = r0.mLookupTable
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r2 = r2.paperSize
+                int r1 = r1.getStringId(r2)
+                java.lang.String r0 = r0.getString(r1)
+                r15.setText(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r15 = r15.mLookupTable
+                r15.destructor()
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.os.Handler r15 = r15.mHandler
+                r15.sendEmptyMessage(r9)
+                goto L_0x0c90
+            L_0x09b0:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                epson.print.service.IEpsonService r15 = r15.mEpsonService
+                if (r15 == 0) goto L_0x09c4
+                com.epson.cameracopy.ui.CameraPrintSettingActivity$3$1 r15 = new com.epson.cameracopy.ui.CameraPrintSettingActivity$3$1
+                r15.<init>()
+                java.lang.Void[] r0 = new java.lang.Void[r1]
+                r15.execute(r0)
+                goto L_0x0c90
+            L_0x09c4:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.os.Handler r15 = r15.mHandler
+                r15.sendEmptyMessageDelayed(r1, r7)
+                goto L_0x0c90
+            L_0x09cd:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r0 = 2131231301(0x7f080245, float:1.807868E38)
+                android.view.View r15 = r15.findViewById(r0)
+                android.widget.TextView r15 = (android.widget.TextView) r15
+                java.lang.StringBuilder r0 = new java.lang.StringBuilder
+                r0.<init>()
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r2 = r2.startValue
+                r0.append(r2)
+                java.lang.String r2 = ".."
+                r0.append(r2)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r2 = r2.endValue
+                r0.append(r2)
+                java.lang.String r0 = r0.toString()
+                r15.setText(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$FeedDirection r0 = new com.epson.mobilephone.common.escpr.MediaInfo$FeedDirection
+                r0.<init>()
+                com.epson.mobilephone.common.escpr.MediaInfo.AbstractInfo unused = r15.mLookupTable = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.TextView r15 = r15.feedDirectionInfo
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r2 = r0.mLookupTable
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r3 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r3 = r3.feedDirection
+                int r2 = r2.getStringId(r3)
+                java.lang.String r0 = r0.getString(r2)
+                r15.setText(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r15 = r15.mLookupTable
+                r15.destructor()
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$PrintDate r0 = new com.epson.mobilephone.common.escpr.MediaInfo$PrintDate
+                r0.<init>()
+                com.epson.mobilephone.common.escpr.MediaInfo.AbstractInfo unused = r15.mLookupTable = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.TextView r15 = r15.printDateInfo
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r2 = r0.mLookupTable
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r3 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r3 = r3.printdate
+                int r2 = r2.getStringId(r3)
+                java.lang.String r0 = r0.getString(r2)
+                r15.setText(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r15 = r15.mLookupTable
+                r15.destructor()
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.TextView r15 = r15.brightness
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.brightnessValue
+                java.lang.String r0 = java.lang.String.valueOf(r0)
+                r15.setText(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.Button r15 = r15.brightnessMinus
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.brightnessValue
+                r2 = -50
+                if (r0 == r2) goto L_0x0a80
+                r0 = 1
+                goto L_0x0a81
+            L_0x0a80:
+                r0 = 0
+            L_0x0a81:
+                r15.setEnabled(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.Button r15 = r15.brightnessPlus
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.brightnessValue
+                r3 = 50
+                if (r0 == r3) goto L_0x0a96
+                r0 = 1
+                goto L_0x0a97
+            L_0x0a96:
+                r0 = 0
+            L_0x0a97:
+                r15.setEnabled(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.TextView r15 = r15.contrast
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.contrastValue
+                java.lang.String r0 = java.lang.String.valueOf(r0)
+                r15.setText(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.Button r15 = r15.contrastMinus
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.contrastValue
+                if (r0 == r2) goto L_0x0abd
+                r0 = 1
+                goto L_0x0abe
+            L_0x0abd:
+                r0 = 0
+            L_0x0abe:
+                r15.setEnabled(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.Button r15 = r15.contrastPlus
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.contrastValue
+                if (r0 == r3) goto L_0x0ad1
+                r0 = 1
+                goto L_0x0ad2
+            L_0x0ad1:
+                r0 = 0
+            L_0x0ad2:
+                r15.setEnabled(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.TextView r15 = r15.saturation
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.saturationValue
+                java.lang.String r0 = java.lang.String.valueOf(r0)
+                r15.setText(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.Button r15 = r15.saturationMinus
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.saturationValue
+                if (r0 == r2) goto L_0x0af8
+                r0 = 1
+                goto L_0x0af9
+            L_0x0af8:
+                r0 = 0
+            L_0x0af9:
+                r15.setEnabled(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.Button r15 = r15.saturationPlus
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.saturationValue
+                if (r0 == r3) goto L_0x0b0b
+                r1 = 1
+            L_0x0b0b:
+                r15.setEnabled(r1)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r15.updateSettingView()
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                java.lang.Boolean r0 = java.lang.Boolean.valueOf(r10)
+                r15.setScreenState(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                boolean r0 = r15.undoFlag
+                boolean unused = r15.updateSupportedMediaFile(r0)
+                goto L_0x0c90
+            L_0x0b25:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                epson.print.service.IEpsonService r15 = r15.mEpsonService
+                if (r15 != 0) goto L_0x0b36
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.os.Handler r15 = r15.mHandler
+                r15.sendEmptyMessageDelayed(r4, r7)
+                goto L_0x0c90
+            L_0x0b36:
+                java.lang.String r15 = "SettingScr"
+                java.lang.String r0 = "GET_DUPLEX"
+                epson.print.Util.EPLog.m313i(r15, r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] unused = r15.duplex_info = r5
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x0b59 }
+                epson.print.service.IEpsonService r15 = r15.mEpsonService     // Catch:{ RemoteException -> 0x0b59 }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x0b59 }
+                int r0 = r0.sizeIndex     // Catch:{ RemoteException -> 0x0b59 }
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this     // Catch:{ RemoteException -> 0x0b59 }
+                int r2 = r2.typeIndex     // Catch:{ RemoteException -> 0x0b59 }
+                int r15 = r15.getDuplex(r0, r2)     // Catch:{ RemoteException -> 0x0b59 }
+                goto L_0x0b62
+            L_0x0b59:
+                r15 = move-exception
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                r0.undoFlag = r10
+                r15.printStackTrace()
+                r15 = 0
+            L_0x0b62:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                java.lang.String r0 = r0.printerId
+                if (r0 != 0) goto L_0x0b99
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.paperType
+                com.epson.mobilephone.common.PrintingLib.define.Constants$MediaName r2 = com.epson.mobilephone.common.PrintingLib.define.Constants.MediaName.EPS_MTID_PLAIN
+                int r2 = r2.getCode()
+                if (r0 != r2) goto L_0x0b99
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = new int[r6]
+                int[] unused = r15.duplex_info = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.duplex_info
+                r15[r1] = r1
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.duplex_info
+                r15[r10] = r10
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.duplex_info
+                r15[r9] = r9
+                goto L_0x0c0f
+            L_0x0b99:
+                if (r15 == 0) goto L_0x0c00
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.paperSource
+                r2 = 16
+                if (r0 == r2) goto L_0x0c00
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.layout
+                if (r0 != r10) goto L_0x0be0
+                r15 = r15 & r9
+                if (r15 == 0) goto L_0x0bd0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = new int[r6]
+                int[] unused = r15.duplex_info = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.duplex_info
+                r15[r1] = r1
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.duplex_info
+                r15[r10] = r10
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.duplex_info
+                r15[r9] = r9
+                goto L_0x0c0f
+            L_0x0bd0:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = new int[r10]
+                int[] unused = r15.duplex_info = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.duplex_info
+                r15[r1] = r1
+                goto L_0x0c0f
+            L_0x0be0:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = new int[r6]
+                int[] unused = r15.duplex_info = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.duplex_info
+                r15[r1] = r1
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.duplex_info
+                r15[r10] = r10
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.duplex_info
+                r15[r9] = r9
+                goto L_0x0c0f
+            L_0x0c00:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = new int[r10]
+                int[] unused = r15.duplex_info = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.duplex_info
+                r15[r1] = r1
+            L_0x0c0f:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.duplex_info
+                if (r15 == 0) goto L_0x0c82
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r15 = r15.duplex_info
+                int r15 = r15.length
+                if (r15 <= 0) goto L_0x0c82
+                r15 = 0
+            L_0x0c21:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.duplex_info
+                int r0 = r0.length
+                if (r15 >= r0) goto L_0x0c3e
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r0 = r0.duplex
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r2 = r2.duplex_info
+                r2 = r2[r15]
+                if (r0 != r2) goto L_0x0c3b
+                goto L_0x0c3e
+            L_0x0c3b:
+                int r15 = r15 + 1
+                goto L_0x0c21
+            L_0x0c3e:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r0.duplex_info
+                int r0 = r0.length
+                if (r15 < r0) goto L_0x0c52
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int[] r0 = r15.duplex_info
+                r0 = r0[r1]
+                int unused = r15.duplex = r0
+            L_0x0c52:
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$Duplex r0 = new com.epson.mobilephone.common.escpr.MediaInfo$Duplex
+                r0.<init>()
+                com.epson.mobilephone.common.escpr.MediaInfo.AbstractInfo unused = r15.mLookupTable = r0
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.widget.TextView r15 = r15.duplexInfo
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r0 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r1 = r0.mLookupTable
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r2 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                int r2 = r2.duplex
+                int r1 = r1.getStringId(r2)
+                java.lang.String r0 = r0.getString(r1)
+                r15.setText(r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                com.epson.mobilephone.common.escpr.MediaInfo$AbstractInfo r15 = r15.mLookupTable
+                r15.destructor()
+            L_0x0c82:
+                java.lang.String r15 = "SettingScr"
+                java.lang.String r0 = "get Color setScreenState = true"
+                epson.print.Util.EPLog.m313i(r15, r0)
+                com.epson.cameracopy.ui.CameraPrintSettingActivity r15 = com.epson.cameracopy.p006ui.CameraPrintSettingActivity.this
+                android.os.Handler r15 = r15.mHandler
+                r15.sendEmptyMessage(r3)
+            L_0x0c90:
+                return r10
+            */
+            throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.p006ui.CameraPrintSettingActivity.C08553.handleMessage(android.os.Message):boolean");
+        }
+
+        private int[] removeCddvdMedia(int[] iArr) {
+            if (iArr == null) {
+                return null;
+            }
+            ArrayList arrayList = new ArrayList();
+            for (int valueOf : iArr) {
+                arrayList.add(Integer.valueOf(valueOf));
+            }
+            for (Integer remove : new Integer[]{91, 92, 93}) {
+                do {
+                } while (arrayList.remove(remove));
+            }
+            int[] iArr2 = new int[arrayList.size()];
+            for (int i = 0; i < arrayList.size(); i++) {
+                iArr2[i] = ((Integer) arrayList.get(i)).intValue();
+            }
+            return iArr2;
+        }
+    });
+    /* access modifiers changed from: private */
+    public MediaInfo.AbstractInfo mLookupTable;
+    private MediaInfo.AbstractInfo mPaperSizeType;
+    private boolean mPrinterSelectDone;
+    /* access modifiers changed from: private */
+    public int mRemoteSrcType;
+    private boolean mWaiteInkReplenProgress;
+    /* access modifiers changed from: private */
+    public int paperSize;
+    /* access modifiers changed from: private */
+    public TextView paperSizeInfo;
+    /* access modifiers changed from: private */
+    public int paperSource;
+    /* access modifiers changed from: private */
+    public TextView paperSourceInfo;
+    /* access modifiers changed from: private */
+    public int paperType;
+    /* access modifiers changed from: private */
+    public TextView paperTypeInfo;
+    /* access modifiers changed from: private */
+    public int[] paper_size_info = null;
+    /* access modifiers changed from: private */
+    public int[] paper_source_info = null;
+    /* access modifiers changed from: private */
+    public int[] paper_type_info = null;
+    private boolean printAll;
+    /* access modifiers changed from: private */
+    public TextView printDateInfo;
+    /* access modifiers changed from: private */
+    public int printdate;
+    private MyPrinter printer = null;
+    private String printerDeviceId;
+    /* access modifiers changed from: private */
+    public String printerEmailAddress;
+    /* access modifiers changed from: private */
+    public String printerId;
+    /* access modifiers changed from: private */
+    public String printerIp;
+    /* access modifiers changed from: private */
+    public int printerLocation;
+    /* access modifiers changed from: private */
+    public TextView printerName;
+    private String printerSerialNo;
+    private View progressGetOption;
+    /* access modifiers changed from: private */
+    public int quality;
+    /* access modifiers changed from: private */
+    public TextView qualityInfo;
+    /* access modifiers changed from: private */
+    public int[] quality_info = null;
+    /* access modifiers changed from: private */
+    public TextView saturation;
+    /* access modifiers changed from: private */
+    public Button saturationMinus;
+    /* access modifiers changed from: private */
+    public Button saturationPlus;
+    /* access modifiers changed from: private */
+    public int saturationValue;
+    private int sheets = 1;
+    /* access modifiers changed from: private */
+    public int sizeIndex = 0;
+    /* access modifiers changed from: private */
+    public int startValue;
+    /* access modifiers changed from: private */
+    public int typeIndex = 0;
+    boolean undoFlag = true;
+
+    static /* synthetic */ int access$1108(CameraPrintSettingActivity cameraPrintSettingActivity) {
+        int i = cameraPrintSettingActivity.sizeIndex;
+        cameraPrintSettingActivity.sizeIndex = i + 1;
+        return i;
+    }
+
+    static /* synthetic */ int access$1608(CameraPrintSettingActivity cameraPrintSettingActivity) {
+        int i = cameraPrintSettingActivity.typeIndex;
+        cameraPrintSettingActivity.typeIndex = i + 1;
+        return i;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        setContentView((int) C2135R.layout.setting_layout);
+        setActionBar((int) C2135R.string.str_btn_printer_settings, true);
+        bindEpsonService();
+        this.mContext = this;
+        this.mRemoteSrcType = 2;
+        this.isDocumentSetting = getIntent().getBooleanExtra(PrintProgress.PARAM_DOCUMENT_MODE, false);
+        if (this.isDocumentSetting) {
+            this.sheets = getIntent().getIntExtra("SHEETS", 1);
+            this.disablePrintArea = getIntent().getBooleanExtra("PRINTAREA", false);
+            this.mRemoteSrcType = 1;
+        }
+        this.sheets = 1;
+        this.mRemoteSrcType = 2;
+        this.printerName = (TextView) findViewById(C2135R.C2137id.printer_name);
+        this.paperSizeInfo = (TextView) findViewById(C2135R.C2137id.paper_size_info);
+        this.paperTypeInfo = (TextView) findViewById(C2135R.C2137id.paper_type_info);
+        this.layoutInfo = (TextView) findViewById(C2135R.C2137id.layout_info);
+        this.qualityInfo = (TextView) findViewById(C2135R.C2137id.quality_info);
+        this.paperSourceInfo = (TextView) findViewById(C2135R.C2137id.paper_source_info);
+        this.copies = (TextView) findViewById(C2135R.C2137id.copies);
+        this.copiesMinus = (Button) findViewById(C2135R.C2137id.copies_minus_button);
+        this.copiesPlus = (Button) findViewById(C2135R.C2137id.copies_plus_button);
+        LongTapRepeatAdapter.bless(this.copiesMinus);
+        LongTapRepeatAdapter.bless(this.copiesPlus);
+        this.colorInfo = (TextView) findViewById(C2135R.C2137id.color_info);
+        this.duplexInfo = (TextView) findViewById(C2135R.C2137id.duplex_info);
+        this.feedDirectionInfo = (TextView) findViewById(C2135R.C2137id.feed_direction_info);
+        this.printDateInfo = (TextView) findViewById(C2135R.C2137id.printdate_info);
+        this.brightness = (TextView) findViewById(C2135R.C2137id.brightness);
+        this.brightnessMinus = (Button) findViewById(C2135R.C2137id.brightness_minus_button);
+        this.brightnessPlus = (Button) findViewById(C2135R.C2137id.brightness_plus_button);
+        this.contrast = (TextView) findViewById(C2135R.C2137id.contrast);
+        this.contrastMinus = (Button) findViewById(C2135R.C2137id.contrast_minus_button);
+        this.contrastPlus = (Button) findViewById(C2135R.C2137id.contrast_plus_button);
+        this.saturation = (TextView) findViewById(C2135R.C2137id.saturation);
+        this.saturationMinus = (Button) findViewById(C2135R.C2137id.saturation_minus_button);
+        this.saturationPlus = (Button) findViewById(C2135R.C2137id.saturation_plus_button);
+        this.progressGetOption = findViewById(C2135R.C2137id.progressGetOption);
+        this.enableShowPreview = getSharedPreferences(Constants.PREFS_EPSON_CONNECT, 0).getBoolean(Constants.ENABLE_SHOW_PREVIEW, true);
+        loadConfig();
+        setClickListener();
+        updatePrinterIcon();
+        if (this.printerId != null) {
+            this.undoFlag = false;
+            if (loadSupportedMediaFile()) {
+                this.mHandler.sendEmptyMessage(1);
+            } else {
+                this.mHandler.sendEmptyMessage(17);
+            }
+        } else {
+            this.mHandler.sendEmptyMessage(1);
+        }
+    }
+
+    private void updatePrinterIcon() {
+        if (this.printerName.getText().equals(getString(C2135R.string.str_lbl_title_scan))) {
+            ((ImageView) findViewById(C2135R.C2137id.imageViewPrinterLocation)).setVisibility(8);
+            return;
+        }
+        ((ImageView) findViewById(C2135R.C2137id.imageViewPrinterLocation)).setVisibility(0);
+        switch (this.printerLocation) {
+            case 1:
+                ((ImageView) findViewById(C2135R.C2137id.imageViewPrinterLocation)).setImageResource(C2135R.C2136drawable.print_local);
+                return;
+            case 2:
+                ((ImageView) findViewById(C2135R.C2137id.imageViewPrinterLocation)).setImageResource(C2135R.C2136drawable.print_remote);
+                return;
+            case 3:
+                ((ImageView) findViewById(C2135R.C2137id.imageViewPrinterLocation)).setImageResource(C2135R.C2136drawable.print_ip);
+                return;
+            default:
+                return;
+        }
+    }
+
+    private void setClickListener() {
+        this.copiesMinus.setOnClickListener(this);
+        this.copiesPlus.setOnClickListener(this);
+        this.brightnessMinus.setOnClickListener(this);
+        this.brightnessPlus.setOnClickListener(this);
+        this.contrastMinus.setOnClickListener(this);
+        this.contrastPlus.setOnClickListener(this);
+        this.saturationMinus.setOnClickListener(this);
+        this.saturationPlus.setOnClickListener(this);
+        if (this.isDocumentSetting) {
+            findViewById(C2135R.C2137id.page_range_setting).setOnClickListener(this);
+        }
+        findViewById(C2135R.C2137id.printer).setOnClickListener(this);
+        findViewById(C2135R.C2137id.paper_size).setOnClickListener(this);
+        findViewById(C2135R.C2137id.paper_type).setOnClickListener(this);
+        findViewById(C2135R.C2137id.layout).setOnClickListener(this);
+        findViewById(C2135R.C2137id.quality).setOnClickListener(this);
+        findViewById(C2135R.C2137id.paper_source).setOnClickListener(this);
+        findViewById(C2135R.C2137id.color).setOnClickListener(this);
+        findViewById(C2135R.C2137id.duplex).setOnClickListener(this);
+        findViewById(C2135R.C2137id.feed_direction).setOnClickListener(this);
+        findViewById(C2135R.C2137id.printdate).setOnClickListener(this);
+    }
+
+    private void loadConfig() {
+        MyPrinter curPrinter = MyPrinter.getCurPrinter(this);
+        if (curPrinter == null || curPrinter.getName() == null) {
+            this.printerName.setText(getString(C2135R.string.str_lbl_title_scan));
+        } else {
+            this.printerName.setText(curPrinter.getUserDefName(this));
+        }
+        this.printerDeviceId = curPrinter.getName();
+        this.printerId = curPrinter.getPrinterId();
+        this.printerIp = curPrinter.getIp();
+        this.printerSerialNo = curPrinter.getSerialNo();
+        this.printerEmailAddress = curPrinter.getEmailAddress();
+        this.printerLocation = curPrinter.getLocation();
+        boolean z = true;
+        if (this.printerLocation == 0) {
+            this.printerLocation = 1;
+        }
+        this.autoConnectSsid = WiFiDirectManager.getConnectInfo(this, WiFiDirectManager.DEVICE_TYPE_PRINTER);
+        PrintSetting printSetting = new PrintSetting(this, PrintSetting.Kind.cameracopy);
+        printSetting.loadSettings();
+        this.mLookupTable = new MediaInfo.PaperSize();
+        this.paperSize = printSetting.paperSizeValue;
+        this.paperSizeInfo.setText(getString(this.mLookupTable.getStringId(this.paperSize)));
+        this.mLookupTable.destructor();
+        this.mLookupTable = new MediaInfo.PaperType();
+        this.paperType = printSetting.paperTypeValue;
+        this.paperTypeInfo.setText(getString(this.mLookupTable.getStringId(this.paperType)));
+        this.mLookupTable.destructor();
+        this.mPaperSizeType = printSetting.loadPaperSizeTypePear();
+        this.mPaperSizeType.putID(this.paperSize, this.paperType);
+        this.mLookupTable = new MediaInfo.Layout();
+        this.layout = printSetting.layoutValue;
+        this.layoutInfo.setText(getString(this.mLookupTable.getStringId(this.layout)));
+        this.mLookupTable.destructor();
+        this.mLookupTable = new MediaInfo.Quality();
+        this.quality = printSetting.qualityValue;
+        this.qualityInfo.setText(getString(this.mLookupTable.getStringId(this.quality)));
+        this.mLookupTable.destructor();
+        this.mLookupTable = new MediaInfo.PaperSource();
+        this.paperSource = printSetting.paperSourceValue;
+        this.paperSourceInfo.setText(getString(this.mLookupTable.getStringId(this.paperSource)));
+        this.mLookupTable.destructor();
+        this.mLookupTable = new MediaInfo.Color();
+        this.color = printSetting.colorValue;
+        this.colorInfo.setText(getString(this.mLookupTable.getStringId(this.color)));
+        this.mLookupTable.destructor();
+        this.copiesValue = printSetting.copiesValue;
+        this.copies.setText(String.valueOf(this.copiesValue));
+        this.copiesMinus.setEnabled(this.copiesValue != 1);
+        Button button = this.copiesPlus;
+        if (this.copiesValue == 30) {
+            z = false;
+        }
+        button.setEnabled(z);
+        this.brightnessValue = printSetting.brightnessValue;
+        this.contrastValue = printSetting.contrastValue;
+        this.saturationValue = printSetting.saturationValue;
+        this.mLookupTable = new MediaInfo.Duplex();
+        this.duplex = printSetting.duplexValue;
+        this.duplexInfo.setText(getString(this.mLookupTable.getStringId(this.duplex)));
+        this.mLookupTable.destructor();
+        this.mLookupTable = new MediaInfo.FeedDirection();
+        this.feedDirection = printSetting.feedDirectionValue;
+        this.feedDirectionInfo.setText(getString(this.mLookupTable.getStringId(this.feedDirection)));
+        this.mLookupTable.destructor();
+        this.lang = curPrinter.getLang();
+        if (this.isDocumentSetting) {
+            this.printAll = printSetting.printAll;
+            this.startValue = printSetting.startValue;
+            this.endValue = printSetting.endValue;
+            ((TextView) findViewById(C2135R.C2137id.page_range_value)).setText(this.startValue + ".." + this.endValue);
+            return;
+        }
+        this.mLookupTable = new MediaInfo.PrintDate();
+        this.printdate = printSetting.printdate;
+        this.printDateInfo.setText(getString(this.mLookupTable.getStringId(this.printdate)));
+        this.mLookupTable.destructor();
+    }
+
+    private boolean loadSupportedMediaFile() {
+        ExternalFileUtils instance = ExternalFileUtils.getInstance(this);
+        File savedSupportedMedia = instance.getSavedSupportedMedia();
+        File supportedMedia = instance.getSupportedMedia();
+        File preSupportedMedia = instance.getPreSupportedMedia();
+        EPLog.m313i(TAG, "call loadSupportedMedia");
+        try {
+            if (!savedSupportedMedia.exists()) {
+                EPLog.m318w("loadSupportedMedia", savedSupportedMedia.getName() + " not exist");
+                return false;
+            }
+            Utils.copyFile(savedSupportedMedia, supportedMedia);
+            Utils.copyFile(savedSupportedMedia, preSupportedMedia);
+            File savedAreaInfo = instance.getSavedAreaInfo();
+            File areaInfo = instance.getAreaInfo();
+            File preAreaInfo = instance.getPreAreaInfo();
+            try {
+                if (!savedAreaInfo.exists()) {
+                    return true;
+                }
+                Utils.copyFile(savedAreaInfo, areaInfo);
+                Utils.copyFile(savedAreaInfo, preAreaInfo);
+                return true;
+            } catch (Exception e) {
+                EPLog.m318w("loadSupportedMedia", "failure " + e.getMessage());
+                return false;
+            }
+        } catch (Exception e2) {
+            EPLog.m318w("loadSupportedMedia", "failure " + e2.getMessage());
+            return false;
+        }
+    }
+
+    /* access modifiers changed from: private */
+    public boolean updateSupportedMediaFile(boolean z) {
+        ExternalFileUtils instance = ExternalFileUtils.getInstance(this);
+        EPLog.m313i(TAG, "call updateSupportedMedia");
+        File supportedMedia = instance.getSupportedMedia();
+        File preSupportedMedia = instance.getPreSupportedMedia();
+        if (z) {
+            File file = preSupportedMedia;
+            preSupportedMedia = supportedMedia;
+            supportedMedia = file;
+        }
+        try {
+            Utils.copyFile(supportedMedia, preSupportedMedia);
+            File areaInfo = instance.getAreaInfo();
+            File preAreaInfo = instance.getPreAreaInfo();
+            if (!z) {
+                File file2 = areaInfo;
+                areaInfo = preAreaInfo;
+                preAreaInfo = file2;
+            }
+            try {
+                if (!preAreaInfo.exists()) {
+                    return true;
+                }
+                Utils.copyFile(preAreaInfo, areaInfo);
+                return true;
+            } catch (Exception e) {
+                if (preAreaInfo != null && preAreaInfo.exists()) {
+                    preAreaInfo.delete();
+                }
+                if (areaInfo != null && areaInfo.exists()) {
+                    areaInfo.delete();
+                }
+                EPLog.m318w("updateSupportedMediaFile", "failure " + e.getMessage());
+                return false;
+            }
+        } catch (Exception e2) {
+            if (supportedMedia != null && supportedMedia.exists()) {
+                supportedMedia.delete();
+            }
+            if (preSupportedMedia != null && preSupportedMedia.exists()) {
+                preSupportedMedia.delete();
+            }
+            EPLog.m318w("updateSupportedMediaFile", "failure " + e2.getMessage());
+            return false;
+        }
+    }
+
+    private boolean saveSupportedMediaFile() {
+        ExternalFileUtils instance = ExternalFileUtils.getInstance(this);
+        EPLog.m313i(TAG, "call saveSupportedMedia");
+        File supportedMedia = instance.getSupportedMedia();
+        File savedSupportedMedia = instance.getSavedSupportedMedia();
+        try {
+            if (!supportedMedia.exists()) {
+                EPLog.m318w("updateSupportedMediaFile", supportedMedia.getName() + " not exist");
+                return false;
+            }
+            Utils.copyFile(supportedMedia, savedSupportedMedia);
+            File areaInfo = instance.getAreaInfo();
+            File savedAreaInfo = instance.getSavedAreaInfo();
+            int i = this.printerLocation;
+            if (i == 1 || i == 3) {
+                try {
+                    if (!areaInfo.exists()) {
+                        EPLog.m318w("updateSupportedMediaFile", areaInfo.getName() + " not exist");
+                        return false;
+                    }
+                    Utils.copyFile(areaInfo, savedAreaInfo);
+                } catch (Exception e) {
+                    EPLog.m318w("saveSupportedMediaFile", "failure " + e.getMessage());
+                    return false;
+                }
+            } else {
+                EPLog.m313i(TAG, "delete AreaInfo");
+                instance.removeAreaInfo();
+            }
+            return true;
+        } catch (Exception e2) {
+            EPLog.m318w("saveSupportedMediaFile", "failure " + e2.getMessage());
+            return false;
+        }
+    }
+
+    private void saveChanged() {
+        SharedPreferences.Editor edit = getSharedPreferences("PrintSetting", 0).edit();
+        edit.putInt(Constants.PREFS_INFO_PRINT_SAVE, 1);
+        edit.commit();
+        MyPrinter myPrinter = new MyPrinter(this.printerDeviceId, this.printerIp, this.printerId, this.printerSerialNo, this.printerEmailAddress, this.printerLocation);
+        myPrinter.setLang(this.lang);
+        myPrinter.setCurPrinter(this);
+        PrintSetting printSetting = new PrintSetting(this, PrintSetting.Kind.cameracopy);
+        printSetting.paperSizeValue = this.paperSize;
+        printSetting.paperTypeValue = this.paperType;
+        printSetting.layoutValue = this.layout;
+        printSetting.qualityValue = this.quality;
+        printSetting.paperSourceValue = this.paperSource;
+        printSetting.colorValue = this.color;
+        printSetting.duplexValue = this.duplex;
+        printSetting.feedDirectionValue = this.feedDirection;
+        printSetting.copiesValue = this.copiesValue;
+        printSetting.brightnessValue = this.brightnessValue;
+        printSetting.contrastValue = this.contrastValue;
+        printSetting.saturationValue = this.saturationValue;
+        if (this.isDocumentSetting) {
+            printSetting.printAll = this.printAll;
+            printSetting.startValue = this.startValue;
+            printSetting.endValue = this.endValue;
+        } else {
+            printSetting.printdate = this.printdate;
+        }
+        printSetting.saveSettings();
+        printSetting.savePaperSizeTypePear((MediaInfo.PaperSizeType) this.mPaperSizeType);
+        saveSupportedMediaFile();
+        String str = this.autoConnectSsid;
+        if (str == null || str.length() <= 0) {
+            WiFiDirectManager.resetConnectInfo(this, WiFiDirectManager.DEVICE_TYPE_PRINTER);
+        } else {
+            WiFiDirectManager.setConnectInfo(this, this.autoConnectSsid, WiFiDirectManager.DEVICE_TYPE_PRINTER, myPrinter.getName());
+        }
+        EPPrinterManager ePPrinterManager = new EPPrinterManager(this.mContext);
+        ePPrinterManager.commitIPPrinterInfo();
+        ePPrinterManager.commitRemotePrinterInfo();
+        if (this.mPrinterSelectDone) {
+            new InkRplnRepository(false).savePermanently(this);
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onDestroy() {
+        super.onDestroy();
+        unbindEpsonService();
+        EPLog.m313i("SettingScr", "onDestroy");
+        this.mPaperSizeType.destructor();
+    }
+
+    private void bindEpsonService() {
+        EPLog.m316v("SettingScr", "bindEpsonService");
+        if (this.mEpsonService == null) {
+            bindService(new Intent(this, EpsonService.class), this.mEpsonConnection, 1);
+        }
+    }
+
+    private void unbindEpsonService() {
+        EPLog.m316v("SettingScr", "unbindEpsonService");
+        IEpsonService iEpsonService = this.mEpsonService;
+        if (iEpsonService != null) {
+            try {
+                iEpsonService.unregisterCallback(this.mCallback);
+                unbindService(this.mEpsonConnection);
+                this.mEpsonService = null;
+            } catch (RemoteException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    public void onClick(View view) {
+        if (this.progressGetOption.getVisibility() == 8) {
+            IEpsonService iEpsonService = this.mEpsonService;
+            if (iEpsonService != null) {
+                try {
+                    iEpsonService.cancelSearchPrinter();
+                } catch (RemoteException e) {
+                    e.printStackTrace();
+                }
+            }
+            switch (view.getId()) {
+                case C2135R.C2137id.brightness_minus_button /*2131230848*/:
+                    this.brightnessValue--;
+                    if (this.brightnessValue <= -50) {
+                        this.brightnessValue = -50;
+                        this.brightnessMinus.setEnabled(false);
+                    } else {
+                        this.brightnessMinus.setEnabled(true);
+                    }
+                    this.brightnessPlus.setEnabled(true);
+                    this.brightness.setText(String.valueOf(this.brightnessValue));
+                    return;
+                case C2135R.C2137id.brightness_plus_button /*2131230850*/:
+                    this.brightnessValue++;
+                    if (this.brightnessValue >= 50) {
+                        this.brightnessValue = 50;
+                        this.brightnessPlus.setEnabled(false);
+                    } else {
+                        this.brightnessPlus.setEnabled(true);
+                    }
+                    this.brightnessMinus.setEnabled(true);
+                    this.brightness.setText(String.valueOf(this.brightnessValue));
+                    return;
+                case C2135R.C2137id.color /*2131230930*/:
+                    launchDetailScreen(this.color, C2135R.C2137id.color);
+                    return;
+                case C2135R.C2137id.contrast_minus_button /*2131230942*/:
+                    this.contrastValue--;
+                    if (this.contrastValue <= -50) {
+                        this.contrastValue = -50;
+                        this.contrastMinus.setEnabled(false);
+                    } else {
+                        this.contrastMinus.setEnabled(true);
+                    }
+                    this.contrastPlus.setEnabled(true);
+                    this.contrast.setText(String.valueOf(this.contrastValue));
+                    return;
+                case C2135R.C2137id.contrast_plus_button /*2131230943*/:
+                    this.contrastValue++;
+                    if (this.contrastValue >= 50) {
+                        this.contrastValue = 50;
+                        this.contrastPlus.setEnabled(false);
+                    } else {
+                        this.contrastPlus.setEnabled(true);
+                    }
+                    this.contrastMinus.setEnabled(true);
+                    this.contrast.setText(String.valueOf(this.contrastValue));
+                    return;
+                case C2135R.C2137id.copies_minus_button /*2131230945*/:
+                    this.copiesValue--;
+                    if (this.copiesValue <= 1) {
+                        this.copiesValue = 1;
+                        this.copiesMinus.setEnabled(false);
+                    } else {
+                        this.copiesMinus.setEnabled(true);
+                    }
+                    this.copiesPlus.setEnabled(true);
+                    this.copies.setText(String.valueOf(this.copiesValue));
+                    return;
+                case C2135R.C2137id.copies_plus_button /*2131230946*/:
+                    this.copiesValue++;
+                    if (this.copiesValue >= 30) {
+                        this.copiesValue = 30;
+                        this.copiesPlus.setEnabled(false);
+                    } else {
+                        this.copiesPlus.setEnabled(true);
+                    }
+                    this.copiesMinus.setEnabled(true);
+                    this.copies.setText(String.valueOf(this.copiesValue));
+                    return;
+                case C2135R.C2137id.duplex /*2131231005*/:
+                    launchDetailScreen(this.duplex, C2135R.C2137id.duplex);
+                    return;
+                case C2135R.C2137id.feed_direction /*2131231037*/:
+                    launchDetailScreen(this.feedDirection, C2135R.C2137id.feed_direction);
+                    return;
+                case C2135R.C2137id.layout /*2131231158*/:
+                    launchDetailScreen(this.layout, C2135R.C2137id.layout);
+                    return;
+                case C2135R.C2137id.page_range_setting /*2131231300*/:
+                    Intent intent = new Intent(this, PageRangeSetting.class);
+                    intent.putExtra("SHEETS", this.sheets);
+                    intent.putExtra("printAll", this.printAll);
+                    intent.putExtra("startValue", this.startValue);
+                    intent.putExtra("endValue", this.endValue);
+                    startActivityForResult(intent, 2);
+                    return;
+                case C2135R.C2137id.paper_size /*2131231306*/:
+                    launchDetailScreen(this.paperSize, C2135R.C2137id.paper_size);
+                    return;
+                case C2135R.C2137id.paper_source /*2131231311*/:
+                    int i = this.paperSource;
+                    int[] iArr = this.paper_source_info;
+                    if (iArr != null && iArr.length <= 1) {
+                        i = 128;
+                    }
+                    launchDetailScreen(i, C2135R.C2137id.paper_source);
+                    return;
+                case C2135R.C2137id.paper_type /*2131231314*/:
+                    launchDetailScreen(this.paperType, C2135R.C2137id.paper_type);
+                    return;
+                case C2135R.C2137id.printdate /*2131231355*/:
+                    launchDetailScreen(this.printdate, C2135R.C2137id.printdate);
+                    return;
+                case C2135R.C2137id.printer /*2131231358*/:
+                    unbindEpsonService();
+                    new AsyncTask<Void, Void, Void>() {
+                        /* access modifiers changed from: protected */
+                        public void onPreExecute() {
+                            CameraPrintSettingActivity.this.findViewById(C2135R.C2137id.printer).setClickable(false);
+                        }
+
+                        /* access modifiers changed from: protected */
+                        public Void doInBackground(Void... voidArr) {
+                            CameraPrintSettingActivity cameraPrintSettingActivity = CameraPrintSettingActivity.this;
+                            WiFiDirectManager.disconnect(cameraPrintSettingActivity, WiFiDirectManager.DEVICE_TYPE_PRINTER, cameraPrintSettingActivity.printerIp);
+                            CameraPrintSettingActivity cameraPrintSettingActivity2 = CameraPrintSettingActivity.this;
+                            WiFiDirectManager.disconnectSimpleAP(cameraPrintSettingActivity2, cameraPrintSettingActivity2.autoConnectSsid, CameraPrintSettingActivity.this.printerIp);
+                            return null;
+                        }
+
+                        /* access modifiers changed from: protected */
+                        public void onPostExecute(Void voidR) {
+                            Intent intent = new Intent(CameraPrintSettingActivity.this, SearchPrinterScr.class);
+                            Bundle bundle = new Bundle();
+                            bundle.putString(Constants.PRINTER_ID, CameraPrintSettingActivity.this.printerId);
+                            bundle.putString(Constants.PRINTER_IP, CameraPrintSettingActivity.this.printerIp);
+                            bundle.putString(Constants.PRINTER_EMAIL_ADDRESS, CameraPrintSettingActivity.this.printerEmailAddress);
+                            bundle.putInt(Constants.PRINTER_LOCATION, CameraPrintSettingActivity.this.printerLocation);
+                            bundle.putString(CameraPrintSettingActivity.EXTRA_SIMPLEAP, CameraPrintSettingActivity.this.autoConnectSsid);
+                            intent.putExtras(bundle);
+                            CameraPrintSettingActivity.this.startActivityForResult(intent, 0);
+                            CameraPrintSettingActivity.this.findViewById(C2135R.C2137id.printer).setClickable(true);
+                        }
+                    }.execute(new Void[0]);
+                    return;
+                case C2135R.C2137id.quality /*2131231392*/:
+                    launchDetailScreen(this.quality, C2135R.C2137id.quality);
+                    return;
+                case C2135R.C2137id.saturation_minus_button /*2131231425*/:
+                    this.saturationValue--;
+                    if (this.saturationValue <= -50) {
+                        this.saturationValue = -50;
+                        this.saturationMinus.setEnabled(false);
+                    } else {
+                        this.saturationMinus.setEnabled(true);
+                    }
+                    this.saturationPlus.setEnabled(true);
+                    this.saturation.setText(String.valueOf(this.saturationValue));
+                    return;
+                case C2135R.C2137id.saturation_plus_button /*2131231426*/:
+                    this.saturationValue++;
+                    if (this.saturationValue >= 50) {
+                        this.saturationValue = 50;
+                        this.saturationPlus.setEnabled(false);
+                    } else {
+                        this.saturationPlus.setEnabled(true);
+                    }
+                    this.saturationMinus.setEnabled(true);
+                    this.saturation.setText(String.valueOf(this.saturationValue));
+                    return;
+                default:
+                    return;
+            }
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public void launchDetailScreen(int i, int i2) {
+        Intent intent = new Intent(this, PrinterInfoDetail.class);
+        Bundle bundle = new Bundle();
+        bundle.putInt("ID", i2);
+        bundle.putInt("sizeIndex", this.sizeIndex);
+        bundle.putInt("typeIndex", this.typeIndex);
+        bundle.putInt("curValue", i);
+        bundle.putBoolean("isDocumentSetting", this.isDocumentSetting);
+        switch (i2) {
+            case C2135R.C2137id.color /*2131230930*/:
+                bundle.putIntArray(Constants.COLOR_INFO, this.color_info);
+                break;
+            case C2135R.C2137id.duplex /*2131231005*/:
+                bundle.putIntArray(Constants.DUPLEX_INFO, this.duplex_info);
+                break;
+            case C2135R.C2137id.layout /*2131231158*/:
+                bundle.putIntArray(Constants.LAYOUT_INFO, this.layout_info);
+                break;
+            case C2135R.C2137id.paper_size /*2131231306*/:
+                bundle.putIntArray(Constants.PAPER_SIZE_INFO, this.paper_size_info);
+                break;
+            case C2135R.C2137id.paper_source /*2131231311*/:
+                int[] iArr = this.paper_source_info;
+                bundle.putIntArray(Constants.PAPER_SOURCE_INFO, (iArr == null || iArr.length > 1) ? this.paper_source_info : new int[]{128});
+                break;
+            case C2135R.C2137id.paper_type /*2131231314*/:
+                bundle.putIntArray(Constants.PAPER_TYPE_INFO, this.paper_type_info);
+                break;
+            case C2135R.C2137id.quality /*2131231392*/:
+                bundle.putIntArray(Constants.PRINT_QUALITY_INFO, this.quality_info);
+                break;
+        }
+        intent.putExtras(bundle);
+        startActivityForResult(intent, 1);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onActivityResult(int i, int i2, Intent intent) {
+        super.onActivityResult(i, i2, intent);
+        String callingPackage = getCallingPackage();
+        EPLog.m313i(callingPackage, "requestCode = " + i + " resultCode = " + i2);
+        if (i != 0) {
+            if (i != 4) {
+                if (i != 2) {
+                    if (i == 1 && i2 == -1) {
+                        int i3 = intent.getExtras().getInt("curValue");
+                        switch (intent.getExtras().getInt("ID")) {
+                            case C2135R.C2137id.color /*2131230930*/:
+                                this.mLookupTable = new MediaInfo.Color();
+                                this.colorInfo.setText(getString(this.mLookupTable.getStringId(i3)));
+                                this.mLookupTable.destructor();
+                                this.color = i3;
+                                break;
+                            case C2135R.C2137id.duplex /*2131231005*/:
+                                this.mLookupTable = new MediaInfo.Duplex();
+                                this.duplexInfo.setText(getString(this.mLookupTable.getStringId(i3)));
+                                this.mLookupTable.destructor();
+                                this.duplex = i3;
+                                break;
+                            case C2135R.C2137id.feed_direction /*2131231037*/:
+                                this.mLookupTable = new MediaInfo.FeedDirection();
+                                this.feedDirectionInfo.setText(getString(this.mLookupTable.getStringId(i3)));
+                                this.mLookupTable.destructor();
+                                this.feedDirection = i3;
+                                break;
+                            case C2135R.C2137id.layout /*2131231158*/:
+                                this.mLookupTable = new MediaInfo.Layout();
+                                this.layoutInfo.setText(getString(this.mLookupTable.getStringId(i3)));
+                                this.mLookupTable.destructor();
+                                this.layout = i3;
+                                this.undoFlag = false;
+                                this.mHandler.sendEmptyMessage(32);
+                                break;
+                            case C2135R.C2137id.paper_size /*2131231306*/:
+                                this.sizeIndex = intent.getExtras().getInt("INDEX");
+                                this.mLookupTable = new MediaInfo.PaperSize();
+                                this.paperSizeInfo.setText(getString(this.mLookupTable.getStringId(i3)));
+                                this.mLookupTable.destructor();
+                                this.paperSize = i3;
+                                this.paperType = this.mPaperSizeType.getID(this.paperSize);
+                                this.undoFlag = false;
+                                this.mHandler.sendEmptyMessage(2);
+                                break;
+                            case C2135R.C2137id.paper_source /*2131231311*/:
+                                this.mLookupTable = new MediaInfo.PaperSource();
+                                this.paperSourceInfo.setText(getString(this.mLookupTable.getStringId(i3)));
+                                this.mLookupTable.destructor();
+                                int[] iArr = this.paper_source_info;
+                                if (iArr != null && iArr.length > 1) {
+                                    this.paperSource = i3;
+                                }
+                                this.undoFlag = false;
+                                this.mHandler.sendEmptyMessage(32);
+                                break;
+                            case C2135R.C2137id.paper_type /*2131231314*/:
+                                this.typeIndex = intent.getExtras().getInt("INDEX");
+                                this.mLookupTable = new MediaInfo.PaperType();
+                                this.paperTypeInfo.setText(getString(this.mLookupTable.getStringId(i3)));
+                                this.mLookupTable.destructor();
+                                this.paperType = i3;
+                                this.mPaperSizeType.putID(this.paperSize, this.paperType);
+                                this.undoFlag = false;
+                                this.mHandler.sendEmptyMessage(3);
+                                break;
+                            case C2135R.C2137id.printdate /*2131231355*/:
+                                this.mLookupTable = new MediaInfo.PrintDate();
+                                this.printDateInfo.setText(getString(this.mLookupTable.getStringId(i3)));
+                                this.mLookupTable.destructor();
+                                this.printdate = i3;
+                                break;
+                            case C2135R.C2137id.quality /*2131231392*/:
+                                this.mLookupTable = new MediaInfo.Quality();
+                                this.qualityInfo.setText(getString(this.mLookupTable.getStringId(i3)));
+                                this.mLookupTable.destructor();
+                                this.quality = i3;
+                                break;
+                        }
+                    }
+                } else if (i2 == -1) {
+                    this.printAll = intent.getExtras().getBoolean("printAll");
+                    this.startValue = intent.getExtras().getInt("startValue");
+                    this.endValue = intent.getExtras().getInt("endValue");
+                    this.mHandler.sendEmptyMessage(64);
+                }
+            } else {
+                endInkReplAndGoProbePrinter();
+            }
+        } else {
+            onPrinterSelectEnd(i2, intent);
+        }
+        updatePrinterIcon();
+    }
+
+    /* JADX WARNING: Can't fix incorrect switch cases order */
+    /* JADX WARNING: Code restructure failed: missing block: B:25:0x00ea, code lost:
+        if (r7.loadIpPrinterInfo(r6.printerId) == null) goto L_0x00f7;
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:27:0x00f3, code lost:
+        if (r7.loadRemotePrinterInfo(r6.printerEmailAddress) == null) goto L_0x00f7;
+     */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    private void onPrinterSelectEnd(int r7, android.content.Intent r8) {
+        /*
+            r6 = this;
+            r0 = 0
+            r1 = 1
+            r2 = -1
+            if (r7 != r2) goto L_0x00d6
+            android.os.Bundle r7 = r8.getExtras()
+            java.lang.String r2 = "myprinter"
+            android.os.Parcelable r7 = r7.getParcelable(r2)
+            epson.print.MyPrinter r7 = (epson.print.MyPrinter) r7
+            r6.printer = r7
+            android.widget.TextView r7 = r6.printerName
+            epson.print.MyPrinter r2 = r6.printer
+            java.lang.String r2 = r2.getName()
+            r7.setText(r2)
+            epson.print.MyPrinter r7 = r6.printer
+            java.lang.String r7 = r7.getName()
+            r6.printerDeviceId = r7
+            epson.print.MyPrinter r7 = r6.printer
+            java.lang.String r7 = r7.getPrinterId()
+            r6.printerId = r7
+            epson.print.MyPrinter r7 = r6.printer
+            java.lang.String r7 = r7.getIp()
+            r6.printerIp = r7
+            epson.print.MyPrinter r7 = r6.printer
+            java.lang.String r7 = r7.getSerialNo()
+            r6.printerSerialNo = r7
+            epson.print.MyPrinter r7 = r6.printer
+            java.lang.String r7 = r7.getEmailAddress()
+            r6.printerEmailAddress = r7
+            epson.print.MyPrinter r7 = r6.printer
+            int r7 = r7.getLocation()
+            r6.printerLocation = r7
+            epson.print.EPPrinterManager r7 = new epson.print.EPPrinterManager
+            r7.<init>(r6)
+            int r2 = r6.printerLocation
+            switch(r2) {
+                case 2: goto L_0x0075;
+                case 3: goto L_0x0059;
+                default: goto L_0x0058;
+            }
+        L_0x0058:
+            goto L_0x0090
+        L_0x0059:
+            java.lang.String r2 = r6.printerId
+            epson.print.EPPrinterInfo r7 = r7.loadIpPrinterInfo(r2)
+            if (r7 == 0) goto L_0x0090
+            java.lang.String r2 = r7.userDefName
+            if (r2 == 0) goto L_0x0090
+            java.lang.String r2 = r7.userDefName
+            int r2 = r2.length()
+            if (r2 <= 0) goto L_0x0090
+            android.widget.TextView r2 = r6.printerName
+            java.lang.String r7 = r7.userDefName
+            r2.setText(r7)
+            goto L_0x0090
+        L_0x0075:
+            java.lang.String r2 = r6.printerEmailAddress
+            epson.print.EPPrinterInfo r7 = r7.loadRemotePrinterInfo(r2)
+            if (r7 == 0) goto L_0x0090
+            java.lang.String r2 = r7.userDefName
+            if (r2 == 0) goto L_0x0090
+            java.lang.String r2 = r7.userDefName
+            int r2 = r2.length()
+            if (r2 <= 0) goto L_0x0090
+            android.widget.TextView r2 = r6.printerName
+            java.lang.String r7 = r7.userDefName
+            r2.setText(r7)
+        L_0x0090:
+            android.os.Bundle r7 = r8.getExtras()
+            java.lang.String r8 = "simpleap"
+            java.lang.String r7 = r7.getString(r8)
+            r6.autoConnectSsid = r7
+            android.content.Context r7 = r6.getApplicationContext()
+            java.lang.String r8 = "PrintSetting"
+            java.lang.String r2 = "RE_SEARCH"
+            epson.common.Utils.savePref((android.content.Context) r7, (java.lang.String) r8, (java.lang.String) r2, (boolean) r1)
+            r6.undoFlag = r0
+            r6.mPrinterSelectDone = r1
+            r6.mWaiteInkReplenProgress = r1
+            android.content.Context r7 = r6.getApplicationContext()
+            java.lang.String r8 = r6.printerId
+            boolean r7 = epson.print.inkrpln.InkReplnHelper.isSimpleApOrP2p(r7, r8)
+            if (r7 != 0) goto L_0x00d2
+            epson.print.inkrpln.PrintSettingDependencyBuilder r7 = new epson.print.inkrpln.PrintSettingDependencyBuilder
+            java.lang.String r1 = r6.printerId
+            java.lang.String r2 = r6.printerIp
+            java.lang.String r3 = r6.printerSerialNo
+            int r4 = r6.printerLocation
+            java.lang.String r5 = r6.printerDeviceId
+            r0 = r7
+            r0.<init>(r1, r2, r3, r4, r5)
+            android.content.Intent r7 = epson.print.inkrpln.InkRplnProgressDialog.getStartIntent2(r6, r7)
+            r8 = 4
+            r6.startActivityForResult(r7, r8)
+            goto L_0x00fc
+        L_0x00d2:
+            r6.endInkReplAndGoProbePrinter()
+            goto L_0x00fc
+        L_0x00d6:
+            r6.bindEpsonService()
+            epson.print.EPPrinterManager r7 = new epson.print.EPPrinterManager
+            r7.<init>(r6)
+            int r8 = r6.printerLocation
+            switch(r8) {
+                case 2: goto L_0x00ed;
+                case 3: goto L_0x00e4;
+                default: goto L_0x00e3;
+            }
+        L_0x00e3:
+            goto L_0x00f6
+        L_0x00e4:
+            java.lang.String r8 = r6.printerId
+            epson.print.EPPrinterInfo r7 = r7.loadIpPrinterInfo(r8)
+            if (r7 != 0) goto L_0x00f6
+            goto L_0x00f7
+        L_0x00ed:
+            java.lang.String r8 = r6.printerEmailAddress
+            epson.print.EPPrinterInfo r7 = r7.loadRemotePrinterInfo(r8)
+            if (r7 != 0) goto L_0x00f6
+            goto L_0x00f7
+        L_0x00f6:
+            r1 = 0
+        L_0x00f7:
+            if (r1 == 0) goto L_0x00fc
+            r6.resetSettings()
+        L_0x00fc:
+            return
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.p006ui.CameraPrintSettingActivity.onPrinterSelectEnd(int, android.content.Intent):void");
+    }
+
+    private void endInkReplAndGoProbePrinter() {
+        this.mWaiteInkReplenProgress = false;
+        bindEpsonService();
+        this.mHandler.sendEmptyMessageDelayed(17, 100);
+    }
+
+    /* access modifiers changed from: package-private */
+    public void updateSettingView() {
+        boolean z = this.isDocumentSetting;
+        setVisibilityPageRange(false);
+        int[] iArr = this.color_info;
+        if (iArr == null) {
+            ((ImageView) findViewById(C2135R.C2137id.color_next_screen_imv)).setVisibility(8);
+        } else if (iArr.length <= 1) {
+            ((ImageView) findViewById(C2135R.C2137id.color_next_screen_imv)).setVisibility(8);
+        } else {
+            ((ImageView) findViewById(C2135R.C2137id.color_next_screen_imv)).setVisibility(0);
+        }
+        int[] iArr2 = this.duplex_info;
+        findViewById(C2135R.C2137id.duplex_view).setVisibility(8);
+        ((LinearLayout) findViewById(C2135R.C2137id.duplex)).setVisibility(8);
+        switch (this.lang) {
+            case 2:
+            case 3:
+                findViewById(C2135R.C2137id.feed_direction_view).setVisibility(0);
+                findViewById(C2135R.C2137id.feed_direction).setVisibility(0);
+                break;
+            default:
+                findViewById(C2135R.C2137id.feed_direction_view).setVisibility(8);
+                findViewById(C2135R.C2137id.feed_direction).setVisibility(8);
+                break;
+        }
+        if (!this.isDocumentSetting) {
+            int i = this.printerLocation;
+        }
+        findViewById(C2135R.C2137id.printdate).setVisibility(8);
+    }
+
+    /* access modifiers changed from: package-private */
+    public int getPrinterLang() {
+        int i;
+        IEpsonService iEpsonService;
+        if (!(this.printerLocation == 2 || (iEpsonService = this.mEpsonService) == null)) {
+            try {
+                i = iEpsonService.getLang();
+            } catch (RemoteException e) {
+                e.printStackTrace();
+            }
+            EPLog.m305d(TAG, "getPrinterLang called : ret = " + i);
+            return i;
+        }
+        i = 1;
+        EPLog.m305d(TAG, "getPrinterLang called : ret = " + i);
+        return i;
+    }
+
+    /* access modifiers changed from: package-private */
+    public void setVisibilityPageRange(boolean z) {
+        int i = 0;
+        findViewById(C2135R.C2137id.page_range_setting).setVisibility(z ? 0 : 8);
+        View findViewById = findViewById(C2135R.C2137id.page_range_separator);
+        if (!z) {
+            i = 8;
+        }
+        findViewById.setVisibility(i);
+    }
+
+    /* access modifiers changed from: package-private */
+    public void setClickablePageRange(boolean z) {
+        findViewById(C2135R.C2137id.page_range_setting).setClickable(z);
+        int i = 0;
+        findViewById(C2135R.C2137id.page_range_next_screen_imv).setVisibility(z ? 0 : 8);
+        View findViewById = findViewById(C2135R.C2137id.page_range_value);
+        if (!z) {
+            i = 8;
+        }
+        findViewById.setVisibility(i);
+    }
+
+    /* access modifiers changed from: package-private */
+    public void resetSettings() {
+        this.printerDeviceId = null;
+        this.printerId = null;
+        this.printerEmailAddress = null;
+        this.printerIp = null;
+        this.printerLocation = 0;
+        this.info = null;
+        this.paper_source_info = null;
+        this.color_info = null;
+        this.paper_size_info = null;
+        this.paper_type_info = null;
+        this.layout_info = null;
+        this.quality_info = null;
+        this.duplex_info = null;
+        this.autoConnectSsid = "";
+        this.printerName.setText(getString(C2135R.string.str_lbl_title_scan));
+        ((ImageView) findViewById(C2135R.C2137id.imageViewPrinterLocation)).setVisibility(8);
+        updateSettingView();
+        setScreenState(true);
+    }
+
+    public void onBackPressed() {
+        super.onBackPressed();
+        IEpsonService iEpsonService = this.mEpsonService;
+        if (iEpsonService != null) {
+            try {
+                iEpsonService.cancelSearchPrinter();
+            } catch (RemoteException e) {
+                e.printStackTrace();
+            }
+        }
+        loadSupportedMediaFile();
+        EPPrinterManager ePPrinterManager = new EPPrinterManager(this.mContext);
+        ePPrinterManager.rollbackRemotePrinterInfo();
+        ePPrinterManager.rollbackIPPrinterInfo();
+        new InkRplnRepository(false).deleteTemporaryData(this);
+    }
+
+    /* access modifiers changed from: private */
+    public void setScreenState(Boolean bool) {
+        if (bool.booleanValue()) {
+            this.progressGetOption.setVisibility(8);
+        } else {
+            this.progressGetOption.setVisibility(0);
+        }
+        findViewById(C2135R.C2137id.printer).setClickable(bool.booleanValue());
+        findViewById(C2135R.C2137id.paper_size).setClickable(bool.booleanValue());
+        findViewById(C2135R.C2137id.paper_type).setClickable(bool.booleanValue());
+        findViewById(C2135R.C2137id.layout).setClickable(bool.booleanValue());
+        findViewById(C2135R.C2137id.quality).setClickable(bool.booleanValue());
+        findViewById(C2135R.C2137id.paper_source).setClickable(bool.booleanValue());
+        findViewById(C2135R.C2137id.color).setClickable(bool.booleanValue());
+        findViewById(C2135R.C2137id.duplex).setClickable(bool.booleanValue());
+        findViewById(C2135R.C2137id.feed_direction).setClickable(bool.booleanValue());
+        findViewById(C2135R.C2137id.printdate).setClickable(bool.booleanValue());
+    }
+
+    public void showErrorDialog(String str, String str2) {
+        new CustomTitleAlertDialogBuilder(this).setCancelable(false).setTitle(str).setMessage(str2).setNegativeButton(getString(C2135R.string.ok_button), new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialogInterface, int i) {
+                CameraPrintSettingActivity.this.setScreenState(true);
+                dialogInterface.cancel();
+            }
+        }).create().show();
+        updateSupportedMediaFile(true);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onResume() {
+        super.onResume();
+        EPLog.m307e("SettingScr", "onResume()");
+        if (this.printerId != null && this.printerLocation == 1 && this.isRetryAfterConnectSimpleAp) {
+            this.undoFlag = false;
+            if (loadSupportedMediaFile()) {
+                this.mHandler.sendEmptyMessage(1);
+            } else {
+                this.mHandler.sendEmptyMessage(17);
+            }
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPause() {
+        EPLog.m305d("SettingScr", "onPause");
+        super.onPause();
+        if (isFinishing()) {
+            deleteLongTapMessage();
+        }
+        WiFiDirectManager.disconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, this.printerIp);
+        WiFiDirectManager.disconnectSimpleAP(this, this.autoConnectSsid, this.printerIp);
+    }
+
+    public boolean onCreateOptionsMenu(Menu menu) {
+        getMenuInflater().inflate(C2135R.C2138menu.menu_done, menu);
+        return super.onCreateOptionsMenu(menu);
+    }
+
+    public boolean onOptionsItemSelected(MenuItem menuItem) {
+        if (menuItem.getItemId() != C2135R.C2137id.menuSettingsDone) {
+            return super.onOptionsItemSelected(menuItem);
+        }
+        saveChanged();
+        setResult(3, getIntent());
+        finish();
+        return true;
+    }
+
+    /* access modifiers changed from: protected */
+    public void deleteLongTapMessage() {
+        MotionEvent obtain = MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis() + 10, 1, 0.0f, 0.0f, 0);
+        this.copiesMinus.dispatchTouchEvent(obtain);
+        this.copiesPlus.dispatchTouchEvent(obtain);
+    }
+
+    public void onConfigurationChanged(Configuration configuration) {
+        super.onConfigurationChanged(configuration);
+        deleteLongTapMessage();
+    }
+}

+ 1469 - 0
app/src/main/java/com/epson/cameracopy/p006ui/CropImageActivity.java

@@ -0,0 +1,1469 @@
+package com.epson.cameracopy.p006ui;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.arch.lifecycle.Observer;
+import android.arch.lifecycle.ViewModelProviders;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.graphics.Bitmap;
+import android.graphics.Color;
+import android.graphics.Point;
+import android.graphics.PointF;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Debug;
+import android.os.Environment;
+import android.os.Handler;
+import android.os.Message;
+import android.provider.MediaStore;
+import android.support.p000v4.app.DialogFragment;
+import android.support.p000v4.app.FragmentActivity;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.util.DisplayMetrics;
+import android.util.Log;
+import android.view.GestureDetector;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
+import android.widget.RelativeLayout;
+import android.widget.SeekBar;
+import android.widget.TextView;
+import android.widget.Toast;
+import com.epson.cameracopy.alt.UiCommon;
+import com.epson.cameracopy.device.CameraPreviewControl;
+import com.epson.cameracopy.printlayout.DocumentSizeInfo;
+import com.epson.cameracopy.printlayout.RegistedDocumentSizeList;
+import com.epson.mobilephone.common.EpLog;
+import epson.colorcorrection.ImageCollect;
+import epson.common.DialogProgress;
+import epson.common.DialogProgressViewModel;
+import epson.common.ExternalFileUtils;
+import epson.common.Info_paper;
+import epson.print.ActivityIACommon;
+import epson.print.ActivityRequestPermissions;
+import epson.print.C2135R;
+import epson.print.CommonDefine;
+import java.io.File;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Deque;
+import java.util.List;
+import java.util.Locale;
+import org.opencv.core.Size;
+
+/* renamed from: com.epson.cameracopy.ui.CropImageActivity */
+public class CropImageActivity extends ActivityIACommon implements View.OnClickListener, SeekBar.OnSeekBarChangeListener, View.OnTouchListener, GestureDetector.OnDoubleTapListener {
+    private static final int ACTIVITY_MODE_COLOR_ADJUSTMENT = 2;
+    private static final int ACTIVITY_MODE_CROP_IMAGE = 0;
+    private static final int ACTIVITY_MODE_ENHANCE_TEXT = 1;
+    private static final String DIALOG_PROGRESS = "dialog_progress";
+    private static final String ICPD_FOLDER_PRINT_DATA = "ic";
+    public static final String IMAGE_FILE_NAME = "image_file_name";
+    private static final int MESSAGE_BOX_TYPE_CANCEL = 103;
+    private static final int MESSAGE_BOX_TYPE_OK = 102;
+    private static final int MESSAGE_BOX_TYPE_YES_NO = 101;
+    private static final int MSG_DEBUG_MODE = 390;
+    private static final int MSG_DEBUG_RESOLUTION_THRESHOLD = 391;
+    private static final int MSG_DEBUG_SMALL_PREVIEW_RATE = 392;
+    private static final int MSG_PREVIEW_CROP = 801;
+    public static final int MSG_PREVIEW_EDGE_DETECTION = 301;
+    private static final int MSG_PREVIEW_LOAD_DIALOG_DISMISS = 902;
+    private static final int MSG_PREVIEW_LOAD_DIALOG_SHOW = 901;
+    private static final int MSG_PREVIEW_LOAD_FINISH = 912;
+    private static final int MSG_PREVIEW_LOAD_PHOTO = 911;
+    private static final int MSG_PREVIEW_PRINT_PREVIEW_EXECUTE = 841;
+    private static final int MSG_PREVIEW_PRINT_PREVIEW_FINISH = 842;
+    private static final int MSG_PREVIEW_SAVE_EXECUTE = 831;
+    private static final int MSG_PREVIEW_SAVE_FINISH = 832;
+    public static final int MSG_PREVIEW_TOUCH_EVENT_ACTION_DOWN = 311;
+    private static final int MSG_SDIC_BCSC_FIX_CANCEL = 825;
+    private static final int MSG_SDIC_BCSC_FIX_PROC = 824;
+    private static final int MSG_SDIC_BCSC_FIX_QUIT = 826;
+    private static final int MSG_SDIC_BCSC_RESET = 823;
+    private static final int MSG_SDIC_PWC_EXECUTE = 811;
+    private static final int MSG_SDIC_PWC_FINISH = 812;
+    private static final int REQUEST_CODE_ORG_PAPER_SIZE_SELECT = 3;
+    private static final int REQUEST_RUNTIMEPERMMISSION = 4;
+    public static final String RESULT_COLLECTED_FILE_NAME = "corrected_file_name";
+    private static final int SEEK_BAR_STEP = 10;
+    private static WeakReference<Activity> mActivity;
+    /* access modifiers changed from: private */
+    public static CropImageActivity mCropImageActivity;
+    /* access modifiers changed from: private */
+    public static Handler mHandler = new Handler() {
+        public void handleMessage(Message message) {
+            if (CropImageActivity.mCropImageActivity != null) {
+                CropImageActivity.mCropImageActivity.executeMessage(message);
+            }
+        }
+    };
+    private int mActivityMode;
+    private float mBcscBDefault;
+    private float mBcscBValue;
+    private float mBcscCDefault;
+    private float mBcscCValue;
+    private float mBcscSDefault;
+    private float mBcscSValue;
+    private int mBcscSeekBarBDefault;
+    private int mBcscSeekBarCDefault;
+    private int mBcscSeekBarSDefault;
+    private int mBcscType;
+    private Bitmap mBitmapPreview = null;
+    private Button mButtonColorAdjustment;
+    private Button mButtonDocSize;
+    private Button mButtonExecute;
+    private Button mButtonReset;
+    private Button mButtonSave;
+    private File mCacheFolder = null;
+    /* access modifiers changed from: private */
+    public List<CorrectionParamSet> mCorrectionHistory = null;
+    /* access modifiers changed from: private */
+    public CorrectionParamSet mCorrectionParamSet = null;
+    private FrameLayout mCropImageFrameLayout = null;
+    private View mCropImageHeader = null;
+    boolean mCropImageMessageShow = true;
+    private int mCurrentPaperId = 0;
+    Size mCurrentPaperSize = null;
+    private CustomToast mCustomToast = null;
+    private DaemonView mDaemonView = null;
+    private int mDebugID = 0;
+    /* access modifiers changed from: private */
+    public int mDebugMode = 0;
+    /* access modifiers changed from: private */
+    public int mDebugResolutionThreshold = 2;
+    /* access modifiers changed from: private */
+    public int mDebugSmallPreviewRate = 2;
+    Size mDeviceSize = null;
+    DocumentSizeInfo mDocumentSizeInfo = null;
+    private GestureDetector mGestureDetector = null;
+    /* access modifiers changed from: private */
+    public ImageCollect mImageCollect = null;
+    private LinearLayout mImageCollectAdjustmentBrightness = null;
+    private SeekBar mImageCollectAdjustmentBrightnessSeekBar = null;
+    private TextView mImageCollectAdjustmentBrightnessTitle = null;
+    private LinearLayout mImageCollectAdjustmentContrast = null;
+    private SeekBar mImageCollectAdjustmentContrastSeekBar = null;
+    private TextView mImageCollectAdjustmentContrastTitle = null;
+    private LinearLayout mImageCollectAdjustmentSaturation = null;
+    private SeekBar mImageCollectAdjustmentSaturationSeekBar = null;
+    private TextView mImageCollectAdjustmentSaturationTitle = null;
+    private RadioGroup mImageCollectAdjustmentSwitch = null;
+    private int mImageCollectAdjustmentSwitchId;
+    private RadioButton mImageCollectAdjustmentSwitchLeft = null;
+    private RadioButton mImageCollectAdjustmentSwitchRight = null;
+    private RelativeLayout mImageCollectLayout = null;
+    private Button mImageCollectPalletButton = null;
+    private LinearLayout mImageCollectPalletLayout = null;
+    private TextView mImageCollectPaperSizeInfo = null;
+    private LinearLayout mImageCollectPreviewLayout = null;
+    private RadioGroup mImageCollectSwitch = null;
+    private int mImageCollectSwitchId;
+    private LinearLayout mImageCollectSwitchLayout = null;
+    private RadioButton mImageCollectSwitchLeft = null;
+    private RadioButton mImageCollectSwitchMiddle = null;
+    private RadioButton mImageCollectSwitchRight = null;
+    /* access modifiers changed from: private */
+    public ImageCollectView mImageCollectView = null;
+    /* access modifiers changed from: private */
+    public int mImageType = 2;
+    Info_paper mInfoPaper = null;
+    private int mMaskType;
+    private AlertDialog mMessageDialog = null;
+    private DisplayMetrics mMetrics = null;
+    private DialogProgressViewModel mModelDialog;
+    /* access modifiers changed from: private */
+    public double mPaperHeight = 0.0d;
+    /* access modifiers changed from: private */
+    public int mPaperId = -999;
+    Size mPaperSize = null;
+    /* access modifiers changed from: private */
+    public double mPaperWidth = 0.0d;
+    /* access modifiers changed from: private */
+    public PointF[] mPointPreviewCropPoint = null;
+    private int mPreviewType;
+    private DialogProgress mProgressDialog = null;
+    private boolean[] mSaveApprovalTable = null;
+    private LinearLayout mToolBartLayout = null;
+    private LinearLayout mToolbarColorAdjustment = null;
+    private LinearLayout mToolbarCropImage = null;
+    private LinearLayout mToolbarEnhanceText = null;
+    private File mUserFolder = null;
+    private final GestureDetector.SimpleOnGestureListener onGestureDetectorListener = new GestureDetector.SimpleOnGestureListener() {
+        public void onLongPress(MotionEvent motionEvent) {
+            if (CropImageActivity.this.mDebugMode == 4) {
+                CropImageActivity.mHandler.sendEmptyMessage(CropImageActivity.MSG_DEBUG_MODE);
+            }
+            super.onLongPress(motionEvent);
+        }
+    };
+
+    public boolean onDoubleTapEvent(MotionEvent motionEvent) {
+        return false;
+    }
+
+    public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
+        return false;
+    }
+
+    public void onStartTrackingTouch(SeekBar seekBar) {
+    }
+
+    public void onStopTrackingTouch(SeekBar seekBar) {
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        setContentView((int) C2135R.layout.activity_crop_image);
+        this.mModelDialog = (DialogProgressViewModel) ViewModelProviders.m2of((FragmentActivity) this).get(DialogProgressViewModel.class);
+        this.mModelDialog.getDialogJob().observe(this, new Observer() {
+            public final void onChanged(Object obj) {
+                CropImageActivity.lambda$onCreate$0(CropImageActivity.this, (Deque) obj);
+            }
+        });
+        setActionBar((int) C2135R.string.crop_image_title, true);
+        mActivity = new WeakReference<>(this);
+        mCropImageActivity = (CropImageActivity) mActivity.get();
+        this.mModelDialog.doShow(DIALOG_PROGRESS);
+        this.mPaperSize = new Size(0.0d, 0.0d);
+        GetPaperInfo();
+        this.mDaemonView = new DaemonView(this);
+        this.mCropImageFrameLayout = (FrameLayout) findViewById(C2135R.C2137id.crop_image_frame_layout);
+        this.mCropImageFrameLayout.addView(this.mDaemonView);
+        this.mImageCollectLayout = (RelativeLayout) findViewById(C2135R.C2137id.ImageCollectLayout);
+        this.mImageCollectPreviewLayout = (LinearLayout) findViewById(C2135R.C2137id.ImageCollectPreviewLayout);
+        this.mImageCollectView = (ImageCollectView) this.mImageCollectPreviewLayout.findViewById(C2135R.C2137id.ImageCollectView);
+        this.mImageCollectView.SetHandler(mHandler);
+        this.mImageCollectPaperSizeInfo = (TextView) this.mImageCollectPreviewLayout.findViewById(C2135R.C2137id.ImageCollectPaperSizeInfo);
+        this.mImageCollectPaperSizeInfo.setSingleLine(true);
+        this.mImageCollectPaperSizeInfo.setEllipsize(TextUtils.TruncateAt.END);
+        this.mImageCollectPaperSizeInfo.setText(getDocumentSizeText());
+        this.mImageCollectPalletButton = (Button) this.mImageCollectPreviewLayout.findViewById(C2135R.C2137id.ImageCollectPalletButton);
+        this.mImageCollectPalletButton.setOnClickListener(this);
+        this.mImageCollectPalletButton.setVisibility(4);
+        this.mImageCollectSwitchLayout = (LinearLayout) findViewById(C2135R.C2137id.ImageCollectSwitchLayout);
+        this.mImageCollectSwitch = (RadioGroup) findViewById(C2135R.C2137id.ImageCollectSwitch);
+        this.mImageCollectSwitchLeft = (RadioButton) findViewById(C2135R.C2137id.ImageCollectSwitchLeft);
+        this.mImageCollectSwitchLeft.setOnClickListener(this);
+        this.mImageCollectSwitchMiddle = (RadioButton) findViewById(C2135R.C2137id.ImageCollectSwitchMiddle);
+        this.mImageCollectSwitchMiddle.setOnClickListener(this);
+        this.mImageCollectSwitchRight = (RadioButton) findViewById(C2135R.C2137id.ImageCollectSwitchRight);
+        this.mImageCollectSwitchRight.setOnClickListener(this);
+        this.mImageCollectPalletLayout = (LinearLayout) findViewById(C2135R.C2137id.ImageCollectPalletLayout);
+        this.mImageCollectAdjustmentBrightness = (LinearLayout) findViewById(C2135R.C2137id.ImageCollectAdjustmentBrightness);
+        this.mImageCollectAdjustmentBrightnessTitle = (TextView) this.mImageCollectAdjustmentBrightness.findViewById(C2135R.C2137id.AdjustmentBarTitle);
+        this.mImageCollectAdjustmentBrightnessTitle.setText(C2135R.string.brightness);
+        this.mImageCollectAdjustmentBrightnessSeekBar = (SeekBar) this.mImageCollectAdjustmentBrightness.findViewById(C2135R.C2137id.AdjustmentBarSeekBar);
+        this.mImageCollectAdjustmentBrightnessSeekBar.setOnSeekBarChangeListener(this);
+        this.mImageCollectAdjustmentContrast = (LinearLayout) findViewById(C2135R.C2137id.ImageCollectAdjustmentContrast);
+        this.mImageCollectAdjustmentContrastTitle = (TextView) this.mImageCollectAdjustmentContrast.findViewById(C2135R.C2137id.AdjustmentBarTitle);
+        this.mImageCollectAdjustmentContrastTitle.setText(C2135R.string.contrast);
+        this.mImageCollectAdjustmentContrastSeekBar = (SeekBar) this.mImageCollectAdjustmentContrast.findViewById(C2135R.C2137id.AdjustmentBarSeekBar);
+        this.mImageCollectAdjustmentContrastSeekBar.setOnSeekBarChangeListener(this);
+        this.mImageCollectAdjustmentSaturation = (LinearLayout) findViewById(C2135R.C2137id.ImageCollectAdjustmentSaturation);
+        this.mImageCollectAdjustmentSaturationTitle = (TextView) this.mImageCollectAdjustmentSaturation.findViewById(C2135R.C2137id.AdjustmentBarTitle);
+        this.mImageCollectAdjustmentSaturationTitle.setText(C2135R.string.saturation);
+        this.mImageCollectAdjustmentSaturationSeekBar = (SeekBar) this.mImageCollectAdjustmentSaturation.findViewById(C2135R.C2137id.AdjustmentBarSeekBar);
+        this.mImageCollectAdjustmentSaturationSeekBar.setOnSeekBarChangeListener(this);
+        this.mImageCollectAdjustmentSwitch = (RadioGroup) findViewById(C2135R.C2137id.AdjustmentModeSwitch);
+        this.mImageCollectAdjustmentSwitchLeft = (RadioButton) findViewById(C2135R.C2137id.AdjustmentModeSwitchLeft);
+        this.mImageCollectAdjustmentSwitchLeft.setOnClickListener(this);
+        this.mImageCollectAdjustmentSwitchRight = (RadioButton) findViewById(C2135R.C2137id.AdjustmentModeSwitchRight);
+        this.mImageCollectAdjustmentSwitchRight.setOnClickListener(this);
+        this.mCropImageHeader = findViewById(C2135R.C2137id.navigation_bar);
+        this.mToolBartLayout = (LinearLayout) findViewById(C2135R.C2137id.tool_bar);
+        this.mToolbarCropImage = (LinearLayout) this.mToolBartLayout.findViewById(C2135R.C2137id.ImageCollectToolbarCropImage);
+        this.mToolbarEnhanceText = (LinearLayout) this.mToolBartLayout.findViewById(C2135R.C2137id.ImageCollectToolbarEnhanceText);
+        this.mToolbarColorAdjustment = (LinearLayout) this.mToolBartLayout.findViewById(C2135R.C2137id.ImageCollectToolbarColorAdjustment);
+        this.mCropImageHeader.setOnTouchListener(this);
+        this.mCropImageHeader.setOnClickListener(this);
+        this.mToolbarCropImage.setOnTouchListener(this);
+        this.mToolbarCropImage.setOnClickListener(this);
+        this.mToolbarEnhanceText.setOnTouchListener(this);
+        this.mToolbarEnhanceText.setOnClickListener(this);
+        this.mBcscSeekBarBDefault = 5;
+        this.mBcscSeekBarCDefault = 0;
+        this.mBcscSeekBarSDefault = 5;
+        this.mBcscBDefault = 0.0f;
+        this.mBcscCDefault = 0.0f;
+        this.mBcscSDefault = 0.0f;
+        InitBCSCParams();
+        this.mSaveApprovalTable = new boolean[5];
+        activityModeChange(0);
+        String stringExtra = getIntent().getStringExtra(IMAGE_FILE_NAME);
+        this.mMetrics = new DisplayMetrics();
+        getWindowManager().getDefaultDisplay().getMetrics(this.mMetrics);
+        this.mDeviceSize = new Size((double) this.mMetrics.widthPixels, (double) this.mMetrics.heightPixels);
+        this.mCorrectionParamSet = new CorrectionParamSet();
+        this.mCorrectionHistory = new ArrayList();
+        this.mUserFolder = GetCacheFolder(false);
+        this.mCacheFolder = GetCacheFolder(true);
+        CameraPreviewControl instance = CameraPreviewControl.getInstance(this);
+        this.mCurrentPaperId = 0;
+        String country = Locale.getDefault().getCountry();
+        String language = Locale.getDefault().getLanguage();
+        if ((country.equals(Locale.US.getCountry()) || country.equals(Locale.CANADA.getCountry())) && !language.equals(Locale.FRENCH.getLanguage())) {
+            this.mCurrentPaperId = 1;
+        }
+        this.mCurrentPaperSize = new Size(3048.0d, 4321.0d);
+        Info_paper infoPaper = Info_paper.getInfoPaper(this, this.mCurrentPaperId);
+        if (infoPaper != null) {
+            this.mCurrentPaperSize.width = (double) infoPaper.getPaper_width();
+            this.mCurrentPaperSize.height = (double) infoPaper.getPaper_height();
+        }
+        this.mImageCollect = new ImageCollect(stringExtra, this.mMetrics.density, this.mCurrentPaperSize);
+        this.mImageCollect.SetPath(this.mCacheFolder, this.mUserFolder, instance.getSaveDirecotry());
+        this.mPreviewType = -1;
+        mHandler.sendEmptyMessage(MSG_PREVIEW_LOAD_PHOTO);
+        this.mGestureDetector = new GestureDetector(this, this.onGestureDetectorListener);
+    }
+
+    public static /* synthetic */ void lambda$onCreate$0(CropImageActivity cropImageActivity, Deque deque) {
+        String[] checkQueue = cropImageActivity.mModelDialog.checkQueue();
+        if (checkQueue != null) {
+            String str = checkQueue[0];
+            String str2 = checkQueue[1];
+            if (str2.equals("do_show")) {
+                cropImageActivity.showDialog(str);
+            }
+            if (str2.equals("do_dismiss")) {
+                cropImageActivity.dismissDialog(str);
+                EpLog.m69d("dismissDialog");
+                if (cropImageActivity.mCropImageMessageShow) {
+                    EpLog.m69d("TOAST");
+                    cropImageActivity.mCropImageMessageShow = false;
+                    cropImageActivity.ToastMessage(cropImageActivity.getString(C2135R.string.crop_image_message));
+                }
+            }
+        }
+    }
+
+    public void onRestart() {
+        super.onRestart();
+    }
+
+    public void onStart() {
+        super.onStart();
+    }
+
+    public void onResume() {
+        super.onResume();
+    }
+
+    public void onPause() {
+        super.onPause();
+        EpLog.m68d();
+        CancelToast();
+    }
+
+    public void onStop() {
+        super.onStop();
+        EpLog.m68d();
+        CancelToast();
+    }
+
+    private void CancelToast() {
+        if (this.mCustomToast != null) {
+            EpLog.m69d(" Toast Cancel");
+            this.mCustomToast.cancel();
+            this.mCustomToast = null;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onDestroy() {
+        releaseResource();
+        super.onDestroy();
+    }
+
+    public void onConfigurationChanged(Configuration configuration) {
+        super.onConfigurationChanged(configuration);
+    }
+
+    public void onWindowFocusChanged(boolean z) {
+        super.onWindowFocusChanged(z);
+    }
+
+    public void onBackPressed() {
+        int i = this.mActivityMode;
+        if (i == 0) {
+            this.mActivityMode = -1;
+            this.mImageCollectView.MessageOff();
+            CancelToast();
+            releaseResource();
+            finish();
+        } else if (i == 1) {
+            activityModeChange(0);
+            PointF[] GetCornerPoints = this.mImageCollect.GetCornerPoints();
+            GetPreviewImage(0);
+            this.mImageCollectView.SetPreviewBitmapAndCropData(this.mBitmapPreview, GetCornerPoints);
+        } else if (i == 2) {
+            activityModeChange(1);
+            GetPreviewImage(this.mImageType);
+            this.mImageCollectView.SetPreviewBitmapAndCropData(this.mBitmapPreview);
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onSaveInstanceState(Bundle bundle) {
+        super.onSaveInstanceState(bundle);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onRestoreInstanceState(Bundle bundle) {
+        super.onRestoreInstanceState(bundle);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onActivityResult(int i, int i2, Intent intent) {
+        if (i == 3) {
+            GetPaperInfo();
+            this.mImageCollectPaperSizeInfo.setText(getDocumentSizeText());
+        }
+        if (i == 4 && i2 == -1) {
+            savePreviewExecute();
+        }
+    }
+
+    public void onClick(View view) {
+        switch (view.getId()) {
+            case C2135R.C2137id.AdjustmentModeSwitchLeft /*2131230725*/:
+                if (this.mImageCollectAdjustmentSwitchId != C2135R.C2137id.AdjustmentModeSwitchLeft) {
+                    this.mImageCollectAdjustmentSwitchId = C2135R.C2137id.AdjustmentModeSwitchLeft;
+                    AdjustmentModeSwitchALL();
+                    return;
+                }
+                return;
+            case C2135R.C2137id.AdjustmentModeSwitchRight /*2131230726*/:
+                if (this.mImageCollectAdjustmentSwitchId != C2135R.C2137id.AdjustmentModeSwitchRight) {
+                    this.mImageCollectAdjustmentSwitchId = C2135R.C2137id.AdjustmentModeSwitchRight;
+                    AdjustmentModeSwitchPART();
+                    return;
+                }
+                return;
+            case C2135R.C2137id.ImageCollectPalletButton /*2131230737*/:
+                palletShow();
+                return;
+            case C2135R.C2137id.ImageCollectSwitchLeft /*2131230744*/:
+                if (this.mImageCollectSwitchId != C2135R.C2137id.ImageCollectSwitchLeft) {
+                    this.mImageCollectSwitchId = C2135R.C2137id.ImageCollectSwitchLeft;
+                    ImageCollectSwitchPWC(1);
+                    return;
+                }
+                return;
+            case C2135R.C2137id.ImageCollectSwitchMiddle /*2131230745*/:
+                if (this.mImageCollectSwitchId != C2135R.C2137id.ImageCollectSwitchMiddle) {
+                    this.mImageCollectSwitchId = C2135R.C2137id.ImageCollectSwitchMiddle;
+                    ImageCollectSwitchPWC(2);
+                    return;
+                }
+                return;
+            case C2135R.C2137id.ImageCollectSwitchRight /*2131230746*/:
+                if (this.mImageCollectSwitchId != C2135R.C2137id.ImageCollectSwitchRight) {
+                    this.mImageCollectSwitchId = C2135R.C2137id.ImageCollectSwitchRight;
+                    ImageCollectSwitchCROP();
+                    return;
+                }
+                return;
+            case C2135R.C2137id.color_adjustment_button /*2131230932*/:
+                activityModeChange(2);
+                InitBCSC();
+                return;
+            case C2135R.C2137id.document_size_button /*2131230996*/:
+                this.mImageCollectView.MessageOff();
+                setDocumentSize();
+                return;
+            case C2135R.C2137id.execute_button /*2131231032*/:
+                int i = this.mActivityMode;
+                if (i == 0) {
+                    this.mImageCollectView.MessageOff();
+                    mHandler.sendEmptyMessage(MSG_PREVIEW_CROP);
+                    return;
+                } else if (i == 1) {
+                    MessageBox(101, -1, C2135R.string.finish_adjustment_message, MSG_PREVIEW_PRINT_PREVIEW_EXECUTE);
+                    return;
+                } else if (i == 2) {
+                    boolean z = false;
+                    if (!(this.mBcscBValue == this.mBcscBDefault && this.mBcscCValue == this.mBcscCDefault && this.mBcscSValue == this.mBcscSDefault)) {
+                        z = true;
+                    }
+                    if (this.mCorrectionParamSet.Size() > 0) {
+                        z = true;
+                    }
+                    if (z) {
+                        MessageBox(101, -1, (int) C2135R.string.finish_color_adjustment_message, (int) MSG_SDIC_BCSC_FIX_PROC, (int) MSG_SDIC_BCSC_FIX_CANCEL);
+                        return;
+                    }
+                    activityModeChange(1);
+                    GetPreviewImage(this.mImageType);
+                    this.mImageCollectView.SetPreviewBitmapAndCropData(this.mBitmapPreview);
+                    return;
+                } else {
+                    return;
+                }
+            case C2135R.C2137id.reset_button /*2131231403*/:
+                MessageBox(101, -1, C2135R.string.reset_color_adjustment_message, MSG_SDIC_BCSC_RESET);
+                return;
+            case C2135R.C2137id.save_button /*2131231436*/:
+                mHandler.sendEmptyMessage(MSG_PREVIEW_SAVE_EXECUTE);
+                return;
+            default:
+                return;
+        }
+    }
+
+    public boolean onTouch(View view, MotionEvent motionEvent) {
+        this.mDebugID = view.getId();
+        this.mGestureDetector.onTouchEvent(motionEvent);
+        return false;
+    }
+
+    public boolean onDoubleTap(MotionEvent motionEvent) {
+        if (this.mDebugID == this.mCropImageHeader.getId()) {
+            int i = this.mDebugMode;
+            if (i == 1) {
+                this.mDebugMode = i + 1;
+            }
+            int i2 = this.mDebugMode;
+            if (i2 == 3) {
+                this.mDebugMode = i2 + 1;
+                this.mToolbarCropImage.setBackgroundColor(Color.rgb(8, 35, 130));
+                this.mToolbarEnhanceText.setBackgroundColor(Color.rgb(8, 35, 130));
+                this.mToolbarColorAdjustment.setBackgroundColor(Color.rgb(8, 35, 130));
+            }
+        } else if (this.mDebugID == this.mToolbarCropImage.getId() || this.mDebugID == this.mToolbarEnhanceText.getId()) {
+            int i3 = this.mDebugMode;
+            if (i3 == 0) {
+                this.mDebugMode = i3 + 1;
+            }
+            int i4 = this.mDebugMode;
+            if (i4 == 2) {
+                this.mDebugMode = i4 + 1;
+            }
+        }
+        this.mDebugID = 0;
+        return false;
+    }
+
+    public void onProgressChanged(SeekBar seekBar, int i, boolean z) {
+        if (z) {
+            SeekBarTracking();
+        }
+    }
+
+    /* access modifiers changed from: private */
+    public void executeMessage(Message message) {
+        String str;
+        switch (message.what) {
+            case 301:
+                ImageCollectView imageCollectView = this.mImageCollectView;
+                imageCollectView.SetMaskEdge(this.mImageCollect.DetectEdge(imageCollectView.GetMaskImage()));
+                float progress = (float) this.mImageCollectAdjustmentContrastSeekBar.getProgress();
+                float progress2 = (float) this.mImageCollectAdjustmentSaturationSeekBar.getProgress();
+                UiCommon.setButtonEnabled(this.mButtonReset, true);
+                if (((float) this.mImageCollectAdjustmentBrightnessSeekBar.getProgress()) != ((float) this.mBcscSeekBarBDefault) || progress != ((float) this.mBcscSeekBarCDefault) || progress2 != ((float) this.mBcscSeekBarSDefault)) {
+                    PreviewImageBCSC();
+                    return;
+                }
+                return;
+            case MSG_PREVIEW_TOUCH_EVENT_ACTION_DOWN /*311*/:
+                CancelToast();
+                return;
+            case MSG_DEBUG_MODE /*390*/:
+                AlertDialog.Builder builder = new AlertDialog.Builder(this);
+                builder.setTitle("Menu");
+                builder.setCancelable(false);
+                builder.setItems(new String[]{"Resolution Threshold", "Small Preview Rate"}, new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialogInterface, int i) {
+                        switch (i) {
+                            case 0:
+                                CropImageActivity.mHandler.sendEmptyMessage(CropImageActivity.MSG_DEBUG_RESOLUTION_THRESHOLD);
+                                return;
+                            case 1:
+                                CropImageActivity.mHandler.sendEmptyMessage(CropImageActivity.MSG_DEBUG_SMALL_PREVIEW_RATE);
+                                return;
+                            default:
+                                return;
+                        }
+                    }
+                });
+                builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialogInterface, int i) {
+                    }
+                });
+                builder.show();
+                return;
+            case MSG_DEBUG_RESOLUTION_THRESHOLD /*391*/:
+                AlertDialog.Builder builder2 = new AlertDialog.Builder(this);
+                builder2.setTitle("Resolution Threshold");
+                builder2.setCancelable(false);
+                builder2.setSingleChoiceItems(new String[]{"360dpi", "300dpi", "240dpi", "180dpi", "120dpi"}, this.mDebugResolutionThreshold, new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialogInterface, int i) {
+                        switch (i) {
+                            case 0:
+                                CropImageActivity.this.mImageCollect.SetResolutionThreshold(360.0d);
+                                break;
+                            case 1:
+                                CropImageActivity.this.mImageCollect.SetResolutionThreshold(300.0d);
+                                break;
+                            case 2:
+                                CropImageActivity.this.mImageCollect.SetResolutionThreshold(240.0d);
+                                break;
+                            case 3:
+                                CropImageActivity.this.mImageCollect.SetResolutionThreshold(180.0d);
+                                break;
+                            case 4:
+                                CropImageActivity.this.mImageCollect.SetResolutionThreshold(120.0d);
+                                break;
+                        }
+                        int unused = CropImageActivity.this.mDebugResolutionThreshold = i;
+                    }
+                });
+                builder2.setPositiveButton(CommonDefine.f335OK, new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialogInterface, int i) {
+                    }
+                });
+                builder2.show();
+                return;
+            case MSG_DEBUG_SMALL_PREVIEW_RATE /*392*/:
+                AlertDialog.Builder builder3 = new AlertDialog.Builder(this);
+                builder3.setTitle("Small Preview Rate");
+                builder3.setCancelable(false);
+                builder3.setSingleChoiceItems(new String[]{"1/1.0", "1/1.5", "1/2.0", "1/2.5", "1/3.0", "1/3.5", "1/4.0"}, this.mDebugSmallPreviewRate, new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialogInterface, int i) {
+                        switch (i) {
+                            case 0:
+                                CropImageActivity.this.mImageCollect.SetSmallPreviewRate(1.0f);
+                                break;
+                            case 1:
+                                CropImageActivity.this.mImageCollect.SetSmallPreviewRate(1.5f);
+                                break;
+                            case 2:
+                                CropImageActivity.this.mImageCollect.SetSmallPreviewRate(2.0f);
+                                break;
+                            case 3:
+                                CropImageActivity.this.mImageCollect.SetSmallPreviewRate(2.5f);
+                                break;
+                            case 4:
+                                CropImageActivity.this.mImageCollect.SetSmallPreviewRate(3.0f);
+                                break;
+                            case 5:
+                                CropImageActivity.this.mImageCollect.SetSmallPreviewRate(3.5f);
+                                break;
+                            case 6:
+                                CropImageActivity.this.mImageCollect.SetSmallPreviewRate(4.0f);
+                                break;
+                        }
+                        int unused = CropImageActivity.this.mDebugSmallPreviewRate = i;
+                    }
+                });
+                builder3.setPositiveButton(CommonDefine.f335OK, new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialogInterface, int i) {
+                    }
+                });
+                builder3.show();
+                return;
+            case MSG_PREVIEW_CROP /*801*/:
+                mHandler.sendEmptyMessage(MSG_PREVIEW_LOAD_DIALOG_SHOW);
+                new Thread(new Runnable() {
+                    public void run() {
+                        int paperId = CropImageActivity.this.mDocumentSizeInfo.getPaperId();
+                        double width = CropImageActivity.this.mDocumentSizeInfo.getWidth();
+                        double height = CropImageActivity.this.mDocumentSizeInfo.getHeight();
+                        PointF[] GetCropPoint = CropImageActivity.this.mImageCollectView.GetCropPoint();
+                        boolean z = false;
+                        boolean z2 = true;
+                        if (!(CropImageActivity.this.mPointPreviewCropPoint == null || GetCropPoint == null || (CropImageActivity.this.mPointPreviewCropPoint[0].x == GetCropPoint[0].x && CropImageActivity.this.mPointPreviewCropPoint[0].y == GetCropPoint[0].y && CropImageActivity.this.mPointPreviewCropPoint[1].x == GetCropPoint[1].x && CropImageActivity.this.mPointPreviewCropPoint[1].y == GetCropPoint[1].y && CropImageActivity.this.mPointPreviewCropPoint[2].x == GetCropPoint[2].x && CropImageActivity.this.mPointPreviewCropPoint[2].y == GetCropPoint[2].y && CropImageActivity.this.mPointPreviewCropPoint[3].x == GetCropPoint[3].x && CropImageActivity.this.mPointPreviewCropPoint[3].y == GetCropPoint[3].y))) {
+                            z = true;
+                        }
+                        if (z || (CropImageActivity.this.mPaperId == -1 || paperId == -1 ? CropImageActivity.this.mPaperId == paperId : CropImageActivity.this.mPaperWidth == width && CropImageActivity.this.mPaperHeight == height)) {
+                            z2 = z;
+                        }
+                        int unused = CropImageActivity.this.mPaperId = paperId;
+                        double unused2 = CropImageActivity.this.mPaperWidth = width;
+                        double unused3 = CropImageActivity.this.mPaperHeight = height;
+                        if (z2) {
+                            PointF[] unused4 = CropImageActivity.this.mPointPreviewCropPoint = GetCropPoint;
+                            CropImageActivity.this.mImageCollect.MakePreviewImageCROP(CropImageActivity.this.mPointPreviewCropPoint, CropImageActivity.this.mPaperSize, CropImageActivity.this.mDeviceSize);
+                            CropImageActivity.mHandler.sendEmptyMessage(CropImageActivity.MSG_SDIC_PWC_EXECUTE);
+                            return;
+                        }
+                        CropImageActivity.mHandler.sendEmptyMessage(CropImageActivity.MSG_SDIC_PWC_FINISH);
+                    }
+                }).start();
+                return;
+            case MSG_SDIC_PWC_EXECUTE /*811*/:
+                new Thread(new Runnable() {
+                    public void run() {
+                        CropImageActivity.this.mImageCollect.MakePreviewImagePWC(-1);
+                        CropImageActivity.mHandler.sendEmptyMessage(CropImageActivity.MSG_SDIC_PWC_FINISH);
+                    }
+                }).start();
+                return;
+            case MSG_SDIC_PWC_FINISH /*812*/:
+                this.mImageCollectSwitchId = C2135R.C2137id.ImageCollectSwitchLeft;
+                this.mImageCollectSwitch.check(this.mImageCollectSwitchId);
+                this.mImageType = 2;
+                activityModeChange(1);
+                ImageCollectSwitchPWC(1);
+                mHandler.sendEmptyMessage(MSG_PREVIEW_LOAD_DIALOG_DISMISS);
+                return;
+            case MSG_SDIC_BCSC_RESET /*823*/:
+                InitBCSC();
+                UiCommon.setButtonEnabled(this.mButtonReset, false);
+                return;
+            case MSG_SDIC_BCSC_FIX_PROC /*824*/:
+                AdjustmentModeSwitchEXECUTE();
+                this.mSaveApprovalTable[4] = true;
+                mHandler.sendEmptyMessage(MSG_PREVIEW_LOAD_DIALOG_SHOW);
+                this.mCorrectionParamSet.SetImageType(this.mImageType);
+                this.mCorrectionHistory.add(this.mCorrectionParamSet.Clone());
+                new Thread(new Runnable() {
+                    public void run() {
+                        CropImageActivity.this.mImageCollect.MakePreviewBCSC(CropImageActivity.this.mCorrectionParamSet);
+                        CropImageActivity.mHandler.sendEmptyMessage(CropImageActivity.MSG_SDIC_BCSC_FIX_QUIT);
+                    }
+                }).start();
+                return;
+            case MSG_SDIC_BCSC_FIX_QUIT /*826*/:
+                activityModeChange(1);
+                GetPreviewImage(4);
+                this.mImageCollectView.SetPreviewBitmapAndCropData(this.mBitmapPreview);
+                mHandler.sendEmptyMessage(MSG_PREVIEW_LOAD_DIALOG_DISMISS);
+                return;
+            case MSG_PREVIEW_SAVE_EXECUTE /*831*/:
+                if (ActivityRequestPermissions.isRuntimePermissionSupported()) {
+                    String[] strArr = {"android.permission.WRITE_EXTERNAL_STORAGE"};
+                    ActivityRequestPermissions.Permission permission = new ActivityRequestPermissions.Permission(strArr[0], new String[]{getString(C2135R.string.permission_dialog_title), getString(C2135R.string.permission_dialog_title)}, new String[]{ActivityRequestPermissions.DialogParameter.setMessage2((Context) this, getString(C2135R.string.permission_dialog_message_storage)), ActivityRequestPermissions.DialogParameter.setMessage3A((Context) this, getString(C2135R.string.permission_dialog_message_storage), getString(C2135R.string.permission_function_storage))});
+                    if (!ActivityRequestPermissions.checkPermission(this, strArr)) {
+                        ActivityRequestPermissions.requestPermission((Activity) this, permission, 4);
+                        return;
+                    }
+                }
+                savePreviewExecute();
+                return;
+            case MSG_PREVIEW_SAVE_FINISH /*832*/:
+                mHandler.sendEmptyMessage(MSG_PREVIEW_LOAD_DIALOG_DISMISS);
+                String GetSavePath = this.mImageCollect.GetSavePath(false);
+                if (GetSavePath != null) {
+                    str = String.format(getString(C2135R.string.image_save_message), new Object[]{GetSavePath});
+                } else {
+                    str = getString(C2135R.string.file_save_error_message);
+                }
+                MessageBox(102, -1, str, -1, -1);
+                return;
+            case MSG_PREVIEW_PRINT_PREVIEW_EXECUTE /*841*/:
+                mHandler.sendEmptyMessage(MSG_PREVIEW_LOAD_DIALOG_SHOW);
+                MakePrintData(true, MSG_PREVIEW_PRINT_PREVIEW_FINISH);
+                return;
+            case MSG_PREVIEW_PRINT_PREVIEW_FINISH /*842*/:
+                startPrintPreviewActivity(this.mImageCollect.GetSavePath(true));
+                this.mActivityMode = -1;
+                mHandler.sendEmptyMessage(MSG_PREVIEW_LOAD_DIALOG_DISMISS);
+                return;
+            case MSG_PREVIEW_LOAD_DIALOG_SHOW /*901*/:
+                LoadProgressShow();
+                return;
+            case MSG_PREVIEW_LOAD_DIALOG_DISMISS /*902*/:
+                LoadProgressHide();
+                return;
+            case MSG_PREVIEW_LOAD_PHOTO /*911*/:
+                mHandler.sendEmptyMessage(MSG_PREVIEW_LOAD_DIALOG_SHOW);
+                new Thread(new Runnable() {
+                    public void run() {
+                        CropImageActivity.this.mImageCollect.MakePreviewImageRAW(CropImageActivity.this.mDeviceSize.width, CropImageActivity.this.mDeviceSize.height);
+                        CropImageActivity.this.GetPreviewImage(0);
+                        CropImageActivity.mHandler.sendEmptyMessage(CropImageActivity.MSG_PREVIEW_LOAD_FINISH);
+                    }
+                }).start();
+                return;
+            case MSG_PREVIEW_LOAD_FINISH /*912*/:
+                EpLog.m69d("MSG_PREVIEW_LOAD_FINISH");
+                if (this.mBitmapPreview != null) {
+                    this.mImageCollectView.SetPreviewBitmapAndCropData(this.mBitmapPreview, this.mImageCollect.GetCornerPoints());
+                }
+                mHandler.sendEmptyMessage(MSG_PREVIEW_LOAD_DIALOG_DISMISS);
+                return;
+            default:
+                return;
+        }
+    }
+
+    private void savePreviewExecute() {
+        SaveButtonDisable();
+        mHandler.sendEmptyMessage(MSG_PREVIEW_LOAD_DIALOG_SHOW);
+        MakePrintData(false, MSG_PREVIEW_SAVE_FINISH);
+    }
+
+    private void ImageCollectSwitchPWC(int i) {
+        GetPreviewImage(i == 1 ? 2 : 3);
+        this.mImageCollectView.SetPreviewBitmapAndCropData(this.mBitmapPreview);
+        this.mCorrectionHistory.clear();
+    }
+
+    private void ImageCollectSwitchCROP() {
+        this.mImageType = 1;
+        GetPreviewImage(1);
+        this.mImageCollectView.SetPreviewBitmapAndCropData(this.mBitmapPreview);
+        this.mCorrectionHistory.clear();
+    }
+
+    private void AdjustmentModeSwitchALL() {
+        AdjustmentModeProc(false, true, 0, 2);
+    }
+
+    private void AdjustmentModeSwitchPART() {
+        AdjustmentModeProc(true, true, C2135R.string.start_adjustment_partly_message, 3);
+    }
+
+    private void AdjustmentModeSwitchEXECUTE() {
+        if (this.mImageCollectAdjustmentSwitch.getCheckedRadioButtonId() == C2135R.C2137id.AdjustmentModeSwitchRight) {
+            AdjustmentModeProc(false, true, 0, 3);
+        } else {
+            AdjustmentModeProc(true, true, 0, 2);
+        }
+    }
+
+    private void AdjustmentModeProc(boolean z, boolean z2, int i, int i2) {
+        StackBCSCParams(z, z2);
+        this.mBcscType = this.mImageType;
+        this.mImageCollect.SiwtchPreviewImageBCSC(this.mBcscType);
+        if (i > 0) {
+            ToastMessage(getString(i));
+        }
+        this.mImageCollectView.SetViewMode(i2);
+        this.mImageCollectView.invalidate();
+    }
+
+    private void InitBCSC() {
+        InitBCSCParams();
+        this.mCorrectionParamSet.Reset();
+        this.mImageCollect.ResetPreviewImageBCSC();
+        this.mBcscType = this.mImageType;
+        this.mImageCollect.MakePreviewImageBCSC_Init(this.mBcscType, true);
+        if (this.mImageCollectAdjustmentSwitch.getCheckedRadioButtonId() == C2135R.C2137id.AdjustmentModeSwitchRight) {
+            this.mImageCollectView.SetViewMode(3);
+        } else {
+            this.mImageCollectView.SetViewMode(2);
+        }
+        GetPreviewImage(this.mImageType);
+        this.mImageCollectView.SetPreviewBitmapAndCropData(this.mBitmapPreview);
+    }
+
+    private void InitBCSCParams() {
+        this.mImageCollectAdjustmentBrightnessSeekBar.setMax(10);
+        this.mImageCollectAdjustmentBrightnessSeekBar.setProgress(this.mBcscSeekBarBDefault);
+        this.mImageCollectAdjustmentContrastSeekBar.setMax(10);
+        this.mImageCollectAdjustmentContrastSeekBar.setProgress(this.mBcscSeekBarCDefault);
+        this.mImageCollectAdjustmentSaturationSeekBar.setMax(10);
+        this.mImageCollectAdjustmentSaturationSeekBar.setProgress(this.mBcscSeekBarSDefault);
+        this.mBcscBValue = this.mBcscBDefault;
+        this.mBcscCValue = this.mBcscCDefault;
+        this.mBcscSValue = this.mBcscSDefault;
+    }
+
+    private void StackBCSCParams(boolean z, boolean z2) {
+        if (this.mBcscBValue != this.mBcscBDefault || this.mBcscCValue != this.mBcscCDefault || this.mBcscSValue != this.mBcscSDefault) {
+            CorrectionParam correctionParam = new CorrectionParam();
+            boolean unused = correctionParam.mMaskType = z;
+            float unused2 = correctionParam.mBcscBValue = this.mBcscBValue;
+            float unused3 = correctionParam.mBcscCValue = this.mBcscCValue;
+            float unused4 = correctionParam.mBcscSValue = this.mBcscSValue;
+            if (!z) {
+                List unused5 = correctionParam.mPointArray = this.mImageCollectView.GetBcscPointArray();
+                float unused6 = correctionParam.mScale = this.mImageCollectView.GetBcscScale();
+                float unused7 = correctionParam.mStrokeWidth = this.mImageCollectView.GetBcscStrokeWidth();
+                Point unused8 = correctionParam.mPreviewImageSize = this.mImageCollect.GetMakedPreviewImageSize();
+            }
+            this.mCorrectionParamSet.AddParam(correctionParam);
+            if (z2) {
+                InitBCSCParams();
+            }
+        }
+    }
+
+    private void SeekBarTracking() {
+        float progress = (((float) this.mImageCollectAdjustmentBrightnessSeekBar.getProgress()) * 0.2f) - 1.0f;
+        float progress2 = ((float) this.mImageCollectAdjustmentContrastSeekBar.getProgress()) * 0.1f;
+        float progress3 = (((float) this.mImageCollectAdjustmentSaturationSeekBar.getProgress()) * 0.2f) - 1.0f;
+        if (progress != this.mBcscBValue || progress2 != this.mBcscCValue || progress3 != this.mBcscSValue) {
+            this.mBcscBValue = progress;
+            this.mBcscCValue = progress2;
+            this.mBcscSValue = progress3;
+            PreviewImageBCSC();
+            UiCommon.setButtonEnabled(this.mButtonReset, true);
+        }
+    }
+
+    private void PreviewImageBCSC() {
+        if (this.mImageCollectAdjustmentSwitch.getCheckedRadioButtonId() == C2135R.C2137id.AdjustmentModeSwitchLeft) {
+            this.mMaskType = 7;
+        } else {
+            this.mMaskType = 8;
+        }
+        this.mImageCollect.MakePreviewImageBCSC_Exec(this.mMaskType, true, this.mBcscBValue, this.mBcscCValue, this.mBcscSValue, this.mImageCollectView.GetBcscScale());
+        GetPreviewImage(6);
+        this.mImageCollectView.SetPreviewBitmapAndCropData(this.mBitmapPreview);
+    }
+
+    /* access modifiers changed from: private */
+    public void GetPreviewImage(int i) {
+        Bitmap GetPreviewImage;
+        if (i == 1 || i == 2 || i == 3 || i == 4) {
+            this.mImageType = i;
+            SaveButtonState();
+        }
+        if ((i == 6 || i == 4 || i != this.mPreviewType) && (GetPreviewImage = this.mImageCollect.GetPreviewImage(i)) != null) {
+            Bitmap bitmap = this.mBitmapPreview;
+            if (bitmap != null) {
+                bitmap.recycle();
+            }
+            this.mBitmapPreview = GetPreviewImage;
+            this.mPreviewType = i;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void setDocumentSize() {
+        startActivityForResult(new Intent(this, DocumentSizeSettingActivity.class), 3);
+    }
+
+    private File GetCacheFolder(boolean z) {
+        if (!z) {
+            return Environment.getExternalStorageDirectory();
+        }
+        File file = new File(getExternalCacheDir(), ICPD_FOLDER_PRINT_DATA);
+        ExternalFileUtils.getInstance(this).createTempFolder(file.getPath());
+        return file;
+    }
+
+    private void MakePrintData(final boolean z, final int i) {
+        new Thread(new Runnable() {
+            public void run() {
+                CropImageActivity.this.mImageCollect.MakeCropPrintSizeImage(CropImageActivity.this.mPointPreviewCropPoint, CropImageActivity.this.mPaperSize, CropImageActivity.this.mImageType, CropImageActivity.this.mCorrectionHistory);
+                if (CropImageActivity.this.mImageCollect.SaveExecute(z, CropImageActivity.this.mImageType, CropImageActivity.this.mPaperSize) && !z) {
+                    Uri fromFile = Uri.fromFile(new File(CropImageActivity.this.mImageCollect.GetSavePath(true)));
+                    ContentValues contentValues = new ContentValues();
+                    contentValues.put("title", fromFile.getLastPathSegment());
+                    contentValues.put("_display_name", fromFile.getLastPathSegment());
+                    contentValues.put("mime_type", "image/jpeg");
+                    contentValues.put("_data", fromFile.getPath());
+                    contentValues.put("datetaken", Long.valueOf(System.currentTimeMillis()));
+                    CropImageActivity.this.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);
+                }
+                CropImageActivity.mHandler.sendEmptyMessage(i);
+            }
+        }).start();
+    }
+
+    private void GetPaperInfo() {
+        Size size = this.mPaperSize;
+        size.width = 0.0d;
+        size.height = 0.0d;
+        this.mDocumentSizeInfo = RegistedDocumentSizeList.getInstance(this).getCurrentDocumentSize();
+        int paperId = this.mDocumentSizeInfo.getPaperId();
+        int scaleId = this.mDocumentSizeInfo.getScaleId();
+        if (paperId > -1) {
+            this.mInfoPaper = Info_paper.getInfoPaper(this, this.mDocumentSizeInfo.getPaperId());
+            Info_paper info_paper = this.mInfoPaper;
+            if (info_paper != null) {
+                this.mPaperSize.width = (double) info_paper.getPaper_width();
+                this.mPaperSize.height = (double) this.mInfoPaper.getPaper_height();
+            }
+        } else if (paperId < -1) {
+            double width = this.mDocumentSizeInfo.getWidth();
+            double height = this.mDocumentSizeInfo.getHeight();
+            if (scaleId == 1) {
+                Size size2 = this.mPaperSize;
+                size2.width = (width / 25.4d) * 360.0d;
+                size2.height = (height / 25.4d) * 360.0d;
+                return;
+            }
+            Size size3 = this.mPaperSize;
+            size3.width = width * 360.0d;
+            size3.height = height * 360.0d;
+        }
+    }
+
+    private String getDocumentSizeText() {
+        new String();
+        if (this.mDocumentSizeInfo.getPaperId() != -2) {
+            return this.mDocumentSizeInfo.getDocSizeName(this);
+        }
+        return String.format(Locale.US, this.mDocumentSizeInfo.getScaleId() == 2 ? "%s (%.1f x %.1f in)" : "%s (%.0f x %.0f mm)", new Object[]{this.mDocumentSizeInfo.getDocSizeName(this), Float.valueOf((float) this.mDocumentSizeInfo.getWidth()), Float.valueOf((float) this.mDocumentSizeInfo.getHeight())});
+    }
+
+    private void startPrintPreviewActivity(String str) {
+        releaseResource();
+        if (str != null) {
+            Intent intent = new Intent();
+            intent.putExtra(RESULT_COLLECTED_FILE_NAME, str);
+            setResult(-1, intent);
+        } else {
+            setResult(0);
+        }
+        logRecordImageImageProcessingType();
+        finish();
+    }
+
+    private void logRecordImageImageProcessingType() {
+        if (!this.mImageCollectSwitchMiddle.isChecked()) {
+            this.mImageCollectSwitchRight.isChecked();
+        }
+    }
+
+    private void palletShow() {
+        if (this.mImageCollectPalletLayout.getVisibility() == 0) {
+            this.mImageCollectPalletLayout.setVisibility(8);
+            this.mImageCollectPalletButton.setText("▲");
+            return;
+        }
+        this.mImageCollectPalletLayout.setVisibility(0);
+        this.mImageCollectPalletButton.setText("▼");
+    }
+
+    private void LoadProgressShow() {
+        this.mModelDialog.doShow(DIALOG_PROGRESS);
+    }
+
+    private void LoadProgressHide() {
+        this.mModelDialog.doDismiss(DIALOG_PROGRESS);
+    }
+
+    private void MessageBox(int i, int i2, int i3, int i4) {
+        MessageBox(i, i2, getString(i3), i4, -1);
+    }
+
+    private void MessageBox(int i, int i2, int i3, int i4, int i5) {
+        MessageBox(i, i2, getString(i3), i4, i5);
+    }
+
+    private void MessageBox(int i, int i2, String str, final int i3, final int i4) {
+        AlertDialog.Builder builder = new AlertDialog.Builder(this);
+        builder.setCancelable(false);
+        if (i2 != -1) {
+            builder.setTitle(i2);
+        }
+        if (str != null) {
+            builder.setMessage(str);
+        }
+        C086515 r4 = null;
+        C086414 r5 = i3 != -1 ? new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialogInterface, int i) {
+                CropImageActivity.mHandler.sendEmptyMessage(i3);
+            }
+        } : null;
+        if (i4 != -1) {
+            r4 = new DialogInterface.OnClickListener() {
+                public void onClick(DialogInterface dialogInterface, int i) {
+                    CropImageActivity.mHandler.sendEmptyMessage(i4);
+                }
+            };
+        }
+        if (i == 101) {
+            builder.setPositiveButton(C2135R.string.str_yes, r5);
+            builder.setNegativeButton(C2135R.string.str_no, r4);
+        } else if (i == 102) {
+            builder.setPositiveButton(C2135R.string.str_ok, r5);
+        } else if (i == 103) {
+            builder.setNegativeButton(C2135R.string.str_cancel, r4);
+        }
+        this.mMessageDialog = builder.create();
+        this.mMessageDialog.show();
+    }
+
+    private void releaseResource() {
+        ImageCollectView imageCollectView = this.mImageCollectView;
+        if (imageCollectView != null) {
+            imageCollectView.ReleaseResource();
+            this.mImageCollectView = null;
+        }
+        ImageCollect imageCollect = this.mImageCollect;
+        if (imageCollect != null) {
+            imageCollect.ReleaseImageCollect();
+            this.mImageCollect = null;
+        }
+        Bitmap bitmap = this.mBitmapPreview;
+        if (bitmap != null) {
+            bitmap.recycle();
+            this.mBitmapPreview = null;
+        }
+        System.gc();
+    }
+
+    private void SaveButtonState() {
+        UiCommon.setButtonEnabled(this.mButtonSave, this.mSaveApprovalTable[this.mImageType]);
+    }
+
+    private void SaveButtonDisable() {
+        boolean[] zArr = this.mSaveApprovalTable;
+        int i = this.mImageType;
+        zArr[i] = false;
+        UiCommon.setButtonEnabled(this.mButtonSave, zArr[i]);
+    }
+
+    private void activityModeChange(int i) {
+        if (i == 0) {
+            this.mImageCollectPreviewLayout.setVisibility(0);
+            this.mImageCollectPaperSizeInfo.setVisibility(0);
+            this.mImageCollectPalletButton.setVisibility(4);
+            this.mImageCollectSwitchLayout.setVisibility(8);
+            this.mImageCollectPalletLayout.setVisibility(8);
+            setTitle(C2135R.string.crop_image_title);
+            this.mToolbarCropImage.setVisibility(0);
+            this.mToolbarEnhanceText.setVisibility(8);
+            this.mToolbarColorAdjustment.setVisibility(8);
+            this.mButtonDocSize = (Button) this.mToolbarCropImage.findViewById(C2135R.C2137id.document_size_button);
+            this.mButtonDocSize.setOnClickListener(this);
+            this.mButtonExecute = (Button) this.mToolbarCropImage.findViewById(C2135R.C2137id.execute_button);
+            this.mButtonExecute.setText(C2135R.string.execute_button);
+            this.mButtonExecute.setOnClickListener(this);
+            this.mImageCollectView.SetViewMode(0);
+            boolean[] zArr = this.mSaveApprovalTable;
+            zArr[0] = false;
+            zArr[1] = true;
+            zArr[2] = true;
+            zArr[3] = true;
+            zArr[4] = true;
+        } else if (i == 1) {
+            this.mImageCollectPreviewLayout.setVisibility(0);
+            this.mImageCollectPaperSizeInfo.setVisibility(4);
+            this.mImageCollectPalletButton.setVisibility(4);
+            this.mImageCollectSwitchLayout.setVisibility(0);
+            this.mImageCollectPalletLayout.setVisibility(8);
+            setTitle(C2135R.string.enhance_text_title);
+            this.mToolbarCropImage.setVisibility(8);
+            this.mToolbarEnhanceText.setVisibility(0);
+            this.mToolbarColorAdjustment.setVisibility(8);
+            this.mButtonSave = (Button) this.mToolbarEnhanceText.findViewById(C2135R.C2137id.save_button);
+            this.mButtonSave.setOnClickListener(this);
+            this.mButtonColorAdjustment = (Button) this.mToolbarEnhanceText.findViewById(C2135R.C2137id.color_adjustment_button);
+            this.mButtonColorAdjustment.setOnClickListener(this);
+            this.mButtonExecute = (Button) this.mToolbarEnhanceText.findViewById(C2135R.C2137id.execute_button);
+            this.mButtonExecute.setText(C2135R.string.print_preview_button);
+            this.mButtonExecute.setOnClickListener(this);
+            this.mImageCollectView.SetViewMode(1);
+        } else if (i == 2) {
+            this.mImageCollectPreviewLayout.setVisibility(0);
+            this.mImageCollectPaperSizeInfo.setVisibility(4);
+            this.mImageCollectPalletButton.setVisibility(0);
+            this.mImageCollectPalletButton.setText("▼");
+            this.mImageCollectSwitchLayout.setVisibility(8);
+            this.mImageCollectPalletLayout.setVisibility(0);
+            setTitle(C2135R.string.color_adjustment_title);
+            this.mToolbarCropImage.setVisibility(8);
+            this.mToolbarEnhanceText.setVisibility(8);
+            this.mToolbarColorAdjustment.setVisibility(0);
+            this.mButtonReset = (Button) this.mToolbarColorAdjustment.findViewById(C2135R.C2137id.reset_button);
+            this.mButtonReset.setOnClickListener(this);
+            UiCommon.setButtonEnabled(this.mButtonReset, false);
+            this.mButtonExecute = (Button) this.mToolbarColorAdjustment.findViewById(C2135R.C2137id.execute_button);
+            this.mButtonExecute.setText(C2135R.string.execute_button);
+            this.mButtonExecute.setOnClickListener(this);
+            this.mImageCollectAdjustmentSwitchId = C2135R.C2137id.AdjustmentModeSwitchLeft;
+            this.mImageCollectAdjustmentSwitch.check(this.mImageCollectAdjustmentSwitchId);
+            AdjustmentModeSwitchALL();
+            this.mImageCollectView.SetViewMode(2);
+        }
+        this.mActivityMode = i;
+    }
+
+    private void ToastMessage(CharSequence charSequence) {
+        CancelToast();
+        this.mDaemonView.SetHandler(mHandler);
+        this.mCustomToast = new CustomToast();
+        this.mCustomToast.makeText(this, charSequence, 0, (this.mImageCollectPreviewLayout.getHeight() - this.mImageCollectLayout.getHeight()) / 2);
+        this.mCustomToast.show();
+    }
+
+    private void showDialog(String str) {
+        this.mProgressDialog = DialogProgress.newInstance(str, 0, getString(C2135R.string.processing_image_message));
+        this.mProgressDialog.setCancelable(false);
+        this.mProgressDialog.show(getSupportFragmentManager(), str);
+    }
+
+    private void dismissDialog(String str) {
+        DialogFragment dialogFragment = (DialogFragment) getSupportFragmentManager().findFragmentByTag(str);
+        if (dialogFragment != null) {
+            dialogFragment.dismiss();
+        }
+    }
+
+    @SuppressLint({"ShowToast"})
+    /* renamed from: com.epson.cameracopy.ui.CropImageActivity$CustomToast */
+    private class CustomToast {
+        private boolean mBreak;
+        private Toast mToast;
+
+        private CustomToast() {
+            this.mToast = null;
+            this.mBreak = false;
+        }
+
+        public void makeText(Context context, CharSequence charSequence, int i, int i2) {
+            this.mBreak = false;
+            this.mToast = Toast.makeText(context, charSequence, 1);
+            this.mToast.setGravity(17, i, i2);
+            View view = this.mToast.getView();
+            view.setBackgroundColor(-12303292);
+            if (view instanceof ViewGroup) {
+                ViewGroup viewGroup = (ViewGroup) view;
+                for (int i3 = 0; i3 < viewGroup.getChildCount(); i3++) {
+                    View childAt = viewGroup.getChildAt(i3);
+                    if (childAt instanceof TextView) {
+                        ((TextView) childAt).setTextColor(-1);
+                    }
+                }
+            }
+            view.setOnTouchListener(new View.OnTouchListener() {
+                public boolean onTouch(View view, MotionEvent motionEvent) {
+                    if (motionEvent.getAction() != 0) {
+                        return false;
+                    }
+                    CustomToast.this.cancel();
+                    return false;
+                }
+            });
+        }
+
+        public void show() {
+            EpLog.m69d("show :");
+            if (!this.mBreak) {
+                EpLog.m69d("run:show");
+                this.mToast.show();
+                return;
+            }
+            EpLog.m69d("run:break");
+        }
+
+        public void cancel() {
+            EpLog.m69d("cancel");
+            this.mBreak = true;
+            this.mToast.cancel();
+        }
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.CropImageActivity$DaemonView */
+    private class DaemonView extends View {
+        private Handler mHandlerAvtivity = null;
+
+        public DaemonView(Context context) {
+            super(context);
+            Init();
+        }
+
+        public DaemonView(Context context, AttributeSet attributeSet) {
+            super(context, attributeSet);
+            Init();
+        }
+
+        public DaemonView(Context context, AttributeSet attributeSet, int i) {
+            super(context, attributeSet, i);
+            Init();
+        }
+
+        public void SetHandler(Handler handler) {
+            this.mHandlerAvtivity = handler;
+            setVisibility(0);
+        }
+
+        private void Init() {
+            setVisibility(4);
+            setBackgroundColor(Color.argb(0, 0, 0, 0));
+            setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
+        }
+
+        public boolean onTouchEvent(MotionEvent motionEvent) {
+            Handler handler;
+            if ((motionEvent.getAction() & 255) != 0 || (handler = this.mHandlerAvtivity) == null) {
+                return false;
+            }
+            handler.sendEmptyMessage(CropImageActivity.MSG_PREVIEW_TOUCH_EVENT_ACTION_DOWN);
+            this.mHandlerAvtivity = null;
+            setVisibility(4);
+            return false;
+        }
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.CropImageActivity$CorrectionParamSet */
+    public class CorrectionParamSet {
+        private int mAfterPWCtype = 0;
+        private int mImageType = 0;
+        private List<CorrectionParam> mParamArray = new ArrayList();
+
+        public CorrectionParamSet() {
+        }
+
+        public void SetImageType(int i) {
+            this.mImageType = i;
+        }
+
+        public int GetImageType() {
+            return this.mImageType;
+        }
+
+        public void AddParam(CorrectionParam correctionParam) {
+            this.mParamArray.add(correctionParam);
+        }
+
+        public CorrectionParam GetParam(int i) {
+            return this.mParamArray.get(i);
+        }
+
+        public void SetAfterPWC(int i) {
+            this.mAfterPWCtype = i;
+        }
+
+        public int GetAfterPWC() {
+            return this.mAfterPWCtype;
+        }
+
+        public void Reset() {
+            this.mParamArray.clear();
+        }
+
+        public int Size() {
+            return this.mParamArray.size();
+        }
+
+        public CorrectionParamSet Clone() {
+            CorrectionParamSet correctionParamSet = new CorrectionParamSet();
+            ArrayList arrayList = new ArrayList();
+            for (CorrectionParam Clone : this.mParamArray) {
+                arrayList.add(Clone.Clone());
+            }
+            correctionParamSet.mParamArray = arrayList;
+            correctionParamSet.mImageType = this.mImageType;
+            correctionParamSet.mAfterPWCtype = this.mAfterPWCtype;
+            return correctionParamSet;
+        }
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.CropImageActivity$CorrectionParam */
+    public class CorrectionParam {
+        /* access modifiers changed from: private */
+        public float mBcscBValue;
+        /* access modifiers changed from: private */
+        public float mBcscCValue;
+        /* access modifiers changed from: private */
+        public float mBcscSValue;
+        /* access modifiers changed from: private */
+        public boolean mMaskType;
+        /* access modifiers changed from: private */
+        public List<List<PointF>> mPointArray;
+        /* access modifiers changed from: private */
+        public Point mPreviewImageSize = new Point(0, 0);
+        /* access modifiers changed from: private */
+        public float mScale;
+        /* access modifiers changed from: private */
+        public float mStrokeWidth;
+
+        public CorrectionParam() {
+        }
+
+        public boolean GetMaskType() {
+            return this.mMaskType;
+        }
+
+        public float GetBcscBValue() {
+            return this.mBcscBValue;
+        }
+
+        public float GetBcscCValue() {
+            return this.mBcscCValue;
+        }
+
+        public float GetBcscSValue() {
+            return this.mBcscSValue;
+        }
+
+        public Point GetPreviewImageSize() {
+            return this.mPreviewImageSize;
+        }
+
+        public List<List<PointF>> GetPointArray() {
+            return this.mPointArray;
+        }
+
+        public float GetScale() {
+            return this.mScale;
+        }
+
+        public float GetStrokeWidth() {
+            return this.mStrokeWidth;
+        }
+
+        public CorrectionParam Clone() {
+            CorrectionParam correctionParam = new CorrectionParam();
+            correctionParam.mMaskType = this.mMaskType;
+            correctionParam.mBcscBValue = this.mBcscBValue;
+            correctionParam.mBcscCValue = this.mBcscCValue;
+            correctionParam.mBcscSValue = this.mBcscSValue;
+            correctionParam.mPreviewImageSize = new Point(this.mPreviewImageSize.x, this.mPreviewImageSize.y);
+            correctionParam.mPointArray = new ArrayList();
+            List<List<PointF>> list = this.mPointArray;
+            if (list != null) {
+                for (List<PointF> it : list) {
+                    ArrayList arrayList = new ArrayList();
+                    for (PointF add : it) {
+                        arrayList.add(add);
+                    }
+                    correctionParam.mPointArray.add(arrayList);
+                }
+            }
+            correctionParam.mScale = this.mScale;
+            correctionParam.mStrokeWidth = this.mStrokeWidth;
+            return correctionParam;
+        }
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.CropImageActivity$EPxLog */
+    static class EPxLog {
+        EPxLog() {
+        }
+
+        /* renamed from: d */
+        public static final void m58d(String str, String str2) {
+            Log.d(str, str2);
+        }
+
+        /* renamed from: e */
+        public static final void m59e(String str, String str2) {
+            if (Debug.isDebuggerConnected()) {
+                Log.e(str, str2);
+            }
+        }
+
+        /* renamed from: i */
+        public static final void m60i(String str, String str2) {
+            if (Debug.isDebuggerConnected()) {
+                Log.i(str, str2);
+            }
+        }
+
+        /* renamed from: v */
+        public static final void m61v(String str, String str2) {
+            if (Debug.isDebuggerConnected()) {
+                Log.v(str, str2);
+            }
+        }
+
+        /* renamed from: w */
+        public static final void m62w(String str, String str2) {
+            if (Debug.isDebuggerConnected()) {
+                Log.w(str, str2);
+            }
+        }
+    }
+}

+ 39 - 0
app/src/main/java/com/epson/cameracopy/p006ui/CurrentFolderName.java

@@ -0,0 +1,39 @@
+package com.epson.cameracopy.p006ui;
+
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import java.io.File;
+
+/* renamed from: com.epson.cameracopy.ui.CurrentFolderName */
+/* compiled from: FolderSelectActivity */
+class CurrentFolderName {
+    LinearLayout mFolderSelectCurrent = null;
+    File mFolderSelectFile = null;
+    TextView mFolderSelectText = null;
+
+    CurrentFolderName(LinearLayout linearLayout, TextView textView) {
+        this.mFolderSelectCurrent = linearLayout;
+        this.mFolderSelectText = textView;
+    }
+
+    public void SetText(String str) {
+        this.mFolderSelectText.setText(str);
+    }
+
+    public void SetFile(File file) {
+        this.mFolderSelectFile = file;
+        this.mFolderSelectText.setText(this.mFolderSelectFile.getName());
+    }
+
+    public void Show(boolean z) {
+        if (z) {
+            this.mFolderSelectCurrent.setVisibility(0);
+        } else {
+            this.mFolderSelectCurrent.setVisibility(8);
+        }
+    }
+
+    public File GetFile() {
+        return this.mFolderSelectFile;
+    }
+}

+ 325 - 0
app/src/main/java/com/epson/cameracopy/p006ui/DocumentSizeEditActivity.java

@@ -0,0 +1,325 @@
+package com.epson.cameracopy.p006ui;
+
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.os.SystemClock;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.RadioGroup;
+import android.widget.TextView;
+import com.epson.cameracopy.printlayout.DocumentSizeInfo;
+import com.epson.cameracopy.printlayout.RegistedDocumentSizeList;
+import epson.print.ActivityIACommon;
+import epson.print.C2135R;
+import epson.print.widgets.LongTapRepeatAdapter;
+import java.math.BigDecimal;
+
+/* renamed from: com.epson.cameracopy.ui.DocumentSizeEditActivity */
+public class DocumentSizeEditActivity extends ActivityIACommon implements View.OnClickListener, RadioGroup.OnCheckedChangeListener {
+    private final double RATIO_INCHTOMM = 25.4d;
+    private final double SIZE_INCH_MAX = 39.37d;
+    private final double SIZE_INCH_MIN = 0.1d;
+    private final int SIZE_MM_MAX = 1000;
+    private final int SIZE_MM_MIN = 1;
+    DocumentSizeInfo mDocumentSizeInfo;
+    private double mHeight;
+    private Button mHeightDec;
+    private Button mHeightInc;
+    private TextView mHeightText;
+    private boolean mInch = false;
+    int mPosition;
+    private RadioGroup mScale;
+    private double mWidth;
+    private Button mWidthDec;
+    private Button mWidthInc;
+    private TextView mWidthText;
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        setContentView((int) C2135R.layout.activity_document_size_edit);
+        setActionBar((int) C2135R.string.document_size_edit_title, true);
+        this.mScale = (RadioGroup) findViewById(C2135R.C2137id.document_size_scale);
+        this.mScale.setOnCheckedChangeListener(this);
+        this.mWidthText = (TextView) findViewById(C2135R.C2137id.width);
+        this.mWidthDec = (Button) findViewById(C2135R.C2137id.width_dec_button);
+        this.mWidthDec.setOnClickListener(this);
+        this.mWidthInc = (Button) findViewById(C2135R.C2137id.width_inc_button);
+        this.mWidthInc.setOnClickListener(this);
+        this.mHeightText = (TextView) findViewById(C2135R.C2137id.height);
+        this.mHeightDec = (Button) findViewById(C2135R.C2137id.height_dec_button);
+        this.mHeightDec.setOnClickListener(this);
+        this.mHeightInc = (Button) findViewById(C2135R.C2137id.height_inc_button);
+        this.mHeightInc.setOnClickListener(this);
+        LongTapRepeatAdapter.bless(this.mWidthDec);
+        LongTapRepeatAdapter.bless(this.mWidthInc);
+        LongTapRepeatAdapter.bless(this.mHeightDec);
+        LongTapRepeatAdapter.bless(this.mHeightInc);
+        setDocumentSize();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPause() {
+        super.onPause();
+        if (isFinishing()) {
+            deleteLongTapMessage();
+        }
+    }
+
+    public void onClick(View view) {
+        switch (view.getId()) {
+            case C2135R.C2137id.height_dec_button /*2131231100*/:
+                decHeight();
+                return;
+            case C2135R.C2137id.height_inc_button /*2131231101*/:
+                incHeight();
+                return;
+            case C2135R.C2137id.width_dec_button /*2131231633*/:
+                decWidth();
+                return;
+            case C2135R.C2137id.width_inc_button /*2131231634*/:
+                incWidth();
+                return;
+            default:
+                return;
+        }
+    }
+
+    public void onCheckedChanged(RadioGroup radioGroup, int i) {
+        if (i != -1) {
+            if (i == C2135R.C2137id.inch_button) {
+                this.mInch = true;
+                convertDocumentSize();
+            } else if (i == C2135R.C2137id.mm_button) {
+                this.mInch = false;
+                convertDocumentSize();
+            }
+        }
+        radioGroup.invalidate();
+    }
+
+    private void setDocumentSize() {
+        this.mDocumentSizeInfo = (DocumentSizeInfo) getIntent().getParcelableExtra("DocumentSize");
+        this.mPosition = getIntent().getIntExtra("DocumentSizePos", -1);
+        ((EditText) findViewById(C2135R.C2137id.et_document_size)).setText(this.mDocumentSizeInfo.getDocSizeName(this));
+        this.mInch = this.mDocumentSizeInfo.getScaleId() == 2;
+        if (this.mInch) {
+            this.mScale.check(C2135R.C2137id.inch_button);
+            this.mWidth = this.mDocumentSizeInfo.getWidth();
+            double roundDownValue = getRoundDownValue(this.mWidth, 1);
+            TextView textView = this.mWidthText;
+            textView.setText(String.valueOf(roundDownValue) + " in");
+            this.mHeight = this.mDocumentSizeInfo.getHeight();
+            double roundDownValue2 = getRoundDownValue(this.mHeight, 1);
+            TextView textView2 = this.mHeightText;
+            textView2.setText(String.valueOf(roundDownValue2) + " in");
+            return;
+        }
+        this.mScale.check(C2135R.C2137id.mm_button);
+        this.mWidth = this.mDocumentSizeInfo.getWidth();
+        TextView textView3 = this.mWidthText;
+        textView3.setText(String.valueOf((int) getRoundDownValue(this.mWidth, 0)) + " mm");
+        this.mHeight = this.mDocumentSizeInfo.getHeight();
+        TextView textView4 = this.mHeightText;
+        textView4.setText(String.valueOf((int) getRoundDownValue(this.mHeight, 0)) + " mm");
+    }
+
+    private void decWidth() {
+        if (this.mInch) {
+            this.mWidth = decDouble(this.mWidth, 0.1d);
+            if (this.mWidth < 0.1d) {
+                this.mWidth = 0.1d;
+            }
+            double roundDownValue = getRoundDownValue(this.mWidth, 1);
+            TextView textView = this.mWidthText;
+            textView.setText(String.valueOf(roundDownValue) + " in");
+            this.mWidth = roundDownValue;
+            return;
+        }
+        this.mWidth = decDouble(this.mWidth, 1.0d);
+        if (this.mWidth < 1.0d) {
+            this.mWidth = 1.0d;
+        }
+        int roundDownValue2 = (int) getRoundDownValue(this.mWidth, 0);
+        TextView textView2 = this.mWidthText;
+        textView2.setText(String.valueOf(roundDownValue2) + " mm");
+        this.mWidth = (double) roundDownValue2;
+    }
+
+    private void incWidth() {
+        if (this.mInch) {
+            this.mWidth = incDouble(this.mWidth, 0.1d);
+            if (this.mWidth > 39.37d) {
+                this.mWidth = 39.37d;
+            }
+            double roundDownValue = getRoundDownValue(this.mWidth, 1);
+            TextView textView = this.mWidthText;
+            textView.setText(String.valueOf(roundDownValue) + " in");
+            this.mWidth = roundDownValue;
+            return;
+        }
+        this.mWidth = incDouble(this.mWidth, 1.0d);
+        if (this.mWidth > 1000.0d) {
+            this.mWidth = 1000.0d;
+        }
+        int roundDownValue2 = (int) getRoundDownValue(this.mWidth, 0);
+        TextView textView2 = this.mWidthText;
+        textView2.setText(String.valueOf(roundDownValue2) + " mm");
+        this.mWidth = (double) roundDownValue2;
+    }
+
+    private void decHeight() {
+        if (this.mInch) {
+            this.mHeight = decDouble(this.mHeight, 0.1d);
+            if (this.mHeight < 0.1d) {
+                this.mHeight = 0.1d;
+            }
+            double roundDownValue = getRoundDownValue(this.mHeight, 1);
+            TextView textView = this.mHeightText;
+            textView.setText(String.valueOf(roundDownValue) + " in");
+            return;
+        }
+        this.mHeight = decDouble(this.mHeight, 1.0d);
+        if (this.mHeight < 1.0d) {
+            this.mHeight = 1.0d;
+        }
+        int roundDownValue2 = (int) getRoundDownValue(this.mHeight, 0);
+        TextView textView2 = this.mHeightText;
+        textView2.setText(String.valueOf(roundDownValue2) + " mm");
+        this.mHeight = (double) roundDownValue2;
+    }
+
+    private void incHeight() {
+        if (this.mInch) {
+            this.mHeight = incDouble(this.mHeight, 0.1d);
+            if (this.mHeight > 39.37d) {
+                this.mHeight = 39.37d;
+            }
+            double roundDownValue = getRoundDownValue(this.mHeight, 1);
+            TextView textView = this.mHeightText;
+            textView.setText(String.valueOf(roundDownValue) + " in");
+            this.mHeight = roundDownValue;
+            return;
+        }
+        this.mHeight = incDouble(this.mHeight, 1.0d);
+        if (this.mHeight > 1000.0d) {
+            this.mHeight = 1000.0d;
+        }
+        int roundDownValue2 = (int) getRoundDownValue(this.mHeight, 0);
+        TextView textView2 = this.mHeightText;
+        textView2.setText(String.valueOf(roundDownValue2) + " mm");
+        this.mHeight = (double) roundDownValue2;
+    }
+
+    private void convertDocumentSize() {
+        if (this.mInch) {
+            this.mWidth /= 25.4d;
+            double d = this.mWidth;
+            if (d < 0.1d) {
+                d = 0.1d;
+            }
+            this.mWidth = d;
+            double roundDownValue = getRoundDownValue(this.mWidth, 1);
+            this.mWidthText.setText(String.valueOf(roundDownValue) + " in");
+            this.mWidth = roundDownValue;
+            this.mHeight = this.mHeight / 25.4d;
+            double d2 = this.mHeight;
+            if (d2 < 0.1d) {
+                d2 = 0.1d;
+            }
+            this.mHeight = d2;
+            double roundDownValue2 = getRoundDownValue(this.mHeight, 1);
+            this.mHeightText.setText(String.valueOf(roundDownValue2) + " in");
+            this.mHeight = roundDownValue2;
+            return;
+        }
+        this.mWidth *= 25.4d;
+        double d3 = this.mWidth;
+        if (d3 > 1000.0d) {
+            d3 = 1000.0d;
+        }
+        this.mWidth = d3;
+        int roundDownValue3 = (int) getRoundDownValue(this.mWidth, 0);
+        this.mWidthText.setText(String.valueOf(roundDownValue3) + " mm");
+        this.mWidth = (double) roundDownValue3;
+        this.mHeight = this.mHeight * 25.4d;
+        double d4 = this.mHeight;
+        if (d4 > 1000.0d) {
+            d4 = 1000.0d;
+        }
+        this.mHeight = d4;
+        int roundDownValue4 = (int) getRoundDownValue(this.mHeight, 0);
+        this.mHeightText.setText(String.valueOf(roundDownValue4) + " mm");
+        this.mHeight = (double) roundDownValue4;
+    }
+
+    private double getRoundDownValue(double d, int i) {
+        return new BigDecimal(String.valueOf(d)).setScale(i, 1).doubleValue();
+    }
+
+    private void checkDocumentSize() {
+        String obj = ((EditText) findViewById(C2135R.C2137id.et_document_size)).getText().toString();
+        if (obj.isEmpty()) {
+            SimpleMessageDialogFragment.newInstance(C2135R.string.no_name_documentsize_message).show(getSupportFragmentManager(), "error-dialog");
+            return;
+        }
+        this.mDocumentSizeInfo.setDocSizeName(obj);
+        this.mDocumentSizeInfo.setScaleId(this.mInch ? 2 : 1);
+        this.mDocumentSizeInfo.setWidth(getRoundDownValue(this.mWidth, 1));
+        this.mDocumentSizeInfo.setHeight(getRoundDownValue(this.mHeight, 1));
+        RegistedDocumentSizeList instance = RegistedDocumentSizeList.getInstance(this);
+        if (instance.isExistDocumentSizeName(obj, this.mPosition)) {
+            SimpleMessageDialogFragment.newInstance(C2135R.string.exist_documentsize_message).show(getSupportFragmentManager(), "error-dialog");
+            return;
+        }
+        int i = this.mPosition;
+        if (i < 0) {
+            instance.add(this.mDocumentSizeInfo);
+            finish();
+            return;
+        }
+        instance.update(this.mDocumentSizeInfo, i);
+        finish();
+    }
+
+    private double incDouble(double d, double d2) {
+        return new BigDecimal(String.valueOf(d)).add(new BigDecimal(String.valueOf(d2))).doubleValue();
+    }
+
+    private double decDouble(double d, double d2) {
+        return new BigDecimal(String.valueOf(d)).subtract(new BigDecimal(String.valueOf(d2))).doubleValue();
+    }
+
+    public boolean onCreateOptionsMenu(Menu menu) {
+        if (this.mDocumentSizeInfo.getPaperId() == -2) {
+            getMenuInflater().inflate(C2135R.C2138menu.menu_done, menu);
+        }
+        return super.onCreateOptionsMenu(menu);
+    }
+
+    public boolean onOptionsItemSelected(MenuItem menuItem) {
+        if (menuItem.getItemId() != C2135R.C2137id.menuSettingsDone) {
+            return super.onOptionsItemSelected(menuItem);
+        }
+        checkDocumentSize();
+        return true;
+    }
+
+    /* access modifiers changed from: protected */
+    public void deleteLongTapMessage() {
+        MotionEvent obtain = MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis() + 10, 1, 0.0f, 0.0f, 0);
+        this.mWidthDec.dispatchTouchEvent(obtain);
+        this.mWidthInc.dispatchTouchEvent(obtain);
+        this.mHeightDec.dispatchTouchEvent(obtain);
+        this.mHeightInc.dispatchTouchEvent(obtain);
+    }
+
+    public void onConfigurationChanged(Configuration configuration) {
+        super.onConfigurationChanged(configuration);
+        deleteLongTapMessage();
+    }
+}

+ 263 - 0
app/src/main/java/com/epson/cameracopy/p006ui/DocumentSizeSettingActivity.java

@@ -0,0 +1,263 @@
+package com.epson.cameracopy.p006ui;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.p000v4.app.DialogFragment;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.BaseAdapter;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.TextView;
+import com.epson.cameracopy.printlayout.DocumentSizeInfo;
+import com.epson.cameracopy.printlayout.RegistedDocumentSizeList;
+import epson.print.ActivityIACommon;
+import epson.print.C2135R;
+import java.util.Locale;
+
+/* renamed from: com.epson.cameracopy.ui.DocumentSizeSettingActivity */
+public class DocumentSizeSettingActivity extends ActivityIACommon implements View.OnClickListener {
+    private int ID_DIALOG_DELETE = 1;
+    private int ID_DIALOG_RESET = 2;
+    private Button mAdd;
+    private Button mClear;
+    private Button mDelete;
+    private Button mEdit;
+    private ListView mListView;
+    private Button mSelect;
+    SelectListAdapter mSelectListAdapter;
+    private int mSelectPos;
+
+    public void doNegativeClick(int i) {
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        setContentView((int) C2135R.layout.activity_document_size_setting);
+        setActionBar((int) C2135R.string.document_size_title, true);
+        this.mListView = (ListView) findViewById(C2135R.C2137id.docsize_list);
+        this.mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+            public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
+                DocumentSizeSettingActivity documentSizeSettingActivity = DocumentSizeSettingActivity.this;
+                documentSizeSettingActivity.onSelectDocsizeList(documentSizeSettingActivity.mSelectListAdapter.getItem(i), view, i);
+            }
+        });
+        this.mSelectListAdapter = new SelectListAdapter();
+        this.mListView.setAdapter(this.mSelectListAdapter);
+        this.mSelect = (Button) findViewById(C2135R.C2137id.select_button);
+        this.mSelect.setOnClickListener(this);
+        this.mEdit = (Button) findViewById(C2135R.C2137id.edit_button);
+        this.mEdit.setOnClickListener(this);
+        this.mDelete = (Button) findViewById(C2135R.C2137id.delete_button);
+        this.mDelete.setOnClickListener(this);
+        this.mAdd = (Button) findViewById(C2135R.C2137id.add_button);
+        this.mAdd.setOnClickListener(this);
+        this.mClear = (Button) findViewById(C2135R.C2137id.clear_button);
+        this.mClear.setOnClickListener(this);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onStart() {
+        super.onStart();
+        this.mSelectListAdapter.reload();
+    }
+
+    public void onClick(View view) {
+        switch (view.getId()) {
+            case C2135R.C2137id.add_button /*2131230807*/:
+                addNewDocumentSize();
+                break;
+            case C2135R.C2137id.clear_button /*2131230914*/:
+                resetDocumentSizeList();
+                break;
+            case C2135R.C2137id.delete_button /*2131230979*/:
+                deleteDocumentSize();
+                break;
+            case C2135R.C2137id.edit_button /*2131231009*/:
+                editDocumentSize(this.mSelectPos);
+                break;
+            case C2135R.C2137id.select_button /*2131231472*/:
+                selectDocumentSize(this.mSelectPos);
+                break;
+        }
+        findViewById(C2135R.C2137id.document_size_menu).setVisibility(4);
+    }
+
+    public void onSelectDocsizeList(Object obj, View view, int i) {
+        this.mSelectPos = i;
+        if (findViewById(C2135R.C2137id.document_size_menu).getVisibility() != 0) {
+            DocumentSizeInfo documentSizeInfo = (DocumentSizeInfo) obj;
+            ((TextView) findViewById(C2135R.C2137id.menu_text)).setText(documentSizeInfo.getDocSizeName(this));
+            boolean z = true;
+            this.mEdit.setEnabled(documentSizeInfo.getPaperId() == -2);
+            if (documentSizeInfo.getPaperId() == -1) {
+                z = false;
+            }
+            this.mDelete.setEnabled(z);
+            findViewById(C2135R.C2137id.document_size_menu).setVisibility(0);
+            return;
+        }
+        findViewById(C2135R.C2137id.document_size_menu).setVisibility(4);
+    }
+
+    private void addNewDocumentSize() {
+        DocumentSizeInfo documentSizeInfo = new DocumentSizeInfo();
+        String country = Locale.getDefault().getCountry();
+        if (country.equals(Locale.US.getCountry()) || country.equals(Locale.CANADA.getCountry())) {
+            documentSizeInfo.setDocSizeName(getString(C2135R.string.new_document_size));
+            documentSizeInfo.setScaleId(2);
+            documentSizeInfo.setWidth(8.5d);
+            documentSizeInfo.setHeight(11.0d);
+            documentSizeInfo.setPaperId(-2);
+            documentSizeInfo.setDocSizeNameId(0);
+        } else {
+            documentSizeInfo.setDocSizeName(getString(C2135R.string.new_document_size));
+            documentSizeInfo.setScaleId(1);
+            documentSizeInfo.setWidth(210.0d);
+            documentSizeInfo.setHeight(297.0d);
+            documentSizeInfo.setPaperId(-2);
+            documentSizeInfo.setDocSizeNameId(0);
+        }
+        Intent intent = new Intent(this, DocumentSizeEditActivity.class);
+        intent.putExtra("DocumentSize", documentSizeInfo);
+        intent.putExtra("DocumentSizePos", -1);
+        startActivity(intent);
+    }
+
+    private void selectDocumentSize(int i) {
+        this.mSelectListAdapter.select(i);
+        finish();
+    }
+
+    private void editDocumentSize(int i) {
+        Intent intent = new Intent(this, DocumentSizeEditActivity.class);
+        intent.putExtra("DocumentSize", (DocumentSizeInfo) this.mSelectListAdapter.getItem(i));
+        intent.putExtra("DocumentSizePos", i);
+        startActivity(intent);
+    }
+
+    private void deleteDocumentSize() {
+        Bundle bundle = new Bundle();
+        bundle.putString("message", getString(C2135R.string.delete_documentsize_message));
+        bundle.putInt("id", this.ID_DIALOG_DELETE);
+        NotifyDialogFragment notifyDialogFragment = new NotifyDialogFragment();
+        notifyDialogFragment.setArguments(bundle);
+        notifyDialogFragment.show(getSupportFragmentManager(), "notify-dialog");
+    }
+
+    private void resetDocumentSizeList() {
+        Bundle bundle = new Bundle();
+        bundle.putString("message", getString(C2135R.string.reset_documentsize_message));
+        bundle.putInt("id", this.ID_DIALOG_RESET);
+        NotifyDialogFragment notifyDialogFragment = new NotifyDialogFragment();
+        notifyDialogFragment.setArguments(bundle);
+        notifyDialogFragment.show(getSupportFragmentManager(), "notify-dialog");
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.DocumentSizeSettingActivity$SelectListAdapter */
+    class SelectListAdapter extends BaseAdapter {
+        RegistedDocumentSizeList mRegistedDocumentSizeList;
+
+        public long getItemId(int i) {
+            return 0;
+        }
+
+        public SelectListAdapter() {
+            reload();
+        }
+
+        public void reload() {
+            this.mRegistedDocumentSizeList = RegistedDocumentSizeList.getInstance(DocumentSizeSettingActivity.this);
+            notifyDataSetChanged();
+        }
+
+        public void select(int i) {
+            this.mRegistedDocumentSizeList.select(i);
+            notifyDataSetChanged();
+        }
+
+        public int getCount() {
+            RegistedDocumentSizeList registedDocumentSizeList = this.mRegistedDocumentSizeList;
+            if (registedDocumentSizeList == null) {
+                return 0;
+            }
+            return registedDocumentSizeList.size();
+        }
+
+        public Object getItem(int i) {
+            RegistedDocumentSizeList registedDocumentSizeList = this.mRegistedDocumentSizeList;
+            if (registedDocumentSizeList == null) {
+                return null;
+            }
+            return registedDocumentSizeList.getItem(i);
+        }
+
+        public View getView(int i, View view, ViewGroup viewGroup) {
+            if (view == null) {
+                view = DocumentSizeSettingActivity.this.getLayoutInflater().inflate(C2135R.layout.select_list_row, viewGroup, false);
+            }
+            RegistedDocumentSizeList registedDocumentSizeList = this.mRegistedDocumentSizeList;
+            if (registedDocumentSizeList == null) {
+                return view;
+            }
+            DocumentSizeInfo item = registedDocumentSizeList.getItem(i);
+            ((TextView) view.findViewById(C2135R.C2137id.docsize_name)).setText(item.getDocSizeName(DocumentSizeSettingActivity.this));
+            ImageView imageView = (ImageView) view.findViewById(C2135R.C2137id.current_docsize_image);
+            if (this.mRegistedDocumentSizeList.isSelected(item)) {
+                imageView.setVisibility(0);
+            } else {
+                imageView.setVisibility(4);
+            }
+            return view;
+        }
+
+        public void delete(DocumentSizeInfo documentSizeInfo, int i) {
+            this.mRegistedDocumentSizeList.delete(documentSizeInfo, i);
+            notifyDataSetChanged();
+        }
+
+        public void reset() {
+            this.mRegistedDocumentSizeList.reset();
+            notifyDataSetChanged();
+        }
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.DocumentSizeSettingActivity$NotifyDialogFragment */
+    public static class NotifyDialogFragment extends DialogFragment {
+        public Dialog onCreateDialog(Bundle bundle) {
+            super.onCreateDialog(bundle);
+            String string = getArguments().getString("message");
+            final int i = getArguments().getInt("id");
+            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+            builder.setMessage(string);
+            builder.setPositiveButton(C2135R.string.yes_button, new DialogInterface.OnClickListener() {
+                public void onClick(DialogInterface dialogInterface, int i) {
+                    ((DocumentSizeSettingActivity) NotifyDialogFragment.this.getActivity()).doPositiveClick(i);
+                }
+            });
+            builder.setNegativeButton(C2135R.string.no_button, new DialogInterface.OnClickListener() {
+                public void onClick(DialogInterface dialogInterface, int i) {
+                    ((DocumentSizeSettingActivity) NotifyDialogFragment.this.getActivity()).doNegativeClick(i);
+                }
+            });
+            AlertDialog create = builder.create();
+            create.setCanceledOnTouchOutside(false);
+            return create;
+        }
+    }
+
+    public void doPositiveClick(int i) {
+        if (i == this.ID_DIALOG_RESET) {
+            this.mSelectListAdapter.reset();
+        } else if (i == this.ID_DIALOG_DELETE) {
+            this.mSelectListAdapter.delete((DocumentSizeInfo) this.mSelectListAdapter.getItem(this.mSelectPos), this.mSelectPos);
+            this.mSelectPos--;
+        }
+    }
+}

+ 143 - 0
app/src/main/java/com/epson/cameracopy/p006ui/FolderInformation.java

@@ -0,0 +1,143 @@
+package com.epson.cameracopy.p006ui;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+
+/* renamed from: com.epson.cameracopy.ui.FolderInformation */
+/* compiled from: FolderSelectActivity */
+class FolderInformation {
+    private static int DIRECTION_CURRENT = 0;
+    private static int DIRECTION_FORWARD = 1;
+    private static int DIRECTION_REVERS = -1;
+    private File mCurrentFolder = null;
+    private CurrentFolderName mCurrentFolderName = null;
+    private File[] mFileList = null;
+    private ArrayList<File> mFolderArray = null;
+    private ItemDataAdapter mItemDataAdapter = null;
+    private ArrayList<ItemData> mItemDataList = null;
+    private int mLevel = 0;
+    private MenuControl mMenuControl = null;
+    private int mSelectedPosition = -1;
+
+    FolderInformation(String str, int i, ItemDataAdapter itemDataAdapter, ArrayList<ItemData> arrayList, CurrentFolderName currentFolderName, MenuControl menuControl) {
+        init(str, i, itemDataAdapter, arrayList, currentFolderName, menuControl);
+    }
+
+    private void init(String str, int i, ItemDataAdapter itemDataAdapter, ArrayList<ItemData> arrayList, CurrentFolderName currentFolderName, MenuControl menuControl) {
+        this.mCurrentFolder = new File(str);
+        this.mItemDataList = arrayList;
+        this.mItemDataAdapter = itemDataAdapter;
+        this.mLevel = i;
+        this.mCurrentFolderName = currentFolderName;
+        this.mMenuControl = menuControl;
+    }
+
+    public void UpdateFolder() {
+        UpdateFolder(0, DIRECTION_CURRENT);
+    }
+
+    public int UpdateFolder(int i) {
+        if (IsFolder(i)) {
+            UpdateFolder(i, DIRECTION_FORWARD);
+        } else {
+            UpdateFolder(i, DIRECTION_REVERS);
+        }
+        this.mItemDataAdapter.notifyDataSetInvalidated();
+        return this.mLevel;
+    }
+
+    public boolean IsFolder(int i) {
+        return i != 0 || this.mLevel == 0;
+    }
+
+    public void SetSelectedPosition(int i) {
+        this.mSelectedPosition = i;
+    }
+
+    public boolean IsFolder() {
+        return this.mSelectedPosition != 0 || this.mLevel == 0;
+    }
+
+    public File GetCurrentFolder() {
+        return this.mCurrentFolder;
+    }
+
+    private void UpdateFolder(int i, int i2) {
+        if (i2 == DIRECTION_REVERS) {
+            this.mLevel--;
+            GetFolder(this.mFolderArray.get(i).getParentFile());
+        } else if (i2 == DIRECTION_FORWARD) {
+            this.mLevel++;
+            GetFolder(this.mFolderArray.get(i));
+        } else {
+            GetFolder(this.mCurrentFolder);
+        }
+    }
+
+    private void GetFolder(File file) {
+        this.mItemDataList.clear();
+        this.mCurrentFolder = file;
+        this.mFolderArray = new ArrayList<>();
+        if (this.mLevel != 0) {
+            this.mItemDataList.add(new ItemData((String) null));
+            this.mFolderArray.add(this.mCurrentFolder);
+        }
+        this.mFileList = this.mCurrentFolder.listFiles(new DirectoryFileFilter());
+        Arrays.sort(this.mFileList, new FileNameSort());
+        if (this.mFileList != null) {
+            int i = 0;
+            while (true) {
+                File[] fileArr = this.mFileList;
+                if (i >= fileArr.length) {
+                    break;
+                }
+                this.mItemDataList.add(new ItemData(fileArr[i].getName()));
+                this.mFolderArray.add(this.mFileList[i]);
+                i++;
+            }
+        }
+        CurrentFolderName currentFolderName = this.mCurrentFolderName;
+        if (currentFolderName != null) {
+            currentFolderName.SetFile(this.mCurrentFolder);
+            if (this.mLevel != 0) {
+                this.mCurrentFolderName.Show(true);
+            } else {
+                this.mCurrentFolderName.Show(false);
+            }
+        }
+        MenuControl menuControl = this.mMenuControl;
+        if (menuControl == null) {
+            return;
+        }
+        if (this.mLevel != 0) {
+            menuControl.ChangeMenu(1);
+        } else {
+            menuControl.ChangeMenu(0);
+        }
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.FolderInformation$DirectoryFileFilter */
+    /* compiled from: FolderSelectActivity */
+    private class DirectoryFileFilter implements FileFilter {
+        private DirectoryFileFilter() {
+        }
+
+        public boolean accept(File file) {
+            return file.isDirectory() && !file.isHidden();
+        }
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.FolderInformation$FileNameSort */
+    /* compiled from: FolderSelectActivity */
+    private class FileNameSort implements Comparator<File> {
+        private FileNameSort() {
+        }
+
+        public int compare(File file, File file2) {
+            return file.getName().compareToIgnoreCase(file2.getName());
+        }
+    }
+}

+ 172 - 0
app/src/main/java/com/epson/cameracopy/p006ui/FolderSelectActivity.java

@@ -0,0 +1,172 @@
+package com.epson.cameracopy.p006ui;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Environment;
+import android.os.Handler;
+import android.os.Message;
+import android.view.ContextMenu;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.LinearLayout;
+import android.widget.ListView;
+import android.widget.TextView;
+import epson.print.ActivityIACommon;
+import epson.print.ActivityRequestPermissions;
+import epson.print.C2135R;
+import java.io.File;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+
+/* renamed from: com.epson.cameracopy.ui.FolderSelectActivity */
+public class FolderSelectActivity extends ActivityIACommon implements View.OnClickListener {
+    private static final int MSG_UPDATE_LIST_VIEW = 901;
+    private static final int REQEST_RUNTIMEPERMMISSION = 1;
+    private static WeakReference<Activity> mActivity;
+    /* access modifiers changed from: private */
+    public static FolderSelectActivity mFolderSelectActivity;
+    /* access modifiers changed from: private */
+    public static Handler mHandler = new Handler() {
+        public void handleMessage(Message message) {
+            if (FolderSelectActivity.mFolderSelectActivity != null) {
+                FolderSelectActivity.mFolderSelectActivity.executeMessage(message);
+            }
+        }
+    };
+    AdapterView.OnItemClickListener listViewListener = new AdapterView.OnItemClickListener() {
+        public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
+            FolderSelectActivity.this.mFolderInformation.UpdateFolder(i);
+            FolderSelectActivity.mHandler.sendEmptyMessage(FolderSelectActivity.MSG_UPDATE_LIST_VIEW);
+        }
+    };
+    /* access modifiers changed from: private */
+    public FolderInformation mFolderInformation = null;
+    private LinearLayout mFolderSelectBase = null;
+    private LinearLayout mFolderSelectCurrent = null;
+    private TextView mFolderSelectText = null;
+    private ItemDataAdapter mItemDataAdapter = null;
+    private ArrayList<ItemData> mItemDataList = null;
+    private ListView mListView = null;
+    private MenuControl mMenuControl = null;
+    private String mRootFolder = null;
+
+    public void onActionbarMenuNewClicked(View view) {
+    }
+
+    public void onClick(View view) {
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        setContentView((int) C2135R.layout.activity_folder_select);
+        setActionBar((int) C2135R.string.folder_selector_title, true);
+        mActivity = new WeakReference<>(this);
+        mFolderSelectActivity = (FolderSelectActivity) mActivity.get();
+        this.mFolderSelectBase = (LinearLayout) findViewById(C2135R.C2137id.folder_select_base);
+        this.mFolderSelectCurrent = (LinearLayout) findViewById(C2135R.C2137id.folder_select_current);
+        this.mFolderSelectText = (TextView) findViewById(C2135R.C2137id.folder_select_text);
+        this.mMenuControl = new MenuControl(this, 1);
+        this.mRootFolder = Environment.getExternalStorageDirectory().getAbsolutePath();
+        this.mItemDataList = new ArrayList<>();
+        this.mItemDataAdapter = new ItemDataAdapter(this, 0, this.mItemDataList);
+        updateListView();
+        if (ActivityRequestPermissions.isRuntimePermissionSupported()) {
+            String[] strArr = {"android.permission.WRITE_EXTERNAL_STORAGE"};
+            ActivityRequestPermissions.Permission permission = new ActivityRequestPermissions.Permission(strArr[0], new String[]{getString(C2135R.string.permission_dialog_title), getString(C2135R.string.permission_dialog_title)}, new String[]{ActivityRequestPermissions.DialogParameter.setMessage2((Context) this, getString(C2135R.string.permission_dialog_message_storage)), ActivityRequestPermissions.DialogParameter.setMessage3A((Context) this, getString(C2135R.string.permission_dialog_message_storage), getString(C2135R.string.permission_function_storage))});
+            if (!ActivityRequestPermissions.checkPermission(this, strArr)) {
+                ActivityRequestPermissions.requestPermission((Activity) this, permission, 1);
+                return;
+            }
+        }
+        initFolder();
+    }
+
+    /* access modifiers changed from: package-private */
+    public void initFolder() {
+        try {
+            this.mFolderInformation = new FolderInformation(this.mRootFolder, 0, this.mItemDataAdapter, this.mItemDataList, new CurrentFolderName(this.mFolderSelectCurrent, this.mFolderSelectText), this.mMenuControl);
+            this.mFolderInformation.UpdateFolder();
+        } catch (NullPointerException unused) {
+            setResult(1, (Intent) null);
+            finish();
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onActivityResult(int i, int i2, Intent intent) {
+        super.onActivityResult(i, i2, intent);
+        if (i == 1) {
+            if (i2 != -1) {
+                setResult(0);
+                finish();
+                return;
+            }
+            initFolder();
+        }
+    }
+
+    /* access modifiers changed from: private */
+    public void executeMessage(Message message) {
+        if (message.what == MSG_UPDATE_LIST_VIEW) {
+            updateListView();
+        }
+    }
+
+    private void updateListView() {
+        int i = 0;
+        while (true) {
+            if (i >= this.mFolderSelectBase.getChildCount()) {
+                break;
+            } else if (this.mFolderSelectBase.getChildAt(i).equals(this.mListView)) {
+                this.mFolderSelectBase.removeView(this.mListView);
+                break;
+            } else {
+                i++;
+            }
+        }
+        this.mListView = new ListView(this);
+        this.mListView.setAdapter(this.mItemDataAdapter);
+        this.mListView.setOnItemClickListener(this.listViewListener);
+        this.mFolderSelectBase.addView(this.mListView);
+    }
+
+    public boolean onCreateOptionsMenu(Menu menu) {
+        this.mMenuControl.CreateMenu(menu);
+        return true;
+    }
+
+    public boolean onOptionsItemSelected(MenuItem menuItem) {
+        if (menuItem.getItemId() != C2135R.C2137id.f337ok) {
+            return super.onOptionsItemSelected(menuItem);
+        }
+        onActionbarMenuidOkClicked((View) null);
+        return true;
+    }
+
+    public void onActionbarMenuidOkClicked(View view) {
+        File GetCurrentFolder = this.mFolderInformation.GetCurrentFolder();
+        Intent intent = new Intent();
+        intent.putExtra("SELECT_Folder", GetCurrentFolder.getAbsolutePath());
+        setResult(-1, intent);
+        finish();
+    }
+
+    public void onCreateContextMenu(ContextMenu contextMenu, View view, ContextMenu.ContextMenuInfo contextMenuInfo) {
+        super.onCreateContextMenu(contextMenu, view, contextMenuInfo);
+        ListView listView = (ListView) view;
+        if (this.mFolderInformation.IsFolder()) {
+            contextMenu.add(0, 0, 0, "選択");
+            contextMenu.add(0, 1, 0, "削除");
+        }
+    }
+
+    public boolean onContextItemSelected(MenuItem menuItem) {
+        menuItem.getItemId();
+        return true;
+    }
+}

+ 1485 - 0
app/src/main/java/com/epson/cameracopy/p006ui/ImageCollectView.java

@@ -0,0 +1,1485 @@
+package com.epson.cameracopy.p006ui;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.DashPathEffect;
+import android.graphics.Matrix;
+import android.graphics.Paint;
+import android.graphics.Path;
+import android.graphics.PathEffect;
+import android.graphics.PointF;
+import android.graphics.Rect;
+import android.graphics.RectF;
+import android.graphics.Region;
+import android.graphics.drawable.BitmapDrawable;
+import android.os.Debug;
+import android.os.Handler;
+import android.os.Message;
+import android.support.p000v4.internal.view.SupportMenu;
+import android.support.p000v4.view.InputDeviceCompat;
+import android.util.AttributeSet;
+import android.util.DisplayMetrics;
+import android.util.Log;
+import android.view.GestureDetector;
+import android.view.MotionEvent;
+import android.view.ScaleGestureDetector;
+import android.view.View;
+import java.util.ArrayList;
+import java.util.List;
+
+/* renamed from: com.epson.cameracopy.ui.ImageCollectView */
+public class ImageCollectView extends View {
+    private static final float DRAG_EDGE_STROKE_WIDTH = 1.0f;
+    private static final float MESSAGE_TEXT_SIZE = 10.0f;
+    private static final float RADIUS_CROP_CIRCLE = 16.0f;
+    private static final float SCALE_RANGE_MAX = 4.0f;
+    private static final float SCALE_RANGE_MIN = 1.0f;
+    private static final float STROKE_WIDTH_DRAG_PATH = 20.0f;
+    private static final int TOUCH_STATE_DOWN_MOVE = 0;
+    private static final int TOUCH_STATE_IDOLE = -1;
+    private static final int TOUCH_STATE_UP = 1;
+    private static final float VIEW_MARGINE = 6.0f;
+    public static final int VIEW_MODE_COLOR_ADJUSTMENT_ALL = 2;
+    public static final int VIEW_MODE_COLOR_ADJUSTMENT_PART = 3;
+    public static final int VIEW_MODE_CROP_IMAGE = 0;
+    public static final int VIEW_MODE_ENHANCE_TEXT = 1;
+    private int[] INVERT = {1, 0};
+    private Bitmap mBitmapImage = null;
+    private Bitmap mBitmapMask = null;
+    private Canvas mCanvasMask = null;
+    private Context mContext = null;
+    /* access modifiers changed from: private */
+    public Data mData = null;
+    private GestureDetector mGestureDetector = null;
+    private boolean mGetCropPoint = false;
+    private Handler mHandlerAvtivity = null;
+    /* access modifiers changed from: private */
+    public int mOrient = 0;
+    private PathEffectData mPathEffectData = null;
+    private ScaleGestureDetector mScaleGestureDetector = null;
+    private int mViewMode = 0;
+    private final GestureDetector.SimpleOnGestureListener onGestureDetectorListener = new GestureDetector.SimpleOnGestureListener() {
+        public boolean onDoubleTap(MotionEvent motionEvent) {
+            ImageCollectView.this.ResetScalePos(true);
+            ImageCollectView.this.invalidate();
+            return super.onDoubleTap(motionEvent);
+        }
+
+        public boolean onDoubleTapEvent(MotionEvent motionEvent) {
+            return super.onDoubleTapEvent(motionEvent);
+        }
+
+        public boolean onDown(MotionEvent motionEvent) {
+            return super.onDown(motionEvent);
+        }
+
+        public void onLongPress(MotionEvent motionEvent) {
+            super.onLongPress(motionEvent);
+        }
+
+        public void onShowPress(MotionEvent motionEvent) {
+            super.onShowPress(motionEvent);
+        }
+
+        public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
+            return super.onSingleTapConfirmed(motionEvent);
+        }
+
+        public boolean onSingleTapUp(MotionEvent motionEvent) {
+            return super.onSingleTapUp(motionEvent);
+        }
+
+        public boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) {
+            return super.onFling(motionEvent, motionEvent2, f, f2);
+        }
+
+        public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) {
+            return super.onScroll(motionEvent, motionEvent2, f, f2);
+        }
+    };
+    private final ScaleGestureDetector.SimpleOnScaleGestureListener onScaleGestureDetector = new ScaleGestureDetector.SimpleOnScaleGestureListener() {
+        public boolean onScaleBegin(ScaleGestureDetector scaleGestureDetector) {
+            return super.onScaleBegin(scaleGestureDetector);
+        }
+
+        public boolean onScale(ScaleGestureDetector scaleGestureDetector) {
+            ImageCollectView.this.SetScale(scaleGestureDetector.getScaleFactor());
+            ImageCollectView.this.invalidate();
+            return true;
+        }
+
+        public void onScaleEnd(ScaleGestureDetector scaleGestureDetector) {
+            ImageCollectView.this.SetScale(scaleGestureDetector.getScaleFactor());
+            ImageCollectView.this.invalidate();
+            super.onScaleEnd(scaleGestureDetector);
+        }
+    };
+
+    private void TouchEventColorAdjustmentAll(MotionEvent motionEvent) {
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.ImageCollectView$DataCropImage */
+    class DataCropImage {
+        public PointF[] mPointPreviewCrop;
+        public PointF mPointPreviewTouch;
+        public RectF[] mRectCropMovableArea;
+        public RectF[] mRectCropTapArea;
+        public int mSelectArea;
+
+        DataCropImage() {
+            this.mRectCropTapArea = null;
+            this.mRectCropMovableArea = null;
+            this.mPointPreviewCrop = null;
+            this.mPointPreviewTouch = null;
+            this.mRectCropTapArea = new RectF[5];
+            this.mRectCropTapArea[0] = new RectF();
+            this.mRectCropTapArea[1] = new RectF();
+            this.mRectCropTapArea[2] = new RectF();
+            this.mRectCropTapArea[3] = new RectF();
+            this.mRectCropTapArea[4] = new RectF();
+            this.mRectCropMovableArea = new RectF[4];
+            this.mRectCropMovableArea[0] = new RectF();
+            this.mRectCropMovableArea[1] = new RectF();
+            this.mRectCropMovableArea[2] = new RectF();
+            this.mRectCropMovableArea[3] = new RectF();
+            this.mPointPreviewCrop = new PointF[4];
+            this.mPointPreviewCrop[0] = new PointF();
+            this.mPointPreviewCrop[1] = new PointF();
+            this.mPointPreviewCrop[2] = new PointF();
+            this.mPointPreviewCrop[3] = new PointF();
+            this.mPointPreviewTouch = new PointF();
+            this.mSelectArea = -1;
+        }
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.ImageCollectView$DataEnhanceText */
+    class DataEnhanceText {
+        DataEnhanceText() {
+        }
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.ImageCollectView$DataColorAdjust */
+    class DataColorAdjust {
+        public List<List<PointF>> mPointArray;
+        public List<List<PointF>> mPointEdgeArray;
+        public List<PointF> mPointMoveArray;
+
+        DataColorAdjust() {
+            this.mPointArray = null;
+            this.mPointMoveArray = null;
+            this.mPointEdgeArray = null;
+            this.mPointArray = new ArrayList();
+            this.mPointMoveArray = new ArrayList();
+            this.mPointEdgeArray = new ArrayList();
+        }
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.ImageCollectView$DataDrawPreview */
+    class DataDrawPreview {
+        public BitmapDrawable mBitmapDrawable;
+        public Matrix mMatrixBitmap;
+        public PointF mPointInitOffset;
+        public PointF[] mPointMoveDeff;
+        public PointF mPointMovePoint;
+        public RectF mRectBitmap;
+        public RectF mRectDrawScale;
+        public float[] mScale;
+
+        DataDrawPreview() {
+            this.mBitmapDrawable = null;
+            this.mMatrixBitmap = null;
+            this.mRectBitmap = null;
+            this.mRectDrawScale = null;
+            this.mPointInitOffset = null;
+            this.mPointMovePoint = null;
+            this.mPointMoveDeff = null;
+            this.mMatrixBitmap = new Matrix();
+            this.mRectBitmap = new RectF(0.0f, 0.0f, 0.0f, 0.0f);
+            this.mRectDrawScale = new RectF(0.0f, 0.0f, 0.0f, 0.0f);
+            this.mPointInitOffset = new PointF();
+            this.mPointMovePoint = new PointF(0.0f, 0.0f);
+            this.mPointMoveDeff = new PointF[2];
+            this.mPointMoveDeff[0] = new PointF(0.0f, 0.0f);
+            this.mPointMoveDeff[1] = new PointF(0.0f, 0.0f);
+            this.mScale = new float[2];
+            float[] fArr = this.mScale;
+            fArr[0] = 1.0f;
+            fArr[1] = 1.0f;
+        }
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.ImageCollectView$Data */
+    class Data {
+
+        /* renamed from: d */
+        public C0884D[] f133d;
+        /* access modifiers changed from: private */
+        public boolean mFlagScale;
+        public Paint mPaintCropCircleDeselected;
+        public Paint mPaintCropCircleSelect;
+        public Paint mPaintCropLine;
+        public Paint mPaintCropMovableArea;
+        public Paint mPaintCropTapArea;
+        public Paint mPaintDragEdge;
+        public Paint mPaintDragMask;
+        public Paint mPaintDragOff;
+        public Paint mPaintDragOn;
+        public Paint mPaintImageArea;
+        public Paint mPaintMessageArea;
+        public Paint mPaintPreviewImage;
+        public Paint mPaintTextMessage;
+        public Paint mPaintView;
+        public PointF[] mPointCrop;
+        public PointF[] mPointViewMargine;
+        public float mRadiusCropCircle;
+        public boolean mShowTextMessage;
+        float mStrokeWidth;
+        public String mTextMessage;
+        public TimerCropImageCropCircle mTimerCropImageCropCircle;
+        public int mTouchState;
+
+        /* renamed from: com.epson.cameracopy.ui.ImageCollectView$Data$D */
+        class C0884D {
+            public DataColorAdjust dca = null;
+            public DataCropImage dcm = null;
+            public DataDrawPreview[] ddp = null;
+            public DataEnhanceText det = null;
+            public float[] mBaseScale;
+            public PointF mPointPreviewImageOffset = null;
+            public RectF mRectImageArea = null;
+            public RectF mRectMessageArea = null;
+            public RectF mRectPreviewImage = null;
+            public RectF mRectView = null;
+
+            public C0884D() {
+                this.dcm = new DataCropImage();
+                this.det = new DataEnhanceText();
+                this.dca = new DataColorAdjust();
+                this.ddp = new DataDrawPreview[4];
+                this.ddp[0] = new DataDrawPreview();
+                this.ddp[1] = new DataDrawPreview();
+                this.ddp[2] = new DataDrawPreview();
+                this.ddp[3] = new DataDrawPreview();
+                this.mRectView = new RectF();
+                this.mRectImageArea = new RectF();
+                this.mRectPreviewImage = new RectF();
+                this.mRectMessageArea = new RectF();
+                this.mPointPreviewImageOffset = new PointF();
+                this.mBaseScale = new float[2];
+                float[] fArr = this.mBaseScale;
+                fArr[0] = 1.0f;
+                fArr[1] = 1.0f;
+            }
+        }
+
+        public Data() {
+            this.f133d = null;
+            this.mPointCrop = null;
+            this.mPaintView = null;
+            this.mPaintPreviewImage = null;
+            this.mPaintImageArea = null;
+            this.mPaintCropLine = null;
+            this.mPaintCropCircleSelect = null;
+            this.mPaintCropCircleDeselected = null;
+            this.mPaintDragOn = null;
+            this.mPaintDragOff = null;
+            this.mPaintDragMask = null;
+            this.mPaintDragEdge = null;
+            this.mPaintCropTapArea = null;
+            this.mPaintCropMovableArea = null;
+            this.mPointViewMargine = null;
+            this.mTimerCropImageCropCircle = null;
+            this.mTextMessage = null;
+            this.mPaintTextMessage = null;
+            this.mPaintMessageArea = null;
+            this.mFlagScale = false;
+            this.f133d = new C0884D[2];
+            this.f133d[0] = new C0884D();
+            this.f133d[1] = new C0884D();
+            this.mPointCrop = new PointF[4];
+            this.mPointCrop[0] = new PointF();
+            this.mPointCrop[1] = new PointF();
+            this.mPointCrop[2] = new PointF();
+            this.mPointCrop[3] = new PointF();
+            this.mPaintView = new Paint();
+            this.mPaintPreviewImage = new Paint();
+            this.mPaintImageArea = new Paint();
+            this.mPaintCropLine = new Paint();
+            this.mPaintCropCircleSelect = new Paint();
+            this.mPaintCropCircleDeselected = new Paint();
+            this.mPaintDragOn = new Paint();
+            this.mPaintDragOff = new Paint();
+            this.mPaintDragMask = new Paint();
+            this.mPaintDragEdge = new Paint();
+            this.mPaintCropTapArea = new Paint();
+            this.mPaintCropMovableArea = new Paint();
+            this.mPointViewMargine = new PointF[4];
+            this.mTextMessage = "";
+            this.mPaintTextMessage = new Paint();
+            this.mPaintMessageArea = new Paint();
+            this.mTouchState = -1;
+        }
+    }
+
+    public ImageCollectView(Context context) {
+        super(context);
+        if (!isInEditMode()) {
+            init(context);
+        }
+    }
+
+    public ImageCollectView(Context context, AttributeSet attributeSet) {
+        super(context, attributeSet);
+        if (!isInEditMode()) {
+            init(context);
+        }
+    }
+
+    public ImageCollectView(Context context, AttributeSet attributeSet, int i) {
+        super(context, attributeSet, i);
+        if (!isInEditMode()) {
+            init(context);
+        }
+    }
+
+    private void init(Context context) {
+        this.mContext = context;
+        DisplayMetrics displayMetrics = new DisplayMetrics();
+        ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
+        float f = displayMetrics.density;
+        float f2 = RADIUS_CROP_CIRCLE * f;
+        float f3 = VIEW_MARGINE * f;
+        float f4 = 20.0f * f;
+        this.mData = new Data();
+        Data data = this.mData;
+        data.mStrokeWidth = f4;
+        data.mRadiusCropCircle = f2;
+        float f5 = f2 + f3;
+        data.mPointViewMargine[0] = new PointF(f5, f5);
+        this.mData.mPointViewMargine[1] = new PointF(f3, f3);
+        this.mData.mPointViewMargine[2] = new PointF(f3, f3);
+        this.mData.mPointViewMargine[3] = new PointF(f3, f3);
+        this.mData.mPaintView.setStyle(Paint.Style.STROKE);
+        this.mData.mPaintView.setColor(-65281);
+        this.mData.mPaintView.setStrokeWidth(2.0f);
+        this.mData.mPaintImageArea.setStyle(Paint.Style.STROKE);
+        this.mData.mPaintImageArea.setColor(InputDeviceCompat.SOURCE_ANY);
+        this.mData.mPaintPreviewImage.setStyle(Paint.Style.STROKE);
+        this.mData.mPaintPreviewImage.setColor(-16776961);
+        this.mData.mPaintCropLine.setStyle(Paint.Style.STROKE);
+        this.mData.mPaintCropLine.setColor(-16711936);
+        this.mData.mPaintCropLine.setStrokeWidth(2.0f);
+        this.mData.mPaintCropCircleSelect.setStyle(Paint.Style.STROKE);
+        this.mData.mPaintCropCircleSelect.setColor(SupportMenu.CATEGORY_MASK);
+        this.mData.mPaintCropCircleDeselected.setStyle(Paint.Style.FILL);
+        this.mData.mPaintCropCircleDeselected.setColor(Color.argb(76, 255, 0, 0));
+        this.mData.mPaintDragOn.setStyle(Paint.Style.STROKE);
+        this.mData.mPaintDragOn.setColor(Color.argb(76, 0, 255, 0));
+        this.mData.mPaintDragOn.setStrokeWidth(f4);
+        this.mData.mPaintDragOn.setStrokeCap(Paint.Cap.ROUND);
+        this.mData.mPaintDragOff.setStyle(Paint.Style.STROKE);
+        this.mData.mPaintDragOff.setColor(Color.argb(76, 0, 0, 255));
+        this.mData.mPaintDragOff.setStrokeWidth(f4);
+        this.mData.mPaintDragOff.setStrokeCap(Paint.Cap.ROUND);
+        this.mData.mPaintDragMask.setStyle(Paint.Style.STROKE);
+        this.mData.mPaintDragMask.setColor(-1);
+        this.mData.mPaintDragMask.setStrokeWidth(f4);
+        this.mData.mPaintDragMask.setStrokeCap(Paint.Cap.ROUND);
+        this.mData.mPaintDragEdge.setStyle(Paint.Style.STROKE);
+        this.mData.mPaintDragEdge.setColor(SupportMenu.CATEGORY_MASK);
+        this.mData.mPaintDragEdge.setStrokeWidth(1.0f * f);
+        this.mData.mPaintCropTapArea.setStyle(Paint.Style.STROKE);
+        this.mData.mPaintCropTapArea.setColor(-1147154);
+        this.mData.mPaintCropTapArea.setStrokeWidth(3.0f);
+        this.mData.mPaintCropMovableArea.setStyle(Paint.Style.STROKE);
+        this.mData.mPaintCropMovableArea.setColor(-16711681);
+        this.mData.mPaintTextMessage.setTextAlign(Paint.Align.CENTER);
+        this.mData.mPaintTextMessage.setTextSize(f * MESSAGE_TEXT_SIZE);
+        this.mData.mPaintTextMessage.setColor(SupportMenu.CATEGORY_MASK);
+        this.mData.mPaintTextMessage.setAntiAlias(true);
+        this.mData.mPaintMessageArea.setStyle(Paint.Style.FILL_AND_STROKE);
+        this.mData.mPaintMessageArea.setColor(-855638017);
+        this.mData.mTimerCropImageCropCircle = new TimerCropImageCropCircle();
+        this.mGestureDetector = new GestureDetector(context, this.onGestureDetectorListener);
+        this.mScaleGestureDetector = new ScaleGestureDetector(context, this.onScaleGestureDetector);
+        this.mPathEffectData = new PathEffectData(this);
+    }
+
+    public void SetViewMode(int i) {
+        this.mViewMode = i;
+        if (this.mViewMode == 3) {
+            if (this.mData.f133d[this.mOrient].dca.mPointArray != null) {
+                for (List<PointF> clear : this.mData.f133d[this.mOrient].dca.mPointArray) {
+                    clear.clear();
+                }
+                this.mData.f133d[this.mOrient].dca.mPointArray.clear();
+            }
+            if (this.mBitmapImage != null) {
+                Bitmap bitmap = this.mBitmapMask;
+                if (bitmap != null) {
+                    bitmap.recycle();
+                }
+                this.mBitmapMask = Bitmap.createBitmap(this.mBitmapImage.getWidth(), this.mBitmapImage.getHeight(), Bitmap.Config.ARGB_8888);
+                this.mCanvasMask = new Canvas(this.mBitmapMask);
+            }
+        }
+    }
+
+    public void SetMessage(String str) {
+        this.mData.mTextMessage = new String(str);
+    }
+
+    public void SetHandler(Handler handler) {
+        this.mHandlerAvtivity = handler;
+    }
+
+    public void SetPreviewBitmapAndCropData(Bitmap bitmap, PointF[] pointFArr) {
+        this.mGetCropPoint = true;
+        if (pointFArr == null || pointFArr.length != 4) {
+            for (int i = 0; i < 4; i++) {
+                this.mData.mPointCrop[i].set(0.0f, 0.0f);
+            }
+        } else {
+            this.mData.mPointCrop[0].set(pointFArr[0]);
+            this.mData.mPointCrop[1].set(pointFArr[3]);
+            this.mData.mPointCrop[2].set(pointFArr[2]);
+            this.mData.mPointCrop[3].set(pointFArr[1]);
+        }
+        SetPreviewBitmap(bitmap);
+    }
+
+    public void SetPreviewBitmapAndCropData(Bitmap bitmap) {
+        for (int i = 0; i < 4; i++) {
+            this.mData.mPointCrop[i].set(0.0f, 0.0f);
+        }
+        SetPreviewBitmap(bitmap);
+    }
+
+    private void SetPreviewBitmap(Bitmap bitmap) {
+        if (this.mBitmapImage != null) {
+            ReleaseBitmap();
+        }
+        this.mBitmapImage = bitmap;
+        ResetScalePos(false);
+        invalidate();
+    }
+
+    public List<List<PointF>> GetBcscPointArray() {
+        return ClontPointArray(this.mData.f133d[this.mOrient].dca.mPointArray);
+    }
+
+    public float GetBcscScale() {
+        return this.mData.f133d[this.mOrient].mBaseScale[1];
+    }
+
+    public float GetBcscStrokeWidth() {
+        return this.mData.mStrokeWidth;
+    }
+
+    public Bitmap GetMaskImage() {
+        return this.mBitmapMask;
+    }
+
+    public void SetMaskEdge(List<List<PointF>> list) {
+        this.mData.f133d[this.mOrient].dca.mPointEdgeArray.clear();
+        for (List<PointF> next : list) {
+            if (next.size() > 0) {
+                ArrayList arrayList = new ArrayList();
+                for (PointF pointF : next) {
+                    arrayList.add(new PointF(pointF.x * this.mData.f133d[this.mOrient].mBaseScale[1], pointF.y * this.mData.f133d[this.mOrient].mBaseScale[1]));
+                }
+                this.mData.f133d[this.mOrient].dca.mPointEdgeArray.add(arrayList);
+            }
+        }
+        invalidate();
+    }
+
+    public void MessageOff() {
+        this.mData.mTimerCropImageCropCircle.TimerOff();
+    }
+
+    public void ReleaseResource() {
+        ReleaseBitmap();
+        ReleaseMask();
+        PathEffectData pathEffectData = this.mPathEffectData;
+        if (pathEffectData != null) {
+            pathEffectData.Cleanup();
+        }
+    }
+
+    public void ReleaseBitmap() {
+        for (int i = 0; i < 2; i++) {
+            for (int i2 = 0; i2 < this.mData.f133d[i].ddp.length; i2++) {
+                if (this.mData.f133d[i].ddp[i2].mBitmapDrawable != null) {
+                    this.mData.f133d[i].ddp[i2].mBitmapDrawable = null;
+                }
+            }
+        }
+        this.mBitmapImage = null;
+    }
+
+    public void ReleaseMask() {
+        Bitmap bitmap = this.mBitmapMask;
+        if (bitmap != null) {
+            bitmap.recycle();
+            this.mBitmapMask = null;
+            this.mCanvasMask = null;
+        }
+    }
+
+    public PointF[] GetCropPoint() {
+        PointF[] pointFArr = new PointF[4];
+        PointF[] pointFArr2 = new PointF[4];
+        for (int i = 0; i < 4; i++) {
+            pointFArr2[i] = new PointF();
+            pointFArr2[i].x = (this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i].x - this.mData.f133d[this.mOrient].mPointPreviewImageOffset.x) / this.mData.f133d[this.mOrient].mBaseScale[1];
+            pointFArr2[i].y = (this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i].y - this.mData.f133d[this.mOrient].mPointPreviewImageOffset.y) / this.mData.f133d[this.mOrient].mBaseScale[1];
+        }
+        float width = (float) this.mBitmapImage.getWidth();
+        float height = (float) this.mBitmapImage.getHeight();
+        if (pointFArr2[0].x < 0.0f) {
+            pointFArr2[0].x = 0.0f;
+        }
+        if (pointFArr2[0].y < 0.0f) {
+            pointFArr2[0].y = 0.0f;
+        }
+        if (pointFArr2[1].x > width) {
+            pointFArr2[1].x = width;
+        }
+        if (pointFArr2[1].y < 0.0f) {
+            pointFArr2[1].y = 0.0f;
+        }
+        if (pointFArr2[2].x > width) {
+            pointFArr2[2].x = width;
+        }
+        if (pointFArr2[2].y > height) {
+            pointFArr2[2].y = height;
+        }
+        if (pointFArr2[3].x < 0.0f) {
+            pointFArr2[3].x = 0.0f;
+        }
+        if (pointFArr2[3].y > height) {
+            pointFArr2[3].y = height;
+        }
+        pointFArr[0] = pointFArr2[0];
+        pointFArr[1] = pointFArr2[3];
+        pointFArr[2] = pointFArr2[2];
+        pointFArr[3] = pointFArr2[1];
+        return pointFArr;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onSizeChanged(int i, int i2, int i3, int i4) {
+        int i5;
+        Context context = this.mContext;
+        if (context != null) {
+            int rotation = ((Activity) context).getWindowManager().getDefaultDisplay().getRotation();
+            i5 = (rotation == 1 || rotation == 3) ? 1 : 0;
+        } else {
+            i5 = 0;
+        }
+        boolean z = (i3 == 0 || this.mOrient == i5) ? false : true;
+        this.mOrient = i5;
+        Data data = this.mData;
+        if (data != null && data.f133d != null && this.mData.f133d[this.mOrient].mRectView != null) {
+            boolean z2 = (!z && this.mData.f133d[this.mOrient].mRectView.right == ((float) i) && this.mData.f133d[this.mOrient].mRectView.bottom == ((float) i2)) ? false : true;
+            this.mData.f133d[this.mOrient].mRectView.set(0.0f, 0.0f, (float) i, (float) i2);
+            float f = this.mData.mPointViewMargine[this.mViewMode].x;
+            float f2 = this.mData.mPointViewMargine[this.mViewMode].y;
+            this.mData.f133d[this.mOrient].mRectImageArea.set(this.mData.f133d[this.mOrient].mRectView.left + f, this.mData.f133d[this.mOrient].mRectView.top + f2, this.mData.f133d[this.mOrient].mRectView.right - f, this.mData.f133d[this.mOrient].mRectView.bottom - f2);
+            float f3 = this.mData.f133d[z ? this.INVERT[this.mOrient] : this.mOrient].mBaseScale[1];
+            GetPreviewImage();
+            float f4 = this.mData.f133d[this.mOrient].mBaseScale[1] / f3;
+            if (z) {
+                int i6 = this.mViewMode;
+                if (i6 == 0) {
+                    if (this.mGetCropPoint && this.mData.f133d[this.INVERT[this.mOrient]].dcm.mPointPreviewCrop[3].y != 0.0f) {
+                        for (int i7 = 0; i7 < 4; i7++) {
+                            this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i7].x = ((this.mData.f133d[this.INVERT[this.mOrient]].dcm.mPointPreviewCrop[i7].x - this.mData.f133d[this.INVERT[this.mOrient]].mPointPreviewImageOffset.x) * f4) + this.mData.f133d[this.mOrient].mPointPreviewImageOffset.x;
+                            this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i7].y = ((this.mData.f133d[this.INVERT[this.mOrient]].dcm.mPointPreviewCrop[i7].y - this.mData.f133d[this.INVERT[this.mOrient]].mPointPreviewImageOffset.y) * f4) + this.mData.f133d[this.mOrient].mPointPreviewImageOffset.y;
+                        }
+                        DataCropImage dataCropImage = this.mData.f133d[this.mOrient].dcm;
+                        this.mData.f133d[this.INVERT[this.mOrient]].dcm.mSelectArea = -1;
+                        dataCropImage.mSelectArea = -1;
+                    }
+                } else if (i6 == 1) {
+                    this.mData.f133d[this.mOrient].ddp[this.mViewMode].mScale[1] = this.mData.f133d[this.INVERT[this.mOrient]].ddp[this.mViewMode].mScale[1];
+                    this.mData.f133d[this.mOrient].ddp[this.mViewMode].mScale[0] = this.mData.f133d[this.INVERT[this.mOrient]].ddp[this.mViewMode].mScale[0];
+                    this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[1].x = this.mData.f133d[this.INVERT[this.mOrient]].ddp[this.mViewMode].mPointMoveDeff[1].x * f4;
+                    this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[1].y = this.mData.f133d[this.INVERT[this.mOrient]].ddp[this.mViewMode].mPointMoveDeff[1].y * f4;
+                    this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[0].x = this.mData.f133d[this.INVERT[this.mOrient]].ddp[this.mViewMode].mPointMoveDeff[0].x * f4;
+                    this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[0].y = this.mData.f133d[this.INVERT[this.mOrient]].ddp[this.mViewMode].mPointMoveDeff[0].y * f4;
+                    DrawPreviewImageCalcMatrix(new Matrix());
+                    DrawPreviewImagePointCheck(true);
+                }
+            }
+            if (z2 && f4 != 0.0f && this.mViewMode == 3) {
+                if (z) {
+                    this.mData.f133d[this.mOrient].dca.mPointArray = ClontPointArray(this.mData.f133d[this.INVERT[this.mOrient]].dca.mPointArray);
+                    this.mData.f133d[this.mOrient].dca.mPointEdgeArray = ClontPointArray(this.mData.f133d[this.INVERT[this.mOrient]].dca.mPointEdgeArray);
+                }
+                if (this.mData.f133d[this.mOrient].dca.mPointArray != null) {
+                    for (List<PointF> it : this.mData.f133d[this.mOrient].dca.mPointArray) {
+                        for (PointF pointF : it) {
+                            pointF.x *= f4;
+                            pointF.y *= f4;
+                        }
+                    }
+                }
+                if (this.mData.f133d[this.mOrient].dca.mPointEdgeArray != null) {
+                    for (List<PointF> it2 : this.mData.f133d[this.mOrient].dca.mPointEdgeArray) {
+                        for (PointF pointF2 : it2) {
+                            pointF2.x *= f4;
+                            pointF2.y *= f4;
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    private List<List<PointF>> ClontPointArray(List<List<PointF>> list) {
+        ArrayList arrayList = new ArrayList();
+        if (list != null) {
+            for (List<PointF> it : list) {
+                ArrayList arrayList2 = new ArrayList();
+                for (PointF add : it) {
+                    arrayList2.add(add);
+                }
+                arrayList.add(arrayList2);
+            }
+        }
+        return arrayList;
+    }
+
+    public void onDraw(Canvas canvas) {
+        super.onDraw(canvas);
+        Data data = this.mData;
+        if (data != null && data.f133d != null) {
+            GetPreviewImage();
+            int i = this.mViewMode;
+            if (i == 0) {
+                DrawCropImage(canvas);
+            } else if (i == 1) {
+                DrawEnhanceText(canvas);
+            } else if (i == 2) {
+                DrawColorAdjustmentAll(canvas);
+            } else if (i == 3) {
+                DrawColorAdjustmentPart(canvas);
+            }
+        }
+    }
+
+    private void DrawCropImage(Canvas canvas) {
+        DrawPreviewImage(canvas);
+        GetPreviewCropPoint();
+        if (this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[3].y != 0.0f) {
+            canvas.drawLine(this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[0].x, this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[0].y, this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[1].x, this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[1].y, this.mData.mPaintCropLine);
+            canvas.drawLine(this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[1].x, this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[1].y, this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[2].x, this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[2].y, this.mData.mPaintCropLine);
+            canvas.drawLine(this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[2].x, this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[2].y, this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[3].x, this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[3].y, this.mData.mPaintCropLine);
+            canvas.drawLine(this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[3].x, this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[3].y, this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[0].x, this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[0].y, this.mData.mPaintCropLine);
+            for (int i = 0; i < 4; i++) {
+                if (i == this.mData.f133d[this.mOrient].dcm.mSelectArea) {
+                    canvas.drawCircle(this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i].x, this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i].y, this.mData.mRadiusCropCircle, this.mData.mPaintCropCircleSelect);
+                } else {
+                    canvas.drawCircle(this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i].x, this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i].y, this.mData.mRadiusCropCircle, this.mData.mPaintCropCircleDeselected);
+                }
+            }
+        }
+    }
+
+    private void DrawEnhanceText(Canvas canvas) {
+        DrawPreviewImage(canvas);
+    }
+
+    private void DrawColorAdjustmentAll(Canvas canvas) {
+        DrawPreviewImage(canvas);
+        this.mData.mPaintDragEdge.setPathEffect(this.mPathEffectData.BlinkingIndex((RectF) null));
+        canvas.drawRect(this.mData.f133d[this.mOrient].mRectPreviewImage, this.mData.mPaintDragEdge);
+    }
+
+    private void DrawColorAdjustmentPart(Canvas canvas) {
+        DrawPreviewImage(canvas);
+        float f = this.mData.f133d[this.mOrient].mRectPreviewImage.left;
+        float f2 = this.mData.f133d[this.mOrient].mRectPreviewImage.top;
+        float f3 = this.mData.f133d[this.mOrient].mBaseScale[1];
+        Path path = new Path();
+        Path path2 = new Path();
+        this.mData.mPaintDragOn.setStrokeWidth(this.mData.mStrokeWidth * f3);
+        for (List next : this.mData.f133d[this.mOrient].dca.mPointArray) {
+            if (next.size() > 0) {
+                PointF pointF = (PointF) next.get(0);
+                if (next.size() > 1) {
+                    path.moveTo(pointF.x + f, pointF.y + f2);
+                    path2.moveTo(pointF.x / f3, pointF.y / f3);
+                    for (int i = 1; i < next.size(); i++) {
+                        PointF pointF2 = (PointF) next.get(i);
+                        path.lineTo(pointF2.x + f, pointF2.y + f2);
+                        path2.lineTo(pointF2.x / f3, pointF2.y / f3);
+                    }
+                }
+            }
+        }
+        if (this.mData.mTouchState == 0) {
+            int size = this.mData.f133d[this.mOrient].dca.mPointMoveArray.size();
+            if (size > 0) {
+                PointF pointF3 = this.mData.f133d[this.mOrient].dca.mPointMoveArray.get(0);
+                if (size > 1) {
+                    path.moveTo(pointF3.x + f, pointF3.y + f2);
+                    for (int i2 = 1; i2 < size; i2++) {
+                        PointF pointF4 = this.mData.f133d[this.mOrient].dca.mPointMoveArray.get(i2);
+                        path.lineTo(pointF4.x + f, pointF4.y + f2);
+                    }
+                }
+            }
+            if (!path.isEmpty()) {
+                canvas.drawPath(path, this.mData.mPaintDragOn);
+            }
+        } else if (path.isEmpty()) {
+        } else {
+            if (this.mData.mTouchState == 1) {
+                this.mData.mTouchState = -1;
+                if (this.mCanvasMask != null) {
+                    if (!path2.isEmpty()) {
+                        this.mCanvasMask.drawPath(path2, this.mData.mPaintDragMask);
+                    }
+                    this.mHandlerAvtivity.sendEmptyMessage(301);
+                }
+            } else if (this.mData.f133d[this.mOrient].dca.mPointEdgeArray != null && !this.mData.f133d[this.mOrient].dca.mPointEdgeArray.isEmpty()) {
+                Path path3 = new Path();
+                this.mData.mPaintDragEdge.setPathEffect(this.mPathEffectData.BlinkingIndex((RectF) null));
+                for (List next2 : this.mData.f133d[this.mOrient].dca.mPointEdgeArray) {
+                    if (next2.size() > 0) {
+                        PointF pointF5 = (PointF) next2.get(0);
+                        float f4 = pointF5.x + f;
+                        float f5 = pointF5.y + f2;
+                        path3.moveTo(f4, f5);
+                        for (int i3 = 1; i3 < next2.size(); i3++) {
+                            PointF pointF6 = (PointF) next2.get(i3);
+                            path3.lineTo(pointF6.x + f, pointF6.y + f2);
+                        }
+                        path3.lineTo(f4, f5);
+                    }
+                    canvas.drawPath(path3, this.mData.mPaintDragEdge);
+                    path3.reset();
+                }
+            }
+        }
+    }
+
+    private void DrawPreviewImage(Canvas canvas) {
+        if (this.mBitmapImage != null) {
+            BitmapDrawable bitmapDrawable = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mBitmapDrawable;
+            if (bitmapDrawable == null) {
+                bitmapDrawable = DrawPreviewImageGetDrawable(this.mBitmapImage, this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectBitmap);
+                this.mData.f133d[this.mOrient].ddp[this.mViewMode].mBitmapDrawable = bitmapDrawable;
+            }
+            if (bitmapDrawable != null && DrawPreviewImageGetMatrix(this.mData.f133d[this.mOrient].ddp[this.mViewMode].mMatrixBitmap)) {
+                canvas.save();
+                canvas.concat(this.mData.f133d[this.mOrient].ddp[this.mViewMode].mMatrixBitmap);
+                bitmapDrawable.draw(canvas);
+                canvas.restore();
+            }
+        }
+    }
+
+    private BitmapDrawable DrawPreviewImageGetDrawable(Bitmap bitmap, RectF rectF) {
+        if (bitmap == null) {
+            return null;
+        }
+        BitmapDrawable bitmapDrawable = new BitmapDrawable(getResources(), bitmap);
+        rectF.set(0.0f, 0.0f, (float) bitmap.getWidth(), (float) bitmap.getHeight());
+        bitmapDrawable.setBounds(new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()));
+        return bitmapDrawable;
+    }
+
+    private boolean DrawPreviewImageGetMatrix(Matrix matrix) {
+        DrawPreviewImageCalcMatrix(matrix);
+        if (this.mViewMode == 1 && DrawPreviewImagePointCheck(this.mData.mFlagScale)) {
+            DrawPreviewImageCalcMatrix(matrix);
+        }
+        return true;
+    }
+
+    private boolean DrawPreviewImagePointCheck(boolean z) {
+        boolean z2;
+        boolean z3;
+        boolean z4;
+        float f;
+        float f2;
+        if (z) {
+            if (this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.width() < this.mData.f133d[this.mOrient].mRectView.width()) {
+                f = (this.mData.f133d[this.mOrient].mRectView.left + ((this.mData.f133d[this.mOrient].mRectView.width() - this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.width()) / 2.0f)) - this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.left;
+            } else {
+                f = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.left > this.mData.f133d[this.mOrient].mRectView.left ? this.mData.f133d[this.mOrient].mRectView.left - this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.left : 0.0f;
+                if (this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.right < this.mData.f133d[this.mOrient].mRectView.right) {
+                    f = this.mData.f133d[this.mOrient].mRectView.right - this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.right;
+                }
+            }
+            if (this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.height() < this.mData.f133d[this.mOrient].mRectView.height()) {
+                f2 = (this.mData.f133d[this.mOrient].mRectView.top + ((this.mData.f133d[this.mOrient].mRectView.height() - this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.height()) / 2.0f)) - this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.top;
+            } else {
+                f2 = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.top > this.mData.f133d[this.mOrient].mRectView.top ? this.mData.f133d[this.mOrient].mRectView.top - this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.top : 0.0f;
+                if (this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.bottom < this.mData.f133d[this.mOrient].mRectView.bottom) {
+                    f2 = this.mData.f133d[this.mOrient].mRectView.bottom - this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.bottom;
+                }
+            }
+            if (f == 0.0f && f2 == 0.0f) {
+                return false;
+            }
+            PointF pointF = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[0];
+            PointF pointF2 = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[1];
+            float f3 = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[1].x + f;
+            pointF2.x = f3;
+            pointF.x = f3;
+            PointF pointF3 = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[0];
+            PointF pointF4 = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[1];
+            float f4 = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[1].y + f2;
+            pointF4.y = f4;
+            pointF3.y = f4;
+            return true;
+        }
+        if (this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.width() < this.mData.f133d[this.mOrient].mRectView.width()) {
+            this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[0].x = 0.0f;
+            z2 = true;
+        } else {
+            z2 = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.left > this.mData.f133d[this.mOrient].mRectView.left;
+            if (this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.right < this.mData.f133d[this.mOrient].mRectView.right) {
+                z2 = true;
+            }
+        }
+        if (this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.height() < this.mData.f133d[this.mOrient].mRectView.height()) {
+            this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[0].y = 0.0f;
+            z3 = true;
+        } else {
+            z3 = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.top > this.mData.f133d[this.mOrient].mRectView.top;
+            if (this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.bottom < this.mData.f133d[this.mOrient].mRectView.bottom) {
+                z3 = true;
+            }
+        }
+        if (z2) {
+            this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[1].x = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[0].x;
+            z4 = true;
+        } else {
+            this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[0].x = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[1].x;
+            z4 = false;
+        }
+        if (z3) {
+            this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[1].y = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[0].y;
+            return true;
+        }
+        this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[0].y = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[1].y;
+        return z4;
+    }
+
+    private void DrawPreviewImageCalcMatrix(Matrix matrix) {
+        matrix.reset();
+        float f = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mScale[1] * this.mData.f133d[this.mOrient].mBaseScale[1];
+        matrix.postScale(f, f);
+        matrix.postTranslate(this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointInitOffset.x, this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointInitOffset.y);
+        this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.set(0.0f, 0.0f, this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectBitmap.width(), this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectBitmap.height());
+        matrix.mapRect(this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale);
+        float f2 = -(((this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.height() - this.mData.f133d[this.mOrient].mRectImageArea.height()) / 2.0f) - (this.mData.f133d[this.mOrient].mRectImageArea.top - this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.top));
+        matrix.postTranslate(this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[1].x + (-(((this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.width() - this.mData.f133d[this.mOrient].mRectImageArea.width()) / 2.0f) - (this.mData.f133d[this.mOrient].mRectImageArea.left - this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.left))), this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[1].y + f2);
+        this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale.set(0.0f, 0.0f, this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectBitmap.width(), this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectBitmap.height());
+        matrix.mapRect(this.mData.f133d[this.mOrient].ddp[this.mViewMode].mRectDrawScale);
+    }
+
+    public boolean onTouchEvent(MotionEvent motionEvent) {
+        int i = this.mViewMode;
+        if (i == 0) {
+            TouchEventCropImage(motionEvent);
+        } else if (i == 1) {
+            TouchEventEnhanceText(motionEvent);
+        } else if (i == 2) {
+            TouchEventColorAdjustmentAll(motionEvent);
+        } else if (i == 3) {
+            TouchEventColorAdjustmentPart(motionEvent);
+        }
+        return true;
+    }
+
+    private void TouchEventCropImage(MotionEvent motionEvent) {
+        int TouchEventCropImageHitCheck;
+        switch (motionEvent.getAction() & 255) {
+            case 0:
+                float x = motionEvent.getX();
+                float y = motionEvent.getY();
+                this.mData.mTimerCropImageCropCircle.TimerOff();
+                int TouchEventCropImageHitCheck2 = TouchEventCropImageHitCheck(x, y, true);
+                if (TouchEventCropImageHitCheck2 > -1) {
+                    this.mData.f133d[this.mOrient].dcm.mPointPreviewTouch.set(x, y);
+                    this.mData.f133d[this.mOrient].dcm.mSelectArea = TouchEventCropImageHitCheck2;
+                    return;
+                } else if (this.mData.f133d[this.mOrient].dcm.mSelectArea > -1 && (TouchEventCropImageHitCheck = TouchEventCropImageHitCheck(x, y, false)) > -1) {
+                    this.mData.mTimerCropImageCropCircle.TimerOn(this);
+                    this.mData.f133d[this.mOrient].dcm.mPointPreviewTouch.set(x, y);
+                    this.mData.f133d[this.mOrient].dcm.mSelectArea = TouchEventCropImageHitCheck;
+                    return;
+                } else {
+                    return;
+                }
+            case 1:
+            case 3:
+                if (this.mData.f133d[this.mOrient].dcm.mSelectArea > -1) {
+                    this.mData.mTimerCropImageCropCircle.TimerOn(this);
+                    return;
+                }
+                return;
+            case 2:
+                int i = this.mData.f133d[this.mOrient].dcm.mSelectArea;
+                if (i > -1) {
+                    float x2 = motionEvent.getX();
+                    float y2 = motionEvent.getY();
+                    float f = this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i].x + (x2 - this.mData.f133d[this.mOrient].dcm.mPointPreviewTouch.x);
+                    float f2 = this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i].y + (y2 - this.mData.f133d[this.mOrient].dcm.mPointPreviewTouch.y);
+                    if (!this.mData.f133d[this.mOrient].dcm.mRectCropMovableArea[i].contains(f, f2)) {
+                        if (f < this.mData.f133d[this.mOrient].dcm.mRectCropMovableArea[i].left) {
+                            f = this.mData.f133d[this.mOrient].dcm.mRectCropMovableArea[i].left;
+                        }
+                        if (f2 < this.mData.f133d[this.mOrient].dcm.mRectCropMovableArea[i].top) {
+                            f2 = this.mData.f133d[this.mOrient].dcm.mRectCropMovableArea[i].top;
+                        }
+                        if (f > this.mData.f133d[this.mOrient].dcm.mRectCropMovableArea[i].right) {
+                            f = this.mData.f133d[this.mOrient].dcm.mRectCropMovableArea[i].right;
+                        }
+                        if (f2 > this.mData.f133d[this.mOrient].dcm.mRectCropMovableArea[i].bottom) {
+                            f2 = this.mData.f133d[this.mOrient].dcm.mRectCropMovableArea[i].bottom;
+                        }
+                    }
+                    this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i].x = f;
+                    this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i].y = f2;
+                    this.mData.f133d[this.mOrient].dcm.mPointPreviewTouch.x = x2;
+                    this.mData.f133d[this.mOrient].dcm.mPointPreviewTouch.y = y2;
+                    invalidate();
+                    return;
+                }
+                return;
+            default:
+                return;
+        }
+    }
+
+    private int TouchEventCropImageHitCheck(float f, float f2, boolean z) {
+        int i = 3;
+        while (i > -1) {
+            RectF rectF = new RectF();
+            Path path = new Path();
+            path.addCircle(this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i].x, this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i].y, this.mData.mRadiusCropCircle, Path.Direction.CW);
+            path.computeBounds(rectF, true);
+            Region region = new Region();
+            region.setPath(path, new Region((int) rectF.left, (int) rectF.top, (int) rectF.right, (int) rectF.bottom));
+            boolean contains = region.contains(Math.round(f), Math.round(f2));
+            if (!contains) {
+                if (z) {
+                    contains = this.mData.f133d[this.mOrient].dcm.mRectCropMovableArea[i].contains(f, f2);
+                } else {
+                    contains = this.mData.f133d[this.mOrient].dcm.mRectCropTapArea[i].contains(f, f2);
+                }
+            }
+            if (contains) {
+                break;
+            }
+            i--;
+        }
+        return i;
+    }
+
+    private void TouchEventEnhanceText(MotionEvent motionEvent) {
+        int action = motionEvent.getAction() & 255;
+        int pointerCount = motionEvent.getPointerCount();
+        if (action != 5) {
+            switch (action) {
+                case 0:
+                    if (!this.mData.mFlagScale) {
+                        this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMovePoint.set(motionEvent.getX(), motionEvent.getY());
+                        break;
+                    }
+                    break;
+                case 1:
+                case 3:
+                    boolean unused = this.mData.mFlagScale = false;
+                    break;
+                case 2:
+                    if (!this.mData.mFlagScale) {
+                        float x = motionEvent.getX();
+                        float y = motionEvent.getY();
+                        this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[1].x += x - this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMovePoint.x;
+                        this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[1].y += y - this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMovePoint.y;
+                        this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMovePoint.x = x;
+                        this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMovePoint.y = y;
+                        invalidate();
+                        break;
+                    }
+                    break;
+            }
+        } else {
+            boolean unused2 = this.mData.mFlagScale = true;
+        }
+        if (pointerCount == 1) {
+            this.mGestureDetector.onTouchEvent(motionEvent);
+        }
+        if (pointerCount >= 2) {
+            try {
+                this.mScaleGestureDetector.onTouchEvent(motionEvent);
+            } catch (IllegalArgumentException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    private void TouchEventColorAdjustmentPart(MotionEvent motionEvent) {
+        int action = motionEvent.getAction() & 255;
+        float x = motionEvent.getX();
+        float y = motionEvent.getY();
+        float f = this.mData.f133d[this.mOrient].mRectPreviewImage.left;
+        float f2 = this.mData.f133d[this.mOrient].mRectPreviewImage.top;
+        float f3 = x - f;
+        float f4 = y - f2;
+        switch (action) {
+            case 0:
+                Data data = this.mData;
+                data.mTouchState = 0;
+                data.f133d[this.mOrient].dca.mPointMoveArray.clear();
+                this.mData.f133d[this.mOrient].dca.mPointMoveArray.add(new PointF(f3, f4));
+                return;
+            case 1:
+            case 3:
+                if (this.mData.f133d[this.mOrient].dca.mPointMoveArray.size() > 0) {
+                    ArrayList arrayList = new ArrayList();
+                    for (PointF next : this.mData.f133d[this.mOrient].dca.mPointMoveArray) {
+                        if (this.mData.f133d[this.mOrient].mRectPreviewImage.contains(next.x + f, next.y + f2)) {
+                            arrayList.add(next);
+                        }
+                    }
+                    if (arrayList.size() > 0) {
+                        if (arrayList.size() == 1) {
+                            float f5 = ((PointF) arrayList.get(0)).x;
+                            float f6 = ((PointF) arrayList.get(0)).y;
+                            arrayList.clear();
+                            float f7 = f5 - 1.0f;
+                            float f8 = f6 - 1.0f;
+                            arrayList.add(new PointF(f7, f8));
+                            arrayList.add(new PointF(f5, f8));
+                            float f9 = f5 + 1.0f;
+                            arrayList.add(new PointF(f9, f8));
+                            arrayList.add(new PointF(f9, f6));
+                            float f10 = 1.0f + f6;
+                            arrayList.add(new PointF(f9, f10));
+                            arrayList.add(new PointF(f5, f10));
+                            arrayList.add(new PointF(f7, f10));
+                            arrayList.add(new PointF(f7, f6));
+                        }
+                        this.mData.f133d[this.mOrient].dca.mPointArray.add(arrayList);
+                    }
+                    this.mData.f133d[this.mOrient].dca.mPointMoveArray.clear();
+                }
+                this.mData.mTouchState = 1;
+                invalidate();
+                return;
+            case 2:
+                this.mData.f133d[this.mOrient].dca.mPointMoveArray.add(new PointF(f3, f4));
+                invalidate();
+                return;
+            default:
+                return;
+        }
+    }
+
+    /* access modifiers changed from: private */
+    public void SetScale(float f) {
+        this.mData.f133d[this.mOrient].ddp[this.mViewMode].mScale[0] = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mScale[1];
+        float f2 = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mScale[1] * f;
+        if (f2 < 1.0f) {
+            this.mData.f133d[this.mOrient].ddp[this.mViewMode].mScale[1] = 1.0f;
+        } else if (f2 > SCALE_RANGE_MAX) {
+            this.mData.f133d[this.mOrient].ddp[this.mViewMode].mScale[1] = 4.0f;
+        } else {
+            this.mData.f133d[this.mOrient].ddp[this.mViewMode].mScale[1] = f2;
+        }
+    }
+
+    /* access modifiers changed from: private */
+    public void ResetScalePos(boolean z) {
+        if (z || this.mViewMode != 1) {
+            this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[0].set(0.0f, 0.0f);
+            this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointMoveDeff[1].set(0.0f, 0.0f);
+            float[] fArr = this.mData.f133d[this.mOrient].ddp[this.mViewMode].mScale;
+            this.mData.f133d[this.mOrient].ddp[this.mViewMode].mScale[1] = 1.0f;
+            fArr[0] = 1.0f;
+        }
+        if (this.mViewMode == 0) {
+            this.mData.f133d[this.mOrient].ddp[1].mPointMoveDeff[0].set(0.0f, 0.0f);
+            this.mData.f133d[this.mOrient].ddp[1].mPointMoveDeff[1].set(0.0f, 0.0f);
+            float[] fArr2 = this.mData.f133d[this.mOrient].ddp[1].mScale;
+            this.mData.f133d[this.mOrient].ddp[1].mScale[1] = 1.0f;
+            fArr2[0] = 1.0f;
+        }
+    }
+
+    private void GetPreviewImage() {
+        Bitmap bitmap;
+        Data data = this.mData;
+        if (data != null && data.f133d != null && (bitmap = this.mBitmapImage) != null) {
+            float width = (float) bitmap.getWidth();
+            float height = (float) this.mBitmapImage.getHeight();
+            float width2 = this.mData.f133d[this.mOrient].mRectImageArea.width() / width;
+            float height2 = this.mData.f133d[this.mOrient].mRectImageArea.height() / height;
+            if (width2 >= height2) {
+                width2 = height2;
+            }
+            this.mData.f133d[this.mOrient].mBaseScale[1] = width2;
+            this.mData.f133d[this.mOrient].mRectPreviewImage.set(0.0f, 0.0f, width * width2, height * width2);
+            this.mData.f133d[this.mOrient].mPointPreviewImageOffset.set(this.mData.f133d[this.mOrient].mRectImageArea.left + ((this.mData.f133d[this.mOrient].mRectImageArea.width() - this.mData.f133d[this.mOrient].mRectPreviewImage.width()) / 2.0f), this.mData.f133d[this.mOrient].mRectImageArea.top + ((this.mData.f133d[this.mOrient].mRectImageArea.height() - this.mData.f133d[this.mOrient].mRectPreviewImage.height()) / 2.0f));
+            this.mData.f133d[this.mOrient].mRectPreviewImage.offset(this.mData.f133d[this.mOrient].mPointPreviewImageOffset.x, this.mData.f133d[this.mOrient].mPointPreviewImageOffset.y);
+            float width3 = this.mData.f133d[this.mOrient].mRectPreviewImage.width() / 2.0f;
+            float height3 = this.mData.f133d[this.mOrient].mRectPreviewImage.height() / 2.0f;
+            float width4 = this.mData.f133d[this.mOrient].mRectPreviewImage.width() * 0.05f;
+            float f = this.mData.f133d[this.mOrient].mRectPreviewImage.left + width3;
+            float f2 = this.mData.f133d[this.mOrient].mRectPreviewImage.top + height3;
+            this.mData.f133d[this.mOrient].dcm.mRectCropMovableArea[0].set(this.mData.f133d[this.mOrient].mRectPreviewImage.left, this.mData.f133d[this.mOrient].mRectPreviewImage.top, (this.mData.f133d[this.mOrient].mRectPreviewImage.left + width3) - width4, (this.mData.f133d[this.mOrient].mRectPreviewImage.top + height3) - width4);
+            this.mData.f133d[this.mOrient].dcm.mRectCropMovableArea[1].set((this.mData.f133d[this.mOrient].mRectPreviewImage.right - width3) + width4, this.mData.f133d[this.mOrient].mRectPreviewImage.top, this.mData.f133d[this.mOrient].mRectPreviewImage.right, (this.mData.f133d[this.mOrient].mRectPreviewImage.top + height3) - width4);
+            this.mData.f133d[this.mOrient].dcm.mRectCropMovableArea[2].set((this.mData.f133d[this.mOrient].mRectPreviewImage.right - width3) + width4, (this.mData.f133d[this.mOrient].mRectPreviewImage.bottom - height3) + width4, this.mData.f133d[this.mOrient].mRectPreviewImage.right, this.mData.f133d[this.mOrient].mRectPreviewImage.bottom);
+            this.mData.f133d[this.mOrient].dcm.mRectCropMovableArea[3].set(this.mData.f133d[this.mOrient].mRectPreviewImage.left, (this.mData.f133d[this.mOrient].mRectPreviewImage.bottom - height3) + width4, (this.mData.f133d[this.mOrient].mRectPreviewImage.left + width3) - width4, this.mData.f133d[this.mOrient].mRectPreviewImage.bottom);
+            this.mData.f133d[this.mOrient].dcm.mRectCropTapArea[0].set(this.mData.f133d[this.mOrient].mRectView.left, this.mData.f133d[this.mOrient].mRectView.top, (this.mData.f133d[this.mOrient].mRectPreviewImage.left + width3) - width4, (this.mData.f133d[this.mOrient].mRectPreviewImage.top + height3) - width4);
+            this.mData.f133d[this.mOrient].dcm.mRectCropTapArea[1].set((this.mData.f133d[this.mOrient].mRectPreviewImage.right - width3) + width4, this.mData.f133d[this.mOrient].mRectView.top, this.mData.f133d[this.mOrient].mRectView.right, (this.mData.f133d[this.mOrient].mRectPreviewImage.top + height3) - width4);
+            this.mData.f133d[this.mOrient].dcm.mRectCropTapArea[2].set((this.mData.f133d[this.mOrient].mRectPreviewImage.right - width3) + width4, (this.mData.f133d[this.mOrient].mRectPreviewImage.bottom - height3) + width4, this.mData.f133d[this.mOrient].mRectView.right, this.mData.f133d[this.mOrient].mRectView.bottom);
+            this.mData.f133d[this.mOrient].dcm.mRectCropTapArea[3].set(this.mData.f133d[this.mOrient].mRectView.left, (this.mData.f133d[this.mOrient].mRectPreviewImage.bottom - height3) + width4, (this.mData.f133d[this.mOrient].mRectPreviewImage.left + width3) - width4, this.mData.f133d[this.mOrient].mRectView.bottom);
+            this.mData.f133d[this.mOrient].dcm.mRectCropTapArea[4].set(f - width4, f2 - width4, f + width4, f2 + width4);
+            this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointInitOffset.x = this.mData.f133d[this.mOrient].mPointPreviewImageOffset.x;
+            this.mData.f133d[this.mOrient].ddp[this.mViewMode].mPointInitOffset.y = this.mData.f133d[this.mOrient].mPointPreviewImageOffset.y;
+        }
+    }
+
+    private void GetPreviewCropPoint() {
+        boolean z;
+        Data data = this.mData;
+        if (data != null && data.f133d != null && this.mData.f133d[this.mOrient].dcm != null && this.mBitmapImage != null && this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[3].y == 0.0f) {
+            if (this.mData.mPointCrop[3].y != 0.0f) {
+                for (int i = 0; i < 4; i++) {
+                    this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i].x = (this.mData.mPointCrop[i].x * this.mData.f133d[this.mOrient].mBaseScale[1]) + this.mData.f133d[this.mOrient].mPointPreviewImageOffset.x;
+                    this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i].y = (this.mData.mPointCrop[i].y * this.mData.f133d[this.mOrient].mBaseScale[1]) + this.mData.f133d[this.mOrient].mPointPreviewImageOffset.y;
+                }
+                int i2 = 0;
+                while (true) {
+                    if (i2 >= 4) {
+                        z = false;
+                        break;
+                    } else if (!this.mData.f133d[this.mOrient].dcm.mRectCropMovableArea[i2].contains(this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i2].x, this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[i2].y)) {
+                        z = true;
+                        break;
+                    } else {
+                        i2++;
+                    }
+                }
+            } else {
+                z = true;
+            }
+            if (this.mGetCropPoint && z) {
+                this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[0].x = this.mData.f133d[this.mOrient].mRectPreviewImage.left;
+                this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[0].y = this.mData.f133d[this.mOrient].mRectPreviewImage.top;
+                this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[1].x = this.mData.f133d[this.mOrient].mRectPreviewImage.right;
+                this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[1].y = this.mData.f133d[this.mOrient].mRectPreviewImage.top;
+                this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[2].x = this.mData.f133d[this.mOrient].mRectPreviewImage.right;
+                this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[2].y = this.mData.f133d[this.mOrient].mRectPreviewImage.bottom;
+                this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[3].x = this.mData.f133d[this.mOrient].mRectPreviewImage.left;
+                this.mData.f133d[this.mOrient].dcm.mPointPreviewCrop[3].y = this.mData.f133d[this.mOrient].mRectPreviewImage.bottom;
+            }
+        }
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.ImageCollectView$TimerCropImageTextMessage */
+    class TimerCropImageTextMessage {
+        private static final int CROP_IMAGE_TIMER_LIMIT = 5000;
+        private static final int CROP_IMAGE_TIMER_TIME = 200;
+        private static final int MSG_TIMER_CROP_IMAGE_TEXT_MESSAGE_TIMEOUT = 501;
+        /* access modifiers changed from: private */
+        public boolean mBreak = false;
+        /* access modifiers changed from: private */
+        public Handler mHandlerTimerCropImageTextMessage = new Handler() {
+            public void handleMessage(Message message) {
+                if (message.what == 501) {
+                    ImageCollectView.this.mData.mShowTextMessage = false;
+                    if (TimerCropImageTextMessage.this.mView != null) {
+                        TimerCropImageTextMessage.this.mView.invalidate();
+                    }
+                }
+            }
+        };
+        private Thread mThreadTimer = null;
+        /* access modifiers changed from: private */
+        public View mView = null;
+
+        TimerCropImageTextMessage() {
+        }
+
+        public void TimerOff() {
+            Thread thread = this.mThreadTimer;
+            if (thread != null && thread.isAlive()) {
+                this.mBreak = true;
+                do {
+                } while (this.mThreadTimer.isAlive());
+            }
+        }
+
+        public void Timer(View view) {
+            this.mView = view;
+            if (this.mThreadTimer == null) {
+                this.mThreadTimer = new Thread(new Runnable() {
+                    public void run() {
+                        int i = 0;
+                        while (true) {
+                            if (i >= 25) {
+                                break;
+                            }
+                            try {
+                                if (TimerCropImageTextMessage.this.mBreak) {
+                                    break;
+                                }
+                                Thread.sleep(200);
+                                i++;
+                            } catch (InterruptedException e) {
+                                e.printStackTrace();
+                            }
+                        }
+                        if (TimerCropImageTextMessage.this.mHandlerTimerCropImageTextMessage != null) {
+                            TimerCropImageTextMessage.this.mHandlerTimerCropImageTextMessage.sendEmptyMessage(501);
+                        }
+                    }
+                });
+                this.mThreadTimer.start();
+            }
+        }
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.ImageCollectView$TimerCropImageCropCircle */
+    class TimerCropImageCropCircle {
+        private static final int MSG_TIMER_CROP_IMAGE_CROP_CIRCLE_TIMEOUT = 500;
+        /* access modifiers changed from: private */
+        public boolean mBreak = false;
+        /* access modifiers changed from: private */
+        public Handler mHandlerTimerCropImageCropCircle = new Handler() {
+            public void handleMessage(Message message) {
+                if (message.what == 500) {
+                    ImageCollectView.this.mData.f133d[ImageCollectView.this.mOrient].dcm.mSelectArea = -1;
+                    if (TimerCropImageCropCircle.this.mView != null) {
+                        TimerCropImageCropCircle.this.mView.invalidate();
+                    }
+                }
+            }
+        };
+        /* access modifiers changed from: private */
+        public long mNewTime;
+        /* access modifiers changed from: private */
+        public long mStartTime;
+        private Thread mTimer = null;
+        /* access modifiers changed from: private */
+        public View mView = null;
+
+        TimerCropImageCropCircle() {
+        }
+
+        public void TimerOn(View view) {
+            Thread thread;
+            this.mView = view;
+            Thread thread2 = this.mTimer;
+            if ((thread2 != null && !thread2.isAlive()) || (thread = this.mTimer) == null) {
+                this.mStartTime = System.currentTimeMillis();
+                Timer(2000);
+            } else if (thread != null && thread.isAlive()) {
+                this.mStartTime = System.currentTimeMillis();
+            }
+        }
+
+        public void TimerOff() {
+            Thread thread = this.mTimer;
+            if (thread != null && thread.isAlive()) {
+                this.mBreak = true;
+                do {
+                } while (this.mTimer.isAlive());
+            }
+        }
+
+        private void Timer(final int i) {
+            this.mBreak = false;
+            this.mTimer = new Thread(new Runnable() {
+                public void run() {
+                    while (!TimerCropImageCropCircle.this.mBreak) {
+                        try {
+                            Thread.sleep(100);
+                        } catch (InterruptedException e) {
+                            e.printStackTrace();
+                        }
+                        long unused = TimerCropImageCropCircle.this.mNewTime = System.currentTimeMillis();
+                        if (TimerCropImageCropCircle.this.mStartTime + ((long) i) <= TimerCropImageCropCircle.this.mNewTime) {
+                            break;
+                        }
+                    }
+                    if (!TimerCropImageCropCircle.this.mBreak && TimerCropImageCropCircle.this.mHandlerTimerCropImageCropCircle != null) {
+                        TimerCropImageCropCircle.this.mHandlerTimerCropImageCropCircle.sendEmptyMessage(500);
+                    }
+                }
+            });
+            this.mTimer.start();
+        }
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.ImageCollectView$PathEffectData */
+    private class PathEffectData {
+        private static final int BLINKING_TIME = 500;
+        private static final int DEFAULT_BLINKING_DELAYTIMES = 200;
+        private static final int MSG_INVALIDATE_VIEW = 901;
+        private long mBlinkingDelayTimes = 200;
+        /* access modifiers changed from: private */
+        public boolean mBreak = false;
+        /* access modifiers changed from: private */
+        public Handler mHandlerPathEffectData = new Handler() {
+            public void handleMessage(Message message) {
+                if (message.what != PathEffectData.MSG_INVALIDATE_VIEW || PathEffectData.this.mView == null) {
+                    return;
+                }
+                if (PathEffectData.this.mRectDirty.isEmpty()) {
+                    PathEffectData.this.mView.invalidate();
+                } else {
+                    PathEffectData.this.mView.invalidate(PathEffectData.this.mRectDirty);
+                }
+            }
+        };
+        /* access modifiers changed from: private */
+        public long mNewTime;
+        private int mPathEffectBlinkingIndex = 0;
+        private long mPathEffectBlinkingTime = 0;
+        private PathEffect[] mPathEffectList = new PathEffect[5];
+        /* access modifiers changed from: private */
+        public Rect mRectDirty = new Rect(0, 0, 0, 0);
+        /* access modifiers changed from: private */
+        public long mStartTime;
+        private Thread mTimer = null;
+        /* access modifiers changed from: private */
+        public View mView = null;
+
+        public PathEffectData(View view) {
+            this.mPathEffectList[0] = new DashPathEffect(new float[]{5.0f, 5.0f}, 8.0f);
+            this.mPathEffectList[1] = new DashPathEffect(new float[]{5.0f, 5.0f}, ImageCollectView.VIEW_MARGINE);
+            this.mPathEffectList[2] = new DashPathEffect(new float[]{5.0f, 5.0f}, ImageCollectView.SCALE_RANGE_MAX);
+            this.mPathEffectList[3] = new DashPathEffect(new float[]{5.0f, 5.0f}, 2.0f);
+            this.mPathEffectList[4] = new DashPathEffect(new float[]{5.0f, 5.0f}, 0.0f);
+            this.mView = view;
+        }
+
+        public PathEffect BlinkingIndex(RectF rectF) {
+            long currentTimeMillis = System.currentTimeMillis();
+            if (this.mPathEffectBlinkingTime == 0) {
+                this.mPathEffectBlinkingTime = currentTimeMillis;
+                if (rectF != null) {
+                    this.mRectDirty.left = (int) rectF.left;
+                    this.mRectDirty.top = (int) rectF.top;
+                    this.mRectDirty.right = (int) (rectF.right + 1.0f);
+                    this.mRectDirty.bottom = (int) (rectF.bottom + 1.0f);
+                } else {
+                    this.mRectDirty.setEmpty();
+                }
+            }
+            BlinkOn(0);
+            if (this.mPathEffectBlinkingTime + this.mBlinkingDelayTimes < currentTimeMillis) {
+                int i = this.mPathEffectBlinkingIndex;
+                if (i < this.mPathEffectList.length - 1) {
+                    this.mPathEffectBlinkingIndex = i + 1;
+                } else {
+                    this.mPathEffectBlinkingIndex = 0;
+                }
+                this.mPathEffectBlinkingTime = currentTimeMillis;
+            }
+            return this.mPathEffectList[this.mPathEffectBlinkingIndex];
+        }
+
+        public void Cleanup() {
+            Thread thread = this.mTimer;
+            if (thread == null || !thread.isAlive()) {
+                this.mTimer = null;
+                this.mView = null;
+                this.mPathEffectList = null;
+            }
+            this.mBreak = true;
+            do {
+            } while (this.mTimer.isAlive());
+            this.mTimer = null;
+            this.mView = null;
+            this.mPathEffectList = null;
+        }
+
+        private void BlinkOn(int i) {
+            Thread thread;
+            Thread thread2 = this.mTimer;
+            if ((thread2 != null && !thread2.isAlive()) || (thread = this.mTimer) == null) {
+                this.mStartTime = System.currentTimeMillis();
+                Timer(500);
+            } else if (thread != null && thread.isAlive()) {
+                this.mStartTime = System.currentTimeMillis();
+            }
+        }
+
+        private void Timer(final int i) {
+            this.mBreak = false;
+            this.mTimer = new Thread(new Runnable() {
+                public void run() {
+                    while (!PathEffectData.this.mBreak) {
+                        try {
+                            Thread.sleep(100);
+                        } catch (InterruptedException e) {
+                            e.printStackTrace();
+                        }
+                        long unused = PathEffectData.this.mNewTime = System.currentTimeMillis();
+                        PathEffectData.this.mHandlerPathEffectData.sendEmptyMessage(PathEffectData.MSG_INVALIDATE_VIEW);
+                        if (PathEffectData.this.mStartTime + ((long) i) <= PathEffectData.this.mNewTime) {
+                            return;
+                        }
+                    }
+                }
+            });
+            this.mTimer.start();
+        }
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.ImageCollectView$EPxLog */
+    static class EPxLog {
+        EPxLog() {
+        }
+
+        /* renamed from: d */
+        public static final void m63d(String str, String str2) {
+            Log.d(str, str2);
+        }
+
+        /* renamed from: e */
+        public static final void m64e(String str, String str2) {
+            if (Debug.isDebuggerConnected()) {
+                Log.e(str, str2);
+            }
+        }
+
+        /* renamed from: i */
+        public static final void m65i(String str, String str2) {
+            if (Debug.isDebuggerConnected()) {
+                Log.i(str, str2);
+            }
+        }
+
+        /* renamed from: v */
+        public static final void m66v(String str, String str2) {
+            if (Debug.isDebuggerConnected()) {
+                Log.v(str, str2);
+            }
+        }
+
+        /* renamed from: w */
+        public static final void m67w(String str, String str2) {
+            if (Debug.isDebuggerConnected()) {
+                Log.w(str, str2);
+            }
+        }
+    }
+}

+ 89 - 0
app/src/main/java/com/epson/cameracopy/p006ui/ImageFolderFile.java

@@ -0,0 +1,89 @@
+package com.epson.cameracopy.p006ui;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import com.epson.cameracopy.alt.FileUtils;
+import epson.common.ImageUtil;
+import epson.print.IprintApplication;
+import java.io.File;
+import java.io.IOException;
+import java.io.Serializable;
+
+/* renamed from: com.epson.cameracopy.ui.ImageFolderFile */
+class ImageFolderFile implements ImagePreviewFile, Serializable {
+    private static final long serialVersionUID = 1;
+    private String mConvertFilename;
+    private String mImageFolderFileName;
+    private String mTemporaryFileName;
+
+    public boolean doSave(String str) {
+        return false;
+    }
+
+    public boolean needSaveButton() {
+        return false;
+    }
+
+    public ImageFolderFile(String str) {
+        this.mImageFolderFileName = str;
+    }
+
+    public String getImageProcFileName(Context context) {
+        File newTemporaryJpegFile = FileUtils.getNewTemporaryJpegFile(context);
+        if (!newTemporaryJpegFile.exists()) {
+            try {
+                FileUtils.copy(new File(getPrintFileName()), newTemporaryJpegFile);
+            } catch (IOException unused) {
+                return null;
+            }
+        }
+        this.mTemporaryFileName = newTemporaryJpegFile.toString();
+        return this.mTemporaryFileName;
+    }
+
+    public String getPrintFileName() {
+        String str = this.mConvertFilename;
+        return str != null ? str : this.mImageFolderFileName;
+    }
+
+    public void deleteTemporaryFile() {
+        localDeleteFile(this.mTemporaryFileName);
+        this.mTemporaryFileName = null;
+        localDeleteFile(getHeifToJpegFile(IprintApplication.getInstance()).getPath());
+        this.mConvertFilename = null;
+    }
+
+    private void localDeleteFile(@Nullable String str) {
+        if (str != null) {
+            File file = new File(str);
+            if (file.exists()) {
+                file.delete();
+            }
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public boolean prepareImage(@NonNull Context context) {
+        this.mConvertFilename = null;
+        deleteTemporaryFile();
+        if (!ImageUtil.isHEIFFormat(this.mImageFolderFileName)) {
+            return true;
+        }
+        String path = getHeifToJpegFile(context).getPath();
+        if (!ImageUtil.convertHEIFtoJPEG(this.mImageFolderFileName, path)) {
+            return false;
+        }
+        this.mConvertFilename = path;
+        return true;
+    }
+
+    public boolean needsConvert(@NonNull Context context) {
+        return ImageUtil.isHEIFFormat(this.mImageFolderFileName);
+    }
+
+    @NonNull
+    private File getHeifToJpegFile(@NonNull Context context) {
+        return new File(FileUtils.getCameracopyTempDir(context), "heif_to_jpeg.jpg");
+    }
+}

+ 53 - 0
app/src/main/java/com/epson/cameracopy/p006ui/ImageFolderFileViewModel.java

@@ -0,0 +1,53 @@
+package com.epson.cameracopy.p006ui;
+
+import android.app.Application;
+import android.arch.lifecycle.AndroidViewModel;
+import android.arch.lifecycle.LiveData;
+import android.os.AsyncTask;
+import android.support.annotation.NonNull;
+
+/* renamed from: com.epson.cameracopy.ui.ImageFolderFileViewModel */
+public class ImageFolderFileViewModel extends AndroidViewModel {
+    /* access modifiers changed from: private */
+    public final Application mApplication;
+    /* access modifiers changed from: private */
+    public final ImageFolderFileLiveData mImageFolderFileLiveData = new ImageFolderFileLiveData();
+
+    public ImageFolderFileViewModel(@NonNull Application application) {
+        super(application);
+        this.mApplication = application;
+    }
+
+    public void setOriginalData(@NonNull ImageFolderFile imageFolderFile) {
+        this.mImageFolderFileLiveData.setImageFolderFile(imageFolderFile);
+    }
+
+    public ImageFolderFileLiveData getData() {
+        return this.mImageFolderFileLiveData;
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.ImageFolderFileViewModel$ImageFolderFileLiveData */
+    public class ImageFolderFileLiveData extends LiveData<ImageFolderFile> {
+        public ImageFolderFileLiveData() {
+        }
+
+        public void setImageFolderFile(@NonNull final ImageFolderFile imageFolderFile) {
+            new AsyncTask<Void, Void, ImageFolderFile>() {
+                /* access modifiers changed from: protected */
+                public void onPostExecute(ImageFolderFile imageFolderFile) {
+                    ImageFolderFileViewModel.this.mImageFolderFileLiveData.setValue(imageFolderFile);
+                }
+
+                /* access modifiers changed from: protected */
+                public ImageFolderFile doInBackground(Void... voidArr) {
+                    ImageFolderFile imageFolderFile = imageFolderFile;
+                    if (imageFolderFile == null) {
+                        return null;
+                    }
+                    imageFolderFile.prepareImage(ImageFolderFileViewModel.this.mApplication);
+                    return imageFolderFile;
+                }
+            }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
+        }
+    }
+}

+ 427 - 0
app/src/main/java/com/epson/cameracopy/p006ui/ImagePreviewActivity.java

@@ -0,0 +1,427 @@
+package com.epson.cameracopy.p006ui;
+
+import android.annotation.SuppressLint;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.arch.lifecycle.Observer;
+import android.arch.lifecycle.ViewModelProviders;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.media.ExifInterface;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.p000v4.app.DialogFragment;
+import android.support.p000v4.app.Fragment;
+import android.support.p000v4.app.FragmentActivity;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ProgressBar;
+import com.epson.cameracopy.alt.UiCommon;
+import com.epson.cameracopy.device.CameraFile;
+import com.epson.cameracopy.device.CameraPreviewControl;
+import com.epson.mobilephone.common.wifidirect.NfcTagUtils;
+import epson.common.ImageUtil;
+import epson.common.ScalableImageView;
+import epson.print.ActivityIACommon;
+import epson.print.ActivityRequestPermissions;
+import epson.print.C2135R;
+import epson.print.IprintApplication;
+import epson.print.Util.CommonMessage;
+import java.io.File;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import org.opencv.videoio.Videoio;
+
+/* renamed from: com.epson.cameracopy.ui.ImagePreviewActivity */
+public class ImagePreviewActivity extends ActivityIACommon {
+    public static final String PARAM_CAMERA_FILE = "camera-file";
+    public static final String PARAM_PICTURE_FILENAME = "file_name";
+    public static final String PARAM_SHOW_SIZE_SET_MESSAGE_ON_PRINT_PREVIEW = "pram-sizeset-message-printpreview";
+    private static final int REQEST_CODE_IMAGE_CROP = 1;
+    private static final int REQEST_RUNTIMEPERMMISSION = 2;
+    private static final int REQUEST_WRITE_PERMISSION_FOR_IMAGE_FORMAT_CONVERT = 3;
+    private PlaceholderFragment mFragment;
+
+    public boolean onCreateOptionsMenu(Menu menu) {
+        return true;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        setContentView((int) C2135R.layout.activity_picture_view);
+        setActionBar((int) C2135R.string.image_preview_title, true);
+        if (bundle == null) {
+            Intent intent = getIntent();
+            if (intent == null) {
+                finish();
+                return;
+            }
+            String stringExtra = intent.getStringExtra(PARAM_PICTURE_FILENAME);
+            CameraFile cameraFile = (CameraFile) intent.getSerializableExtra(PARAM_CAMERA_FILE);
+            if (stringExtra == null && cameraFile == null) {
+                finish();
+                return;
+            }
+            Bundle extras = intent.getExtras();
+            if (extras.containsKey(PARAM_PICTURE_FILENAME) && extras.containsKey(PARAM_CAMERA_FILE)) {
+                finish();
+            } else if (cameraFile == null || new File(cameraFile.getValidFileName()).exists()) {
+                this.mFragment = PlaceholderFragment.getInstance(stringExtra, cameraFile);
+                getSupportFragmentManager().beginTransaction().add((int) C2135R.C2137id.container, (Fragment) this.mFragment).commit();
+            } else {
+                finish();
+            }
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPause() {
+        super.onPause();
+        NfcTagUtils.disableForegroundDispatch(this);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onResume() {
+        super.onResume();
+        NfcTagUtils.enableForegroundDispatch(this, (IntentFilter[]) null, (String[][]) null);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onNewIntent(Intent intent) {
+        super.onNewIntent(intent);
+        CommonMessage.showInvalidPrintMessageIfEpsonNfcPrinter(this, intent);
+    }
+
+    public boolean onOptionsItemSelected(MenuItem menuItem) {
+        menuItem.getItemId();
+        return super.onOptionsItemSelected(menuItem);
+    }
+
+    public void onBackPressed() {
+        PlaceholderFragment placeholderFragment = this.mFragment;
+        if (placeholderFragment == null || !placeholderFragment.checkProgress()) {
+            backCameraPreviewActivity();
+        }
+    }
+
+    public void backCameraPreviewActivity() {
+        Intent intent = new Intent(this, CameraPreviewActivity.class);
+        intent.addFlags(67108864);
+        intent.addFlags(Videoio.CAP_INTELPERC_DEPTH_GENERATOR);
+        startActivity(intent);
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.ImagePreviewActivity$PlaceholderFragment */
+    public static class PlaceholderFragment extends Fragment {
+        static final /* synthetic */ boolean $assertionsDisabled = false;
+        private static final String KEY_PREVIEW_FILE = "preview-file";
+        private static final String PARAM_CAMERA_FILE = "camera-file";
+        private static final String PARAM_FILE_NAME = "file_name";
+        ImagePreviewFile mImagePreviewFile;
+        private ScalableImageView mImageView;
+        private ProgressBar mProgressBar;
+        private Button mSaveButton;
+        private boolean mShowSetDisplaySizeMessageOnPrintPreview;
+
+        static {
+            Class<ImagePreviewActivity> cls = ImagePreviewActivity.class;
+        }
+
+        public static PlaceholderFragment getInstance(String str, CameraFile cameraFile) {
+            PlaceholderFragment placeholderFragment = new PlaceholderFragment();
+            Bundle bundle = new Bundle();
+            bundle.putCharSequence("file_name", str);
+            bundle.putSerializable("camera-file", cameraFile);
+            placeholderFragment.setArguments(bundle);
+            return placeholderFragment;
+        }
+
+        private void setPreview(ScalableImageView scalableImageView, String str) {
+            scalableImageView.SetImageBitmap(ImageUtil.loadBitmap(str, 1200, 1200, true, true), getResources());
+            try {
+                int attributeInt = new ExifInterface(str).getAttributeInt(android.support.media.ExifInterface.TAG_ORIENTATION, 1);
+                if (attributeInt == 3) {
+                    scalableImageView.SetRotate(180.0f);
+                } else if (attributeInt == 6) {
+                    scalableImageView.SetRotate(90.0f);
+                } else if (attributeInt != 8) {
+                    scalableImageView.SetRotate(0.0f);
+                } else {
+                    scalableImageView.SetRotate(270.0f);
+                }
+            } catch (IOException unused) {
+            }
+        }
+
+        public void setPreview() {
+            String printFileName = this.mImagePreviewFile.getPrintFileName();
+            if (printFileName != null) {
+                setPreview(this.mImageView, printFileName);
+            }
+        }
+
+        public void restorePreview() {
+            ScalableImageView scalableImageView = this.mImageView;
+            if (scalableImageView != null && this.mImagePreviewFile != null && scalableImageView.getBitmap() == null) {
+                setPreview();
+            }
+        }
+
+        public void releasePreviewBitmap() {
+            ScalableImageView scalableImageView = this.mImageView;
+            if (scalableImageView != null) {
+                scalableImageView.SetImageBitmap((Bitmap) null, (Resources) null);
+            }
+        }
+
+        public void onCreate(Bundle bundle) {
+            super.onCreate(bundle);
+            if (bundle != null) {
+                this.mImagePreviewFile = (ImagePreviewFile) bundle.getSerializable(KEY_PREVIEW_FILE);
+                return;
+            }
+            Bundle arguments = getArguments();
+            if (arguments != null) {
+                CameraFile cameraFile = (CameraFile) arguments.getSerializable("camera-file");
+                if (cameraFile != null) {
+                    this.mShowSetDisplaySizeMessageOnPrintPreview = false;
+                    this.mImagePreviewFile = new CameraFileAdapter(cameraFile);
+                    return;
+                }
+                this.mShowSetDisplaySizeMessageOnPrintPreview = true;
+            }
+        }
+
+        public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
+            View inflate = layoutInflater.inflate(C2135R.layout.fragment_image_preview_view, viewGroup, false);
+            this.mImageView = (ScalableImageView) inflate.findViewById(C2135R.C2137id.preview_view);
+            this.mProgressBar = (ProgressBar) inflate.findViewById(C2135R.C2137id.progressBar);
+            this.mSaveButton = (Button) inflate.findViewById(C2135R.C2137id.save_button);
+            this.mSaveButton.setOnClickListener(new View.OnClickListener() {
+                public void onClick(View view) {
+                    if (!PlaceholderFragment.this.checkProgress()) {
+                        if (ActivityRequestPermissions.isRuntimePermissionSupported()) {
+                            String[] strArr = {"android.permission.WRITE_EXTERNAL_STORAGE"};
+                            String[] strArr2 = {PlaceholderFragment.this.getString(C2135R.string.permission_dialog_title), PlaceholderFragment.this.getString(C2135R.string.permission_dialog_title)};
+                            PlaceholderFragment placeholderFragment = PlaceholderFragment.this;
+                            PlaceholderFragment placeholderFragment2 = PlaceholderFragment.this;
+                            ActivityRequestPermissions.Permission permission = new ActivityRequestPermissions.Permission(strArr[0], strArr2, new String[]{ActivityRequestPermissions.DialogParameter.setMessage2((Fragment) placeholderFragment, placeholderFragment.getString(C2135R.string.permission_dialog_message_storage)), ActivityRequestPermissions.DialogParameter.setMessage3A((Fragment) placeholderFragment2, placeholderFragment2.getString(C2135R.string.permission_dialog_message_storage), PlaceholderFragment.this.getString(C2135R.string.permission_function_storage))});
+                            if (!ActivityRequestPermissions.checkPermission(PlaceholderFragment.this.getActivity(), strArr)) {
+                                ActivityRequestPermissions.requestPermission((Fragment) PlaceholderFragment.this, permission, 2);
+                                return;
+                            }
+                        }
+                        PlaceholderFragment.this.saveImage();
+                    }
+                }
+            });
+            ((Button) inflate.findViewById(C2135R.C2137id.print_button)).setOnClickListener(new View.OnClickListener() {
+                public void onClick(View view) {
+                    if (!PlaceholderFragment.this.checkProgress()) {
+                        PlaceholderFragment.this.startPrintPreviewActivity();
+                    }
+                }
+            });
+            ((Button) inflate.findViewById(C2135R.C2137id.retouch_button)).setOnClickListener(new View.OnClickListener() {
+                public void onClick(View view) {
+                    if (!PlaceholderFragment.this.checkProgress()) {
+                        PlaceholderFragment.this.startImageCollectActivity();
+                    }
+                }
+            });
+            if (this.mImagePreviewFile != null) {
+                this.mProgressBar.setVisibility(8);
+                setPreview();
+                UiCommon.setButtonEnabled(this.mSaveButton, this.mImagePreviewFile.needSaveButton());
+            } else {
+                this.mProgressBar.setVisibility(0);
+                observeImageConvertFromArgument();
+            }
+            return inflate;
+        }
+
+        private void observeImageConvertFromArgument() {
+            String str;
+            Bundle arguments = getArguments();
+            if (arguments != null && (str = (String) arguments.getCharSequence("file_name")) != null) {
+                observeImageFolderFile(str);
+            }
+        }
+
+        private void observeImageFolderFile(@Nullable String str) {
+            if (str != null) {
+                ImageFolderFile imageFolderFile = new ImageFolderFile(str);
+                if (!imageFolderFile.needsConvert(IprintApplication.getInstance()) || !requestWritePermissionIfNeeded()) {
+                    ImageFolderFileViewModel imageFolderFileViewModel = (ImageFolderFileViewModel) ViewModelProviders.m0of((Fragment) this).get(ImageFolderFileViewModel.class);
+                    imageFolderFileViewModel.setOriginalData(imageFolderFile);
+                    imageFolderFileViewModel.getData().observe(this, new Observer<ImageFolderFile>() {
+                        public void onChanged(@Nullable ImageFolderFile imageFolderFile) {
+                            PlaceholderFragment.this.localFolderFileViewModelPrepared(imageFolderFile);
+                        }
+                    });
+                }
+            }
+        }
+
+        private boolean requestWritePermissionIfNeeded() {
+            if (ActivityRequestPermissions.isRuntimePermissionSupported()) {
+                String[] strArr = {"android.permission.WRITE_EXTERNAL_STORAGE"};
+                ActivityRequestPermissions.Permission permission = new ActivityRequestPermissions.Permission(strArr[0], new String[]{getString(C2135R.string.permission_dialog_title), getString(C2135R.string.permission_dialog_title)}, new String[]{ActivityRequestPermissions.DialogParameter.setMessage2((Fragment) this, getString(C2135R.string.permission_dialog_message_storage)), ActivityRequestPermissions.DialogParameter.setMessage3A((Fragment) this, getString(C2135R.string.permission_dialog_message_storage), getString(C2135R.string.permission_function_storage))});
+                if (!ActivityRequestPermissions.checkPermission(getActivity(), strArr)) {
+                    ActivityRequestPermissions.requestPermission((Fragment) this, permission, 3);
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        /* access modifiers changed from: private */
+        public boolean checkProgress() {
+            return this.mProgressBar.getVisibility() == 0;
+        }
+
+        /* access modifiers changed from: private */
+        public void localFolderFileViewModelPrepared(@Nullable ImageFolderFile imageFolderFile) {
+            this.mProgressBar.setVisibility(8);
+            this.mImagePreviewFile = imageFolderFile;
+            UiCommon.setButtonEnabled(this.mSaveButton, this.mImagePreviewFile.needSaveButton());
+            restorePreview();
+        }
+
+        public void onStart() {
+            super.onStart();
+            restorePreview();
+        }
+
+        public void onPause() {
+            if (getActivity().isFinishing()) {
+                releasePreviewBitmap();
+                this.mImagePreviewFile.deleteTemporaryFile();
+            }
+            super.onPause();
+        }
+
+        public void onStop() {
+            releasePreviewBitmap();
+            super.onStop();
+        }
+
+        public void onSaveInstanceState(Bundle bundle) {
+            super.onSaveInstanceState(bundle);
+            bundle.putSerializable(KEY_PREVIEW_FILE, (Serializable) this.mImagePreviewFile);
+        }
+
+        public void saveImage() {
+            UiCommon.setButtonEnabled(this.mSaveButton, false);
+            if (!this.mImagePreviewFile.doSave(CameraPreviewControl.getInstance(getActivity()).getSaveDirecotry())) {
+                UiCommon.setButtonEnabled(this.mSaveButton, true);
+                SimpleMessageDialogFragment.newInstance(C2135R.string.file_save_error_message).show(getFragmentManager(), "error-dialog");
+                return;
+            }
+            File file = new File(this.mImagePreviewFile.getPrintFileName());
+            ImageUtil.galleryAddPic(getActivity(), file);
+            FileSaveDialogFragment.newInstance(1, file.getParentFile().getName()).show(getFragmentManager(), "ok-dialog");
+        }
+
+        public void startPrintPreviewActivity() {
+            String printFileName = this.mImagePreviewFile.getPrintFileName();
+            if (printFileName != null) {
+                Intent intent = new Intent(getActivity(), PrintPreviewActivity.class);
+                ArrayList arrayList = new ArrayList(1);
+                arrayList.add(printFileName);
+                intent.putExtra("imageList", arrayList);
+                if (this.mShowSetDisplaySizeMessageOnPrintPreview) {
+                    intent.putExtra(PrintPreviewActivity.PARAM_DISPLAY_SIZE_SET_MESSAGE, true);
+                }
+                startActivity(intent);
+            }
+        }
+
+        public void startImageCollectActivity() {
+            String imageProcFileName = this.mImagePreviewFile.getImageProcFileName(getActivity());
+            if (imageProcFileName != null) {
+                Intent intent = new Intent(getActivity(), CropImageActivity.class);
+                intent.putExtra(CropImageActivity.IMAGE_FILE_NAME, imageProcFileName);
+                startActivityForResult(intent, 1);
+            }
+        }
+
+        public void onActivityResult(int i, int i2, Intent intent) {
+            String stringExtra;
+            switch (i) {
+                case 1:
+                    if (i2 == -1 && (stringExtra = intent.getStringExtra(CropImageActivity.RESULT_COLLECTED_FILE_NAME)) != null) {
+                        this.mImagePreviewFile.deleteTemporaryFile();
+                        this.mImagePreviewFile = new CameraFileAdapter(new CameraFile(new Date(), stringExtra));
+                        setPreview();
+                        UiCommon.setButtonEnabled(this.mSaveButton, this.mImagePreviewFile.needSaveButton());
+                        this.mShowSetDisplaySizeMessageOnPrintPreview = false;
+                        startPrintPreviewActivity();
+                        return;
+                    }
+                    return;
+                case 2:
+                    if (i2 == -1) {
+                        saveImage();
+                        return;
+                    }
+                    return;
+                case 3:
+                    if (i2 != -1) {
+                        FragmentActivity activity = getActivity();
+                        if (activity != null) {
+                            activity.finish();
+                            return;
+                        }
+                        return;
+                    }
+                    observeImageConvertFromArgument();
+                    return;
+                default:
+                    return;
+            }
+        }
+    }
+
+    @SuppressLint({"ValidFragment"})
+    /* renamed from: com.epson.cameracopy.ui.ImagePreviewActivity$FileSaveDialogFragment */
+    public static class FileSaveDialogFragment extends DialogFragment {
+        private static final String PARAM_FILENAME = "filename";
+        private static final String PARAM_TYPE = "type";
+        private String mFileName;
+
+        static FileSaveDialogFragment newInstance(int i, String str) {
+            FileSaveDialogFragment fileSaveDialogFragment = new FileSaveDialogFragment();
+            Bundle bundle = new Bundle();
+            bundle.putInt("type", i);
+            bundle.putString(PARAM_FILENAME, str);
+            fileSaveDialogFragment.setArguments(bundle);
+            return fileSaveDialogFragment;
+        }
+
+        public void onCreate(Bundle bundle) {
+            super.onCreate(bundle);
+            Bundle arguments = getArguments();
+            arguments.getInt("type");
+            this.mFileName = arguments.getString(PARAM_FILENAME);
+        }
+
+        public Dialog onCreateDialog(Bundle bundle) {
+            super.onCreateDialog(bundle);
+            return new AlertDialog.Builder(getActivity()).setMessage(getResources().getString(C2135R.string.image_save_message, new Object[]{this.mFileName})).setPositiveButton(C2135R.string.ok_button, new DialogInterface.OnClickListener() {
+                public void onClick(DialogInterface dialogInterface, int i) {
+                }
+            }).create();
+        }
+    }
+}

+ 17 - 0
app/src/main/java/com/epson/cameracopy/p006ui/ImagePreviewFile.java

@@ -0,0 +1,17 @@
+package com.epson.cameracopy.p006ui;
+
+import android.content.Context;
+
+/* renamed from: com.epson.cameracopy.ui.ImagePreviewFile */
+/* compiled from: ImagePreviewActivity */
+interface ImagePreviewFile {
+    void deleteTemporaryFile();
+
+    boolean doSave(String str);
+
+    String getImageProcFileName(Context context);
+
+    String getPrintFileName();
+
+    boolean needSaveButton();
+}

+ 31 - 0
app/src/main/java/com/epson/cameracopy/p006ui/ItemData.java

@@ -0,0 +1,31 @@
+package com.epson.cameracopy.p006ui;
+
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+import epson.print.C2135R;
+
+/* renamed from: com.epson.cameracopy.ui.ItemData */
+/* compiled from: FolderSelectActivity */
+class ItemData {
+    String mFileName = null;
+
+    ItemData(String str) {
+        if (str != null) {
+            this.mFileName = new String(str);
+        }
+    }
+
+    public void DrawItem(int i, View view, ViewGroup viewGroup) {
+        ImageView imageView = (ImageView) view.findViewById(C2135R.C2137id.file_item_image);
+        TextView textView = (TextView) view.findViewById(C2135R.C2137id.file_item_text);
+        if (this.mFileName != null) {
+            imageView.setImageResource(C2135R.C2136drawable.folder);
+            textView.setText(this.mFileName);
+            return;
+        }
+        imageView.setImageResource(C2135R.C2136drawable.parent_folder);
+        textView.setText("");
+    }
+}

+ 32 - 0
app/src/main/java/com/epson/cameracopy/p006ui/ItemDataAdapter.java

@@ -0,0 +1,32 @@
+package com.epson.cameracopy.p006ui;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import epson.print.C2135R;
+import java.util.List;
+
+/* renamed from: com.epson.cameracopy.ui.ItemDataAdapter */
+/* compiled from: FolderSelectActivity */
+class ItemDataAdapter extends ArrayAdapter<ItemData> {
+    private final Context mContext;
+    private final LayoutInflater mLayoutInflater = ((LayoutInflater) this.mContext.getSystemService("layout_inflater"));
+
+    public ItemDataAdapter(Context context, int i, List<ItemData> list) {
+        super(context, i, list);
+        this.mContext = context;
+    }
+
+    public View getView(int i, View view, ViewGroup viewGroup) {
+        if (view == null) {
+            view = this.mLayoutInflater.inflate(C2135R.layout.file_select_row, (ViewGroup) null);
+        }
+        ItemData itemData = (ItemData) getItem(i);
+        if (itemData != null) {
+            itemData.DrawItem(i, view, viewGroup);
+        }
+        return view;
+    }
+}

+ 37 - 0
app/src/main/java/com/epson/cameracopy/p006ui/MenuControl.java

@@ -0,0 +1,37 @@
+package com.epson.cameracopy.p006ui;
+
+import android.view.Menu;
+import android.view.MenuInflater;
+import epson.print.C2135R;
+
+/* renamed from: com.epson.cameracopy.ui.MenuControl */
+/* compiled from: FolderSelectActivity */
+class MenuControl {
+    static final int MENU_HIDE = 0;
+    static final int MENU_NEW = 2;
+    static final int MENU_OK = 1;
+    static final int MENU_OK_CANCEL = 4;
+    static final int MENU_OK_NEW = 3;
+    private final FolderSelectActivity mActivity;
+    private final MenuInflater mMenuInflater;
+    private int mMenuMode = -1;
+
+    MenuControl(FolderSelectActivity folderSelectActivity, int i) {
+        this.mActivity = folderSelectActivity;
+        this.mMenuInflater = this.mActivity.getMenuInflater();
+        this.mMenuMode = i;
+    }
+
+    public void CreateMenu(Menu menu) {
+        if (this.mMenuMode != 0) {
+            this.mMenuInflater.inflate(C2135R.C2138menu.menu_ok, menu);
+        }
+    }
+
+    public void ChangeMenu(int i) {
+        if (this.mMenuMode != i) {
+            this.mMenuMode = i;
+            this.mActivity.invalidateOptionsMenu();
+        }
+    }
+}

+ 173 - 0
app/src/main/java/com/epson/cameracopy/p006ui/PictureResolutionDialogFragment.java

@@ -0,0 +1,173 @@
+package com.epson.cameracopy.p006ui;
+
+import android.content.Context;
+import android.graphics.Point;
+import android.os.Bundle;
+import android.support.p000v4.app.DialogFragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+import com.epson.cameracopy.device.CameraPreviewControl;
+import epson.print.C2135R;
+import java.util.Collections;
+import java.util.List;
+
+/* renamed from: com.epson.cameracopy.ui.PictureResolutionDialogFragment */
+public class PictureResolutionDialogFragment extends DialogFragment {
+    private static final String KEY_CAMERA_PICTURE_RESOLUTION_MODE = "picture_resolution_mode";
+    private static final String KEY_CAMERA_PICTURE_SIZE = "picture_size";
+    private static final int MANUAL_SIZE_START_INDEX = 1;
+    private List<Point> mSizeList;
+
+    /* renamed from: com.epson.cameracopy.ui.PictureResolutionDialogFragment$OnItemSelectedListener */
+    interface OnItemSelectedListener {
+        void onItemSelected(boolean z, int i, Point point);
+    }
+
+    public static PictureResolutionDialogFragment newInstance(int i, Point point) {
+        PictureResolutionDialogFragment pictureResolutionDialogFragment = new PictureResolutionDialogFragment();
+        Bundle bundle = new Bundle();
+        bundle.putInt(KEY_CAMERA_PICTURE_RESOLUTION_MODE, i);
+        if (point != null) {
+            bundle.putIntArray(KEY_CAMERA_PICTURE_SIZE, new int[]{point.x, point.y});
+        }
+        pictureResolutionDialogFragment.setArguments(bundle);
+        return pictureResolutionDialogFragment;
+    }
+
+    /* JADX WARNING: Code restructure failed: missing block: B:2:0x000f, code lost:
+        r7 = r7.getIntArray(KEY_CAMERA_PICTURE_SIZE);
+     */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    public android.app.Dialog onCreateDialog(android.os.Bundle r7) {
+        /*
+            r6 = this;
+            android.os.Bundle r7 = r6.getArguments()
+            java.lang.String r0 = "picture_resolution_mode"
+            int r0 = r7.getInt(r0)
+            r1 = 0
+            r2 = 1
+            r3 = 0
+            if (r0 != r2) goto L_0x0025
+            java.lang.String r4 = "picture_size"
+            int[] r7 = r7.getIntArray(r4)
+            if (r7 == 0) goto L_0x0025
+            int r4 = r7.length
+            r5 = 2
+            if (r4 < r5) goto L_0x0025
+            android.graphics.Point r4 = new android.graphics.Point
+            r5 = r7[r1]
+            r7 = r7[r2]
+            r4.<init>(r5, r7)
+            goto L_0x0026
+        L_0x0025:
+            r4 = r3
+        L_0x0026:
+            java.util.List r7 = r6.getPictureSizeList()
+            r6.mSizeList = r7
+            java.util.List<android.graphics.Point> r7 = r6.mSizeList
+            java.lang.CharSequence[] r7 = r6.getPictureSizeStrList(r7)
+            if (r7 != 0) goto L_0x0035
+            return r3
+        L_0x0035:
+            java.util.List<android.graphics.Point> r2 = r6.mSizeList
+            int r0 = r6.getListPoisition(r0, r4, r2)
+            com.epson.cameracopy.ui.PictureResolutionDialogFragment$MyAdapter r2 = new com.epson.cameracopy.ui.PictureResolutionDialogFragment$MyAdapter
+            android.support.v4.app.FragmentActivity r3 = r6.getActivity()
+            r4 = 2131361980(0x7f0a00bc, float:1.8343728E38)
+            r2.<init>(r3, r4, r7, r0)
+            android.app.AlertDialog$Builder r7 = new android.app.AlertDialog$Builder
+            android.support.v4.app.FragmentActivity r3 = r6.getActivity()
+            r7.<init>(r3)
+            r3 = 2131625007(0x7f0e042f, float:1.887721E38)
+            android.app.AlertDialog$Builder r3 = r7.setTitle(r3)
+            com.epson.cameracopy.ui.PictureResolutionDialogFragment$1 r4 = new com.epson.cameracopy.ui.PictureResolutionDialogFragment$1
+            r4.<init>()
+            r3.setSingleChoiceItems(r2, r0, r4)
+            android.app.AlertDialog r7 = r7.create()
+            r7.setCanceledOnTouchOutside(r1)
+            return r7
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.p006ui.PictureResolutionDialogFragment.onCreateDialog(android.os.Bundle):android.app.Dialog");
+    }
+
+    public void onActivityCreated(Bundle bundle) {
+        super.onActivityCreated(bundle);
+    }
+
+    private List<Point> getPictureSizeList() {
+        List<Point> cameraPictureSizes = CameraPreviewControl.getInstance(getActivity()).getCameraPictureSizes();
+        if (cameraPictureSizes == null) {
+            return null;
+        }
+        Collections.sort(cameraPictureSizes, new AreaComparator());
+        return cameraPictureSizes;
+    }
+
+    private int getListPoisition(int i, Point point, List<Point> list) {
+        int indexOf;
+        if (i != 1 || point == null || (indexOf = this.mSizeList.indexOf(point)) < 0) {
+            return 0;
+        }
+        return indexOf + 1;
+    }
+
+    private CharSequence[] getPictureSizeStrList(List<Point> list) {
+        String[] strArr = new String[((list != null ? list.size() : 0) + 1)];
+        strArr[0] = getActivity().getResources().getString(C2135R.string.picture_size_auto);
+        if (list == null) {
+            return strArr;
+        }
+        int i = 1;
+        for (Point next : list) {
+            strArr[i] = CameraPreviewControl.getPictureSizeString(next.x, next.y);
+            i++;
+        }
+        return strArr;
+    }
+
+    /* access modifiers changed from: private */
+    public void selectListItem(int i) {
+        OnItemSelectedListener onItemSelectedListener = (OnItemSelectedListener) getActivity();
+        List<Point> list = this.mSizeList;
+        if (list == null) {
+            onItemSelectedListener.onItemSelected(false, -1, (Point) null);
+        } else if (i == 0) {
+            onItemSelectedListener.onItemSelected(true, 0, (Point) null);
+        } else {
+            try {
+                onItemSelectedListener.onItemSelected(true, 1, list.get(i - 1));
+            } catch (IndexOutOfBoundsException unused) {
+            }
+        }
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.PictureResolutionDialogFragment$MyAdapter */
+    static class MyAdapter extends ArrayAdapter<CharSequence> {
+        LayoutInflater mLayoutInflater;
+        int mSelectNumber;
+
+        public MyAdapter(Context context, int i, CharSequence[] charSequenceArr, int i2) {
+            super(context, i, charSequenceArr);
+            this.mLayoutInflater = (LayoutInflater) context.getSystemService("layout_inflater");
+            this.mSelectNumber = i2;
+        }
+
+        public View getView(int i, View view, ViewGroup viewGroup) {
+            if (view == null) {
+                view = this.mLayoutInflater.inflate(C2135R.layout.select_list_row, viewGroup, false);
+            }
+            ((TextView) view.findViewById(C2135R.C2137id.docsize_name)).setText((CharSequence) getItem(i));
+            ImageView imageView = (ImageView) view.findViewById(C2135R.C2137id.current_docsize_image);
+            if (i != this.mSelectNumber) {
+                imageView.setVisibility(4);
+            } else {
+                imageView.setVisibility(0);
+            }
+            return view;
+        }
+    }
+}

+ 826 - 0
app/src/main/java/com/epson/cameracopy/p006ui/PrintPreviewActivity.java

@@ -0,0 +1,826 @@
+package com.epson.cameracopy.p006ui;
+
+import android.app.AlertDialog;
+import android.arch.lifecycle.Observer;
+import android.arch.lifecycle.ViewModelProviders;
+import android.content.ComponentName;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.content.SharedPreferences;
+import android.content.res.Configuration;
+import android.graphics.PointF;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.Message;
+import android.os.RemoteException;
+import android.support.annotation.Nullable;
+import android.support.p000v4.app.DialogFragment;
+import android.support.p000v4.app.FragmentActivity;
+import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+import com.epson.cameracopy.printlayout.ImageAndLayout;
+import com.epson.cameracopy.printlayout.ManuscriptSize;
+import com.epson.cameracopy.printlayout.PreviewView;
+import com.epson.mobilephone.common.ReviewInvitationDialog;
+import com.epson.mobilephone.common.ReviewInvitationViewModel;
+import com.epson.mobilephone.common.escpr.MediaInfo;
+import com.epson.mobilephone.common.wifidirect.NfcTagUtils;
+import epson.common.Constants;
+import epson.common.DialogProgress;
+import epson.common.DialogProgressViewModel;
+import epson.common.ExternalFileUtils;
+import epson.print.ActivityIACommon;
+import epson.print.ActivityNfcPrinter;
+import epson.print.C2135R;
+import epson.print.CommonDefine;
+import epson.print.EPImage;
+import epson.print.EPImageList;
+import epson.print.MyPrinter;
+import epson.print.Util.AsyncTaskExecutor;
+import epson.print.Util.EPLog;
+import epson.print.screen.PaperSourceInfo;
+import epson.print.screen.PaperSourceSetting;
+import epson.print.screen.PaperSourceSettingScr;
+import epson.print.screen.PrintSetting;
+import epson.print.service.EpsonService;
+import epson.print.service.IEpsonService;
+import epson.print.service.IEpsonServiceCallback;
+import java.util.ArrayList;
+import java.util.Deque;
+import java.util.Locale;
+
+/* renamed from: com.epson.cameracopy.ui.PrintPreviewActivity */
+public class PrintPreviewActivity extends ActivityIACommon implements CommonDefine, View.OnClickListener, PreviewView.PrttargetScaleChangeListener, ReviewInvitationDialog.OnClickListener {
+    static final /* synthetic */ boolean $assertionsDisabled = false;
+    private static final String DIALOG_KEY_STORE_DIALOG = "store-dialog";
+    private static final String DIALOG_PROGRESS = "dialog_progress";
+    private static final String KEY_PREVIEW_VIEW = "preview-view";
+    private static final int MESSAGE_MANUSCRIPT_SCALE_TEXT_UPDATE = 8;
+    public static final String PARAM_DISPLAY_SIZE_SET_MESSAGE = "display-sizeset-message";
+    public static final String PARAM_IMAGE_LIST = "imageList";
+    private static final int REQUEST_CODE_NFC_PRINTER_CHANGE = 4;
+    private static final int REQUEST_CODE_ORG_PAPER_SIZE_SELECT = 3;
+    private static final int REQUEST_CODE_PRINT = 1;
+    private static final int REQUEST_CODE_SETTING = 2;
+    private final int LOAD_ALL_IMAGE = 3;
+    private final int OUT_OF_MEMORY_ERROR = 7;
+    private final int PREVIEW_LOAD_DIALOG_DISMISS = 1;
+    private final int PREVIEW_LOAD_DIALOG_SHOW = 0;
+    private final PrintSetting.Kind PRINT_MODE_CAMERACOPY = PrintSetting.Kind.cameracopy;
+    private final int START_PRINT = 5;
+    private final int ZOOM_CONTROL = 2;
+    private ArrayList<PaperSourceSetting> aPaperSourceSetting;
+    boolean bAutoStartPrint = false;
+    private Button backButton = null;
+    private int currentColor = 0;
+    private int currentLayout = 2;
+    private int currentPaperSize = 0;
+    private String currentPrinterName = "";
+    private boolean enableShowWarning = true;
+    /* access modifiers changed from: private */
+    public final IEpsonServiceCallback mCallback = new IEpsonServiceCallback.Stub() {
+        public void onFindPrinterResult(String str, String str2, String str3, String str4, String str5) throws RemoteException {
+        }
+
+        public void onGetInkState() throws RemoteException {
+        }
+
+        public void onGetStatusState() throws RemoteException {
+        }
+
+        public void onNotifyContinueable(int i) throws RemoteException {
+        }
+
+        public void onNotifyEndJob(int i) throws RemoteException {
+        }
+
+        public void onNotifyError(int i, int i2, boolean z) throws RemoteException {
+        }
+
+        public void onNotifyProgress(int i, int i2) throws RemoteException {
+        }
+    };
+    private final ServiceConnection mEpsonConnection = new ServiceConnection() {
+        public void onServiceDisconnected(ComponentName componentName) {
+            try {
+                PrintPreviewActivity.this.mEpsonService.unregisterCallback(PrintPreviewActivity.this.mCallback);
+            } catch (RemoteException e) {
+                e.printStackTrace();
+            }
+            IEpsonService unused = PrintPreviewActivity.this.mEpsonService = null;
+        }
+
+        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
+            IEpsonService unused = PrintPreviewActivity.this.mEpsonService = IEpsonService.Stub.asInterface(iBinder);
+            if (PrintPreviewActivity.this.mEpsonService != null) {
+                try {
+                    PrintPreviewActivity.this.mEpsonService.registerCallback(PrintPreviewActivity.this.mCallback);
+                } catch (RemoteException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    };
+    /* access modifiers changed from: private */
+    public IEpsonService mEpsonService = null;
+    Handler mHandler = new Handler(new Handler.Callback() {
+        static final /* synthetic */ boolean $assertionsDisabled = false;
+
+        static {
+            Class<PrintPreviewActivity> cls = PrintPreviewActivity.class;
+        }
+
+        public boolean handleMessage(Message message) {
+            int i = message.what;
+            if (i == 3) {
+                PrintPreviewActivity.this.startLoadtask();
+            } else if (i == 5) {
+                PrintPreviewActivity.this.disablePrintButton();
+                PrintPreviewActivity.this.startPrint();
+            } else if (i != 100) {
+                switch (i) {
+                    case 0:
+                        PrintPreviewActivity.this.showProgressDialog();
+                        break;
+                    case 1:
+                        PrintPreviewActivity.this.dismissProgressDialog();
+                        break;
+                    default:
+                        switch (i) {
+                            case 7:
+                                if (PrintPreviewActivity.this.mImageList.size() <= 0) {
+                                    PrintPreviewActivity.this.disablePrintButton();
+                                }
+                                PrintPreviewActivity printPreviewActivity = PrintPreviewActivity.this;
+                                Toast.makeText(printPreviewActivity, printPreviewActivity.getString(C2135R.string.file_size_notsupport), 1).show();
+                                break;
+                            case 8:
+                                PrintPreviewActivity.this.updateManuscriptScaleText(((Double) message.obj).doubleValue());
+                                return true;
+                        }
+                }
+            } else {
+                PrintPreviewActivity.this.updatePaperDisplay(message);
+            }
+            return true;
+        }
+    });
+    /* access modifiers changed from: private */
+    public final EPImageList mImageList = new EPImageList();
+    private boolean mIsRemotePrinter = false;
+    ManuscriptSize mManuscriptSize;
+    private DialogProgressViewModel mModelDialog;
+    private Button mOriginalImageSizeButton;
+    private PreviewView mPreviewView = null;
+    int mPrintTargetPaperSizeId = -2;
+    private TextView mPrintTargetSizeText;
+    private ReviewInvitationViewModel mReviewInvitationViewModel;
+    private TextView mScaleText;
+    private ImageView paperMissmath = null;
+    PaperSourceInfo paperSourceInfo = null;
+    private TextView papersizeTextView = null;
+    /* access modifiers changed from: private */
+    public Button printButton = null;
+    private String printerId = "";
+    private ImageButton printsettingButton = null;
+    private AllReloadTask reloadTask = null;
+    private Button rotateButton = null;
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        setContentView((int) C2135R.layout.activity_camera_print_preview);
+        this.mModelDialog = (DialogProgressViewModel) ViewModelProviders.m2of((FragmentActivity) this).get(DialogProgressViewModel.class);
+        this.mModelDialog.getDialogJob().observe(this, new Observer() {
+            public final void onChanged(Object obj) {
+                PrintPreviewActivity.lambda$onCreate$0(PrintPreviewActivity.this, (Deque) obj);
+            }
+        });
+        this.mReviewInvitationViewModel = (ReviewInvitationViewModel) ViewModelProviders.m2of((FragmentActivity) this).get(ReviewInvitationViewModel.class);
+        this.mReviewInvitationViewModel.getShowInvitationLiveData().observe(this, new Observer<Boolean>() {
+            public void onChanged(@Nullable Boolean bool) {
+                if (bool.booleanValue()) {
+                    PrintPreviewActivity.this.showStoreDialog();
+                }
+            }
+        });
+        setActionBar((int) C2135R.string.print_title, true);
+        ExternalFileUtils.getInstance(this).initPrintDir();
+        getImageListFromIntent();
+        EPImageList ePImageList = this.mImageList;
+        if (ePImageList == null || ePImageList.size() != 1) {
+            finish();
+            return;
+        }
+        this.mPreviewView = (PreviewView) findViewById(C2135R.C2137id.previewImageView);
+        this.papersizeTextView = (TextView) findViewById(C2135R.C2137id.paper_size_text);
+        this.papersizeTextView.setOnClickListener(this);
+        this.mPrintTargetSizeText = (TextView) findViewById(C2135R.C2137id.printtarget_size_text);
+        this.mPrintTargetSizeText.setOnClickListener(this);
+        this.mScaleText = (TextView) findViewById(C2135R.C2137id.scale_text);
+        this.mScaleText.setOnClickListener(this);
+        this.paperMissmath = (ImageView) findViewById(C2135R.C2137id.icon_papermissmatch);
+        this.paperMissmath.setOnClickListener(this);
+        this.mOriginalImageSizeButton = (Button) findViewById(C2135R.C2137id.paper_size_button);
+        this.mOriginalImageSizeButton.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View view) {
+                PrintPreviewActivity.this.startOrgImageSizeActivity();
+            }
+        });
+        this.rotateButton = (Button) findViewById(C2135R.C2137id.rotate_button);
+        this.rotateButton.setOnClickListener(this);
+        this.printButton = (Button) findViewById(C2135R.C2137id.print_button);
+        this.printButton.setOnClickListener(this);
+        this.mPreviewView.setImage(this.mImageList.get(0).loadImageFileName);
+        loadPrinterSettingAndChangeView(true);
+        updateManuscriptScaleText(1.0d);
+        this.mPreviewView.setPrttargetScaleChangeListener(this);
+        this.enableShowWarning = getSharedPreferences(Constants.PREFS_EPSON_CONNECT, 0).getBoolean(Constants.ENABLE_SHOW_WARNING, true);
+        this.paperSourceInfo = PaperSourceInfo.getInstance(this);
+        if (this.mEpsonService == null) {
+            bindService(new Intent(this, EpsonService.class), this.mEpsonConnection, 1);
+        }
+        if (bundle == null) {
+            this.mHandler.sendEmptyMessageDelayed(3, 300);
+            checkSizeSetMessage();
+        }
+    }
+
+    public static /* synthetic */ void lambda$onCreate$0(PrintPreviewActivity printPreviewActivity, Deque deque) {
+        String[] checkQueue = printPreviewActivity.mModelDialog.checkQueue();
+        if (checkQueue != null) {
+            String str = checkQueue[0];
+            String str2 = checkQueue[1];
+            if (str2.equals("do_show")) {
+                printPreviewActivity.showDialog(str);
+            }
+            if (str2.equals("do_dismiss")) {
+                printPreviewActivity.dismissDialog(str);
+            }
+        }
+    }
+
+    /* access modifiers changed from: private */
+    public void showStoreDialog() {
+        ReviewInvitationDialog.newInstance().show(getSupportFragmentManager(), DIALOG_KEY_STORE_DIALOG);
+    }
+
+    private void checkSizeSetMessage() {
+        Intent intent = getIntent();
+        if (intent != null && intent.getBooleanExtra(PARAM_DISPLAY_SIZE_SET_MESSAGE, false)) {
+            Toast makeText = Toast.makeText(this, getString(C2135R.string.manuscript_size_set_message), 1);
+            makeText.setGravity(8, 0, 0);
+            makeText.show();
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void startOrgImageSizeActivity() {
+        startActivityForResult(new Intent(this, DocumentSizeSettingActivity.class), 3);
+    }
+
+    private void getImageListFromIntent() {
+        this.mImageList.clear();
+        Intent intent = getIntent();
+        if (intent == null) {
+            finish();
+            return;
+        }
+        ArrayList<String> stringArrayListExtra = intent.getStringArrayListExtra("imageList");
+        if (stringArrayListExtra == null) {
+            finish();
+            return;
+        }
+        for (int i = 0; i < stringArrayListExtra.size(); i++) {
+            this.mImageList.add(stringArrayListExtra.get(i));
+        }
+        for (int i2 = 0; i2 < this.mImageList.size(); i2++) {
+            if (!checkEPImage(this.mImageList.get(i2))) {
+                this.mImageList.clear();
+                finish();
+                return;
+            }
+        }
+    }
+
+    private boolean checkEPImage(EPImage ePImage) {
+        return ePImage != null && ePImage.srcWidth > 0 && ePImage.srcHeight > 0;
+    }
+
+    private void updateParaSizeText() {
+        String string = getString(new MediaInfo.PaperSize().getStringId(this.currentPaperSize));
+        TextView textView = this.papersizeTextView;
+        textView.setText(getString(C2135R.string.paper_size) + ": " + string);
+    }
+
+    private boolean updateManuscriptSize() {
+        ManuscriptSize manuscriptSize = this.mManuscriptSize;
+        this.mManuscriptSize = ManuscriptSize.load(this, this.mImageList.get(0).loadImageFileName);
+        boolean z = manuscriptSize == null || !manuscriptSize.equals(this.mManuscriptSize);
+        if (this.mManuscriptSize.displayLength()) {
+            PointF documentSize = this.mManuscriptSize.getDocumentSize(this);
+            this.mPrintTargetSizeText.setText(String.format(Locale.US, this.mManuscriptSize.getUnitType(this) == 2 ? "%s: %s (%.1f x %.1f %s)" : "%s: %s (%.0f x %.0f %s)", new Object[]{getString(C2135R.string.document_size), this.mManuscriptSize.getSizeName(this), Float.valueOf(documentSize.x), Float.valueOf(documentSize.y), this.mManuscriptSize.getUnitStr(this)}));
+        } else {
+            this.mPrintTargetSizeText.setText(String.format(Locale.US, "%s: %s", new Object[]{getString(C2135R.string.document_size), this.mManuscriptSize.getSizeName(this)}));
+        }
+        return z;
+    }
+
+    /* access modifiers changed from: private */
+    public void updateManuscriptScaleText(double d) {
+        PointF physicalSize = this.mManuscriptSize.getPhysicalSize(this);
+        this.mScaleText.setText(String.format(Locale.US, this.mManuscriptSize.getUnitType(this) == 2 ? "%s: %.0f%% (%.1f x %.1f %s)" : "%s: %.0f%% (%.0f x %.0f %s)", new Object[]{getString(C2135R.string.magnification), Double.valueOf(100.0d * d), Double.valueOf(((double) physicalSize.x) * d), Double.valueOf(((double) physicalSize.y) * d), this.mManuscriptSize.getUnitStr(this)}));
+    }
+
+    /* access modifiers changed from: private */
+    public void loadPrinterSettingAndChangeView(boolean z) {
+        boolean z2;
+        boolean z3;
+        PreviewView previewView;
+        boolean isRemotePrinter = isRemotePrinter();
+        boolean z4 = false;
+        SharedPreferences sharedPreferences = getSharedPreferences("PrintSetting", 0);
+        if (sharedPreferences != null) {
+            String string = sharedPreferences.getString(Constants.PRINTER_NAME, getString(C2135R.string.str_lbl_title_scan));
+            PrintSetting printSetting = new PrintSetting(this, PrintSetting.Kind.cameracopy);
+            printSetting.loadSettings();
+            this.printerId = sharedPreferences.getString(Constants.PRINTER_ID, (String) null);
+            boolean z5 = true;
+            if (z || this.mIsRemotePrinter != isRemotePrinter) {
+                this.mIsRemotePrinter = isRemotePrinter;
+                z3 = true;
+                z2 = true;
+            } else {
+                z3 = false;
+                z2 = false;
+            }
+            if (z || !this.currentPrinterName.equalsIgnoreCase(string)) {
+                this.currentPrinterName = string;
+                z3 = true;
+                z2 = true;
+            }
+            if (z || this.currentPaperSize != printSetting.paperSizeValue) {
+                this.currentPaperSize = printSetting.paperSizeValue;
+                PreviewView previewView2 = this.mPreviewView;
+                if (previewView2 != null) {
+                    previewView2.setPaperSize(this.currentPaperSize);
+                }
+                z3 = true;
+                z2 = true;
+            }
+            if (z || this.currentLayout != printSetting.layoutValue) {
+                this.currentLayout = printSetting.layoutValue;
+                if (this.mPreviewView != null) {
+                    if (this.currentLayout == 1) {
+                        z4 = true;
+                    }
+                    this.mPreviewView.setBorderless(z4);
+                }
+                z3 = true;
+                z2 = true;
+            }
+            if (z || this.currentColor != printSetting.colorValue) {
+                this.currentColor = printSetting.colorValue;
+                PreviewView previewView3 = this.mPreviewView;
+                if (previewView3 != null) {
+                    previewView3.setColor(this.currentColor);
+                }
+            } else {
+                z5 = z2;
+            }
+            if (z3) {
+                updateManuscriptSize();
+                PreviewView previewView4 = this.mPreviewView;
+                if (previewView4 != null) {
+                    previewView4.printPostionResetRequest();
+                    this.mPreviewView.setPrintTargetSize(this.mManuscriptSize.getPixelWidth(), this.mManuscriptSize.getPixelHeight());
+                    this.mPreviewView.update();
+                }
+                updateParaSizeText();
+            } else if (z5 && (previewView = this.mPreviewView) != null) {
+                previewView.update();
+            }
+        } else if (this.mIsRemotePrinter != isRemotePrinter) {
+            this.mIsRemotePrinter = isRemotePrinter;
+        }
+    }
+
+    private void enablePrintButton() {
+        this.printButton.setEnabled(true);
+    }
+
+    /* access modifiers changed from: private */
+    public void disablePrintButton() {
+        this.printButton.setEnabled(false);
+    }
+
+    /* JADX WARNING: Code restructure failed: missing block: B:6:0x0014, code lost:
+        r0 = (r0 = getSharedPreferences("PrintSetting", 0)).getString(epson.common.Constants.PRINTER_NAME, getString(epson.print.C2135R.string.str_lbl_title_scan));
+     */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    private boolean isPrinterChanged() {
+        /*
+            r5 = this;
+            boolean r0 = r5.isRemotePrinter()
+            boolean r1 = r5.mIsRemotePrinter
+            r2 = 1
+            if (r1 == r0) goto L_0x000a
+            return r2
+        L_0x000a:
+            java.lang.String r0 = "PrintSetting"
+            r1 = 0
+            android.content.SharedPreferences r0 = r5.getSharedPreferences(r0, r1)
+            if (r0 != 0) goto L_0x0014
+            return r2
+        L_0x0014:
+            java.lang.String r3 = "PRINTER_NAME"
+            r4 = 2131625174(0x7f0e04d6, float:1.8877549E38)
+            java.lang.String r4 = r5.getString(r4)
+            java.lang.String r0 = r0.getString(r3, r4)
+            if (r0 != 0) goto L_0x0024
+            return r2
+        L_0x0024:
+            java.lang.String r3 = r5.currentPrinterName
+            boolean r0 = r3.equalsIgnoreCase(r0)
+            if (r0 != 0) goto L_0x002d
+            return r2
+        L_0x002d:
+            return r1
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.p006ui.PrintPreviewActivity.isPrinterChanged():boolean");
+    }
+
+    /* access modifiers changed from: protected */
+    public void onActivityResult(int i, int i2, Intent intent) {
+        super.onActivityResult(i, i2, intent);
+        switch (i) {
+            case 1:
+                enablePrintButton();
+                ExternalFileUtils.getInstance(this).initPrintDir();
+                this.mReviewInvitationViewModel.onPrintEnd(CameraPrintProgress.isPrintSuccess(i2));
+                return;
+            case 2:
+                if (i2 == 3) {
+                    enablePrintButton();
+                    if (isPrinterChanged()) {
+                        this.aPaperSourceSetting = null;
+                        setPaperSizeDisplayForNoPapaerInfoPrinter();
+                        startLoadtask();
+                        return;
+                    }
+                    loadPrinterSettingAndChangeView(false);
+                    return;
+                }
+                return;
+            case 3:
+                if (updateManuscriptSize()) {
+                    this.mPreviewView.setPrintTargetSize(this.mManuscriptSize.getPixelWidth(), this.mManuscriptSize.getPixelHeight());
+                    this.mPreviewView.update();
+                    return;
+                }
+                return;
+            case 4:
+                if (i2 == -1) {
+                    this.aPaperSourceSetting = null;
+                    setPaperSizeDisplayForNoPapaerInfoPrinter();
+                    this.bAutoStartPrint = true;
+                    startLoadtask();
+                    return;
+                }
+                return;
+            default:
+                return;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onRestart() {
+        super.onRestart();
+        PreviewView previewView = this.mPreviewView;
+        if (previewView != null) {
+            previewView.restoreBitmap();
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onResume() {
+        super.onResume();
+        NfcTagUtils.enableForegroundDispatch(this, (IntentFilter[]) null, (String[][]) null);
+        this.paperMissmath.setVisibility(4);
+        this.paperSourceInfo.start(this, this.mHandler);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onNewIntent(Intent intent) {
+        NfcTagUtils.EpsonNfcConnectInfo parseNECTag;
+        super.onNewIntent(intent);
+        String action = intent.getAction();
+        AllReloadTask allReloadTask = this.reloadTask;
+        if (allReloadTask != null && allReloadTask.getStatus() == AsyncTask.Status.FINISHED && "android.nfc.action.NDEF_DISCOVERED".equals(action) && (parseNECTag = NfcTagUtils.parseNECTag(this, intent)) != null) {
+            Intent intent2 = new Intent();
+            intent2.setClass(this, ActivityNfcPrinter.class);
+            intent2.putExtra(ActivityNfcPrinter.CONNECTINFO, parseNECTag);
+            intent2.putExtra(ActivityNfcPrinter.CHANGEMODE, 1);
+            startActivityForResult(intent2, 4);
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onDestroy() {
+        EPLog.m316v("ActivityImageViewSelect", "onDestroy");
+        super.onDestroy();
+        IEpsonService iEpsonService = this.mEpsonService;
+        if (iEpsonService != null) {
+            try {
+                iEpsonService.cancelSearchPrinter();
+                this.mEpsonService.unregisterCallback(this.mCallback);
+                unbindService(this.mEpsonConnection);
+            } catch (RemoteException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPause() {
+        EPLog.m305d("ActivityImageViewSelect", "onPause");
+        super.onPause();
+        if (isFinishing()) {
+            AllReloadTask allReloadTask = this.reloadTask;
+            if (allReloadTask != null) {
+                allReloadTask.cancel(false);
+            }
+            dismissProgressDialog();
+            this.mHandler.removeMessages(3);
+            this.mHandler.removeMessages(5);
+            this.mHandler.removeMessages(0);
+            this.mHandler.removeMessages(1);
+            this.mHandler.removeMessages(100);
+            this.mHandler.removeMessages(8);
+            this.mPreviewView.setPrttargetScaleChangeListener((PreviewView.PrttargetScaleChangeListener) null);
+            this.mPreviewView = null;
+        }
+        NfcTagUtils.disableForegroundDispatch(this);
+        this.paperSourceInfo.stop();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onStop() {
+        if (isFinishing()) {
+            new PrintSetting(this, PrintSetting.Kind.cameracopy).resetPrintSettings();
+        }
+        super.onStop();
+    }
+
+    /* access modifiers changed from: package-private */
+    public void check3GAndStartPrint() {
+        this.mHandler.sendEmptyMessage(5);
+    }
+
+    /* access modifiers changed from: private */
+    public void startLoadtask() {
+        this.reloadTask = new AllReloadTask();
+        this.reloadTask.executeOnExecutor(new Void[0]);
+    }
+
+    /* access modifiers changed from: private */
+    public void showProgressDialog() {
+        this.mModelDialog.doShow(DIALOG_PROGRESS);
+    }
+
+    /* access modifiers changed from: private */
+    public void dismissProgressDialog() {
+        this.mModelDialog.doDismiss(DIALOG_PROGRESS);
+    }
+
+    /* access modifiers changed from: private */
+    public void startPrint() {
+        ExternalFileUtils.getInstance(this).initPrintDir();
+        ImageAndLayout imageAndLayout = this.mPreviewView.getImageAndLayout();
+        imageAndLayout.setOrgFileName(this.mImageList.get(0).loadImageFileName);
+        ArrayList arrayList = new ArrayList();
+        arrayList.add(imageAndLayout);
+        Intent intent = new Intent(this, CameraPrintProgress.class);
+        intent.putExtra(CameraPrintProgress.KEY_IMAGE_AND_LAYOUT, arrayList);
+        startActivityForResult(intent, 1);
+    }
+
+    /* access modifiers changed from: private */
+    public void updatePaperDisplay(Message message) {
+        this.aPaperSourceSetting = message.getData().getParcelableArrayList(PaperSourceInfo.KEY_PAPERSOURCEINFO);
+        if (this.aPaperSourceSetting != null) {
+            this.papersizeTextView.setTextColor(getResources().getColor(C2135R.color.epson_blue));
+            this.mPrintTargetSizeText.setTextColor(getResources().getColor(C2135R.color.epson_blue));
+            this.mScaleText.setTextColor(getResources().getColor(C2135R.color.epson_blue));
+            PrintSetting printSetting = new PrintSetting(this, PrintSetting.Kind.cameracopy);
+            printSetting.loadSettings();
+            if (this.paperSourceInfo.checkPaperMissmatch(printSetting, this.aPaperSourceSetting)) {
+                this.paperMissmath.setVisibility(0);
+            } else {
+                this.paperMissmath.setVisibility(4);
+            }
+        } else {
+            setPaperSizeDisplayForNoPapaerInfoPrinter();
+        }
+    }
+
+    private void setPaperSizeDisplayForNoPapaerInfoPrinter() {
+        this.papersizeTextView.setTextColor(getResources().getColor(C2135R.color.all_black));
+        this.mPrintTargetSizeText.setTextColor(getResources().getColor(C2135R.color.all_black));
+        this.mScaleText.setTextColor(getResources().getColor(C2135R.color.all_black));
+        this.paperMissmath.setVisibility(4);
+    }
+
+    /* access modifiers changed from: private */
+    public boolean isRemotePrinter() {
+        return MyPrinter.isRemotePrinter(this);
+    }
+
+    private void showDialog(String str) {
+        DialogProgress newInstance = DialogProgress.newInstance(str, 0, getString(C2135R.string.str_load));
+        newInstance.setCancelable(false);
+        newInstance.show(getSupportFragmentManager(), str);
+    }
+
+    private void dismissDialog(String str) {
+        DialogFragment dialogFragment = (DialogFragment) getSupportFragmentManager().findFragmentByTag(str);
+        if (dialogFragment != null) {
+            dialogFragment.dismiss();
+        }
+    }
+
+    public void onClick(View view) {
+        switch (view.getId()) {
+            case C2135R.C2137id.icon_papermissmatch /*2131231117*/:
+            case C2135R.C2137id.paper_size_text /*2131231310*/:
+            case C2135R.C2137id.printtarget_size_text /*2131231374*/:
+                if (this.aPaperSourceSetting != null) {
+                    Intent intent = new Intent();
+                    intent.setClass(this, PaperSourceSettingScr.class);
+                    intent.putParcelableArrayListExtra(PaperSourceInfo.KEY_PAPERSOURCEINFO, this.aPaperSourceSetting);
+                    intent.putExtra(PaperSourceSettingScr.PRINT_SETTING_TYPE, PrintSetting.Kind.cameracopy.name());
+                    startActivityForResult(intent, 2);
+                    return;
+                }
+                callPrintSetting();
+                return;
+            case C2135R.C2137id.print_button /*2131231336*/:
+                this.mIsRemotePrinter = isRemotePrinter();
+                if (this.mIsRemotePrinter && this.enableShowWarning) {
+                    AlertDialog.Builder cancelable = new AlertDialog.Builder(this).setCancelable(false);
+                    cancelable.setMessage(getString(C2135R.string.epsonconnect_str_remote_print_warning) + "\n\n" + getString(C2135R.string.epsonconnect_str_remote_print_warning2)).setPositiveButton(getString(C2135R.string.str_yes), new DialogInterface.OnClickListener() {
+                        public void onClick(DialogInterface dialogInterface, int i) {
+                            PrintPreviewActivity.this.check3GAndStartPrint();
+                        }
+                    }).setNegativeButton(getString(C2135R.string.str_no), new DialogInterface.OnClickListener() {
+                        public void onClick(DialogInterface dialogInterface, int i) {
+                        }
+                    }).show();
+                    return;
+                } else if (this.currentPrinterName.equalsIgnoreCase(getString(C2135R.string.str_lbl_title_scan))) {
+                    new AlertDialog.Builder(this).setCancelable(false).setTitle(C2135R.string.printer_notselect_title).setMessage(getString(C2135R.string.printer_notselect_warning)).setPositiveButton(getString(C2135R.string.str_ok), new DialogInterface.OnClickListener() {
+                        public void onClick(DialogInterface dialogInterface, int i) {
+                        }
+                    }).show();
+                    return;
+                } else {
+                    check3GAndStartPrint();
+                    return;
+                }
+            case C2135R.C2137id.rotate_button /*2131231420*/:
+                this.mPreviewView.rotateImageR90();
+                this.mPreviewView.update();
+                return;
+            default:
+                return;
+        }
+    }
+
+    public boolean onOptionsItemSelected(MenuItem menuItem) {
+        if (menuItem.getItemId() == C2135R.C2137id.Menu_Show_PrintSettings) {
+            callPrintSetting();
+        }
+        return super.onOptionsItemSelected(menuItem);
+    }
+
+    public boolean onCreateOptionsMenu(Menu menu) {
+        super.onCreateOptionsMenu(menu);
+        getMenuInflater().inflate(C2135R.C2138menu.print_menu, menu);
+        return true;
+    }
+
+    private void setPreferencesDocumentMode() {
+        SharedPreferences.Editor edit = getSharedPreferences("PrintSetting", 0).edit();
+        edit.putInt(Constants.SOURCE_TYPE, 1);
+        edit.commit();
+    }
+
+    public void callPrintSetting() {
+        System.gc();
+        Intent intent = new Intent(this, CameraPrintSettingActivity.class);
+        intent.setAction("android.intent.action.VIEW");
+        startActivityForResult(intent, 2);
+    }
+
+    public boolean onKeyDown(int i, KeyEvent keyEvent) {
+        if (keyEvent.getAction() == 0 && i == 84) {
+            EPLog.m307e("key search", "diable");
+            return true;
+        } else if (keyEvent.getAction() != 0 || i != 4) {
+            return false;
+        } else {
+            onBackPressed();
+            return true;
+        }
+    }
+
+    public void onConfigurationChanged(Configuration configuration) {
+        super.onConfigurationChanged(configuration);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onRestoreInstanceState(Bundle bundle) {
+        super.onRestoreInstanceState(bundle);
+        this.mPreviewView.restoreInstanceState(bundle, KEY_PREVIEW_VIEW);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onSaveInstanceState(Bundle bundle) {
+        this.mPreviewView.saveInstanceState(bundle, KEY_PREVIEW_VIEW);
+        super.onSaveInstanceState(bundle);
+    }
+
+    public void onPrttargetScaleChange(double d) {
+        this.mHandler.sendMessage(this.mHandler.obtainMessage(8, Double.valueOf(d)));
+    }
+
+    public void invitationDialogClicked(boolean z) {
+        this.mReviewInvitationViewModel.setStartStoreEnd();
+    }
+
+    /* renamed from: com.epson.cameracopy.ui.PrintPreviewActivity$AllReloadTask */
+    public class AllReloadTask extends AsyncTaskExecutor<Void, Integer, Boolean> {
+        public AllReloadTask() {
+        }
+
+        /* access modifiers changed from: protected */
+        public void onPreExecute() {
+            PrintPreviewActivity.this.showProgressDialog();
+        }
+
+        /* access modifiers changed from: protected */
+        public Boolean doInBackground(Void... voidArr) {
+            System.gc();
+            int i = 0;
+            do {
+                try {
+                    if (PrintPreviewActivity.this.mEpsonService != null) {
+                        break;
+                    } else if (isCancelled()) {
+                        return false;
+                    } else {
+                        Thread.sleep(100);
+                        i++;
+                    }
+                } catch (RemoteException e) {
+                    e.printStackTrace();
+                } catch (InterruptedException e2) {
+                    e2.printStackTrace();
+                }
+            } while (i < 100);
+            if (isCancelled()) {
+                return false;
+            }
+            if (PrintPreviewActivity.this.mEpsonService != null) {
+                if (PrintPreviewActivity.this.isRemotePrinter()) {
+                    PrintPreviewActivity.this.mEpsonService.EpsonConnectUpdatePrinterSettings(PrintSetting.Kind.cameracopy.name());
+                } else {
+                    PrintPreviewActivity.this.mEpsonService.updatePrinterSettings(PrintSetting.Kind.cameracopy.name());
+                }
+            }
+            return true;
+        }
+
+        /* access modifiers changed from: protected */
+        public void onPostExecute(Boolean bool) {
+            PrintPreviewActivity.this.loadPrinterSettingAndChangeView(false);
+            PrintPreviewActivity.this.dismissProgressDialog();
+            if (PrintPreviewActivity.this.bAutoStartPrint) {
+                PrintPreviewActivity printPreviewActivity = PrintPreviewActivity.this;
+                printPreviewActivity.onClick(printPreviewActivity.printButton);
+                PrintPreviewActivity.this.bAutoStartPrint = false;
+            }
+        }
+    }
+}

+ 37 - 0
app/src/main/java/com/epson/cameracopy/p006ui/SimpleMessageDialogFragment.java

@@ -0,0 +1,37 @@
+package com.epson.cameracopy.p006ui;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.support.p000v4.app.DialogFragment;
+import epson.print.C2135R;
+
+/* renamed from: com.epson.cameracopy.ui.SimpleMessageDialogFragment */
+public class SimpleMessageDialogFragment extends DialogFragment {
+    private static final String PARAM_MESSAGE_RESOURCE_ID = "resource-id";
+    private int mResourceId;
+
+    static SimpleMessageDialogFragment newInstance(int i) {
+        SimpleMessageDialogFragment simpleMessageDialogFragment = new SimpleMessageDialogFragment();
+        Bundle bundle = new Bundle();
+        bundle.putInt(PARAM_MESSAGE_RESOURCE_ID, i);
+        simpleMessageDialogFragment.setArguments(bundle);
+        return simpleMessageDialogFragment;
+    }
+
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        this.mResourceId = getArguments().getInt(PARAM_MESSAGE_RESOURCE_ID);
+    }
+
+    public Dialog onCreateDialog(Bundle bundle) {
+        super.onCreateDialog(bundle);
+        AlertDialog create = new AlertDialog.Builder(getActivity()).setMessage(getResources().getString(this.mResourceId)).setPositiveButton(C2135R.string.ok_button, new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialogInterface, int i) {
+            }
+        }).create();
+        create.setCanceledOnTouchOutside(false);
+        return create;
+    }
+}

+ 34 - 0
app/src/main/java/com/epson/cameracopy/printlayout/AutoManuscriptSize.java

@@ -0,0 +1,34 @@
+package com.epson.cameracopy.printlayout;
+
+import android.content.Context;
+import android.graphics.Point;
+import epson.print.C2135R;
+import java.util.Locale;
+
+/* compiled from: ManuscriptSize */
+class AutoManuscriptSize extends IdManuscriptSize {
+    public boolean displayLength() {
+        return true;
+    }
+
+    public AutoManuscriptSize(DocumentSizeInfo documentSizeInfo) {
+        super(documentSizeInfo);
+    }
+
+    public Point getBasePixelSize(int i) {
+        Point dpiPaperSizeById = IdManuscriptSize.getDpiPaperSizeById(0, i);
+        if (dpiPaperSizeById == null) {
+            return null;
+        }
+        return dpiPaperSizeById;
+    }
+
+    public int getUnitType(Context context) {
+        String country = Locale.getDefault().getCountry();
+        return ("US".equals(country) || "USA".equals(country) || "CA".equals(country) || "CAN".equals(country)) ? 2 : 1;
+    }
+
+    public String getSizeName(Context context) {
+        return context.getString(C2135R.string.papersize_auto);
+    }
+}

+ 72 - 0
app/src/main/java/com/epson/cameracopy/printlayout/CustomManuscriptSize.java

@@ -0,0 +1,72 @@
+package com.epson.cameracopy.printlayout;
+
+import android.content.Context;
+import android.graphics.Point;
+import android.graphics.PointF;
+import com.epson.cameracopy.printlayout.ManuscriptSize;
+
+/* compiled from: ManuscriptSize */
+class CustomManuscriptSize implements ManuscriptSize.ManuscriptTypeAdapter {
+    private DocumentSizeInfo mDocumentSizeInfo;
+    private double mHeight;
+    private int mScale;
+    private double mWidth;
+
+    public boolean displayLength() {
+        return true;
+    }
+
+    public CustomManuscriptSize(DocumentSizeInfo documentSizeInfo) {
+        this.mDocumentSizeInfo = documentSizeInfo;
+        this.mWidth = documentSizeInfo.getWidth();
+        this.mHeight = documentSizeInfo.getHeight();
+        this.mScale = documentSizeInfo.getScaleId();
+    }
+
+    public Point getBasePixelSize(int i) {
+        return new Point(lengthToPixel(this.mWidth, i), lengthToPixel(this.mHeight, i));
+    }
+
+    public String getSizeName(Context context) {
+        return this.mDocumentSizeInfo.getDocSizeName(context);
+    }
+
+    public int getUnitType(Context context) {
+        return this.mDocumentSizeInfo.getScaleId() == 2 ? 2 : 1;
+    }
+
+    public PointF getCustomDocumentSize(Context context) {
+        return new PointF((float) this.mWidth, (float) this.mHeight);
+    }
+
+    /* access modifiers changed from: protected */
+    public int lengthToPixel(double d, int i) {
+        switch (this.mDocumentSizeInfo.getScaleId()) {
+            case 1:
+                return (int) (((d * ((double) i)) / 25.4d) + 0.5d);
+            case 2:
+                return (int) ((d * ((double) i)) + 0.5d);
+            default:
+                return 0;
+        }
+    }
+
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null || getClass() != obj.getClass()) {
+            return false;
+        }
+        CustomManuscriptSize customManuscriptSize = (CustomManuscriptSize) obj;
+        DocumentSizeInfo documentSizeInfo = this.mDocumentSizeInfo;
+        if (documentSizeInfo == null) {
+            if (customManuscriptSize.mDocumentSizeInfo != null) {
+                return false;
+            }
+        } else if (!documentSizeInfo.equals(customManuscriptSize.mDocumentSizeInfo)) {
+            return false;
+        }
+        return Double.doubleToLongBits(this.mHeight) == Double.doubleToLongBits(customManuscriptSize.mHeight) && this.mScale == customManuscriptSize.mScale && Double.doubleToLongBits(this.mWidth) == Double.doubleToLongBits(customManuscriptSize.mWidth);
+    }
+}

+ 192 - 0
app/src/main/java/com/epson/cameracopy/printlayout/DocumentSizeInfo.java

@@ -0,0 +1,192 @@
+package com.epson.cameracopy.printlayout;
+
+import android.content.Context;
+import android.os.Parcel;
+import android.os.Parcelable;
+import epson.print.C2135R;
+import java.io.Serializable;
+import java.util.LinkedList;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class DocumentSizeInfo implements Parcelable, Serializable {
+    public static final Parcelable.Creator<DocumentSizeInfo> CREATOR = new Parcelable.Creator<DocumentSizeInfo>() {
+        public DocumentSizeInfo createFromParcel(Parcel parcel) {
+            return new DocumentSizeInfo(parcel);
+        }
+
+        public DocumentSizeInfo[] newArray(int i) {
+            return new DocumentSizeInfo[i];
+        }
+    };
+    public static final int DOCSIZE_NAME_USER_DEFINE = 0;
+    private static final int[] DOCUMENT_SIZE_NAME = {C2135R.string.papersize_auto, C2135R.string.papersize_auto, C2135R.string.papersize_a3, C2135R.string.papersize_a4, C2135R.string.papersize_a5, C2135R.string.papersize_a6, C2135R.string.papersize_b4, C2135R.string.papersize_b5, C2135R.string.papersize_b6, C2135R.string.papersize_letter, C2135R.string.papersize_legal, C2135R.string.papersize_postcard, C2135R.string.papersize_10x15, C2135R.string.papersize_l, C2135R.string.papersize_2l, C2135R.string.papersize_card, C2135R.string.papersize_buzcard, C2135R.string.papersize_passport};
+    public static final double PAPER_A4_HEIGHT = 297.0d;
+    public static final double PAPER_A4_WIDTH = 210.0d;
+    public static final int PAPER_AUTO = -1;
+    public static final double PAPER_LETTER_HEIGHT = 11.0d;
+    public static final double PAPER_LETTER_WIDTH = 8.5d;
+    public static final int PAPER_USER_DEFINE = -2;
+    public static final int SCALE_TYPE_INCH = 2;
+    public static final int SCALE_TYPE_MM = 1;
+    private static final long serialVersionUID = 4845251233379966243L;
+    private String mDocSizeName;
+    private int mDocSizeNameId;
+    private double mHeight;
+    private int mPaperId;
+    private int mScaleId;
+    private double mWidth;
+
+    public int describeContents() {
+        return 0;
+    }
+
+    public DocumentSizeInfo() {
+    }
+
+    public String getDocSizeName() {
+        return this.mDocSizeName;
+    }
+
+    public String getDocSizeName(Context context) {
+        int i = this.mDocSizeNameId;
+        if (i > 0) {
+            int[] iArr = DOCUMENT_SIZE_NAME;
+            if (i <= iArr.length - 1) {
+                return context.getString(iArr[i]);
+            }
+        }
+        return this.mDocSizeName;
+    }
+
+    public void setDocSizeName(String str) {
+        this.mDocSizeName = str;
+    }
+
+    public int getScaleId() {
+        return this.mScaleId;
+    }
+
+    public void setScaleId(int i) {
+        this.mScaleId = i;
+    }
+
+    public double getWidth() {
+        return this.mWidth;
+    }
+
+    public void setWidth(double d) {
+        this.mWidth = d;
+    }
+
+    public double getHeight() {
+        return this.mHeight;
+    }
+
+    public void setHeight(double d) {
+        this.mHeight = d;
+    }
+
+    public int getPaperId() {
+        return this.mPaperId;
+    }
+
+    public void setPaperId(int i) {
+        this.mPaperId = i;
+    }
+
+    public int getDocSizeNameId() {
+        return this.mDocSizeNameId;
+    }
+
+    public void setDocSizeNameId(int i) {
+        this.mDocSizeNameId = i;
+    }
+
+    public void update(DocumentSizeInfo documentSizeInfo) {
+        this.mDocSizeName = documentSizeInfo.mDocSizeName;
+        this.mScaleId = documentSizeInfo.mScaleId;
+        this.mWidth = documentSizeInfo.mWidth;
+        this.mHeight = documentSizeInfo.mHeight;
+        this.mDocSizeNameId = documentSizeInfo.mDocSizeNameId;
+    }
+
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null || getClass() != obj.getClass()) {
+            return false;
+        }
+        DocumentSizeInfo documentSizeInfo = (DocumentSizeInfo) obj;
+        String str = this.mDocSizeName;
+        if (str == null) {
+            if (documentSizeInfo.mDocSizeName != null) {
+                return false;
+            }
+        } else if (!str.equals(documentSizeInfo.mDocSizeName)) {
+            return false;
+        }
+        return true;
+    }
+
+    public void writeToParcel(Parcel parcel, int i) {
+        parcel.writeString(this.mDocSizeName);
+        parcel.writeInt(this.mScaleId);
+        parcel.writeDouble(this.mWidth);
+        parcel.writeDouble(this.mHeight);
+        parcel.writeInt(this.mPaperId);
+        parcel.writeInt(this.mDocSizeNameId);
+    }
+
+    private DocumentSizeInfo(Parcel parcel) {
+        this.mDocSizeName = parcel.readString();
+        this.mScaleId = parcel.readInt();
+        this.mWidth = parcel.readDouble();
+        this.mHeight = parcel.readDouble();
+        this.mPaperId = parcel.readInt();
+        this.mDocSizeNameId = parcel.readInt();
+    }
+
+    public static LinkedList<DocumentSizeInfo> getDocumentSizeInfoList(JSONObject jSONObject) throws JSONException {
+        LinkedList<DocumentSizeInfo> linkedList = new LinkedList<>();
+        JSONArray jSONArray = jSONObject.getJSONArray("DocumentSizeInfoList");
+        for (int i = 0; i < jSONArray.length(); i++) {
+            DocumentSizeInfo documentSizeInfo = new DocumentSizeInfo();
+            try {
+                JSONObject jSONObject2 = jSONArray.getJSONObject(i);
+                documentSizeInfo.mDocSizeName = jSONObject2.getString("mDocSizeName");
+                documentSizeInfo.mScaleId = jSONObject2.getInt("mScaleId");
+                documentSizeInfo.mWidth = jSONObject2.getDouble("mWidth");
+                documentSizeInfo.mHeight = jSONObject2.getDouble("mHeight");
+                documentSizeInfo.mPaperId = jSONObject2.getInt("mPaperId");
+                documentSizeInfo.mDocSizeNameId = jSONObject2.getInt("mDocSizeNameId");
+                linkedList.add(documentSizeInfo);
+            } catch (JSONException e) {
+                e.printStackTrace();
+            }
+        }
+        return linkedList;
+    }
+
+    public static JSONArray makeDocumentSizeInfoList(LinkedList<DocumentSizeInfo> linkedList) throws JSONException {
+        JSONArray jSONArray = new JSONArray();
+        for (int i = 0; i < linkedList.size(); i++) {
+            DocumentSizeInfo documentSizeInfo = linkedList.get(i);
+            JSONObject jSONObject = new JSONObject();
+            try {
+                jSONObject.put("mDocSizeName", documentSizeInfo.mDocSizeName);
+                jSONObject.put("mScaleId", documentSizeInfo.mScaleId);
+                jSONObject.put("mWidth", documentSizeInfo.mWidth);
+                jSONObject.put("mHeight", documentSizeInfo.mHeight);
+                jSONObject.put("mPaperId", documentSizeInfo.mPaperId);
+                jSONObject.put("mDocSizeNameId", documentSizeInfo.mDocSizeNameId);
+                jSONArray.put(jSONObject);
+            } catch (JSONException e) {
+                e.printStackTrace();
+            }
+        }
+        return jSONArray;
+    }
+}

+ 78 - 0
app/src/main/java/com/epson/cameracopy/printlayout/IdManuscriptSize.java

@@ -0,0 +1,78 @@
+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;
+import epson.print.C2135R;
+
+/* 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) {
+        this.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(this.mDocumentSizeInfo.getPaperId(), i);
+    }
+
+    public String getSizeName(Context context) {
+        if (this.mDocumentSizeInfo.getDocSizeName(context).equalsIgnoreCase(context.getString(C2135R.string.papersize_passport))) {
+            return this.mDocumentSizeInfo.getDocSizeName(context);
+        }
+        return context.getString(new MediaInfo.PaperSize().getStringId(this.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 = this.mDocumentSizeInfo;
+        if (documentSizeInfo == null) {
+            if (idManuscriptSize.mDocumentSizeInfo != null) {
+                return false;
+            }
+        } else if (!documentSizeInfo.equals(idManuscriptSize.mDocumentSizeInfo)) {
+            return false;
+        }
+        return true;
+    }
+}

+ 580 - 0
app/src/main/java/com/epson/cameracopy/printlayout/ImageAndLayout.java

@@ -0,0 +1,580 @@
+package com.epson.cameracopy.printlayout;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.support.annotation.NonNull;
+import android.support.annotation.VisibleForTesting;
+import com.epson.cameracopy.alt.SimpleBmpMerger;
+import epson.print.Util.ImageFileUtil;
+import epson.print.Util.OpenCvHelper;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import org.opencv.core.Core;
+import org.opencv.core.CvType;
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfInt;
+import org.opencv.core.MatOfPoint2f;
+import org.opencv.core.Point;
+import org.opencv.core.Scalar;
+import org.opencv.core.Size;
+import org.opencv.imgcodecs.Imgcodecs;
+import org.opencv.imgproc.Imgproc;
+
+public class ImageAndLayout implements Parcelable {
+    static final /* synthetic */ boolean $assertionsDisabled = false;
+    public static final Parcelable.Creator<ImageAndLayout> CREATOR = new Parcelable.Creator<ImageAndLayout>() {
+        public ImageAndLayout createFromParcel(Parcel parcel) {
+            return new ImageAndLayout(parcel);
+        }
+
+        public ImageAndLayout[] newArray(int i) {
+            return new ImageAndLayout[i];
+        }
+    };
+    private int mInterpolation;
+    private boolean mIsPaperLandscape;
+    private double mOffsetX;
+    private double mOffsetY;
+    private int mOpenCvExifRotation;
+    private boolean mOpenCvExifRotationCancel;
+    private String mOrgFilename;
+    private double mPrintTargetHeight;
+    private double mPrintTargetWidth;
+    private int mPrintableAreaHeight;
+    private int mPrintableAreaWidth;
+    private int mRotation;
+
+    public int describeContents() {
+        return 0;
+    }
+
+    static {
+        System.loadLibrary("opencv_java3");
+    }
+
+    public ImageAndLayout() {
+        this.mInterpolation = 2;
+        this.mIsPaperLandscape = true;
+        this.mOpenCvExifRotationCancel = true;
+    }
+
+    public void writeToParcel(Parcel parcel, int i) {
+        parcel.writeInt(this.mPrintableAreaWidth);
+        parcel.writeInt(this.mPrintableAreaHeight);
+        parcel.writeString(this.mOrgFilename);
+        parcel.writeDouble(this.mPrintTargetWidth);
+        parcel.writeDouble(this.mPrintTargetHeight);
+        parcel.writeDouble(this.mOffsetX);
+        parcel.writeDouble(this.mOffsetY);
+        parcel.writeInt(this.mRotation);
+        parcel.writeBooleanArray(new boolean[]{this.mIsPaperLandscape});
+    }
+
+    private ImageAndLayout(Parcel parcel) {
+        this.mInterpolation = 2;
+        this.mPrintableAreaWidth = parcel.readInt();
+        this.mPrintableAreaHeight = parcel.readInt();
+        this.mOrgFilename = parcel.readString();
+        this.mPrintTargetWidth = parcel.readDouble();
+        this.mPrintTargetHeight = parcel.readDouble();
+        this.mOffsetX = parcel.readDouble();
+        this.mOffsetY = parcel.readDouble();
+        this.mRotation = parcel.readInt();
+        boolean[] zArr = new boolean[1];
+        parcel.readBooleanArray(zArr);
+        this.mIsPaperLandscape = zArr[0];
+        this.mOpenCvExifRotationCancel = true;
+    }
+
+    public void setOpenCvExifRotationCancel(boolean z) {
+        this.mOpenCvExifRotationCancel = z;
+    }
+
+    public void setLayoutAreaSize(int i, int i2) {
+        this.mPrintableAreaWidth = i;
+        this.mPrintableAreaHeight = i2;
+    }
+
+    public void setLayout(double d, double d2, double d3, double d4, int i) {
+        this.mPrintTargetWidth = d;
+        this.mPrintTargetHeight = d2;
+        this.mOffsetX = d3;
+        this.mOffsetY = d4;
+        this.mRotation = i;
+    }
+
+    public void setPaperIsLandscape(boolean z) {
+        this.mIsPaperLandscape = z;
+    }
+
+    public boolean isPaperLandscape() {
+        return this.mIsPaperLandscape;
+    }
+
+    public void setOrgFileName(String str) {
+        this.mOrgFilename = str;
+    }
+
+    public String getOrgFileName() {
+        return this.mOrgFilename;
+    }
+
+    /* access modifiers changed from: package-private */
+    public double[] getExRate(int[] iArr) {
+        int i;
+        int i2;
+        double[] dArr = {1.0d, 1.0d};
+        if (iArr == null || iArr.length < 2 || (i = this.mPrintableAreaWidth) <= 0 || (i2 = this.mPrintableAreaHeight) <= 0) {
+            return dArr;
+        }
+        dArr[0] = ((double) iArr[0]) / ((double) i);
+        dArr[1] = ((double) iArr[1]) / ((double) i2);
+        return dArr;
+    }
+
+    static Mat new3x2Mat(double d, double d2, double d3, double d4, double d5, double d6) {
+        final double d7 = d;
+        final double d8 = d2;
+        final double d9 = d3;
+        final double d10 = d4;
+        final double d11 = d5;
+        final double d12 = d6;
+        return new Mat(2, 3, 6) {
+            {
+                put(0, 0, d7, d8, d9);
+                put(1, 0, d10, d11, d12);
+            }
+        };
+    }
+
+    static Mat getTransformMat0(Size size, Size size2, double d, double d2, int i) {
+        MatOfPoint2f matOfPoint2f;
+        Size size3 = size;
+        Size size4 = size2;
+        double d3 = size3.width;
+        double d4 = size3.height;
+        MatOfPoint2f matOfPoint2f2 = new MatOfPoint2f(new Point(0.0d, 0.0d), new Point(0.0d, size4.height), new Point(size4.width, 0.0d));
+        switch (i & 3) {
+            case 1:
+                double d5 = d3 + d;
+                double d6 = d2 + 0.0d;
+                matOfPoint2f = new MatOfPoint2f(new Point(d5, d6), new Point(d + 0.0d, d6), new Point(d5, d4 + d2));
+                break;
+            case 2:
+                double d7 = d3 + d;
+                double d8 = d4 + d2;
+                matOfPoint2f = new MatOfPoint2f(new Point(d7, d8), new Point(d7, d2 + 0.0d), new Point(d + 0.0d, d8));
+                break;
+            case 3:
+                double d9 = d + 0.0d;
+                double d10 = d4 + d2;
+                matOfPoint2f = new MatOfPoint2f(new Point(d9, d10), new Point(d3 + d, d10), new Point(d9, d2 + 0.0d));
+                break;
+            default:
+                double d11 = d + 0.0d;
+                double d12 = d2 + 0.0d;
+                matOfPoint2f = new MatOfPoint2f(new Point(d11, d12), new Point(d11, d4 + d2), new Point(d3 + d, d12));
+                break;
+        }
+        Mat affineTransform = Imgproc.getAffineTransform(matOfPoint2f2, matOfPoint2f);
+        matOfPoint2f2.release();
+        matOfPoint2f.release();
+        return affineTransform;
+    }
+
+    static Mat getTransformMat1(Size size, Size size2, double d, double d2, int i) {
+        MatOfPoint2f matOfPoint2f;
+        Size size3 = size;
+        Size size4 = size2;
+        double d3 = size3.width;
+        double d4 = size3.height;
+        double d5 = size3.width;
+        double d6 = size4.width;
+        double d7 = size3.height;
+        double d8 = size4.height;
+        MatOfPoint2f matOfPoint2f2 = new MatOfPoint2f(new Point(0.0d, 0.0d), new Point(0.0d, size4.height), new Point(size4.width, 0.0d));
+        switch (i & 3) {
+            case 1:
+                double d9 = d3 + d;
+                double d10 = d2 + 0.0d;
+                matOfPoint2f = new MatOfPoint2f(new Point(d9, d10), new Point(d + 0.0d, d10), new Point(d9, d4 + d2));
+                break;
+            case 2:
+                double d11 = d3 + d;
+                double d12 = d4 + d2;
+                matOfPoint2f = new MatOfPoint2f(new Point(d11, d12), new Point(d11, d2 + 0.0d), new Point(d + 0.0d, d12));
+                break;
+            case 3:
+                double d13 = d + 0.0d;
+                double d14 = d4 + d2;
+                matOfPoint2f = new MatOfPoint2f(new Point(d13, d14), new Point(d3 + d, d14), new Point(d13, d2 + 0.0d));
+                break;
+            default:
+                double d15 = d + 0.0d;
+                double d16 = d2 + 0.0d;
+                matOfPoint2f = new MatOfPoint2f(new Point(d15, d16), new Point(d15, d4 + d2), new Point(d3 + d, d16));
+                break;
+        }
+        Mat affineTransform = Imgproc.getAffineTransform(matOfPoint2f2, matOfPoint2f);
+        matOfPoint2f2.release();
+        matOfPoint2f.release();
+        return affineTransform;
+    }
+
+    static Mat getTransformMat(Size size, Size size2, double d, double d2, int i) {
+        double d3;
+        double d4;
+        Size size3 = size;
+        Size size4 = size2;
+        if ((i & 1) == 0) {
+            double d5 = size3.width / size4.width;
+            d4 = size3.height / size4.height;
+            d3 = d5;
+        } else {
+            double d6 = size3.width / size4.height;
+            d4 = size3.height / size4.width;
+            d3 = d6;
+        }
+        int i2 = (int) (d3 / 2.0d);
+        int i3 = (int) (d4 / 2.0d);
+        switch (i & 3) {
+            case 1:
+                return new3x2Mat(0.0d, -d3, ((d + size3.width) - ((double) i2)) - 1.0d, d4, 0.0d, d2 + ((double) i3));
+            case 2:
+                return new3x2Mat(-d3, 0.0d, ((d + size3.width) - ((double) i2)) - 1.0d, 0.0d, -d4, ((d2 + size3.height) - ((double) i3)) - 1.0d);
+            case 3:
+                return new3x2Mat(0.0d, d3, d + ((double) i2), -d4, 0.0d, ((d2 + size3.height) - ((double) i3)) - 1.0d);
+            default:
+                return new3x2Mat(d3, 0.0d, d + ((double) i2), 0.0d, d4, d2 + ((double) i3));
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public Size getPrintImageSize(double[] dArr) {
+        return new Size(this.mPrintTargetWidth * dArr[0], this.mPrintTargetHeight * dArr[1]);
+    }
+
+    /* access modifiers changed from: package-private */
+    public Mat getPrintMat(int[] iArr, int i, Mat mat) {
+        switch (i & 3) {
+            case 1:
+                Mat mat2 = new Mat(2, 3, 6);
+                mat2.put(0, 0, mat.get(1, 0)[0] * -1.0d);
+                mat2.put(0, 1, mat.get(1, 1)[0] * -1.0d);
+                mat2.put(0, 2, (mat.get(1, 2)[0] * -1.0d) + ((double) iArr[0]));
+                mat2.put(1, 0, mat.get(0, 0)[0]);
+                mat2.put(1, 1, mat.get(0, 1)[0]);
+                mat2.put(1, 2, mat.get(0, 2)[0]);
+                return mat2;
+            case 2:
+                Mat mat3 = null;
+                mat3.put(0, 0, mat.get(0, 0)[0] * -1.0d);
+                mat3.put(0, 1, mat.get(0, 1)[0] * -1.0d);
+                mat3.put(0, 2, (mat.get(0, 2)[0] * -1.0d) + ((double) iArr[0]));
+                mat3.put(1, 0, mat.get(1, 0)[0] * -1.0d);
+                mat3.put(1, 1, mat.get(1, 1)[0] * -1.0d);
+                mat3.put(1, 2, (mat.get(1, 2)[0] * -1.0d) + ((double) iArr[1]));
+                return mat3;
+            case 3:
+                Mat mat4 = new Mat(2, 3, 6);
+                mat4.put(0, 0, mat.get(1, 0)[0]);
+                mat4.put(0, 1, mat.get(1, 1)[0]);
+                mat4.put(0, 2, mat.get(1, 2)[0] + ((double) iArr[0]));
+                mat4.put(1, 0, mat.get(0, 0)[0] * -1.0d);
+                mat4.put(1, 1, mat.get(0, 1)[0] * -1.0d);
+                mat4.put(1, 2, mat.get(0, 2)[0] * -1.0d);
+                return mat4;
+            default:
+                return mat.clone();
+        }
+    }
+
+    public Mat makePrintImageMat(Mat mat, int i, int[] iArr) {
+        Mat transMat = getTransMat(mat, i, iArr);
+        Mat mat2 = new Mat(iArr[1], iArr[0], mat.type());
+        Imgproc.warpAffine(mat, mat2, transMat, mat2.size(), this.mInterpolation, 0, new Scalar(255.0d, 255.0d, 255.0d, 255.0d));
+        transMat.release();
+        return mat2;
+    }
+
+    private Mat getTransMat(Mat mat, int i, int[] iArr) {
+        int[] iArr2 = new int[2];
+        if ((i & 1) != 0) {
+            iArr2[0] = iArr[1];
+            iArr2[1] = iArr[0];
+        } else {
+            iArr2[0] = iArr[0];
+            iArr2[1] = iArr[1];
+        }
+        double[] exRate = getExRate(iArr2);
+        Size printImageSize = getPrintImageSize(exRate);
+        double d = this.mOffsetX * exRate[0];
+        double d2 = this.mOffsetY;
+        int imageRotation = getImageRotation(this.mRotation);
+        Mat transformMat = getTransformMat(printImageSize, mat.size(), d, exRate[1] * d2, imageRotation);
+        Mat printMat = getPrintMat(iArr, i, transformMat);
+        transformMat.release();
+        return printMat;
+    }
+
+    private boolean affineBand(Mat mat, Mat mat2, int i, int i2, int i3, File file) {
+        Mat clone = mat2.clone();
+        Mat mat3 = new Mat();
+        Size size = new Size((double) i, (double) i2);
+        clone.put(1, 2, clone.get(1, 2)[0] - ((double) i3));
+        Mat mat4 = null;
+        try {
+            Imgproc.warpAffine(mat, mat3, clone, size, this.mInterpolation, 0, new Scalar(255.0d, 255.0d, 255.0d, 255.0d));
+            if (mat.type() == CvType.CV_8UC1) {
+                mat4 = make24BitMatFromGrayMat(mat3);
+                if (!Imgcodecs.imwrite(file.toString(), mat4)) {
+                    clone.release();
+                    mat3.release();
+                    if (mat4 != null) {
+                        mat4.release();
+                    }
+                    return false;
+                }
+            } else if (!Imgcodecs.imwrite(file.toString(), mat3)) {
+                clone.release();
+                mat3.release();
+                return false;
+            }
+            clone.release();
+            mat3.release();
+            if (mat4 != null) {
+                mat4.release();
+            }
+            return true;
+        } catch (Exception unused) {
+            clone.release();
+            mat3.release();
+            if (mat4 != null) {
+                mat4.release();
+            }
+            return false;
+        } catch (Throwable th) {
+            clone.release();
+            mat3.release();
+            if (mat4 != null) {
+                mat4.release();
+            }
+            throw th;
+        }
+    }
+
+    private boolean makeBandImageFile(Mat mat, int i, int[] iArr, String str, LinkedList<File> linkedList) {
+        String str2 = str;
+        LinkedList<File> linkedList2 = linkedList;
+        Mat transMat = getTransMat(mat, i, iArr);
+        int i2 = 0;
+        int i3 = 0;
+        while (true) {
+            int i4 = i2 + 512;
+            if (i4 < iArr[1]) {
+                File file = new File(str2, "bo" + i3 + ".bmp");
+                affineBand(mat, transMat, iArr[0], 512, i2, file);
+                if (!file.exists()) {
+                    return false;
+                }
+                linkedList2.addFirst(file);
+                i3++;
+                i2 = i4;
+            } else {
+                File file2 = new File(str2, "bo" + i3 + ".bmp");
+                if (!affineBand(mat, transMat, iArr[0], iArr[1] - i2, i2, file2)) {
+                    return false;
+                }
+                linkedList2.addFirst(file2);
+                return true;
+            }
+        }
+    }
+
+    private boolean makePrintImageFile(Mat mat, int i, int[] iArr, String str) {
+        String parent = new File(str).getParent();
+        LinkedList linkedList = new LinkedList();
+        if (makeBandImageFile(mat, i, iArr, parent, linkedList) && SimpleBmpMerger.margeBmpFile(str, linkedList.iterator())) {
+            return true;
+        }
+        return false;
+    }
+
+    /* access modifiers changed from: package-private */
+    public Mat make24BitMatFromGrayMat(Mat mat) {
+        Mat mat2 = new Mat(mat.height(), mat.width(), CvType.CV_8UC3);
+        Core.mixChannels(Arrays.asList(new Mat[]{mat}), Arrays.asList(new Mat[]{mat2}), new MatOfInt(0, 0, 0, 1, 0, 2));
+        return mat2;
+    }
+
+    public boolean createPrintData(String str, boolean z, int[] iArr, int i) {
+        Mat mat = null;
+        try {
+            setOpenCvJpegRotation(this.mOrgFilename);
+            Mat imread = Imgcodecs.imread(this.mOrgFilename, -1);
+            mat = imread.channels() == 4 ? convertRgbaToRgbTrWhite(imread) : imread;
+            if (z) {
+                int channels = mat.channels();
+                if (channels != 1) {
+                    if (channels != 3) {
+                        if (mat != null) {
+                            mat.release();
+                        }
+                        File file = new File(str);
+                        if (file.exists()) {
+                            file.delete();
+                        }
+                        return false;
+                    }
+                    Imgproc.cvtColor(mat, mat, 7);
+                    Imgproc.cvtColor(mat, mat, 8, 3);
+                }
+            }
+            boolean makePrintImageFile = makePrintImageFile(mat, i, iArr, str);
+            if (mat != null) {
+                mat.release();
+            }
+            if (!makePrintImageFile) {
+                File file2 = new File(str);
+                if (file2.exists()) {
+                    file2.delete();
+                }
+            }
+            return makePrintImageFile;
+        } catch (OutOfMemoryError unused) {
+            if (mat != null) {
+                mat.release();
+            }
+            File file3 = new File(str);
+            if (file3.exists()) {
+                file3.delete();
+            }
+            return false;
+        } catch (Exception unused2) {
+            if (mat != null) {
+                mat.release();
+            }
+            File file4 = new File(str);
+            if (file4.exists()) {
+                file4.delete();
+            }
+            return false;
+        } catch (Throwable th) {
+            if (mat != null) {
+                mat.release();
+            }
+            File file5 = new File(str);
+            if (file5.exists()) {
+                file5.delete();
+            }
+            throw th;
+        }
+    }
+
+    @VisibleForTesting
+    static Mat calc255Alpha(Mat mat) {
+        Mat mat2 = new Mat();
+        Core.multiply(mat, new Scalar(-255.0d), mat2);
+        Mat mat3 = new Mat();
+        Core.add(mat2, new Scalar(255.0d), mat3);
+        mat2.release();
+        return mat3;
+    }
+
+    @VisibleForTesting
+    @NonNull
+    static Mat convertRgbaToRgbTrWhite(Mat mat) {
+        ArrayList arrayList = new ArrayList();
+        Core.split(mat, arrayList);
+        mat.release();
+        Mat mat2 = new Mat();
+        ((Mat) arrayList.get(3)).convertTo(mat2, CvType.CV_32FC1, 0.00392156862745098d);
+        ((Mat) arrayList.get(3)).release();
+        arrayList.remove(3);
+        ArrayList arrayList2 = new ArrayList();
+        for (int i = 0; i < 3; i++) {
+            arrayList2.add(mat2);
+        }
+        Mat mat3 = new Mat();
+        Core.merge(arrayList2, mat3);
+        Mat mat4 = new Mat();
+        Mat mat5 = new Mat();
+        Core.merge(arrayList, mat4);
+        ((Mat) arrayList.get(0)).release();
+        ((Mat) arrayList.get(1)).release();
+        ((Mat) arrayList.get(2)).release();
+        mat4.convertTo(mat5, CvType.CV_32FC1);
+        mat4.release();
+        Mat mul = mat5.mul(mat3);
+        mat5.release();
+        Mat mat6 = new Mat();
+        mul.convertTo(mat6, CvType.CV_8UC3);
+        mul.release();
+        Mat calc255Alpha = calc255Alpha(mat2);
+        Mat mat7 = new Mat();
+        calc255Alpha.convertTo(mat7, CvType.CV_8UC1);
+        Mat mat8 = new Mat();
+        Imgproc.cvtColor(mat7, mat8, 8, 3);
+        Core.add(mat6, mat8, mat6);
+        return mat6;
+    }
+
+    @NonNull
+    private static Mat convertRgbaToRgb(Mat mat) {
+        ArrayList arrayList = new ArrayList();
+        Core.split(mat, arrayList);
+        mat.release();
+        Mat mat2 = new Mat();
+        ((Mat) arrayList.get(3)).convertTo(mat2, CvType.CV_32FC1, 0.00392156862745098d);
+        ((Mat) arrayList.get(3)).release();
+        arrayList.remove(3);
+        ArrayList arrayList2 = new ArrayList();
+        for (int i = 0; i < 3; i++) {
+            arrayList2.add(mat2);
+        }
+        Mat mat3 = new Mat();
+        Core.merge(arrayList2, mat3);
+        mat2.release();
+        Mat mat4 = new Mat();
+        Mat mat5 = new Mat();
+        Core.merge(arrayList, mat4);
+        ((Mat) arrayList.get(0)).release();
+        ((Mat) arrayList.get(1)).release();
+        ((Mat) arrayList.get(2)).release();
+        mat4.convertTo(mat5, CvType.CV_32FC1);
+        mat4.release();
+        Mat mul = mat5.mul(mat3);
+        mat5.release();
+        Mat mat6 = new Mat();
+        mul.convertTo(mat6, CvType.CV_8UC3);
+        mul.release();
+        return mat6;
+    }
+
+    private void setOpenCvJpegRotation(String str) {
+        this.mOpenCvExifRotation = 0;
+        if (OpenCvHelper.doseImreadRotateWithExifTag()) {
+            this.mOpenCvExifRotation = ImageFileUtil.getExifRotationDegree(str);
+            if (this.mOpenCvExifRotation < 0) {
+                this.mOpenCvExifRotation = 0;
+            }
+        }
+    }
+
+    private int getImageRotation(int i) {
+        if (this.mOpenCvExifRotationCancel) {
+            i -= this.mOpenCvExifRotation;
+        }
+        if (i < 0) {
+            i += (((-i) / 4) + 1) * 4;
+        }
+        return i % 4;
+    }
+
+    /* access modifiers changed from: package-private */
+    public void setInterpolation(int i) {
+        this.mInterpolation = i;
+    }
+}

+ 155 - 0
app/src/main/java/com/epson/cameracopy/printlayout/ManuscriptSize.java

@@ -0,0 +1,155 @@
+package com.epson.cameracopy.printlayout;
+
+import android.content.Context;
+import android.graphics.Point;
+import android.graphics.PointF;
+import com.epson.cameracopy.alt.AdditionalPrinterInfo;
+import epson.common.ImageUtil;
+import epson.print.C2135R;
+
+public class ManuscriptSize {
+    static final /* synthetic */ boolean $assertionsDisabled = false;
+    public static final double INCH_MM = 25.4d;
+    public static final int SCALE_TYPE_INCH = 2;
+    public static final int SCALE_TYPE_MM = 1;
+    private int mBaseDpi;
+    private String mManuscriptFileName;
+    private Point mManuscriptPixelSize;
+    private ManuscriptTypeAdapter mManuscriptTypeAdapter;
+
+    interface ManuscriptTypeAdapter {
+        boolean displayLength();
+
+        Point getBasePixelSize(int i);
+
+        String getSizeName(Context context);
+
+        int getUnitType(Context context);
+    }
+
+    public static double getPixelToPhysicalSizeScale(int i, int i2) {
+        return i2 == 2 ? 1.0d / ((double) i) : 25.4d / ((double) i);
+    }
+
+    public ManuscriptSize(DocumentSizeInfo documentSizeInfo, String str, int i) {
+        this.mBaseDpi = i;
+        switch (documentSizeInfo.getPaperId()) {
+            case -2:
+                this.mManuscriptTypeAdapter = new CustomManuscriptSize(documentSizeInfo);
+                break;
+            case -1:
+                this.mManuscriptTypeAdapter = new AutoManuscriptSize(documentSizeInfo);
+                break;
+            default:
+                this.mManuscriptTypeAdapter = new IdManuscriptSize(documentSizeInfo);
+                break;
+        }
+        setManuscriptPixlSize(str);
+        this.mManuscriptFileName = str;
+    }
+
+    public int getPixelWidth() {
+        return this.mManuscriptPixelSize.x;
+    }
+
+    public int getPixelHeight() {
+        return this.mManuscriptPixelSize.y;
+    }
+
+    public PointF getPhysicalSize(Context context) {
+        double pixelToPhysicalSizeScale = getPixelToPhysicalSizeScale(this.mBaseDpi, this.mManuscriptTypeAdapter.getUnitType(context));
+        return new PointF((float) (((double) this.mManuscriptPixelSize.x) * pixelToPhysicalSizeScale), (float) (((double) this.mManuscriptPixelSize.y) * pixelToPhysicalSizeScale));
+    }
+
+    public PointF getDocumentSize(Context context) {
+        ManuscriptTypeAdapter manuscriptTypeAdapter = this.mManuscriptTypeAdapter;
+        if (manuscriptTypeAdapter instanceof CustomManuscriptSize) {
+            return ((CustomManuscriptSize) manuscriptTypeAdapter).getCustomDocumentSize(context);
+        }
+        return getPhysicalSize(context);
+    }
+
+    public String getSizeName(Context context) {
+        return this.mManuscriptTypeAdapter.getSizeName(context);
+    }
+
+    public boolean displayLength() {
+        return this.mManuscriptTypeAdapter.displayLength();
+    }
+
+    public int getUnitType(Context context) {
+        return this.mManuscriptTypeAdapter.getUnitType(context);
+    }
+
+    public static double calcRate(int i, int i2, int i3, int i4) {
+        return Math.min(((double) i) / ((double) i3), ((double) i2) / ((double) i4));
+    }
+
+    public static ManuscriptSize load(Context context, String str) {
+        return new ManuscriptSize(RegistedDocumentSizeList.getInstance(context).getCurrentDocumentSize(), str, AdditionalPrinterInfo.getCurrentPrintModeResolution(context));
+    }
+
+    public String getUnitStr(Context context) {
+        if (getUnitType(context) == 2) {
+            return context.getString(C2135R.string.unit_inch);
+        }
+        return context.getString(C2135R.string.unit_mm);
+    }
+
+    private void setManuscriptPixlSize(String str) {
+        Point basePixelSize;
+        this.mManuscriptPixelSize = new Point();
+        Point imageSize = ImageUtil.getImageSize(str);
+        if (imageSize != null && (basePixelSize = this.mManuscriptTypeAdapter.getBasePixelSize(this.mBaseDpi)) != null) {
+            int i = imageSize.x;
+            int i2 = imageSize.y;
+            if ((i2 - i) * (basePixelSize.y - basePixelSize.x) >= 0) {
+                int i3 = i;
+                i = i2;
+                i2 = i3;
+            }
+            double calcRate = calcRate(basePixelSize.x, basePixelSize.y, i2, i);
+            Point point = this.mManuscriptPixelSize;
+            point.x = (int) (((double) i2) * calcRate);
+            point.y = (int) (calcRate * ((double) i));
+        }
+    }
+
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null || getClass() != obj.getClass()) {
+            return false;
+        }
+        ManuscriptSize manuscriptSize = (ManuscriptSize) obj;
+        if (this.mBaseDpi != manuscriptSize.mBaseDpi) {
+            return false;
+        }
+        String str = this.mManuscriptFileName;
+        if (str == null) {
+            if (manuscriptSize.mManuscriptFileName != null) {
+                return false;
+            }
+        } else if (!str.equals(manuscriptSize.mManuscriptFileName)) {
+            return false;
+        }
+        Point point = this.mManuscriptPixelSize;
+        if (point == null) {
+            if (manuscriptSize.mManuscriptPixelSize != null) {
+                return false;
+            }
+        } else if (!point.equals(manuscriptSize.mManuscriptPixelSize)) {
+            return false;
+        }
+        ManuscriptTypeAdapter manuscriptTypeAdapter = this.mManuscriptTypeAdapter;
+        if (manuscriptTypeAdapter == null) {
+            if (manuscriptSize.mManuscriptTypeAdapter != null) {
+                return false;
+            }
+        } else if (!manuscriptTypeAdapter.equals(manuscriptSize.mManuscriptTypeAdapter)) {
+            return false;
+        }
+        return true;
+    }
+}

+ 410 - 0
app/src/main/java/com/epson/cameracopy/printlayout/PreviewPosition.java

@@ -0,0 +1,410 @@
+package com.epson.cameracopy.printlayout;
+
+import android.graphics.Rect;
+import com.epson.cameracopy.printlayout.PreviewView;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+class PreviewPosition implements Serializable {
+    static final /* synthetic */ boolean $assertionsDisabled = false;
+    public static final double MAX_IMAGE_RATE = 4.0d;
+    public static final double MIN_IMAGE_RATE = 0.25d;
+    private static final int MOVABLE_PREVIE_PIXEL = 10;
+    private static final long serialVersionUID = 1;
+    private int m3mPrintAreaActualHeight;
+    private int m3mPrintAreaActualWidth;
+    private double mActualPreviewRate;
+    private int mBorderlessDataHeight;
+    private int mBorderlessDataWidth;
+    private int mBorderlessLeftMargin;
+    private boolean mBorderlessMode;
+    private int mBorderlessTopMargin;
+    private boolean mFitSizeMode;
+    private int mPaperActualHeight = 297;
+    private int mPaperActualWidth = 210;
+    private int mPaperTo3mActualLeftMargin;
+    private int mPaperTo3mActualTopMargin;
+    private int[] mPreviewMovableArea = new int[4];
+    private double mPreviewPaperRate = 0.98d;
+    private transient Rect mPreviewPaperRect = new Rect();
+    private int mPrintTargetAddRotation;
+    private int mPrtimageActualHeight;
+    private int mPrtimageActualWidth;
+    private final PreviewRect mPrtimagePreviewPosition = new PreviewRect();
+    private transient Rect mScaledPrtimagePreviewRect = new Rect();
+    private int mScreenHeight;
+    private int mScreenWidth;
+
+    public PreviewPosition() {
+    }
+
+    public PreviewPosition(double d) {
+        this.mPreviewPaperRate = d;
+    }
+
+    public void setPrtimageActualSize(int i, int i2) {
+        this.mPrtimageActualWidth = i;
+        this.mPrtimageActualHeight = i2;
+    }
+
+    public int[] getPrtImageActualSIze() {
+        return new int[]{this.mPrtimageActualWidth, this.mPrtimageActualHeight};
+    }
+
+    public void setScreenSize(int i, int i2) {
+        this.mScreenWidth = i;
+        this.mScreenHeight = i2;
+    }
+
+    public void changeScreenSize(int i, int i2) {
+        if (this.mActualPreviewRate <= 0.0d || i <= 0 || i2 <= 0) {
+            return;
+        }
+        if (this.mScreenWidth != i || this.mScreenHeight != i2) {
+            this.mScreenWidth = i;
+            this.mScreenHeight = i2;
+            double left = ((double) (this.mPrtimagePreviewPosition.getLeft() - this.mPreviewPaperRect.left)) / this.mActualPreviewRate;
+            double top = ((double) (this.mPrtimagePreviewPosition.getTop() - this.mPreviewPaperRect.top)) / this.mActualPreviewRate;
+            calcPreviewPaperSize();
+            double d = this.mActualPreviewRate;
+            this.mPrtimagePreviewPosition.setX1Size((int) (((double) this.mPrtimageActualWidth) * d), (int) (((double) this.mPrtimageActualHeight) * d));
+            this.mPrtimagePreviewPosition.setLeft(this.mPreviewPaperRect.left + ((int) (left * this.mActualPreviewRate)));
+            this.mPrtimagePreviewPosition.setTop(this.mPreviewPaperRect.top + ((int) (top * this.mActualPreviewRate)));
+            setMovableArea();
+        }
+    }
+
+    public void setPaperSize(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10) {
+        this.mPaperActualWidth = i;
+        this.mPaperActualHeight = i2;
+        this.mPaperTo3mActualLeftMargin = i3;
+        this.mPaperTo3mActualTopMargin = i4;
+        this.m3mPrintAreaActualWidth = i5;
+        this.m3mPrintAreaActualHeight = i6;
+        this.mBorderlessLeftMargin = i7;
+        this.mBorderlessTopMargin = i8;
+        this.mBorderlessDataWidth = i9;
+        this.mBorderlessDataHeight = i10;
+    }
+
+    public int[] getPaperMaginAnd3mPrintableArea() {
+        double d = this.mActualPreviewRate;
+        return new int[]{(int) (((double) this.mPaperTo3mActualLeftMargin) * d), (int) (((double) this.mPaperTo3mActualTopMargin) * d), (int) (((double) this.m3mPrintAreaActualWidth) * d), (int) (((double) this.m3mPrintAreaActualHeight) * d)};
+    }
+
+    public void calcSizeAndPositionOnScreen() {
+        calcPreviewPaperSize();
+        initPreviewPrtimageRect();
+        setMovableArea();
+    }
+
+    private void setMovableArea() {
+        this.mPreviewMovableArea[0] = this.mPreviewPaperRect.left + 10;
+        this.mPreviewMovableArea[1] = this.mPreviewPaperRect.top + 10;
+        this.mPreviewMovableArea[2] = this.mPreviewPaperRect.right - 10;
+        this.mPreviewMovableArea[3] = this.mPreviewPaperRect.bottom - 10;
+        if (!this.mBorderlessMode) {
+            int[] paperMaginAnd3mPrintableArea = getPaperMaginAnd3mPrintableArea();
+            int[] iArr = this.mPreviewMovableArea;
+            iArr[0] = iArr[0] + paperMaginAnd3mPrintableArea[0];
+            iArr[1] = iArr[1] + paperMaginAnd3mPrintableArea[1];
+            iArr[2] = ((this.mPreviewPaperRect.left + paperMaginAnd3mPrintableArea[0]) + paperMaginAnd3mPrintableArea[2]) - 10;
+            this.mPreviewMovableArea[3] = ((this.mPreviewPaperRect.top + paperMaginAnd3mPrintableArea[1]) + paperMaginAnd3mPrintableArea[3]) - 10;
+        }
+    }
+
+    private void initPreviewPrtimageRect() {
+        if (this.mPreviewPaperRect.right > 0 && this.mPreviewPaperRect.width() > 0 && this.mPrtimageActualWidth > 0 && this.mPrtimageActualHeight > 0) {
+            this.mFitSizeMode = false;
+            this.mPrtimagePreviewPosition.setScale(1.0d);
+            this.mPrtimagePreviewPosition.resetRotate();
+            double d = this.mActualPreviewRate;
+            this.mPrtimagePreviewPosition.setX1Size((int) ((((double) this.mPrtimageActualWidth) * d) + 0.5d), (int) ((((double) this.mPrtimageActualHeight) * d) + 0.5d));
+            this.mPrtimagePreviewPosition.setLeft(this.mPreviewPaperRect.left);
+            this.mPrtimagePreviewPosition.setTop(this.mPreviewPaperRect.top);
+        }
+    }
+
+    private void calcPreviewPaperSize() {
+        int i;
+        int i2;
+        int i3;
+        int i4 = this.mScreenWidth;
+        if (i4 > 0 && (i = this.mScreenHeight) > 0 && (i2 = this.mPaperActualWidth) > 0 && (i3 = this.mPaperActualHeight) > 0) {
+            this.mFitSizeMode = false;
+            double d = this.mPreviewPaperRate;
+            this.mActualPreviewRate = Math.min((((double) i4) * d) / ((double) i2), (((double) i) * d) / ((double) i3));
+            this.mPreviewPaperRect.setEmpty();
+            Rect rect = this.mPreviewPaperRect;
+            double d2 = this.mActualPreviewRate;
+            rect.right = (int) (((double) this.mPaperActualWidth) * d2);
+            rect.bottom = (int) (((double) this.mPaperActualHeight) * d2);
+            this.mPreviewPaperRect.offsetTo((this.mScreenWidth - rect.right) / 2, (this.mScreenHeight - this.mPreviewPaperRect.bottom) / 2);
+        }
+    }
+
+    public void move(int i, int i2) {
+        this.mPrtimagePreviewPosition.move(i, i2);
+        adjustPrtimagePosition();
+    }
+
+    public Rect getPreviewPaperRect() {
+        return this.mPreviewPaperRect;
+    }
+
+    public Rect getPreviewPrtimageRect() {
+        this.mScaledPrtimagePreviewRect.left = this.mPrtimagePreviewPosition.getLeft();
+        this.mScaledPrtimagePreviewRect.right = this.mPrtimagePreviewPosition.getRight();
+        this.mScaledPrtimagePreviewRect.top = this.mPrtimagePreviewPosition.getTop();
+        this.mScaledPrtimagePreviewRect.bottom = this.mPrtimagePreviewPosition.getBottom();
+        return this.mScaledPrtimagePreviewRect;
+    }
+
+    public int getPrtimageRotation() {
+        return (this.mPrtimagePreviewPosition.getRotation() + this.mPrintTargetAddRotation) & 3;
+    }
+
+    public void rotateRight90() {
+        this.mPrtimagePreviewPosition.rotateRight90();
+        adjustPrtimagePosition();
+    }
+
+    public void resetRotation() {
+        this.mPrtimagePreviewPosition.resetRotate();
+        adjustPrtimagePosition();
+    }
+
+    public void setPrintTargetAddRotation(int i) {
+        this.mPrintTargetAddRotation = i;
+    }
+
+    public double getCurrentPrttargetScale() {
+        return this.mPrtimagePreviewPosition.getScale();
+    }
+
+    public void setScaleFactor(double d) {
+        if (d < 0.25d) {
+            d = 0.25d;
+        } else if (d > 4.0d) {
+            d = 4.0d;
+        }
+        this.mPrtimagePreviewPosition.setScale(d);
+        adjustPrtimagePosition();
+    }
+
+    private void adjustPrtimagePosition() {
+        int right = this.mPrtimagePreviewPosition.getRight();
+        int[] iArr = this.mPreviewMovableArea;
+        if (right < iArr[0]) {
+            this.mPrtimagePreviewPosition.setRight(iArr[0]);
+        }
+        int bottom = this.mPrtimagePreviewPosition.getBottom();
+        int[] iArr2 = this.mPreviewMovableArea;
+        if (bottom < iArr2[1]) {
+            this.mPrtimagePreviewPosition.setBottom(iArr2[1]);
+        }
+        int left = this.mPrtimagePreviewPosition.getLeft();
+        int[] iArr3 = this.mPreviewMovableArea;
+        if (left > iArr3[2]) {
+            this.mPrtimagePreviewPosition.setLeft(iArr3[2]);
+        }
+        int top = this.mPrtimagePreviewPosition.getTop();
+        int[] iArr4 = this.mPreviewMovableArea;
+        if (top > iArr4[3]) {
+            this.mPrtimagePreviewPosition.setTop(iArr4[3]);
+        }
+        this.mFitSizeMode = false;
+    }
+
+    public void resetPrtimagePosition() {
+        initPreviewPrtimageRect();
+    }
+
+    public PreviewView.SizeAndPosition getPrintSizeAndPosition() {
+        if (this.mActualPreviewRate <= 0.0d) {
+            return null;
+        }
+        return new PreviewView.SizeAndPosition((int) (((double) this.mPrtimagePreviewPosition.getWidth()) / this.mActualPreviewRate), (int) (((double) this.mPrtimagePreviewPosition.getHeight()) / this.mActualPreviewRate), (int) (((double) (this.mPrtimagePreviewPosition.getLeft() - this.mPreviewPaperRect.left)) / this.mActualPreviewRate), (int) (((double) (this.mPrtimagePreviewPosition.getTop() - this.mPreviewPaperRect.top)) / this.mActualPreviewRate), getPrtimageRotation());
+    }
+
+    public ImageAndLayout getImageAndLayout(boolean z) {
+        double d;
+        double d2;
+        if (this.mActualPreviewRate <= 0.0d) {
+            return null;
+        }
+        ImageAndLayout imageAndLayout = new ImageAndLayout();
+        if (z) {
+            imageAndLayout.setLayoutAreaSize(this.mBorderlessDataWidth, this.mBorderlessDataHeight);
+            d2 = (((double) (this.mPrtimagePreviewPosition.getLeft() - this.mPreviewPaperRect.left)) / this.mActualPreviewRate) + ((double) this.mBorderlessLeftMargin);
+            d = (((double) (this.mPrtimagePreviewPosition.getTop() - this.mPreviewPaperRect.top)) / this.mActualPreviewRate) + ((double) this.mBorderlessTopMargin);
+        } else {
+            imageAndLayout.setLayoutAreaSize(this.m3mPrintAreaActualWidth, this.m3mPrintAreaActualHeight);
+            d2 = (((double) (this.mPrtimagePreviewPosition.getLeft() - this.mPreviewPaperRect.left)) / this.mActualPreviewRate) - ((double) this.mPaperTo3mActualLeftMargin);
+            d = (((double) (this.mPrtimagePreviewPosition.getTop() - this.mPreviewPaperRect.top)) / this.mActualPreviewRate) - ((double) this.mPaperTo3mActualTopMargin);
+        }
+        imageAndLayout.setLayout(((double) this.mPrtimagePreviewPosition.getWidth()) / this.mActualPreviewRate, ((double) this.mPrtimagePreviewPosition.getHeight()) / this.mActualPreviewRate, d2, d, getPrtimageRotation());
+        return imageAndLayout;
+    }
+
+    public void fitSize() {
+        int i;
+        int i2 = this.mPrtimageActualWidth;
+        if (i2 > 0 && (i = this.mPrtimageActualHeight) > 0) {
+            if ((this.mPrtimagePreviewPosition.getRotation() & 1) != 0) {
+                int i3 = i;
+                i = i2;
+                i2 = i3;
+            }
+            double d = ((double) this.mPaperActualWidth) / ((double) i2);
+            double d2 = ((double) this.mPaperActualHeight) / ((double) i);
+            if (d <= d2) {
+                d2 = d;
+            }
+            if (d2 > 4.0d) {
+                d2 = 4.0d;
+            }
+            if (d2 < 0.25d) {
+                d2 = 0.25d;
+            }
+            this.mPrtimagePreviewPosition.setScale(d2);
+            this.mPrtimagePreviewPosition.setLeft(this.mPreviewPaperRect.left);
+            this.mPrtimagePreviewPosition.setTop(this.mPreviewPaperRect.top);
+            this.mFitSizeMode = true;
+        }
+    }
+
+    public boolean isFitSize() {
+        return this.mFitSizeMode;
+    }
+
+    public void setBorderless(boolean z) {
+        this.mBorderlessMode = z;
+    }
+
+    private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
+        objectOutputStream.defaultWriteObject();
+        objectOutputStream.writeInt(this.mPreviewPaperRect.left);
+        objectOutputStream.writeInt(this.mPreviewPaperRect.right);
+        objectOutputStream.writeInt(this.mPreviewPaperRect.top);
+        objectOutputStream.writeInt(this.mPreviewPaperRect.bottom);
+        objectOutputStream.writeInt(this.mScaledPrtimagePreviewRect.left);
+        objectOutputStream.writeInt(this.mScaledPrtimagePreviewRect.right);
+        objectOutputStream.writeInt(this.mScaledPrtimagePreviewRect.top);
+        objectOutputStream.writeInt(this.mScaledPrtimagePreviewRect.bottom);
+    }
+
+    private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
+        objectInputStream.defaultReadObject();
+        this.mPreviewPaperRect = new Rect();
+        this.mPreviewPaperRect.left = objectInputStream.readInt();
+        this.mPreviewPaperRect.right = objectInputStream.readInt();
+        this.mPreviewPaperRect.top = objectInputStream.readInt();
+        this.mPreviewPaperRect.bottom = objectInputStream.readInt();
+        this.mScaledPrtimagePreviewRect = new Rect();
+        this.mScaledPrtimagePreviewRect.left = objectInputStream.readInt();
+        this.mScaledPrtimagePreviewRect.right = objectInputStream.readInt();
+        this.mScaledPrtimagePreviewRect.top = objectInputStream.readInt();
+        this.mScaledPrtimagePreviewRect.bottom = objectInputStream.readInt();
+    }
+
+    static class PreviewRect implements Serializable {
+        private static final long serialVersionUID = 1;
+        private int mCx;
+        private int mCy;
+        private int mRotation;
+        private double mScale = 1.0d;
+        private int mScaledHeight;
+        private int mScaledWidth;
+        private int mX1Height;
+        private int mX1Width;
+
+        PreviewRect() {
+        }
+
+        public final void setX1Size(int i, int i2) {
+            this.mX1Width = i;
+            this.mX1Height = i2;
+            setScale(this.mScale);
+        }
+
+        public final void setLeft(int i) {
+            this.mCx = (this.mScaledWidth / 2) + i;
+        }
+
+        public final void setRight(int i) {
+            setLeft(i - this.mScaledWidth);
+        }
+
+        public final void setTop(int i) {
+            this.mCy = (this.mScaledHeight / 2) + i;
+        }
+
+        public final void setBottom(int i) {
+            setTop(i - this.mScaledHeight);
+        }
+
+        public int getLeft() {
+            return this.mCx - (this.mScaledWidth / 2);
+        }
+
+        public int getRight() {
+            return getLeft() + this.mScaledWidth;
+        }
+
+        public int getTop() {
+            return this.mCy - (this.mScaledHeight / 2);
+        }
+
+        public int getBottom() {
+            return getTop() + this.mScaledHeight;
+        }
+
+        public int getWidth() {
+            return this.mScaledWidth;
+        }
+
+        public int getHeight() {
+            return this.mScaledHeight;
+        }
+
+        public void setScale(double d) {
+            this.mScale = d;
+            this.mScaledWidth = (int) (((double) this.mX1Width) * d);
+            this.mScaledHeight = (int) (((double) this.mX1Height) * d);
+            if ((this.mRotation & 1) != 0) {
+                int i = this.mScaledWidth;
+                this.mScaledWidth = this.mScaledHeight;
+                this.mScaledHeight = i;
+            }
+        }
+
+        public double getScale() {
+            return this.mScale;
+        }
+
+        public void move(int i, int i2) {
+            this.mCx += i;
+            this.mCy += i2;
+        }
+
+        public int getRotation() {
+            return this.mRotation;
+        }
+
+        public void rotateRight90() {
+            this.mRotation++;
+            if (this.mRotation >= 4) {
+                this.mRotation = 0;
+            }
+            setScale(this.mScale);
+        }
+
+        public void resetRotate() {
+            this.mRotation = 0;
+            setScale(this.mScale);
+        }
+    }
+}

+ 409 - 0
app/src/main/java/com/epson/cameracopy/printlayout/PreviewView.java

@@ -0,0 +1,409 @@
+package com.epson.cameracopy.printlayout;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.ColorMatrix;
+import android.graphics.ColorMatrixColorFilter;
+import android.graphics.Matrix;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.os.Bundle;
+import android.support.p000v4.view.GestureDetectorCompat;
+import android.util.AttributeSet;
+import android.view.GestureDetector;
+import android.view.MotionEvent;
+import android.view.ScaleGestureDetector;
+import android.view.View;
+import epson.common.ImageUtil;
+import epson.common.Info_paper;
+import epson.print.C2135R;
+import org.opencv.videoio.Videoio;
+
+public class PreviewView extends View {
+    private static final int BORDER_AREA_COLOR = -1;
+    private static final ColorMatrixColorFilter[] COLOR_FILTER = {new ColorMatrixColorFilter(new ColorMatrix(colorMatrix)), new ColorMatrixColorFilter(new ColorMatrix(monoMatrix)), new ColorMatrixColorFilter(new ColorMatrix(sepiaMatrix))};
+    private static final float MANUSCRIPT_FRAME_BORDER_SIZE_DP = 1.5f;
+    private static final int MANUSCRIPT_FRAME_COLOR = -1057030144;
+    private static final int PAPER_AREA_COLOR = -1;
+    private static final float[] colorMatrix = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f};
+    private static final float[] monoMatrix = {0.298912f, 0.586611f, 0.114478f, 0.0f, 0.0f, 0.298912f, 0.586611f, 0.114478f, 0.0f, 0.0f, 0.298912f, 0.586611f, 0.114478f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f};
+    private static final float[] sepiaMatrix = {0.11747242f, 0.45110387f, 0.021636343f, 0.0f, 0.0f, 0.10432029f, 0.40241516f, 0.019232305f, 0.0f, 0.0f, 0.050217215f, 0.31325027f, 0.014996618f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f};
+    private Bitmap mBitmap;
+    private final Paint mBitmapPaint;
+    private boolean mBorderlessMode;
+    private float mDpToPixelScale;
+    private final GestureDetectorCompat mGestureDetector;
+    private String mImageFileName;
+    private boolean mIsMoving;
+    private boolean mIsPrintPositionResetRequired;
+    private float[] mLinePoints;
+    private final Matrix mMatrix;
+    private final Paint mPaint;
+    private int mPapaerSizeId;
+    /* access modifiers changed from: private */
+    public PreviewPosition mPreviewPosition;
+    private PrttargetScaleChangeListener mPrttargetScaleChangeListener;
+    private final ScaleGestureDetector mScaleGestureDetector;
+
+    public interface PrttargetScaleChangeListener {
+        void onPrttargetScaleChange(double d);
+    }
+
+    public static class SizeAndPosition {
+        public int height;
+        public int offsetX;
+        public int offsetY;
+        public int rotation;
+        public int width;
+
+        public SizeAndPosition(int i, int i2, int i3, int i4, int i5) {
+            this.width = i;
+            this.height = i2;
+            this.offsetX = i3;
+            this.offsetY = i4;
+            this.rotation = i5;
+        }
+
+        public SizeAndPosition() {
+        }
+    }
+
+    public PreviewView(Context context, AttributeSet attributeSet, int i) {
+        super(context, attributeSet, i);
+        this.mBitmapPaint = new Paint();
+        this.mMatrix = new Matrix();
+        this.mPapaerSizeId = -1;
+        this.mGestureDetector = new GestureDetectorCompat(context, new MyGestureListener(this));
+        this.mGestureDetector.setIsLongpressEnabled(false);
+        this.mScaleGestureDetector = new ScaleGestureDetector(context, new MyScaledGestureListener(this));
+        this.mPaint = new Paint();
+        this.mLinePoints = new float[16];
+        this.mPreviewPosition = new PreviewPosition();
+        this.mDpToPixelScale = context.getResources().getDisplayMetrics().density;
+    }
+
+    public PreviewView(Context context, AttributeSet attributeSet) {
+        this(context, attributeSet, 0);
+    }
+
+    public PreviewView(Context context) {
+        this(context, (AttributeSet) null, 0);
+    }
+
+    public boolean onTouchEvent(MotionEvent motionEvent) {
+        boolean z = this.mGestureDetector.onTouchEvent(motionEvent) || this.mScaleGestureDetector.onTouchEvent(motionEvent);
+        if (motionEvent.getActionMasked() == 1) {
+            setMoving(false);
+            invalidate();
+        }
+        if (z || super.onTouchEvent(motionEvent)) {
+            return true;
+        }
+        return false;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onDraw(Canvas canvas) {
+        Rect previewPaperRect = this.mPreviewPosition.getPreviewPaperRect();
+        if (previewPaperRect != null) {
+            this.mPaint.setColor(-1);
+            canvas.drawRect(previewPaperRect, this.mPaint);
+        }
+        drawPrintTargetPreview(canvas);
+        drawOutsidePaperArea(canvas, previewPaperRect);
+        if (!this.mBorderlessMode && previewPaperRect != null) {
+            drawNonPrintableArea(canvas, previewPaperRect, this.mPreviewPosition.getPaperMaginAnd3mPrintableArea());
+        }
+    }
+
+    private void drawPrintTargetPreview(Canvas canvas) {
+        double d;
+        double d2;
+        int i;
+        int i2;
+        Rect previewPrtimageRect = this.mPreviewPosition.getPreviewPrtimageRect();
+        if (previewPrtimageRect != null && this.mBitmap != null) {
+            int prtimageRotation = this.mPreviewPosition.getPrtimageRotation();
+            this.mMatrix.reset();
+            this.mMatrix.setRotate(((float) prtimageRotation) * 90.0f);
+            if ((prtimageRotation & 1) != 0) {
+                d2 = ((double) previewPrtimageRect.width()) / ((double) this.mBitmap.getHeight());
+                d = ((double) previewPrtimageRect.height()) / ((double) this.mBitmap.getWidth());
+            } else {
+                d2 = ((double) previewPrtimageRect.width()) / ((double) this.mBitmap.getWidth());
+                d = ((double) previewPrtimageRect.height()) / ((double) this.mBitmap.getHeight());
+            }
+            this.mMatrix.postScale((float) d2, (float) d);
+            switch (prtimageRotation) {
+                case 1:
+                    i2 = previewPrtimageRect.width();
+                    i = 0;
+                    break;
+                case 2:
+                    i2 = previewPrtimageRect.width();
+                    i = previewPrtimageRect.height();
+                    break;
+                case 3:
+                    i = previewPrtimageRect.height();
+                    i2 = 0;
+                    break;
+                default:
+                    i2 = 0;
+                    i = 0;
+                    break;
+            }
+            this.mMatrix.postTranslate((float) (previewPrtimageRect.left + i2), (float) (previewPrtimageRect.top + i));
+            canvas.drawBitmap(this.mBitmap, this.mMatrix, this.mBitmapPaint);
+            this.mPaint.setColor(MANUSCRIPT_FRAME_COLOR);
+            float f = this.mDpToPixelScale * MANUSCRIPT_FRAME_BORDER_SIZE_DP;
+            this.mPaint.setStrokeWidth(f);
+            float f2 = f / 2.0f;
+            float f3 = ((float) previewPrtimageRect.bottom) - f2;
+            float f4 = ((float) previewPrtimageRect.right) - f2;
+            this.mLinePoints[0] = (float) previewPrtimageRect.left;
+            this.mLinePoints[1] = (float) previewPrtimageRect.top;
+            this.mLinePoints[2] = (float) previewPrtimageRect.left;
+            float[] fArr = this.mLinePoints;
+            fArr[3] = f3;
+            fArr[4] = (float) previewPrtimageRect.left;
+            float[] fArr2 = this.mLinePoints;
+            fArr2[5] = f3;
+            fArr2[6] = f4;
+            fArr2[7] = f3;
+            fArr2[8] = f4;
+            fArr2[9] = f3;
+            fArr2[10] = f4;
+            fArr2[11] = (float) previewPrtimageRect.top;
+            float[] fArr3 = this.mLinePoints;
+            fArr3[12] = f4;
+            fArr3[13] = (float) previewPrtimageRect.top;
+            this.mLinePoints[14] = (float) previewPrtimageRect.left;
+            this.mLinePoints[15] = (float) previewPrtimageRect.top;
+            canvas.drawLines(this.mLinePoints, this.mPaint);
+        }
+    }
+
+    private void drawNonPrintableArea(Canvas canvas, Rect rect, int[] iArr) {
+        this.mPaint.setColor(-1);
+        int i = iArr[0];
+        int i2 = iArr[1];
+        int i3 = iArr[2];
+        int i4 = iArr[3];
+        Canvas canvas2 = canvas;
+        canvas2.drawRect((float) rect.left, (float) rect.top, (float) (rect.left + i), (float) rect.bottom, this.mPaint);
+        canvas2.drawRect((float) (rect.left + i), (float) rect.top, (float) (rect.left + i + i3), (float) (rect.top + i2), this.mPaint);
+        canvas2.drawRect((float) (rect.left + i), (float) (rect.top + i2 + i4), (float) (rect.left + i + i3), (float) rect.bottom, this.mPaint);
+        canvas.drawRect((float) (rect.left + i + i3), (float) rect.top, (float) rect.right, (float) rect.bottom, this.mPaint);
+    }
+
+    private void drawOutsidePaperArea(Canvas canvas, Rect rect) {
+        this.mPaint.setColor(getResources().getColor(C2135R.color.background_preview));
+        if (this.mIsMoving) {
+            this.mPaint.setAlpha(221);
+        }
+        float width = (float) getWidth();
+        float height = (float) getHeight();
+        Canvas canvas2 = canvas;
+        canvas2.drawRect(0.0f, 0.0f, (float) rect.left, height, this.mPaint);
+        canvas2.drawRect((float) rect.left, 0.0f, (float) rect.right, (float) rect.top, this.mPaint);
+        canvas2.drawRect((float) rect.left, (float) rect.bottom, (float) rect.right, height, this.mPaint);
+        canvas.drawRect((float) rect.right, 0.0f, width, height, this.mPaint);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onSizeChanged(int i, int i2, int i3, int i4) {
+        super.onSizeChanged(i, i2, i3, i4);
+        if (i > 0 && i2 > 0) {
+            if (i3 <= 0 || i4 <= 0) {
+                this.mPreviewPosition.setScreenSize(i, i2);
+                update();
+            } else if (i != i3 || i2 != i4) {
+                this.mPreviewPosition.changeScreenSize(i, i2);
+            }
+        }
+    }
+
+    public void setMoving(boolean z) {
+        this.mIsMoving = z;
+    }
+
+    static class MyGestureListener extends GestureDetector.SimpleOnGestureListener {
+        private final PreviewView mPreviewView;
+
+        public MyGestureListener(PreviewView previewView) {
+            this.mPreviewView = previewView;
+        }
+
+        public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) {
+            this.mPreviewView.setMoving(true);
+            this.mPreviewView.mPreviewPosition.move(-((int) f), -((int) f2));
+            this.mPreviewView.invalidate();
+            return true;
+        }
+
+        public boolean onDown(MotionEvent motionEvent) {
+            this.mPreviewView.setMoving(true);
+            this.mPreviewView.invalidate();
+            return true;
+        }
+
+        public boolean onDoubleTap(MotionEvent motionEvent) {
+            if (this.mPreviewView.mPreviewPosition.isFitSize()) {
+                this.mPreviewView.mPreviewPosition.resetPrtimagePosition();
+                this.mPreviewView.updateScale();
+                this.mPreviewView.invalidate();
+                return true;
+            }
+            this.mPreviewView.mPreviewPosition.fitSize();
+            this.mPreviewView.updateScale();
+            this.mPreviewView.invalidate();
+            return true;
+        }
+    }
+
+    static class MyScaledGestureListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
+        private double mBaseFactor;
+        private final PreviewView mPreviewView;
+
+        public MyScaledGestureListener(PreviewView previewView) {
+            this.mPreviewView = previewView;
+        }
+
+        public boolean onScaleBegin(ScaleGestureDetector scaleGestureDetector) {
+            this.mBaseFactor = this.mPreviewView.mPreviewPosition.getCurrentPrttargetScale();
+            return super.onScaleBegin(scaleGestureDetector);
+        }
+
+        public boolean onScale(ScaleGestureDetector scaleGestureDetector) {
+            this.mPreviewView.mPreviewPosition.setScaleFactor(((double) scaleGestureDetector.getScaleFactor()) * this.mBaseFactor);
+            this.mPreviewView.updateScale();
+            this.mPreviewView.invalidate();
+            return super.onScale(scaleGestureDetector);
+        }
+    }
+
+    /* access modifiers changed from: private */
+    public void updateScale() {
+        PrttargetScaleChangeListener prttargetScaleChangeListener = this.mPrttargetScaleChangeListener;
+        if (prttargetScaleChangeListener != null) {
+            prttargetScaleChangeListener.onPrttargetScaleChange(this.mPreviewPosition.getCurrentPrttargetScale());
+        }
+    }
+
+    public void setPaperSize(int i) {
+        if (i != this.mPapaerSizeId) {
+            setPaperSizeInternal(i);
+        }
+    }
+
+    private void setPaperSizeInternal(int i) {
+        this.mPapaerSizeId = i;
+        Info_paper infoPaper = Info_paper.getInfoPaper(getContext(), i);
+        if (infoPaper != null) {
+            this.mPreviewPosition.setPaperSize(infoPaper.getPaper_width(), infoPaper.getPaper_height(), infoPaper.getLeftMargin_border(), infoPaper.getTopMargin_border(), infoPaper.getPaper_width_boder(), infoPaper.getPaper_height_boder(), -infoPaper.getLeftMargin(), -infoPaper.getTopMargin(), infoPaper.getPaper_width_boderless(), infoPaper.getPaper_height_boderless());
+            this.mIsPrintPositionResetRequired = true;
+        }
+    }
+
+    public void setColor(int i) {
+        ColorMatrixColorFilter colorMatrixColorFilter;
+        switch (i) {
+            case 0:
+                colorMatrixColorFilter = COLOR_FILTER[0];
+                break;
+            case 1:
+                colorMatrixColorFilter = COLOR_FILTER[1];
+                break;
+            default:
+                colorMatrixColorFilter = null;
+                break;
+        }
+        if (colorMatrixColorFilter != null) {
+            this.mBitmapPaint.setColorFilter(colorMatrixColorFilter);
+        }
+    }
+
+    public void rotateImageR90() {
+        this.mPreviewPosition.rotateRight90();
+        invalidate();
+    }
+
+    public void setImage(String str) {
+        this.mImageFileName = str;
+        this.mIsPrintPositionResetRequired = true;
+    }
+
+    public void setPrintTargetSize(int i, int i2) {
+        this.mPreviewPosition.setPrtimageActualSize(i, i2);
+        this.mIsPrintPositionResetRequired = true;
+    }
+
+    public void update() {
+        if (this.mImageFileName != null && getHeight() > 0 && getWidth() > 0) {
+            this.mBitmap = createPreviewBitmap(this.mImageFileName);
+            if (this.mBitmap != null) {
+                int[] prtImageActualSIze = this.mPreviewPosition.getPrtImageActualSIze();
+                int i = 1;
+                if ((prtImageActualSIze[0] - prtImageActualSIze[1]) * (this.mBitmap.getWidth() - this.mBitmap.getHeight()) >= 0) {
+                    i = 0;
+                }
+                this.mPreviewPosition.setPrintTargetAddRotation(i);
+                if (this.mIsPrintPositionResetRequired) {
+                    setPaperSizeInternal(this.mPapaerSizeId);
+                    this.mPreviewPosition.setBorderless(this.mBorderlessMode);
+                    this.mPreviewPosition.resetRotation();
+                    this.mPreviewPosition.calcSizeAndPositionOnScreen();
+                    this.mIsPrintPositionResetRequired = false;
+                    updateScale();
+                }
+                invalidate();
+            }
+        }
+    }
+
+    private Bitmap createPreviewBitmap(String str) {
+        return ImageUtil.loadBitmap(str, Videoio.CAP_UNICAP, Videoio.CAP_PVAPI, true, true);
+    }
+
+    public void releaseBitmap() {
+        this.mBitmap.recycle();
+        this.mBitmap = null;
+    }
+
+    public void restoreBitmap() {
+        String str;
+        if (this.mBitmap == null && (str = this.mImageFileName) != null) {
+            this.mBitmap = createPreviewBitmap(str);
+        }
+    }
+
+    public void setBorderless(boolean z) {
+        if (this.mBorderlessMode != z) {
+            this.mBorderlessMode = z;
+            this.mIsPrintPositionResetRequired = true;
+        }
+    }
+
+    public void printPostionResetRequest() {
+        this.mIsPrintPositionResetRequired = true;
+    }
+
+    public void setPrttargetScaleChangeListener(PrttargetScaleChangeListener prttargetScaleChangeListener) {
+        this.mPrttargetScaleChangeListener = prttargetScaleChangeListener;
+    }
+
+    public ImageAndLayout getImageAndLayout() {
+        return this.mPreviewPosition.getImageAndLayout(this.mBorderlessMode);
+    }
+
+    public void saveInstanceState(Bundle bundle, String str) {
+        bundle.putSerializable(str, this.mPreviewPosition);
+    }
+
+    public void restoreInstanceState(Bundle bundle, String str) {
+        this.mPreviewPosition = (PreviewPosition) bundle.getSerializable(str);
+        this.mIsPrintPositionResetRequired = false;
+        updateScale();
+    }
+}

+ 432 - 0
app/src/main/java/com/epson/cameracopy/printlayout/RegistedDocumentSizeList.java

@@ -0,0 +1,432 @@
+package com.epson.cameracopy.printlayout;
+
+import android.content.Context;
+import epson.print.C2135R;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Locale;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class RegistedDocumentSizeList {
+    private static final int CLASS_SAVE_VERSION = 1;
+    private static int DEFAULT_PAPER_SIZE_COUNT = 17;
+    private static final int[] DOCSIZE_NAME_ID = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
+    private static final double[] PAPER_SIZE_HEIGHT = {297.0d, 420.0d, 297.0d, 210.0d, 148.0d, 364.0d, 257.0d, 182.0d, 11.0d, 14.0d, 148.0d, 152.0d, 127.0d, 178.0d, 86.0d, 91.0d, 182.0d};
+    private static final int[] PAPER_SIZE_ID = {-1, 62, 0, 3, 4, 63, 5, 46, 1, 2, 16, 10, 15, 28, 35, 36, 46};
+    private static final int[] PAPER_SIZE_NAME = {C2135R.string.papersize_auto, C2135R.string.papersize_a3, C2135R.string.papersize_a4, C2135R.string.papersize_a5, C2135R.string.papersize_a6, C2135R.string.papersize_b4, C2135R.string.papersize_b5, C2135R.string.papersize_b6, C2135R.string.papersize_letter, C2135R.string.papersize_legal, C2135R.string.papersize_postcard, C2135R.string.papersize_10x15, C2135R.string.papersize_l, C2135R.string.papersize_2l, C2135R.string.papersize_card, C2135R.string.papersize_buzcard, C2135R.string.papersize_passport};
+    private static final int[] PAPER_SIZE_SCALE = {1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1};
+    private static final double[] PAPER_SIZE_WIDTH = {210.0d, 297.0d, 210.0d, 148.0d, 105.0d, 257.0d, 182.0d, 128.0d, 8.5d, 8.5d, 100.0d, 102.0d, 89.0d, 127.0d, 54.0d, 55.0d, 128.0d};
+    private static final String REGISTED_DOCUMENTSIZE_LIST_FILENAME = "registed_documentsize.bin";
+    static RegistedDocumentSizeList sRegistedDocumentSizeList;
+    Context mContext;
+    DocumentSizeInfo mCurrentDocumentSize;
+    private LinkedList<DocumentSizeInfo> mDocumentSizeList = new LinkedList<>();
+
+    RegistedDocumentSizeList(Context context) {
+        if (context != null) {
+            this.mContext = context;
+            initData();
+            return;
+        }
+        throw new IllegalArgumentException("context is null");
+    }
+
+    public static DocumentSizeInfo getCurrentDocumentSize(Context context) {
+        RegistedDocumentSizeList registedDocumentSizeList = sRegistedDocumentSizeList;
+        if (registedDocumentSizeList != null) {
+            return registedDocumentSizeList.getCurrentDocumentSize();
+        }
+        return getInstance(context).getCurrentDocumentSize();
+    }
+
+    public static RegistedDocumentSizeList getInstance(Context context) {
+        if (context != null) {
+            if (sRegistedDocumentSizeList == null) {
+                sRegistedDocumentSizeList = new RegistedDocumentSizeList(context);
+                sRegistedDocumentSizeList.restoreData(context);
+            }
+            return sRegistedDocumentSizeList;
+        }
+        throw new RuntimeException("context == null");
+    }
+
+    public Collection<DocumentSizeInfo> getRegistedList() {
+        return this.mDocumentSizeList;
+    }
+
+    public DocumentSizeInfo getCurrentDocumentSize() {
+        return this.mCurrentDocumentSize;
+    }
+
+    public void add(DocumentSizeInfo documentSizeInfo) {
+        if (documentSizeInfo != null) {
+            this.mDocumentSizeList.add(documentSizeInfo);
+            this.mCurrentDocumentSize = documentSizeInfo;
+            saveData(this.mContext);
+        }
+    }
+
+    public void update(DocumentSizeInfo documentSizeInfo, int i) {
+        DocumentSizeInfo documentSizeInfo2 = this.mDocumentSizeList.get(i);
+        if (documentSizeInfo2 != null) {
+            documentSizeInfo2.update(documentSizeInfo);
+            this.mCurrentDocumentSize = this.mDocumentSizeList.get(i);
+            saveData(this.mContext);
+        }
+    }
+
+    public void delete(DocumentSizeInfo documentSizeInfo, int i) {
+        this.mDocumentSizeList.remove(documentSizeInfo);
+        DocumentSizeInfo documentSizeInfo2 = this.mCurrentDocumentSize;
+        if (documentSizeInfo2 != null && documentSizeInfo2.equals(documentSizeInfo)) {
+            if (i > 0) {
+                this.mCurrentDocumentSize = this.mDocumentSizeList.get(i - 1);
+            } else if (this.mDocumentSizeList.size() > 0) {
+                this.mCurrentDocumentSize = this.mDocumentSizeList.get(0);
+            } else {
+                this.mCurrentDocumentSize = null;
+            }
+        }
+    }
+
+    public void deleteAll() {
+        LinkedList<DocumentSizeInfo> linkedList = this.mDocumentSizeList;
+        linkedList.removeAll(linkedList);
+        this.mCurrentDocumentSize = null;
+    }
+
+    public void reset() {
+        initData();
+        for (int i = 0; i < DEFAULT_PAPER_SIZE_COUNT; i++) {
+            DocumentSizeInfo documentSizeInfo = new DocumentSizeInfo();
+            documentSizeInfo.setDocSizeName(this.mContext.getString(PAPER_SIZE_NAME[i]));
+            documentSizeInfo.setScaleId(PAPER_SIZE_SCALE[i]);
+            documentSizeInfo.setWidth(PAPER_SIZE_WIDTH[i]);
+            documentSizeInfo.setHeight(PAPER_SIZE_HEIGHT[i]);
+            documentSizeInfo.setPaperId(PAPER_SIZE_ID[i]);
+            documentSizeInfo.setDocSizeNameId(DOCSIZE_NAME_ID[i]);
+            add(documentSizeInfo);
+        }
+        select(0);
+    }
+
+    public int size() {
+        return this.mDocumentSizeList.size();
+    }
+
+    public DocumentSizeInfo getItem(int i) {
+        return this.mDocumentSizeList.get(i);
+    }
+
+    public DocumentSizeInfo getItem(String str) {
+        DocumentSizeInfo documentSizeInfo;
+        Iterator it = this.mDocumentSizeList.iterator();
+        do {
+            documentSizeInfo = null;
+            if (!it.hasNext()) {
+                break;
+            }
+            documentSizeInfo = (DocumentSizeInfo) it.next();
+        } while (!documentSizeInfo.getDocSizeName().equals(str));
+        return documentSizeInfo;
+    }
+
+    public boolean isExistDocumentSizeName(String str, int i) {
+        DocumentSizeInfo item = getItem(str);
+        return (item == null || this.mDocumentSizeList.indexOf(item) == i) ? false : true;
+    }
+
+    public void storeData() {
+        saveData(this.mContext);
+    }
+
+    public boolean isSelected(DocumentSizeInfo documentSizeInfo) {
+        DocumentSizeInfo documentSizeInfo2 = this.mCurrentDocumentSize;
+        if (documentSizeInfo2 == null) {
+            return false;
+        }
+        return documentSizeInfo2.equals(documentSizeInfo);
+    }
+
+    public void select(int i) {
+        if (i < 0) {
+            this.mCurrentDocumentSize = null;
+        } else if (i < this.mDocumentSizeList.size()) {
+            this.mCurrentDocumentSize = this.mDocumentSizeList.get(i);
+            saveData(this.mContext);
+        } else {
+            throw new IndexOutOfBoundsException(String.format(Locale.US, "position <%d> learger than list size <%s>", new Object[]{Integer.valueOf(i), Integer.valueOf(this.mDocumentSizeList.size())}));
+        }
+    }
+
+    public void select(DocumentSizeInfo documentSizeInfo) {
+        if (documentSizeInfo != null) {
+            int indexOf = this.mDocumentSizeList.indexOf(documentSizeInfo);
+            if (indexOf >= 0) {
+                this.mCurrentDocumentSize = this.mDocumentSizeList.get(indexOf);
+            } else {
+                this.mDocumentSizeList.add(documentSizeInfo);
+                this.mCurrentDocumentSize = documentSizeInfo;
+            }
+            saveData(this.mContext);
+            return;
+        }
+        throw new IllegalArgumentException("DocumentSizeInfo is null");
+    }
+
+    public int getCurrentDocumentSizePosition() {
+        Iterator it = this.mDocumentSizeList.iterator();
+        int i = 0;
+        while (it.hasNext()) {
+            if (((DocumentSizeInfo) it.next()) == this.mCurrentDocumentSize) {
+                return i;
+            }
+            i++;
+        }
+        return -1;
+    }
+
+    public Iterator<DocumentSizeInfo> getIterator() {
+        return this.mDocumentSizeList.iterator();
+    }
+
+    public int indexOf(DocumentSizeInfo documentSizeInfo) {
+        LinkedList<DocumentSizeInfo> linkedList = this.mDocumentSizeList;
+        if (linkedList == null) {
+            return -1;
+        }
+        return linkedList.indexOf(documentSizeInfo);
+    }
+
+    private void initData() {
+        this.mDocumentSizeList.clear();
+        this.mCurrentDocumentSize = null;
+    }
+
+    private void saveData(Context context) {
+        FileOutputStream fileOutputStream = null;
+        try {
+            fileOutputStream = context.openFileOutput(REGISTED_DOCUMENTSIZE_LIST_FILENAME, 0);
+            JSONObject jSONObject = new JSONObject();
+            jSONObject.put("version", 1);
+            jSONObject.put("DocumentSizeInfoList", DocumentSizeInfo.makeDocumentSizeInfoList(this.mDocumentSizeList));
+            jSONObject.put("currentDocumentSize", this.mCurrentDocumentSize);
+            fileOutputStream.write(jSONObject.toString().getBytes());
+            if (fileOutputStream == null) {
+                return;
+            }
+        } catch (IOException unused) {
+            if (fileOutputStream == null) {
+                return;
+            }
+        } catch (JSONException e) {
+            e.printStackTrace();
+            if (fileOutputStream == null) {
+                return;
+            }
+        } catch (Throwable th) {
+            if (fileOutputStream != null) {
+                try {
+                    fileOutputStream.close();
+                } catch (IOException unused2) {
+                }
+            }
+            throw th;
+        }
+        try {
+            fileOutputStream.close();
+        } catch (IOException unused3) {
+        }
+    }
+
+    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r2v6, resolved type: java.lang.Object} */
+    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r3v6, resolved type: java.lang.Integer} */
+    /* JADX WARNING: Code restructure failed: missing block: B:59:?, code lost:
+        r0.close();
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:68:?, code lost:
+        r0.close();
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:85:?, code lost:
+        return;
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:86:?, code lost:
+        return;
+     */
+    /* JADX WARNING: Exception block dominator not found, dom blocks: [B:55:0x00c9, B:64:0x00d7] */
+    /* JADX WARNING: Missing exception handler attribute for start block: B:55:0x00c9 */
+    /* JADX WARNING: Missing exception handler attribute for start block: B:64:0x00d7 */
+    /* JADX WARNING: Multi-variable type inference failed */
+    /* JADX WARNING: Removed duplicated region for block: B:39:0x00b0 A[SYNTHETIC, Splitter:B:39:0x00b0] */
+    /* JADX WARNING: Removed duplicated region for block: B:58:0x00ce A[SYNTHETIC, Splitter:B:58:0x00ce] */
+    /* JADX WARNING: Removed duplicated region for block: B:67:0x00dc A[SYNTHETIC, Splitter:B:67:0x00dc] */
+    /* JADX WARNING: Removed duplicated region for block: B:75:0x00eb A[SYNTHETIC, Splitter:B:75:0x00eb] */
+    /* JADX WARNING: Removed duplicated region for block: B:79:0x00f2 A[SYNTHETIC, Splitter:B:79:0x00f2] */
+    /* JADX WARNING: Removed duplicated region for block: B:84:? A[RETURN, SYNTHETIC] */
+    /* JADX WARNING: Removed duplicated region for block: B:85:? A[RETURN, SYNTHETIC] */
+    /* JADX WARNING: Removed duplicated region for block: B:86:? A[RETURN, SYNTHETIC] */
+    /* JADX WARNING: Unknown top exception splitter block from list: {B:64:0x00d7=Splitter:B:64:0x00d7, B:55:0x00c9=Splitter:B:55:0x00c9} */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    private void restoreData(android.content.Context r8) {
+        /*
+            r7 = this;
+            r0 = 0
+            java.lang.String r1 = "registed_documentsize.bin"
+            java.io.FileInputStream r1 = r8.openFileInput(r1)     // Catch:{ ClassNotFoundException -> 0x00d6, IOException -> 0x00c8, all -> 0x00c5 }
+            r2 = 1
+            int r3 = r1.available()     // Catch:{ JSONException -> 0x004b }
+            byte[] r3 = new byte[r3]     // Catch:{ JSONException -> 0x004b }
+            r1.read(r3)     // Catch:{ JSONException -> 0x004b }
+            org.json.JSONObject r4 = new org.json.JSONObject     // Catch:{ JSONException -> 0x004b }
+            java.lang.String r5 = new java.lang.String     // Catch:{ JSONException -> 0x004b }
+            r5.<init>(r3)     // Catch:{ JSONException -> 0x004b }
+            r4.<init>(r5)     // Catch:{ JSONException -> 0x004b }
+            java.lang.String r3 = "version"
+            int r3 = r4.getInt(r3)     // Catch:{ JSONException -> 0x004b }
+            java.lang.Integer r3 = java.lang.Integer.valueOf(r3)     // Catch:{ JSONException -> 0x004b }
+            int r3 = r3.intValue()     // Catch:{ JSONException -> 0x004b }
+            if (r3 != r2) goto L_0x003c
+            java.util.LinkedList r3 = com.epson.cameracopy.printlayout.DocumentSizeInfo.getDocumentSizeInfoList(r4)     // Catch:{ JSONException -> 0x004b }
+            r7.mDocumentSizeList = r3     // Catch:{ JSONException -> 0x004b }
+            java.lang.String r3 = "currentDocumentSize"
+            int r3 = r4.optInt(r3)     // Catch:{ JSONException -> 0x004b }
+            java.lang.Integer r3 = java.lang.Integer.valueOf(r3)     // Catch:{ JSONException -> 0x004b }
+            goto L_0x0051
+        L_0x003c:
+            java.io.IOException r3 = new java.io.IOException     // Catch:{ JSONException -> 0x004b }
+            r3.<init>()     // Catch:{ JSONException -> 0x004b }
+            throw r3     // Catch:{ JSONException -> 0x004b }
+        L_0x0042:
+            r8 = move-exception
+            goto L_0x00e9
+        L_0x0045:
+            r8 = r1
+            goto L_0x00c9
+        L_0x0048:
+            r8 = r1
+            goto L_0x00d7
+        L_0x004b:
+            r3 = move-exception
+            r3.printStackTrace()     // Catch:{ ClassNotFoundException -> 0x0048, IOException -> 0x0045, all -> 0x0042 }
+            r3 = r0
+            r4 = r3
+        L_0x0051:
+            if (r4 != 0) goto L_0x0083
+            r1.close()     // Catch:{ ClassNotFoundException -> 0x0048, IOException -> 0x0045, all -> 0x0042 }
+            java.lang.String r3 = "registed_documentsize.bin"
+            java.io.FileInputStream r8 = r8.openFileInput(r3)     // Catch:{ ClassNotFoundException -> 0x0048, IOException -> 0x0045, all -> 0x0042 }
+            java.io.ObjectInputStream r1 = new java.io.ObjectInputStream     // Catch:{ ClassNotFoundException -> 0x00d7, IOException -> 0x00c9 }
+            r1.<init>(r8)     // Catch:{ ClassNotFoundException -> 0x00d7, IOException -> 0x00c9 }
+            java.lang.Object r3 = r1.readObject()     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            java.lang.Integer r3 = (java.lang.Integer) r3     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            int r3 = r3.intValue()     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            if (r3 != r2) goto L_0x007d
+            java.lang.Object r2 = r1.readObject()     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            java.util.LinkedList r2 = (java.util.LinkedList) r2     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            r7.mDocumentSizeList = r2     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            java.lang.Object r2 = r1.readObject()     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            r3 = r2
+            java.lang.Integer r3 = (java.lang.Integer) r3     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            goto L_0x0085
+        L_0x007d:
+            java.io.IOException r0 = new java.io.IOException     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            r0.<init>()     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            throw r0     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+        L_0x0083:
+            r8 = r1
+            r1 = r0
+        L_0x0085:
+            if (r3 == 0) goto L_0x00ac
+            int r2 = r3.intValue()     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            java.util.LinkedList<com.epson.cameracopy.printlayout.DocumentSizeInfo> r4 = r7.mDocumentSizeList     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            int r4 = r4.size()     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            if (r2 < r4) goto L_0x0094
+            goto L_0x00ac
+        L_0x0094:
+            int r2 = r3.intValue()     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            if (r2 >= 0) goto L_0x009d
+            r7.mCurrentDocumentSize = r0     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            goto L_0x00ae
+        L_0x009d:
+            java.util.LinkedList<com.epson.cameracopy.printlayout.DocumentSizeInfo> r0 = r7.mDocumentSizeList     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            int r2 = r3.intValue()     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            java.lang.Object r0 = r0.get(r2)     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            com.epson.cameracopy.printlayout.DocumentSizeInfo r0 = (com.epson.cameracopy.printlayout.DocumentSizeInfo) r0     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            r7.mCurrentDocumentSize = r0     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+            goto L_0x00ae
+        L_0x00ac:
+            r7.mCurrentDocumentSize = r0     // Catch:{ ClassNotFoundException -> 0x00c3, IOException -> 0x00c1, all -> 0x00bb }
+        L_0x00ae:
+            if (r1 == 0) goto L_0x00b5
+            r1.close()     // Catch:{ IOException -> 0x00b4 }
+            goto L_0x00b5
+        L_0x00b4:
+        L_0x00b5:
+            if (r8 == 0) goto L_0x00e4
+        L_0x00b7:
+            r8.close()     // Catch:{ IOException -> 0x00e4 }
+            goto L_0x00e4
+        L_0x00bb:
+            r0 = move-exception
+            r6 = r1
+            r1 = r8
+            r8 = r0
+            r0 = r6
+            goto L_0x00e9
+        L_0x00c1:
+            r0 = r1
+            goto L_0x00c9
+        L_0x00c3:
+            r0 = r1
+            goto L_0x00d7
+        L_0x00c5:
+            r8 = move-exception
+            r1 = r0
+            goto L_0x00e9
+        L_0x00c8:
+            r8 = r0
+        L_0x00c9:
+            r7.reset()     // Catch:{ all -> 0x00e5 }
+            if (r0 == 0) goto L_0x00d3
+            r0.close()     // Catch:{ IOException -> 0x00d2 }
+            goto L_0x00d3
+        L_0x00d2:
+        L_0x00d3:
+            if (r8 == 0) goto L_0x00e4
+            goto L_0x00b7
+        L_0x00d6:
+            r8 = r0
+        L_0x00d7:
+            r7.reset()     // Catch:{ all -> 0x00e5 }
+            if (r0 == 0) goto L_0x00e1
+            r0.close()     // Catch:{ IOException -> 0x00e0 }
+            goto L_0x00e1
+        L_0x00e0:
+        L_0x00e1:
+            if (r8 == 0) goto L_0x00e4
+            goto L_0x00b7
+        L_0x00e4:
+            return
+        L_0x00e5:
+            r1 = move-exception
+            r6 = r1
+            r1 = r8
+            r8 = r6
+        L_0x00e9:
+            if (r0 == 0) goto L_0x00f0
+            r0.close()     // Catch:{ IOException -> 0x00ef }
+            goto L_0x00f0
+        L_0x00ef:
+        L_0x00f0:
+            if (r1 == 0) goto L_0x00f5
+            r1.close()     // Catch:{ IOException -> 0x00f5 }
+        L_0x00f5:
+            throw r8
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.printlayout.RegistedDocumentSizeList.restoreData(android.content.Context):void");
+    }
+}

+ 441 - 0
app/src/main/java/com/epson/iprint/prtlogger/Analytics.java

@@ -0,0 +1,441 @@
+package com.epson.iprint.prtlogger;
+
+import android.content.Context;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import com.box.androidsdk.content.BoxConstants;
+import com.epson.mobilephone.common.EpLog;
+import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
+
+
+import epson.print.IprintApplication;
+import epson.print.MyPrinter;
+import epson.print.Util.EPLog;
+import epson.print.copy.Component.ecopycomponent.CopyParams;
+import epson.print.rpcopy.Component.ecopycomponent.RepeatCopyAnalyticsParams;
+import epson.print.screen.PrintProgress;
+import epson.print.screen.PrintSetting;
+import epson.scan.lib.I1ScanParams;
+
+public class Analytics {
+    public static final String ACTION_ID_HOME_BUY_INK = "Home-BuyInk";
+    public static final String ACTION_ID_HOME_CAMERACOPY = "Home-CameraCopy";
+    public static final String ACTION_ID_HOME_COPY = "Home-Copy";
+    public static final String ACTION_ID_HOME_DOCUMENT = "Home-Document";
+    public static final String ACTION_ID_HOME_INFO = "Home-Info";
+    public static final String ACTION_ID_HOME_MAINTAIN = "Home-Maintain";
+    public static final String ACTION_ID_HOME_MEMORYCARD_ACCESS = "Home-MemoryCardAccess";
+    public static final String ACTION_ID_HOME_ONLINE_STORAGE = "Home-OnlineStorage";
+    public static final String ACTION_ID_HOME_PHOTO = "Home-Photo";
+    public static final String ACTION_ID_HOME_PHOTO_TRANSFER = "Home-PhotoTransfer";
+    public static final String ACTION_ID_HOME_READY_INK = "Home-ReadyInk";
+    public static final String ACTION_ID_HOME_SCAN = "Home-Scan";
+    public static final String ACTION_ID_HOME_WEB = "Home-Web";
+    public static final String ACTION_ID_MAINTENANCE_BUY_INK = "Maintenance-BuyInk";
+    public static final String ACTION_ID_MAINTENANCE_FIRMWARE_UPDATE = "Firmware Update";
+    public static final String ACTION_ID_MAINTENANCE_HEAD_CLEANING = "HeadCleaning";
+    public static final String ACTION_ID_MAINTENANCE_NOZZLE_CHECK = "NozzlleCheck";
+    public static final String ACTION_ID_MAINTENANCE_READY_INK = "Maintenance-ReadyInk";
+    public static final String ACTION_ID_SETUP_BLE = "PrinterSetup-BLE";
+    public static final int CONNECTION_TYPE_NO_CONNECTION_TYPE = -1;
+    public static final int CONNECTION_TYPE_OTG = 11;
+    public static final int CONNECTION_TYPE_REMOTE = 10;
+    private static final int CUSTOM_DIMENSION_BLE_PATH = 1;
+    private static final int CUSTOM_DIMENSION_BLE_RESULT = 2;
+    private static final int CUSTOM_DIMENSION_DEBUG = 28;
+    private static final String CUSTOM_DIMENSION_DEBUG_VALUE = "develop";
+    public static final String EXTENSION_STRING_WEB = "http";
+    public static final String SCREEN_ID_HOME = "Home";
+    private static final String TAG = "Analytics";
+    public static final int WIFI_DIRECT_TYPE_NORMAL_WIFI_DIRECT = 1;
+    public static final int WIFI_DIRECT_TYPE_NOT_WIFI_DIRECT = 0;
+    public static final int WIFI_DIRECT_TYPE_SIMPLE_AP = 2;
+
+    private static String getActionString(int i) {
+        if (i == 4100) {
+            return "Intent-Web";
+        }
+        if (i == 4353) {
+            return "Intent-Scan";
+        }
+        switch (i) {
+            case 1:
+                return "Photos";
+            case 2:
+                return "Saved Documents";
+            case 3:
+                return "Web";
+            case 4:
+                return "Scan-Print";
+            case 5:
+                return "Document Capture";
+            default:
+                switch (i) {
+                    case 256:
+                        return "Evernote";
+                    case 257:
+                        return "Google Drive";
+                    case PrintLog.PRINT_SOURCE_DROPBOX /*258*/:
+                        return "Dropbox";
+                    case PrintLog.PRINT_SOURCE_BOX /*259*/:
+                        return "Box";
+                    case PrintLog.PRINT_SOURCE_ONEDRIVE /*260*/:
+                        return "OneDrive";
+                    case PrintLog.PRINT_SOURCE_MYPOCKET /*261*/:
+                        return "MyPocket";
+                    default:
+                        switch (i) {
+                            case 4097:
+                                return "Intent-Photos";
+                            case 4098:
+                                return "Intent-Documents";
+                            default:
+                                switch (i) {
+                                    case PrintLog.ACTION_ID_MEMORY_CARD_COPY_TO_PRINTER:
+                                    case PrintLog.ACTION_ID_MEMORY_CARD_COPY_TO_MOBILE_DEVICE:
+                                        return "Memory Access";
+                                    case PrintLog.ACTION_PHOTO_TRANSFER:
+                                        return "Send Photo";
+                                    case PrintLog.ACTION_COPY:
+                                        return "Copy";
+                                    case PrintLog.ACTION_SCAN:
+                                        return "Scan";
+                                    case PrintLog.ACTION_REPEAT_COPY:
+                                        return "RepeatCopy";
+                                    default:
+                                        return "";
+                                }
+                        }
+                }
+        }
+    }
+
+    @NonNull
+    private static String getConnectionTypeString(int i) {
+        switch (i) {
+            case 0:
+                return "Infra";
+            case 1:
+                return "Wi-Fi Direct";
+            case 2:
+                return "SimpleAP";
+            default:
+                switch (i) {
+                    case 10:
+                        return "Remote";
+                    case 11:
+                        return "OTG";
+                    default:
+                        return "";
+                }
+        }
+    }
+
+    private static String getDateString(int i) {
+        return i == 0 ? "OFF" : "ON";
+    }
+
+    private static String getOnOff(boolean z) {
+        return z ? "ON" : "OFF";
+    }
+
+    private static String getScanColorTypeString(int i) {
+        switch (i) {
+            case 1:
+                return "Color";
+            case 2:
+                return "Grayscale";
+            case 3:
+                return "Monochrome";
+            default:
+                return "";
+        }
+    }
+
+    private static String getScanDeviceString(int i) {
+        switch (i) {
+            case 0:
+                return "DocumentTable";
+            case 1:
+                return "ADF";
+            default:
+                return "";
+        }
+    }
+
+    private static String getScanGammaString(int i) {
+        return i != 0 ? "1" : BoxConstants.ROOT_FOLDER_ID;
+    }
+
+    public enum SetUpResult {
+        Success("Success"),
+        Fail("Fail"),
+        Error("Error"),
+        Error106("Error-106"),
+        Error119("Error-119");
+
+        private final String name;
+
+        private SetUpResult(String str) {
+            this.name = str;
+        }
+
+        public String toString() {
+            return this.name;
+        }
+    }
+
+    public enum SetUpPath {
+        Home("HomePopup"),
+        Button("SetUpButton");
+
+        private final String name;
+
+        private SetUpPath(String str) {
+            this.name = str;
+        }
+
+        public String toString() {
+            return this.name;
+        }
+    }
+
+    public static void sendPrintLog(@NonNull Context context, @NonNull PrintProgress.ProgressParams progressParams) {
+        if (NewLoggerController.isLoggerEnabled(context)) {
+            PrintLog printLog = progressParams.getPrintLog();
+            if (printLog == null) {
+                printLog = new PrintLog();
+            }
+            int printNumber = AnalyticsPreferences.getPrintNumber(context);
+            EpLog.m77i("    **************     " + printNumber);
+            if (printNumber > 0) {
+                PrintSetting printSetting = progressParams.getPrintSetting(context);
+                printSetting.loadSettings();
+                HitBuilders.EventBuilder value = createEventBuilder().setCategory("function").setAction(getActionString(printLog)).setValue((long) (printNumber * printSetting.copiesValue));
+                String defaultPrinterName = getDefaultPrinterName(context);
+                if (defaultPrinterName != null) {
+                    value.setLabel(defaultPrinterName);
+                }
+                ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) value.setCustomDimension(2, getConnectionString(context))).setCustomDimension(3, Integer.toString(printSetting.paperSizeValue))).setCustomDimension(4, Integer.toString(printSetting.paperTypeValue))).setCustomDimension(5, Integer.toString(printSetting.qualityValue))).setCustomDimension(6, Integer.toString(getLayoutValue(printSetting)))).setCustomDimension(7, Integer.toString(printSetting.paperSourceValue))).setCustomDimension(8, Integer.toString(printSetting.colorValue))).setCustomDimension(9, Integer.toString(printSetting.duplexValue));
+                if (printLog.previewType == 1) {
+                    ((HitBuilders.EventBuilder) value.setCustomDimension(11, progressParams.getApfMode() ? "ON" : "OFF")).setCustomDimension(10, getDateString(printSetting.printdate));
+                }
+                String sizeLimitString = getSizeLimitString(printLog.originalFileExtension, 150);
+                if (!sizeLimitString.isEmpty()) {
+                    value.setCustomDimension(1, sizeLimitString);
+                }
+                String sizeLimitString2 = getSizeLimitString(printLog.callerPackage, 150);
+                if (!sizeLimitString2.isEmpty()) {
+                    value.setCustomDimension(12, sizeLimitString2);
+                }
+                IprintApplication.getInstance().getDefaultTracker().send(value.build());
+            }
+        }
+    }
+
+    private static int getLayoutValue(PrintSetting printSetting) {
+        int i = printSetting.layoutMultiPageValue;
+        if (i == 0) {
+            return printSetting.layoutValue;
+        }
+        if (i == 65536) {
+            return 256;
+        }
+        if (i != 131072) {
+            return i != 262144 ? 2 : 1024;
+        }
+        return 512;
+    }
+
+    @NonNull
+    static String getSizeLimitString(String str, int i) {
+        if (str == null) {
+            return "";
+        }
+        int length = str.length();
+        if (i > length) {
+            i = length;
+        }
+        return str.substring(0, i);
+    }
+
+    public static String getDefaultPrinterName(@NonNull Context context) {
+        return MyPrinter.getCurPrinter(context).getName();
+    }
+
+    @NonNull
+    private static String getConnectionString(@NonNull Context context) {
+        return getConnectionTypeString(AnalyticsPreferences.getConnectionPath(context));
+    }
+
+    private static String getActionString(PrintLog printLog) {
+        return printLog == null ? "" : getActionString(printLog.uiRoute);
+    }
+
+    public static void sendScanI1Log(Context context, I1ScanParams i1ScanParams, CommonLog commonLog, boolean z) {
+        if (commonLog != null && context != null && i1ScanParams != null && NewLoggerController.isLoggerEnabled(context)) {
+            HitBuilders.EventBuilder createEventBuilder = createEventBuilder();
+            setCommonData(commonLog, createEventBuilder);
+            setScanDataFromI1(i1ScanParams, createEventBuilder, z);
+            sendData(createEventBuilder);
+        }
+    }
+
+    private static void setScanDataFromI1(@NonNull I1ScanParams i1ScanParams, @NonNull HitBuilders.EventBuilder eventBuilder, boolean z) {
+        ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) eventBuilder.setCustomDimension(13, getScanDeviceString(i1ScanParams.inputDevice))).setCustomDimension(15, getScanColorTypeString(i1ScanParams.colorType))).setCustomDimension(16, Integer.toString(i1ScanParams.resolution))).setCustomDimension(17, getOnOff(i1ScanParams.twoSide != 0))).setCustomDimension(18, getScanGammaString(i1ScanParams.gamma))).setCustomDimension(19, Integer.toString(i1ScanParams.brightness))).setCustomDimension(41, getOnOff(z));
+    }
+
+    public static void sendCopyLog(@NonNull Context context, CopyParams copyParams, CommonLog commonLog) {
+        if (copyParams != null && NewLoggerController.isLoggerEnabled(context)) {
+            HitBuilders.EventBuilder createEventBuilder = createEventBuilder();
+            setCommonData(commonLog, createEventBuilder);
+            setCopyData(copyParams, createEventBuilder);
+            sendData(createEventBuilder);
+        }
+    }
+
+    private static void setCopyData(@NonNull CopyParams copyParams, @NonNull HitBuilders.EventBuilder eventBuilder) {
+        ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) eventBuilder.setCustomDimension(20, copyParams.colorMode)).setCustomDimension(21, copyParams.density)).setCustomDimension(22, copyParams.magnification)).setCustomDimension(23, copyParams.paperSize)).setCustomDimension(24, copyParams.paperType)).setCustomDimension(25, copyParams.printDevice)).setCustomDimension(26, copyParams.copyType)).setCustomDimension(27, copyParams.copyQuality);
+    }
+
+    public static void sendRepeatCopyLog(@NonNull Context context, RepeatCopyAnalyticsParams repeatCopyAnalyticsParams, @NonNull CommonLog commonLog) {
+        if (repeatCopyAnalyticsParams != null && NewLoggerController.isLoggerEnabled(context)) {
+            HitBuilders.EventBuilder createEventBuilder = createEventBuilder();
+            setCommonData(commonLog, createEventBuilder);
+            setRepeatCopyData(repeatCopyAnalyticsParams, createEventBuilder);
+            sendData(createEventBuilder);
+        }
+    }
+
+    private static void setRepeatCopyData(@NonNull RepeatCopyAnalyticsParams repeatCopyAnalyticsParams, @NonNull HitBuilders.EventBuilder eventBuilder) {
+        ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) ((HitBuilders.EventBuilder) eventBuilder.setCustomDimension(30, repeatCopyAnalyticsParams.colorMode)).setCustomDimension(31, repeatCopyAnalyticsParams.density)).setCustomDimension(32, repeatCopyAnalyticsParams.repeatLayout)).setCustomDimension(33, repeatCopyAnalyticsParams.paperSize)).setCustomDimension(34, repeatCopyAnalyticsParams.paperType)).setCustomDimension(35, repeatCopyAnalyticsParams.printDevice)).setCustomDimension(36, repeatCopyAnalyticsParams.copyQuality)).setCustomDimension(37, repeatCopyAnalyticsParams.removeBackground);
+        sendDataIfNonNull(eventBuilder, 38, repeatCopyAnalyticsParams.XCutLine);
+        sendDataIfNonNull(eventBuilder, 39, repeatCopyAnalyticsParams.XCutLineStyle);
+        sendDataIfNonNull(eventBuilder, 40, repeatCopyAnalyticsParams.XCutLineWeight);
+    }
+
+    private static void sendDataIfNonNull(@NonNull HitBuilders.EventBuilder eventBuilder, int i, @Nullable String str) {
+        if (str != null) {
+            eventBuilder.setCustomDimension(i, str);
+        }
+    }
+
+    public static void sendCommonLog(Context context, CommonLog commonLog) {
+        if (NewLoggerController.isLoggerEnabled(context) && commonLog != null && context != null) {
+            HitBuilders.EventBuilder createEventBuilder = createEventBuilder();
+            setCommonData(commonLog, createEventBuilder);
+            sendData(createEventBuilder);
+        }
+    }
+
+    private static void setCommonData(@NonNull CommonLog commonLog, @NonNull HitBuilders.EventBuilder eventBuilder) {
+        eventBuilder.setCategory("function").setAction(getActionString(commonLog.action)).setValue((long) commonLog.numberOfSheet);
+        int i = commonLog.connectionType;
+        if (i >= 0) {
+            eventBuilder.setCustomDimension(2, getConnectionTypeString(i));
+        }
+        if (commonLog.printerName != null) {
+            eventBuilder.setLabel(commonLog.printerName);
+        }
+        if (commonLog.callerPackage != null) {
+            eventBuilder.setCustomDimension(12, getSizeLimitString(commonLog.callerPackage, 150));
+        }
+        setDirectionData(commonLog, eventBuilder);
+    }
+
+    private static void sendData(@NonNull HitBuilders.EventBuilder eventBuilder) {
+        IprintApplication.getInstance().getDefaultTracker().send(eventBuilder.build());
+    }
+
+    private static void setDirectionData(CommonLog commonLog, HitBuilders.EventBuilder eventBuilder) {
+        String str;
+        switch (commonLog.action) {
+            case PrintLog.ACTION_ID_MEMORY_CARD_COPY_TO_PRINTER /*8193*/:
+                str = "toPrinter";
+                break;
+            case 8194:
+                str = "toSmartPhone";
+                break;
+            default:
+                return;
+        }
+        eventBuilder.setCustomDimension(1, str);
+    }
+
+    public static void savePrintInfo(@NonNull Context context, int i) {
+        EpLog.m77i("  @@@@@@@@@@@@@     printSheet = " + i);
+        AnalyticsPreferences.savePrintNumber(context, i);
+        AnalyticsPreferences.saveConnectionPath(context, getConnectionType(context));
+    }
+
+    public static void cleanPrintNumber(@NonNull Context context) {
+        AnalyticsPreferences.savePrintNumber(context, 0);
+    }
+
+    public static int getConnectionType(@NonNull Context context) {
+        if (MyPrinter.isRemotePrinter(context)) {
+            return 10;
+        }
+        if (MyPrinter.isPrinterRouteOtg(context)) {
+            return 11;
+        }
+        return getWifiDirectTypeIprintV4(context);
+    }
+
+    public static void countScreen(@NonNull Context context, String str) {
+        if (NewLoggerController.isLoggerEnabled(context)) {
+            if (str == null) {
+                EPLog.m318w(TAG, "ERROR: countScreen() screenId == null");
+                return;
+            }
+            Tracker defaultTracker = IprintApplication.getInstance().getDefaultTracker();
+            defaultTracker.setScreenName(str);
+            defaultTracker.send(createScreenViewBuilder().build());
+        }
+    }
+
+    public static void sendAction(@NonNull Context context, String str) {
+        if (NewLoggerController.isLoggerEnabled(context)) {
+            if (str == null) {
+                EPLog.m318w(TAG, "ERROR: sendAction() actionId == null");
+            } else {
+                IprintApplication.getInstance().getDefaultTracker().send(createEventBuilder().setCategory("tap").setAction(str).build());
+            }
+        }
+    }
+
+    public static void sendSetup(String str, SetUpPath setUpPath, SetUpResult setUpResult) {
+        HitBuilders.EventBuilder label = createEventBuilder().setCategory("setup").setAction(ACTION_ID_SETUP_BLE).setLabel(str);
+        label.setCustomDimension(1, setUpPath.toString());
+        label.setCustomDimension(2, setUpResult.toString());
+        IprintApplication.getInstance().getDefaultTracker().send(label.build());
+    }
+
+    private static HitBuilders.EventBuilder createEventBuilder() {
+        HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder();
+        if (isAnalyticsDebug()) {
+            eventBuilder.setCustomDimension(28, CUSTOM_DIMENSION_DEBUG_VALUE);
+        }
+        return eventBuilder;
+    }
+
+    private static HitBuilders.ScreenViewBuilder createScreenViewBuilder() {
+        HitBuilders.ScreenViewBuilder screenViewBuilder = new HitBuilders.ScreenViewBuilder();
+        if (isAnalyticsDebug()) {
+            screenViewBuilder.setCustomDimension(28, CUSTOM_DIMENSION_DEBUG_VALUE);
+        }
+        return screenViewBuilder;
+    }
+
+    private static boolean isAnalyticsDebug() {
+        return IprintApplication.isConnectStaging();
+    }
+
+    public static int getWifiDirectTypeIprintV4(Context context) {
+        if (!WiFiDirectManager.isWifiDirectFY13(context) && !WiFiDirectManager.isWifiDirectP2P(context)) {
+            return WiFiDirectManager.isSimpleAP(context) ? 2 : 0;
+        }
+        return 1;
+    }
+}

+ 40 - 0
app/src/main/java/com/epson/iprint/prtlogger/AnalyticsPreferences.java

@@ -0,0 +1,40 @@
+package com.epson.iprint.prtlogger;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+
+import com.epson.mobilephone.common.EpLog;
+
+import epson.provider.SharedPreferencesProvider;
+
+public class AnalyticsPreferences {
+    private static final String PREFS_KEY_CONNECTION_PATH = "connection_path";
+    private static final String PREFS_KEY_ONLINE_STORAGE_TYPE = "online_storage_type";
+    private static final String PREFS_KEY_PRINT_NUMBER = "print_num";
+    public static final String PREFS_NAME = "analytics_prefs";
+
+    public static void saveConnectionPath(@NonNull Context context, int i) {
+        SharedPreferencesProvider.getInstace(context, PREFS_NAME).edit().putInt(PREFS_KEY_CONNECTION_PATH, i).apply(PREFS_NAME);
+    }
+
+    public static int getConnectionPath(@NonNull Context context) {
+        return SharedPreferencesProvider.getInstace(context, PREFS_NAME).getInt(PREFS_KEY_CONNECTION_PATH, -1);
+    }
+
+    public static void savePrintNumber(@NonNull Context context, int i) {
+        EpLog.m77i("    printNumber = " + i);
+        SharedPreferencesProvider.getInstace(context, PREFS_NAME).edit().putInt(PREFS_KEY_PRINT_NUMBER, i).apply(PREFS_NAME);
+    }
+
+    public static int getPrintNumber(@NonNull Context context) {
+        return SharedPreferencesProvider.getInstace(context, PREFS_NAME).getInt(PREFS_KEY_PRINT_NUMBER, 0);
+    }
+
+    public static void saveOnlineStorageType(@NonNull Context context, int i) {
+        SharedPreferencesProvider.getInstace(context, PREFS_NAME).edit().putInt(PREFS_KEY_ONLINE_STORAGE_TYPE, i).apply(PREFS_NAME);
+    }
+
+    private static int getOnlineStorageType(@NonNull Context context) {
+        return SharedPreferencesProvider.getInstace(context, PREFS_NAME).getInt(PREFS_KEY_ONLINE_STORAGE_TYPE, -1);
+    }
+}

+ 24 - 0
app/src/main/java/com/epson/iprint/prtlogger/CommonLog.java

@@ -0,0 +1,24 @@
+package com.epson.iprint.prtlogger;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+
+import java.io.Serializable;
+
+import epson.print.MyPrinter;
+
+public class CommonLog implements Serializable {
+    public int action;
+    public String callerPackage;
+    public int connectionType;
+    public int numberOfSheet;
+    public String printerName;
+
+    public void setPrinterName(@NonNull Context context) {
+        this.printerName = MyPrinter.getCurPrinter(context).getName();
+    }
+
+    public void setConnectionType(@NonNull Context context) {
+        this.connectionType = Analytics.getConnectionType(context);
+    }
+}

+ 49 - 0
app/src/main/java/com/epson/iprint/prtlogger/LoggerRecord.java

@@ -0,0 +1,49 @@
+package com.epson.iprint.prtlogger;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.support.annotation.NonNull;
+import android.support.annotation.VisibleForTesting;
+
+public class LoggerRecord {
+    private static final String ANALYTICS_PREFS_NAME = "logger6_3";
+    private static final String PREFS_KEY_LOGGER_ANSWER = "answer";
+    private static final String PREFS_KEY_LOGGER_VERSION = "logger_version";
+    private static LoggerRecord sLoggerRecord;
+
+    public static synchronized LoggerRecord getInstance() {
+        LoggerRecord loggerRecord;
+        synchronized (LoggerRecord.class) {
+            if (sLoggerRecord == null) {
+                sLoggerRecord = new LoggerRecord();
+            }
+            loggerRecord = sLoggerRecord;
+        }
+        return loggerRecord;
+    }
+
+    @VisibleForTesting
+    static void replaceInstance(LoggerRecord loggerRecord) {
+        sLoggerRecord = loggerRecord;
+    }
+
+    public int getInvitationVersion(@NonNull Context context) {
+        return getPreferences(context).getInt(PREFS_KEY_LOGGER_VERSION, 0);
+    }
+
+    public void setInvitationVersion(@NonNull Context context, int i) {
+        getPreferences(context).edit().putInt(PREFS_KEY_LOGGER_VERSION, i).apply();
+    }
+
+    public void setAnswer(@NonNull Context context, boolean z) {
+        getPreferences(context).edit().putBoolean(PREFS_KEY_LOGGER_ANSWER, z).apply();
+    }
+
+    public boolean getAnswer(@NonNull Context context) {
+        return getPreferences(context).getBoolean(PREFS_KEY_LOGGER_ANSWER, false);
+    }
+
+    private SharedPreferences getPreferences(@NonNull Context context) {
+        return context.getSharedPreferences(ANALYTICS_PREFS_NAME, 0);
+    }
+}

+ 55 - 0
app/src/main/java/com/epson/iprint/prtlogger/NewLoggerController.java

@@ -0,0 +1,55 @@
+package com.epson.iprint.prtlogger;
+
+import android.content.Context;
+
+import androidx.annotation.NonNull;
+
+/**
+ * log跟踪器
+ *
+ * @author liuyuqi.gov@msn.cn
+ * @date 10/29/2020
+ */
+public class NewLoggerController {
+    private static final int CURRENT_USER_SURVEY_DOCUMENT_VERSION = 60300;
+
+    private NewLoggerController() {
+    }
+
+    public static boolean checkAnalyticsInvitationAndDeleteOldData(@NonNull Context context) {
+        return !doesAnsweredCurrentInvitation(context);
+    }
+
+    public static boolean doesAnsweredCurrentInvitation(@NonNull Context context) {
+        return LoggerRecord.getInstance().getInvitationVersion(context) >= CURRENT_USER_SURVEY_DOCUMENT_VERSION;
+    }
+
+    public static boolean doesAnsweredInvitation(@NonNull Context context) {
+        return LoggerRecord.getInstance().getInvitationVersion(context) > 0;
+    }
+
+    public static void setAnswer(@NonNull Context context, boolean z) {
+        LoggerRecord instance = LoggerRecord.getInstance();
+        instance.setAnswer(context, z);
+        instance.setInvitationVersion(context, CURRENT_USER_SURVEY_DOCUMENT_VERSION);
+//        GoogleAnalytics.getInstance(context).setAppOptOut(!z);
+    }
+
+    public static boolean isLoggerEnabled(@NonNull Context context) {
+        if (!doesAnsweredCurrentInvitation(context)) {
+            return false;
+        }
+        return LoggerRecord.getInstance().getAnswer(context);
+    }
+
+    /**
+     * 如果不同意则不记录log
+     *
+     * @param context 上下文
+     */
+    public static void stopLoggerIfNotAgreed(@NonNull Context context) {
+        if (!isLoggerEnabled(context)) {
+//            GoogleAnalytics.getInstance(context).setAppOptOut(true);
+        }
+    }
+}

+ 56 - 0
app/src/main/java/com/epson/iprint/prtlogger/PrintLog.java

@@ -0,0 +1,56 @@
+package com.epson.iprint.prtlogger;
+
+import androidx.annotation.Nullable;
+
+import java.io.File;
+import java.io.Serializable;
+
+public class PrintLog implements Serializable {
+    public static final int ACTION_COPY = 8196;
+    public static final int ACTION_EXTERNAL_APP_SCAN = 4353;
+    public static final int ACTION_ID_MEMORY_CARD_COPY_TO_MOBILE_DEVICE = 8194;
+    public static final int ACTION_ID_MEMORY_CARD_COPY_TO_PRINTER = 8193;
+    public static final int ACTION_PHOTO_TRANSFER = 8195;
+    public static final int ACTION_REPEAT_COPY = 8198;
+    public static final int ACTION_SCAN = 8197;
+    public static final int PREVIEW_TYPE_DOCUMENT = 2;
+    public static final int PREVIEW_TYPE_NOT_SET = 0;
+    public static final int PREVIEW_TYPE_PHOTO = 1;
+    public static final int PREVIEW_TYPE_WEB = 3;
+    public static final int PRINT_SOURCE_BOX = 259;
+    public static final int PRINT_SOURCE_CAMERACOPY = 5;
+    public static final int PRINT_SOURCE_DOCUMENT = 2;
+    public static final int PRINT_SOURCE_DROPBOX = 258;
+    public static final int PRINT_SOURCE_EVERNOTE = 256;
+    public static final int PRINT_SOURCE_EXTERNAL_APP_DOCUMENT = 4098;
+    public static final int PRINT_SOURCE_EXTERNAL_APP_PHOTO = 4097;
+    public static final int PRINT_SOURCE_EXTERNAL_APP_WEB = 4100;
+    public static final int PRINT_SOURCE_GOOGLEDRIVE = 257;
+    public static final int PRINT_SOURCE_MYPOCKET = 261;
+    public static final int PRINT_SOURCE_ONEDRIVE = 260;
+    public static final int PRINT_SOURCE_PHOTO = 1;
+    public static final int PRINT_SOURCE_SCAN_PRINT = 4;
+    public static final int PRINT_SOURCE_WEB = 3;
+    public String callerPackage;
+    public String originalFileExtension;
+    public int previewType;
+    public int uiRoute;
+
+    @Nullable
+    public static String getFileExtension(File file) {
+        String name = file.getName();
+        int lastIndexOf = name.lastIndexOf(46);
+        if (lastIndexOf < 0 || lastIndexOf >= name.length()) {
+            return null;
+        }
+        return name.substring(lastIndexOf + 1).toLowerCase();
+    }
+
+    @Nullable
+    public static String getFileExtension(String str) {
+        if (str == null) {
+            return null;
+        }
+        return getFileExtension(new File(str));
+    }
+}

+ 15 - 0
app/src/main/java/com/epson/lib/escani2/AdfCapability.java

@@ -0,0 +1,15 @@
+package com.epson.lib.escani2;
+
+import java.io.Serializable;
+
+public class AdfCapability implements Serializable {
+    public boolean cleaning;
+    public boolean crop;
+    public boolean doubleFeedDetectorLevel1;
+    public boolean doubleFeedDetectorLevel2;
+    public boolean duplex;
+    public boolean overscan;
+    public boolean paperEndDetector;
+    public boolean shadingDataCalibration;
+    public boolean skew;
+}

+ 476 - 0
app/src/main/java/com/epson/lib/escani2/EscanI2Lib.java

@@ -0,0 +1,476 @@
+package com.epson.lib.escani2;
+
+import com.epson.lib.escani2.EscanI2NativeInterface;
+import com.epson.lib.escani2.ScanSize;
+import java.util.ArrayList;
+import java.util.Locale;
+
+public class EscanI2Lib {
+    static final /* synthetic */ boolean $assertionsDisabled = false;
+    public static final int ERROR_CODE_COMM_ERROR = -214;
+    public static final int ERROR_CODE_COVER_OPEN = -215;
+    public static final int ERROR_CODE_DOUBLE_FEED = -211;
+    public static final int ERROR_CODE_ESCANI2_ERROR = -1000;
+    public static final int ERROR_CODE_FILE_WRITE_ERROR = -202;
+    public static final int ERROR_CODE_GENERAL_ERROR = -200;
+    public static final int ERROR_CODE_INTERNAL_ERROR = -100;
+    public static final int ERROR_CODE_JOB_CANCELED = 1;
+    public static final int ERROR_CODE_MEMORY_ALLOCATE_ERROR = -201;
+    public static final int ERROR_CODE_NO_ERROR = 0;
+    public static final int ERROR_CODE_PAPER_EMPTY = -210;
+    public static final int ERROR_CODE_PAPER_JAM = -212;
+    public static final int ERROR_CODE_SCANNER_OCCUPIED = -213;
+    private static final String LOG_TAG = "EscanI2Lib";
+    static EscanI2NativeInterface sEscanI2NativeInterface;
+    static EscanI2Lib sInstance;
+    int mDuplex;
+    private boolean mLibraryInitialized;
+    int mMaxScanSheets;
+    Observer mObserver;
+    final Object mObserverLock = new Object();
+    private boolean mScannerLocked;
+    private boolean mSetPaperSize;
+    private boolean mSetScannerDone;
+    volatile boolean mWaitStartRequest;
+    int marg_jpeg_quality;
+    int marg_over_scan;
+    int marg_threshold;
+    int mautoCtop;
+    int mautoSkew;
+    int mbufferSize;
+    ColorMode mcolorMode;
+    DoubleFeedLevel mdoubleFeedLevel;
+    int mheight;
+    ImageFormat mimageFormat;
+    InputUnit minputSource;
+    int mlookupTableNo;
+    int moffsetX;
+    int moffsetY;
+    int mresolutionMain;
+    int mresolutionSub;
+    Gamma muserGamma;
+    int mwidth;
+
+    public enum AutoCrop {
+        FALSE,
+        TRUE
+    }
+
+    public enum AutoSkew {
+        FALSE,
+        TRUE
+    }
+
+    public enum ColorMode {
+        MONO_1BIT,
+        GRAYSCALE_8BIT,
+        COLOR_24BIT
+    }
+
+    public enum Gamma {
+        GAMMA_100,
+        GAMMA_180
+    }
+
+    public enum ImageFormat {
+        JPG,
+        RAW
+    }
+
+    public enum InputUnit {
+        FLATBED,
+        ADF,
+        TRANSPARENT_UNIT
+    }
+
+    public interface Observer {
+        void update(int i, int i2);
+    }
+
+    public enum PagerGuidPosition {
+        CENTER,
+        UPPER_LEFT
+    }
+
+    private boolean checkResolution(int i, int i2) {
+        return i != 300 ? i == 600 && i2 == 600 : i2 == 300;
+    }
+
+    private boolean isDeviceChige() {
+        return false;
+    }
+
+    /* access modifiers changed from: package-private */
+    public int trunsErrorCode(int i, boolean z) {
+        if (i == -5007) {
+            return -211;
+        }
+        if (i == -1501) {
+            return -213;
+        }
+        if (i == -1114 || i == -1100) {
+            return -214;
+        }
+        switch (i) {
+            case -5003:
+                return z ? -210 : 0;
+            case -5002:
+                return -212;
+            case -5001:
+                return -215;
+            default:
+                switch (i) {
+                    case -102:
+                        return -202;
+                    case -101:
+                        return -201;
+                    default:
+                        return i;
+                }
+        }
+    }
+
+    public enum DoubleFeedLevel {
+        LEVEL_NONE(0),
+        LEVEL_1(1),
+        LEVEL_2(2),
+        LEVEL_UNDEFINED(255);
+        
+        private int mValue;
+
+        private DoubleFeedLevel(int i) {
+            this.mValue = i;
+        }
+
+        public int getValue() {
+            return this.mValue;
+        }
+    }
+
+    private EscanI2Lib() {
+    }
+
+    public static synchronized EscanI2Lib getInstance() {
+        EscanI2Lib escanI2Lib;
+        synchronized (EscanI2Lib.class) {
+            if (sEscanI2NativeInterface == null) {
+                sEscanI2NativeInterface = new EscanI2NativeIf();
+            }
+            if (sInstance == null) {
+                sInstance = new EscanI2Lib();
+            }
+            escanI2Lib = sInstance;
+        }
+        return escanI2Lib;
+    }
+
+    public static synchronized EscanI2Lib getInstance(EscanI2NativeInterface escanI2NativeInterface) {
+        EscanI2Lib escanI2Lib;
+        synchronized (EscanI2Lib.class) {
+            sEscanI2NativeInterface = escanI2NativeInterface;
+            if (sInstance == null) {
+                sInstance = new EscanI2Lib();
+            }
+            escanI2Lib = sInstance;
+        }
+        return escanI2Lib;
+    }
+
+    public synchronized int initializeLibrary() {
+        int initializeLibraryJni;
+        if (!this.mLibraryInitialized) {
+            this.mLibraryInitialized = false;
+            this.mSetScannerDone = false;
+            this.mScannerLocked = false;
+            this.mSetPaperSize = false;
+            initializeLibraryJni = sEscanI2NativeInterface.initializeLibraryJni();
+            if (initializeLibraryJni == 0) {
+                this.mLibraryInitialized = true;
+            }
+            sEscanI2NativeInterface.setPageWriteCallback(new EscanI2NativeInterface.PageWriteCallback() {
+                public void pageWriteDone(int i, int i2) {
+                    EscanI2Lib.this.updatePages(i, i2);
+                }
+            });
+        } else {
+            throw new RuntimeException("initializeLibrary() has already called.");
+        }
+        return initializeLibraryJni;
+    }
+
+    /* JADX WARNING: Can't wrap try/catch for region: R(8:10|11|12|13|22|21|8|7) */
+    /* JADX WARNING: Missing exception handler attribute for start block: B:7:0x0008 */
+    /* JADX WARNING: Removed duplicated region for block: B:7:0x0008 A[LOOP:0: B:7:0x0008->B:21:0x0008, LOOP_START, SYNTHETIC, Splitter:B:7:0x0008] */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    public synchronized int releaseLibrary() {
+        /*
+            r4 = this;
+            monitor-enter(r4)
+            boolean r0 = r4.mLibraryInitialized     // Catch:{ all -> 0x002b }
+            r1 = 0
+            if (r0 != 0) goto L_0x0008
+            monitor-exit(r4)
+            return r1
+        L_0x0008:
+            boolean r0 = r4.mWaitStartRequest     // Catch:{ all -> 0x002b }
+            if (r0 == 0) goto L_0x0015
+            r4.cancelWaiting()     // Catch:{ all -> 0x002b }
+            r2 = 100
+            java.lang.Thread.sleep(r2)     // Catch:{ InterruptedException -> 0x0008 }
+            goto L_0x0008
+        L_0x0015:
+            r4.releaseScanner()     // Catch:{ all -> 0x002b }
+            r4.mLibraryInitialized = r1     // Catch:{ all -> 0x002b }
+            r4.mSetScannerDone = r1     // Catch:{ all -> 0x002b }
+            r4.mScannerLocked = r1     // Catch:{ all -> 0x002b }
+            r4.mSetPaperSize = r1     // Catch:{ all -> 0x002b }
+            r0 = 0
+            r4.mObserver = r0     // Catch:{ all -> 0x002b }
+            com.epson.lib.escani2.EscanI2NativeInterface r0 = sEscanI2NativeInterface     // Catch:{ all -> 0x002b }
+            int r0 = r0.releaseLibraryJni()     // Catch:{ all -> 0x002b }
+            monitor-exit(r4)
+            return r0
+        L_0x002b:
+            r0 = move-exception
+            monitor-exit(r4)
+            throw r0
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.lib.escani2.EscanI2Lib.releaseLibrary():int");
+    }
+
+    public int NOT_setScanner(String str) {
+        return setScanner(str);
+    }
+
+    public synchronized int setScanner(String str) {
+        if (this.mLibraryInitialized) {
+            this.mSetScannerDone = true;
+        } else {
+            throw new RuntimeException("initializeLibrary() has not been called.");
+        }
+        return trunsErrorCode(sEscanI2NativeInterface.setScannerJni(str), false);
+    }
+
+    public int waitStartRequest() {
+        this.mWaitStartRequest = true;
+        int waitStartRequest = sEscanI2NativeInterface.waitStartRequest();
+        this.mWaitStartRequest = false;
+        return trunsErrorCode(waitStartRequest, false);
+    }
+
+    public int cancelWaiting() {
+        sEscanI2NativeInterface.cancelWaitingJni();
+        return 0;
+    }
+
+    public synchronized int setPaperSize(ScanSize.PaperSize paperSize, int i, int i2, boolean z) {
+        if (!this.mSetScannerDone) {
+            throw new RuntimeException("setScanner() has not been called.");
+        } else if (checkResolution(i, i2)) {
+            int[] iArr = ScanSize.get300DpiPixelFromPaperSize(paperSize);
+            int i3 = 2550;
+            if (i == 600) {
+                iArr[0] = iArr[0] * 2;
+                iArr[1] = iArr[1] * 2;
+                i3 = 5100;
+            }
+            if (!z) {
+                if (!isDeviceChige()) {
+                    this.moffsetX = (i3 - iArr[0]) / 2;
+                    this.moffsetY = 0;
+                    this.mwidth = iArr[0];
+                    this.mheight = iArr[1];
+                    this.mresolutionMain = i;
+                    this.mresolutionSub = i2;
+                }
+            }
+            this.moffsetX = 0;
+            this.moffsetY = 0;
+            this.mwidth = iArr[0];
+            this.mheight = iArr[1];
+            this.mresolutionMain = i;
+            this.mresolutionSub = i2;
+        } else {
+            throw new RuntimeException(String.format(Locale.US, "%dx%d dpi is not supported.", new Object[]{Integer.valueOf(i), Integer.valueOf(i2)}));
+        }
+        return 0;
+    }
+
+    public synchronized int startScan(AutoCrop autoCrop, AutoSkew autoSkew, ColorMode colorMode, Gamma gamma, int i, InputUnit inputUnit, int i2, int i3, boolean z, boolean z2, ImageFormat imageFormat, int i4, int i5, DoubleFeedLevel doubleFeedLevel) {
+        ImageFormat imageFormat2;
+        int trunsErrorCode;
+        synchronized (this) {
+            if (this.mLibraryInitialized) {
+                this.mautoCtop = autoCrop.ordinal();
+                this.mautoSkew = autoSkew.ordinal();
+                this.mcolorMode = colorMode;
+                this.muserGamma = gamma;
+                this.mlookupTableNo = i;
+                this.minputSource = inputUnit;
+                this.mMaxScanSheets = i2;
+                this.mDuplex = 0;
+                if (z) {
+                    this.mDuplex = 1;
+                }
+                this.marg_over_scan = 0;
+                if (!z2 || isDeviceChige()) {
+                    imageFormat2 = imageFormat;
+                } else {
+                    this.marg_over_scan = 1;
+                    imageFormat2 = imageFormat;
+                }
+                this.mimageFormat = imageFormat2;
+                this.marg_jpeg_quality = i4;
+                this.marg_threshold = i5;
+                this.mdoubleFeedLevel = doubleFeedLevel;
+                this.mbufferSize = 65536;
+                this.mScannerLocked = true;
+                trunsErrorCode = trunsErrorCode(sEscanI2NativeInterface.startScan(this.moffsetX, this.moffsetY, this.mwidth, this.mheight, this.mautoCtop, this.mautoSkew, this.mresolutionMain, this.mresolutionSub, this.mcolorMode.ordinal(), this.muserGamma.ordinal(), this.mlookupTableNo, this.minputSource.ordinal(), this.mDuplex > 0 ? this.mMaxScanSheets * 2 : this.mMaxScanSheets, i3, this.mDuplex, this.marg_over_scan, this.mimageFormat.ordinal(), this.marg_jpeg_quality, this.marg_threshold, this.mdoubleFeedLevel.getValue(), this.mbufferSize), true);
+            } else {
+                throw new RuntimeException("initializeLibrary() has not been called.");
+            }
+        }
+        return trunsErrorCode;
+    }
+
+    public synchronized int startScan(ScanI2Params scanI2Params, int i, int i2, int i3, int i4, ImageFormat imageFormat, int i5, int i6, int i7) {
+        int trunsErrorCode;
+        ScanI2Params scanI2Params2 = scanI2Params;
+        synchronized (this) {
+            int startScan = sEscanI2NativeInterface.startScan(i3, i4, i, i2, scanI2Params2.autoCrop.ordinal(), scanI2Params2.autoSkew.ordinal(), scanI2Params2.resolutionMain, scanI2Params2.resolutionSub, scanI2Params2.colorMode.ordinal(), scanI2Params2.userGamma.ordinal(), scanI2Params2.lookupTableNo, scanI2Params2.inputUnit.ordinal(), scanI2Params2.maxScanSheets, scanI2Params2.maxWriteSheets, scanI2Params2.duplex ? 1 : 0, scanI2Params2.overScan ? 1 : 0, imageFormat.ordinal(), i5, i6, scanI2Params2.doubleFeedLevel.getValue(), i7);
+            this.mScannerLocked = true;
+            trunsErrorCode = trunsErrorCode(startScan, true);
+        }
+        return trunsErrorCode;
+    }
+
+    /* JADX WARNING: Code restructure failed: missing block: B:13:0x0019, code lost:
+        return r0;
+     */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    public synchronized int releaseScanner() {
+        /*
+            r3 = this;
+            monitor-enter(r3)
+            boolean r0 = r3.mScannerLocked     // Catch:{ all -> 0x001a }
+            r1 = 0
+            if (r0 != 0) goto L_0x0008
+            monitor-exit(r3)
+            return r1
+        L_0x0008:
+            r3.mScannerLocked = r1     // Catch:{ all -> 0x001a }
+            com.epson.lib.escani2.EscanI2NativeInterface r0 = sEscanI2NativeInterface     // Catch:{ all -> 0x001a }
+            int r0 = r0.releaseScannerJni()     // Catch:{ all -> 0x001a }
+            int r0 = r3.trunsErrorCode(r0, r1)     // Catch:{ all -> 0x001a }
+            r2 = 1
+            if (r0 != r2) goto L_0x0018
+            r0 = 0
+        L_0x0018:
+            monitor-exit(r3)
+            return r0
+        L_0x001a:
+            r0 = move-exception
+            monitor-exit(r3)
+            throw r0
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.lib.escani2.EscanI2Lib.releaseScanner():int");
+    }
+
+    public void cancelScan() {
+        sEscanI2NativeInterface.cancelScanJni();
+    }
+
+    public int writeScanImage(int i, String str, String str2) {
+        if (!this.mScannerLocked) {
+            throw new RuntimeException("startScan() has not been called");
+        } else if (str == null) {
+            throw new IllegalArgumentException("outfile_fmt_a must not be null.");
+        } else if (this.mDuplex <= 0 || str2 != null) {
+            return trunsErrorCode(sEscanI2NativeInterface.scan(i, str, str2), false);
+        } else {
+            throw new IllegalArgumentException("outfile_fmt_b must not be null.");
+        }
+    }
+
+    public void setObserver(Observer observer) {
+        synchronized (this.mObserverLock) {
+            this.mObserver = observer;
+        }
+    }
+
+    public int getScanPages(int i) {
+        if (this.mLibraryInitialized) {
+            return sEscanI2NativeInterface.getScanPages(i);
+        }
+        throw new RuntimeException("initializeLibrary() has not been called.");
+    }
+
+    public int cleanAdf() {
+        return trunsErrorCode(sEscanI2NativeInterface.cleanAdf(), true);
+    }
+
+    public int freeBlockedCleanAdf() {
+        return trunsErrorCode(sEscanI2NativeInterface.freeBlockedCleanAdf(), false);
+    }
+
+    public int calibrateAdf() {
+        return trunsErrorCode(sEscanI2NativeInterface.calibrateAdf(), true);
+    }
+
+    public int freeBlockedCalibrateAdf() {
+        return trunsErrorCode(sEscanI2NativeInterface.freeBlockedCalibrateAdf(), false);
+    }
+
+    public int setPowerSaveTime(int i) {
+        return trunsErrorCode(sEscanI2NativeInterface.setPowerSaveTime(i), false);
+    }
+
+    public int setPowerOffTime(int i) {
+        return trunsErrorCode(sEscanI2NativeInterface.setPowerOffTime(i), false);
+    }
+
+    public int getMaintAppliedParameters(int[] iArr) {
+        int[] maintAppliedParameters = sEscanI2NativeInterface.getMaintAppliedParameters();
+        if (maintAppliedParameters == null) {
+            return -100;
+        }
+        iArr[0] = maintAppliedParameters[0];
+        iArr[1] = maintAppliedParameters[1];
+        return 0;
+    }
+
+    public int getMaintCapability(ArrayList<Integer> arrayList, ArrayList<Integer> arrayList2) {
+        int[] maintCapability = sEscanI2NativeInterface.getMaintCapability();
+        boolean z = false;
+        for (int i : maintCapability) {
+            if (i == -1) {
+                z = true;
+            } else if (!z) {
+                arrayList.add(Integer.valueOf(i));
+            } else {
+                arrayList2.add(Integer.valueOf(i));
+            }
+        }
+        if (maintCapability == null) {
+            return -100;
+        }
+        return 0;
+    }
+
+    public int getScannerInfo(ScannerI2Info scannerI2Info) {
+        return sEscanI2NativeInterface.getScannerInfo(scannerI2Info);
+    }
+
+    public int getCapability(ScannerI2Capability scannerI2Capability) {
+        return sEscanI2NativeInterface.getCapability(scannerI2Capability);
+    }
+
+    /* access modifiers changed from: package-private */
+    public void updatePages(int i, int i2) {
+        synchronized (this.mObserverLock) {
+            if (this.mObserver != null) {
+                this.mObserver.update(i, i2);
+            }
+        }
+    }
+}

+ 70 - 0
app/src/main/java/com/epson/lib/escani2/EscanI2NativeIf.java

@@ -0,0 +1,70 @@
+package com.epson.lib.escani2;
+
+import com.epson.lib.escani2.EscanI2NativeInterface;
+
+class EscanI2NativeIf implements EscanI2NativeInterface {
+    private long mNativeInscance;
+    EscanI2NativeInterface.PageWriteCallback mPageWriteCallback;
+
+    public native int calibrateAdf();
+
+    public native void cancelScanJni();
+
+    public native void cancelWaitingJni();
+
+    public native int cleanAdf();
+
+    public native int freeBlockedCalibrateAdf();
+
+    public native int freeBlockedCleanAdf();
+
+    public native int getCapability(ScannerI2Capability scannerI2Capability);
+
+    public int getEscanI2LibError() {
+        return 0;
+    }
+
+    public native int[] getMaintAppliedParameters();
+
+    public native int[] getMaintCapability();
+
+    public native int getScanPages(int i);
+
+    public native int getScannerInfo(ScannerI2Info scannerI2Info);
+
+    public native int initializeLibraryJni();
+
+    public native int releaseLibraryJni();
+
+    public native int releaseScannerJni();
+
+    public native int scan(int i, String str, String str2);
+
+    public native int setPowerOffTime(int i);
+
+    public native int setPowerSaveTime(int i);
+
+    public native int setScannerJni(String str);
+
+    public native int startScan(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15, int i16, int i17, int i18, int i19, int i20, int i21);
+
+    public native int waitStartRequest();
+
+    EscanI2NativeIf() {
+    }
+
+    static {
+        System.loadLibrary("escani2");
+    }
+
+    private synchronized int pageWriteEndCallback(int i, int i2) {
+        if (this.mPageWriteCallback != null) {
+            this.mPageWriteCallback.pageWriteDone(i, i2);
+        }
+        return 1;
+    }
+
+    public synchronized void setPageWriteCallback(EscanI2NativeInterface.PageWriteCallback pageWriteCallback) {
+        this.mPageWriteCallback = pageWriteCallback;
+    }
+}

+ 52 - 0
app/src/main/java/com/epson/lib/escani2/EscanI2NativeInterface.java

@@ -0,0 +1,52 @@
+package com.epson.lib.escani2;
+
+public interface EscanI2NativeInterface {
+
+    public interface PageWriteCallback {
+        void pageWriteDone(int i, int i2);
+    }
+
+    int calibrateAdf();
+
+    void cancelScanJni();
+
+    void cancelWaitingJni();
+
+    int cleanAdf();
+
+    int freeBlockedCalibrateAdf();
+
+    int freeBlockedCleanAdf();
+
+    int getCapability(ScannerI2Capability scannerI2Capability);
+
+    int getEscanI2LibError();
+
+    int[] getMaintAppliedParameters();
+
+    int[] getMaintCapability();
+
+    int getScanPages(int i);
+
+    int getScannerInfo(ScannerI2Info scannerI2Info);
+
+    int initializeLibraryJni();
+
+    int releaseLibraryJni();
+
+    int releaseScannerJni();
+
+    int scan(int i, String str, String str2);
+
+    void setPageWriteCallback(PageWriteCallback pageWriteCallback);
+
+    int setPowerOffTime(int i);
+
+    int setPowerSaveTime(int i);
+
+    int setScannerJni(String str);
+
+    int startScan(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15, int i16, int i17, int i18, int i19, int i20, int i21);
+
+    int waitStartRequest();
+}

+ 7 - 0
app/src/main/java/com/epson/lib/escani2/FlatbedCapability.java

@@ -0,0 +1,7 @@
+package com.epson.lib.escani2;
+
+import java.io.Serializable;
+
+public class FlatbedCapability implements Serializable {
+    public boolean overscan;
+}

+ 32 - 0
app/src/main/java/com/epson/lib/escani2/I2LibScannerInfoAndCapability.java

@@ -0,0 +1,32 @@
+package com.epson.lib.escani2;
+
+import com.epson.lib.escani2.EscanI2Lib;
+import java.io.Serializable;
+
+public class I2LibScannerInfoAndCapability implements Serializable {
+    public ScannerI2Capability scannerI2Capability = new ScannerI2Capability();
+    public ScannerI2Info scannerI2Info = new ScannerI2Info();
+
+    public boolean isAdfAvailable() {
+        return this.scannerI2Info.adfInstalled;
+    }
+
+    public boolean isFlatbedAvailable() {
+        return this.scannerI2Info.flatbedInstalled;
+    }
+
+    public int getAlignment(EscanI2Lib.InputUnit inputUnit) {
+        return this.scannerI2Info.getAlignment(inputUnit);
+    }
+
+    public int[] getSensorSize(EscanI2Lib.InputUnit inputUnit) {
+        return this.scannerI2Info.getSensorSize(inputUnit);
+    }
+
+    public boolean canDoubleSideScan() {
+        if (!isAdfAvailable()) {
+            return false;
+        }
+        return this.scannerI2Capability.adfCapability.duplex;
+    }
+}

+ 35 - 0
app/src/main/java/com/epson/lib/escani2/ScanI2Params.java

@@ -0,0 +1,35 @@
+package com.epson.lib.escani2;
+
+import com.epson.lib.escani2.EscanI2Lib;
+import java.io.Serializable;
+
+public class ScanI2Params implements Serializable, Cloneable {
+    public EscanI2Lib.AutoCrop autoCrop;
+    public EscanI2Lib.AutoSkew autoSkew;
+    public EscanI2Lib.ColorMode colorMode;
+    public int density;
+    public boolean densityChangeable;
+    public EscanI2Lib.DoubleFeedLevel doubleFeedLevel;
+    public boolean duplex;
+    public int duplexTurnDirection;
+    public EscanI2Lib.InputUnit inputUnit;
+    public int lookupTableNo;
+    public int manualAdfAlignment;
+    public int maxScanSheets;
+    public int maxWriteSheets;
+    public boolean overScan;
+    public int qualityHW;
+    public int qualitySW;
+    public int resolutionMain;
+    public int resolutionSub;
+    public ScanSize scanSize;
+    public EscanI2Lib.Gamma userGamma;
+
+    public ScanI2Params clone() {
+        try {
+            return (ScanI2Params) super.clone();
+        } catch (CloneNotSupportedException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

+ 45 - 0
app/src/main/java/com/epson/lib/escani2/ScanI2PropertyTaker.java

@@ -0,0 +1,45 @@
+package com.epson.lib.escani2;
+
+public class ScanI2PropertyTaker {
+    private int mEscanI2LibError = 0;
+
+    public I2LibScannerInfoAndCapability getScannerInfoAndCapability(String str) {
+        if (str == null || str.isEmpty()) {
+            throw new IllegalArgumentException("ipAddress error");
+        }
+        I2LibScannerInfoAndCapability i2LibScannerInfoAndCapability = new I2LibScannerInfoAndCapability();
+        EscanI2Lib instance = EscanI2Lib.getInstance();
+        int initializeLibrary = instance.initializeLibrary();
+        if (initializeLibrary != 0) {
+            this.mEscanI2LibError = initializeLibrary;
+            return null;
+        }
+        try {
+            int scanner = instance.setScanner(str);
+            if (scanner != 0) {
+                this.mEscanI2LibError = scanner;
+                return null;
+            }
+            int scannerInfo = instance.getScannerInfo(i2LibScannerInfoAndCapability.scannerI2Info);
+            if (scannerInfo != 0) {
+                this.mEscanI2LibError = scannerInfo;
+                instance.releaseLibrary();
+                return null;
+            }
+            int capability = instance.getCapability(i2LibScannerInfoAndCapability.scannerI2Capability);
+            if (capability != 0) {
+                this.mEscanI2LibError = capability;
+                instance.releaseLibrary();
+                return null;
+            }
+            instance.releaseLibrary();
+            return i2LibScannerInfoAndCapability;
+        } finally {
+            instance.releaseLibrary();
+        }
+    }
+
+    public int getEscanI2LibError() {
+        return this.mEscanI2LibError;
+    }
+}

+ 222 - 0
app/src/main/java/com/epson/lib/escani2/ScanI2Runner.java

@@ -0,0 +1,222 @@
+package com.epson.lib.escani2;
+
+public class ScanI2Runner {
+    private static final String LOG_TAG = "ScanI2Runner";
+    private volatile boolean mCancelScan;
+    private EscanI2Lib mEscanI2Lib;
+    private int[] mScanPages;
+
+    public int[] getScanPages() {
+        return this.mScanPages;
+    }
+
+    public boolean isCancelScan() {
+        return this.mCancelScan;
+    }
+
+    private void setCancelScan(boolean z) {
+        this.mCancelScan = z;
+    }
+
+    public ScanI2Runner() {
+        this.mScanPages = new int[2];
+        this.mEscanI2Lib = EscanI2Lib.getInstance();
+        this.mCancelScan = false;
+    }
+
+    public ScanI2Runner(EscanI2Lib escanI2Lib) {
+        this.mScanPages = new int[2];
+        throw new UnsupportedOperationException("ScanI2Runner(EscanI2Lib) is test only.");
+    }
+
+    public void cancelScan() {
+        setCancelScan(true);
+        EscanI2Lib escanI2Lib = this.mEscanI2Lib;
+        if (escanI2Lib != null) {
+            escanI2Lib.cancelScan();
+        }
+    }
+
+    /* JADX WARNING: Removed duplicated region for block: B:63:0x0122  */
+    /* JADX WARNING: Removed duplicated region for block: B:70:0x0137  */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    public int doScan(java.lang.String r17, com.epson.lib.escani2.ScanI2Params r18, java.lang.String[] r19, com.epson.lib.escani2.EscanI2Lib.Observer r20) {
+        /*
+            r16 = this;
+            r1 = r16
+            r0 = r17
+            r12 = r18
+            if (r0 == 0) goto L_0x0147
+            boolean r2 = r17.isEmpty()
+            if (r2 == 0) goto L_0x0010
+            goto L_0x0147
+        L_0x0010:
+            r13 = 1
+            r14 = 0
+            r15 = 0
+            int[] r2 = r1.mScanPages     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            r2[r15] = r15     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            int[] r2 = r1.mScanPages     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            r2[r13] = r15     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            int r2 = r2.initializeLibrary()     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            if (r2 == 0) goto L_0x002e
+            com.epson.lib.escani2.EscanI2Lib r0 = r1.mEscanI2Lib
+            r0.releaseLibrary()
+            com.epson.lib.escani2.EscanI2Lib r0 = r1.mEscanI2Lib
+            r0.setObserver(r14)
+            return r2
+        L_0x002e:
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            int r0 = r2.setScanner(r0)     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            if (r0 == 0) goto L_0x0041
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib
+            r2.releaseLibrary()
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib
+            r2.setObserver(r14)
+            return r0
+        L_0x0041:
+            com.epson.lib.escani2.EscanI2Lib r0 = r1.mEscanI2Lib     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            r2 = r20
+            r0.setObserver(r2)     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            com.epson.lib.escani2.EscanI2Lib$ImageFormat r8 = com.epson.lib.escani2.EscanI2Lib.ImageFormat.JPG     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            int r0 = r12.qualityHW     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            if (r0 != 0) goto L_0x0053
+            r0 = 90
+            r9 = 90
+            goto L_0x0056
+        L_0x0053:
+            int r0 = r12.qualityHW     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            r9 = r0
+        L_0x0056:
+            r10 = 128(0x80, float:1.794E-43)
+            r11 = 65536(0x10000, float:9.18355E-41)
+            boolean r0 = r16.isCancelScan()     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            if (r0 == 0) goto L_0x006b
+            com.epson.lib.escani2.EscanI2Lib r0 = r1.mEscanI2Lib
+            r0.releaseLibrary()
+            com.epson.lib.escani2.EscanI2Lib r0 = r1.mEscanI2Lib
+            r0.setObserver(r14)
+            return r15
+        L_0x006b:
+            com.epson.lib.escani2.ScannerI2Info r0 = new com.epson.lib.escani2.ScannerI2Info     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            r0.<init>()     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            int r2 = r2.getScannerInfo(r0)     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            if (r2 == 0) goto L_0x0083
+            com.epson.lib.escani2.EscanI2Lib r0 = r1.mEscanI2Lib
+            r0.releaseLibrary()
+            com.epson.lib.escani2.EscanI2Lib r0 = r1.mEscanI2Lib
+            r0.setObserver(r14)
+            return r2
+        L_0x0083:
+            com.epson.lib.escani2.ScanSize r2 = r12.scanSize     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            int[] r0 = r2.getValidScanSize(r0, r12)     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            if (r0 != 0) goto L_0x0096
+            com.epson.lib.escani2.EscanI2Lib r0 = r1.mEscanI2Lib
+            r0.releaseLibrary()
+            com.epson.lib.escani2.EscanI2Lib r0 = r1.mEscanI2Lib
+            r0.setObserver(r14)
+            return r15
+        L_0x0096:
+            boolean r2 = r16.isCancelScan()     // Catch:{ Throwable -> 0x0132, all -> 0x011e }
+            if (r2 == 0) goto L_0x00a7
+            com.epson.lib.escani2.EscanI2Lib r0 = r1.mEscanI2Lib
+            r0.releaseLibrary()
+            com.epson.lib.escani2.EscanI2Lib r0 = r1.mEscanI2Lib
+            r0.setObserver(r14)
+            return r15
+        L_0x00a7:
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            r4 = r0[r15]     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            r5 = r0[r13]     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            r3 = 2
+            r6 = r0[r3]     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            r3 = 3
+            r7 = r0[r3]     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            r3 = r18
+            int r0 = r2.startScan(r3, r4, r5, r6, r7, r8, r9, r10, r11)     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            if (r0 == 0) goto L_0x00cb
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib
+            r2.releaseScanner()
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib
+            r2.releaseLibrary()
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib
+            r2.setObserver(r14)
+            return r0
+        L_0x00cb:
+            r0 = r19[r15]     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            boolean r2 = r12.duplex     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            if (r2 == 0) goto L_0x00d4
+            r2 = r19[r13]     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            goto L_0x00d5
+        L_0x00d4:
+            r2 = r14
+        L_0x00d5:
+            boolean r3 = r16.isCancelScan()     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            if (r3 == 0) goto L_0x00f0
+            com.epson.lib.escani2.EscanI2Lib r0 = r1.mEscanI2Lib     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            r0.releaseScanner()     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            com.epson.lib.escani2.EscanI2Lib r0 = r1.mEscanI2Lib
+            r0.releaseScanner()
+            com.epson.lib.escani2.EscanI2Lib r0 = r1.mEscanI2Lib
+            r0.releaseLibrary()
+            com.epson.lib.escani2.EscanI2Lib r0 = r1.mEscanI2Lib
+            r0.setObserver(r14)
+            return r15
+        L_0x00f0:
+            com.epson.lib.escani2.EscanI2Lib r3 = r1.mEscanI2Lib     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            int r0 = r3.writeScanImage(r15, r0, r2)     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            int[] r2 = r1.mScanPages     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            com.epson.lib.escani2.EscanI2Lib r3 = r1.mEscanI2Lib     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            int r3 = r3.getScanPages(r15)     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            r2[r15] = r3     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            int[] r2 = r1.mScanPages     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            com.epson.lib.escani2.EscanI2Lib r3 = r1.mEscanI2Lib     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            int r3 = r3.getScanPages(r13)     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            r2[r13] = r3     // Catch:{ Throwable -> 0x011c, all -> 0x011a }
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib
+            r2.releaseScanner()
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib
+            r2.releaseLibrary()
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib
+            r2.setObserver(r14)
+            return r0
+        L_0x011a:
+            r0 = move-exception
+            goto L_0x0120
+        L_0x011c:
+            goto L_0x0133
+        L_0x011e:
+            r0 = move-exception
+            r13 = 0
+        L_0x0120:
+            if (r13 == 0) goto L_0x0127
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib
+            r2.releaseScanner()
+        L_0x0127:
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib
+            r2.releaseLibrary()
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib
+            r2.setObserver(r14)
+            throw r0
+        L_0x0132:
+            r13 = 0
+        L_0x0133:
+            r0 = -200(0xffffffffffffff38, float:NaN)
+            if (r13 == 0) goto L_0x013c
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib
+            r2.releaseScanner()
+        L_0x013c:
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib
+            r2.releaseLibrary()
+            com.epson.lib.escani2.EscanI2Lib r2 = r1.mEscanI2Lib
+            r2.setObserver(r14)
+            return r0
+        L_0x0147:
+            r0 = -214(0xffffffffffffff2a, float:NaN)
+            return r0
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.lib.escani2.ScanI2Runner.doScan(java.lang.String, com.epson.lib.escani2.ScanI2Params, java.lang.String[], com.epson.lib.escani2.EscanI2Lib$Observer):int");
+    }
+}

+ 264 - 0
app/src/main/java/com/epson/lib/escani2/ScanSize.java

@@ -0,0 +1,264 @@
+package com.epson.lib.escani2;
+
+import android.support.annotation.NonNull;
+import android.support.annotation.VisibleForTesting;
+import com.epson.lib.escani2.EscanI2Lib;
+import epson.scan.i2lib.I2ScanParamArbiter;
+import epson.scan.lib.ScanSizeHelper;
+import java.io.Serializable;
+
+public class ScanSize implements Serializable {
+    private int mOffsetX;
+    private int mOffsetY;
+    private int mPixelHeight;
+    private int mPixelWidth;
+    private boolean mPortrait;
+    private PaperSize mSizeType;
+
+    public enum PaperSize {
+        A4,
+        LETTER,
+        LEGAL,
+        B5,
+        B6,
+        A5,
+        A6,
+        A8,
+        MEISHI,
+        PCARD,
+        AUTO,
+        A3,
+        MAX,
+        PIXEL
+    }
+
+    private static int getI2AlignmentValue(int i) {
+        return i != 1 ? 2 : 1;
+    }
+
+    static int[] get300DpiPixelFromPaperSize(PaperSize paperSize) {
+        switch (paperSize) {
+            case A3:
+                return new int[]{3507, 4959};
+            case A4:
+                return new int[]{2480, 3507};
+            case LETTER:
+                return new int[]{2550, 3300};
+            case LEGAL:
+                return new int[]{2550, 4200};
+            case B5:
+                return new int[]{2149, 3035};
+            case B6:
+                return new int[]{1512, 2150};
+            case A5:
+                return new int[]{1748, 2480};
+            case A6:
+                return new int[]{1240, 1748};
+            case A8:
+                return new int[]{615, 874};
+            case MEISHI:
+                return new int[]{1051, 650};
+            case PCARD:
+                return new int[]{1011, 638};
+            case AUTO:
+                return new int[]{2550, 4200};
+            default:
+                return new int[]{-1, -1};
+        }
+    }
+
+    public ScanSize(PaperSize paperSize, boolean z) {
+        this.mSizeType = paperSize;
+        this.mPortrait = z;
+    }
+
+    public ScanSize(int i, int i2, int i3, int i4) {
+        this.mSizeType = PaperSize.PIXEL;
+        this.mPixelWidth = i;
+        this.mPixelHeight = i2;
+        this.mOffsetX = i3;
+        this.mOffsetY = i4;
+        this.mPortrait = true;
+    }
+
+    public boolean equals(Object obj) {
+        if (obj == null || !(obj instanceof ScanSize)) {
+            return false;
+        }
+        ScanSize scanSize = (ScanSize) obj;
+        if (!this.mSizeType.equals(scanSize.mSizeType)) {
+            return false;
+        }
+        switch (this.mSizeType) {
+            case PIXEL:
+                if (this.mPixelWidth == scanSize.mPixelWidth && this.mPixelHeight == scanSize.mPixelHeight && this.mOffsetX == scanSize.mOffsetX && this.mOffsetY == scanSize.mOffsetY) {
+                    return true;
+                }
+                return false;
+            case MAX:
+                return true;
+            default:
+                return this.mPortrait;
+        }
+    }
+
+    public int hashCode() {
+        if (this.mSizeType == PaperSize.PIXEL) {
+            return (((((((this.mSizeType.hashCode() * 31) + this.mPixelWidth) * 31) + this.mPixelHeight) * 31) + this.mOffsetX) * 31) + this.mOffsetY;
+        }
+        return this.mSizeType.hashCode();
+    }
+
+    public PaperSize getSize() {
+        return this.mSizeType;
+    }
+
+    public boolean isPixelSize() {
+        return this.mSizeType == PaperSize.PIXEL;
+    }
+
+    public int[] getValidScanSize(ScannerI2Info scannerI2Info, ScanI2Params scanI2Params) {
+        int[] validScanSizeInternal = getValidScanSizeInternal(scannerI2Info, scanI2Params);
+        if (validScanSizeInternal == null) {
+            return null;
+        }
+        return adjustSizeFromScannerInfo(validScanSizeInternal, scannerI2Info, scanI2Params);
+    }
+
+    /* access modifiers changed from: package-private */
+    @VisibleForTesting
+    public int[] adjustSizeFromScannerInfo(@NonNull int[] iArr, @NonNull ScannerI2Info scannerI2Info, @NonNull ScanI2Params scanI2Params) {
+        int[] sensorPixelSize = scannerI2Info.getSensorPixelSize(scanI2Params.inputUnit, scanI2Params.resolutionMain, scanI2Params.resolutionSub);
+        if (iArr[0] > sensorPixelSize[0]) {
+            iArr[0] = sensorPixelSize[0];
+        }
+        int i = (iArr[0] + iArr[2]) - sensorPixelSize[0];
+        if (i > 0) {
+            iArr[2] = iArr[2] - i;
+        }
+        if (iArr[1] > sensorPixelSize[1]) {
+            iArr[1] = sensorPixelSize[1];
+        }
+        int i2 = (iArr[1] + iArr[3]) - sensorPixelSize[1];
+        if (i2 > 0) {
+            iArr[3] = iArr[3] - i2;
+        }
+        return iArr;
+    }
+
+    /* access modifiers changed from: package-private */
+    @VisibleForTesting
+    public int[] getValidScanSizeInternal(ScannerI2Info scannerI2Info, ScanI2Params scanI2Params) {
+        if (scannerI2Info.isAdfAlignmentInvalid()) {
+            scannerI2Info.adfAlignment = getI2AlignmentValue(scanI2Params.manualAdfAlignment);
+        }
+        if (!isPixelSize()) {
+            return getSize(scannerI2Info, scanI2Params);
+        }
+        if (scanI2Params.inputUnit != EscanI2Lib.InputUnit.ADF) {
+            return getLeftAlignPixelSizeValidScanSize(scannerI2Info, scanI2Params);
+        }
+        if (scannerI2Info.adfAlignment == 1) {
+            return getCenterAlignPixelSizeValidScanSize(scannerI2Info, scanI2Params);
+        }
+        return getLeftAlignPixelSizeValidScanSize(scannerI2Info, scanI2Params);
+    }
+
+    private int[] getCenterAlignPixelSizeValidScanSize(ScannerI2Info scannerI2Info, ScanI2Params scanI2Params) {
+        int[] size = getSize(scannerI2Info, scanI2Params);
+        size[2] = 0;
+        size[3] = 0;
+        int[] sensorPixelSize = scannerI2Info.getSensorPixelSize(scanI2Params.inputUnit, scanI2Params.resolutionMain, scanI2Params.resolutionSub);
+        if (size[0] > sensorPixelSize[0]) {
+            size[0] = sensorPixelSize[0];
+        } else {
+            size[2] = (sensorPixelSize[0] - size[0]) / 2;
+        }
+        if (size[1] > sensorPixelSize[1]) {
+            size[1] = sensorPixelSize[1];
+        }
+        return size;
+    }
+
+    private int[] getLeftAlignPixelSizeValidScanSize(ScannerI2Info scannerI2Info, ScanI2Params scanI2Params) {
+        int[] size = getSize(scannerI2Info, scanI2Params);
+        int[] sensorPixelSize = scannerI2Info.getSensorPixelSize(scanI2Params.inputUnit, scanI2Params.resolutionMain, scanI2Params.resolutionSub);
+        if (size[0] + size[2] <= 0 || size[1] + size[3] <= 0 || size[2] >= sensorPixelSize[0] || size[3] >= sensorPixelSize[1]) {
+            return null;
+        }
+        if (size[2] < 0) {
+            size[0] = size[2] + size[0];
+            size[2] = 0;
+        }
+        size[0] = size[0] + size[2] >= sensorPixelSize[0] ? sensorPixelSize[0] - size[2] : size[0];
+        if (size[3] < 0) {
+            size[1] = size[3] + size[1];
+            size[3] = 0;
+        }
+        size[1] = size[1] + size[3] >= sensorPixelSize[1] ? sensorPixelSize[1] - size[3] : size[1];
+        return size;
+    }
+
+    public int[] getSize(ScannerI2Info scannerI2Info, ScanI2Params scanI2Params) {
+        return getSize(scannerI2Info, scanI2Params.inputUnit, scanI2Params.resolutionMain, scanI2Params.resolutionSub);
+    }
+
+    /* access modifiers changed from: package-private */
+    public int[] getSize(ScannerI2Info scannerI2Info, EscanI2Lib.InputUnit inputUnit, int i, int i2) {
+        int[] pixel = getPixel(scannerI2Info, inputUnit, i, i2);
+        int[] offset = getOffset(scannerI2Info, inputUnit, i, i2);
+        return new int[]{pixel[0], pixel[1], offset[0], offset[1]};
+    }
+
+    /* access modifiers changed from: package-private */
+    public int[] getPixel(ScannerI2Info scannerI2Info, EscanI2Lib.InputUnit inputUnit, int i, int i2) {
+        if (this.mSizeType == PaperSize.MAX) {
+            return scannerI2Info.getSensorPixelSize(inputUnit, i, i2);
+        }
+        if (this.mSizeType == PaperSize.PIXEL) {
+            return new int[]{this.mPixelWidth, this.mPixelHeight};
+        }
+        int[] iArr = get300DpiPixelFromPaperSize(this.mSizeType);
+        if (!this.mPortrait) {
+            int i3 = iArr[0];
+            iArr[0] = iArr[1];
+            iArr[1] = i3;
+        }
+        if (i != 300) {
+            iArr[0] = (int) ((((double) iArr[0]) * ((double) i)) / ((double) 300));
+        }
+        if (i2 != 300) {
+            iArr[1] = (int) ((((double) iArr[1]) * ((double) i2)) / ((double) 300));
+        }
+        return iArr;
+    }
+
+    /* access modifiers changed from: package-private */
+    public int[] getOffset(ScannerI2Info scannerI2Info, EscanI2Lib.InputUnit inputUnit, int i, int i2) {
+        if (this.mSizeType == PaperSize.PIXEL) {
+            return new int[]{this.mOffsetX, this.mOffsetY};
+        } else if (this.mSizeType == PaperSize.MAX) {
+            return new int[]{0, 0};
+        } else {
+            int[] iArr = {0, 0};
+            iArr[0] = calcOffset(scannerI2Info.getAlignment(inputUnit), getPixel(scannerI2Info, inputUnit, i, i2)[0], (int) Math.round((((double) scannerI2Info.getSensorSize(inputUnit)[0]) * ((double) i)) / ((double) scannerI2Info.getSensorSizeBaseResolution())));
+            return iArr;
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public int calcOffset(int i, int i2, int i3) {
+        switch (i) {
+            case 1:
+                return (i3 - i2) / 2;
+            case 2:
+                return i3 - i2;
+            default:
+                return 0;
+        }
+    }
+
+    public static ScanSize getLocaleDefaultSize() {
+        return I2ScanParamArbiter.getI2ScanSize(ScanSizeHelper.getDefaultScanSize());
+    }
+}

+ 10 - 0
app/src/main/java/com/epson/lib/escani2/ScannerI2Capability.java

@@ -0,0 +1,10 @@
+package com.epson.lib.escani2;
+
+import java.io.Serializable;
+
+public class ScannerI2Capability implements Serializable {
+    public AdfCapability adfCapability;
+    public FlatbedCapability flatbedCapability;
+    public int[] mainScanResolutions;
+    public int[] subScanResolutions;
+}

+ 71 - 0
app/src/main/java/com/epson/lib/escani2/ScannerI2Info.java

@@ -0,0 +1,71 @@
+package com.epson.lib.escani2;
+
+import com.epson.lib.escani2.EscanI2Lib;
+import java.io.Serializable;
+
+public class ScannerI2Info implements Serializable {
+    public static final int ALIGNMENT_UNDEFINED = 255;
+    public int adfAlignment;
+    public int adfDuplexType;
+    public boolean adfInstalled;
+    public int adfSensorHeight;
+    public int adfSensorWidth;
+    public int adfType;
+    public int flatbedAlignment;
+    public boolean flatbedInstalled;
+    public int flatbedSensorHeight;
+    public int flatbedSensorWidth;
+    public int imageSensorHeight;
+    public int imageSensorWidth;
+    public String productName;
+
+    public int getSensorSizeBaseResolution() {
+        return 100;
+    }
+
+    public int getAlignment(EscanI2Lib.InputUnit inputUnit) {
+        switch (inputUnit) {
+            case ADF:
+                if (!this.adfInstalled) {
+                    return 255;
+                }
+                return this.adfAlignment;
+            case FLATBED:
+                if (!this.flatbedInstalled) {
+                    return 255;
+                }
+                return this.flatbedAlignment;
+            default:
+                return 255;
+        }
+    }
+
+    public int[] getSensorPixelSize(EscanI2Lib.InputUnit inputUnit, int i, int i2) {
+        int[] sensorSize = getSensorSize(inputUnit);
+        int sensorSizeBaseResolution = getSensorSizeBaseResolution();
+        if (i != sensorSizeBaseResolution) {
+            sensorSize[0] = (int) ((((double) sensorSize[0]) * ((double) i)) / ((double) sensorSizeBaseResolution));
+        }
+        if (i2 != sensorSizeBaseResolution) {
+            sensorSize[1] = (int) ((((double) sensorSize[1]) * ((double) i2)) / ((double) sensorSizeBaseResolution));
+        }
+        return sensorSize;
+    }
+
+    public int[] getSensorSize(EscanI2Lib.InputUnit inputUnit) {
+        if (C09741.$SwitchMap$com$epson$lib$escani2$EscanI2Lib$InputUnit[inputUnit.ordinal()] != 1) {
+            if (!this.flatbedInstalled) {
+                return null;
+            }
+            return new int[]{this.flatbedSensorWidth, this.flatbedSensorHeight};
+        } else if (!this.adfInstalled) {
+            return null;
+        } else {
+            return new int[]{this.adfSensorWidth, this.adfSensorHeight};
+        }
+    }
+
+    public boolean isAdfAlignmentInvalid() {
+        return this.adfAlignment == 255;
+    }
+}

+ 44 - 0
app/src/main/java/com/epson/memcardacc/AltAlertDialogFragment.java

@@ -0,0 +1,44 @@
+package com.epson.memcardacc;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.support.p000v4.app.DialogFragment;
+import epson.print.C2135R;
+
+public class AltAlertDialogFragment extends DialogFragment {
+    private static final String ARG_MESSAGE = "message";
+    private static final String ARG_MESSAGE_STR = "message_string";
+    private static final String ARG_TITLE = "title";
+
+    public interface DialogCallback {
+        void onPositiveCallback();
+    }
+
+    public static AltAlertDialogFragment newInstance(String str, String str2) {
+        AltAlertDialogFragment altAlertDialogFragment = new AltAlertDialogFragment();
+        Bundle bundle = new Bundle();
+        if (str != null) {
+            bundle.putString(ARG_TITLE, str);
+        }
+        bundle.putString(ARG_MESSAGE_STR, str2);
+        altAlertDialogFragment.setArguments(bundle);
+        return altAlertDialogFragment;
+    }
+
+    public Dialog onCreateDialog(Bundle bundle) {
+        Bundle arguments = getArguments();
+        String string = arguments.getString(ARG_TITLE);
+        AlertDialog create = new AlertDialog.Builder(getActivity()).setMessage(arguments.getString(ARG_MESSAGE_STR)).setCancelable(false).setPositiveButton(C2135R.string.str_btn_close, new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialogInterface, int i) {
+                ((DialogCallback) AltAlertDialogFragment.this.getActivity()).onPositiveCallback();
+            }
+        }).create();
+        if (string != null) {
+            create.setTitle(string);
+        }
+        create.setCanceledOnTouchOutside(false);
+        return create;
+    }
+}

+ 150 - 0
app/src/main/java/com/epson/memcardacc/AltViewImageAdapter.java

@@ -0,0 +1,150 @@
+package com.epson.memcardacc;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.drawable.Drawable;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AbsListView;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+import epson.print.C2135R;
+import epson.print.CommonDefine;
+import epson.print.ImageItem;
+import epson.print.Util.EPLog;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AltViewImageAdapter extends BaseAdapter implements CommonDefine {
+    private static final String TAG = "ViewImageAdapter";
+    int itmH;
+    int itmW;
+    private final Context mContext;
+    private List<ImageItem> mImageItemList = new ArrayList();
+    Bitmap mSelectPictureBitmap = null;
+
+    public long getItemId(int i) {
+        return (long) i;
+    }
+
+    public AltViewImageAdapter(Context context) {
+        this.mContext = context;
+        BitmapFactory.Options options = new BitmapFactory.Options();
+        options.inPurgeable = true;
+        options.inScaled = false;
+        try {
+            this.mSelectPictureBitmap = BitmapFactory.decodeResource(this.mContext.getResources(), C2135R.C2136drawable.select_picture, options);
+        } catch (OutOfMemoryError e) {
+            EPLog.m307e(TAG, "BitmapFactory.decodeResource Error " + e.getMessage());
+        }
+    }
+
+    public void setImageSize(int i, int i2) {
+        this.itmW = i;
+        this.itmH = i2;
+    }
+
+    public View getView(int i, View view, ViewGroup viewGroup) {
+        RelativeLayout relativeLayout;
+        ImageItem imageItem;
+        if (view == null) {
+            relativeLayout = new RelativeLayout(this.mContext);
+            relativeLayout.setLayoutParams(new AbsListView.LayoutParams(this.itmW, this.itmH));
+            relativeLayout.setGravity(17);
+        } else {
+            relativeLayout = (RelativeLayout) view;
+        }
+        ImageView imageView = (ImageView) relativeLayout.getChildAt(0);
+        if (imageView == null) {
+            imageView = new ImageView(this.mContext);
+            imageView.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
+            imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
+            relativeLayout.addView(imageView, 0);
+        }
+        if (this.mImageItemList.size() < 0 || this.mImageItemList.size() <= i) {
+            imageItem = null;
+        } else {
+            try {
+                imageItem = this.mImageItemList.get(i);
+            } catch (NullPointerException e) {
+                EPLog.m316v("null pointer Exception", "line 46 <> View Image Adapter");
+                e.printStackTrace();
+                return relativeLayout;
+            }
+        }
+        if (imageItem == null) {
+            return relativeLayout;
+        }
+        try {
+            if (imageItem.getBitmap() != null) {
+                imageView.setImageBitmap(imageItem.getBitmap());
+            } else {
+                imageView.setImageBitmap((Bitmap) null);
+                imageView.setBackgroundColor(-3355444);
+                EPLog.m316v("null", "bitmap is null");
+            }
+        } catch (NullPointerException e2) {
+            EPLog.m316v("null pointer Exception", "line 61 <> View Image Adapter");
+            e2.printStackTrace();
+        }
+        try {
+            ImageView imageView2 = (ImageView) relativeLayout.getChildAt(1);
+            if (imageItem.getSelected() != 0) {
+                if (imageView2 == null) {
+                    ImageView imageView3 = new ImageView(this.mContext);
+                    try {
+                        imageView3.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
+                        imageView3.setScaleType(ImageView.ScaleType.FIT_XY);
+                        imageView3.setImageDrawable((Drawable) null);
+                        imageView3.setBackground((Drawable) null);
+                        imageView3.setImageBitmap(this.mSelectPictureBitmap);
+                    } catch (OutOfMemoryError e3) {
+                        EPLog.m307e(TAG, "setImageBitmap Error" + e3.getMessage());
+                        System.runFinalization();
+                        System.gc();
+                    }
+                    relativeLayout.addView(imageView3, 1);
+                } else {
+                    imageView2.setVisibility(0);
+                }
+            } else if (imageView2 != null) {
+                imageView2.setVisibility(4);
+            }
+        } catch (NullPointerException e4) {
+            EPLog.m316v("null pointer Exception", "line 73 <> View Image Adapter");
+            e4.printStackTrace();
+        }
+        return relativeLayout;
+    }
+
+    public int getCount() {
+        return this.mImageItemList.size();
+    }
+
+    public Object getItem(int i) {
+        return this.mImageItemList.get(i);
+    }
+
+    public ImageItem getImageItem(int i) {
+        return this.mImageItemList.get(i);
+    }
+
+    public void add(ImageItem imageItem) {
+        this.mImageItemList.add(imageItem);
+    }
+
+    public void clearImageItem() {
+        this.mImageItemList.clear();
+    }
+
+    public void recycleBitmap() {
+        for (ImageItem bitmap : this.mImageItemList) {
+            Bitmap bitmap2 = bitmap.getBitmap();
+            if (bitmap2 != null) {
+                bitmap2.recycle();
+            }
+        }
+    }
+}

+ 258 - 0
app/src/main/java/com/epson/memcardacc/BitmapCache.java

@@ -0,0 +1,258 @@
+package com.epson.memcardacc;
+
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Matrix;
+import android.media.ExifInterface;
+import com.epson.memcardacc.ImageUtil;
+import epson.print.EPImage;
+import java.io.File;
+import java.io.IOException;
+
+public class BitmapCache {
+    private static final String LOG_TAG = "BitmapCache";
+    private static BitmapCache sBitmapCacheInstance;
+    protected File mCacheDir;
+    CacheHashMap<String, File> mCacheHashMap = new CacheHashMap<>();
+    private CifsAccess mCifsAccess;
+    protected File mTempolaryDownloadDir;
+    private int mThumbnailHeight;
+    private int mThumbnailWidth;
+
+    public boolean setDirectory(File file, File file2) {
+        this.mCacheDir = file;
+        this.mTempolaryDownloadDir = file2;
+        return initEnv();
+    }
+
+    private boolean initEnv() {
+        if (!checkDirectory(this.mCacheDir) || !checkDirectory(this.mTempolaryDownloadDir)) {
+            return false;
+        }
+        new File(this.mCacheDir, MemcardConfig.MAP_FILE_NAME).exists();
+        return true;
+    }
+
+    public boolean checkSettings() {
+        return checkDirectory(this.mCacheDir) && checkDirectory(this.mTempolaryDownloadDir);
+    }
+
+    private boolean checkDirectory(File file) {
+        if (!file.exists()) {
+            if (!file.mkdirs()) {
+                return false;
+            }
+            return true;
+        } else if (!file.isDirectory() || !file.canRead() || !file.canWrite()) {
+            return false;
+        } else {
+            return true;
+        }
+    }
+
+    public void setCifsAccess(CifsAccess cifsAccess) {
+        this.mCifsAccess = cifsAccess;
+    }
+
+    private void deleteDir(File file) {
+        if (file.exists()) {
+            for (File delete : file.listFiles()) {
+                delete.delete();
+            }
+            file.delete();
+        }
+    }
+
+    public void clearCache() {
+        deleteDir(this.mCacheDir);
+        deleteDir(this.mTempolaryDownloadDir);
+    }
+
+    public Bitmap makeThumbnailBitmap(String str, String str2) {
+        File file;
+        try {
+            file = new File(this.mTempolaryDownloadDir, str);
+            try {
+                if (this.mCifsAccess.readFromPrinterMemcard(str2, file.toString()) != 0) {
+                    if (file.exists()) {
+                        file.delete();
+                    }
+                    return null;
+                }
+                int exifRotation = getExifRotation(file);
+                int i = this.mThumbnailWidth;
+                int i2 = this.mThumbnailHeight;
+                if (exifRotation == 90 || exifRotation == 270) {
+                    i = this.mThumbnailHeight;
+                    i2 = this.mThumbnailWidth;
+                }
+                Bitmap makeThumbNail = ImageUtil.makeThumbNail(file, new ImageUtil.WidthHeight(i, i2));
+                if (exifRotation == 0) {
+                    if (file.exists()) {
+                        file.delete();
+                    }
+                    return makeThumbNail;
+                }
+                Bitmap rotateBitmap = rotateBitmap(makeThumbNail, exifRotation);
+                makeThumbNail.recycle();
+                if (file.exists()) {
+                    file.delete();
+                }
+                return rotateBitmap;
+            } catch (Exception unused) {
+                if (file != null && file.exists()) {
+                    file.delete();
+                }
+                return null;
+            } catch (Throwable th) {
+                th = th;
+                if (file != null && file.exists()) {
+                    file.delete();
+                }
+                throw th;
+            }
+        } catch (Exception unused2) {
+            file = null;
+            file.delete();
+            return null;
+        } catch (Throwable th2) {
+            th = th2;
+            file = null;
+            file.delete();
+            throw th;
+        }
+    }
+
+    private static Bitmap rotateBitmap(Bitmap bitmap, int i) {
+        if (bitmap == null) {
+            return null;
+        }
+        int width = bitmap.getWidth();
+        int height = bitmap.getHeight();
+        if (width <= 0 || height <= 0) {
+            return null;
+        }
+        Matrix matrix = new Matrix();
+        matrix.setRotate((float) i);
+        return Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
+    }
+
+    private static int getExifRotation(File file) {
+        try {
+            int attributeInt = new ExifInterface(file.toString()).getAttributeInt(android.support.media.ExifInterface.TAG_ORIENTATION, 1);
+            if (attributeInt == 3) {
+                return EPImage.EPS_ROTATE_180;
+            }
+            if (attributeInt == 6) {
+                return 90;
+            }
+            if (attributeInt != 8) {
+                return 0;
+            }
+            return EPImage.EPS_ROTATE_270;
+        } catch (IOException unused) {
+            return 0;
+        }
+    }
+
+    /* JADX WARNING: Removed duplicated region for block: B:18:0x003f A[SYNTHETIC, Splitter:B:18:0x003f] */
+    /* JADX WARNING: Removed duplicated region for block: B:25:0x004f A[SYNTHETIC, Splitter:B:25:0x004f] */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    private void saveCache(java.lang.String r7, android.graphics.Bitmap r8) {
+        /*
+            r6 = this;
+            if (r8 != 0) goto L_0x0003
+            return
+        L_0x0003:
+            java.util.Locale r0 = java.util.Locale.US
+            java.lang.String r1 = "%08x.bin"
+            r2 = 1
+            java.lang.Object[] r2 = new java.lang.Object[r2]
+            r3 = 0
+            long r4 = java.lang.System.currentTimeMillis()
+            java.lang.Long r4 = java.lang.Long.valueOf(r4)
+            r2[r3] = r4
+            java.lang.String r0 = java.lang.String.format(r0, r1, r2)
+            java.io.File r1 = new java.io.File
+            java.io.File r2 = r6.mCacheDir
+            r1.<init>(r2, r0)
+            r0 = 0
+            java.io.FileOutputStream r2 = new java.io.FileOutputStream     // Catch:{ FileNotFoundException -> 0x0039 }
+            r2.<init>(r1)     // Catch:{ FileNotFoundException -> 0x0039 }
+            android.graphics.Bitmap$CompressFormat r0 = android.graphics.Bitmap.CompressFormat.PNG     // Catch:{ FileNotFoundException -> 0x0034, all -> 0x0031 }
+            r3 = 100
+            r8.compress(r0, r3, r2)     // Catch:{ FileNotFoundException -> 0x0034, all -> 0x0031 }
+            r2.close()     // Catch:{ IOException -> 0x0043 }
+            goto L_0x0047
+        L_0x0031:
+            r7 = move-exception
+            r0 = r2
+            goto L_0x004d
+        L_0x0034:
+            r8 = move-exception
+            r0 = r2
+            goto L_0x003a
+        L_0x0037:
+            r7 = move-exception
+            goto L_0x004d
+        L_0x0039:
+            r8 = move-exception
+        L_0x003a:
+            r8.printStackTrace()     // Catch:{ all -> 0x0037 }
+            if (r0 == 0) goto L_0x0047
+            r0.close()     // Catch:{ IOException -> 0x0043 }
+            goto L_0x0047
+        L_0x0043:
+            r8 = move-exception
+            r8.printStackTrace()
+        L_0x0047:
+            com.epson.memcardacc.CacheHashMap<java.lang.String, java.io.File> r8 = r6.mCacheHashMap
+            r8.put(r7, r1)
+            return
+        L_0x004d:
+            if (r0 == 0) goto L_0x0057
+            r0.close()     // Catch:{ IOException -> 0x0053 }
+            goto L_0x0057
+        L_0x0053:
+            r8 = move-exception
+            r8.printStackTrace()
+        L_0x0057:
+            throw r7
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.memcardacc.BitmapCache.saveCache(java.lang.String, android.graphics.Bitmap):void");
+    }
+
+    private Bitmap getBitmapFromCache(String str) {
+        File file = (File) this.mCacheHashMap.get(str);
+        if (file == null) {
+            return null;
+        }
+        Bitmap decodeFile = BitmapFactory.decodeFile(file.toString());
+        if (decodeFile == null) {
+            this.mCacheHashMap.remove(str);
+        }
+        return decodeFile;
+    }
+
+    public Bitmap cacheOrMakeThumbnailBitmap(String str, String str2) {
+        Bitmap bitmapFromCache = getBitmapFromCache(str2);
+        if (bitmapFromCache != null) {
+            return bitmapFromCache;
+        }
+        Bitmap makeThumbnailBitmap = makeThumbnailBitmap(str, str2);
+        saveCache(str2, makeThumbnailBitmap);
+        return makeThumbnailBitmap;
+    }
+
+    public static BitmapCache getInstance() {
+        if (sBitmapCacheInstance == null) {
+            sBitmapCacheInstance = new BitmapCache();
+        }
+        return sBitmapCacheInstance;
+    }
+
+    public void setSize(int i, int i2) {
+        this.mThumbnailWidth = i;
+        this.mThumbnailHeight = i2;
+    }
+}

+ 18 - 0
app/src/main/java/com/epson/memcardacc/CacheHashMap.java

@@ -0,0 +1,18 @@
+package com.epson.memcardacc;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/* compiled from: BitmapCache */
+class CacheHashMap<K, V> extends LinkedHashMap<K, V> {
+    static final int LIMIT = 1024;
+    private static final long serialVersionUID = 1;
+
+    CacheHashMap() {
+    }
+
+    /* access modifiers changed from: protected */
+    public boolean removeEldestEntry(Map.Entry<K, V> entry) {
+        return size() > 1024;
+    }
+}

+ 457 - 0
app/src/main/java/com/epson/memcardacc/CifsAccess.java

@@ -0,0 +1,457 @@
+package com.epson.memcardacc;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import com.google.common.primitives.UnsignedBytes;
+import epson.print.IprintApplication;
+import epson.print.Util.EPLog;
+import java.io.UnsupportedEncodingException;
+import java.util.LinkedList;
+import java.util.TimeZone;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+import org.apache.commons.lang.CharEncoding;
+import org.apache.commons.lang.time.DateUtils;
+
+public class CifsAccess {
+    public static final int CHECK_STORAGE_ERROR = 0;
+    public static final int CIFS_ERROR_LOGIN_FAILURE = -1205;
+    public static final int CIFS_ERROR_PATH_EXISTED = -1203;
+    public static final String KEY_SMB_PASSWORD = "password";
+    public static final String KEY_SMB_USER_NAME = "smb_user_name";
+    public static final String SMB_AUTHINFO_SHARED_PREFS_KEY = "smb_authinfo";
+    public static final int STORAGE_SET_TYPE_GENERIC_MEMCARD_COPY = 1;
+    public static final int STORAGE_SET_TYPE_PHOTO_COPY = 2;
+    private static CifsLib sCifsLib;
+    private static CifsLibFactory sCifsLibFactory;
+    protected static final Semaphore sCifsLibSemaphore = new Semaphore(1);
+    private boolean mGotCifsLibSemaphore;
+    private String[] mStorageSet;
+
+    protected static void setCifsFactory(CifsLibFactory cifsLibFactory) {
+    }
+
+    public int initDefault(Context context, int i) {
+        if (i != 2) {
+            this.mStorageSet = MemcardConfig.GENERIC_STORAGE_SET;
+        } else {
+            this.mStorageSet = MemcardConfig.PHOTO_COPY_STORAGE_SET;
+        }
+        try {
+            return init(MemcardUtil.getPrinterIpAddress(context), TimeZone.getDefault().getRawOffset() / DateUtils.MILLIS_IN_HOUR);
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    /* JADX WARNING: Code restructure failed: missing block: B:31:0x0048, code lost:
+        return 0;
+     */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    public synchronized int init(java.lang.String r4, int r5) throws java.io.UnsupportedEncodingException {
+        /*
+            r3 = this;
+            monitor-enter(r3)
+            r0 = 0
+            if (r4 == 0) goto L_0x0047
+            int r1 = r4.length()     // Catch:{ all -> 0x0044 }
+            if (r1 > 0) goto L_0x000b
+            goto L_0x0047
+        L_0x000b:
+            boolean r1 = r3.mGotCifsLibSemaphore     // Catch:{ all -> 0x0044 }
+            if (r1 == 0) goto L_0x0011
+            monitor-exit(r3)
+            return r0
+        L_0x0011:
+            boolean r1 = r3.acquireCifsLibSemaphore()     // Catch:{ all -> 0x0044 }
+            if (r1 != 0) goto L_0x0019
+            monitor-exit(r3)
+            return r0
+        L_0x0019:
+            com.epson.memcardacc.CifsLib r1 = sCifsLib     // Catch:{ all -> 0x0044 }
+            if (r1 == 0) goto L_0x0027
+            java.lang.String r1 = "CifsAccess"
+            java.lang.String r2 = "in init() sCifsLib != null"
+            epson.print.Util.EPLog.m318w((java.lang.String) r1, (java.lang.String) r2)     // Catch:{ all -> 0x0044 }
+            r3.freeCifsLib()     // Catch:{ all -> 0x0044 }
+        L_0x0027:
+            com.epson.memcardacc.CifsAccess$CifsLibFactory r1 = sCifsLibFactory     // Catch:{ all -> 0x0044 }
+            com.epson.memcardacc.CifsLib r1 = r1.getCifsLib()     // Catch:{ all -> 0x0044 }
+            sCifsLib = r1     // Catch:{ all -> 0x0044 }
+            java.lang.String r1 = "US-ASCII"
+            byte[] r4 = r4.getBytes(r1)     // Catch:{ all -> 0x0044 }
+            com.epson.memcardacc.CifsLib r1 = sCifsLib     // Catch:{ all -> 0x0044 }
+            int r4 = r1.init(r4, r5)     // Catch:{ all -> 0x0044 }
+            if (r4 != 0) goto L_0x0042
+            r3.free()     // Catch:{ all -> 0x0044 }
+            monitor-exit(r3)
+            return r0
+        L_0x0042:
+            monitor-exit(r3)
+            return r4
+        L_0x0044:
+            r4 = move-exception
+            monitor-exit(r3)
+            throw r4
+        L_0x0047:
+            monitor-exit(r3)
+            return r0
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.memcardacc.CifsAccess.init(java.lang.String, int):int");
+    }
+
+    /* access modifiers changed from: protected */
+    public void freeCifsLib() {
+        CifsLib cifsLib = sCifsLib;
+        if (cifsLib != null) {
+            cifsLib.free();
+            sCifsLib = null;
+        }
+    }
+
+    public synchronized void free() {
+        freeCifsLib();
+        releaseCifsLibSemaphore();
+    }
+
+    /* access modifiers changed from: protected */
+    public synchronized boolean acquireCifsLibSemaphore() {
+        try {
+            if (!getCifsLibSemaphore().tryAcquire(60, TimeUnit.SECONDS)) {
+                EPLog.m318w("CifsAccess", "cifsSemaphore.tryAcquire() can not get semaphore.");
+                return false;
+            }
+            this.mGotCifsLibSemaphore = true;
+            return true;
+        } catch (InterruptedException unused) {
+            EPLog.m313i("CifsAccess", "cifsSemaphore.tryAcquire() interrupted.");
+            return false;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public synchronized void releaseCifsLibSemaphore() {
+        if (this.mGotCifsLibSemaphore) {
+            getCifsLibSemaphore().release();
+            this.mGotCifsLibSemaphore = false;
+        }
+    }
+
+    public LinkedList<String> getStorageNames() {
+        return getStringsFromUtf16LeByte(sCifsLib.getStrageNames());
+    }
+
+    public int checkStorage() {
+        int i = 0;
+        while (true) {
+            String[] strArr = this.mStorageSet;
+            if (i >= strArr.length) {
+                return 0;
+            }
+            if (connectStorageWithApplicationUsernameAndPassword(strArr[i]) != 0) {
+                long freeUnit = getFreeUnit();
+                disconnectStorage();
+                if (freeUnit >= 0) {
+                    return i + 1;
+                }
+            }
+            if (getErrorCode() == -1205) {
+                return 0;
+            }
+            i++;
+        }
+    }
+
+    public int connectStorage(String str, String str2, String str3) {
+        if (!checkCifsLibStatus()) {
+            return 0;
+        }
+        try {
+            int connectStrageNative = sCifsLib.connectStrageNative(getZZTermUtf16Bin(str), str2, str3);
+            EPLog.m316v("CifsAccess", "@@@return <" + connectStrageNative + ">");
+            return connectStrageNative;
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
+
+    public int connectStorageWithApplicationUsernameAndPassword(String str) {
+        String str2 = "";
+        String str3 = "";
+        SmbAuthInfo smbAuthInfo = getSmbAuthInfo();
+        if (smbAuthInfo != null) {
+            str2 = smbAuthInfo.mUserName;
+            str3 = smbAuthInfo.mPassword;
+        }
+        return connectStorage(str, str2, str3);
+    }
+
+    public int connectDefaultStorage(int i, String str, String str2) {
+        if (i <= 0) {
+            return -1;
+        }
+        return connectStorage(this.mStorageSet[i - 1], str, str2);
+    }
+
+    public int connectDefaultStorageWidthDefaultAthInfo(int i) {
+        SmbAuthInfo smbAuthInfo = getSmbAuthInfo();
+        if (smbAuthInfo == null) {
+            return connectDefaultStorage(i, "", "");
+        }
+        return connectDefaultStorage(i, smbAuthInfo.mUserName, smbAuthInfo.mPassword);
+    }
+
+    public void disconnectStorage() {
+        CifsLib cifsLib = sCifsLib;
+        if (cifsLib != null) {
+            cifsLib.cancel();
+            sCifsLib.disConnectStrage();
+        }
+    }
+
+    public LinkedList<CifsFileInfo> getFileList(String str) {
+        boolean equals = "\\".equals(str);
+        try {
+            byte[] fileList = sCifsLib.getFileList(getZZTermUtf16Bin(str));
+            if (fileList == null) {
+                return null;
+            }
+            try {
+                return getFileInfoFromBin(fileList);
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+                return null;
+            }
+        } catch (UnsupportedEncodingException e2) {
+            e2.printStackTrace();
+            return null;
+        }
+    }
+
+    public long getFileSize(String str) {
+        try {
+            return sCifsLib.getFileSize(getZZTermUtf16Bin(str));
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+            return -100;
+        }
+    }
+
+    public long getFreeUnit() {
+        return sCifsLib.getFreeUnit();
+    }
+
+    public int getUnitSize() {
+        return sCifsLib.getUnitSize();
+    }
+
+    public long getFreeSize() {
+        return ((long) getUnitSize()) * getFreeUnit();
+    }
+
+    public int readFromPrinterMemcard(String str, String str2) {
+        if (!checkCifsLibStatus()) {
+            return -1;
+        }
+        try {
+            return sCifsLib.readFromPrinterMemcard(getZZTermUtf16Bin(str), str2);
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+            return -100;
+        }
+    }
+
+    public int writeToPrinterMemcard(String str, String str2, int i) throws UnsupportedEncodingException {
+        if (!checkCifsLibStatus()) {
+            return -1;
+        }
+        return sCifsLib.writeToPrinterMemcard(str, getZZTermUtf16Bin(str2), i);
+    }
+
+    public int createDirectory(String str) {
+        if (!checkCifsLibStatus()) {
+            return -1;
+        }
+        try {
+            return sCifsLib.createDirectory(getZZTermUtf16Bin(str));
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+            return -100;
+        }
+    }
+
+    public int deleteDirectory(String str) {
+        if (!checkCifsLibStatus()) {
+            return -1;
+        }
+        try {
+            return sCifsLib.deleteDirectory(getZZTermUtf16Bin(str));
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+            return -100;
+        }
+    }
+
+    public int deleteFile(String str) {
+        if (!checkCifsLibStatus()) {
+            return -1;
+        }
+        try {
+            return sCifsLib.deleteFile(getZZTermUtf16Bin(str));
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+            return -100;
+        }
+    }
+
+    public synchronized void cancel() {
+        if (checkCifsLibStatus()) {
+            sCifsLib.cancel();
+        }
+    }
+
+    public synchronized void cancelByFileSizeZero() {
+        if (checkCifsLibStatus()) {
+            sCifsLib.cancelByFileSizeZero();
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public boolean checkCifsLibStatus() {
+        return this.mGotCifsLibSemaphore && sCifsLib != null;
+    }
+
+    public int getErrorCode() {
+        CifsLib cifsLib = sCifsLib;
+        if (cifsLib == null) {
+            return 0;
+        }
+        return cifsLib.getErrorCode();
+    }
+
+    public static LinkedList<String> getStringsFromUtf16LeByte(byte[] bArr) {
+        String str;
+        LinkedList<String> linkedList = new LinkedList<>();
+        if (bArr == null) {
+            return linkedList;
+        }
+        int i = 0;
+        while (i < bArr.length) {
+            int utf16ZZTermDataByteLength = getUtf16ZZTermDataByteLength(bArr, i);
+            try {
+                str = new String(bArr, i, utf16ZZTermDataByteLength, CharEncoding.UTF_16LE);
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+                str = "??can_not_decode??";
+            }
+            linkedList.add(str);
+            i += utf16ZZTermDataByteLength + 2;
+        }
+        return linkedList;
+    }
+
+    public static int getUtf16ZZTermDataByteLength(byte[] bArr, int i) {
+        if (bArr.length < i) {
+            return 0;
+        }
+        int i2 = i;
+        while (true) {
+            int i3 = i2 + 2;
+            if (bArr.length < i3) {
+                return i2 - i;
+            }
+            if (bArr[i2] == 0 && bArr[i2 + 1] == 0) {
+                return i2 - i;
+            }
+            i2 = i3;
+        }
+    }
+
+    public static byte[] getZZTermUtf16Bin(String str) throws UnsupportedEncodingException {
+        return (str + "\u0000").getBytes(CharEncoding.UTF_16LE);
+    }
+
+    static int readLeNByteInt(byte[] bArr, int i, int i2) {
+        int i3 = 0;
+        for (int i4 = 0; i4 < i2; i4++) {
+            i3 |= (bArr[i + i4] & UnsignedBytes.MAX_VALUE) << (i4 * 8);
+        }
+        return i3;
+    }
+
+    public static LinkedList<CifsFileInfo> getFileInfoFromBin(byte[] bArr) throws UnsupportedEncodingException {
+        LinkedList<CifsFileInfo> linkedList = new LinkedList<>();
+        if (bArr == null) {
+            return linkedList;
+        }
+        int i = 0;
+        while (true) {
+            int i2 = i + 4;
+            int i3 = i2 + 2;
+            if (i3 > bArr.length) {
+                return linkedList;
+            }
+            int readLeNByteInt = readLeNByteInt(bArr, i, 4);
+            int readLeNByteInt2 = readLeNByteInt(bArr, i2, 2);
+            linkedList.add(new CifsFileInfo(new String(bArr, i3, readLeNByteInt2, CharEncoding.UTF_16LE), readLeNByteInt));
+            i += readLeNByteInt2 + 6;
+        }
+    }
+
+    public static String getParentDirectory(String str) {
+        return (str == null || str.length() <= 1) ? "" : str.replaceFirst("\\\\[^\\\\]+\\\\?$", "");
+    }
+
+    public static String join(String str, String str2) {
+        if (str.endsWith("\\")) {
+            return str + str2;
+        }
+        return str + "\\" + str2;
+    }
+
+    protected CifsAccess() {
+        if (sCifsLibFactory == null) {
+            sCifsLibFactory = new CifsLibFactory();
+        }
+    }
+
+    public static CifsAccess getInstance() {
+        return new CifsAccess();
+    }
+
+    protected static SharedPreferences getCifsAccessSharedPreferences() {
+        return IprintApplication.getInstance().getSharedPreferences(SMB_AUTHINFO_SHARED_PREFS_KEY, 0);
+    }
+
+    public static void clearSmbAuthInfo() {
+        getCifsAccessSharedPreferences().edit().clear().commit();
+    }
+
+    public static SmbAuthInfo getSmbAuthInfo() {
+        SharedPreferences cifsAccessSharedPreferences = getCifsAccessSharedPreferences();
+        return new SmbAuthInfo(cifsAccessSharedPreferences.getString(KEY_SMB_USER_NAME, ""), cifsAccessSharedPreferences.getString("password", ""));
+    }
+
+    public static void setSmbAuthInfo(SmbAuthInfo smbAuthInfo) {
+        SharedPreferences.Editor edit = getCifsAccessSharedPreferences().edit();
+        edit.putString(KEY_SMB_USER_NAME, smbAuthInfo.mUserName);
+        edit.putString("password", smbAuthInfo.mPassword);
+        edit.commit();
+    }
+
+    public static Semaphore getCifsLibSemaphore() {
+        return sCifsLibSemaphore;
+    }
+
+    protected static class CifsLibFactory {
+        protected CifsLibFactory() {
+        }
+
+        public CifsLib getCifsLib() {
+            return new CifsLib();
+        }
+    }
+}

+ 36 - 0
app/src/main/java/com/epson/memcardacc/CifsFileInfo.java

@@ -0,0 +1,36 @@
+package com.epson.memcardacc;
+
+import java.io.Serializable;
+
+public class CifsFileInfo implements Serializable {
+    private static final long serialVersionUID = 1;
+    public int mAttribute;
+    public String mFileName;
+
+    public CifsFileInfo(String str, int i) {
+        this.mFileName = str;
+        this.mAttribute = i;
+    }
+
+    public boolean isDirectory() {
+        return (this.mAttribute & 16) != 0;
+    }
+
+    public boolean isReadableDir() {
+        int i = this.mAttribute;
+        return (i & 16) != 0 && (i & 6) == 0;
+    }
+
+    public boolean readableNormalFile() {
+        int i = this.mAttribute;
+        return (i & 16) == 0 && (i & 6) == 0;
+    }
+
+    public boolean isReadable() {
+        return (this.mAttribute & 6) == 0;
+    }
+
+    public boolean equals(Object obj) {
+        return this.mFileName.equals(((CifsFileInfo) obj).mFileName);
+    }
+}

+ 43 - 0
app/src/main/java/com/epson/memcardacc/CifsLib.java

@@ -0,0 +1,43 @@
+package com.epson.memcardacc;
+
+public class CifsLib {
+    private long mNativeInscance;
+
+    public native void cancel();
+
+    public native void cancelByFileSizeZero();
+
+    public native synchronized int connectStrageNative(byte[] bArr, String str, String str2);
+
+    public native synchronized int createDirectory(byte[] bArr);
+
+    public native synchronized int deleteDirectory(byte[] bArr);
+
+    public native synchronized int deleteFile(byte[] bArr);
+
+    public native synchronized int disConnectStrage();
+
+    public native synchronized void free();
+
+    public native int getErrorCode();
+
+    public native synchronized byte[] getFileList(byte[] bArr);
+
+    public native synchronized long getFileSize(byte[] bArr);
+
+    public native synchronized long getFreeUnit();
+
+    public native synchronized byte[] getStrageNames();
+
+    public native synchronized int getUnitSize();
+
+    public native synchronized int init(byte[] bArr, int i);
+
+    public native synchronized int readFromPrinterMemcard(byte[] bArr, String str);
+
+    public native synchronized int writeToPrinterMemcard(String str, byte[] bArr, int i);
+
+    static {
+        System.loadLibrary("cifs");
+    }
+}

+ 626 - 0
app/src/main/java/com/epson/memcardacc/ConfirmReadMemcard.java

@@ -0,0 +1,626 @@
+package com.epson.memcardacc;
+
+import android.arch.lifecycle.Observer;
+import android.arch.lifecycle.ViewModelProviders;
+import android.content.Intent;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.os.StatFs;
+import android.support.p000v4.app.DialogFragment;
+import android.support.p000v4.app.FragmentActivity;
+import android.view.View;
+import android.widget.TextView;
+import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
+import epson.common.DialogProgress;
+import epson.common.DialogProgressViewModel;
+import epson.print.ActivityIACommon;
+import epson.print.C2135R;
+import epson.print.CommonDefine;
+import epson.print.Util.EPLog;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Deque;
+import java.util.Iterator;
+import java.util.Locale;
+
+public class ConfirmReadMemcard extends ActivityIACommon implements DialogProgress.DialogButtonClick {
+    private static final int ACTIVITY_DIRECTORY_SELECT = 2;
+    private static final int ACTIVITY_TYPE_PROGRESS = 1;
+    private static final String DIALOG_COMMUNICATION_ERROR = "dialog_communication_error";
+    private static final String DIALOG_COPY_RESULT_CANCEL = "dialog_copy_result";
+    private static final String DIALOG_COPY_RESULT_COMPLETE = "dialog_copy_result_complete";
+    private static final String DIALOG_COPY_RESULT_ERROR = "dialog_copy_result_error";
+    private static final String DIALOG_DISK_SPACE_SHORTAGE = "dialog_disk_space_shortage";
+    private static final String DIALOG_PRINTER_BUSY = "dialog_printer_busy";
+    private static final String DIALOG_PROGRESS = "dialog_progress";
+    private static final String DIALOG_WRITE_LOCAL_DIR_CANNOT_GET = "dialog_write_local_dir_cannot_get";
+    static final int ERROR_COMMUNICATION_ERROR = 11;
+    static final int ERROR_MEMCARD_BUSY = 10;
+    public static final String KEY_IMAGE_LIST = "imagelist";
+    private static final String LOG_TAG = "ConfirmReadMemcard";
+    public static final String MEMCARD_STORAGE_TYPE = "memcard_storage_type";
+    public static final int RESULT_BACK_TO_MEMCARD_TOP = 1;
+    boolean doTotalFileSizeCalc = false;
+    boolean isKeepSimleApConnect = false;
+    boolean isTryConnectSimpleAp = false;
+    CheckAndNextActivityTask mCheckAndNextActivityTask;
+    /* access modifiers changed from: private */
+    public String mCopyTargetFolderName;
+    private TextView mCopyTargetPathText;
+    private TextView mFileNumText;
+    private TextView mFileSizeText;
+    /* access modifiers changed from: private */
+    public ArrayList<String> mImageList;
+    /* access modifiers changed from: private */
+    public int mMemcardStorageType;
+    /* access modifiers changed from: private */
+    public DialogProgressViewModel mModelDialog;
+    private long mTotalFileSize;
+    private TotalFileSizeCalcTask mTotalFileSizeCalcTask;
+    private String mWriteDirectory = MemcardConfig.DEFAULT_READER_LOCAL_DIRECTORY;
+
+    public void onCancelDialog(String str) {
+    }
+
+    public void onNeutralClick(String str) {
+    }
+
+    public void onPositiveClick(String str) {
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        setContentView((int) C2135R.layout.activity_confirm_read_memcard);
+        this.mModelDialog = (DialogProgressViewModel) ViewModelProviders.m2of((FragmentActivity) this).get(DialogProgressViewModel.class);
+        this.mModelDialog.getDialogJob().observe(this, new Observer() {
+            public final void onChanged(Object obj) {
+                ConfirmReadMemcard.lambda$onCreate$0(ConfirmReadMemcard.this, (Deque) obj);
+            }
+        });
+        setActionBar((int) C2135R.string.memcard_title_copy_confirm, true);
+        this.mFileNumText = (TextView) findViewById(C2135R.C2137id.textFileNumber);
+        this.mFileSizeText = (TextView) findViewById(C2135R.C2137id.textFileSize);
+        this.mFileSizeText.setText(CommonDefine.QUESTION_MARK);
+        this.mCopyTargetPathText = (TextView) findViewById(C2135R.C2137id.textWriteFolder);
+        Intent intent = getIntent();
+        this.mImageList = intent.getStringArrayListExtra(KEY_IMAGE_LIST);
+        if (this.mImageList == null) {
+            this.mImageList = new ArrayList<>();
+        }
+        this.mMemcardStorageType = intent.getIntExtra("memcard_storage_type", 1);
+        int size = this.mImageList.size();
+        this.mFileNumText.setText(String.format(getResources().getString(C2135R.string.memcard_file_num_format), new Object[]{Integer.valueOf(size)}));
+        setTargetDirectory(MemcardConfig.DEFAULT_READER_LOCAL_DIRECTORY);
+        this.doTotalFileSizeCalc = true;
+    }
+
+    public static /* synthetic */ void lambda$onCreate$0(ConfirmReadMemcard confirmReadMemcard, Deque deque) {
+        String[] checkQueue = confirmReadMemcard.mModelDialog.checkQueue();
+        if (checkQueue != null) {
+            String str = checkQueue[0];
+            String str2 = checkQueue[1];
+            if (str2.equals("do_show")) {
+                confirmReadMemcard.showDialog(str);
+            }
+            if (str2.equals("do_dismiss")) {
+                confirmReadMemcard.dismissDialog(str);
+            }
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onResume() {
+        super.onResume();
+        if (!WiFiDirectManager.isNeedConnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER)) {
+            this.isTryConnectSimpleAp = false;
+        } else if (!this.isTryConnectSimpleAp) {
+            this.isTryConnectSimpleAp = true;
+            if (WiFiDirectManager.reconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, -1)) {
+                this.doTotalFileSizeCalc = true;
+                return;
+            }
+        }
+        this.isKeepSimleApConnect = false;
+        if (this.doTotalFileSizeCalc) {
+            this.mTotalFileSizeCalcTask = new TotalFileSizeCalcTask();
+            this.mTotalFileSizeCalcTask.execute(new Void[0]);
+            this.doTotalFileSizeCalc = false;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPause() {
+        EPLog.m305d(LOG_TAG, "onPause()");
+        super.onPause();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onStop() {
+        EPLog.m305d(LOG_TAG, "onStop()");
+        super.onStop();
+        if (!this.isKeepSimleApConnect) {
+            WiFiDirectManager.disconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, MemcardUtil.getPrinterIpAddress(this));
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onDestroy() {
+        this.mTotalFileSizeCalcTask.cancel(true);
+        super.onDestroy();
+    }
+
+    public void onBackPressed() {
+        super.onBackPressed();
+        this.isKeepSimleApConnect = true;
+    }
+
+    /* access modifiers changed from: private */
+    public void localShowDialog(String str) {
+        this.mModelDialog.doShow(str);
+    }
+
+    public void setTargetDirectory(String str) {
+        this.mWriteDirectory = str;
+        this.mCopyTargetFolderName = getTargetFolderName();
+        String str2 = this.mCopyTargetFolderName;
+        if (str2 == null) {
+            localShowDialog(DIALOG_WRITE_LOCAL_DIR_CANNOT_GET);
+            str2 = "";
+        }
+        EPLog.m313i(LOG_TAG, "outdir: " + this.mCopyTargetFolderName);
+        this.mCopyTargetPathText.setText(String.format(getResources().getString(C2135R.string.memcard_folder_save_to_format), new Object[]{str2}));
+    }
+
+    private String getTargetFolderName() {
+        Calendar instance = Calendar.getInstance();
+        for (int i = 0; i < 100; i++) {
+            String format = String.format(Locale.US, "%s/%s/%04d%02d%02d%02d%02d%02d", new Object[]{MemcardConfig.BASE_DIRECTORY, this.mWriteDirectory, Integer.valueOf(instance.get(1)), Integer.valueOf(instance.get(2) + 1), Integer.valueOf(instance.get(5)), Integer.valueOf(instance.get(11)), Integer.valueOf(instance.get(12)), Integer.valueOf(i)});
+            File file = new File(format);
+            if (!file.exists()) {
+                boolean mkdirs = file.mkdirs();
+                file.delete();
+                if (mkdirs) {
+                    return format;
+                }
+            }
+        }
+        return null;
+    }
+
+    static long getTotalFileSize(ArrayList<String> arrayList) {
+        long j = 0;
+        if (arrayList == null) {
+            return 0;
+        }
+        Iterator<String> it = arrayList.iterator();
+        while (it.hasNext()) {
+            j += new File(it.next()).length();
+        }
+        return j;
+    }
+
+    /* access modifiers changed from: private */
+    public boolean checkFileSize() {
+        StatFs statFs = new StatFs(new File(MemcardConfig.BASE_DIRECTORY, this.mWriteDirectory).toString());
+        return (this.mTotalFileSize / statFs.getBlockSizeLong()) + ((long) this.mImageList.size()) <= statFs.getAvailableBlocksLong();
+    }
+
+    public void updateFileSize(long j) {
+        this.mTotalFileSize = j;
+        this.mFileSizeText.setText(String.format(getResources().getString(C2135R.string.memcard_total_file_size_format), new Object[]{Double.valueOf(((double) this.mTotalFileSize) / 1000000.0d)}));
+    }
+
+    /* access modifiers changed from: private */
+    public void startCopyActivity() {
+        Intent intent = new Intent(this, MemcardReadProgress.class);
+        intent.putStringArrayListExtra("imageList", this.mImageList);
+        intent.putExtra("target_folder_name", this.mCopyTargetFolderName);
+        intent.putExtra("memcard_storage_type", this.mMemcardStorageType);
+        startActivityForResult(intent, 1);
+        this.isKeepSimleApConnect = true;
+    }
+
+    public void copy_dest_button_clicked(View view) {
+        Intent intent = new Intent(this, DirectorySelecterActivity.class);
+        intent.putExtra(DirectorySelecterActivity.PARAM_BASE_DIRECTORY, MemcardConfig.BASE_DIRECTORY);
+        intent.putExtra(DirectorySelecterActivity.PARAM_DEFAULT_DIR, MemcardConfig.DEFAULT_READER_LOCAL_DIRECTORY);
+        startActivityForResult(intent, 2);
+    }
+
+    public void copy_button_clicked(View view) {
+        this.mCheckAndNextActivityTask = new CheckAndNextActivityTask();
+        this.mCheckAndNextActivityTask.execute(new Void[0]);
+    }
+
+    /* JADX WARNING: Can't fix incorrect switch cases order */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    private void showDialog(java.lang.String r12) {
+        /*
+            r11 = this;
+            int r0 = r12.hashCode()
+            r1 = 0
+            switch(r0) {
+                case -2116590872: goto L_0x004f;
+                case -2003975289: goto L_0x0045;
+                case -508401744: goto L_0x003b;
+                case -63760199: goto L_0x0031;
+                case -21731516: goto L_0x0027;
+                case 1079349783: goto L_0x001d;
+                case 1194959080: goto L_0x0013;
+                case 1429177493: goto L_0x0009;
+                default: goto L_0x0008;
+            }
+        L_0x0008:
+            goto L_0x0059
+        L_0x0009:
+            java.lang.String r0 = "dialog_printer_busy"
+            boolean r0 = r12.equals(r0)
+            if (r0 == 0) goto L_0x0059
+            r0 = 6
+            goto L_0x005a
+        L_0x0013:
+            java.lang.String r0 = "dialog_copy_result_complete"
+            boolean r0 = r12.equals(r0)
+            if (r0 == 0) goto L_0x0059
+            r0 = 3
+            goto L_0x005a
+        L_0x001d:
+            java.lang.String r0 = "dialog_write_local_dir_cannot_get"
+            boolean r0 = r12.equals(r0)
+            if (r0 == 0) goto L_0x0059
+            r0 = 2
+            goto L_0x005a
+        L_0x0027:
+            java.lang.String r0 = "dialog_progress"
+            boolean r0 = r12.equals(r0)
+            if (r0 == 0) goto L_0x0059
+            r0 = 0
+            goto L_0x005a
+        L_0x0031:
+            java.lang.String r0 = "dialog_copy_result_error"
+            boolean r0 = r12.equals(r0)
+            if (r0 == 0) goto L_0x0059
+            r0 = 5
+            goto L_0x005a
+        L_0x003b:
+            java.lang.String r0 = "dialog_copy_result"
+            boolean r0 = r12.equals(r0)
+            if (r0 == 0) goto L_0x0059
+            r0 = 4
+            goto L_0x005a
+        L_0x0045:
+            java.lang.String r0 = "dialog_disk_space_shortage"
+            boolean r0 = r12.equals(r0)
+            if (r0 == 0) goto L_0x0059
+            r0 = 1
+            goto L_0x005a
+        L_0x004f:
+            java.lang.String r0 = "dialog_communication_error"
+            boolean r0 = r12.equals(r0)
+            if (r0 == 0) goto L_0x0059
+            r0 = 7
+            goto L_0x005a
+        L_0x0059:
+            r0 = -1
+        L_0x005a:
+            r2 = 2131624893(0x7f0e03bd, float:1.8876979E38)
+            r3 = 2131625202(0x7f0e04f2, float:1.8877605E38)
+            switch(r0) {
+                case 0: goto L_0x0107;
+                case 1: goto L_0x00eb;
+                case 2: goto L_0x00eb;
+                case 3: goto L_0x00d5;
+                case 4: goto L_0x00bd;
+                case 5: goto L_0x009f;
+                case 6: goto L_0x0082;
+                case 7: goto L_0x0066;
+                default: goto L_0x0063;
+            }
+        L_0x0063:
+            r0 = 0
+            goto L_0x0115
+        L_0x0066:
+            r5 = 2
+            r0 = 2131624886(0x7f0e03b6, float:1.8876964E38)
+            java.lang.String r6 = r11.getString(r0)
+            r0 = 2131624887(0x7f0e03b7, float:1.8876966E38)
+            java.lang.String r7 = r11.getString(r0)
+            java.lang.String r8 = r11.getString(r3)
+            r9 = 0
+            r10 = 0
+            r4 = r12
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r4, r5, r6, r7, r8, r9, r10)
+            goto L_0x0115
+        L_0x0082:
+            r2 = 2
+            r0 = 2131624471(0x7f0e0217, float:1.8876123E38)
+            java.lang.String r0 = r11.getString(r0)
+            r1 = 2131624472(0x7f0e0218, float:1.8876125E38)
+            java.lang.String r4 = r11.getString(r1)
+            java.lang.String r5 = r11.getString(r3)
+            r6 = 0
+            r7 = 0
+            r1 = r12
+            r3 = r0
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r1, r2, r3, r4, r5, r6, r7)
+            goto L_0x0115
+        L_0x009f:
+            r0 = 2
+            java.lang.String r4 = r11.getString(r2)
+            r1 = 2131624894(0x7f0e03be, float:1.887698E38)
+            java.lang.String r5 = r11.getString(r1)
+            java.lang.String r6 = r11.getString(r3)
+            r7 = 0
+            r8 = 0
+            r1 = r12
+            r2 = r0
+            r3 = r4
+            r4 = r5
+            r5 = r6
+            r6 = r7
+            r7 = r8
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r1, r2, r3, r4, r5, r6, r7)
+            goto L_0x0115
+        L_0x00bd:
+            r0 = 2
+            java.lang.String r4 = r11.getString(r2)
+            r5 = 0
+            r6 = 0
+            r7 = 0
+            java.lang.String r8 = r11.getString(r3)
+            r1 = r12
+            r2 = r0
+            r3 = r4
+            r4 = r5
+            r5 = r6
+            r6 = r7
+            r7 = r8
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r1, r2, r3, r4, r5, r6, r7)
+            goto L_0x0115
+        L_0x00d5:
+            r2 = 2
+            r0 = 2131624890(0x7f0e03ba, float:1.8876972E38)
+            java.lang.String r0 = r11.getString(r0)
+            r4 = 0
+            r5 = 0
+            r6 = 0
+            java.lang.String r7 = r11.getString(r3)
+            r1 = r12
+            r3 = r0
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r1, r2, r3, r4, r5, r6, r7)
+            goto L_0x0115
+        L_0x00eb:
+            r2 = 2
+            r0 = 2131624883(0x7f0e03b3, float:1.8876958E38)
+            java.lang.String r0 = r11.getString(r0)
+            r1 = 2131624884(0x7f0e03b4, float:1.887696E38)
+            java.lang.String r4 = r11.getString(r1)
+            java.lang.String r5 = r11.getString(r3)
+            r6 = 0
+            r7 = 0
+            r1 = r12
+            r3 = r0
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r1, r2, r3, r4, r5, r6, r7)
+            goto L_0x0115
+        L_0x0107:
+            r0 = 2131624885(0x7f0e03b5, float:1.8876962E38)
+            java.lang.String r0 = r11.getString(r0)
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r12, r1, r0)
+            r0.setCancelable(r1)
+        L_0x0115:
+            if (r0 == 0) goto L_0x011e
+            android.support.v4.app.FragmentManager r1 = r11.getSupportFragmentManager()
+            r0.show(r1, r12)
+        L_0x011e:
+            return
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.memcardacc.ConfirmReadMemcard.showDialog(java.lang.String):void");
+    }
+
+    private void dismissDialog(String str) {
+        DialogFragment dialogFragment = (DialogFragment) getSupportFragmentManager().findFragmentByTag(String.valueOf(str));
+        if (dialogFragment != null) {
+            dialogFragment.dismiss();
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onActivityResult(int i, int i2, Intent intent) {
+        switch (i) {
+            case 1:
+                this.isKeepSimleApConnect = false;
+                if (i2 == -2) {
+                    setResult(1);
+                    finish();
+                    return;
+                } else if (i2 != 0) {
+                    localShowDialog(DIALOG_COPY_RESULT_ERROR);
+                    return;
+                } else {
+                    return;
+                }
+            case 2:
+                if (i2 == -1) {
+                    setTargetDirectory(intent.getStringExtra(DirectorySelecterActivity.RESULT_DIRECTORY));
+                    return;
+                }
+                return;
+            default:
+                return;
+        }
+    }
+
+    /* JADX WARNING: Removed duplicated region for block: B:12:0x0029  */
+    /* JADX WARNING: Removed duplicated region for block: B:13:0x002f  */
+    /* JADX WARNING: Removed duplicated region for block: B:16:? A[RETURN, SYNTHETIC] */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    public void onNegativeClick(java.lang.String r4) {
+        /*
+            r3 = this;
+            int r0 = r4.hashCode()
+            r1 = -508401744(0xffffffffe1b267b0, float:-4.11374E20)
+            r2 = 1
+            if (r0 == r1) goto L_0x001a
+            r1 = 1194959080(0x4739a0e8, float:47520.906)
+            if (r0 == r1) goto L_0x0010
+            goto L_0x0024
+        L_0x0010:
+            java.lang.String r0 = "dialog_copy_result_complete"
+            boolean r4 = r4.equals(r0)
+            if (r4 == 0) goto L_0x0024
+            r4 = 0
+            goto L_0x0025
+        L_0x001a:
+            java.lang.String r0 = "dialog_copy_result"
+            boolean r4 = r4.equals(r0)
+            if (r4 == 0) goto L_0x0024
+            r4 = 1
+            goto L_0x0025
+        L_0x0024:
+            r4 = -1
+        L_0x0025:
+            switch(r4) {
+                case 0: goto L_0x002f;
+                case 1: goto L_0x0029;
+                default: goto L_0x0028;
+            }
+        L_0x0028:
+            goto L_0x0035
+        L_0x0029:
+            java.lang.String r4 = r3.mWriteDirectory
+            r3.setTargetDirectory(r4)
+            goto L_0x0035
+        L_0x002f:
+            r3.setResult(r2)
+            r3.finish()
+        L_0x0035:
+            return
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.memcardacc.ConfirmReadMemcard.onNegativeClick(java.lang.String):void");
+    }
+
+    class TotalFileSizeCalcTask extends AsyncTask<Void, Void, Long> {
+        CifsAccess mCifsAccess = CifsAccess.getInstance();
+
+        TotalFileSizeCalcTask() {
+        }
+
+        /* access modifiers changed from: protected */
+        public synchronized Long doInBackground(Void... voidArr) {
+            if (this.mCifsAccess.initDefault(ConfirmReadMemcard.this, 1) == 0) {
+                return -1L;
+            }
+            if (this.mCifsAccess.connectDefaultStorageWidthDefaultAthInfo(ConfirmReadMemcard.this.mMemcardStorageType) == 0) {
+                this.mCifsAccess.free();
+                return -1L;
+            }
+            try {
+                Iterator it = ConfirmReadMemcard.this.mImageList.iterator();
+                long j = 0;
+                while (it.hasNext()) {
+                    if (isCancelled()) {
+                        this.mCifsAccess.disconnectStorage();
+                        this.mCifsAccess.free();
+                        return 0L;
+                    }
+                    long fileSize = this.mCifsAccess.getFileSize((String) it.next());
+                    if (fileSize <= 0) {
+                        return -1L;
+                    }
+                    j += fileSize;
+                }
+                this.mCifsAccess.disconnectStorage();
+                this.mCifsAccess.free();
+                return Long.valueOf(j);
+            } finally {
+                this.mCifsAccess.disconnectStorage();
+                this.mCifsAccess.free();
+            }
+        }
+
+        /* access modifiers changed from: protected */
+        public void onPostExecute(Long l) {
+            if (l != null) {
+                if (l.longValue() == 0) {
+                    ConfirmReadMemcard.this.localShowDialog(ConfirmReadMemcard.DIALOG_COPY_RESULT_CANCEL);
+                } else if (l.longValue() < 0) {
+                    ConfirmReadMemcard.this.localShowDialog(ConfirmReadMemcard.DIALOG_COMMUNICATION_ERROR);
+                } else {
+                    ConfirmReadMemcard.this.updateFileSize(l.longValue());
+                }
+            }
+            ConfirmReadMemcard.this.mModelDialog.doDismiss(ConfirmReadMemcard.DIALOG_PROGRESS);
+        }
+
+        /* access modifiers changed from: protected */
+        public void onPreExecute() {
+            ConfirmReadMemcard.this.mModelDialog.doShow(ConfirmReadMemcard.DIALOG_PROGRESS);
+        }
+    }
+
+    class CheckAndNextActivityTask extends AsyncTask<Void, Void, Integer> {
+        CheckAndNextActivityTask() {
+        }
+
+        /* access modifiers changed from: protected */
+        public Integer doInBackground(Void... voidArr) {
+            if (ConfirmReadMemcard.this.mCopyTargetFolderName == null) {
+                return 100;
+            }
+            if (isCancelled()) {
+                return -1;
+            }
+            if (!ConfirmReadMemcard.this.checkFileSize()) {
+                return 1;
+            }
+            if (isCancelled()) {
+                return -1;
+            }
+            switch (EscprLibPrinter.checkIdleOrError(ConfirmReadMemcard.this, 60)) {
+                case 1:
+                    return 11;
+                case 2:
+                    return 10;
+                default:
+                    new File(ConfirmReadMemcard.this.mCopyTargetFolderName).mkdir();
+                    return 0;
+            }
+        }
+
+        /* access modifiers changed from: protected */
+        public void onCancelled() {
+            ConfirmReadMemcard.this.mModelDialog.doDismiss(ConfirmReadMemcard.DIALOG_PROGRESS);
+        }
+
+        /* access modifiers changed from: protected */
+        public void onPostExecute(Integer num) {
+            ConfirmReadMemcard.this.mModelDialog.doDismiss(ConfirmReadMemcard.DIALOG_PROGRESS);
+            switch (num.intValue()) {
+                case 0:
+                    ConfirmReadMemcard.this.startCopyActivity();
+                    return;
+                case 1:
+                    ConfirmReadMemcard.this.localShowDialog(ConfirmReadMemcard.DIALOG_DISK_SPACE_SHORTAGE);
+                    return;
+                case 10:
+                    ConfirmReadMemcard.this.localShowDialog(ConfirmReadMemcard.DIALOG_PRINTER_BUSY);
+                    return;
+                case 11:
+                    ConfirmReadMemcard.this.localShowDialog(ConfirmReadMemcard.DIALOG_COMMUNICATION_ERROR);
+                    return;
+                default:
+                    return;
+            }
+        }
+
+        /* access modifiers changed from: protected */
+        public void onPreExecute() {
+            ConfirmReadMemcard.this.mModelDialog.doShow(ConfirmReadMemcard.DIALOG_PROGRESS);
+            if (ConfirmReadMemcard.this.mCopyTargetFolderName == null) {
+                ConfirmReadMemcard.this.setTargetDirectory(MemcardConfig.DEFAULT_READER_LOCAL_DIRECTORY);
+            }
+        }
+    }
+}

+ 720 - 0
app/src/main/java/com/epson/memcardacc/ConfirmWriteMemcard.java

@@ -0,0 +1,720 @@
+package com.epson.memcardacc;
+
+import android.arch.lifecycle.Observer;
+import android.arch.lifecycle.ViewModelProviders;
+import android.content.Context;
+import android.content.Intent;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.p000v4.app.DialogFragment;
+import android.support.p000v4.app.FragmentActivity;
+import android.view.View;
+import android.widget.TextView;
+import com.epson.memcardacc.MemCardWriteConvertViewModel;
+import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
+import epson.common.DialogProgress;
+import epson.common.DialogProgressViewModel;
+import epson.print.ActivityIACommon;
+import epson.print.C2135R;
+import epson.print.MyPrinter;
+import epson.print.Util.EPLog;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Deque;
+import java.util.Locale;
+
+public class ConfirmWriteMemcard extends ActivityIACommon implements DialogProgress.DialogButtonClick {
+    private static final int ACTIVITY_TYPE_PROGRESS = 1;
+    private static final String DIALOG_CHECK_AND_NEXT = "dialog_check_and_next";
+    private static final String DIALOG_COMMUNICATION_ERROR = "dialog_communication_error";
+    private static final String DIALOG_COPY_RESULT_CANCEL = "dialog_copy_result_cancel";
+    private static final String DIALOG_COPY_RESULT_COMPLETE = "dialog_copy_result_complete";
+    private static final String DIALOG_COPY_RESULT_ERROR = "dialog_copy_result_error";
+    private static final String DIALOG_DISK_SPACE_SHORTAGE = "dialog_disk_space_shortage";
+    private static final String DIALOG_FILE_CONVERT = "dialog_file_convert";
+    private static final String DIALOG_FILE_WRITE_ERROR = "dialog_file_write_error";
+    private static final String DIALOG_PRINTER_BUSY = "dialog_printer_busy";
+    private static final String DIALOG_STORAGE_CONNECT_ERROR = "dialog_storage_connect_error";
+    private static final String DIALOG_TARGET_DIRECTORY_NAME_TASK = "dialog_target_directy_name_task";
+    static final int ERROR_COMMUNICATION_ERROR = 11;
+    static final int ERROR_FILE_WRITE_ERROR = 12;
+    static final int ERROR_MEMCARD_BUSY = 10;
+    private static final String KEY_IMAGE_LIST = "imagelist";
+    private static final String LOG_TAG = "ConfirmWriteMemcard";
+    public static final int RESULT_BACK_TO_MEMCARD_TOP = 1;
+    boolean doDirectoryNameTask = false;
+    boolean isKeepSimleApConnect = false;
+    boolean isTryConnectSimpleAp = false;
+    private CheckAndNextActivityTask mCheckAndNextActivity;
+    /* access modifiers changed from: private */
+    public String mCopyTargetFolderName;
+    /* access modifiers changed from: private */
+    public TextView mCopyTargetPathText;
+    private TextView mCopyTargetPrinter;
+    private DirectoryNameTask mDirectoryNameTask = null;
+    private TextView mFileNumText;
+    private TextView mFileSizeText;
+    private ArrayList<String> mImageList;
+    private int mMemcardStorageType;
+    /* access modifiers changed from: private */
+    public DialogProgressViewModel mModelDialog;
+    private long mTotalFileSize;
+
+    public void onCancelDialog(String str) {
+    }
+
+    public void onNeutralClick(String str) {
+    }
+
+    public void onPositiveClick(String str) {
+    }
+
+    @NonNull
+    public static Intent getStartIntent(@NonNull Context context, @NonNull ArrayList<String> arrayList) {
+        Intent intent = new Intent(context, ConfirmWriteMemcard.class);
+        intent.putStringArrayListExtra("imagelist", arrayList);
+        return intent;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        setContentView((int) C2135R.layout.activity_confirm_write_memcard);
+        this.mModelDialog = (DialogProgressViewModel) ViewModelProviders.m2of((FragmentActivity) this).get(DialogProgressViewModel.class);
+        this.mModelDialog.getDialogJob().observe(this, new Observer() {
+            public final void onChanged(Object obj) {
+                ConfirmWriteMemcard.lambda$onCreate$0(ConfirmWriteMemcard.this, (Deque) obj);
+            }
+        });
+        setActionBar((int) C2135R.string.memcard_title_copy_confirm, true);
+        this.mFileNumText = (TextView) findViewById(C2135R.C2137id.textFileNumber);
+        this.mFileSizeText = (TextView) findViewById(C2135R.C2137id.textFileSize);
+        this.mCopyTargetPrinter = (TextView) findViewById(C2135R.C2137id.textWritePrt);
+        this.mCopyTargetPathText = (TextView) findViewById(C2135R.C2137id.textWriteFolder);
+        this.mCopyTargetPathText.setText("");
+        this.mImageList = null;
+        this.mCopyTargetPrinter.setText(String.format(getResources().getString(C2135R.string.memcard_printer_save_to_format), new Object[]{MyPrinter.getCurPrinter(this).getName()}));
+        this.doDirectoryNameTask = true;
+        observeImageConvertFromIntent(getIntent());
+    }
+
+    public static /* synthetic */ void lambda$onCreate$0(ConfirmWriteMemcard confirmWriteMemcard, Deque deque) {
+        String[] checkQueue = confirmWriteMemcard.mModelDialog.checkQueue();
+        if (checkQueue != null) {
+            String str = checkQueue[0];
+            String str2 = checkQueue[1];
+            if (str2.equals("do_show")) {
+                confirmWriteMemcard.showDialog(str);
+            }
+            if (str2.equals("do_dismiss")) {
+                confirmWriteMemcard.dismissDialog(str);
+            }
+        }
+    }
+
+    private void observeImageConvertFromIntent(@Nullable Intent intent) {
+        if (intent == null) {
+            finish();
+            return;
+        }
+        ArrayList<String> startArgumentFileList = getStartArgumentFileList(intent);
+        if (startArgumentFileList == null) {
+            finish();
+            return;
+        }
+        updateFileInfo(startArgumentFileList);
+        observeImageConvert(startArgumentFileList);
+    }
+
+    private ArrayList<String> getStartArgumentFileList(@Nullable Intent intent) {
+        if (intent == null) {
+            return null;
+        }
+        return intent.getStringArrayListExtra("imagelist");
+    }
+
+    private void observeImageConvert(@NonNull ArrayList<String> arrayList) {
+        this.mModelDialog.doShow(DIALOG_FILE_CONVERT);
+        MemCardWriteConvertViewModel memCardWriteConvertViewModel = (MemCardWriteConvertViewModel) ViewModelProviders.m2of((FragmentActivity) this).get(MemCardWriteConvertViewModel.class);
+        memCardWriteConvertViewModel.setOrigFileList(arrayList);
+        memCardWriteConvertViewModel.getData().observe(this, new Observer<MemCardWriteConvertViewModel.ConvertResult>() {
+            public void onChanged(@Nullable MemCardWriteConvertViewModel.ConvertResult convertResult) {
+                ConfirmWriteMemcard.this.onUpdateViewModelData(convertResult);
+            }
+        });
+    }
+
+    /* access modifiers changed from: private */
+    public void onUpdateViewModelData(MemCardWriteConvertViewModel.ConvertResult convertResult) {
+        if (convertResult == null) {
+            finish();
+            return;
+        }
+        this.mModelDialog.doDismiss(DIALOG_FILE_CONVERT);
+        this.mTotalFileSize = convertResult.totalFileSize;
+        this.mImageList = new ArrayList<>(convertResult.filenameList);
+        updateFileInfo(this.mImageList);
+    }
+
+    private void updateFileInfo(@Nullable ArrayList<String> arrayList) {
+        this.mFileNumText.setText(String.format(getResources().getString(C2135R.string.memcard_file_num_format), new Object[]{Integer.valueOf(arrayList != null ? arrayList.size() : 0)}));
+        this.mFileSizeText.setText(String.format(getResources().getString(C2135R.string.memcard_total_file_size_format), new Object[]{Double.valueOf(((double) this.mTotalFileSize) / 1000000.0d)}));
+    }
+
+    /* access modifiers changed from: protected */
+    public void onResume() {
+        EPLog.m305d(LOG_TAG, "onResume()");
+        super.onResume();
+        if (!WiFiDirectManager.isNeedConnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER)) {
+            this.isTryConnectSimpleAp = false;
+        } else if (!this.isTryConnectSimpleAp) {
+            this.isTryConnectSimpleAp = true;
+            if (WiFiDirectManager.reconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, -1)) {
+                this.doDirectoryNameTask = true;
+                return;
+            }
+        }
+        this.isKeepSimleApConnect = false;
+        if (this.doDirectoryNameTask) {
+            this.mDirectoryNameTask = new DirectoryNameTask();
+            this.mDirectoryNameTask.execute(new Void[0]);
+            this.doDirectoryNameTask = false;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPause() {
+        super.onPause();
+        if (isFinishing()) {
+            deleteTemporallyFile();
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onStop() {
+        EPLog.m305d(LOG_TAG, "onStop()");
+        super.onStop();
+        if (!this.isKeepSimleApConnect) {
+            WiFiDirectManager.disconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, MemcardUtil.getPrinterIpAddress(this));
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public void setWriteDirName(String str) {
+        this.mCopyTargetFolderName = str;
+        if (str != null && this.mCopyTargetFolderName != null) {
+            runOnUiThread(new Runnable() {
+                public void run() {
+                    ConfirmWriteMemcard.this.mCopyTargetPathText.setText(String.format(ConfirmWriteMemcard.this.getResources().getString(C2135R.string.memcard_folder_save_to_format), new Object[]{ConfirmWriteMemcard.this.mCopyTargetFolderName}));
+                }
+            });
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public boolean isWirteDirNameDetermined() {
+        String str = this.mCopyTargetFolderName;
+        return str != null && str.length() > 0;
+    }
+
+    public void add_button_clicked(View view) {
+        LocalImageSelectActivity.startAddImageList(this, getStartArgumentFileList(getIntent()));
+        finish();
+    }
+
+    public void copy_button_clicked(View view) {
+        this.mCheckAndNextActivity = new CheckAndNextActivityTask();
+        this.mCheckAndNextActivity.execute(new Void[0]);
+    }
+
+    public void onBackPressed() {
+        setResult(1);
+        finish();
+    }
+
+    private void deleteTemporallyFile() {
+        ((MemCardWriteConvertViewModel) ViewModelProviders.m2of((FragmentActivity) this).get(MemCardWriteConvertViewModel.class)).deleteTempFile();
+    }
+
+    /* access modifiers changed from: private */
+    public int capacityCheck() {
+        EPLog.m313i(LOG_TAG, "in capacityCheck()");
+        CifsAccess instance = CifsAccess.getInstance();
+        try {
+            if (instance.initDefault(this, 1) == 0) {
+                return 2;
+            }
+            if (instance.connectDefaultStorageWidthDefaultAthInfo(this.mMemcardStorageType) == 0) {
+                instance.free();
+                return 2;
+            }
+            int unitSize = instance.getUnitSize();
+            long freeUnit = instance.getFreeUnit();
+            instance.disconnectStorage();
+            instance.free();
+            EPLog.m313i(LOG_TAG, "unit :<" + unitSize + "> free: <" + freeUnit + ">");
+            if ((this.mTotalFileSize / ((long) unitSize)) + ((long) this.mImageList.size()) > freeUnit) {
+                return 1;
+            }
+            return 0;
+        } finally {
+            instance.free();
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public String cifsGetTargetFoldername() {
+        CifsAccess instance = CifsAccess.getInstance();
+        try {
+            if (instance.initDefault(this, 1) == 0) {
+                return null;
+            }
+            int checkStorage = instance.checkStorage();
+            if (checkStorage == 0) {
+                instance.free();
+                return null;
+            }
+            this.mMemcardStorageType = checkStorage;
+            if (instance.connectDefaultStorageWidthDefaultAthInfo(checkStorage) == 0) {
+                instance.free();
+                return null;
+            }
+            String targetFolderName = getTargetFolderName(instance);
+            instance.disconnectStorage();
+            instance.free();
+            return targetFolderName;
+        } finally {
+            instance.free();
+        }
+    }
+
+    private String getTargetFolderName(CifsAccess cifsAccess) {
+        Calendar instance = Calendar.getInstance();
+        int createDirectory = cifsAccess.createDirectory(MemcardConfig.CIFS_WRITE_FOLDER);
+        if (createDirectory != -1203 && createDirectory != 0) {
+            return null;
+        }
+        for (int i = 0; i < 100; i++) {
+            String format = String.format(Locale.US, "\\EPIMG\\%04d%02d%02d%02d%02d%02d", new Object[]{Integer.valueOf(instance.get(1)), Integer.valueOf(instance.get(2) + 1), Integer.valueOf(instance.get(5)), Integer.valueOf(instance.get(11)), Integer.valueOf(instance.get(12)), Integer.valueOf(i)});
+            if (cifsAccess.createDirectory(format) == 0) {
+                cifsAccess.deleteDirectory(format);
+                return format;
+            }
+            EPLog.m313i(LOG_TAG, "CifsAccess.createDirectory() return <" + createDirectory + ">");
+        }
+        return null;
+    }
+
+    /* access modifiers changed from: private */
+    public void startCopyActivity() {
+        Intent intent = new Intent(this, MemcardWriteProgress.class);
+        intent.putStringArrayListExtra("imageList", this.mImageList);
+        intent.putExtra("target_folder_name", this.mCopyTargetFolderName);
+        intent.putExtra("memcard_storage_type", this.mMemcardStorageType);
+        startActivityForResult(intent, 1);
+        this.isKeepSimleApConnect = true;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onActivityResult(int i, int i2, Intent intent) {
+        if (i == 1) {
+            this.isKeepSimleApConnect = false;
+            if (i2 == -2) {
+                loggerCountUp();
+                setResult(1);
+                deleteTemporallyFile();
+                finish();
+            } else if (i2 != 0) {
+                localShowDialog(DIALOG_COPY_RESULT_ERROR);
+            }
+        }
+    }
+
+    private void loggerCountUp() {
+        this.mImageList.size();
+    }
+
+    /* access modifiers changed from: package-private */
+    public void localShowDialog(String str) {
+        this.mModelDialog.doShow(str);
+    }
+
+    /* JADX WARNING: Can't fix incorrect switch cases order */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    private void showDialog(java.lang.String r11) {
+        /*
+            r10 = this;
+            int r0 = r11.hashCode()
+            r1 = 0
+            switch(r0) {
+                case -2116590872: goto L_0x0066;
+                case -2049655319: goto L_0x005b;
+                case -2003975289: goto L_0x0051;
+                case -1628437111: goto L_0x0047;
+                case -797044744: goto L_0x003d;
+                case 976257404: goto L_0x0033;
+                case 1194959080: goto L_0x0028;
+                case 1429177493: goto L_0x001e;
+                case 1442112211: goto L_0x0014;
+                case 2132918151: goto L_0x000a;
+                default: goto L_0x0008;
+            }
+        L_0x0008:
+            goto L_0x0070
+        L_0x000a:
+            java.lang.String r0 = "dialog_file_convert"
+            boolean r0 = r11.equals(r0)
+            if (r0 == 0) goto L_0x0070
+            r0 = 0
+            goto L_0x0071
+        L_0x0014:
+            java.lang.String r0 = "dialog_target_directy_name_task"
+            boolean r0 = r11.equals(r0)
+            if (r0 == 0) goto L_0x0070
+            r0 = 1
+            goto L_0x0071
+        L_0x001e:
+            java.lang.String r0 = "dialog_printer_busy"
+            boolean r0 = r11.equals(r0)
+            if (r0 == 0) goto L_0x0070
+            r0 = 5
+            goto L_0x0071
+        L_0x0028:
+            java.lang.String r0 = "dialog_copy_result_complete"
+            boolean r0 = r11.equals(r0)
+            if (r0 == 0) goto L_0x0070
+            r0 = 8
+            goto L_0x0071
+        L_0x0033:
+            java.lang.String r0 = "dialog_file_write_error"
+            boolean r0 = r11.equals(r0)
+            if (r0 == 0) goto L_0x0070
+            r0 = 6
+            goto L_0x0071
+        L_0x003d:
+            java.lang.String r0 = "dialog_storage_connect_error"
+            boolean r0 = r11.equals(r0)
+            if (r0 == 0) goto L_0x0070
+            r0 = 4
+            goto L_0x0071
+        L_0x0047:
+            java.lang.String r0 = "dialog_check_and_next"
+            boolean r0 = r11.equals(r0)
+            if (r0 == 0) goto L_0x0070
+            r0 = 2
+            goto L_0x0071
+        L_0x0051:
+            java.lang.String r0 = "dialog_disk_space_shortage"
+            boolean r0 = r11.equals(r0)
+            if (r0 == 0) goto L_0x0070
+            r0 = 3
+            goto L_0x0071
+        L_0x005b:
+            java.lang.String r0 = "dialog_copy_result_cancel"
+            boolean r0 = r11.equals(r0)
+            if (r0 == 0) goto L_0x0070
+            r0 = 9
+            goto L_0x0071
+        L_0x0066:
+            java.lang.String r0 = "dialog_communication_error"
+            boolean r0 = r11.equals(r0)
+            if (r0 == 0) goto L_0x0070
+            r0 = 7
+            goto L_0x0071
+        L_0x0070:
+            r0 = -1
+        L_0x0071:
+            r2 = 2131625202(0x7f0e04f2, float:1.8877605E38)
+            switch(r0) {
+                case 0: goto L_0x0154;
+                case 1: goto L_0x0145;
+                case 2: goto L_0x0136;
+                case 3: goto L_0x011a;
+                case 4: goto L_0x00fe;
+                case 5: goto L_0x00e2;
+                case 6: goto L_0x00c5;
+                case 7: goto L_0x00a9;
+                case 8: goto L_0x0090;
+                case 9: goto L_0x007a;
+                default: goto L_0x0077;
+            }
+        L_0x0077:
+            r0 = 0
+            goto L_0x015d
+        L_0x007a:
+            r4 = 2
+            r0 = 2131624893(0x7f0e03bd, float:1.8876979E38)
+            java.lang.String r5 = r10.getString(r0)
+            r6 = 0
+            java.lang.String r7 = r10.getString(r2)
+            r8 = 0
+            r9 = 0
+            r3 = r11
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r3, r4, r5, r6, r7, r8, r9)
+            goto L_0x015d
+        L_0x0090:
+            r3 = 2
+            r0 = 2131624890(0x7f0e03ba, float:1.8876972E38)
+            java.lang.String r4 = r10.getString(r0)
+            r5 = 0
+            r6 = 0
+            r7 = 0
+            java.lang.String r8 = r10.getString(r2)
+            r2 = r11
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r2, r3, r4, r5, r6, r7, r8)
+            r0.setCancelable(r1)
+            goto L_0x015d
+        L_0x00a9:
+            r3 = 2
+            r0 = 2131624886(0x7f0e03b6, float:1.8876964E38)
+            java.lang.String r4 = r10.getString(r0)
+            r0 = 2131624887(0x7f0e03b7, float:1.8876966E38)
+            java.lang.String r5 = r10.getString(r0)
+            java.lang.String r6 = r10.getString(r2)
+            r7 = 0
+            r8 = 0
+            r2 = r11
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r2, r3, r4, r5, r6, r7, r8)
+            goto L_0x015d
+        L_0x00c5:
+            r0 = 2
+            r1 = 2131624896(0x7f0e03c0, float:1.8876985E38)
+            java.lang.String r3 = r10.getString(r1)
+            r1 = 2131624897(0x7f0e03c1, float:1.8876987E38)
+            java.lang.String r4 = r10.getString(r1)
+            java.lang.String r5 = r10.getString(r2)
+            r6 = 0
+            r7 = 0
+            r1 = r11
+            r2 = r0
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r1, r2, r3, r4, r5, r6, r7)
+            goto L_0x015d
+        L_0x00e2:
+            r0 = 2
+            r1 = 2131624471(0x7f0e0217, float:1.8876123E38)
+            java.lang.String r3 = r10.getString(r1)
+            r1 = 2131624472(0x7f0e0218, float:1.8876125E38)
+            java.lang.String r4 = r10.getString(r1)
+            java.lang.String r5 = r10.getString(r2)
+            r6 = 0
+            r7 = 0
+            r1 = r11
+            r2 = r0
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r1, r2, r3, r4, r5, r6, r7)
+            goto L_0x015d
+        L_0x00fe:
+            r0 = 2
+            r1 = 2131624902(0x7f0e03c6, float:1.8876997E38)
+            java.lang.String r3 = r10.getString(r1)
+            r1 = 2131624903(0x7f0e03c7, float:1.8876999E38)
+            java.lang.String r4 = r10.getString(r1)
+            java.lang.String r5 = r10.getString(r2)
+            r6 = 0
+            r7 = 0
+            r1 = r11
+            r2 = r0
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r1, r2, r3, r4, r5, r6, r7)
+            goto L_0x015d
+        L_0x011a:
+            r0 = 2
+            r1 = 2131624883(0x7f0e03b3, float:1.8876958E38)
+            java.lang.String r3 = r10.getString(r1)
+            r1 = 2131624884(0x7f0e03b4, float:1.887696E38)
+            java.lang.String r4 = r10.getString(r1)
+            java.lang.String r5 = r10.getString(r2)
+            r6 = 0
+            r7 = 0
+            r1 = r11
+            r2 = r0
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r1, r2, r3, r4, r5, r6, r7)
+            goto L_0x015d
+        L_0x0136:
+            r0 = 2131624885(0x7f0e03b5, float:1.8876962E38)
+            java.lang.String r0 = r10.getString(r0)
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r11, r1, r0)
+            r0.setCancelable(r1)
+            goto L_0x015d
+        L_0x0145:
+            r0 = 2131624888(0x7f0e03b8, float:1.8876968E38)
+            java.lang.String r0 = r10.getString(r0)
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r11, r1, r0)
+            r0.setCancelable(r1)
+            goto L_0x015d
+        L_0x0154:
+            java.lang.String r0 = ""
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r11, r1, r0)
+            r0.setCancelable(r1)
+        L_0x015d:
+            if (r0 == 0) goto L_0x0166
+            android.support.v4.app.FragmentManager r1 = r10.getSupportFragmentManager()
+            r0.show(r1, r11)
+        L_0x0166:
+            return
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.memcardacc.ConfirmWriteMemcard.showDialog(java.lang.String):void");
+    }
+
+    private void dismissDialog(String str) {
+        DialogFragment dialogFragment = (DialogFragment) getSupportFragmentManager().findFragmentByTag(str);
+        if (dialogFragment != null) {
+            dialogFragment.dismiss();
+        }
+    }
+
+    /* JADX WARNING: Removed duplicated region for block: B:12:0x002a  */
+    /* JADX WARNING: Removed duplicated region for block: B:13:0x0039  */
+    /* JADX WARNING: Removed duplicated region for block: B:16:? A[RETURN, SYNTHETIC] */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    public void onNegativeClick(java.lang.String r5) {
+        /*
+            r4 = this;
+            int r0 = r5.hashCode()
+            r1 = -2049655319(0xffffffff85d4bde9, float:-2.0006146E-35)
+            r2 = 0
+            r3 = 1
+            if (r0 == r1) goto L_0x001b
+            r1 = 1194959080(0x4739a0e8, float:47520.906)
+            if (r0 == r1) goto L_0x0011
+            goto L_0x0025
+        L_0x0011:
+            java.lang.String r0 = "dialog_copy_result_complete"
+            boolean r5 = r5.equals(r0)
+            if (r5 == 0) goto L_0x0025
+            r5 = 0
+            goto L_0x0026
+        L_0x001b:
+            java.lang.String r0 = "dialog_copy_result_cancel"
+            boolean r5 = r5.equals(r0)
+            if (r5 == 0) goto L_0x0025
+            r5 = 1
+            goto L_0x0026
+        L_0x0025:
+            r5 = -1
+        L_0x0026:
+            switch(r5) {
+                case 0: goto L_0x0039;
+                case 1: goto L_0x002a;
+                default: goto L_0x0029;
+            }
+        L_0x0029:
+            goto L_0x003f
+        L_0x002a:
+            com.epson.memcardacc.ConfirmWriteMemcard$DirectoryNameTask r5 = new com.epson.memcardacc.ConfirmWriteMemcard$DirectoryNameTask
+            r5.<init>()
+            r4.mDirectoryNameTask = r5
+            com.epson.memcardacc.ConfirmWriteMemcard$DirectoryNameTask r5 = r4.mDirectoryNameTask
+            java.lang.Void[] r0 = new java.lang.Void[r2]
+            r5.execute(r0)
+            goto L_0x003f
+        L_0x0039:
+            r4.setResult(r3)
+            r4.finish()
+        L_0x003f:
+            return
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.memcardacc.ConfirmWriteMemcard.onNegativeClick(java.lang.String):void");
+    }
+
+    class DirectoryNameTask extends AsyncTask<Void, Integer, String> {
+        /* access modifiers changed from: protected */
+        public void onProgressUpdate(Integer... numArr) {
+        }
+
+        DirectoryNameTask() {
+        }
+
+        /* access modifiers changed from: protected */
+        public void onPostExecute(String str) {
+            if (str == null) {
+                ConfirmWriteMemcard.this.setWriteDirName("");
+            } else {
+                ConfirmWriteMemcard.this.setWriteDirName(str);
+            }
+            ConfirmWriteMemcard.this.mModelDialog.doDismiss(ConfirmWriteMemcard.DIALOG_TARGET_DIRECTORY_NAME_TASK);
+        }
+
+        /* access modifiers changed from: protected */
+        public void onPreExecute() {
+            ConfirmWriteMemcard.this.mModelDialog.doShow(ConfirmWriteMemcard.DIALOG_TARGET_DIRECTORY_NAME_TASK);
+        }
+
+        /* access modifiers changed from: protected */
+        public String doInBackground(Void... voidArr) {
+            return ConfirmWriteMemcard.this.cifsGetTargetFoldername();
+        }
+    }
+
+    class CheckAndNextActivityTask extends AsyncTask<Void, Void, Integer> {
+        CheckAndNextActivityTask() {
+        }
+
+        /* access modifiers changed from: protected */
+        public Integer doInBackground(Void... voidArr) {
+            if (isCancelled()) {
+                return -1;
+            }
+            switch (EscprLibPrinter.checkIdleOrError(ConfirmWriteMemcard.this, 60)) {
+                case 1:
+                    return 11;
+                case 2:
+                    return 10;
+                default:
+                    if (!ConfirmWriteMemcard.this.isWirteDirNameDetermined()) {
+                        String cifsGetTargetFoldername = ConfirmWriteMemcard.this.cifsGetTargetFoldername();
+                        if (cifsGetTargetFoldername == null || cifsGetTargetFoldername.length() <= 0) {
+                            return 12;
+                        }
+                        ConfirmWriteMemcard.this.setWriteDirName(cifsGetTargetFoldername);
+                    }
+                    int access$400 = ConfirmWriteMemcard.this.capacityCheck();
+                    if (access$400 != 0) {
+                        return Integer.valueOf(access$400);
+                    }
+                    return 0;
+            }
+        }
+
+        /* access modifiers changed from: protected */
+        public void onCancelled() {
+            ConfirmWriteMemcard.this.mModelDialog.doDismiss(ConfirmWriteMemcard.DIALOG_CHECK_AND_NEXT);
+        }
+
+        /* access modifiers changed from: protected */
+        public void onPostExecute(Integer num) {
+            ConfirmWriteMemcard.this.mModelDialog.doDismiss(ConfirmWriteMemcard.DIALOG_CHECK_AND_NEXT);
+            int intValue = num.intValue();
+            switch (intValue) {
+                case 0:
+                    ConfirmWriteMemcard.this.startCopyActivity();
+                    return;
+                case 1:
+                    ConfirmWriteMemcard.this.localShowDialog(ConfirmWriteMemcard.DIALOG_DISK_SPACE_SHORTAGE);
+                    return;
+                case 2:
+                    ConfirmWriteMemcard.this.localShowDialog(ConfirmWriteMemcard.DIALOG_STORAGE_CONNECT_ERROR);
+                    return;
+                default:
+                    switch (intValue) {
+                        case 10:
+                            ConfirmWriteMemcard.this.localShowDialog(ConfirmWriteMemcard.DIALOG_PRINTER_BUSY);
+                            return;
+                        case 11:
+                            ConfirmWriteMemcard.this.localShowDialog(ConfirmWriteMemcard.DIALOG_COMMUNICATION_ERROR);
+                            return;
+                        case 12:
+                            ConfirmWriteMemcard.this.localShowDialog(ConfirmWriteMemcard.DIALOG_FILE_WRITE_ERROR);
+                            return;
+                        default:
+                            return;
+                    }
+            }
+        }
+
+        /* access modifiers changed from: protected */
+        public void onPreExecute() {
+            ConfirmWriteMemcard.this.mModelDialog.doShow(ConfirmWriteMemcard.DIALOG_CHECK_AND_NEXT);
+        }
+    }
+}

+ 389 - 0
app/src/main/java/com/epson/memcardacc/CopyTask.java

@@ -0,0 +1,389 @@
+package com.epson.memcardacc;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import com.epson.iprint.prtlogger.CommonLog;
+import epson.print.Util.AsyncTaskExecutor;
+import epson.print.Util.EPLog;
+import java.util.ArrayList;
+
+/* compiled from: MemcardWriteProgress */
+class CopyTask extends AsyncTaskExecutor<Void, Integer, Integer> {
+    private static final String LOG_TAG = "CopyTask";
+    MemcardWriteProgress mCallback;
+    private boolean mCanceling;
+    CifsAccess mCifsAccess = CifsAccess.getInstance();
+    private int mCifsAccessStorageType;
+    private int mErrorCode = 0;
+    private boolean mEscprCheck = false;
+    private ArrayList<String> mImageList;
+    private CommonLog mLogData;
+    private int mMemcardStorageType;
+    private String mTargetFolderName;
+    private ArrayList<String> mWriteFileList;
+
+    public CopyTask(@NonNull MemcardWriteProgress memcardWriteProgress, int i, int i2, @NonNull ArrayList<String> arrayList, @NonNull ArrayList<String> arrayList2, @NonNull String str, @Nullable CommonLog commonLog) {
+        this.mCallback = memcardWriteProgress;
+        this.mCifsAccessStorageType = i;
+        this.mMemcardStorageType = i2;
+        this.mImageList = arrayList;
+        this.mWriteFileList = arrayList2;
+        this.mTargetFolderName = str;
+        this.mLogData = commonLog;
+    }
+
+    public void setCheck(boolean z, boolean z2) {
+        this.mEscprCheck = z;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCancelled() {
+        EPLog.m313i(LOG_TAG, "canceled in AsyncTask");
+        this.mCallback.finishWithState(0, 0, this.mLogData);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPostExecute(Integer num) {
+        EPLog.m313i(LOG_TAG, "onPostExecute in AsyncTask");
+        this.mCallback.finishWithState(num.intValue(), this.mErrorCode, this.mLogData);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPreExecute() {
+        this.mCanceling = false;
+        this.mCallback.setProgress(0, this.mImageList.size());
+    }
+
+    /* access modifiers changed from: protected */
+    public void onProgressUpdate(Integer... numArr) {
+        this.mCallback.setProgress(numArr[0].intValue(), this.mImageList.size());
+    }
+
+    /* access modifiers changed from: protected */
+    public EscprLibPrinter getEscprLibPrinter() {
+        return new EscprLibPrinter();
+    }
+
+    private int checkPrinterByEscprLib(Context context) {
+        EscprLibPrinter escprLibPrinter = getEscprLibPrinter();
+        if (escprLibPrinter.init(context, 60, true) != 0) {
+            return 1;
+        }
+        int status = escprLibPrinter.getStatus();
+        escprLibPrinter.release();
+        return (status == 0 || status == 4) ? 0 : 2;
+    }
+
+    /* access modifiers changed from: protected */
+    /* JADX WARNING: Code restructure failed: missing block: B:68:0x00e5, code lost:
+        r8 = move-exception;
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:69:0x00e6, code lost:
+        r7.mCifsAccess.free();
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:70:0x00eb, code lost:
+        throw r8;
+     */
+    /* JADX WARNING: Removed duplicated region for block: B:68:0x00e5 A[ExcHandler: all (r8v5 'th' java.lang.Throwable A[CUSTOM_DECLARE]), Splitter:B:21:0x003e] */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    public java.lang.Integer doInBackground(java.lang.Void... r8) {
+        /*
+            r7 = this;
+            r8 = 3
+            com.epson.memcardacc.MemcardWriteProgress r0 = r7.mCallback     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            boolean r0 = r0.waitWifiConnect()     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            if (r0 != 0) goto L_0x0013
+            java.lang.Integer r8 = java.lang.Integer.valueOf(r8)     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess
+            r0.free()
+            return r8
+        L_0x0013:
+            boolean r0 = r7.isCancelled()     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            r1 = 0
+            if (r0 == 0) goto L_0x0024
+            java.lang.Integer r8 = java.lang.Integer.valueOf(r1)     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess
+            r0.free()
+            return r8
+        L_0x0024:
+            boolean r0 = r7.mEscprCheck     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            if (r0 == 0) goto L_0x003e
+            com.epson.memcardacc.MemcardWriteProgress r0 = r7.mCallback     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            int r0 = r7.checkPrinterByEscprLib(r0)     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            r7.mErrorCode = r0     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            int r0 = r7.mErrorCode     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            if (r0 == 0) goto L_0x003e
+            java.lang.Integer r8 = java.lang.Integer.valueOf(r8)     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess
+            r0.free()
+            return r8
+        L_0x003e:
+            boolean r0 = r7.isCancelled()     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            if (r0 == 0) goto L_0x004e
+            java.lang.Integer r8 = java.lang.Integer.valueOf(r1)     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess
+            r0.free()
+            return r8
+        L_0x004e:
+            com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            com.epson.memcardacc.MemcardWriteProgress r1 = r7.mCallback     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            int r2 = r7.mCifsAccessStorageType     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            int r0 = r0.initDefault(r1, r2)     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            if (r0 != 0) goto L_0x0064
+            java.lang.Integer r8 = java.lang.Integer.valueOf(r8)     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess
+            r0.free()
+            return r8
+        L_0x0064:
+            com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            int r1 = r7.mMemcardStorageType     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            int r0 = r0.connectDefaultStorageWidthDefaultAthInfo(r1)     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            r1 = 1
+            r2 = -1100(0xfffffffffffffbb4, float:NaN)
+            if (r0 != 0) goto L_0x0088
+            com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            int r0 = r0.getErrorCode()     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            if (r0 != r2) goto L_0x007c
+            r7.mErrorCode = r1     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            goto L_0x007e
+        L_0x007c:
+            r7.mErrorCode = r8     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+        L_0x007e:
+            java.lang.Integer r8 = java.lang.Integer.valueOf(r8)     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess
+            r0.free()
+            return r8
+        L_0x0088:
+            com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            long r3 = r0.getFreeUnit()     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            r5 = 0
+            int r0 = (r3 > r5 ? 1 : (r3 == r5 ? 0 : -1))
+            if (r0 >= 0) goto L_0x00a0
+            r7.mErrorCode = r8     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            java.lang.Integer r8 = java.lang.Integer.valueOf(r8)     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess
+            r0.free()
+            return r8
+        L_0x00a0:
+            java.lang.String r0 = r7.mTargetFolderName     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            int r0 = r0.length()     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            if (r0 <= 0) goto L_0x00d0
+            com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            java.lang.String r3 = r7.mTargetFolderName     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            int r0 = r0.createDirectory(r3)     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            if (r0 == 0) goto L_0x00cf
+            r3 = -1203(0xfffffffffffffb4d, float:NaN)
+            if (r0 == r3) goto L_0x00cf
+            if (r0 != r2) goto L_0x00bb
+            r7.mErrorCode = r1     // Catch:{ Exception -> 0x00cd, all -> 0x00e5 }
+            goto L_0x00be
+        L_0x00bb:
+            r1 = 4
+            r7.mErrorCode = r1     // Catch:{ Exception -> 0x00cd, all -> 0x00e5 }
+        L_0x00be:
+            com.epson.memcardacc.CifsAccess r1 = r7.mCifsAccess     // Catch:{ Exception -> 0x00cd, all -> 0x00e5 }
+            r1.disconnectStorage()     // Catch:{ Exception -> 0x00cd, all -> 0x00e5 }
+            java.lang.Integer r8 = java.lang.Integer.valueOf(r8)     // Catch:{ Exception -> 0x00cd, all -> 0x00e5 }
+            com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess
+            r0.free()
+            return r8
+        L_0x00cd:
+            r8 = r0
+            goto L_0x00ec
+        L_0x00cf:
+            r8 = r0
+        L_0x00d0:
+            int r8 = r7.copyFile()     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            r0.disconnectStorage()     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            com.epson.iprint.prtlogger.CommonLog r0 = r7.mLogData     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            com.epson.memcardacc.MemcardWriteProgress r1 = r7.mCallback     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            android.content.Context r1 = r1.getApplicationContext()     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            r0.setConnectionType(r1)     // Catch:{ Exception -> 0x00ec, all -> 0x00e5 }
+            goto L_0x00ec
+        L_0x00e5:
+            r8 = move-exception
+            com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess
+            r0.free()
+            throw r8
+        L_0x00ec:
+            com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess
+            r0.free()
+            java.lang.Integer r8 = java.lang.Integer.valueOf(r8)
+            return r8
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.memcardacc.CopyTask.doInBackground(java.lang.Void[]):java.lang.Integer");
+    }
+
+    /* access modifiers changed from: protected */
+    /* JADX WARNING: Removed duplicated region for block: B:30:0x00ae  */
+    /* JADX WARNING: Removed duplicated region for block: B:47:0x00f8  */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    public int copyFile() {
+        /*
+            r13 = this;
+            java.util.ArrayList<java.lang.String> r0 = r13.mImageList
+            java.util.Iterator r0 = r0.iterator()
+            r1 = 0
+            r2 = 0
+        L_0x0008:
+            boolean r3 = r0.hasNext()
+            r4 = -2
+            if (r3 == 0) goto L_0x00fe
+            boolean r3 = r13.isCancelled()
+            if (r3 == 0) goto L_0x0016
+            return r1
+        L_0x0016:
+            r13.localPublishProgress(r2)
+            java.lang.Object r3 = r0.next()
+            java.lang.String r3 = (java.lang.String) r3
+            java.util.ArrayList<java.lang.String> r5 = r13.mWriteFileList
+            r6 = 2
+            r7 = 1
+            if (r5 == 0) goto L_0x003c
+            java.lang.Object r5 = r5.get(r2)
+            java.lang.String r5 = (java.lang.String) r5
+            java.util.Locale r8 = java.util.Locale.US
+            java.lang.String r9 = "%s\\%s"
+            java.lang.Object[] r6 = new java.lang.Object[r6]
+            java.lang.String r10 = r13.mTargetFolderName
+            r6[r1] = r10
+            r6[r7] = r5
+            java.lang.String r5 = java.lang.String.format(r8, r9, r6)
+            goto L_0x0050
+        L_0x003c:
+            java.util.Locale r5 = java.util.Locale.US
+            java.lang.String r8 = "%s\\IMG_%04d.JPG"
+            java.lang.Object[] r6 = new java.lang.Object[r6]
+            java.lang.String r9 = r13.mTargetFolderName
+            r6[r1] = r9
+            java.lang.Integer r9 = java.lang.Integer.valueOf(r2)
+            r6[r7] = r9
+            java.lang.String r5 = java.lang.String.format(r5, r8, r6)
+        L_0x0050:
+            int r2 = r2 + 1
+            java.lang.String r6 = "MemcardWriteProgress"
+            java.lang.StringBuilder r8 = new java.lang.StringBuilder
+            r8.<init>()
+            java.lang.String r9 = "copy "
+            r8.append(r9)
+            r8.append(r3)
+            java.lang.String r9 = " => "
+            r8.append(r9)
+            r8.append(r5)
+            java.lang.String r8 = r8.toString()
+            epson.print.Util.EPLog.m313i(r6, r8)
+            long r8 = com.epson.memcardacc.MemcardUtil.getFileLength(r3)
+            r10 = 2147483647(0x7fffffff, double:1.060997895E-314)
+            r6 = 3
+            int r12 = (r8 > r10 ? 1 : (r8 == r10 ? 0 : -1))
+            if (r12 <= 0) goto L_0x0080
+            r0 = 5
+            r13.mErrorCode = r0
+            return r6
+        L_0x0080:
+            r10 = -1203(0xfffffffffffffb4d, float:NaN)
+            com.epson.memcardacc.CifsAccess r11 = r13.mCifsAccess     // Catch:{ UnsupportedEncodingException -> 0x00a7 }
+            int r9 = (int) r8     // Catch:{ UnsupportedEncodingException -> 0x00a7 }
+            int r8 = r11.writeToPrinterMemcard(r3, r5, r9)     // Catch:{ UnsupportedEncodingException -> 0x00a7 }
+            java.util.ArrayList<java.lang.String> r11 = r13.mWriteFileList     // Catch:{ UnsupportedEncodingException -> 0x00a5 }
+            if (r11 == 0) goto L_0x00ac
+            if (r8 == 0) goto L_0x00ac
+            if (r8 == r4) goto L_0x00ac
+            com.epson.memcardacc.CifsAccess r11 = r13.mCifsAccess     // Catch:{ UnsupportedEncodingException -> 0x00a5 }
+            int r11 = r11.getErrorCode()     // Catch:{ UnsupportedEncodingException -> 0x00a5 }
+            if (r11 != r10) goto L_0x00ac
+            com.epson.memcardacc.CifsAccess r11 = r13.mCifsAccess     // Catch:{ UnsupportedEncodingException -> 0x00a5 }
+            r11.deleteFile(r5)     // Catch:{ UnsupportedEncodingException -> 0x00a5 }
+            com.epson.memcardacc.CifsAccess r11 = r13.mCifsAccess     // Catch:{ UnsupportedEncodingException -> 0x00a5 }
+            int r8 = r11.writeToPrinterMemcard(r3, r5, r9)     // Catch:{ UnsupportedEncodingException -> 0x00a5 }
+            goto L_0x00ac
+        L_0x00a5:
+            r9 = move-exception
+            goto L_0x00a9
+        L_0x00a7:
+            r9 = move-exception
+            r8 = 0
+        L_0x00a9:
+            r9.printStackTrace()
+        L_0x00ac:
+            if (r8 == 0) goto L_0x00f8
+            java.lang.String r9 = "MemcardWriteProgress"
+            java.lang.StringBuilder r11 = new java.lang.StringBuilder
+            r11.<init>()
+            java.lang.String r12 = "writeFromPrinterMemcard() returns <"
+            r11.append(r12)
+            r11.append(r8)
+            java.lang.String r12 = ">"
+            r11.append(r12)
+            java.lang.String r11 = r11.toString()
+            epson.print.Util.EPLog.m318w((java.lang.String) r9, (java.lang.String) r11)
+            if (r8 != r4) goto L_0x00d1
+            com.epson.memcardacc.CifsAccess r0 = r13.mCifsAccess
+            r0.deleteFile(r5)
+            return r1
+        L_0x00d1:
+            com.epson.memcardacc.CifsAccess r4 = r13.mCifsAccess
+            int r4 = r4.getErrorCode()
+            r8 = 4
+            if (r4 != r10) goto L_0x00e9
+            java.util.ArrayList<java.lang.String> r4 = r13.mWriteFileList
+            if (r4 != 0) goto L_0x00e6
+            boolean r3 = r13.checkFileSize(r3, r5)
+            if (r3 == 0) goto L_0x00e6
+            goto L_0x0008
+        L_0x00e6:
+            r13.mErrorCode = r8
+            return r6
+        L_0x00e9:
+            com.epson.memcardacc.CifsAccess r0 = r13.mCifsAccess
+            r0.deleteFile(r5)
+            r0 = -1100(0xfffffffffffffbb4, float:NaN)
+            if (r4 != r0) goto L_0x00f5
+            r13.mErrorCode = r7
+            goto L_0x00f7
+        L_0x00f5:
+            r13.mErrorCode = r8
+        L_0x00f7:
+            return r6
+        L_0x00f8:
+            com.epson.iprint.prtlogger.CommonLog r3 = r13.mLogData
+            r3.numberOfSheet = r2
+            goto L_0x0008
+        L_0x00fe:
+            return r4
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.memcardacc.CopyTask.copyFile():int");
+    }
+
+    /* access modifiers changed from: protected */
+    public void localPublishProgress(int i) {
+        publishProgress(new Integer[]{Integer.valueOf(i)});
+    }
+
+    /* access modifiers changed from: protected */
+    public boolean checkFileSize(String str, String str2) {
+        long fileLength = MemcardUtil.getFileLength(str);
+        long fileSize = this.mCifsAccess.getFileSize(str2);
+        return fileSize > 0 && fileLength == fileSize;
+    }
+
+    public void taskCancel() {
+        if (!this.mCanceling) {
+            this.mCanceling = true;
+            EPLog.m313i(LOG_TAG, "taskCancel()");
+            this.mCifsAccess.cancel();
+            cancel(false);
+        }
+    }
+
+    public void taskCancelByFileSizeZero() {
+        if (!this.mCanceling) {
+            this.mCanceling = true;
+            EPLog.m313i(LOG_TAG, "taskCancel()");
+            this.mCifsAccess.cancelByFileSizeZero();
+            cancel(false);
+        }
+    }
+}

+ 24 - 0
app/src/main/java/com/epson/memcardacc/DirectoryCache.java

@@ -0,0 +1,24 @@
+package com.epson.memcardacc;
+
+import java.util.LinkedList;
+
+public class DirectoryCache {
+    LimitedHashMap<String, LinkedList<CifsFileInfo>> mCacheHashMap = new LimitedHashMap<>();
+    CifsAccess mCifsAccess;
+
+    public void setCifsAccess(CifsAccess cifsAccess) {
+        this.mCifsAccess = cifsAccess;
+    }
+
+    public LinkedList<CifsFileInfo> getFileList(String str) {
+        LinkedList<CifsFileInfo> linkedList = (LinkedList) this.mCacheHashMap.get(str);
+        if (linkedList != null) {
+            return linkedList;
+        }
+        LinkedList<CifsFileInfo> fileList = this.mCifsAccess.getFileList(str);
+        if (fileList != null) {
+            this.mCacheHashMap.put(str, fileList);
+        }
+        return fileList;
+    }
+}

+ 122 - 0
app/src/main/java/com/epson/memcardacc/DirectorySelecterActivity.java

@@ -0,0 +1,122 @@
+package com.epson.memcardacc;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.os.Bundle;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+import epson.print.C2135R;
+import epson.print.CommonDefine;
+import java.io.File;
+
+public class DirectorySelecterActivity extends Activity {
+    private static final int DIALOG_FILE_NAME_INVALID = 1;
+    public static final String PARAM_BASE_DIRECTORY = "baseDirectory";
+    public static final String PARAM_DEFAULT_DIR = "default";
+    public static final String RESULT_DIRECTORY = "resultDirectory";
+    TextView mBaseDirTextView;
+    boolean mButtonActionProgress;
+    Button mOkButton;
+    EditText mTargetDir;
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        setContentView(C2135R.layout.activity_directory_selecter);
+        setTitle(getResources().getText(C2135R.string.memcard_folder_save_to_string));
+        this.mBaseDirTextView = (TextView) findViewById(C2135R.C2137id.baseDirText);
+        this.mTargetDir = (EditText) findViewById(C2135R.C2137id.memcardUsername);
+        this.mOkButton = (Button) findViewById(C2135R.C2137id.okButton);
+        Intent intent = getIntent();
+        String stringExtra = intent.getStringExtra(PARAM_BASE_DIRECTORY);
+        String stringExtra2 = intent.getStringExtra(PARAM_DEFAULT_DIR);
+        TextView textView = this.mBaseDirTextView;
+        textView.setText(stringExtra + CommonDefine.SLASH);
+        this.mTargetDir.setText(stringExtra2);
+        this.mTargetDir.addTextChangedListener(new TargetDirTextWatcher());
+        this.mButtonActionProgress = false;
+    }
+
+    private void localShowDialog(int i) {
+        showDialog(i);
+    }
+
+    public void ok_button_clicked(View view) {
+        if (!this.mButtonActionProgress) {
+            this.mButtonActionProgress = true;
+            Intent intent = new Intent();
+            String obj = this.mTargetDir.getText().toString();
+            if (!MemcardUtil.checkFileName(obj)) {
+                localShowDialog(1);
+                this.mButtonActionProgress = false;
+                return;
+            }
+            File file = new File(new File(this.mBaseDirTextView.getText().toString()), obj);
+            if (file.exists() || file.mkdirs()) {
+                intent.putExtra(RESULT_DIRECTORY, obj);
+                setResult(-1, intent);
+                finish();
+                return;
+            }
+            localShowDialog(1);
+            this.mButtonActionProgress = false;
+        }
+    }
+
+    public void cancel_button_clicked(View view) {
+        if (!this.mButtonActionProgress) {
+            this.mButtonActionProgress = true;
+            setResult(0);
+            finish();
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public Dialog onCreateDialog(int i) {
+        if (i != 1) {
+            return null;
+        }
+        return new AlertDialog.Builder(this).setMessage(getString(C2135R.string.str_error_Filename)).setNegativeButton(getString(C2135R.string.str_ok), new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialogInterface, int i) {
+            }
+        }).create();
+    }
+
+    /* access modifiers changed from: package-private */
+    public void disableOkButton() {
+        this.mOkButton.setClickable(false);
+        this.mOkButton.setEnabled(false);
+    }
+
+    /* access modifiers changed from: package-private */
+    public void enableOkButton() {
+        this.mOkButton.setEnabled(true);
+        this.mOkButton.setClickable(true);
+    }
+
+    class TargetDirTextWatcher implements TextWatcher {
+        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
+        }
+
+        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
+        }
+
+        TargetDirTextWatcher() {
+        }
+
+        public void afterTextChanged(Editable editable) {
+            if (editable.length() <= 0) {
+                DirectorySelecterActivity.this.disableOkButton();
+            } else {
+                DirectorySelecterActivity.this.enableOkButton();
+            }
+        }
+    }
+}

+ 98 - 0
app/src/main/java/com/epson/memcardacc/EscprLibPrinter.java

@@ -0,0 +1,98 @@
+package com.epson.memcardacc;
+
+import android.content.Context;
+import com.epson.mobilephone.common.EpLog;
+import com.epson.mobilephone.common.maintain2.MaintainPrinter2;
+import epson.print.MyPrinter;
+
+public class EscprLibPrinter {
+    public static final int ERROR_PRINTER_CONNECTION = 2;
+    public static final int ERROR_PRINTER_LOCATION = 1;
+    public static final int NO_ERROR = 0;
+    public static final int STATUS_BUSY = 2;
+    public static final int STATUS_CANCELLING = 3;
+    public static final int STATUS_ERROR = 4;
+    public static final int STATUS_IDEL = 0;
+    public static final int STATUS_PRINTING = 1;
+    MaintainPrinter2 mMaintainPrinter;
+
+    public int init(Context context, int i, boolean z) {
+        EpLog.m76i();
+        MyPrinter currentPrinter = getCurrentPrinter(context);
+        String printerId = currentPrinter.getPrinterId();
+        String ip = currentPrinter.getIp();
+        int location = currentPrinter.getLocation();
+        if (location != 1 && location != 3) {
+            return 1;
+        }
+        this.mMaintainPrinter = getMaintainPrinter();
+        this.mMaintainPrinter.doInitDriver(context, 2);
+        if (this.mMaintainPrinter.doProbePrinter(i, printerId, ip, location) != 0) {
+            this.mMaintainPrinter = null;
+            return 2;
+        } else if (this.mMaintainPrinter.doSetPrinter() != 0) {
+            this.mMaintainPrinter = null;
+            return 2;
+        } else if (location == 1) {
+            String doGetIp = this.mMaintainPrinter.doGetIp();
+            if (ip.equals(doGetIp) || !z) {
+                return 0;
+            }
+            currentPrinter.setIp(doGetIp);
+            currentPrinter.setCurPrinter(context);
+            return 0;
+        } else if (location != 3 || printerId.equals(this.mMaintainPrinter.doGetId())) {
+            return 0;
+        } else {
+            this.mMaintainPrinter = null;
+            return 2;
+        }
+    }
+
+    public int getStatus() {
+        if (this.mMaintainPrinter.doGetStatus() != 0) {
+            return 4;
+        }
+        switch (this.mMaintainPrinter.getMPrinterInfor().getMStatus()[0]) {
+            case 0:
+                return 0;
+            case 1:
+                return 1;
+            case 2:
+                return 2;
+            case 3:
+                return 3;
+            default:
+                return 4;
+        }
+    }
+
+    public void release() {
+        if (this.mMaintainPrinter != null) {
+            this.mMaintainPrinter = null;
+        }
+    }
+
+    public static int checkIdleOrError(Context context, int i) {
+        EscprLibPrinter escprLibPrinter = new EscprLibPrinter();
+        if (escprLibPrinter.init(context, i, false) != 0) {
+            return 1;
+        }
+        int status = escprLibPrinter.getStatus();
+        escprLibPrinter.release();
+        if (status == 0 || status == 4) {
+            return 0;
+        }
+        return 2;
+    }
+
+    /* access modifiers changed from: package-private */
+    public MyPrinter getCurrentPrinter(Context context) {
+        return MyPrinter.getCurPrinter(context);
+    }
+
+    /* access modifiers changed from: package-private */
+    public MaintainPrinter2 getMaintainPrinter() {
+        return MaintainPrinter2.getInstance();
+    }
+}

+ 93 - 0
app/src/main/java/com/epson/memcardacc/FileConvertTask.java

@@ -0,0 +1,93 @@
+package com.epson.memcardacc;
+
+import android.os.AsyncTask;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import epson.common.ExternalFileUtils;
+import epson.common.ImageUtil;
+import epson.print.IprintApplication;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+class FileConvertTask extends AsyncTask<Void, Void, ArrayList<String>> {
+    private static final int FILE_SIZE_LIMIT = 10485760;
+    private final ConvertEndListener mConvertEndListener;
+    private ErrorType mErrorType = ErrorType.NO_ERROR;
+    private final ArrayList<String> mOrgFileList;
+
+    interface ConvertEndListener {
+        void onConvertEnd(@NonNull ErrorType errorType, @Nullable ArrayList<String> arrayList);
+    }
+
+    enum ErrorType {
+        NO_ERROR,
+        FILE_SIZE_ERROR,
+        CONVERT_ERROR
+    }
+
+    FileConvertTask(@NonNull ArrayList<String> arrayList, @NonNull ConvertEndListener convertEndListener) {
+        this.mOrgFileList = arrayList;
+        this.mConvertEndListener = convertEndListener;
+    }
+
+    static boolean checkSize(ArrayList<String> arrayList) {
+        long j;
+        try {
+            j = MemcardUtil.getFileLength(arrayList.get(0));
+        } catch (Exception unused) {
+            j = 0;
+        }
+        if (j > 10485760) {
+            return false;
+        }
+        return true;
+    }
+
+    @NonNull
+    static File initTempDirectory() {
+        return ExternalFileUtils.getInstance(IprintApplication.getInstance()).initTempCacheDirectory(ExternalFileUtils.TempCacheDirectory.MEMORY_CARD_ACCESS);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPostExecute(ArrayList<String> arrayList) {
+        ConvertEndListener convertEndListener = this.mConvertEndListener;
+        if (convertEndListener != null) {
+            convertEndListener.onConvertEnd(this.mErrorType, arrayList);
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public ArrayList<String> doInBackground(Void... voidArr) {
+        ArrayList<String> convertImageFile = convertImageFile(this.mOrgFileList);
+        if (convertImageFile == null) {
+            return null;
+        }
+        if (checkSize(convertImageFile)) {
+            return convertImageFile;
+        }
+        this.mErrorType = ErrorType.FILE_SIZE_ERROR;
+        return null;
+    }
+
+    @Nullable
+    private ArrayList<String> convertImageFile(@NonNull ArrayList<String> arrayList) {
+        ArrayList<String> arrayList2 = new ArrayList<>();
+        File initTempDirectory = initTempDirectory();
+        Iterator<String> it = arrayList.iterator();
+        while (it.hasNext()) {
+            String next = it.next();
+            String notDuplicateFilename = ExternalFileUtils.getNotDuplicateFilename(next, initTempDirectory.getPath(), 1);
+            if (notDuplicateFilename == null) {
+                this.mErrorType = ErrorType.CONVERT_ERROR;
+                return null;
+            } else if (!ImageUtil.convertHEIFtoJPEG(next, notDuplicateFilename)) {
+                this.mErrorType = ErrorType.CONVERT_ERROR;
+                return null;
+            } else {
+                arrayList2.add(notDuplicateFilename);
+            }
+        }
+        return arrayList2;
+    }
+}

+ 78 - 0
app/src/main/java/com/epson/memcardacc/FileConvertViewModel.java

@@ -0,0 +1,78 @@
+package com.epson.memcardacc;
+
+import android.app.Application;
+import android.arch.lifecycle.AndroidViewModel;
+import android.arch.lifecycle.LiveData;
+import android.arch.lifecycle.MutableLiveData;
+import android.os.AsyncTask;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import com.epson.memcardacc.FileConvertTask;
+import java.util.ArrayList;
+
+public class FileConvertViewModel extends AndroidViewModel {
+    private final FileConvertTask.ConvertEndListener mConvertEndListener = new FileConvertTask.ConvertEndListener() {
+        public void onConvertEnd(@NonNull FileConvertTask.ErrorType errorType, @Nullable ArrayList<String> arrayList) {
+            FileConvertViewModel.this.mFileConvertStatusLiveData.setValue(new FileConvertStatus(ConvertStatus.TASK_END, errorType, arrayList));
+        }
+    };
+    /* access modifiers changed from: private */
+    public final MutableLiveData<FileConvertStatus> mFileConvertStatusLiveData = new MutableLiveData<>();
+    private FileConvertTask mFileConvertTask;
+
+    enum ConvertStatus {
+        TASK_NOT_STARTED,
+        TASK_RUNNING,
+        TASK_END
+    }
+
+    public static class FileConvertStatus {
+        private final ArrayList<String> mConvertFileList;
+        private final ConvertStatus mConvertStatus;
+        private final FileConvertTask.ErrorType mErrorType;
+
+        public FileConvertStatus() {
+            this(ConvertStatus.TASK_NOT_STARTED);
+        }
+
+        public FileConvertStatus(ConvertStatus convertStatus) {
+            this(convertStatus, FileConvertTask.ErrorType.NO_ERROR, (ArrayList<String>) null);
+        }
+
+        public FileConvertStatus(ConvertStatus convertStatus, FileConvertTask.ErrorType errorType, ArrayList<String> arrayList) {
+            this.mErrorType = errorType;
+            this.mConvertStatus = convertStatus;
+            this.mConvertFileList = arrayList;
+        }
+
+        @NonNull
+        public ConvertStatus getConvertStatus() {
+            return this.mConvertStatus;
+        }
+
+        @NonNull
+        public FileConvertTask.ErrorType getErrorType() {
+            return this.mErrorType;
+        }
+
+        @Nullable
+        public ArrayList<String> getConvertFileList() {
+            return this.mConvertFileList;
+        }
+    }
+
+    public FileConvertViewModel(@NonNull Application application) {
+        super(application);
+        this.mFileConvertStatusLiveData.setValue(new FileConvertStatus());
+    }
+
+    public void startConvert(@NonNull ArrayList<String> arrayList) {
+        this.mFileConvertStatusLiveData.setValue(new FileConvertStatus(ConvertStatus.TASK_RUNNING));
+        this.mFileConvertTask = new FileConvertTask(arrayList, this.mConvertEndListener);
+        this.mFileConvertTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
+    }
+
+    public LiveData<FileConvertStatus> getData() {
+        return this.mFileConvertStatusLiveData;
+    }
+}

+ 261 - 0
app/src/main/java/com/epson/memcardacc/ImageFileListAdapter.java

@@ -0,0 +1,261 @@
+package com.epson.memcardacc;
+
+import android.graphics.Bitmap;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AbsListView;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+import epson.print.C2135R;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+public class ImageFileListAdapter extends BaseAdapter implements Serializable {
+    private static final int FILE_SELECT_NUMBER_LIMIT = 30;
+    private static final long serialVersionUID = 1;
+    /* access modifiers changed from: private */
+    public String mBaseDir = "";
+    LinkedList<FileInfoWithCheck> mFileInfoWithCheck = new LinkedList<>();
+    private transient LayoutInflater mLayoutInflator;
+    private AbsListView.LayoutParams mLayoutParams;
+    ReaderSelectedImage mReaderSelectedImage = new ReaderSelectedImage();
+    int mReqHeight;
+    int mReqWidth;
+    private String mUpFolderString = "";
+
+    public long getItemId(int i) {
+        return (long) i;
+    }
+
+    public void setLayoutInflater(LayoutInflater layoutInflater) {
+        this.mLayoutInflator = layoutInflater;
+    }
+
+    public void setUpFolderString(String str) {
+        this.mUpFolderString = str;
+    }
+
+    public int getCount() {
+        return this.mFileInfoWithCheck.size();
+    }
+
+    public Object getItem(int i) {
+        return this.mFileInfoWithCheck.get(i);
+    }
+
+    public View getView(int i, View view, ViewGroup viewGroup) {
+        if (view == null) {
+            view = this.mLayoutInflator.inflate(C2135R.layout.memcard_card_grid_view_elem, viewGroup, false);
+        }
+        ImageView imageView = (ImageView) view.findViewById(C2135R.C2137id.thumbNail);
+        FileInfoWithCheck fileInfoWithCheck = this.mFileInfoWithCheck.get(i);
+        Bitmap thumNail = fileInfoWithCheck.getThumNail();
+        TextView textView = (TextView) view.findViewById(C2135R.C2137id.baseDirText);
+        if (thumNail != null) {
+            imageView.setImageBitmap(thumNail);
+            textView.setVisibility(4);
+        } else if (fileInfoWithCheck.isDirectory()) {
+            if (fileInfoWithCheck.isParentDirectory()) {
+                imageView.setImageResource(C2135R.C2136drawable.parent_folder);
+                String str = this.mUpFolderString;
+                if (str != null) {
+                    textView.setText(str);
+                }
+            } else {
+                imageView.setImageResource(C2135R.C2136drawable.folder);
+                textView.setText(fileInfoWithCheck.getFileName());
+            }
+            textView.setVisibility(0);
+        } else {
+            imageView.setImageResource(C2135R.C2136drawable.image);
+            textView.setVisibility(4);
+        }
+        ImageView imageView2 = (ImageView) view.findViewById(C2135R.C2137id.checkImage);
+        if (fileInfoWithCheck.mChecked != 0) {
+            imageView2.setVisibility(0);
+        } else {
+            imageView2.setVisibility(8);
+        }
+        return view;
+    }
+
+    public void setImageSize(int i, int i2) {
+        this.mReqWidth = i;
+        this.mReqHeight = i2;
+    }
+
+    public void setFileList(String str, LinkedList<CifsFileInfo> linkedList) {
+        String str2 = str.length() <= 0 ? "\\" : str;
+        if (!this.mBaseDir.equals(str2)) {
+            this.mReaderSelectedImage.setFileList(this.mBaseDir, getSelectedFileList());
+            this.mBaseDir = str2;
+            this.mFileInfoWithCheck.clear();
+            if (!"\\".equals(this.mBaseDir)) {
+                this.mFileInfoWithCheck.add(new FileInfoWithCheck(CifsAccess.getParentDirectory(str)));
+            }
+            Iterator it = linkedList.iterator();
+            while (it.hasNext()) {
+                CifsFileInfo cifsFileInfo = (CifsFileInfo) it.next();
+                if (cifsFileInfo.isReadable()) {
+                    FileInfoWithCheck fileInfoWithCheck = new FileInfoWithCheck(cifsFileInfo);
+                    if (this.mReaderSelectedImage.contains(this.mBaseDir, cifsFileInfo)) {
+                        fileInfoWithCheck.mChecked = 1;
+                    }
+                    this.mFileInfoWithCheck.add(fileInfoWithCheck);
+                }
+            }
+            this.mReaderSelectedImage.deleteBaseDir(this.mBaseDir);
+        }
+    }
+
+    private LinkedList<CifsFileInfo> getSelectedFileList() {
+        LinkedList<CifsFileInfo> linkedList = new LinkedList<>();
+        Iterator it = this.mFileInfoWithCheck.iterator();
+        while (it.hasNext()) {
+            FileInfoWithCheck fileInfoWithCheck = (FileInfoWithCheck) it.next();
+            if (fileInfoWithCheck.mChecked != 0) {
+                linkedList.add(fileInfoWithCheck.mCifsFileInfo);
+            }
+        }
+        return linkedList;
+    }
+
+    public int getSelectedFileNum() {
+        Iterator it = this.mFileInfoWithCheck.iterator();
+        int i = 0;
+        while (it.hasNext()) {
+            if (((FileInfoWithCheck) it.next()).mChecked != 0) {
+                i++;
+            }
+        }
+        return i + this.mReaderSelectedImage.getFileSize();
+    }
+
+    public void clear() {
+        this.mFileInfoWithCheck.clear();
+        notifyDataSetChanged();
+    }
+
+    public Iterator<FileInfoWithCheck> getFileInfoIterator() {
+        return this.mFileInfoWithCheck.iterator();
+    }
+
+    public String getDirectoryName(int i) {
+        return ((FileInfoWithCheck) getItem(i)).getDirectoryName();
+    }
+
+    public ArrayList<String> getAllSelectedFile() {
+        ArrayList<String> arrayList = new ArrayList<>();
+        Iterator it = this.mFileInfoWithCheck.iterator();
+        while (it.hasNext()) {
+            FileInfoWithCheck fileInfoWithCheck = (FileInfoWithCheck) it.next();
+            if (fileInfoWithCheck.mChecked != 0) {
+                arrayList.add(fileInfoWithCheck.getFullPath());
+            }
+        }
+        arrayList.addAll(this.mReaderSelectedImage.getAllFileFullPath());
+        return arrayList;
+    }
+
+    public boolean itemSelected(int i) {
+        FileInfoWithCheck fileInfoWithCheck = (FileInfoWithCheck) getItem(i);
+        if (fileInfoWithCheck.mChecked == 0 && getSelectedFileNum() >= 30) {
+            return false;
+        }
+        fileInfoWithCheck.toggleCheck();
+        notifyDataSetChanged();
+        return true;
+    }
+
+    public class FileInfoWithCheck {
+        public int mChecked;
+        /* access modifiers changed from: private */
+        public CifsFileInfo mCifsFileInfo;
+        String mParentDirectory;
+        public Bitmap mThumbNail;
+
+        public FileInfoWithCheck(CifsFileInfo cifsFileInfo) {
+            this.mCifsFileInfo = cifsFileInfo;
+        }
+
+        public boolean isParentDirectory() {
+            return this.mParentDirectory != null;
+        }
+
+        public Bitmap getThumNail() {
+            return this.mThumbNail;
+        }
+
+        public String getFileName() {
+            String str = this.mParentDirectory;
+            if (str != null) {
+                return str;
+            }
+            CifsFileInfo cifsFileInfo = this.mCifsFileInfo;
+            if (cifsFileInfo != null) {
+                return cifsFileInfo.mFileName;
+            }
+            throw new RuntimeException("item don't have CifsFileInfo");
+        }
+
+        public String getFullPath() {
+            String str = this.mParentDirectory;
+            if (str != null) {
+                return str;
+            }
+            if (ImageFileListAdapter.this.mBaseDir.endsWith("\\")) {
+                return ImageFileListAdapter.this.mBaseDir + this.mCifsFileInfo.mFileName;
+            }
+            return ImageFileListAdapter.this.mBaseDir + "\\" + this.mCifsFileInfo.mFileName;
+        }
+
+        public void setThumbNail(Bitmap bitmap) {
+            this.mThumbNail = bitmap;
+        }
+
+        public boolean needThumbNail() {
+            return this.mThumbNail == null;
+        }
+
+        public boolean isDirectory() {
+            if (this.mParentDirectory != null) {
+                return true;
+            }
+            return this.mCifsFileInfo.isDirectory();
+        }
+
+        public FileInfoWithCheck(String str) {
+            this.mParentDirectory = str;
+        }
+
+        public String getDirectoryName() {
+            String str = this.mParentDirectory;
+            if (str != null) {
+                return str;
+            }
+            if (!this.mCifsFileInfo.isDirectory()) {
+                return null;
+            }
+            if (ImageFileListAdapter.this.mBaseDir.endsWith("\\")) {
+                return ImageFileListAdapter.this.mBaseDir + this.mCifsFileInfo.mFileName;
+            }
+            return ImageFileListAdapter.this.mBaseDir + "\\" + this.mCifsFileInfo.mFileName;
+        }
+
+        public void toggleCheck() {
+            if (this.mChecked == 0) {
+                this.mChecked = 1;
+            } else {
+                this.mChecked = 0;
+            }
+        }
+    }
+
+    public String getTargetDirectoryName() {
+        return this.mBaseDir;
+    }
+}

+ 38 - 0
app/src/main/java/com/epson/memcardacc/ImageUtil.java

@@ -0,0 +1,38 @@
+package com.epson.memcardacc;
+
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import java.io.File;
+
+public class ImageUtil {
+    public static WidthHeight getSize(File file) {
+        BitmapFactory.Options options = new BitmapFactory.Options();
+        options.inJustDecodeBounds = true;
+        BitmapFactory.decodeFile(file.toString(), options);
+        return new WidthHeight(options.outWidth, options.outHeight);
+    }
+
+    public static int getSampleSize(WidthHeight widthHeight, WidthHeight widthHeight2) {
+        if (widthHeight.mWidth >= widthHeight2.mWidth || widthHeight.mHeight >= widthHeight2.mHeight) {
+            return (int) Math.floor((double) Math.min(((float) widthHeight.mWidth) / ((float) widthHeight2.mWidth), ((float) widthHeight.mHeight) / ((float) widthHeight2.mHeight)));
+        }
+        return 1;
+    }
+
+    public static Bitmap makeThumbNail(File file, WidthHeight widthHeight) {
+        WidthHeight size = getSize(file);
+        BitmapFactory.Options options = new BitmapFactory.Options();
+        options.inSampleSize = getSampleSize(size, widthHeight);
+        return BitmapFactory.decodeFile(file.toString(), options);
+    }
+
+    public static class WidthHeight {
+        int mHeight;
+        int mWidth;
+
+        public WidthHeight(int i, int i2) {
+            this.mWidth = i;
+            this.mHeight = i2;
+        }
+    }
+}

+ 18 - 0
app/src/main/java/com/epson/memcardacc/LimitedHashMap.java

@@ -0,0 +1,18 @@
+package com.epson.memcardacc;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/* compiled from: DirectoryCache */
+class LimitedHashMap<K, V> extends LinkedHashMap<K, V> {
+    static final int LIMIT = 64;
+    private static final long serialVersionUID = 1;
+
+    LimitedHashMap() {
+    }
+
+    /* access modifiers changed from: protected */
+    public boolean removeEldestEntry(Map.Entry<K, V> entry) {
+        return size() > 64;
+    }
+}

+ 71 - 0
app/src/main/java/com/epson/memcardacc/LocalAlertDialogFragment.java

@@ -0,0 +1,71 @@
+package com.epson.memcardacc;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.support.p000v4.app.DialogFragment;
+import epson.print.C2135R;
+
+public class LocalAlertDialogFragment extends DialogFragment {
+    private static final String KEY_DIALOG_CODE = "dialog_code";
+    private static final String KEY_MESSAGE = "message";
+    private static final String KEY_NO_TITLE = "no_title";
+    private static final String KEY_TITLE = "title";
+    private int mDialogCode;
+
+    public interface DialogCallback {
+        void onDialogCallback(int i);
+    }
+
+    public static LocalAlertDialogFragment newInstance(int i, int i2, int i3) {
+        LocalAlertDialogFragment localAlertDialogFragment = new LocalAlertDialogFragment();
+        Bundle bundle = new Bundle();
+        bundle.putInt("message", i);
+        bundle.putInt(KEY_TITLE, i2);
+        bundle.putInt(KEY_DIALOG_CODE, i3);
+        localAlertDialogFragment.setArguments(bundle);
+        return localAlertDialogFragment;
+    }
+
+    public static LocalAlertDialogFragment newInstanceNoTitle(int i, int i2) {
+        LocalAlertDialogFragment localAlertDialogFragment = new LocalAlertDialogFragment();
+        Bundle bundle = new Bundle();
+        bundle.putInt("message", i);
+        bundle.putInt(KEY_DIALOG_CODE, i2);
+        bundle.putBoolean(KEY_NO_TITLE, true);
+        localAlertDialogFragment.setArguments(bundle);
+        return localAlertDialogFragment;
+    }
+
+    public Dialog onCreateDialog(Bundle bundle) {
+        Bundle arguments = getArguments();
+        int i = arguments.getInt("message", 0);
+        int i2 = arguments.getInt(KEY_TITLE, 0);
+        boolean z = arguments.getBoolean(KEY_NO_TITLE, false);
+        this.mDialogCode = arguments.getInt(KEY_DIALOG_CODE);
+        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+        builder.setMessage(i).setPositiveButton(getActivity().getString(C2135R.string.str_ok), new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialogInterface, int i) {
+                LocalAlertDialogFragment.this.execCallback();
+            }
+        });
+        if (!z) {
+            builder.setTitle(i2);
+        }
+        AlertDialog create = builder.create();
+        create.setCanceledOnTouchOutside(false);
+        return create;
+    }
+
+    /* access modifiers changed from: private */
+    public void execCallback() {
+        try {
+            DialogCallback dialogCallback = (DialogCallback) getActivity();
+            if (dialogCallback != null) {
+                dialogCallback.onDialogCallback(this.mDialogCode);
+            }
+        } catch (ClassCastException unused) {
+        }
+    }
+}

+ 48 - 0
app/src/main/java/com/epson/memcardacc/LocalImageSelectActivity.java

@@ -0,0 +1,48 @@
+package com.epson.memcardacc;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Build;
+import epson.print.imgsel.ImageFinder;
+import epson.print.imgsel.ImageSelectActivity;
+import epson.print.imgsel.JpegHeifImageFinder;
+import epson.print.imgsel.JpegImageFinder;
+import java.util.ArrayList;
+
+public class LocalImageSelectActivity extends ImageSelectActivity {
+    private static final int REQUEST_CODE_CONFIRM_WIRTE = 105;
+
+    public boolean singleImageMode() {
+        return false;
+    }
+
+    public ImageFinder getImageFinder() {
+        if (Build.VERSION.SDK_INT >= 28) {
+            return new JpegHeifImageFinder();
+        }
+        return new JpegImageFinder();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onActivityResult(int i, int i2, Intent intent) {
+        super.onActivityResult(i, i2, intent);
+        if (i == 105 && i2 == 1) {
+            finish();
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void goNext() {
+        ArrayList<String> fileArrayList = getImageSelector().getFileArrayList();
+        if (fileArrayList.size() > 0) {
+            startActivityForResult(ConfirmWriteMemcard.getStartIntent(this, fileArrayList), 105);
+        }
+    }
+
+    public static void startAddImageList(Activity activity, ArrayList<String> arrayList) {
+        Intent intent = new Intent(activity, LocalImageSelectActivity.class);
+        intent.addFlags(335544320);
+        intent.putExtra(ImageSelectActivity.PARAM_SELECTED_FILE_LIST, arrayList);
+        activity.startActivity(intent);
+    }
+}

+ 42 - 0
app/src/main/java/com/epson/memcardacc/LocalProgressDialogFragment.java

@@ -0,0 +1,42 @@
+package com.epson.memcardacc;
+
+import android.app.Dialog;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.p000v4.app.DialogFragment;
+import android.support.p003v7.app.AlertDialog;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+import epson.print.C2135R;
+
+public class LocalProgressDialogFragment extends DialogFragment {
+    private static final String ARGUMENT_MESSAGE_TEXT_ID = "resource-id";
+
+    public static LocalProgressDialogFragment newInstance(int i) {
+        LocalProgressDialogFragment localProgressDialogFragment = new LocalProgressDialogFragment();
+        Bundle bundle = new Bundle();
+        bundle.putInt(ARGUMENT_MESSAGE_TEXT_ID, i);
+        localProgressDialogFragment.setArguments(bundle);
+        return localProgressDialogFragment;
+    }
+
+    public void onCreate(@Nullable Bundle bundle) {
+        super.onCreate(bundle);
+        setCancelable(false);
+    }
+
+    @NonNull
+    public Dialog onCreateDialog(Bundle bundle) {
+        int i;
+        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+        View inflate = getActivity().getLayoutInflater().inflate(C2135R.layout.dialog_local_prgress, (ViewGroup) null);
+        builder.setView(inflate);
+        Bundle arguments = getArguments();
+        if (!(arguments == null || (i = arguments.getInt(ARGUMENT_MESSAGE_TEXT_ID, 0)) == 0)) {
+            ((TextView) inflate.findViewById(C2135R.C2137id.messageText)).setText(i);
+        }
+        return builder.create();
+    }
+}

+ 13 - 0
app/src/main/java/com/epson/memcardacc/LogData.java

@@ -0,0 +1,13 @@
+package com.epson.memcardacc;
+
+import java.io.Serializable;
+
+public class LogData implements Serializable {
+    public static final int DIRECTION_NOT_SUPPORTED = -1;
+    public static final int DIRECTION_PRINTER_TO_TERMINAL = 1;
+    public static final int DIRECTION_TERMINAL_TO_PRINTER = 0;
+    public int actionId;
+    public int direction;
+    public String printerName;
+    public int sheetNumber;
+}

+ 94 - 0
app/src/main/java/com/epson/memcardacc/MemCardWriteConvertViewModel.java

@@ -0,0 +1,94 @@
+package com.epson.memcardacc;
+
+import android.app.Application;
+import android.arch.lifecycle.AndroidViewModel;
+import android.arch.lifecycle.LiveData;
+import android.os.AsyncTask;
+import android.support.annotation.NonNull;
+import epson.common.ExternalFileUtils;
+import epson.common.ImageUtil;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class MemCardWriteConvertViewModel extends AndroidViewModel {
+    /* access modifiers changed from: private */
+    public final Application mApplication;
+    /* access modifiers changed from: private */
+    public final ConvertLiveData mConvertLiveData = new ConvertLiveData();
+
+    public static class ConvertResult {
+        public final ArrayList<String> filenameList = new ArrayList<>();
+        public long totalFileSize = 0;
+
+        public void addFile(String str) {
+            this.totalFileSize += new File(str).length();
+            this.filenameList.add(str);
+        }
+    }
+
+    public MemCardWriteConvertViewModel(@NonNull Application application) {
+        super(application);
+        this.mApplication = application;
+    }
+
+    public void setOrigFileList(@NonNull ArrayList<String> arrayList) {
+        this.mConvertLiveData.setOrigFileList(arrayList);
+    }
+
+    public void deleteTempFile() {
+        this.mConvertLiveData.initTempDirectory();
+    }
+
+    public ConvertLiveData getData() {
+        return this.mConvertLiveData;
+    }
+
+    public class ConvertLiveData extends LiveData<ConvertResult> {
+        public ConvertLiveData() {
+        }
+
+        public void setOrigFileList(@NonNull final ArrayList<String> arrayList) {
+            new AsyncTask<Void, Void, ConvertResult>() {
+                /* access modifiers changed from: protected */
+                public ConvertResult doInBackground(Void... voidArr) {
+                    return ConvertLiveData.this.convertAndGetFileSize(arrayList);
+                }
+
+                /* access modifiers changed from: protected */
+                public void onPostExecute(ConvertResult convertResult) {
+                    MemCardWriteConvertViewModel.this.mConvertLiveData.setValue(convertResult);
+                }
+            }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
+        }
+
+        /* access modifiers changed from: private */
+        public synchronized ConvertResult convertAndGetFileSize(@NonNull ArrayList<String> arrayList) {
+            ConvertResult convertResult = new ConvertResult();
+            File initTempDirectory = initTempDirectory(ExternalFileUtils.getInstance(MemCardWriteConvertViewModel.this.mApplication));
+            Iterator<String> it = arrayList.iterator();
+            while (it.hasNext()) {
+                String next = it.next();
+                if (ImageUtil.isHEIFFormat(next)) {
+                    String notDuplicateFilename = ExternalFileUtils.getNotDuplicateFilename(next, initTempDirectory.getPath(), 30);
+                    if (!ImageUtil.convertHEIFtoJPEG(next, notDuplicateFilename)) {
+                        return null;
+                    }
+                    next = notDuplicateFilename;
+                }
+                convertResult.addFile(next);
+            }
+            return convertResult;
+        }
+
+        @NonNull
+        private File initTempDirectory(ExternalFileUtils externalFileUtils) {
+            return externalFileUtils.initTempCacheDirectory(ExternalFileUtils.TempCacheDirectory.MEMORY_CARD_ACCESS);
+        }
+
+        /* access modifiers changed from: private */
+        public synchronized void initTempDirectory() {
+            initTempDirectory(ExternalFileUtils.getInstance(MemCardWriteConvertViewModel.this.mApplication));
+        }
+    }
+}

+ 25 - 0
app/src/main/java/com/epson/memcardacc/MemcardBitmapCache.java

@@ -0,0 +1,25 @@
+package com.epson.memcardacc;
+
+import android.content.Context;
+import java.io.File;
+
+public class MemcardBitmapCache extends BitmapCache {
+    protected static MemcardBitmapCache sBitmapCache;
+    protected boolean mDirOk;
+
+    public static MemcardBitmapCache getInstance(Context context) {
+        MemcardBitmapCache memcardBitmapCache = new MemcardBitmapCache();
+        File externalCacheDir = context.getExternalCacheDir();
+        if (externalCacheDir != null && memcardBitmapCache.setDirectory(new File(externalCacheDir, MemcardConfig.THUMBNAIL_CACHE_DIRECTORY), new File(externalCacheDir, MemcardConfig.DOWNLOAD_DIRECTORY))) {
+            return memcardBitmapCache;
+        }
+        return null;
+    }
+
+    protected MemcardBitmapCache() {
+    }
+
+    public boolean checkEnv() {
+        return checkSettings();
+    }
+}

+ 220 - 0
app/src/main/java/com/epson/memcardacc/MemcardCheckTask.java

@@ -0,0 +1,220 @@
+package com.epson.memcardacc;
+
+import android.content.Context;
+import android.os.AsyncTask;
+import java.util.concurrent.SynchronousQueue;
+
+public class MemcardCheckTask extends AsyncTask<Void, Void, Integer> {
+    public static final int ERROR_CODE_ACTIVITY_ON_PAUSE_CANCEL = 6;
+    public static final int ERROR_CODE_CANCEL = 5;
+    public static final int ERROR_MEM_CARD_NOT_FOUND = 1;
+    public static final int ERROR_PRINTER_BUSY = 3;
+    public static final int ERROR_PRINTER_CONNECTION = 2;
+    public static final int ERROR_PRINTER_ERROR = 4;
+    public static final int NO_ERROR = 0;
+    protected boolean mActivityOnPauseCancel;
+    MemcardCheckCallback mCallback;
+    int mCifsStorageSetType;
+    Context mContext;
+    int mErrorCode;
+    private SynchronousQueue<MyQueueData> mQueue;
+
+    public interface MemcardCheckCallback {
+        void onAuthInfoRequired(MemcardCheckTask memcardCheckTask, boolean z);
+
+        void onMemcardCheckEnd(Integer num, int i);
+
+        void onPreExecute();
+    }
+
+    public MemcardCheckTask(Context context, MemcardCheckCallback memcardCheckCallback, int i) {
+        this.mActivityOnPauseCancel = false;
+        this.mQueue = new SynchronousQueue<>();
+        this.mContext = context.getApplicationContext();
+        this.mCallback = memcardCheckCallback;
+        this.mCifsStorageSetType = i;
+    }
+
+    protected MemcardCheckTask() {
+        this.mActivityOnPauseCancel = false;
+    }
+
+    /* access modifiers changed from: protected */
+    /* JADX WARNING: Can't wrap try/catch for region: R(4:50|51|52|53) */
+    /* JADX WARNING: Code restructure failed: missing block: B:51:?, code lost:
+        r7.mErrorCode = 5;
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:52:0x00a7, code lost:
+        r8.free();
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:53:0x00aa, code lost:
+        return 0;
+     */
+    /* JADX WARNING: Missing exception handler attribute for start block: B:50:0x00a1 */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    public java.lang.Integer doInBackground(java.lang.Void... r8) {
+        /*
+            r7 = this;
+            boolean r8 = r7.isCancelled()
+            r0 = 5
+            r1 = 0
+            if (r8 == 0) goto L_0x000f
+            r7.mErrorCode = r0
+            java.lang.Integer r8 = java.lang.Integer.valueOf(r1)
+            return r8
+        L_0x000f:
+            android.content.Context r8 = r7.mContext
+            r2 = 60
+            int r8 = r7.checkEscprLib(r8, r2)
+            r7.mErrorCode = r8
+            int r8 = r7.mErrorCode
+            if (r8 == 0) goto L_0x0022
+            java.lang.Integer r8 = java.lang.Integer.valueOf(r1)
+            return r8
+        L_0x0022:
+            com.epson.memcardacc.CifsAccess r8 = r7.getCifsAccessInstance()
+            boolean r2 = r7.isCancelled()     // Catch:{ all -> 0x00b3 }
+            if (r2 == 0) goto L_0x0036
+            r7.mErrorCode = r0     // Catch:{ all -> 0x00b3 }
+            java.lang.Integer r0 = java.lang.Integer.valueOf(r1)     // Catch:{ all -> 0x00b3 }
+            r8.free()
+            return r0
+        L_0x0036:
+            android.content.Context r2 = r7.mContext     // Catch:{ all -> 0x00b3 }
+            int r3 = r7.mCifsStorageSetType     // Catch:{ all -> 0x00b3 }
+            int r2 = r8.initDefault(r2, r3)     // Catch:{ all -> 0x00b3 }
+            if (r2 != 0) goto L_0x0055
+            r8.free()     // Catch:{ all -> 0x00b3 }
+            android.content.Context r2 = r7.mContext     // Catch:{ all -> 0x00b3 }
+            int r3 = r7.mCifsStorageSetType     // Catch:{ all -> 0x00b3 }
+            int r2 = r8.initDefault(r2, r3)     // Catch:{ all -> 0x00b3 }
+            if (r2 != 0) goto L_0x0055
+            java.lang.Integer r0 = java.lang.Integer.valueOf(r1)     // Catch:{ all -> 0x00b3 }
+            r8.free()
+            return r0
+        L_0x0055:
+            r2 = 1
+            r3 = 0
+            r4 = 1
+        L_0x0058:
+            if (r3 != 0) goto L_0x00ab
+            boolean r3 = r7.isCancelled()     // Catch:{ all -> 0x00b3 }
+            if (r3 == 0) goto L_0x006a
+            r7.mErrorCode = r0     // Catch:{ all -> 0x00b3 }
+            java.lang.Integer r0 = java.lang.Integer.valueOf(r1)     // Catch:{ all -> 0x00b3 }
+            r8.free()
+            return r0
+        L_0x006a:
+            int r3 = r8.checkStorage()     // Catch:{ all -> 0x00b3 }
+            if (r3 != 0) goto L_0x0058
+            int r5 = r8.getErrorCode()     // Catch:{ all -> 0x00b3 }
+            r6 = -1205(0xfffffffffffffb4b, float:NaN)
+            if (r5 == r6) goto L_0x0082
+            r7.mErrorCode = r2     // Catch:{ all -> 0x00b3 }
+            java.lang.Integer r0 = java.lang.Integer.valueOf(r1)     // Catch:{ all -> 0x00b3 }
+            r8.free()
+            return r0
+        L_0x0082:
+            boolean r5 = r7.isCancelled()     // Catch:{ all -> 0x00b3 }
+            if (r5 == 0) goto L_0x0092
+            r7.mErrorCode = r0     // Catch:{ all -> 0x00b3 }
+            java.lang.Integer r0 = java.lang.Integer.valueOf(r1)     // Catch:{ all -> 0x00b3 }
+            r8.free()
+            return r0
+        L_0x0092:
+            com.epson.memcardacc.MemcardCheckTask$MemcardCheckCallback r5 = r7.mCallback     // Catch:{ all -> 0x00b3 }
+            r5.onAuthInfoRequired(r7, r4)     // Catch:{ all -> 0x00b3 }
+            java.util.concurrent.SynchronousQueue<com.epson.memcardacc.MemcardCheckTask$MyQueueData> r4 = r7.mQueue     // Catch:{ InterruptedException -> 0x00a1 }
+            java.lang.Object r4 = r4.take()     // Catch:{ InterruptedException -> 0x00a1 }
+            com.epson.memcardacc.MemcardCheckTask$MyQueueData r4 = (com.epson.memcardacc.MemcardCheckTask.MyQueueData) r4     // Catch:{ InterruptedException -> 0x00a1 }
+            r4 = 0
+            goto L_0x0058
+        L_0x00a1:
+            r7.mErrorCode = r0     // Catch:{ all -> 0x00b3 }
+            java.lang.Integer r0 = java.lang.Integer.valueOf(r1)     // Catch:{ all -> 0x00b3 }
+            r8.free()
+            return r0
+        L_0x00ab:
+            r8.free()
+            java.lang.Integer r8 = java.lang.Integer.valueOf(r3)
+            return r8
+        L_0x00b3:
+            r0 = move-exception
+            r8.free()
+            throw r0
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.memcardacc.MemcardCheckTask.doInBackground(java.lang.Void[]):java.lang.Integer");
+    }
+
+    /* access modifiers changed from: protected */
+    public CifsAccess getCifsAccessInstance() {
+        return CifsAccess.getInstance();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPreExecute() {
+        this.mCallback.onPreExecute();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPostExecute(Integer num) {
+        this.mCallback.onMemcardCheckEnd(num, this.mErrorCode);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCancelled() {
+        this.mCallback.onMemcardCheckEnd((Integer) null, this.mActivityOnPauseCancel ? 6 : 5);
+    }
+
+    public void activityOnPauseCancel() {
+        this.mActivityOnPauseCancel = true;
+        cancel(true);
+    }
+
+    public void setAuthData(String str, String str2) {
+        int i = 0;
+        while (!this.mQueue.offer(new MyQueueData(2)) && i < 4) {
+            try {
+                Thread.sleep(300);
+                i++;
+            } catch (Exception unused) {
+                return;
+            }
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public int checkEscprLib(Context context, int i) {
+        EscprLibPrinter newEscprLibPrinter = newEscprLibPrinter();
+        if (newEscprLibPrinter.init(context, i, true) != 0) {
+            return 2;
+        }
+        int status = newEscprLibPrinter.getStatus();
+        newEscprLibPrinter.release();
+        return (status == 0 || status == 4) ? 0 : 3;
+    }
+
+    /* access modifiers changed from: protected */
+    public EscprLibPrinter newEscprLibPrinter() {
+        return new EscprLibPrinter();
+    }
+
+    static class MyQueueData {
+        public static final int TYPE_AUTH_DATA = 2;
+        public static final int TYPE_CANCEL = 1;
+        public int mDataType;
+        public SmbAuthInfo mSmbAuthInfo;
+
+        public static MyQueueData getCancelData() {
+            return new MyQueueData(1);
+        }
+
+        public MyQueueData(int i) {
+            this.mDataType = i;
+        }
+
+        public boolean isCancel() {
+            return this.mDataType == 1;
+        }
+    }
+}

+ 18 - 0
app/src/main/java/com/epson/memcardacc/MemcardConfig.java

@@ -0,0 +1,18 @@
+package com.epson.memcardacc;
+
+import android.os.Environment;
+
+public class MemcardConfig {
+    public static final String BASE_DIRECTORY = Environment.getExternalStorageDirectory().getPath();
+    public static final String CIFS_WRITE_FOLDER = "\\EPIMG";
+    public static final String DEFAULT_READER_LOCAL_DIRECTORY = "eproll";
+    public static final String DOWNLOAD_DIRECTORY = "bindata02";
+    public static final String[] GENERIC_STORAGE_SET = {MEMCARD_STORAGE_NAME, "USBSTORAGE"};
+    public static final String INIT_CIFS_DIRECTORY = "\\DCIM";
+    public static final String MAP_FILE_NAME = "mapfile.bin";
+    public static final String MEMCARD_STORAGE_NAME = "MEMORYCARD";
+    public static final String[] PHOTO_COPY_STORAGE_SET = {"FILESTORE"};
+    public static final String PHOTO_COPY_WRITE_FILE_NAME = "image.jpg";
+    public static final String PHOTO_COPY_WRITE_FOLDER_NAME = "";
+    public static final String THUMBNAIL_CACHE_DIRECTORY = "bindata01";
+}

+ 16 - 0
app/src/main/java/com/epson/memcardacc/MemcardDialog.java

@@ -0,0 +1,16 @@
+package com.epson.memcardacc;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import epson.print.C2135R;
+
+public class MemcardDialog {
+    public static Dialog createDialog(Activity activity, int i, int i2) {
+        return new AlertDialog.Builder(activity).setTitle(i).setMessage(i2).setPositiveButton(activity.getString(C2135R.string.str_ok), new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialogInterface, int i) {
+            }
+        }).create();
+    }
+}

+ 737 - 0
app/src/main/java/com/epson/memcardacc/MemcardImageGrid.java

@@ -0,0 +1,737 @@
+package com.epson.memcardacc;
+
+import android.annotation.SuppressLint;
+import android.annotation.TargetApi;
+import android.arch.lifecycle.Observer;
+import android.arch.lifecycle.ViewModelProviders;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.os.AsyncTask;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.support.p000v4.app.DialogFragment;
+import android.support.p000v4.app.FragmentActivity;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewTreeObserver;
+import android.widget.AdapterView;
+import android.widget.GridView;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+import com.epson.memcardacc.ImageFileListAdapter;
+import com.epson.memcardacc.MemcardTempAlertDialog;
+import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
+import epson.common.DialogProgress;
+import epson.common.DialogProgressViewModel;
+import epson.print.ActivityIACommon;
+import epson.print.C2135R;
+import epson.print.Util.EPLog;
+import java.io.UnsupportedEncodingException;
+import java.util.Deque;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Locale;
+import java.util.concurrent.LinkedBlockingQueue;
+
+public class MemcardImageGrid extends ActivityIACommon implements DialogProgress.DialogButtonClick {
+    static final int ACTIVITY_TYPE_CONFIRM_COPY = 1;
+    private static final String DIALOG_FILE_READ_ERROR = "dialog_file_read_error";
+    private static final String DIALOG_NO_IMAGE_SELECTED = "dialog_no_image_selected";
+    private static final String DIALOG_OVER_SELECTED_NUMBER = "dialog_over_selected_number";
+    private static final String DIALOG_PROGRESS = "dialog_progress";
+    private static final String LOG_TAG = "MemcardImageGrid";
+    public static final String MEMCARD_STORAGE_TYPE = "memcard_storage_type";
+    static final int MESSAGE_EXEC_NEXT_TASK_OR_IDLE = 2;
+    static final int MESSAGE_WAIT_TASK_FINISHED_AND_NEXT_TASK = 1;
+    static final long NEXT_TASK_WAITE = 300;
+    public static final int RESULT_BACK_TO_MEMCARD_TOP = 1;
+    protected static final long TASK_WAITE_PRIOD = 1000;
+    boolean discconectOnThreadFinish = false;
+    private boolean isFinishRequested;
+    boolean isKeepSimleApConnect = false;
+    boolean isTryConnectSimpleAp = false;
+    /* access modifiers changed from: private */
+    public MemcardBitmapCache mBitmapCache;
+    /* access modifiers changed from: private */
+    public CifsAccess mCifsAccess;
+    /* access modifiers changed from: private */
+    public CifsFileListLoader mCifsFileListLoader;
+    /* access modifiers changed from: private */
+    public DirectoryCache mDirectoryCache;
+    private GridView mGridView;
+    /* access modifiers changed from: private */
+    @SuppressLint({"HandlerLeak"})
+    public Handler mHandler = new Handler() {
+        public void handleMessage(Message message) {
+            switch (message.what) {
+                case 1:
+                    if (MemcardImageGrid.this.mCifsFileListLoader != null) {
+                        EPLog.m313i(MemcardImageGrid.LOG_TAG, "status :" + MemcardImageGrid.this.mCifsFileListLoader.getStatus());
+                        switch (C09864.$SwitchMap$android$os$AsyncTask$Status[MemcardImageGrid.this.mCifsFileListLoader.getStatus().ordinal()]) {
+                            case 1:
+                            case 2:
+                                MemcardImageGrid.this.mHandler.sendEmptyMessageDelayed(1, 1000);
+                                return;
+                            case 3:
+                                break;
+                            default:
+                                EPLog.m307e(MemcardImageGrid.LOG_TAG, "unkown AsyncTask.getStatus() value");
+                                return;
+                        }
+                    } else {
+                        EPLog.m313i(MemcardImageGrid.LOG_TAG, "mCifsFileListLoader == null");
+                    }
+                    MemcardImageGrid.this.mHandler.sendEmptyMessageDelayed(2, 300);
+                    return;
+                case 2:
+                    MemcardImageGrid.this.execNextTaskOrIdle();
+                    return;
+                default:
+                    return;
+            }
+        }
+    };
+    /* access modifiers changed from: private */
+    public ImageFileListAdapter mImageFileListAdapter;
+    /* access modifiers changed from: private */
+    public int mMemcardStorageType;
+    private DialogProgressViewModel mModelDialog;
+    private ProgressBar mProgressBar;
+    private TextView mSelectedFileNumText;
+    public boolean mStartDirectory;
+    private LinkedBlockingQueue<String> mTaskQueue = new LinkedBlockingQueue<>();
+    private int mThumbnailHeight;
+    private int mThumbnailWidth;
+    private String targetDir = null;
+
+    public void onCancelDialog(String str) {
+    }
+
+    public void onNeutralClick(String str) {
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        this.mBitmapCache = MemcardBitmapCache.getInstance(this);
+        MemcardBitmapCache memcardBitmapCache = this.mBitmapCache;
+        if (memcardBitmapCache == null || !memcardBitmapCache.checkEnv()) {
+            new MemcardTempAlertDialog().showAlertDialog(this, new MemcardTempAlertDialog.DialogCallback() {
+                public void onPositiveCallback() {
+                    MemcardImageGrid.this.finish();
+                }
+            });
+        }
+        this.mCifsAccess = CifsAccess.getInstance();
+        this.mDirectoryCache = new DirectoryCache();
+        this.mDirectoryCache.setCifsAccess(this.mCifsAccess);
+        super.onCreate(bundle);
+        this.mImageFileListAdapter = new ImageFileListAdapter();
+        this.mImageFileListAdapter.setLayoutInflater(getLayoutInflater());
+        this.mImageFileListAdapter.setUpFolderString(getResources().getString(C2135R.string.memcard_folder_up));
+        setContentView((int) C2135R.layout.activity_memcard_image_grid);
+        setActionBar("", true);
+        this.mGridView = (GridView) findViewById(C2135R.C2137id.gridView1);
+        this.mGridView.setAdapter(this.mImageFileListAdapter);
+        this.mSelectedFileNumText = (TextView) findViewById(C2135R.C2137id.textSelectedImageNum);
+        this.mGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+            public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
+                MemcardImageGrid.this.gridViewItemClicked(adapterView, view, i, j);
+            }
+        });
+        this.mThumbnailWidth = getResources().getDimensionPixelSize(C2135R.dimen.image_selector_grid_thumbnail_size);
+        int i = this.mThumbnailWidth;
+        this.mThumbnailHeight = i;
+        this.mBitmapCache.setSize(i, this.mThumbnailHeight);
+        this.mImageFileListAdapter.setImageSize(this.mThumbnailWidth, this.mThumbnailHeight);
+        this.mGridView.getViewTreeObserver().addOnGlobalLayoutListener(new MyGridLayoutListener(this.mGridView, this.mImageFileListAdapter, getResources().getDimensionPixelSize(C2135R.dimen.image_selector_grid_thumbnail_spacing)));
+        updateSelectedNumber();
+        this.mProgressBar = (ProgressBar) findViewById(C2135R.C2137id.progressBar1);
+        this.mProgressBar.setVisibility(4);
+        this.mMemcardStorageType = getIntent().getIntExtra("memcard_storage_type", 1);
+        if (this.mMemcardStorageType <= 0) {
+            this.mMemcardStorageType = 1;
+        }
+        this.mStartDirectory = true;
+        this.targetDir = MemcardConfig.INIT_CIFS_DIRECTORY;
+        this.mModelDialog = (DialogProgressViewModel) ViewModelProviders.m2of((FragmentActivity) this).get(DialogProgressViewModel.class);
+        this.mModelDialog.getDialogJob().observe(this, new Observer() {
+            public final void onChanged(Object obj) {
+                MemcardImageGrid.lambda$onCreate$0(MemcardImageGrid.this, (Deque) obj);
+            }
+        });
+    }
+
+    public static /* synthetic */ void lambda$onCreate$0(MemcardImageGrid memcardImageGrid, Deque deque) {
+        String[] checkQueue = memcardImageGrid.mModelDialog.checkQueue();
+        if (checkQueue != null) {
+            String str = checkQueue[0];
+            String str2 = checkQueue[1];
+            if (str2.equals("do_show")) {
+                memcardImageGrid.showDialog(str);
+            }
+            if (str2.equals("do_dismiss")) {
+                memcardImageGrid.dismissDialog(str);
+            }
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public void dispTargetDirectory() {
+        setTitle(this.mImageFileListAdapter.getTargetDirectoryName());
+    }
+
+    /* access modifiers changed from: protected */
+    public void onStop() {
+        this.mHandler.removeMessages(1);
+        if (!this.isKeepSimleApConnect) {
+            CifsFileListLoader cifsFileListLoader = this.mCifsFileListLoader;
+            if (cifsFileListLoader != null && cifsFileListLoader.getStatus() == AsyncTask.Status.RUNNING) {
+                this.discconectOnThreadFinish = true;
+            }
+            if (!this.discconectOnThreadFinish) {
+                EPLog.m305d(LOG_TAG, "discconect at onStop()");
+                WiFiDirectManager.disconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, MemcardUtil.getPrinterIpAddress(this));
+            }
+        }
+        cancelFileListLoadTask();
+        super.onStop();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onRestart() {
+        super.onRestart();
+        this.targetDir = this.mImageFileListAdapter.getTargetDirectoryName();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onResume() {
+        super.onResume();
+        if (!WiFiDirectManager.isNeedConnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER)) {
+            this.isTryConnectSimpleAp = false;
+        } else if (!this.isTryConnectSimpleAp) {
+            this.isTryConnectSimpleAp = true;
+            if (WiFiDirectManager.reconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, -1)) {
+                return;
+            }
+        }
+        this.isKeepSimleApConnect = false;
+        this.discconectOnThreadFinish = false;
+        if (!this.isFinishRequested) {
+            chengeTargetDirectory(this.targetDir);
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onActivityResult(int i, int i2, Intent intent) {
+        super.onActivityResult(i, i2, intent);
+        if (i2 == 1 && i2 == 1) {
+            setResult(1);
+            finishMemCardImageGridActivity();
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public void gridViewItemClicked(AdapterView<?> adapterView, View view, int i, long j) {
+        String directoryName = this.mImageFileListAdapter.getDirectoryName(i);
+        if (directoryName != null) {
+            EPLog.m313i(LOG_TAG, "item clicked : dir_name => " + directoryName);
+            chengeTargetDirectory(directoryName);
+        } else if (this.mImageFileListAdapter.itemSelected(i)) {
+            updateSelectedNumber();
+        } else {
+            localShowDialog(DIALOG_OVER_SELECTED_NUMBER);
+        }
+    }
+
+    public boolean onCreateOptionsMenu(Menu menu) {
+        int selectedFileNum = this.mImageFileListAdapter.getSelectedFileNum();
+        getMenuInflater().inflate(C2135R.C2138menu.menu_image_selector, menu);
+        menu.findItem(C2135R.C2137id.action_go_preview).setEnabled(selectedFileNum > 0);
+        if (selectedFileNum <= 0) {
+            setTitle(this.mImageFileListAdapter.getTargetDirectoryName());
+        } else {
+            setTitle(String.format(getResources().getString(C2135R.string.photo_selected), new Object[]{Integer.valueOf(selectedFileNum)}));
+        }
+        return true;
+    }
+
+    public boolean onOptionsItemSelected(MenuItem menuItem) {
+        if (menuItem.getItemId() != C2135R.C2137id.action_go_preview) {
+            return super.onOptionsItemSelected(menuItem);
+        }
+        goNext();
+        return true;
+    }
+
+    public void updateSelectedNumber() {
+        supportInvalidateOptionsMenu();
+    }
+
+    public void next_button_clicked(View view) {
+        goNext();
+    }
+
+    private void goNext() {
+        showProgressDialog();
+        if (this.mImageFileListAdapter.getSelectedFileNum() <= 0) {
+            dismissProgressDialog();
+            localShowDialog(DIALOG_NO_IMAGE_SELECTED);
+            return;
+        }
+        cancelFileListLoadTask();
+        Intent intent = new Intent(this, ConfirmReadMemcard.class);
+        intent.putStringArrayListExtra(ConfirmReadMemcard.KEY_IMAGE_LIST, this.mImageFileListAdapter.getAllSelectedFile());
+        intent.putExtra("memcard_storage_type", this.mMemcardStorageType);
+        startActivityForResult(intent, 1);
+        dismissProgressDialog();
+        this.isKeepSimleApConnect = true;
+    }
+
+    public void onBackPressed() {
+        finishMemCardImageGridActivity();
+    }
+
+    private void finishMemCardImageGridActivity() {
+        this.mHandler.removeMessages(1);
+        cancelFileListLoadTask();
+        finish();
+        this.isFinishRequested = true;
+    }
+
+    /* access modifiers changed from: private */
+    public void localShowDialog(String str) {
+        this.mModelDialog.doShow(str);
+    }
+
+    private void chengeTargetDirectory(String str) {
+        EPLog.m313i(LOG_TAG, "chengeTargetDirectory() start");
+        showProgressDialog();
+        this.mTaskQueue.clear();
+        cancelFileListLoadTask();
+        try {
+            this.mTaskQueue.put(str);
+            this.mHandler.sendEmptyMessage(1);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+            EPLog.m307e(LOG_TAG, "queue.put() error in chengeTargetDirectory()");
+            dismissProgressDialog();
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void execNextTaskOrIdle() {
+        if (!this.mTaskQueue.isEmpty()) {
+            EPLog.m313i(LOG_TAG, "checkQueue() queue not empty");
+            this.mCifsFileListLoader = new CifsFileListLoader();
+            String str = "";
+            while (!this.mTaskQueue.isEmpty()) {
+                str = this.mTaskQueue.poll();
+            }
+            this.mCifsFileListLoader.execute(new String[]{str});
+            return;
+        }
+        dismissProgressDialog();
+    }
+
+    /* access modifiers changed from: package-private */
+    public void cancelFileListLoadTask() {
+        CifsFileListLoader cifsFileListLoader = this.mCifsFileListLoader;
+        if (cifsFileListLoader != null) {
+            cifsFileListLoader.cancelTask();
+        }
+    }
+
+    private void showProgressDialog() {
+        this.mModelDialog.doShow(DIALOG_PROGRESS);
+    }
+
+    /* access modifiers changed from: private */
+    public void dismissProgressDialog() {
+        this.mModelDialog.doDismiss(DIALOG_PROGRESS);
+    }
+
+    /* JADX WARNING: Removed duplicated region for block: B:23:0x0049  */
+    /* JADX WARNING: Removed duplicated region for block: B:24:0x004b  */
+    /* JADX WARNING: Removed duplicated region for block: B:25:0x0069  */
+    /* JADX WARNING: Removed duplicated region for block: B:26:0x0084  */
+    /* JADX WARNING: Removed duplicated region for block: B:27:0x0099  */
+    /* JADX WARNING: Removed duplicated region for block: B:29:0x00ad  */
+    /* JADX WARNING: Removed duplicated region for block: B:31:? A[RETURN, SYNTHETIC] */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    private void showDialog(java.lang.String r11) {
+        /*
+            r10 = this;
+            int r0 = r11.hashCode()
+            r1 = -903480314(0xffffffffca25fc06, float:-2719489.5)
+            r2 = 0
+            if (r0 == r1) goto L_0x0038
+            r1 = -842795367(0xffffffffcdc3f699, float:-4.10964768E8)
+            if (r0 == r1) goto L_0x002e
+            r1 = -195189813(0xfffffffff45da3cb, float:-7.024046E31)
+            if (r0 == r1) goto L_0x0024
+            r1 = -21731516(0xfffffffffeb46744, float:-1.1989861E38)
+            if (r0 == r1) goto L_0x001a
+            goto L_0x0042
+        L_0x001a:
+            java.lang.String r0 = "dialog_progress"
+            boolean r0 = r11.equals(r0)
+            if (r0 == 0) goto L_0x0042
+            r0 = 0
+            goto L_0x0043
+        L_0x0024:
+            java.lang.String r0 = "dialog_file_read_error"
+            boolean r0 = r11.equals(r0)
+            if (r0 == 0) goto L_0x0042
+            r0 = 3
+            goto L_0x0043
+        L_0x002e:
+            java.lang.String r0 = "dialog_over_selected_number"
+            boolean r0 = r11.equals(r0)
+            if (r0 == 0) goto L_0x0042
+            r0 = 1
+            goto L_0x0043
+        L_0x0038:
+            java.lang.String r0 = "dialog_no_image_selected"
+            boolean r0 = r11.equals(r0)
+            if (r0 == 0) goto L_0x0042
+            r0 = 2
+            goto L_0x0043
+        L_0x0042:
+            r0 = -1
+        L_0x0043:
+            r1 = 2131625202(0x7f0e04f2, float:1.8877605E38)
+            switch(r0) {
+                case 0: goto L_0x0099;
+                case 1: goto L_0x0084;
+                case 2: goto L_0x0069;
+                case 3: goto L_0x004b;
+                default: goto L_0x0049;
+            }
+        L_0x0049:
+            r0 = 0
+            goto L_0x00ab
+        L_0x004b:
+            r4 = 2
+            r0 = 2131624887(0x7f0e03b7, float:1.8876966E38)
+            java.lang.String r5 = r10.getString(r0)
+            r6 = 0
+            r0 = 2131625078(0x7f0e0476, float:1.8877354E38)
+            java.lang.String r7 = r10.getString(r0)
+            r8 = 0
+            r0 = 2131625211(0x7f0e04fb, float:1.8877624E38)
+            java.lang.String r9 = r10.getString(r0)
+            r3 = r11
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r3, r4, r5, r6, r7, r8, r9)
+            goto L_0x00ab
+        L_0x0069:
+            r2 = 2
+            r0 = 2131624905(0x7f0e03c9, float:1.8877003E38)
+            java.lang.String r3 = r10.getString(r0)
+            r0 = 2131624906(0x7f0e03ca, float:1.8877005E38)
+            java.lang.String r4 = r10.getString(r0)
+            java.lang.String r5 = r10.getString(r1)
+            r6 = 0
+            r7 = 0
+            r1 = r11
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r1, r2, r3, r4, r5, r6, r7)
+            goto L_0x00ab
+        L_0x0084:
+            r2 = 2
+            r0 = 2131624871(0x7f0e03a7, float:1.8876934E38)
+            java.lang.String r3 = r10.getString(r0)
+            r4 = 0
+            r5 = 0
+            r6 = 0
+            java.lang.String r7 = r10.getString(r1)
+            r1 = r11
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r1, r2, r3, r4, r5, r6, r7)
+            goto L_0x00ab
+        L_0x0099:
+            android.content.res.Resources r0 = r10.getResources()
+            r1 = 2131624888(0x7f0e03b8, float:1.8876968E38)
+            java.lang.String r0 = r0.getString(r1)
+            epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r11, r2, r0)
+            r0.setCancelable(r2)
+        L_0x00ab:
+            if (r0 == 0) goto L_0x00b4
+            android.support.v4.app.FragmentManager r1 = r10.getSupportFragmentManager()
+            r0.show(r1, r11)
+        L_0x00b4:
+            return
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.memcardacc.MemcardImageGrid.showDialog(java.lang.String):void");
+    }
+
+    private void dismissDialog(String str) {
+        DialogFragment dialogFragment = (DialogFragment) getSupportFragmentManager().findFragmentByTag(str);
+        if (dialogFragment != null) {
+            dialogFragment.dismiss();
+        }
+    }
+
+    /* renamed from: com.epson.memcardacc.MemcardImageGrid$4 */
+    static /* synthetic */ class C09864 {
+        static final /* synthetic */ int[] $SwitchMap$android$os$AsyncTask$Status = new int[AsyncTask.Status.values().length];
+
+        /* JADX WARNING: Can't wrap try/catch for region: R(8:0|1|2|3|4|5|6|8) */
+        /* JADX WARNING: Failed to process nested try/catch */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:3:0x0014 */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:5:0x001f */
+        static {
+            /*
+                android.os.AsyncTask$Status[] r0 = android.os.AsyncTask.Status.values()
+                int r0 = r0.length
+                int[] r0 = new int[r0]
+                $SwitchMap$android$os$AsyncTask$Status = r0
+                int[] r0 = $SwitchMap$android$os$AsyncTask$Status     // Catch:{ NoSuchFieldError -> 0x0014 }
+                android.os.AsyncTask$Status r1 = android.os.AsyncTask.Status.PENDING     // Catch:{ NoSuchFieldError -> 0x0014 }
+                int r1 = r1.ordinal()     // Catch:{ NoSuchFieldError -> 0x0014 }
+                r2 = 1
+                r0[r1] = r2     // Catch:{ NoSuchFieldError -> 0x0014 }
+            L_0x0014:
+                int[] r0 = $SwitchMap$android$os$AsyncTask$Status     // Catch:{ NoSuchFieldError -> 0x001f }
+                android.os.AsyncTask$Status r1 = android.os.AsyncTask.Status.RUNNING     // Catch:{ NoSuchFieldError -> 0x001f }
+                int r1 = r1.ordinal()     // Catch:{ NoSuchFieldError -> 0x001f }
+                r2 = 2
+                r0[r1] = r2     // Catch:{ NoSuchFieldError -> 0x001f }
+            L_0x001f:
+                int[] r0 = $SwitchMap$android$os$AsyncTask$Status     // Catch:{ NoSuchFieldError -> 0x002a }
+                android.os.AsyncTask$Status r1 = android.os.AsyncTask.Status.FINISHED     // Catch:{ NoSuchFieldError -> 0x002a }
+                int r1 = r1.ordinal()     // Catch:{ NoSuchFieldError -> 0x002a }
+                r2 = 3
+                r0[r1] = r2     // Catch:{ NoSuchFieldError -> 0x002a }
+            L_0x002a:
+                return
+            */
+            throw new UnsupportedOperationException("Method not decompiled: com.epson.memcardacc.MemcardImageGrid.C09864.<clinit>():void");
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public void selectFileList(LinkedList<CifsFileInfo> linkedList) {
+        Iterator it = linkedList.iterator();
+        while (it.hasNext()) {
+            CifsFileInfo cifsFileInfo = (CifsFileInfo) it.next();
+            if (!cifsFileInfo.isReadable() || (!cifsFileInfo.isDirectory() && !hasExtensionJpg(cifsFileInfo.mFileName))) {
+                it.remove();
+            }
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public boolean hasExtensionJpg(String str) {
+        return Boolean.valueOf(str.toLowerCase(Locale.US).endsWith(".jpg")).booleanValue();
+    }
+
+    public void onPositiveClick(String str) {
+        if (((str.hashCode() == -195189813 && str.equals(DIALOG_FILE_READ_ERROR)) ? (char) 0 : 65535) == 0) {
+            finishMemCardImageGridActivity();
+        }
+    }
+
+    public void onNegativeClick(String str) {
+        if (((str.hashCode() == -195189813 && str.equals(DIALOG_FILE_READ_ERROR)) ? (char) 0 : 65535) == 0) {
+            this.mStartDirectory = true;
+            chengeTargetDirectory(MemcardConfig.INIT_CIFS_DIRECTORY);
+        }
+    }
+
+    private static class MyGridLayoutListener implements ViewTreeObserver.OnGlobalLayoutListener {
+        ImageFileListAdapter mAdapter;
+        private GridView mGridView;
+        private int mHorizontalSpacing;
+
+        public MyGridLayoutListener(GridView gridView, ImageFileListAdapter imageFileListAdapter, int i) {
+            this.mGridView = gridView;
+            this.mAdapter = imageFileListAdapter;
+            this.mHorizontalSpacing = i;
+        }
+
+        @TargetApi(16)
+        public void onGlobalLayout() {
+            int numColumns = this.mGridView.getNumColumns();
+            if (numColumns <= 0) {
+                return;
+            }
+            if (Build.VERSION.SDK_INT >= 16) {
+                setNewVerticalParams();
+                this.mGridView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
+                return;
+            }
+            int width = this.mGridView.getWidth();
+            int i = this.mHorizontalSpacing;
+            int i2 = ((width + i) / numColumns) - i;
+            this.mAdapter.setImageSize(i2, i2);
+            this.mGridView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
+        }
+
+        @TargetApi(16)
+        private void setNewVerticalParams() {
+            this.mGridView.setVerticalSpacing(this.mGridView.getHorizontalSpacing());
+            int columnWidth = this.mGridView.getColumnWidth();
+            this.mAdapter.setImageSize(columnWidth, columnWidth);
+        }
+    }
+
+    class CifsFileListLoader extends AsyncTask<String, Integer, Integer> {
+        private static final int PROGRESS_UPDATE_DIRCTORY = 1;
+        private static final int PROGRESS_UPDATE_THUMBNAIL = 2;
+        private static final int RESULT_FILE_LIST_CANNOT_GET = 1;
+        private static final int RESULT_OK = 0;
+        boolean mAdapterUpdateWaitDone;
+        String mBaseDir;
+        boolean mCanceling;
+        LinkedList<CifsFileInfo> mFileList;
+
+        CifsFileListLoader() {
+        }
+
+        /* access modifiers changed from: protected */
+        public void onPreExecute() {
+            EPLog.m313i(MemcardImageGrid.LOG_TAG, "doInBackground() onPreExecute().");
+        }
+
+        /* access modifiers changed from: package-private */
+        public boolean waiteAdapterUpdateAndCancelCheck() {
+            if (this.mCanceling) {
+                return false;
+            }
+            while (!this.mAdapterUpdateWaitDone) {
+                try {
+                    Thread.sleep(200);
+                    if (this.mCanceling) {
+                        return false;
+                    }
+                } catch (InterruptedException unused) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        /* access modifiers changed from: protected */
+        public synchronized Integer doInBackground(String... strArr) {
+            EPLog.m313i(MemcardImageGrid.LOG_TAG, "doInBackground() started");
+            if (MemcardImageGrid.this.mCifsAccess.initDefault(MemcardImageGrid.this, 1) == 0) {
+                return null;
+            }
+            if (MemcardImageGrid.this.mCifsAccess.connectDefaultStorageWidthDefaultAthInfo(MemcardImageGrid.this.mMemcardStorageType) == 0) {
+                MemcardImageGrid.this.mCifsAccess.free();
+                return null;
+            }
+            try {
+                String str = strArr[0];
+                LinkedList<CifsFileInfo> fileList = MemcardImageGrid.this.mDirectoryCache.getFileList(str);
+                if (fileList == null) {
+                    if (MemcardImageGrid.this.mStartDirectory) {
+                        str = "";
+                        fileList = MemcardImageGrid.this.mDirectoryCache.getFileList(str);
+                        if (fileList == null) {
+                            if (MemcardImageGrid.this.mCifsAccess.getFreeUnit() < 0) {
+                                MemcardImageGrid.this.mCifsAccess.disconnectStorage();
+                                MemcardImageGrid.this.mCifsAccess.free();
+                                return 1;
+                            }
+                            fileList = new LinkedList<>();
+                        }
+                    } else {
+                        fileList = new LinkedList<>();
+                    }
+                }
+                MemcardImageGrid.this.mStartDirectory = false;
+                MemcardImageGrid.this.selectFileList(fileList);
+                this.mBaseDir = str;
+                this.mFileList = fileList;
+                this.mAdapterUpdateWaitDone = false;
+                publishProgress(new Integer[]{1});
+                if (waiteAdapterUpdateAndCancelCheck()) {
+                    EPLog.m313i(MemcardImageGrid.LOG_TAG, "doInBackground() next createThumbnail");
+                    createThumbnail(MemcardImageGrid.this.mCifsAccess);
+                }
+                EPLog.m313i(MemcardImageGrid.LOG_TAG, "doInBackground() disconnectStorage()");
+                MemcardImageGrid.this.mCifsAccess.disconnectStorage();
+                if (MemcardImageGrid.this.discconectOnThreadFinish) {
+                    EPLog.m305d(MemcardImageGrid.LOG_TAG, "disconnectOnThreadFinish");
+                    WiFiDirectManager.disconnect(MemcardImageGrid.this, WiFiDirectManager.DEVICE_TYPE_PRINTER, MemcardUtil.getPrinterIpAddress(MemcardImageGrid.this));
+                }
+                EPLog.m313i(MemcardImageGrid.LOG_TAG, "doInBackground() end");
+                MemcardImageGrid.this.mCifsAccess.free();
+                return 0;
+            } catch (UnsupportedEncodingException e) {
+                try {
+                    e.printStackTrace();
+                    EPLog.m313i(MemcardImageGrid.LOG_TAG, "exception in doInBackground()");
+                    return null;
+                } finally {
+                    MemcardImageGrid.this.mCifsAccess.free();
+                }
+            }
+        }
+
+        public void cancelTask() {
+            if (!this.mCanceling) {
+                EPLog.m313i(MemcardImageGrid.LOG_TAG, "task canceling...");
+                this.mCanceling = true;
+                MemcardImageGrid.this.mCifsAccess.cancel();
+            }
+        }
+
+        /* access modifiers changed from: protected */
+        public void onProgressUpdate(Integer... numArr) {
+            if (numArr[0].intValue() == 1) {
+                MemcardImageGrid.this.mImageFileListAdapter.setFileList(this.mBaseDir, this.mFileList);
+                MemcardImageGrid.this.mImageFileListAdapter.notifyDataSetChanged();
+                this.mAdapterUpdateWaitDone = true;
+                MemcardImageGrid.this.updateSelectedNumber();
+                MemcardImageGrid.this.dismissProgressDialog();
+                return;
+            }
+            MemcardImageGrid.this.mImageFileListAdapter.notifyDataSetChanged();
+        }
+
+        /* access modifiers changed from: protected */
+        public void onPostExecute(Integer num) {
+            EPLog.m313i(MemcardImageGrid.LOG_TAG, "doInBackground() done.");
+            if (num == null) {
+                MemcardImageGrid.this.dismissProgressDialog();
+                MemcardImageGrid.this.localShowDialog(MemcardImageGrid.DIALOG_FILE_READ_ERROR);
+                return;
+            }
+            switch (num.intValue()) {
+                case 0:
+                    MemcardImageGrid.this.mImageFileListAdapter.notifyDataSetChanged();
+                    return;
+                case 1:
+                    MemcardImageGrid.this.localShowDialog(MemcardImageGrid.DIALOG_FILE_READ_ERROR);
+                    return;
+                default:
+                    return;
+            }
+        }
+
+        private int createThumbnail(CifsAccess cifsAccess) throws UnsupportedEncodingException {
+            MemcardImageGrid.this.mBitmapCache.setCifsAccess(cifsAccess);
+            Iterator<ImageFileListAdapter.FileInfoWithCheck> fileInfoIterator = MemcardImageGrid.this.mImageFileListAdapter.getFileInfoIterator();
+            while (fileInfoIterator.hasNext()) {
+                if (this.mCanceling) {
+                    return 0;
+                }
+                ImageFileListAdapter.FileInfoWithCheck next = fileInfoIterator.next();
+                if (next.needThumbNail()) {
+                    if (next.isDirectory()) {
+                        next.setThumbNail((Bitmap) null);
+                    } else {
+                        String fileName = next.getFileName();
+                        EPLog.m313i(MemcardImageGrid.LOG_TAG, "name <" + fileName + ">");
+                        next.setThumbNail(MemcardImageGrid.this.mBitmapCache.cacheOrMakeThumbnailBitmap(fileName, next.getFullPath()));
+                    }
+                    publishProgress(new Integer[]{2});
+                }
+            }
+            return 1;
+        }
+    }
+}

+ 74 - 0
app/src/main/java/com/epson/memcardacc/MemcardPhotocopyTop.java

@@ -0,0 +1,74 @@
+package com.epson.memcardacc;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import com.epson.memcardacc.MemcardTempAlertDialog;
+import epson.print.C2135R;
+
+public class MemcardPhotocopyTop extends MemcardTopSuper {
+    protected static final int DIALOG_TYPE_NOT_READY = 101;
+
+    /* access modifiers changed from: protected */
+    public int getStorageSetType() {
+        return 2;
+    }
+
+    public void launchReaderActivity(int i) {
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        this.mBitmapCache = MemcardBitmapCache.getInstance(this);
+        if (this.mBitmapCache == null || !this.mBitmapCache.checkEnv()) {
+            new MemcardTempAlertDialog().showAlertDialog(this, new MemcardTempAlertDialog.DialogCallback() {
+                public void onPositiveCallback() {
+                    MemcardPhotocopyTop.this.finish();
+                }
+            });
+        }
+        if (bundle == null) {
+            CifsAccess.clearSmbAuthInfo();
+        }
+        super.onCreate(bundle);
+        setContentView((int) C2135R.layout.activity_mcphotocopy_top);
+        setActionBar((int) C2135R.string.FunctionName_iPrint_PhotoTransfer, true);
+        this.mLaunchType = 0;
+        findViewById(C2135R.C2137id.photocopy_button).setOnClickListener(new View.OnClickListener() {
+            public void onClick(View view) {
+                MemcardPhotocopyTop.this.launchWriter();
+            }
+        });
+    }
+
+    /* access modifiers changed from: private */
+    public void launchWriter() {
+        if (this.mLaunchType == 0) {
+            this.mLaunchType = 1;
+            startMemcardStorageCheck();
+        }
+    }
+
+    public void back_home_button_clicked(View view) {
+        finish();
+    }
+
+    /* access modifiers changed from: package-private */
+    public void localShowDialog(int i) {
+        if (!this.mActivityIsFinishing && this.mIsActivityForeground) {
+            LocalAlertDialogFragment localAlertDialogFragment = null;
+            if (i == 1) {
+                localAlertDialogFragment = LocalAlertDialogFragment.newInstance(C2135R.string.mcphotocopy_media_not_found_message, C2135R.string.mcphotocopy_media_not_found_title, 101);
+            }
+            if (localAlertDialogFragment != null) {
+                localAlertDialogFragment.show(getSupportFragmentManager(), "error_dialog");
+            } else {
+                super.localShowDialog(i);
+            }
+        }
+    }
+
+    public void launchWriterActivity() {
+        startActivity(new Intent(this, PhotoCopyImageSelectActivity.class));
+    }
+}

Some files were not shown because too many files changed in this diff