Browse Source

add activity

liuyuqi-dellpc 3 years ago
parent
commit
8f73acc7a1
100 changed files with 17981 additions and 43 deletions
  1. 12 40
      app/src/main/AndroidManifest.xml
  2. 268 0
      app/src/main/java/com/epson/iprint/apf/ApfAdapter.java
  3. 89 0
      app/src/main/java/com/epson/iprint/apf/ApfEpImageAdapter.java
  4. 172 0
      app/src/main/java/com/epson/iprint/apf/ApfPreviewView.java
  5. 72 0
      app/src/main/java/com/epson/iprint/apf/ImageSizeConversionCache.java
  6. 447 0
      app/src/main/java/com/epson/iprint/shared/EpsoniPrintSharedActivity.java
  7. 84 0
      app/src/main/java/com/epson/iprint/shared/ExtSharedParam.java
  8. 26 0
      app/src/main/java/com/epson/iprint/shared/FileFormatErrorException.java
  9. 99 0
      app/src/main/java/com/epson/iprint/shared/ManagePreferences.java
  10. 26 0
      app/src/main/java/com/epson/iprint/shared/ParametersErrorException.java
  11. 14 0
      app/src/main/java/com/epson/iprint/shared/SharedDataException.java
  12. 23 0
      app/src/main/java/com/epson/iprint/shared/SharedParam.java
  13. 139 0
      app/src/main/java/com/epson/iprint/shared/SharedParamPhoto.java
  14. 93 0
      app/src/main/java/com/epson/iprint/shared/SharedParamScan.java
  15. 105 0
      app/src/main/java/com/epson/iprint/shared/SharedParamStatus.java
  16. 48 0
      app/src/main/java/com/epson/iprint/storage/ConfirmCancelDialog.java
  17. 17 0
      app/src/main/java/com/epson/iprint/storage/ISecureKeyStore.java
  18. 96 0
      app/src/main/java/com/epson/iprint/storage/LocalProgressDialog.java
  19. 16 0
      app/src/main/java/com/epson/iprint/storage/Network.java
  20. 53 0
      app/src/main/java/com/epson/iprint/storage/OneButtonDialogFragment.java
  21. 37 0
      app/src/main/java/com/epson/iprint/storage/SecureKeyStore.java
  22. 238 0
      app/src/main/java/com/epson/iprint/storage/StorageActivity.java
  23. 76 0
      app/src/main/java/com/epson/iprint/storage/StorageItem.java
  24. 148 0
      app/src/main/java/com/epson/iprint/storage/StorageProcessActivity.java
  25. 523 0
      app/src/main/java/com/epson/iprint/storage/StorageProcessDownloadActivity.java
  26. 276 0
      app/src/main/java/com/epson/iprint/storage/StorageProcessUploadActivity.java
  27. 291 0
      app/src/main/java/com/epson/iprint/storage/StorageSecureStore.java
  28. 168 0
      app/src/main/java/com/epson/iprint/storage/StorageServiceClient.java
  29. 151 0
      app/src/main/java/com/epson/iprint/storage/StorageSignInActivity.java
  30. 137 0
      app/src/main/java/com/epson/iprint/storage/StorageWaitingActivity.java
  31. 74 0
      app/src/main/java/com/epson/iprint/storage/box/BoxAuthStorage.java
  32. 488 0
      app/src/main/java/com/epson/iprint/storage/box/BoxNetClient.java
  33. 101 0
      app/src/main/java/com/epson/iprint/storage/box/BoxNetSignInActivity.java
  34. 28 0
      app/src/main/java/com/epson/iprint/storage/dropbox/DropboxClientFactory.java
  35. 57 0
      app/src/main/java/com/epson/iprint/storage/dropbox/DropboxV2Adapter.java
  36. 365 0
      app/src/main/java/com/epson/iprint/storage/dropbox/DropboxV2Client.java
  37. 67 0
      app/src/main/java/com/epson/iprint/storage/dropbox/DropboxV2SignInActivity.java
  38. 195 0
      app/src/main/java/com/epson/iprint/storage/evernote/EvernoteClient.java
  39. 278 0
      app/src/main/java/com/epson/iprint/storage/evernote/EvernoteRequest.java
  40. 48 0
      app/src/main/java/com/epson/iprint/storage/evernote/EvernoteSignInActivity.java
  41. 17 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/ActivityWrapper.java
  42. 5 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/Canceller.java
  43. 35 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/DownloadFile.java
  44. 144 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/DownloadTask.java
  45. 61 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/DownloaderWrapper.java
  46. 54 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/DriveListTask.java
  47. 236 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/DriveWriter.java
  48. 84 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/FileListAdapter.java
  49. 63 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/GoogleDownloadContract.java
  50. 246 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/GoogleDownloadPresenter.java
  51. 286 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/GoogleDownloader.java
  52. 76 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/GoogleDriveFile.java
  53. 9 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/GoogleDriveMimeType.java
  54. 127 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/GoogleV3UploadClient.java
  55. 212 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/GoogleV3UploadSignInActivity.java
  56. 24 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/Injection.java
  57. 108 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/IprintGoogleSignIn.java
  58. 382 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/ListAndDownloadActivity.java
  59. 16 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/OnlineFile.java
  60. 26 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/ParentFolder.java
  61. 49 0
      app/src/main/java/com/epson/iprint/storage/gdrivev3/PlayServiceDialogManager.java
  62. 59 0
      app/src/main/java/com/epson/iprint/storage/onedrive/OneDriveAuthenticator.java
  63. 745 0
      app/src/main/java/com/epson/iprint/storage/onedrive/OneDriveClient.java
  64. 33 0
      app/src/main/java/com/epson/iprint/storage/onedrive/OneDriveSignInActivity.java
  65. 69 0
      app/src/main/java/com/epson/iprint/storage/onedrive/OneDriveStorageProcessUploadActivity.java
  66. 1 0
      app/src/main/java/com/epson/memcardacc/LocalImageSelectActivity.java
  67. 5 3
      app/src/main/java/com/epson/memcardacc/PhotoCopyImageSelectActivity.java
  68. 3 0
      app/src/main/java/epson/maintain/activity/GetPrinterReplyData.java
  69. 15 0
      app/src/main/java/epson/print/activity/AFolderPhoto.java
  70. 569 0
      app/src/main/java/epson/print/copy/ActivityBase.java
  71. 12 0
      app/src/main/java/epson/print/copy/Component/ecopycomponent/CopyParams.java
  72. 98 0
      app/src/main/java/epson/print/copy/Component/ecopycomponent/CopyPhotoSettingHandler.java
  73. 342 0
      app/src/main/java/epson/print/copy/Component/ecopycomponent/ECopyComponent.java
  74. 151 0
      app/src/main/java/epson/print/copy/Component/ecopycomponent/ECopyOptionContext.java
  75. 1577 0
      app/src/main/java/epson/print/copy/Component/ecopycomponent/ECopyOptionItem.java
  76. 711 0
      app/src/main/java/epson/print/copy/Component/ecopycomponent/ECopyPreview.java
  77. 196 0
      app/src/main/java/epson/print/copy/Component/ecopycomponent/PreviewScanTask.java
  78. 165 0
      app/src/main/java/epson/print/copy/Component/ecopycomponent/RemoteCopyGetOptionTask.java
  79. 142 0
      app/src/main/java/epson/print/copy/Component/ecopycomponent/RemoteCopyPhotoGetOptionTask.java
  80. 175 0
      app/src/main/java/epson/print/copy/Component/ecopycomponent/RemoteCopyPhotoSetOptionTask.java
  81. 631 0
      app/src/main/java/epson/print/copy/Component/ecopycomponent/RemoteCopyPhotoTask.java
  82. 339 0
      app/src/main/java/epson/print/copy/Component/ecopycomponent/RemoteCopySetOptionTask.java
  83. 574 0
      app/src/main/java/epson/print/copy/Component/ecopycomponent/RemoteCopyTask.java
  84. 240 0
      app/src/main/java/epson/print/copy/Component/ecopycomponent/RemoteDeviceTask.java
  85. 190 0
      app/src/main/java/epson/print/copy/Component/eremoteoperation/ERemoteCombo.java
  86. 356 0
      app/src/main/java/epson/print/copy/Component/eremoteoperation/ERemoteCopy.java
  87. 200 0
      app/src/main/java/epson/print/copy/Component/eremoteoperation/ERemoteCopyPhoto.java
  88. 73 0
      app/src/main/java/epson/print/copy/Component/eremoteoperation/ERemoteDevice.java
  89. 655 0
      app/src/main/java/epson/print/copy/Component/eremoteoperation/ERemoteOperation.java
  90. 59 0
      app/src/main/java/epson/print/copy/Component/eremoteoperation/ERemotePrinter.java
  91. 60 0
      app/src/main/java/epson/print/copy/Component/eremoteoperation/ERemoteScanner.java
  92. 10 0
      app/src/main/java/epson/print/copy/Component/escandevice/EScanDevice.java
  93. 47 0
      app/src/main/java/epson/print/copy/Component/escandevice/IScanController.java
  94. 642 0
      app/src/main/java/epson/print/copy/CopyActivity.java
  95. 139 0
      app/src/main/java/epson/print/copy/CopyProcess.java
  96. 340 0
      app/src/main/java/epson/print/copy/CopyScaleActivity.java
  97. 161 0
      app/src/main/java/epson/print/copy/CopySettingActivity.java
  98. 159 0
      app/src/main/java/epson/print/copy/DisplayUtil.java
  99. 9 0
      app/src/main/java/epson/print/ecclient/DebugDisplay.java
  100. 124 0
      app/src/main/java/epson/print/ecclient/EcClientLib.java

+ 12 - 40
app/src/main/AndroidManifest.xml

@@ -356,19 +356,7 @@
             android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
             android:resizeableActivity="false"
             android:windowSoftInputMode="stateHidden" />
-        <activity
-            android:name="com.dropbox.core.android.AuthActivity"
-            android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
-            android:launchMode="singleTask"
-            android:resizeableActivity="false">
-            <intent-filter>
-                <data android:scheme="db-73ps18y0cjibceg" />
-                <action android:name="android.intent.action.VIEW" />
 
-                <category android:name="android.intent.category.BROWSABLE" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-        </activity>
         <activity
             android:name="com.epson.iprint.storage.onedrive.OneDriveSignInActivity"
             android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
@@ -384,9 +372,7 @@
             android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
             android:resizeableActivity="false"
             android:windowSoftInputMode="stateHidden" />
-        <activity
-            android:name="com.box.boxandroidlibv2.activities.OAuthActivity"
-            android:resizeableActivity="false" />
+
         <activity
             android:name="com.epson.iprint.storage.evernote.EvernoteSignInActivity"
             android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
@@ -414,14 +400,6 @@
             android:resizeableActivity="false"
             android:screenOrientation="unspecified"
             android:theme="@style/AppTheme.Translucent" />
-        <activity
-            android:name="com.evernote.client.android.EvernoteOAuthActivity"
-            android:configChanges="keyboardHidden|orientation"
-            android:resizeableActivity="false" />
-        <activity
-            android:name="com.evernote.client.android.login.EvernoteLoginActivity"
-            android:configChanges="keyboardHidden|orientation"
-            android:resizeableActivity="false" />
         <activity
             android:name="epson.maintain.activity.GetPrinterReplyData"
             android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
@@ -507,7 +485,7 @@
         <activity
             android:name="com.epson.memcardacc.DirectorySelecterActivity"
             android:resizeableActivity="false"
-            android:theme="@style/Theme.Dialog" />
+            android:theme="@style/Base.AlertDialog.AppCompat" />
         <activity
             android:name="com.epson.memcardacc.MemcardPhotocopyTop"
             android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
@@ -520,15 +498,15 @@
             android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
             android:resizeableActivity="false" />
         <activity
-            android:name="com.epson.cameracopy.p006ui.CameraPreviewActivity"
+            android:name="com.epson.cameracopy.ui.CameraPreviewActivity"
             android:resizeableActivity="false"
             android:screenOrientation="portrait" />
         <activity
-            android:name="com.epson.cameracopy.p006ui.FolderSelectActivity"
+            android:name="com.epson.cameracopy.ui.FolderSelectActivity"
             android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
             android:resizeableActivity="false" />
         <activity
-            android:name="com.epson.cameracopy.p006ui.ImagePreviewActivity"
+            android:name="com.epson.cameracopy.ui.ImagePreviewActivity"
             android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
             android:resizeableActivity="false">
             <meta-data
@@ -536,32 +514,32 @@
                 android:value="com.epson.cameracopy.ui.CameraPreviewActivity" />
         </activity>
         <activity
-            android:name="com.epson.cameracopy.p006ui.CameraPreviewOptionActivity"
+            android:name="com.epson.cameracopy.ui.CameraPreviewOptionActivity"
             android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
             android:resizeableActivity="false" />
         <activity
-            android:name="com.epson.cameracopy.p006ui.PrintPreviewActivity"
+            android:name="com.epson.cameracopy.ui.PrintPreviewActivity"
             android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
             android:resizeableActivity="false" />
         <activity
-            android:name="com.epson.cameracopy.p006ui.CameraPrintSettingActivity"
+            android:name="com.epson.cameracopy.ui.CameraPrintSettingActivity"
             android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
             android:resizeableActivity="false" />
         <activity
-            android:name="com.epson.cameracopy.p006ui.CameraPrintProgress"
+            android:name="com.epson.cameracopy.ui.CameraPrintProgress"
             android:configChanges="locale|keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|layoutDirection|fontScale"
             android:resizeableActivity="false"
             android:theme="@style/Theme.MyDialog" />
         <activity
-            android:name="com.epson.cameracopy.p006ui.CropImageActivity"
+            android:name="com.epson.cameracopy.ui.CropImageActivity"
             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize"
             android:resizeableActivity="false" />
         <activity
-            android:name="com.epson.cameracopy.p006ui.DocumentSizeSettingActivity"
+            android:name="com.epson.cameracopy.ui.DocumentSizeSettingActivity"
             android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
             android:resizeableActivity="false" />
         <activity
-            android:name="com.epson.cameracopy.p006ui.DocumentSizeEditActivity"
+            android:name="com.epson.cameracopy.ui.DocumentSizeEditActivity"
             android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
             android:resizeableActivity="false" />
         <activity
@@ -666,12 +644,6 @@
             android:resizeableActivity="false"
             android:theme="@style/AppTheme.Translucent_epWiFiDirectManager" />
 
-        <provider
-            android:name="android.arch.lifecycle.ProcessLifecycleOwnerInitializer"
-            android:authorities="epson.print.lifecycle-trojan"
-            android:exported="false"
-            android:multiprocess="true" />
-
         <activity
             android:name="com.epson.mobilephone.common.license.LicenseTopActivity"
             android:theme="@style/LicenseTheme" />

+ 268 - 0
app/src/main/java/com/epson/iprint/apf/ApfAdapter.java

@@ -0,0 +1,268 @@
+package com.epson.iprint.apf;
+
+import android.content.Context;
+import android.graphics.BitmapFactory;
+import android.media.ExifInterface;
+import android.os.Environment;
+import android.util.Log;
+import com.epson.p007sd.common.apf.apflib;
+import epson.common.ExternalFileUtils;
+import epson.common.ImageUtil;
+import epson.print.CommonDefine;
+import epson.print.EPImageUtil;
+import epson.print.MyPrinter;
+import epson.print.Util.BmpFileSize;
+import java.io.File;
+import java.io.IOException;
+import java.util.Locale;
+import java.util.UUID;
+import java.util.concurrent.locks.ReentrantLock;
+
+public class ApfAdapter {
+    protected static final String APF_IMAGE_DIR = "apf_image";
+    public static final String BMP_EXTENSION = ".bmp";
+    protected static final String FILE_PREFIX_APF = "apf";
+    protected static final String FILE_PREFIX_TMP1 = "tmp1_";
+    protected static final String FILE_PREFIX_TMP2 = "tmp2_";
+    protected static final ReentrantLock mApfLock = new ReentrantLock();
+    protected File mApfImageDir = new File(ExternalFileUtils.getInstance(this.mApplicationContext).getCacheDir(), APF_IMAGE_DIR);
+    protected Context mApplicationContext;
+
+    public ApfAdapter(Context context) {
+        this.mApplicationContext = context.getApplicationContext();
+        ExternalFileUtils.getInstance(this.mApplicationContext).createTempFolder(this.mApfImageDir.getPath());
+    }
+
+    public static void clearDirectory(Context context) {
+        deleteDirectory(new File(ExternalFileUtils.getInstance(context).getCacheDir(), APF_IMAGE_DIR));
+    }
+
+    public static void deleteDirectory(File file) {
+        if (file.exists()) {
+            if (!file.isDirectory()) {
+                file.delete();
+                return;
+            }
+            for (File file2 : file.listFiles()) {
+                if (file2.isDirectory()) {
+                    deleteDirectory(file2);
+                }
+                if (file2.exists()) {
+                    file2.delete();
+                }
+            }
+        }
+    }
+
+    public static int getExifRotationValue(String str) {
+        try {
+            return new ExifInterface(str).getAttributeInt(android.support.media.ExifInterface.TAG_ORIENTATION, 0);
+        } catch (IOException unused) {
+            return 0;
+        }
+    }
+
+    public static File rotateWithExifValue(int i, File file, File file2) {
+        EPImageUtil ePImageUtil = new EPImageUtil();
+        if (i == 3) {
+            ePImageUtil.rotate180Image(file.toString(), file2.toString());
+            return file2;
+        } else if (i == 6) {
+            ePImageUtil.rotateR90Image(file.toString(), file2.toString());
+            return file2;
+        } else if (i != 8) {
+            return file;
+        } else {
+            ePImageUtil.rotateR270Image(file.toString(), file2.toString());
+            return file2;
+        }
+    }
+
+    public String getApfResult(String str, int i, int i2, int i3) {
+        String apfFilename = getApfFilename(str, i, i2, i3);
+        if (canUseApfResult(apfFilename)) {
+            return apfFilename;
+        }
+        try {
+            mApfLock.lockInterruptibly();
+            if (!processApf(str, apfFilename, i == 1, i2 == 1, i3 == 1)) {
+                mApfLock.unlock();
+                return null;
+            }
+            mApfLock.unlock();
+            return apfFilename;
+        } catch (InterruptedException unused) {
+            return null;
+        } catch (Throwable th) {
+            mApfLock.unlock();
+            throw th;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public boolean canUseApfResult(String str) {
+        return new File(str).exists();
+    }
+
+    public static String getMimeTypeWithBitmapFactory(String str) {
+        BitmapFactory.Options options = new BitmapFactory.Options();
+        options.inJustDecodeBounds = true;
+        BitmapFactory.decodeFile(str, options);
+        return options.outMimeType;
+    }
+
+    public boolean processApf(String str, String str2, boolean z, boolean z2, boolean z3) {
+        String str3;
+        int i;
+        File file = null;
+        try {
+            String mimeTypeWithBitmapFactory = getMimeTypeWithBitmapFactory(str);
+            if (CommonDefine.IMAGE_TYPE_BMP.equals(mimeTypeWithBitmapFactory)) {
+                str3 = str;
+                i = 0;
+            } else if ("image/png".equals(mimeTypeWithBitmapFactory)) {
+                file = convertPngToBmp(str);
+                if (file != null) {
+                    str3 = file.toString();
+                    i = 0;
+                } else {
+                    throw new OutOfMemoryError("in convertPngToBmp()");
+                }
+            } else if (!"image/jpeg".equals(mimeTypeWithBitmapFactory)) {
+                return false;
+            } else {
+                file = convertJpegToBmp(str);
+                if (file != null) {
+                    i = getExifRotationValue(str);
+                    str3 = file.toString();
+                } else {
+                    throw new OutOfMemoryError("in convertJpegToBmp()");
+                }
+            }
+            apflib apflib = new apflib();
+            apflib.interrupt();
+            boolean apfFile = apflib.apfFile(str, i, str3, str2, z, z2, z3);
+            Log.v("ApfAdapter", "apf returns <" + apfFile + ">");
+            if (!apfFile) {
+                throw new OutOfMemoryError("in apflib.apfFile()");
+            } else if (!BmpFileSize.checkDiskCapacity(Environment.getExternalStorageDirectory().getPath(), 8192)) {
+                throw new OutOfMemoryError("in apflib.apfFile() size check");
+            } else if (file == null || !file.exists()) {
+                return true;
+            } else {
+                file.delete();
+                return true;
+            }
+        } catch (OutOfMemoryError e) {
+            throw e;
+        } catch (Exception unused) {
+            if (file != null && file.exists()) {
+                file.delete();
+            }
+            return false;
+        } catch (Throwable th) {
+            if (file != null && file.exists()) {
+                file.delete();
+            }
+            throw th;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public File convertPngToBmp(String str) {
+        String png2jpeg = ImageUtil.png2jpeg(this.mApplicationContext, str, 1);
+        if (png2jpeg == null) {
+            return null;
+        }
+        File file = new File(new File(ExternalFileUtils.getInstance(this.mApplicationContext).getTempViewDir()), png2jpeg);
+        if (!file.exists()) {
+            return null;
+        }
+        try {
+            File file2 = new File(getTmpBmpFilename(str, FILE_PREFIX_TMP1));
+            if (new EPImageUtil().jpg2bmp(file.toString(), file2.toString(), 1) != 0) {
+                return null;
+            }
+            file.delete();
+            return file2;
+        } finally {
+            file.delete();
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public File convertJpegToBmp(String str) {
+        File file;
+        File file2 = null;
+        try {
+            file = new File(getTmpBmpFilename(str, FILE_PREFIX_TMP1));
+            try {
+                if (new EPImageUtil().jpg2bmp(str, file.toString(), 1) != 0) {
+                    if (file.exists()) {
+                        file.delete();
+                    }
+                    return null;
+                }
+                int exifRotationValue = getExifRotationValue(str);
+                File file3 = new File(getTmpBmpFilename(str, FILE_PREFIX_TMP2));
+                try {
+                    File rotateWithExifValue = rotateWithExifValue(exifRotationValue, file, file3);
+                    if (rotateWithExifValue != file && file.exists()) {
+                        file.delete();
+                    }
+                    if (rotateWithExifValue != file3 && file3.exists()) {
+                        file3.delete();
+                    }
+                    return rotateWithExifValue;
+                } catch (Throwable th) {
+                    th = th;
+                    file2 = file3;
+                    if (!(file == null || file == null || !file.exists())) {
+                        file.delete();
+                    }
+                    if (!(file2 == null || file2 == null || !file2.exists())) {
+                        file2.delete();
+                    }
+                    throw th;
+                }
+            } catch (Throwable th2) {
+                th = th2;
+                file.delete();
+                file2.delete();
+                throw th;
+            }
+        } catch (Throwable th3) {
+            th = th3;
+            file = null;
+            file.delete();
+            file2.delete();
+            throw th;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public String getTmpBmpFilename(String str, String str2) {
+        if (this.mApfImageDir == null) {
+            return null;
+        }
+        UUID nameUUIDFromBytes = UUID.nameUUIDFromBytes(str.getBytes());
+        File file = this.mApfImageDir;
+        return new File(file, str2 + nameUUIDFromBytes.toString() + ".bmp").toString();
+    }
+
+    public String getApfFilename(String str, int i, int i2, int i3) {
+        return getTmpBmpFilename(str, String.format(Locale.US, "%s%ds%dc%d_", new Object[]{FILE_PREFIX_APF, Integer.valueOf(i), Integer.valueOf(i2), Integer.valueOf(i3)}));
+    }
+
+    public static String getCurrentPrinterId(Context context) {
+        String name = MyPrinter.getCurPrinter(context).getName();
+        if (name == null) {
+            return "";
+        }
+        return name.replaceFirst("(?i)^epson +", "");
+    }
+
+    public static boolean isEpsonColor(Context context, int i, int i2, boolean z) {
+        return new apflib().isDspEpsonColorLogo(getCurrentPrinterId(context), i, i2, z);
+    }
+}

+ 89 - 0
app/src/main/java/com/epson/iprint/apf/ApfEpImageAdapter.java

@@ -0,0 +1,89 @@
+package com.epson.iprint.apf;
+
+import android.content.Context;
+import epson.print.EPImage;
+import epson.print.EPImageList;
+import epson.print.service.PrintService;
+import java.io.File;
+import java.util.Iterator;
+
+public class ApfEpImageAdapter {
+
+    public interface ProgressCallback {
+        boolean updateApfProgress(int i);
+    }
+
+    public static EPImageList getApfImageList(Context context, EPImageList ePImageList, PrintService printService) {
+        int i;
+        EPImage ePImage;
+        String str;
+        EPImageList ePImageList2 = ePImageList;
+        PrintService printService2 = printService;
+        if (ePImageList2 == null || ePImageList2.imageList == null) {
+            return null;
+        }
+        ApfAdapter apfAdapter = new ApfAdapter(context);
+        EPImageList ePImageList3 = new EPImageList();
+        int size = ePImageList2.imageList.size();
+        boolean z = ePImageList2.apfModeInPrinting == 1;
+        boolean z2 = ePImageList.getSharpness() == 1;
+        boolean z3 = ePImageList.getClearlyVivid() == 1;
+        Iterator<EPImage> it = ePImageList2.imageList.iterator();
+        int i2 = 0;
+        while (it.hasNext()) {
+            EPImage next = it.next();
+            if (printService2 != null && !printService2.updateApfProgress((i2 * 100) / size)) {
+                return null;
+            }
+            String apfFilename = apfAdapter.getApfFilename(next.loadImageFileName, ePImageList2.apfModeInPrinting, ePImageList.getSharpness(), ePImageList.getClearlyVivid());
+            try {
+                if (!new File(apfFilename).exists()) {
+                    str = apfFilename;
+                    ePImage = next;
+                    i = i2;
+                    if (!apfAdapter.processApf(next.loadImageFileName, apfFilename, z, z2, z3)) {
+                        return null;
+                    }
+                } else {
+                    str = apfFilename;
+                    ePImage = next;
+                    i = i2;
+                }
+                String str2 = str;
+                int i3 = i;
+                EPImage ePImage2 = new EPImage(str2, i3);
+                i2 = i3 + 1;
+                EPImage ePImage3 = ePImage;
+                copyPositionParams(ePImage3, ePImage2);
+                ePImage2.setOrgName(ePImage3.loadImageFileName);
+                ePImage2.loadImageFileName = str2;
+                ePImageList3.add(ePImage2);
+            } catch (OutOfMemoryError unused) {
+                return null;
+            } catch (Exception unused2) {
+                return null;
+            }
+        }
+        if (!printService2.updateApfProgress(100)) {
+            return null;
+        }
+        return ePImageList3;
+    }
+
+    private static void copyPositionParams(EPImage ePImage, EPImage ePImage2) {
+        ePImage2.previewPaperRectLeft = ePImage.previewPaperRectLeft;
+        ePImage2.previewPaperRectTop = ePImage.previewPaperRectTop;
+        ePImage2.previewPaperRectRight = ePImage.previewPaperRectRight;
+        ePImage2.previewPaperRectBottom = ePImage.previewPaperRectBottom;
+        ePImage2.previewImageRectLeft = ePImage.previewImageRectLeft;
+        ePImage2.previewImageRectTop = ePImage.previewImageRectTop;
+        ePImage2.previewImageRectRight = ePImage.previewImageRectRight;
+        ePImage2.previewImageRectBottom = ePImage.previewImageRectBottom;
+        ePImage2.previewWidth = ePImage.previewWidth;
+        ePImage2.previewHeight = ePImage.previewHeight;
+        ePImage2.isPaperLandScape = ePImage.isPaperLandScape;
+        ePImage2.scaleFactor = ePImage.scaleFactor;
+        ePImage2.previewImageRectCenterX = ePImage.previewImageRectCenterX;
+        ePImage2.previewImageRectCenterY = ePImage.previewImageRectCenterY;
+    }
+}

+ 172 - 0
app/src/main/java/com/epson/iprint/apf/ApfPreviewView.java

@@ -0,0 +1,172 @@
+package com.epson.iprint.apf;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.os.Handler;
+import android.support.annotation.NonNull;
+import com.epson.iprint.apf.ImageSizeConversionCache;
+import epson.print.EPImage;
+import epson.print.EPImageCreator;
+import epson.print.EPImageList;
+import epson.print.IprintApplication;
+import epson.print.phlayout.PhotoPreview;
+import epson.print.phlayout.PhotoPreviewImageList;
+import java.io.File;
+
+public class ApfPreviewView implements PhotoPreview.PreviewBitmapMaker {
+    public static final String APF_RESIZE_FILE_PREFIX = "rsapf_";
+    protected ApfAdapter mApfAdapter;
+    private int mApfMode;
+    protected Context mApplicationContext;
+    private int mClearlyVividMode;
+    protected PhotoPreview mEPPreviewImageView;
+    private ImageSizeConversionCache mResizeCache = new ImageSizeConversionCache();
+    private int mSharpnessValue;
+
+    public void setZoomControlHandler(Handler handler) {
+        this.mEPPreviewImageView.setZoomControlHandler(handler);
+    }
+
+    public void init(Context context, PhotoPreview photoPreview) {
+        this.mApplicationContext = context.getApplicationContext();
+        this.mApfAdapter = new ApfAdapter(this.mApplicationContext);
+        this.mEPPreviewImageView = photoPreview;
+        this.mEPPreviewImageView.setPreviewBitmapMaker(this);
+    }
+
+    public static void deleteWorkingDirectory(Context context) {
+        ApfAdapter.clearDirectory(context);
+    }
+
+    public void invalidate() {
+        this.mEPPreviewImageView.invalidate();
+    }
+
+    public void setIsPaperLandscape(boolean z, Activity activity) {
+        this.mEPPreviewImageView.setIsPaperLandscape(z, activity);
+    }
+
+    public boolean getIsPaperLandscape() {
+        return this.mEPPreviewImageView.getIsPaperLandscape();
+    }
+
+    public void setDrawEndHandler(Handler handler) {
+        this.mEPPreviewImageView.setDrawEndHandler(handler);
+    }
+
+    public void postInvalidate() {
+        this.mEPPreviewImageView.postInvalidate();
+    }
+
+    public void setPreviewImageView(PhotoPreview photoPreview) {
+        this.mEPPreviewImageView = photoPreview;
+    }
+
+    public void setApfLibParams(int i, int i2, int i3) {
+        this.mApfMode = i;
+        this.mSharpnessValue = i2;
+        this.mClearlyVividMode = i3;
+    }
+
+    public int getApfMode() {
+        return this.mApfMode;
+    }
+
+    public int getSharpnessValue() {
+        return this.mSharpnessValue;
+    }
+
+    public int getClearlyVividMode() {
+        return this.mClearlyVividMode;
+    }
+
+    public void setImageList(@NonNull PhotoPreviewImageList photoPreviewImageList) {
+        this.mEPPreviewImageView.setImageList(photoPreviewImageList);
+    }
+
+    public EPImageList getImageList() {
+        return this.mEPPreviewImageView.getImageList();
+    }
+
+    public void setLayout(int i, int i2) {
+        this.mEPPreviewImageView.setLayout(i, i2);
+    }
+
+    public boolean setPaper(int i) {
+        return this.mEPPreviewImageView.setPaper(i);
+    }
+
+    public void setColor(int i) {
+        this.mEPPreviewImageView.setColor(i);
+    }
+
+    public void invalidateImageNo() {
+        this.mEPPreviewImageView.invalidateImageNo();
+    }
+
+    public void invalidatePreview() {
+        this.mResizeCache.invalidateCache();
+        this.mEPPreviewImageView.invalidatePreview();
+    }
+
+    public boolean setImage(int i, int i2, Activity activity) throws OutOfMemoryError {
+        return this.mEPPreviewImageView.setImage(i, i2, activity);
+    }
+
+    public Bitmap getPreviewBitmap(EPImage ePImage, int i, int i2, int i3, boolean z) {
+        String filename;
+        if (this.mApfMode == 0 && this.mSharpnessValue == 0) {
+            return null;
+        }
+        String apfResult = this.mApfAdapter.getApfResult(ePImage.loadImageFileName, this.mApfMode, this.mSharpnessValue, this.mClearlyVividMode);
+        if (apfResult == null) {
+            throw new OutOfMemoryError("in getPreviewBitmap()");
+        } else if (z || (filename = this.mResizeCache.getFilename(apfResult, new ImageSizeConversionCache.ConvertCondition(ePImage.previewWidth, ePImage.previewHeight, i3))) == null) {
+            Bitmap bitmapConventionally = getBitmapConventionally(ePImage, apfResult, i, i2, i3);
+            if (bitmapConventionally != null) {
+                return bitmapConventionally;
+            }
+            throw new OutOfMemoryError("in getPreviewBitmap()");
+        } else {
+            Bitmap decodeFile = BitmapFactory.decodeFile(filename);
+            if (decodeFile != null) {
+                return decodeFile;
+            }
+            throw new OutOfMemoryError("in getPreviewBitmap()");
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public Bitmap getBitmapConventionally(EPImage ePImage, String str, int i, int i2, int i3) {
+        EPImage ePImage2 = new EPImage(str, 0);
+        new EPImageCreator(IprintApplication.getInstance()).createPreviewImage(ePImage2, i, i2, i3, true);
+        if (ePImage2.previewImageFileName == null) {
+            return null;
+        }
+        File file = new File(ePImage2.previewImageFileName);
+        if (!file.canRead()) {
+            return null;
+        }
+        ePImage.srcWidth = ePImage2.srcWidth;
+        ePImage.srcHeight = ePImage2.srcHeight;
+        ePImage.decodeWidth = ePImage2.decodeWidth;
+        ePImage.decodeHeight = ePImage2.decodeHeight;
+        ePImage.previewWidth = ePImage2.previewWidth;
+        ePImage.previewHeight = ePImage2.previewHeight;
+        ePImage.previewImageFileName = null;
+        Bitmap decodeFile = BitmapFactory.decodeFile(ePImage2.previewImageFileName);
+        File apfResizeCacheFile = getApfResizeCacheFile(file, str);
+        if (file.renameTo(apfResizeCacheFile)) {
+            this.mResizeCache.setFilename(str, new ImageSizeConversionCache.ConvertCondition(ePImage.previewWidth, ePImage.previewHeight, i3), apfResizeCacheFile.toString());
+        }
+        return decodeFile;
+    }
+
+    private File getApfResizeCacheFile(File file, String str) {
+        File parentFile = file.getParentFile();
+        String name = new File(str).getName();
+        return new File(parentFile, APF_RESIZE_FILE_PREFIX + name);
+    }
+}

+ 72 - 0
app/src/main/java/com/epson/iprint/apf/ImageSizeConversionCache.java

@@ -0,0 +1,72 @@
+package com.epson.iprint.apf;
+
+import java.io.File;
+import java.util.HashMap;
+
+class ImageSizeConversionCache {
+    private HashMap<String, CacheInfo> mHash = new HashMap<>();
+
+    ImageSizeConversionCache() {
+    }
+
+    public String getFilename(String str, ConvertCondition convertCondition) {
+        CacheInfo cacheInfo = this.mHash.get(str);
+        if (cacheInfo == null) {
+            return null;
+        }
+        if (cacheInfo.isValid(convertCondition)) {
+            return cacheInfo.getFilename();
+        }
+        String filename = cacheInfo.getFilename();
+        if (filename != null) {
+            File file = new File(filename);
+            if (file.exists()) {
+                file.delete();
+            }
+        }
+        this.mHash.remove(str);
+        return null;
+    }
+
+    public void setFilename(String str, ConvertCondition convertCondition, String str2) {
+        this.mHash.put(str, new CacheInfo(convertCondition, str2));
+    }
+
+    public void invalidateCache() {
+        this.mHash.clear();
+    }
+
+    public static class CacheInfo {
+        ConvertCondition mCacheCondition;
+        String mFileName;
+
+        public CacheInfo(ConvertCondition convertCondition, String str) {
+            this.mCacheCondition = convertCondition;
+            this.mFileName = str;
+        }
+
+        public String getFilename() {
+            return this.mFileName;
+        }
+
+        public boolean isValid(ConvertCondition convertCondition) {
+            return this.mCacheCondition.myEquals(convertCondition);
+        }
+    }
+
+    public static class ConvertCondition {
+        public int mColorValue;
+        public int mHeight;
+        public int mWidth;
+
+        public ConvertCondition(int i, int i2, int i3) {
+            this.mWidth = i;
+            this.mHeight = i2;
+            this.mColorValue = i3;
+        }
+
+        public boolean myEquals(ConvertCondition convertCondition) {
+            return this.mWidth == convertCondition.mWidth && this.mHeight == convertCondition.mHeight && this.mColorValue == convertCondition.mColorValue;
+        }
+    }
+}

+ 447 - 0
app/src/main/java/com/epson/iprint/shared/EpsoniPrintSharedActivity.java

@@ -0,0 +1,447 @@
+package com.epson.iprint.shared;
+
+import android.app.Activity;
+import android.arch.lifecycle.Observer;
+import android.arch.lifecycle.ViewModelProviders;
+import android.content.Context;
+import android.content.Intent;
+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.support.p003v7.app.AppCompatActivity;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.epson.iprint.prtlogger.CommonLog;
+import com.epson.iprint.prtlogger.NewLoggerController;
+import com.epson.iprint.prtlogger.PrintLog;
+import com.epson.mobilephone.common.license.LicenseTopActivity;
+import epson.common.Constants;
+import epson.common.DialogProgress;
+import epson.common.DialogProgressViewModel;
+import epson.common.ExternalFileUtils;
+import epson.common.IprintLicenseInfo;
+import epson.common.IprintUserSurveyInfo;
+import epson.common.Utils;
+import epson.print.ActivityRequestPermissions;
+import epson.print.ActivityViewImageSelect;
+import epson.print.R;
+import epson.print.EPImageUtil;
+import epson.print.MyPrinter;
+import epson.print.Util.EPLog;
+import epson.print.WebviewActivity;
+import epson.scan.activity.ScanActivity;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Deque;
+
+public class EpsoniPrintSharedActivity extends AppCompatActivity implements Runnable {
+    public static final String ACTION_CONFIRM_PRINTER_SCANNER_SELECTION = "com.epson.iprint.isSetDevice";
+    public static final String ACTION_PHOTO_PRINT = "com.epson.iprint.photo";
+    public static final String ACTION_SCAN = "com.epson.iprint.scan";
+    public static final String ACTION_WEB_PRINT = "com.epson.iprint.web";
+    public static final String ACTIVITY_GET_PRINTER_INFORMATION = "epson.maintain.activity.GetPrinterReplyData";
+    private static final int ACTIVITY_INTENT_PARAMETER_ERROR_ = 1;
+    public static final String ACTIVITY_SCAN = "epson.scan.activity.ScanActivity";
+    public static final String DIALOG_WAIT = "dialog_wait";
+    public static final String GET_PRINTER_INFORMATION = "com.epson.iprint.status";
+    public static final int INK_STATUS_ERROR = -1;
+    public static final int INK_STATUS_INK_END = 2;
+    public static final int INK_STATUS_INK_LOW = 1;
+    public static final int INK_STATUS_NORMAL = 0;
+    private static final int ISSETDEVICE_DEVICE_NOT_SET = 0;
+    private static final int ISSETDEVICE_LOCAL_DEVICE_SET = -1;
+    private static final int ISSETDEVICE_REMOTE_DEVICE_SET = -2;
+    private static final String LOG_TAG = "iPrintSharedActivity";
+    public static final String PACKAGE_PANASONIC_FAX = "com.panasonic.psn.fax";
+    public static final String PARAM_KEY_CALLER_PACKAGE_NAME = "PACKAGE_NAME";
+    private static final int REQUEST_CODE_LICENSE_CHECK = 101;
+    private static final int REQUEST_PHOTO_CUSTOM = 10;
+    private static final int REQUEST_RUNTIMEPERMMISSION = 100;
+    private static final int REQUEST_SCAN_CUSTOM = 20;
+    private static final int REQUEST_STATUS_CUSTOM = 99;
+    private static final int REQUEST_WEB_CUSTOM = 30;
+    public static final int RESULT_NO_SD_ERROR = 1;
+    public static final int RESULT_PARAM_ERROR = 0;
+    Handler mHandler = new Handler() {
+        public void handleMessage(Message message) {
+            if (message.what != 0) {
+                EPLog.m318w(EpsoniPrintSharedActivity.LOG_TAG, "handleMessage::default");
+                EpsoniPrintSharedActivity.this.CleanUp();
+                return;
+            }
+            EPLog.m313i(EpsoniPrintSharedActivity.LOG_TAG, "handleMessage::0");
+            EpsoniPrintSharedActivity.this.setWait();
+        }
+    };
+    private DialogProgressViewModel mModelDialog;
+    private Thread thread;
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        EPLog.m313i(LOG_TAG, "onCreate");
+        super.onCreate(bundle);
+        this.mModelDialog = (DialogProgressViewModel) ViewModelProviders.m2of((FragmentActivity) this).get(DialogProgressViewModel.class);
+        this.mModelDialog.getDialogJob().observe(this, new Observer() {
+            public final void onChanged(Object obj) {
+                EpsoniPrintSharedActivity.lambda$onCreate$0(EpsoniPrintSharedActivity.this, (Deque) obj);
+            }
+        });
+        NewLoggerController.stopLoggerIfNotAgreed(this);
+        if (bundle == null) {
+            startLicenseCheckActivity();
+        } else if (!IprintLicenseInfo.isAgreedCurrentVersion(this)) {
+            finish();
+        } else {
+            nextOnCreate();
+        }
+    }
+
+    public static /* synthetic */ void lambda$onCreate$0(EpsoniPrintSharedActivity epsoniPrintSharedActivity, Deque deque) {
+        String[] checkQueue = epsoniPrintSharedActivity.mModelDialog.checkQueue();
+        if (checkQueue != null) {
+            String str = checkQueue[0];
+            String str2 = checkQueue[1];
+            if (str2.equals("do_show")) {
+                epsoniPrintSharedActivity.showDialog(str);
+            }
+            if (str2.equals("do_dismiss")) {
+                epsoniPrintSharedActivity.dismissDialog(str);
+            }
+        }
+    }
+
+    private void startLicenseCheckActivity() {
+        IprintLicenseInfo.beforeLicenseCheck(getApplicationContext());
+        startActivityForResult(LicenseTopActivity.getStartIntent(getApplicationContext(), new IprintLicenseInfo(), new IprintUserSurveyInfo()), 101);
+    }
+
+    private void nextOnCreate() {
+        Intent intent = getIntent();
+        intent.getAction();
+        if (intent.getExtras() != null) {
+            try {
+                InitTempFolder();
+                CheckAction(intent.getAction());
+                ManagePreferences managePreferences = new ManagePreferences();
+                managePreferences.resetSavedFlag(getApplicationContext(), "PrintSetting");
+                managePreferences.pushPreferrences(getApplicationContext());
+                String action = intent.getAction();
+                if (action.equals(GET_PRINTER_INFORMATION)) {
+                    Intent intent2 = new Intent();
+                    intent2.setClassName(getPackageName(), ACTIVITY_GET_PRINTER_INFORMATION);
+                    startActivityForResult(intent2, 99);
+                } else if (action.equals(ACTION_CONFIRM_PRINTER_SCANNER_SELECTION)) {
+                    setPrinterScannerSelectionInfo();
+                } else {
+                    if (!IprintLicenseInfo.isAgreedCurrentVersion(this)) {
+                        finish();
+                    }
+                    this.mHandler.sendEmptyMessage(0);
+                }
+            } catch (SharedDataException e) {
+                e.printStackTrace();
+                setResult(1);
+                finish();
+            } catch (IOException e2) {
+                e2.printStackTrace();
+                setResult(2);
+                finish();
+            }
+        } else {
+            throw new SharedDataException("bundle null error");
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public boolean CheckAction(String str) throws SharedDataException {
+        if (str.equals(ACTION_PHOTO_PRINT) || str.equals(ACTION_SCAN) || str.equals(ACTION_WEB_PRINT) || str.equals(GET_PRINTER_INFORMATION) || str.equals(ACTION_CONFIRM_PRINTER_SCANNER_SELECTION)) {
+            return true;
+        }
+        throw new SharedDataException("action error");
+    }
+
+    public void run() {
+        EPLog.m313i(LOG_TAG, "run");
+        try {
+            Thread.sleep(100);
+        } catch (InterruptedException unused) {
+        }
+        EPLog.m313i(LOG_TAG, "run::1");
+        this.mHandler.sendEmptyMessage(1);
+    }
+
+    /* access modifiers changed from: private */
+    public void setWait() {
+        this.mModelDialog.doShow(DIALOG_WAIT);
+        this.thread = new Thread(new Runnable() {
+            public void run() {
+                EpsoniPrintSharedActivity.this.backgroundJob();
+            }
+        });
+        try {
+            if (ActivityRequestPermissions.isRuntimePermissionSupported() && getIntent().getAction().equals(ACTION_PHOTO_PRINT) && 4 == getIntent().getExtras().getInt("FILE_TYPE", 2)) {
+                String[] strArr = {"android.permission.WRITE_EXTERNAL_STORAGE"};
+                ActivityRequestPermissions.Permission permission = new ActivityRequestPermissions.Permission(strArr[0], new String[]{getString(R.string.permission_dialog_title), getString(R.string.permission_dialog_title)}, new String[]{ActivityRequestPermissions.DialogParameter.setMessage2((Context) this, getString(R.string.permission_dialog_message_storage)), ActivityRequestPermissions.DialogParameter.setMessage3A((Context) this, getString(R.string.permission_dialog_message_storage), getString(R.string.permission_function_storage))});
+                if (!ActivityRequestPermissions.checkPermission(this, strArr)) {
+                    ActivityRequestPermissions.requestPermission((Activity) this, permission, 100);
+                    return;
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        this.thread.start();
+    }
+
+    /* access modifiers changed from: private */
+    public void backgroundJob() {
+        int i;
+        EPLog.m313i(LOG_TAG, "backgroundJob");
+        Intent intent = getIntent();
+        if (intent == null) {
+            setResult(1);
+            finish();
+            return;
+        }
+        Intent intent2 = new Intent();
+        Bundle extras = intent.getExtras();
+        if (extras == null) {
+            setResult(1);
+            finish();
+            return;
+        }
+        try {
+            if (intent.getAction().equals(ACTION_PHOTO_PRINT)) {
+                SharedParamPhoto sharedParamPhoto = new SharedParamPhoto();
+                sharedParamPhoto.setParam(extras);
+                if (sharedParamPhoto.getPackage_name().indexOf(PACKAGE_PANASONIC_FAX) != -1) {
+                    new ManagePreferences().setPreferences(PACKAGE_PANASONIC_FAX, getApplicationContext());
+                } else {
+                    new ManagePreferences().setPreferences(sharedParamPhoto.getMedia_type(), sharedParamPhoto.getMedia_size(), sharedParamPhoto.getColor_mode(), sharedParamPhoto.getLayout_type(), getApplicationContext());
+                }
+                if (sharedParamPhoto.isTIFF()) {
+                    convertTiff(sharedParamPhoto);
+                }
+                intent2.setClass(this, ActivityViewImageSelect.class);
+                intent2.setAction(intent.getAction());
+                intent2.putExtra("extParam", sharedParamPhoto);
+                intent2.putExtra("print_log", getPhotoPrintLog(sharedParamPhoto.getPackage_name(), 4097));
+                i = 10;
+            } else if (intent.getAction().equals(ACTION_SCAN)) {
+                SharedParamScan sharedParamScan = new SharedParamScan();
+                sharedParamScan.setParam(extras);
+                if (sharedParamScan.getPixel_main() <= 0 || sharedParamScan.getPixel_sub() <= 0 || sharedParamScan.getRes_main() <= 0 || sharedParamScan.getRes_sub() <= 0) {
+                    throw new SharedDataException("resolution or pixel error.");
+                }
+                intent2.setClass(this, ScanActivity.class);
+                intent2.setAction(intent.getAction());
+                intent2.putExtra("extParam", sharedParamScan);
+                intent2.putExtra(ScanActivity.PARAM_KEY_SCAN_LOG, getScanLog(getCallerPackage(intent2)));
+                i = 20;
+            } else if (intent.getAction().equals(ACTION_WEB_PRINT)) {
+                String charSequence = extras.getCharSequence("URL").toString();
+                if (charSequence.length() > 0) {
+                    intent2.setClass(this, WebviewActivity.class);
+                    intent2.setAction(intent.getAction());
+                    intent2.putExtra("android.intent.extra.TEXT", charSequence);
+                    intent2.putExtra("print_log", getPhotoPrintLog(extras.getString(PARAM_KEY_CALLER_PACKAGE_NAME), PrintLog.PRINT_SOURCE_EXTERNAL_APP_WEB));
+                    i = 30;
+                } else {
+                    throw new SharedDataException("URL error");
+                }
+            } else {
+                setResult(1);
+                finish();
+                return;
+            }
+            startActivityForResult(intent2, i);
+            this.mHandler.sendEmptyMessageDelayed(1, 500);
+        } catch (SharedDataException e) {
+            e.printStackTrace();
+            setResult(1);
+            finish();
+        } catch (NullPointerException e2) {
+            e2.printStackTrace();
+            setResult(1);
+            finish();
+        }
+    }
+
+    private String getCallerPackage(Intent intent) {
+        String stringExtra;
+        if (intent == null || (stringExtra = intent.getStringExtra(PARAM_KEY_CALLER_PACKAGE_NAME)) == null) {
+            return getCallingPackage();
+        }
+        return stringExtra;
+    }
+
+    private CommonLog getScanLog(String str) {
+        CommonLog commonLog = new CommonLog();
+        commonLog.action = PrintLog.ACTION_EXTERNAL_APP_SCAN;
+        commonLog.callerPackage = str;
+        return commonLog;
+    }
+
+    private PrintLog getPhotoPrintLog(String str, int i) {
+        PrintLog printLog = new PrintLog();
+        printLog.uiRoute = i;
+        printLog.callerPackage = str;
+        if (printLog.callerPackage == null) {
+            printLog.callerPackage = getCallingPackage();
+        }
+        return printLog;
+    }
+
+    private int checkPrinterSelection() {
+        if (getSharedPreferences("PrintSetting", 0).getString(Constants.PRINTER_NAME, "").length() <= 0) {
+            return 0;
+        }
+        return MyPrinter.isRemotePrinter(this) ? -2 : -1;
+    }
+
+    private int checkScannerSelection() {
+        String prefString = Utils.getPrefString(getApplicationContext(), Constants.SCAN_REFS_USED_SCANNER_PATH, Constants.SCAN_REFS_SCANNER_MODEL);
+        return (prefString.equals(getString(R.string.str_lbl_title_scan)) || prefString.equals("")) ? 0 : -1;
+    }
+
+    private void setPrinterScannerSelectionInfo() {
+        int i;
+        switch (getIntent().getIntExtra("DEVICE_TYPE", -1)) {
+            case 0:
+                i = checkPrinterSelection();
+                break;
+            case 1:
+                i = checkScannerSelection();
+                break;
+            default:
+                i = 1;
+                break;
+        }
+        setResult(i);
+        finish();
+    }
+
+    private void convertTiff(SharedParamPhoto sharedParamPhoto) {
+        EPImageUtil ePImageUtil = new EPImageUtil();
+        ArrayList<String> arrayFileFullPath = sharedParamPhoto.getArrayFileFullPath();
+        ArrayList<String> arrayFilePath = sharedParamPhoto.getArrayFilePath();
+        for (int i = 0; i < arrayFilePath.size(); i++) {
+            String tempSharedDir = ExternalFileUtils.getInstance(this).getTempSharedDir();
+            ePImageUtil.tiff2bmp(arrayFileFullPath.get(i), new File(tempSharedDir, Utils.getPreffix(arrayFilePath.get(i)) + ".bmp").getPath());
+            String tempSharedDir2 = ExternalFileUtils.getInstance(this).getTempSharedDir();
+            sharedParamPhoto.setArrayFileFullPath(i, new File(tempSharedDir2, Utils.getPreffix(arrayFilePath.get(i)) + ".bmp").getPath());
+        }
+    }
+
+    private void showDialog(String str) {
+        DialogProgress dialogProgress;
+        if (((str.hashCode() == 23812620 && str.equals(DIALOG_WAIT)) ? (char) 0 : 65535) != 0) {
+            dialogProgress = null;
+        } else {
+            dialogProgress = DialogProgress.newInstance(str, 0, getString(R.string.str_wait));
+        }
+        if (dialogProgress != null) {
+            dialogProgress.setCancelable(true);
+            dialogProgress.show(getSupportFragmentManager(), str);
+        }
+    }
+
+    private void dismissDialog(String str) {
+        DialogFragment dialogFragment = (DialogFragment) getSupportFragmentManager().findFragmentByTag(str);
+        if (dialogFragment != null) {
+            dialogFragment.dismiss();
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onActivityResult(int i, int i2, Intent intent) {
+        super.onActivityResult(i, i2, intent);
+        EPLog.m313i(LOG_TAG, "onActivityResult::requestCode = " + i + "/requestCode = " + i2);
+        if (i == 10) {
+            setResult(i2);
+        } else if (i == 20) {
+            Intent intent2 = new Intent();
+            if (intent != null) {
+                intent2.putExtra("FILE_NAME", ScanActivity.getScanFileListFromReturnIntent(intent));
+            }
+            setResult(i2, intent2);
+        } else if (i != 30) {
+            switch (i) {
+                case 99:
+                    Intent intent3 = new Intent();
+                    if (intent == null) {
+                        setResult(i2);
+                        break;
+                    } else {
+                        SharedParamStatus sharedParamStatus = (SharedParamStatus) intent.getSerializableExtra("extStatus");
+                        if (sharedParamStatus == null) {
+                            setResult(i2);
+                            break;
+                        } else {
+                            intent3.putExtra(Constants.PRINTER_NAME, sharedParamStatus.getPrinter_name());
+                            intent3.putExtra("INK_NAME", sharedParamStatus.getArrayOutInkName());
+                            intent3.putExtra("INK_REMAIN", sharedParamStatus.getArrayOutInkRemain());
+                            intent3.putExtra("STATUS_VALUE", sharedParamStatus.getPrinter_status());
+                            intent3.putExtra("DEVICE_ID", sharedParamStatus.getPrinter_name());
+                            intent3.putExtra("INK_STATUS", sharedParamStatus.getExternInkStatus());
+                            setResult(i2, intent3);
+                            break;
+                        }
+                    }
+                case 100:
+                    if (i2 == -1) {
+                        this.thread.start();
+                        break;
+                    } else {
+                        setResult(0);
+                        finish();
+                        break;
+                    }
+                case 101:
+                    if (i2 != -1) {
+                        finish();
+                        return;
+                    } else {
+                        nextOnCreate();
+                        return;
+                    }
+            }
+        } else {
+            setResult(i2);
+        }
+        finish();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onDestroy() {
+        super.onDestroy();
+        ManagePreferences managePreferences = new ManagePreferences();
+        if (managePreferences.getSavedFlag(getApplicationContext(), "PrintSetting") == 0) {
+            EPLog.m313i(LOG_TAG, "Preference 戻す");
+            managePreferences.popPreferrences(getApplicationContext());
+        }
+        CleanUp();
+        try {
+            InitTempFolder();
+        } catch (IOException unused) {
+        }
+    }
+
+    /* access modifiers changed from: private */
+    public void CleanUp() {
+        Thread thread2 = this.thread;
+        if (thread2 != null && thread2.isAlive()) {
+            this.thread.interrupt();
+            this.thread = null;
+        }
+        this.mModelDialog.doDismiss(DIALOG_WAIT);
+    }
+
+    private void InitTempFolder() throws IOException {
+        ExternalFileUtils.getInstance(this).initTempSharedDir();
+    }
+}

+ 84 - 0
app/src/main/java/com/epson/iprint/shared/ExtSharedParam.java

@@ -0,0 +1,84 @@
+package com.epson.iprint.shared;
+
+import android.content.Intent;
+import android.os.Bundle;
+
+public class ExtSharedParam {
+    private String file_name = null;
+    private String folder_name = null;
+    private boolean isValid = false;
+    private String package_name = null;
+    private int pixel_main = 0;
+    private int pixel_sub = 0;
+    private int res_main = 0;
+    private int res_sub = 0;
+    private int scan_mode = 0;
+    private int scan_type = 0;
+
+    public void setParam(Bundle bundle) {
+        this.scan_type = bundle.getInt("SCAN_TYPE");
+        this.pixel_main = bundle.getInt("PIXEL_MAIN");
+        this.pixel_sub = bundle.getInt("PIXEL_SUB");
+        this.res_main = bundle.getInt("RES_MAIN");
+        this.res_sub = bundle.getInt("RES_SUB");
+        this.folder_name = bundle.getString("FOLDER_NAME");
+        this.file_name = bundle.getString("FILE_NAME");
+        this.scan_mode = bundle.getInt("SCAN_MODE");
+        this.package_name = bundle.getString(EpsoniPrintSharedActivity.PARAM_KEY_CALLER_PACKAGE_NAME);
+        this.isValid = true;
+    }
+
+    public void setParam(Intent intent) {
+        Bundle extras = intent.getExtras();
+        this.scan_type = extras.getInt("SCAN_TYPE");
+        this.pixel_main = extras.getInt("PIXEL_MAIN");
+        this.pixel_sub = extras.getInt("PIXEL_SUB");
+        this.res_main = extras.getInt("RES_MAIN");
+        this.res_sub = extras.getInt("RES_SUB");
+        this.folder_name = extras.getString("FOLDER_NAME");
+        this.file_name = extras.getString("FILE_NAME");
+        this.scan_mode = extras.getInt("SCAN_MODE");
+        this.package_name = extras.getString(EpsoniPrintSharedActivity.PARAM_KEY_CALLER_PACKAGE_NAME);
+        this.isValid = true;
+    }
+
+    public boolean isAvailable() {
+        return this.isValid;
+    }
+
+    public int getScan_type() {
+        return this.scan_type;
+    }
+
+    public int getPixel_main() {
+        return this.pixel_main;
+    }
+
+    public int getPixel_sub() {
+        return this.pixel_sub;
+    }
+
+    public int getRes_main() {
+        return this.res_main;
+    }
+
+    public int getRes_sub() {
+        return this.res_sub;
+    }
+
+    public String getFolder_name() {
+        return this.folder_name;
+    }
+
+    public String getFile_name() {
+        return this.file_name;
+    }
+
+    public int getScan_mode() {
+        return this.scan_mode;
+    }
+
+    public String getPackage_name() {
+        return this.package_name;
+    }
+}

+ 26 - 0
app/src/main/java/com/epson/iprint/shared/FileFormatErrorException.java

@@ -0,0 +1,26 @@
+package com.epson.iprint.shared;
+
+/* compiled from: SharedDataException */
+class FileFormatErrorException extends SharedDataException {
+    private String fileName;
+
+    public FileFormatErrorException() {
+        super("ファイルフォーマットエラー");
+    }
+
+    public FileFormatErrorException(String str, Throwable th) {
+        super(str, th);
+    }
+
+    public FileFormatErrorException(String str) {
+        super(str);
+    }
+
+    public String getFileName() {
+        return this.fileName;
+    }
+
+    public void setFileName(String str) {
+        this.fileName = str;
+    }
+}

+ 99 - 0
app/src/main/java/com/epson/iprint/shared/ManagePreferences.java

@@ -0,0 +1,99 @@
+package com.epson.iprint.shared;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.util.Log;
+import epson.common.Constants;
+import epson.print.screen.PrintSetting;
+import java.util.Map;
+
+public class ManagePreferences {
+    public static final String PREFS_INFO_PRINT_CLONE = "PrintSettingClone";
+
+    public boolean pushPreferrences(Context context) {
+        SharedPreferences sharedPreferences = context.getSharedPreferences("PrintSetting", 0);
+        SharedPreferences.Editor edit = context.getSharedPreferences(PREFS_INFO_PRINT_CLONE, 0).edit();
+        edit.clear();
+        for (Map.Entry next : sharedPreferences.getAll().entrySet()) {
+            Log.v("hoge PUSH", String.format("%s=%s", new Object[]{(String) next.getKey(), next.getValue()}));
+            if (next.getValue() != null) {
+                putInPrefs(edit, (String) next.getKey(), next.getValue());
+            }
+        }
+        return edit.commit();
+    }
+
+    public boolean popPreferrences(Context context) {
+        SharedPreferences sharedPreferences = context.getSharedPreferences("PrintSetting", 0);
+        SharedPreferences sharedPreferences2 = context.getSharedPreferences(PREFS_INFO_PRINT_CLONE, 0);
+        SharedPreferences.Editor edit = sharedPreferences.edit();
+        for (Map.Entry next : sharedPreferences2.getAll().entrySet()) {
+            Log.v("hoge POP", String.format("%s=%s", new Object[]{(String) next.getKey(), next.getValue()}));
+            if (next.getValue() != null) {
+                putInPrefs(edit, (String) next.getKey(), next.getValue());
+            }
+        }
+        return edit.commit();
+    }
+
+    public void resetSavedFlag(Context context, String str) {
+        context.getSharedPreferences(str, 0).edit().putInt(Constants.PREFS_INFO_PRINT_SAVE, 0).commit();
+    }
+
+    public int getSavedFlag(Context context, String str) {
+        return context.getSharedPreferences(str, 0).getInt(Constants.PREFS_INFO_PRINT_SAVE, 0);
+    }
+
+    public boolean setPreferences(String str, Context context) {
+        if (str.indexOf(EpsoniPrintSharedActivity.PACKAGE_PANASONIC_FAX) == -1) {
+            return false;
+        }
+        PrintSetting printSetting = new PrintSetting(context, PrintSetting.Kind.photo);
+        printSetting.loadSettings();
+        printSetting.paperSizeValue = 0;
+        printSetting.paperTypeValue = 0;
+        printSetting.colorValue = 1;
+        printSetting.layoutValue = 2;
+        printSetting.copiesValue = 1;
+        printSetting.saveSettings();
+        return true;
+    }
+
+    public boolean setPreferences(int i, int i2, int i3, int i4, Context context) {
+        PrintSetting printSetting = new PrintSetting(context, PrintSetting.Kind.photo);
+        printSetting.loadSettings();
+        printSetting.paperTypeValue = i;
+        printSetting.paperSizeValue = i2;
+        printSetting.colorValue = i3;
+        printSetting.layoutValue = i4;
+        printSetting.copiesValue = 1;
+        printSetting.saveSettings();
+        return true;
+    }
+
+    public static SharedPreferences.Editor putInPrefs(SharedPreferences.Editor editor, String str, Object obj) {
+        Class<?> cls = obj.getClass();
+        if (Boolean.class.isAssignableFrom(cls)) {
+            editor.putBoolean(str, ((Boolean) obj).booleanValue());
+        } else if (Integer.class.isAssignableFrom(cls)) {
+            editor.putInt(str, ((Integer) obj).intValue());
+        } else if (Float.class.isAssignableFrom(cls)) {
+            editor.putFloat(str, ((Float) obj).floatValue());
+        } else if (Long.class.isAssignableFrom(cls)) {
+            editor.putLong(str, ((Long) obj).longValue());
+        } else if (String.class.isAssignableFrom(cls)) {
+            editor.putString(str, (String) obj);
+        } else if (Bundle.class.isAssignableFrom(cls)) {
+            Bundle bundle = (Bundle) obj;
+            for (String str2 : bundle.keySet()) {
+                putInPrefs(editor, getStoredBundleParamKey(str, str2), bundle.get(str2));
+            }
+        }
+        return editor;
+    }
+
+    private static String getStoredBundleParamKey(String str, String str2) {
+        return str + "__" + str2;
+    }
+}

+ 26 - 0
app/src/main/java/com/epson/iprint/shared/ParametersErrorException.java

@@ -0,0 +1,26 @@
+package com.epson.iprint.shared;
+
+/* compiled from: SharedDataException */
+class ParametersErrorException extends SharedDataException {
+    private String ParaName;
+
+    public ParametersErrorException() {
+        super("parameter error");
+    }
+
+    public ParametersErrorException(String str) {
+        super(str);
+    }
+
+    public ParametersErrorException(String str, Throwable th) {
+        super(str, th);
+    }
+
+    public String getParaName() {
+        return this.ParaName;
+    }
+
+    public void setParaName(String str) {
+        this.ParaName = str;
+    }
+}

+ 14 - 0
app/src/main/java/com/epson/iprint/shared/SharedDataException.java

@@ -0,0 +1,14 @@
+package com.epson.iprint.shared;
+
+public class SharedDataException extends Exception {
+    public SharedDataException() {
+    }
+
+    public SharedDataException(String str, Throwable th) {
+        super(str, th);
+    }
+
+    public SharedDataException(String str) {
+        super(str);
+    }
+}

+ 23 - 0
app/src/main/java/com/epson/iprint/shared/SharedParam.java

@@ -0,0 +1,23 @@
+package com.epson.iprint.shared;
+
+import android.os.Bundle;
+import java.io.Serializable;
+
+abstract class SharedParam implements Serializable {
+    protected boolean isValid = false;
+    protected String package_name = null;
+
+    /* access modifiers changed from: protected */
+    public abstract void setParam(Bundle bundle) throws SharedDataException;
+
+    SharedParam() {
+    }
+
+    public boolean isAvailable() {
+        return this.isValid;
+    }
+
+    public String getPackage_name() {
+        return this.package_name;
+    }
+}

+ 139 - 0
app/src/main/java/com/epson/iprint/shared/SharedParamPhoto.java

@@ -0,0 +1,139 @@
+package com.epson.iprint.shared;
+
+import android.os.Bundle;
+import com.epson.mobilephone.common.PrintingLib.define.Constants;
+import epson.print.CommonDefine;
+import java.io.Serializable;
+import java.util.ArrayList;
+
+public class SharedParamPhoto extends SharedParam implements Serializable {
+    private static final long serialVersionUID = 1;
+    private ArrayList<String> arrayFileFullPath = null;
+    private ArrayList<String> arrayFilePath = null;
+    private int color_mode = 0;
+    private int file_type = 0;
+    private String folder_name = null;
+    private int layout_type = 2;
+    private int media_size = 0;
+    private int media_type = 0;
+    private int print_mode = 0;
+
+    public /* bridge */ /* synthetic */ String getPackage_name() {
+        return super.getPackage_name();
+    }
+
+    public /* bridge */ /* synthetic */ boolean isAvailable() {
+        return super.isAvailable();
+    }
+
+    /* access modifiers changed from: protected */
+    public void setParam(Bundle bundle) throws SharedDataException {
+        this.file_type = bundle.getInt("FILE_TYPE", 2);
+        int i = this.file_type;
+        if (i < 0 || i > 4) {
+            throw new ParametersErrorException("FILE_TYPE errorr");
+        }
+        this.folder_name = bundle.getString("FOLDER_NAME");
+        if (!this.folder_name.equals((Object) null)) {
+            this.arrayFilePath = bundle.getStringArrayList("FILE_NAME");
+            if (this.arrayFilePath.size() != 0) {
+                this.print_mode = bundle.getInt("PRINT_MODE", 0);
+                int i2 = this.print_mode;
+                if (i2 < 0 || i2 > 1) {
+                    throw new ParametersErrorException("PRINT_MODE error");
+                }
+                this.media_type = bundle.getInt("MEDIA_TYPE", 0);
+                if (this.media_type == Constants.MediaName.EPS_MTID_PLAIN.getCode() || this.media_type == Constants.MediaName.EPS_MTID_PGPHOTO.getCode() || this.media_type == Constants.MediaName.EPS_MTID_HAGAKIRECL.getCode() || this.media_type == Constants.MediaName.EPS_MTID_HAGAKIINKJET.getCode()) {
+                    this.media_size = bundle.getInt("MEDIA_SIZE", 0);
+                    if (this.media_size == Constants.PaperName.EPS_MSID_A4.getCode() || this.media_size == Constants.PaperName.EPS_MSID_4X6.getCode() || this.media_size == Constants.PaperName.EPS_MSID_L.getCode() || this.media_size == Constants.PaperName.EPS_MSID_POSTCARD.getCode()) {
+                        this.color_mode = bundle.getInt("COLOR_MODE", 0);
+                        int i3 = this.color_mode;
+                        if (i3 == 0 || i3 == 1) {
+                            this.layout_type = bundle.getInt("LAYOUT_TYPE", 2);
+                            int i4 = this.layout_type;
+                            if (i4 == 1 || i4 == 2) {
+                                this.package_name = bundle.getString(EpsoniPrintSharedActivity.PARAM_KEY_CALLER_PACKAGE_NAME);
+                                if (!this.package_name.equals((Object) null)) {
+                                    setFullPathName();
+                                    this.isValid = true;
+                                    return;
+                                }
+                                throw new ParametersErrorException("PACKAGE_NAME error");
+                            }
+                            throw new ParametersErrorException("LAYOUT_TYPE error");
+                        }
+                        throw new ParametersErrorException("COLOR_MODE error");
+                    }
+                    throw new ParametersErrorException("MEDIA_SIZE error");
+                }
+                throw new ParametersErrorException("MEDIA_TYPE error");
+            }
+            throw new ParametersErrorException("FILE_NAME error");
+        }
+        throw new ParametersErrorException("FOLDER_NAME error");
+    }
+
+    private void setFullPathName() {
+        this.arrayFileFullPath = new ArrayList<>();
+        for (int i = 0; i < this.arrayFilePath.size(); i++) {
+            ArrayList<String> arrayList = this.arrayFileFullPath;
+            arrayList.add(this.folder_name + CommonDefine.SLASH + this.arrayFilePath.get(i));
+        }
+    }
+
+    public int getFile_type() {
+        return this.file_type;
+    }
+
+    public boolean isTIFF() {
+        return this.file_type == 4;
+    }
+
+    public boolean isFileTypeValid() {
+        return this.file_type > 0;
+    }
+
+    public String getFolder_name() {
+        return this.folder_name;
+    }
+
+    public ArrayList<String> getArrayFilePath() {
+        return this.arrayFilePath;
+    }
+
+    public ArrayList<String> getArrayFileFullPath() {
+        return this.arrayFileFullPath;
+    }
+
+    public void setArrayFileFullPath(String str) {
+        this.arrayFileFullPath.add(str);
+    }
+
+    public void setArrayFileFullPath(int i, String str) {
+        this.arrayFileFullPath.set(i, str);
+    }
+
+    public void clearArrayFileFullPath() {
+        this.arrayFileFullPath.clear();
+    }
+
+    public int getPrint_mode() {
+        return this.print_mode;
+    }
+
+    public int getMedia_type() {
+        return this.media_type;
+    }
+
+    public int getMedia_size() {
+        return this.media_size;
+    }
+
+    public int getColor_mode() {
+        return this.color_mode;
+    }
+
+    public int getLayout_type() {
+        return this.layout_type;
+    }
+}

+ 93 - 0
app/src/main/java/com/epson/iprint/shared/SharedParamScan.java

@@ -0,0 +1,93 @@
+package com.epson.iprint.shared;
+
+import android.os.Bundle;
+import java.io.Serializable;
+import java.util.ArrayList;
+
+public class SharedParamScan extends SharedParam implements Serializable {
+    private static final long serialVersionUID = 1810612490181007537L;
+    private ArrayList<String> arrayOutFilePath = null;
+    private String file_name = null;
+    private String folder_name = null;
+    private int pixel_main = 0;
+    private int pixel_sub = 0;
+    private int res_main = 0;
+    private int res_sub = 0;
+    private int scan_mode = 0;
+    private int scan_type = 0;
+
+    public /* bridge */ /* synthetic */ String getPackage_name() {
+        return super.getPackage_name();
+    }
+
+    public /* bridge */ /* synthetic */ boolean isAvailable() {
+        return super.isAvailable();
+    }
+
+    /* access modifiers changed from: protected */
+    public void setParam(Bundle bundle) throws SharedDataException {
+        this.scan_type = bundle.getInt("SCAN_TYPE");
+        int i = this.scan_type;
+        if (i < 1 || i > 3) {
+            throw new ParametersErrorException("SCAN_TYPE errorr");
+        }
+        this.pixel_main = bundle.getInt("PIXEL_MAIN");
+        if (this.pixel_main >= 0) {
+            this.pixel_sub = bundle.getInt("PIXEL_SUB");
+            this.res_main = bundle.getInt("RES_MAIN");
+            this.res_sub = bundle.getInt("RES_SUB");
+            this.folder_name = bundle.getString("FOLDER_NAME");
+            this.file_name = bundle.getString("FILE_NAME");
+            this.scan_mode = bundle.getInt("SCAN_MODE");
+            this.package_name = bundle.getString(EpsoniPrintSharedActivity.PARAM_KEY_CALLER_PACKAGE_NAME);
+            this.arrayOutFilePath = new ArrayList<>();
+            this.isValid = true;
+            return;
+        }
+        throw new ParametersErrorException("PIXEL_MAIN errorr");
+    }
+
+    public int getScan_type() {
+        return this.scan_type;
+    }
+
+    public int getPixel_main() {
+        return this.pixel_main;
+    }
+
+    public int getPixel_sub() {
+        return this.pixel_sub;
+    }
+
+    public int getRes_main() {
+        return this.res_main;
+    }
+
+    public int getRes_sub() {
+        return this.res_sub;
+    }
+
+    public String getFolder_name() {
+        return this.folder_name;
+    }
+
+    public String getFile_name() {
+        return this.file_name;
+    }
+
+    public int getScan_mode() {
+        return this.scan_mode;
+    }
+
+    public ArrayList<String> getArrayOutFilePath() {
+        return this.arrayOutFilePath;
+    }
+
+    public void setArrayOutFilePath(String str) {
+        this.arrayOutFilePath.add(str);
+    }
+
+    public void clearArrayOutFilePath() {
+        this.arrayOutFilePath.clear();
+    }
+}

+ 105 - 0
app/src/main/java/com/epson/iprint/shared/SharedParamStatus.java

@@ -0,0 +1,105 @@
+package com.epson.iprint.shared;
+
+import android.os.Bundle;
+import java.io.Serializable;
+import java.util.ArrayList;
+
+public class SharedParamStatus extends SharedParam implements Serializable {
+    private static final long serialVersionUID = 1810612490181007537L;
+    private ArrayList<String> arrayOutInkName = null;
+    private ArrayList<Integer> arrayOutInkRemain = null;
+    private ArrayList<Integer> mEscprLibInkStatus = null;
+    private String mcsModelName = null;
+    private int miReturnStatus = 4;
+
+    public void setParam(Bundle bundle) throws SharedDataException {
+    }
+
+    public /* bridge */ /* synthetic */ String getPackage_name() {
+        return super.getPackage_name();
+    }
+
+    public /* bridge */ /* synthetic */ boolean isAvailable() {
+        return super.isAvailable();
+    }
+
+    public void setPrinter_name(String str) {
+        this.mcsModelName = str;
+    }
+
+    public void setPrinter_status(int i) {
+        this.miReturnStatus = i;
+    }
+
+    public String getPrinter_name() {
+        return this.mcsModelName;
+    }
+
+    public int getPrinter_status() {
+        return this.miReturnStatus;
+    }
+
+    public ArrayList<String> getArrayOutInkName() {
+        return this.arrayOutInkName;
+    }
+
+    public void setArrayOutInkName(ArrayList<String> arrayList) {
+        this.arrayOutInkName = arrayList;
+    }
+
+    public void clearArrayOutInkName() {
+        this.arrayOutInkName.clear();
+    }
+
+    public ArrayList<Integer> getArrayOutInkRemain() {
+        return this.arrayOutInkRemain;
+    }
+
+    public void setArrayOutInkRemain(ArrayList<Integer> arrayList) {
+        this.arrayOutInkRemain = arrayList;
+    }
+
+    public void clearArrayOutInkRemain() {
+        this.arrayOutInkRemain.clear();
+    }
+
+    public ArrayList<Integer> getExternInkStatus() {
+        ArrayList<Integer> arrayList = this.mEscprLibInkStatus;
+        if (arrayList == null) {
+            return null;
+        }
+        ArrayList<Integer> arrayList2 = new ArrayList<>(arrayList.size());
+        for (int i = 0; i < this.mEscprLibInkStatus.size(); i++) {
+            int intValue = this.mEscprLibInkStatus.get(i).intValue();
+            if (intValue != -3) {
+                switch (intValue) {
+                    case -1:
+                        break;
+                    case 0:
+                        if (this.arrayOutInkRemain.get(i).intValue() != 0) {
+                            arrayList2.add(0);
+                            break;
+                        } else {
+                            arrayList2.add(2);
+                            continue;
+                        }
+                    case 1:
+                        arrayList2.add(1);
+                        continue;
+                    case 2:
+                        arrayList2.add(2);
+                        continue;
+                    default:
+                        arrayList2.add(-1);
+                        continue;
+                }
+            }
+            arrayList2.add(2);
+        }
+        return arrayList2;
+    }
+
+    public void setEscprlibInkStatus(ArrayList<Integer> arrayList) {
+        this.mEscprLibInkStatus = arrayList;
+    }
+}

+ 48 - 0
app/src/main/java/com/epson/iprint/storage/ConfirmCancelDialog.java

@@ -0,0 +1,48 @@
+package com.epson.iprint.storage;
+
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.p000v4.app.DialogFragment;
+import android.support.p000v4.app.FragmentActivity;
+import android.support.p003v7.app.AlertDialog;
+import epson.print.R;
+
+public class ConfirmCancelDialog extends DialogFragment {
+    private static final String PARAM_MESSAGE_RESOURCE_ID = "message_id";
+
+    public interface DialogCancelListener {
+        void cancel();
+    }
+
+    public static ConfirmCancelDialog newInstance(int i) {
+        ConfirmCancelDialog confirmCancelDialog = new ConfirmCancelDialog();
+        Bundle bundle = new Bundle();
+        bundle.putInt(PARAM_MESSAGE_RESOURCE_ID, i);
+        confirmCancelDialog.setArguments(bundle);
+        return confirmCancelDialog;
+    }
+
+    @NonNull
+    public Dialog onCreateDialog(Bundle bundle) {
+        int i = getArguments().getInt(PARAM_MESSAGE_RESOURCE_ID);
+        setCancelable(false);
+        return new AlertDialog.Builder(getActivity()).setMessage(i).setPositiveButton((CharSequence) getString(R.string.str_yes), (DialogInterface.OnClickListener) new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialogInterface, int i) {
+                ConfirmCancelDialog.this.doCancel();
+            }
+        }).setNegativeButton((CharSequence) getString(R.string.str_no), (DialogInterface.OnClickListener) new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialogInterface, int i) {
+            }
+        }).create();
+    }
+
+    /* access modifiers changed from: private */
+    public void doCancel() {
+        FragmentActivity activity = getActivity();
+        if (activity != null) {
+            ((DialogCancelListener) activity).cancel();
+        }
+    }
+}

+ 17 - 0
app/src/main/java/com/epson/iprint/storage/ISecureKeyStore.java

@@ -0,0 +1,17 @@
+package com.epson.iprint.storage;
+
+import android.content.Context;
+
+public interface ISecureKeyStore {
+    String getApiKeyA(Context context);
+
+    String getApiKeyB(Context context);
+
+    String getApiKeyC(Context context);
+
+    String getApiKeyD(Context context);
+
+    String getSecKeyB(Context context);
+
+    String getSecKeyC(Context context);
+}

+ 96 - 0
app/src/main/java/com/epson/iprint/storage/LocalProgressDialog.java

@@ -0,0 +1,96 @@
+package com.epson.iprint.storage;
+
+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.p000v4.app.FragmentManager;
+import android.view.KeyEvent;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import epson.print.R;
+
+public class LocalProgressDialog extends DialogFragment {
+    private static final String LOG_TAG = "MyProgress";
+    private static final String PARAM_CANCELABLE = "cancelable";
+    private static final String PARAM_CANCEL_CONFIRM_DIALOG_TAG = "tag_confirm-cancel";
+    private static final String PARAM_MESSAGE_ID = "message-id";
+    private String mCancelConfirmDialogTag;
+
+    public static LocalProgressDialog newInstance(boolean z, int i, @NonNull String str) {
+        if (!z || str != null) {
+            LocalProgressDialog localProgressDialog = new LocalProgressDialog();
+            Bundle bundle = new Bundle();
+            bundle.putBoolean(PARAM_CANCELABLE, z);
+            bundle.putInt(PARAM_MESSAGE_ID, i);
+            bundle.putString(PARAM_CANCEL_CONFIRM_DIALOG_TAG, str);
+            localProgressDialog.setArguments(bundle);
+            return localProgressDialog;
+        }
+        throw new IllegalArgumentException();
+    }
+
+    @Nullable
+    public View onCreateView(@NonNull LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
+        Bundle arguments = getArguments();
+        boolean z = arguments.getBoolean(PARAM_CANCELABLE, false);
+        int i = arguments.getInt(PARAM_MESSAGE_ID, 0);
+        this.mCancelConfirmDialogTag = arguments.getString(PARAM_CANCEL_CONFIRM_DIALOG_TAG);
+        View inflate = layoutInflater.inflate(R.layout.my_progress, viewGroup, false);
+        Button button = (Button) inflate.findViewById(R.id.cancelButton);
+        button.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View view) {
+                LocalProgressDialog.this.showCancelConfirmDialog();
+            }
+        });
+        button.setText(R.string.str_cancel);
+        int i2 = 8;
+        button.setVisibility(z ? 0 : 8);
+        TextView textView = (TextView) inflate.findViewById(R.id.messageText);
+        if (i != 0) {
+            textView.setText(i);
+        }
+        if (i != 0) {
+            i2 = 0;
+        }
+        textView.setVisibility(i2);
+        ((LinearLayout) inflate.findViewById(R.id.dialog_back)).setOnClickListener(new View.OnClickListener() {
+            public void onClick(View view) {
+            }
+        });
+        inflate.setFocusableInTouchMode(true);
+        inflate.requestFocus();
+        inflate.setOnKeyListener(new View.OnKeyListener() {
+            public boolean onKey(View view, int i, KeyEvent keyEvent) {
+                return i == 4;
+            }
+        });
+        setCancelable(false);
+        return inflate;
+    }
+
+    @NonNull
+    public Dialog onCreateDialog(Bundle bundle) {
+        Dialog onCreateDialog = super.onCreateDialog(bundle);
+        onCreateDialog.requestWindowFeature(1);
+        return onCreateDialog;
+    }
+
+    /* access modifiers changed from: private */
+    public void showCancelConfirmDialog() {
+        if (this.mCancelConfirmDialogTag != null) {
+            FragmentManager fragmentManager = getFragmentManager();
+            if (fragmentManager != null) {
+                ConfirmCancelDialog.newInstance(R.string.str_msg_scan_cancel).show(fragmentManager, this.mCancelConfirmDialogTag);
+                return;
+            }
+            return;
+        }
+        throw new IllegalStateException();
+    }
+}

+ 16 - 0
app/src/main/java/com/epson/iprint/storage/Network.java

@@ -0,0 +1,16 @@
+package com.epson.iprint.storage;
+
+import android.support.annotation.NonNull;
+import com.epson.iprint.storage.gdrivev3.ActivityWrapper;
+import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
+import epson.common.Utils;
+
+public class Network {
+    public boolean isOnline(@NonNull ActivityWrapper activityWrapper) {
+        return Utils.isConnecting(activityWrapper.getActivity());
+    }
+
+    public void selectSimpleAp(@NonNull ActivityWrapper activityWrapper, boolean z) {
+        WiFiDirectManager.setPriorityToSimpleAP(activityWrapper.getActivity(), z);
+    }
+}

+ 53 - 0
app/src/main/java/com/epson/iprint/storage/OneButtonDialogFragment.java

@@ -0,0 +1,53 @@
+package com.epson.iprint.storage;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
+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 epson.print.R;
+
+public class OneButtonDialogFragment extends DialogFragment {
+    private static final String PARAM_DIALOG_ID = "dialog_id";
+    private static final String PARAM_MESSAGE_RESOURCE_ID = "message_id";
+    /* access modifiers changed from: private */
+    public String mDialogId;
+    private int mMessageId;
+
+    public interface DialogCallback {
+        void buttonPressed(@Nullable String str);
+    }
+
+    public static OneButtonDialogFragment newInstance(int i, String str) {
+        OneButtonDialogFragment oneButtonDialogFragment = new OneButtonDialogFragment();
+        Bundle bundle = new Bundle();
+        bundle.putInt(PARAM_MESSAGE_RESOURCE_ID, i);
+        bundle.putSerializable(PARAM_DIALOG_ID, str);
+        oneButtonDialogFragment.setArguments(bundle);
+        return oneButtonDialogFragment;
+    }
+
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        Bundle arguments = getArguments();
+        this.mMessageId = arguments.getInt(PARAM_MESSAGE_RESOURCE_ID);
+        this.mDialogId = arguments.getString(PARAM_DIALOG_ID);
+        setCancelable(false);
+    }
+
+    @NonNull
+    public Dialog onCreateDialog(Bundle bundle) {
+        super.onCreateDialog(bundle);
+        return new AlertDialog.Builder(getActivity()).setMessage(this.mMessageId).setPositiveButton(R.string.str_ok, new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialogInterface, int i) {
+                FragmentActivity activity = OneButtonDialogFragment.this.getActivity();
+                if (activity != null) {
+                    ((DialogCallback) activity).buttonPressed(OneButtonDialogFragment.this.mDialogId);
+                }
+            }
+        }).setCancelable(false).create();
+    }
+}

+ 37 - 0
app/src/main/java/com/epson/iprint/storage/SecureKeyStore.java

@@ -0,0 +1,37 @@
+package com.epson.iprint.storage;
+
+import android.content.Context;
+import com.epson.mobilephone.common.keyenc.SecureKeyFactory;
+
+public class SecureKeyStore implements ISecureKeyStore {
+    private static final String A_KEY = "2T6hSEbWBnkQ4r8KmkdQDg==";
+    public static final String B_KEY = "oKHwWs_UUc1LchvNPq3Dd_nHCB5gUSpSiq2zkIHj2fE=";
+    public static final String B_SEC = "FJrqtZTOjGHKXjQ49Q2N5R3qAzBeZvWDd_Tqfjxi3aE=";
+    public static final String C_KEY = "gtV0nQIxV5Mo5JvWmF5ymXXG5gfJeHqp9OdwHjAm6H0d6gMwXmb1g3f06n48Yt2h";
+    public static final String C_SEC = "XYnA5S0klACNMsBO7UXye-V9YNbI9xypH1H4ty-l_T0d6gMwXmb1g3f06n48Yt2h";
+    public static final String D_KEY = "NTqY6KeSXNYF9434almiWR3qAzBeZvWDd_Tqfjxi3aE=";
+
+    public String getApiKeyA(Context context) {
+        return SecureKeyFactory.getInstance(context).Decode(A_KEY);
+    }
+
+    public String getApiKeyB(Context context) {
+        return SecureKeyFactory.getInstance(context).Decode(B_KEY);
+    }
+
+    public String getSecKeyB(Context context) {
+        return SecureKeyFactory.getInstance(context).Decode(B_SEC);
+    }
+
+    public String getApiKeyC(Context context) {
+        return SecureKeyFactory.getInstance(context).Decode(C_KEY);
+    }
+
+    public String getSecKeyC(Context context) {
+        return SecureKeyFactory.getInstance(context).Decode(C_SEC);
+    }
+
+    public String getApiKeyD(Context context) {
+        return SecureKeyFactory.getInstance(context).Decode(D_KEY);
+    }
+}

+ 238 - 0
app/src/main/java/com/epson/iprint/storage/StorageActivity.java

@@ -0,0 +1,238 @@
+package com.epson.iprint.storage;
+
+import android.app.AlertDialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.os.Bundle;
+import android.text.Editable;
+import android.text.InputFilter;
+import android.text.TextWatcher;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import epson.print.ActivityIACommon;
+import epson.print.R;
+import java.util.Random;
+
+class StorageActivity extends ActivityIACommon {
+
+    public interface CancelRequestCallback {
+        void onCancelRequest(Intent intent);
+    }
+
+    StorageActivity() {
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        StorageSecureStore.initSharedSecureStore(getApplicationContext());
+    }
+
+    public class OverlayProgress {
+        BroadcastReceiver mCancelReceiver;
+        int mRequestCode = new Random().nextInt(Integer.MAX_VALUE);
+
+        public OverlayProgress() {
+            setCancelReceiver((BroadcastReceiver) null);
+        }
+
+        public void show() {
+            show((String) null, (CancelRequestCallback) null);
+        }
+
+        /* access modifiers changed from: package-private */
+        public void show(String str) {
+            show(str, (CancelRequestCallback) null);
+        }
+
+        /* access modifiers changed from: package-private */
+        public void show(String str, CancelRequestCallback cancelRequestCallback) {
+            show(str, cancelRequestCallback, true);
+        }
+
+        /* access modifiers changed from: package-private */
+        public void show(String str, CancelRequestCallback cancelRequestCallback, boolean z) {
+            Intent intent = new Intent(StorageActivity.this, StorageWaitingActivity.class);
+            intent.putExtra(StorageWaitingActivity.EXTRA_REQUEST_CODE, this.mRequestCode);
+            if (str != null) {
+                intent.putExtra(StorageWaitingActivity.EXTRA_MESSAGE, str);
+            }
+            if (cancelRequestCallback != null) {
+                intent.putExtra(StorageWaitingActivity.EXTRA_CANCEL_ENABLED, true);
+                registerCancelRequestReceiver(cancelRequestCallback);
+            }
+            StorageActivity.this.startActivity(intent);
+            while (z && !StorageWaitingActivity.bShowing) {
+                try {
+                    Thread.sleep(200);
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+
+        /* access modifiers changed from: package-private */
+        public void changeMessage(String str) {
+            Intent intent = new Intent(StorageWaitingActivity.CHANGE_ACTION);
+            intent.putExtra(StorageWaitingActivity.EXTRA_REQUEST_CODE, this.mRequestCode);
+            intent.putExtra(StorageWaitingActivity.EXTRA_MESSAGE, str);
+            StorageActivity.this.sendBroadcast(intent);
+        }
+
+        /* access modifiers changed from: package-private */
+        public void registerCancelCallback(CancelRequestCallback cancelRequestCallback) {
+            Intent intent = new Intent(StorageWaitingActivity.REGISTER_ACTION);
+            intent.putExtra(StorageWaitingActivity.EXTRA_REQUEST_CODE, this.mRequestCode);
+            intent.putExtra(StorageWaitingActivity.EXTRA_CANCEL_ENABLED, true);
+            registerCancelRequestReceiver(cancelRequestCallback);
+            StorageActivity.this.sendBroadcast(intent);
+        }
+
+        public void dismiss() {
+            Intent intent = new Intent(StorageWaitingActivity.DISMISS_ACTION);
+            intent.putExtra(StorageWaitingActivity.EXTRA_REQUEST_CODE, this.mRequestCode);
+            StorageActivity.this.sendBroadcast(intent);
+            setCancelReceiver((BroadcastReceiver) null);
+        }
+
+        /* access modifiers changed from: package-private */
+        public void setCancelReceiver(BroadcastReceiver broadcastReceiver) {
+            BroadcastReceiver broadcastReceiver2 = this.mCancelReceiver;
+            if (broadcastReceiver2 != null) {
+                StorageActivity.this.unregisterReceiver(broadcastReceiver2);
+            }
+            this.mCancelReceiver = broadcastReceiver;
+        }
+
+        /* access modifiers changed from: package-private */
+        public void registerCancelRequestReceiver(final CancelRequestCallback cancelRequestCallback) {
+            C09221 r0 = new BroadcastReceiver() {
+                public void onReceive(Context context, Intent intent) {
+                    String action = intent.getAction();
+                    int intExtra = intent.getIntExtra(StorageWaitingActivity.EXTRA_REQUEST_CODE, 0);
+                    if (action.equals(StorageWaitingActivity.CANCEL_REQUEST_ACTION) && OverlayProgress.this.mRequestCode == intExtra) {
+                        cancelRequestCallback.onCancelRequest(intent);
+                    }
+                }
+            };
+            StorageActivity.this.registerReceiver(r0, new IntentFilter(StorageWaitingActivity.CANCEL_REQUEST_ACTION));
+            setCancelReceiver(r0);
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void showErrorDialog(String str) {
+        showErrorDialog(str, (Intent) null);
+    }
+
+    /* access modifiers changed from: package-private */
+    public void showErrorDialog(int i) {
+        showErrorDialog(getString(i));
+    }
+
+    /* access modifiers changed from: package-private */
+    public void showConnectionError() {
+        showErrorDialog(getString(R.string.network_error_mes), new Intent("android.settings.WIRELESS_SETTINGS"));
+    }
+
+    /* access modifiers changed from: package-private */
+    public void showErrorDialog(String str, final Intent intent) {
+        AlertDialog.Builder builder = new AlertDialog.Builder(this);
+        builder.setMessage(str);
+        builder.setCancelable(false);
+        builder.setPositiveButton(getString(R.string.str_ok), new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialogInterface, int i) {
+                dialogInterface.cancel();
+                Intent intent = intent;
+                if (intent != null) {
+                    StorageActivity.this.startActivity(intent);
+                    StorageActivity.this.finish();
+                }
+            }
+        });
+        builder.create().show();
+    }
+
+    /* access modifiers changed from: package-private */
+    public void showErrorDialogAndFinish(String str) {
+        AlertDialog.Builder builder = new AlertDialog.Builder(this);
+        builder.setMessage(str);
+        builder.setCancelable(false);
+        builder.setPositiveButton(getString(R.string.str_ok), new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialogInterface, int i) {
+                dialogInterface.cancel();
+                StorageActivity.this.finish();
+            }
+        });
+        builder.create().show();
+    }
+
+    abstract class OnVisibilityListener {
+        public abstract void onVisibilityChanged(int i);
+
+        OnVisibilityListener() {
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public void bindClearButton(int i, int i2) {
+        bindClearButton(i, i2, (OnVisibilityListener) null);
+    }
+
+    /* access modifiers changed from: package-private */
+    public void bindClearButton(int i, int i2, final OnVisibilityListener onVisibilityListener) {
+        final EditText editText = (EditText) findViewById(i);
+        final Button button = (Button) findViewById(i2);
+        editText.addTextChangedListener(new TextWatcher() {
+            public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
+            }
+
+            public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
+            }
+
+            public void afterTextChanged(Editable editable) {
+                if (editText.getText().toString().length() > 0) {
+                    button.setVisibility(0);
+                } else {
+                    button.setVisibility(8);
+                }
+                OnVisibilityListener onVisibilityListener = onVisibilityListener;
+                if (onVisibilityListener != null) {
+                    onVisibilityListener.onVisibilityChanged(button.getVisibility());
+                }
+            }
+        });
+        button.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View view) {
+                editText.getText().clear();
+            }
+        });
+        if (editText.getText().toString().length() > 0) {
+            button.setVisibility(0);
+        }
+    }
+
+    public boolean isConnected() {
+        NetworkInfo activeNetworkInfo = ((ConnectivityManager) getBaseContext().getSystemService("connectivity")).getActiveNetworkInfo();
+        if (activeNetworkInfo != null) {
+            return activeNetworkInfo.isConnectedOrConnecting();
+        }
+        return false;
+    }
+
+    /* access modifiers changed from: package-private */
+    public void setInputMaxLength(EditText editText, int i) {
+        editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(i)});
+    }
+
+    /* access modifiers changed from: package-private */
+    public void setTitle(String str) {
+        super.setTitle(str);
+    }
+}

+ 76 - 0
app/src/main/java/com/epson/iprint/storage/StorageItem.java

@@ -0,0 +1,76 @@
+package com.epson.iprint.storage;
+
+import android.content.Context;
+import epson.common.ExternalFileUtils;
+import java.io.File;
+import java.util.Comparator;
+
+public class StorageItem {
+    static final int LOGGERINFO_MYPOCKET_FILE = 2;
+    static final int LOGGERINFO_MYPOCKET_PHOTO = 1;
+    private static final int LOGGERINFO_NO_INFO = 0;
+    int mLoggerInfo = 0;
+    public String name;
+    public String path;
+    public ItemType type;
+    public Object userInfo;
+
+    public enum ItemType {
+        DIRECTORY,
+        FILE,
+        PHOTO,
+        LOADMORE
+    }
+
+    public static boolean endsWith(String str, String str2) {
+        if (str2.length() > str.length()) {
+            return false;
+        }
+        return str.regionMatches(true, str.length() - str2.length(), str2, 0, str2.length());
+    }
+
+    public StorageItem() {
+    }
+
+    public StorageItem(String str) {
+        this.name = str;
+    }
+
+    public StorageItem(String str, String str2, ItemType itemType) {
+        this.name = str;
+        this.path = str2;
+        this.type = itemType;
+    }
+
+    public StorageItem(String str, String str2, ItemType itemType, Object obj) {
+        this.name = str;
+        this.path = str2;
+        this.type = itemType;
+        this.userInfo = obj;
+    }
+
+    /* access modifiers changed from: package-private */
+    public String getDownloadLocalPath(Context context) {
+        File file = new File(ExternalFileUtils.getInstance(context).getDownloadDir());
+        if (!file.exists()) {
+            file.mkdirs();
+        }
+        return new File(file.getAbsolutePath(), this.name).getPath();
+    }
+
+    public static class NameComparator implements Comparator<StorageItem> {
+        public int compare(StorageItem storageItem, StorageItem storageItem2) {
+            if (storageItem.name == null || storageItem2.name == null) {
+                return -1;
+            }
+            int compareToIgnoreCase = storageItem.name.compareToIgnoreCase(storageItem2.name);
+            if (compareToIgnoreCase != 0) {
+                return compareToIgnoreCase;
+            }
+            if (storageItem.type == null || storageItem2.name == null) {
+                return -1;
+            }
+            return storageItem.type.compareTo(storageItem2.type);
+        }
+    }
+}

+ 148 - 0
app/src/main/java/com/epson/iprint/storage/StorageProcessActivity.java

@@ -0,0 +1,148 @@
+package com.epson.iprint.storage;
+
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Typeface;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.widget.TextView;
+import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
+import epson.print.R;
+
+public abstract class StorageProcessActivity extends StorageActivity {
+    public static final String EXTRA_UPLOADFILE_LIST = "Extra.Uploadfile.List";
+    private static final String StorageServiceNameKey = "storage.service.name";
+    private boolean bEnableSighIn = true;
+    private String mServerName;
+    private StorageServiceClient mStorageServiceClient;
+
+    public enum ProcessType {
+        DOWNLOAD,
+        UPLOAD
+    }
+
+    public enum SignInStatus {
+        SIGNED_IN,
+        SIGNED_OUT
+    }
+
+    /* access modifiers changed from: package-private */
+    public abstract void onSignInStatus(SignInStatus signInStatus);
+
+    /* access modifiers changed from: package-private */
+    public abstract void onUpdateProcessView();
+
+    public /* bridge */ /* synthetic */ boolean isConnected() {
+        return super.isConnected();
+    }
+
+    public static Intent getProcessIntent(Context context, String str, ProcessType processType) {
+        if (processType == ProcessType.DOWNLOAD) {
+            return null;
+        }
+        Intent intent = new Intent(context, StorageProcessUploadActivity.class);
+        setCommonExtra(intent, str);
+        return intent;
+    }
+
+    protected static void setCommonExtra(Intent intent, String str) {
+        intent.putExtra(StorageServiceNameKey, str);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        init();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onStart() {
+        super.onStart();
+        updateSignInStatus();
+        if (this.mStorageServiceClient.isSignedIn(this)) {
+            onUpdateProcessView();
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onResume() {
+        super.onResume();
+        updateSignInStatus();
+    }
+
+    public StorageServiceClient getStorageClient() {
+        return this.mStorageServiceClient;
+    }
+
+    private void onSignIn() {
+        startActivity(StorageSignInActivity.getStartIntent(this, this.mServerName, this.mStorageServiceClient.getStorageServiceName(this)));
+    }
+
+    private void onSignOut() {
+        this.mStorageServiceClient.revokeSignedInData(this);
+        updateSignInStatus();
+    }
+
+    private void init() {
+        String stringExtra = getIntent().getStringExtra(StorageServiceNameKey);
+        this.mServerName = stringExtra;
+        this.mStorageServiceClient = StorageServiceClient.getClient(stringExtra);
+    }
+
+    private void updateSignInRequest(SignInStatus signInStatus) {
+        TextView textView = (TextView) findViewById(16908292);
+        if (signInStatus == SignInStatus.SIGNED_IN) {
+            textView.setVisibility(8);
+            return;
+        }
+        textView.setText(getString(R.string.sign_in_request));
+        textView.setTypeface((Typeface) null, 1);
+        textView.setTextSize(18.0f);
+        textView.setVisibility(0);
+    }
+
+    public void updateSignInStatus() {
+        SignInStatus signInStatus;
+        WiFiDirectManager.setPriorityToSimpleAP(this, false);
+        if (this.mStorageServiceClient.isSignedIn(this)) {
+            signInStatus = SignInStatus.SIGNED_IN;
+        } else {
+            signInStatus = SignInStatus.SIGNED_OUT;
+        }
+        invalidateOptionsMenu();
+        updateSignInRequest(signInStatus);
+        onSignInStatus(signInStatus);
+    }
+
+    /* access modifiers changed from: package-private */
+    public void setSignInButtonEnabled(boolean z) {
+        this.bEnableSighIn = z;
+        invalidateOptionsMenu();
+    }
+
+    public boolean onOptionsItemSelected(MenuItem menuItem) {
+        switch (menuItem.getItemId()) {
+            case R.id.menu_signin /*2131231253*/:
+                onSignIn();
+                return true;
+            case R.id.menu_signout /*2131231254*/:
+                onSignOut();
+                return true;
+            default:
+                return super.onOptionsItemSelected(menuItem);
+        }
+    }
+
+    public boolean onCreateOptionsMenu(Menu menu) {
+        getMenuInflater().inflate(R.C2138menu.menu_sign_inout, menu);
+        if (this.mStorageServiceClient.isSignedIn(this)) {
+            menu.removeItem(R.id.menu_signin);
+            menu.findItem(R.id.menu_signout).setEnabled(this.bEnableSighIn);
+        } else {
+            menu.removeItem(R.id.menu_signout);
+            menu.findItem(R.id.menu_signin).setEnabled(this.bEnableSighIn);
+        }
+        return super.onCreateOptionsMenu(menu);
+    }
+}

+ 523 - 0
app/src/main/java/com/epson/iprint/storage/StorageProcessDownloadActivity.java

@@ -0,0 +1,523 @@
+package com.epson.iprint.storage;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.ListAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+import com.epson.iprint.prtlogger.PrintLog;
+import com.epson.iprint.storage.StorageActivity;
+import com.epson.iprint.storage.StorageItem;
+import com.epson.iprint.storage.StorageProcessActivity;
+import com.epson.iprint.storage.StorageServiceClient;
+import epson.common.Utils;
+import epson.print.ActivityDocsPrintPreview;
+import epson.print.ActivityPrintWeb;
+import epson.print.ActivityViewImageSelect;
+import epson.print.R;
+import epson.print.CommonDefine;
+import epson.print.Util.AsyncTaskExecutor;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Stack;
+import org.opencv.videoio.Videoio;
+
+public class StorageProcessDownloadActivity extends StorageProcessActivity {
+    public static final String PARAM_KEY_ONLINE_STORAGE_PRINT_LOG = "print_log";
+    private final String DOWNLOADED_FILE_PATH = "Downloaded.File.Path";
+    private final String DOWNLOAD_PREFERENCE = "StorageProcessDownloadActivity.Preference";
+    private final String ITEMNAME_PARENT = "..";
+    private final int REQUEST_CODE_DELETE_DOWNLOADED_FILE = 0;
+    private StorageServiceClient.Enumerator mEnumerator;
+    /* access modifiers changed from: private */
+    public Stack<StorageItem> mFolderStack;
+    /* access modifiers changed from: private */
+    public boolean mIsDownloadInterruption = false;
+    /* access modifiers changed from: private */
+    public boolean mIsDownloading = false;
+    /* access modifiers changed from: private */
+    public ListView mListView;
+    /* access modifiers changed from: private */
+    public int mPosition = 0;
+    /* access modifiers changed from: private */
+    public PrintLog mPrintLog;
+    AsyncTaskExecutor<Void, Void, Void> task = null;
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        setContentView((int) R.layout.folder_content_layout);
+        setActionBar(getStorageClient().getStorageServiceName(this), true);
+        this.mEnumerator = getStorageClient().getEnumerator(this);
+        this.mFolderStack = new Stack<>();
+        this.mListView = (ListView) findViewById(16908298);
+        this.mListView.setOnItemClickListener(new StorageItemClickListener());
+        this.mListView.setCacheColorHint(0);
+        try {
+            this.mPrintLog = (PrintLog) getIntent().getSerializableExtra("print_log");
+        } catch (ClassCastException unused) {
+        }
+        if (this.mPrintLog == null) {
+            this.mPrintLog = new PrintLog();
+        }
+    }
+
+    public void onBackPressed() {
+        StorageItemAdapter storageItemAdapter = (StorageItemAdapter) this.mListView.getAdapter();
+        if (storageItemAdapter == null) {
+            finish();
+        } else if (storageItemAdapter.areAllItemsEnabled()) {
+            if (this.mFolderStack.size() > 1) {
+                this.mFolderStack.pop();
+                if (isConnected()) {
+                    new EnumerateTask(this.mFolderStack.peek()).executeOnExecutor(new Void[0]);
+                } else {
+                    showConnectionError();
+                }
+            } else {
+                finish();
+            }
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public void onSignInStatus(StorageProcessActivity.SignInStatus signInStatus) {
+        if (signInStatus == StorageProcessActivity.SignInStatus.SIGNED_IN) {
+            this.mListView.setVisibility(0);
+            return;
+        }
+        this.mListView.setVisibility(4);
+        this.mListView.setAdapter((ListAdapter) null);
+        StorageServiceClient.Enumerator enumerator = this.mEnumerator;
+        if (enumerator != null) {
+            enumerator.cleanUpResources();
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onStop() {
+        super.onStop();
+        if (this.mIsDownloading && Build.VERSION.SDK_INT >= 29) {
+            this.mIsDownloadInterruption = true;
+            this.task.cancel(false);
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onRestart() {
+        super.onRestart();
+        if (this.mIsDownloadInterruption && !this.mIsDownloading) {
+            itemClick(this.mPosition);
+        }
+        this.mIsDownloadInterruption = false;
+    }
+
+    /* access modifiers changed from: package-private */
+    public void onUpdateProcessView() {
+        if (this.mListView.getAdapter() != null) {
+            return;
+        }
+        if (isConnected()) {
+            StorageItem rootItem = getEnumerator().getRootItem();
+            this.mFolderStack = new Stack<>();
+            this.mFolderStack.push(rootItem);
+            new EnumerateTask(rootItem).executeOnExecutor(new Void[0]);
+            return;
+        }
+        showConnectionError();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onActivityResult(int i, int i2, Intent intent) {
+        if (i == 0) {
+            String fetchDownloadedFilePath = fetchDownloadedFilePath();
+            if (fetchDownloadedFilePath != null) {
+                new File(fetchDownloadedFilePath).delete();
+            }
+            this.mIsDownloadInterruption = false;
+        }
+    }
+
+    class DownloadTask extends AsyncTaskExecutor<Void, Void, Void> {
+        StorageItem item = null;
+        String localPath = null;
+        StorageActivity.OverlayProgress progress = null;
+
+        /* access modifiers changed from: protected */
+        public void onPreExecute() {
+            StorageProcessDownloadActivity.this.taskInvoked(true);
+        }
+
+        /* access modifiers changed from: protected */
+        public Void doInBackground(Void... voidArr) {
+            final StorageServiceClient.Downloader downloader = StorageProcessDownloadActivity.this.getStorageClient().getDownloader(StorageProcessDownloadActivity.this, this.item, this.localPath);
+            C09241 r0 = downloader.isCancelable() ? new StorageActivity.CancelRequestCallback() {
+                public void onCancelRequest(Intent intent) {
+                    downloader.cancel();
+                }
+            } : null;
+            this.progress = new StorageActivity.OverlayProgress();
+            this.progress.show(StorageProcessDownloadActivity.this.getString(R.string.downloading_notification), r0);
+            downloader.start(new StorageServiceClient.DownloadCompletion() {
+                public void onDownloadComplete(StorageItem storageItem, String str, StorageServiceClient.ProcessError processError) {
+                    if (str != null) {
+                        DownloadTask.this.localPath = str;
+                    }
+                    StorageProcessDownloadActivity.this.runOnUiThread(new DownloadedRun(processError));
+                }
+            });
+            return null;
+        }
+
+        class DownloadedRun implements Runnable {
+            StorageServiceClient.ProcessError error;
+
+            DownloadedRun(StorageServiceClient.ProcessError processError) {
+                this.error = processError;
+            }
+
+            public void run() {
+                boolean unused = StorageProcessDownloadActivity.this.mIsDownloading = false;
+                if (this.error == StorageServiceClient.ProcessError.NONE) {
+                    StorageProcessDownloadActivity storageProcessDownloadActivity = StorageProcessDownloadActivity.this;
+                    Intent previewIntent = StorageProcessDownloadActivity.getPreviewIntent(DownloadTask.this.localPath, storageProcessDownloadActivity, StorageProcessDownloadActivity.this.mPrintLog);
+                    previewIntent.setFlags(Videoio.CAP_INTELPERC_IMAGE_GENERATOR);
+                    StorageProcessDownloadActivity.this.saveDownloadedFilePath(DownloadTask.this.localPath);
+                    if (!StorageProcessDownloadActivity.this.mIsDownloadInterruption) {
+                        storageProcessDownloadActivity.startActivityForResult(previewIntent, 0);
+                    }
+                } else if (this.error != StorageServiceClient.ProcessError.CANCELED) {
+                    StorageProcessDownloadActivity.this.showErrorDialog((int) R.string.download_error_mes);
+                }
+                StorageProcessDownloadActivity.this.taskInvoked(false);
+                DownloadTask.this.progress.dismiss();
+            }
+        }
+
+        DownloadTask(StorageItem storageItem) {
+            this.item = storageItem;
+            this.localPath = StorageProcessDownloadActivity.this.getStorageClient().getDownloadLocalPath(StorageProcessDownloadActivity.this, storageItem);
+        }
+    }
+
+    public static Intent getPreviewIntent(@NonNull String str, @NonNull Context context, @NonNull PrintLog printLog) {
+        Intent intent = new Intent();
+        intent.putExtra("from", 4);
+        if (StorageItem.endsWith(str, CommonDefine.FileType_PDF) || Utils.isGConvertFile(str)) {
+            intent.putExtra(CommonDefine.SEND_DOCUMENT_VIEW, str);
+            intent.setClass(context, ActivityDocsPrintPreview.class);
+            printLog.originalFileExtension = PrintLog.getFileExtension(str);
+            intent.putExtra("print_log", printLog);
+        } else if (Utils.isPhotoFile(str)) {
+            intent.setAction("android.intent.action.SEND");
+            intent.putExtra("android.intent.extra.STREAM", Uri.parse(str));
+            intent.setType(Utils.getMimeExt(str));
+            intent.putExtra(CommonDefine.STYPE, true);
+            intent.setClass(context, ActivityViewImageSelect.class);
+            intent.putExtra(ActivityViewImageSelect.PARAMS_KEY_FROM_EPSON, true);
+            printLog.originalFileExtension = PrintLog.getFileExtension(str);
+            intent.putExtra("print_log", printLog);
+        } else {
+            ArrayList arrayList = new ArrayList();
+            arrayList.add(str);
+            intent.putStringArrayListExtra("print_web", arrayList);
+            intent.putExtra(CommonDefine.STYPE, true);
+            intent.setClass(context, ActivityPrintWeb.class);
+            printLog.originalFileExtension = PrintLog.getFileExtension(str);
+            intent.putExtra("print_log", printLog);
+        }
+        return intent;
+    }
+
+    class EnumerateTask extends AsyncTaskExecutor<Void, Void, Void> {
+        List<StorageItem> enumeratedItems;
+        StorageItem item;
+        final StorageServiceClient.EnumerateCompletion onEnumerated = new StorageServiceClient.EnumerateCompletion() {
+            public void onEnumerateComplete(List<StorageItem> list, final StorageServiceClient.ProcessError processError) {
+                EnumerateTask enumerateTask = EnumerateTask.this;
+                enumerateTask.enumeratedItems = list;
+                int size = StorageProcessDownloadActivity.this.mFolderStack.size();
+                if (size > 1) {
+                    StorageItem storageItem = (StorageItem) StorageProcessDownloadActivity.this.mFolderStack.get(size - 2);
+                    StorageItem storageItem2 = new StorageItem("..");
+                    storageItem2.path = storageItem.path;
+                    storageItem2.type = StorageItem.ItemType.DIRECTORY;
+                    storageItem2.userInfo = storageItem.userInfo;
+                    if (EnumerateTask.this.enumeratedItems == null) {
+                        EnumerateTask.this.enumeratedItems = new ArrayList();
+                    }
+                    EnumerateTask.this.enumeratedItems.add(0, storageItem2);
+                }
+                StorageProcessDownloadActivity.this.runOnUiThread(new Runnable() {
+                    public void run() {
+                        if (processError == StorageServiceClient.ProcessError.NONE && EnumerateTask.this.enumeratedItems != null) {
+                            StorageProcessDownloadActivity.this.mListView.setAdapter(new StorageItemAdapter(EnumerateTask.this.enumeratedItems));
+                        } else if (processError != StorageServiceClient.ProcessError.CANCELED) {
+                            StorageProcessDownloadActivity.this.showErrorDialog((int) R.string.unknow_error_mes);
+                        }
+                        StorageProcessDownloadActivity.this.taskInvoked(false);
+                        EnumerateTask.this.progress.dismiss();
+                    }
+                });
+            }
+        };
+        StorageServiceClient.EnumerateCompletion onLoadedMore = new StorageServiceClient.EnumerateCompletion() {
+            public void onEnumerateComplete(final List<StorageItem> list, final StorageServiceClient.ProcessError processError) {
+                StorageProcessDownloadActivity.this.runOnUiThread(new Runnable() {
+                    public void run() {
+                        if (processError == StorageServiceClient.ProcessError.NONE) {
+                            StorageItemAdapter storageItemAdapter = (StorageItemAdapter) StorageProcessDownloadActivity.this.mListView.getAdapter();
+                            if (storageItemAdapter != null) {
+                                storageItemAdapter.addLoaedMoreItems(list);
+                                storageItemAdapter.notifyDataSetChanged();
+                            }
+                        } else if (processError != StorageServiceClient.ProcessError.CANCELED) {
+                            StorageProcessDownloadActivity.this.showErrorDialog((int) R.string.unknow_error_mes);
+                        }
+                        StorageProcessDownloadActivity.this.taskInvoked(false);
+                        EnumerateTask.this.progress.dismiss();
+                    }
+                });
+            }
+        };
+        StorageActivity.OverlayProgress progress = new StorageActivity.OverlayProgress();
+
+        /* access modifiers changed from: protected */
+        public void onPreExecute() {
+            StorageProcessDownloadActivity.this.taskInvoked(true);
+        }
+
+        /* access modifiers changed from: protected */
+        public Void doInBackground(Void... voidArr) {
+            boolean isNeedSignin = StorageProcessDownloadActivity.this.getStorageClient().isNeedSignin();
+            if (!isNeedSignin) {
+                this.progress.show();
+            }
+            if (this.item.type == StorageItem.ItemType.LOADMORE) {
+                StorageProcessDownloadActivity.this.getEnumerator().enumerate(this.item, this.onLoadedMore);
+                return null;
+            } else if (!isNeedSignin) {
+                StorageProcessDownloadActivity.this.getEnumerator().enumerate(this.item, this.onEnumerated);
+                return null;
+            } else {
+                StorageProcessDownloadActivity.this.getEnumerator().enumerate(this.item, this.onEnumerated, new StorageServiceClient.SigninCompletion() {
+                    public void onSigninCompletion() {
+                        EnumerateTask.this.progress.show((String) null, (StorageActivity.CancelRequestCallback) null, false);
+                    }
+                });
+                return null;
+            }
+        }
+
+        EnumerateTask(StorageItem storageItem) {
+            this.item = storageItem;
+        }
+    }
+
+    private class StorageItemClickListener implements AdapterView.OnItemClickListener {
+        private StorageItemClickListener() {
+        }
+
+        public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
+            int unused = StorageProcessDownloadActivity.this.mPosition = i;
+            StorageProcessDownloadActivity.this.itemClick(i);
+        }
+    }
+
+    /* access modifiers changed from: private */
+    public void itemClick(int i) {
+        this.mIsDownloading = true;
+        if (isConnected()) {
+            this.task = null;
+            StorageItem storageItem = (StorageItem) this.mListView.getItemAtPosition(i);
+            if (storageItem.type == StorageItem.ItemType.DIRECTORY) {
+                if (storageItem.name.equals("..")) {
+                    this.mFolderStack.pop();
+                } else if (!storageItem.path.equals(((StorageItem) this.mFolderStack.lastElement()).path)) {
+                    this.mFolderStack.push(storageItem);
+                }
+                this.task = new EnumerateTask(storageItem);
+                int i2 = storageItem.mLoggerInfo;
+            } else if (storageItem.type == StorageItem.ItemType.LOADMORE) {
+                this.task = new EnumerateTask(storageItem);
+            } else {
+                this.task = new DownloadTask(storageItem);
+            }
+            AsyncTaskExecutor<Void, Void, Void> asyncTaskExecutor = this.task;
+            if (asyncTaskExecutor != null) {
+                asyncTaskExecutor.executeOnExecutor(new Void[0]);
+                return;
+            }
+            return;
+        }
+        showConnectionError();
+    }
+
+    class StorageItemAdapter extends ArrayAdapter<StorageItem> {
+        final int COMPONENT_GONE = -12345;
+        LayoutInflater layoutInflater;
+        List<StorageItem> storageItems;
+        boolean taskRunningNow;
+        HashMap<StorageItem, View> viewCache;
+
+        public boolean areAllItemsEnabled() {
+            return !this.taskRunningNow;
+        }
+
+        public boolean isEnabled(int i) {
+            return areAllItemsEnabled();
+        }
+
+        @NonNull
+        public View getView(int i, View view, @NonNull ViewGroup viewGroup) {
+            StorageItem storageItem = this.storageItems.get(i);
+            View view2 = this.viewCache.get(storageItem);
+            if (view2 == null) {
+                view2 = this.layoutInflater.inflate(R.layout.file_list_item, (ViewGroup) null);
+                switch (storageItem.type) {
+                    case DIRECTORY:
+                        if (!storageItem.name.equals("..")) {
+                            setViewComponents(view2, storageItem.name, R.C2136drawable.folder, R.C2136drawable.more);
+                            break;
+                        } else {
+                            setViewComponents(view2, storageItem.name, R.C2136drawable.parent_folder, R.C2136drawable.more);
+                            break;
+                        }
+                    case LOADMORE:
+                        String str = storageItem.name;
+                        if (str == null) {
+                            str = StorageProcessDownloadActivity.this.getString(R.string.storage_item_load_more_photos);
+                        }
+                        setViewComponents(view2, str, -12345, -12345);
+                        break;
+                    case FILE:
+                        setViewComponents(view2, storageItem.name, R.C2136drawable.file, -12345);
+                        break;
+                    case PHOTO:
+                        setViewComponents(view2, storageItem.name, R.C2136drawable.image, -12345);
+                        StorageProcessDownloadActivity.this.getEnumerator().setThumbnailInBackground(storageItem, getIconView(view2));
+                        break;
+                }
+                this.viewCache.put(storageItem, view2);
+            }
+            return view2;
+        }
+
+        StorageItemAdapter(List<StorageItem> list) {
+            super(StorageProcessDownloadActivity.this.getBaseContext(), R.layout.file_list_item, list);
+            this.layoutInflater = (LayoutInflater) StorageProcessDownloadActivity.this.getBaseContext().getSystemService("layout_inflater");
+            this.storageItems = list;
+            this.viewCache = new HashMap<>();
+        }
+
+        /* access modifiers changed from: package-private */
+        public void setViewComponents(View view, String str, int i, int i2) {
+            ((TextView) view.findViewById(R.id.file_folder_name)).setText(str);
+            ImageView imageView = (ImageView) view.findViewById(R.id.file_folder_icon);
+            if (i == -12345) {
+                imageView.setVisibility(8);
+            } else {
+                imageView.setImageResource(i);
+                imageView.setVisibility(0);
+            }
+            ImageView imageView2 = (ImageView) view.findViewById(R.id.browse_folder);
+            if (i2 == -12345) {
+                imageView2.setVisibility(8);
+                return;
+            }
+            imageView2.setImageResource(i2);
+            imageView2.setVisibility(0);
+        }
+
+        /* access modifiers changed from: package-private */
+        public void setTaskingStatus(boolean z) {
+            this.taskRunningNow = z;
+        }
+
+        /* access modifiers changed from: package-private */
+        public void addLoaedMoreItems(List<StorageItem> list) {
+            List<StorageItem> list2 = this.storageItems;
+            list2.remove(list2.size() - 1);
+            this.storageItems.addAll(list);
+        }
+
+        /* access modifiers changed from: package-private */
+        public ImageView getIconView(View view) {
+            return (ImageView) view.findViewById(R.id.file_folder_icon);
+        }
+    }
+
+    /* access modifiers changed from: private */
+    public void taskInvoked(boolean z) {
+        StorageItemAdapter storageItemAdapter = (StorageItemAdapter) this.mListView.getAdapter();
+        if (storageItemAdapter != null) {
+            storageItemAdapter.setTaskingStatus(z);
+        }
+        boolean z2 = true;
+        if (z) {
+            z2 = false;
+        }
+        setSignInButtonEnabled(z2);
+    }
+
+    /* access modifiers changed from: private */
+    public void saveDownloadedFilePath(String str) {
+        getSharedPreferences("StorageProcessDownloadActivity.Preference", 0).edit().putString("Downloaded.File.Path", str).apply();
+    }
+
+    private String fetchDownloadedFilePath() {
+        return getSharedPreferences("StorageProcessDownloadActivity.Preference", 0).getString("Downloaded.File.Path", (String) null);
+    }
+
+    /* access modifiers changed from: private */
+    public StorageServiceClient.Enumerator getEnumerator() {
+        if (this.mEnumerator == null) {
+            this.mEnumerator = getStorageClient().getEnumerator(this);
+        }
+        return this.mEnumerator;
+    }
+
+    @NonNull
+    public static Intent getStartIntent(@NonNull Context context, String str) {
+        Intent intent = new Intent(context, StorageProcessDownloadActivity.class);
+        PrintLog printLog = new PrintLog();
+        printLog.uiRoute = getOnlineStorageUiRouteValue(str);
+        intent.putExtra("print_log", printLog);
+        setCommonExtra(intent, str);
+        return intent;
+    }
+
+    private static int getOnlineStorageUiRouteValue(String str) {
+        if (str == null) {
+            return -1;
+        }
+        if (StorageServiceClient.STORAGE_BOX.equals(str)) {
+            return PrintLog.PRINT_SOURCE_BOX;
+        }
+        if (StorageServiceClient.STORAGE_DROPBOX.equals(str)) {
+            return PrintLog.PRINT_SOURCE_DROPBOX;
+        }
+        if (StorageServiceClient.STORAGE_EVERNOTE.equals(str)) {
+            return 256;
+        }
+        if (StorageServiceClient.STORAGE_GOOGLEDRIVE.equals(str)) {
+            return 257;
+        }
+        if (StorageServiceClient.STORAGE_ONEDRIVE.equals(str)) {
+            return PrintLog.PRINT_SOURCE_ONEDRIVE;
+        }
+        return -1;
+    }
+}

+ 276 - 0
app/src/main/java/com/epson/iprint/storage/StorageProcessUploadActivity.java

@@ -0,0 +1,276 @@
+package com.epson.iprint.storage;
+
+import android.content.Intent;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.support.p000v4.media.session.PlaybackStateCompat;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.RadioGroup;
+import android.widget.TextView;
+import com.epson.iprint.storage.StorageActivity;
+import com.epson.iprint.storage.StorageProcessActivity;
+import com.epson.iprint.storage.StorageServiceClient;
+import com.epson.iprint.storage.gdrivev3.GoogleV3UploadClient;
+import com.epson.iprint.storage.gdrivev3.GoogleV3UploadSignInActivity;
+import epson.print.R;
+import epson.print.CommonDefine;
+import epson.print.ScanFileNumber;
+import epson.print.Util.EPLog;
+import epson.print.Util.Utils;
+import epson.scan.lib.libHaru;
+import epson.server.utils.MyUtility;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReentrantLock;
+
+public class StorageProcessUploadActivity extends StorageProcessActivity {
+    final String UPLOAD_EDITING_FILENAME = "Upload.Editing.Filename";
+    List<String> mUploadFileLocalPathList;
+    String mUploadFilename;
+
+    /* access modifiers changed from: package-private */
+    public void onUpdateProcessView() {
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        String string;
+        super.onCreate(bundle);
+        setContentView((int) R.layout.folder_content_layout_for_upload);
+        setActionBar(getStorageClient().getStorageServiceName(this), true);
+        final Button button = (Button) findViewById(R.id.save_button);
+        button.setText(getString(R.string.upload_btn_label));
+        button.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View view) {
+                String filename = StorageProcessUploadActivity.this.getFilename();
+                if (!StorageProcessUploadActivity.this.getStorageClient().isValidUploadName(filename)) {
+                    StorageProcessUploadActivity.this.showErrorDialog((int) R.string.str_error_Filename);
+                } else if (StorageProcessUploadActivity.this.isConnected()) {
+                    button.setEnabled(false);
+                    UploadTask uploadTask = new UploadTask();
+                    uploadTask.localPaths = new ArrayList(StorageProcessUploadActivity.this.mUploadFileLocalPathList);
+                    uploadTask.uploadFilename = filename;
+                    uploadTask.fileType = StorageProcessUploadActivity.this.getFiletype();
+                    uploadTask.execute(new Void[0]);
+                } else {
+                    StorageProcessUploadActivity.this.showConnectionError();
+                }
+            }
+        });
+        bindClearButton(R.id.upload_dialog_file_name, R.id.clear_name_btn, new StorageActivity.OnVisibilityListener() {
+            public void onVisibilityChanged(int i) {
+                StorageProcessUploadActivity.this.setEnabledSaveButton(i == 0);
+            }
+        });
+        this.mUploadFilename = generateUploadFilename(0);
+        if (!(bundle == null || (string = bundle.getString("Upload.Editing.Filename")) == null)) {
+            this.mUploadFilename = string;
+        }
+        setFilename(this.mUploadFilename);
+        this.mUploadFileLocalPathList = getIntent().getStringArrayListExtra(StorageProcessActivity.EXTRA_UPLOADFILE_LIST);
+        if (getStorageClient() instanceof GoogleV3UploadClient) {
+            startActivity(GoogleV3UploadSignInActivity.getPlayServiceCheckIntent(this));
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onSaveInstanceState(Bundle bundle) {
+        super.onSaveInstanceState(bundle);
+        this.mUploadFilename = getFilename();
+        bundle.putString("Upload.Editing.Filename", this.mUploadFilename);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onRestoreInstanceState(Bundle bundle) {
+        super.onRestoreInstanceState(bundle);
+        this.mUploadFilename = bundle.getString("Upload.Editing.Filename");
+    }
+
+    /* access modifiers changed from: package-private */
+    public void onSignInStatus(StorageProcessActivity.SignInStatus signInStatus) {
+        updateUploadSection(signInStatus);
+        updateSaveButton(signInStatus);
+    }
+
+    class UploadTask extends AsyncTask<Void, Void, Void> {
+        boolean canceled;
+        StorageServiceClient.UploadFileType fileType;
+        List<String> localPaths;
+        /* access modifiers changed from: private */
+        public volatile StorageServiceClient.ProcessError taskError;
+        String uploadFilename;
+        boolean uploaded;
+        StorageServiceClient.Uploader uploader;
+
+        UploadTask() {
+        }
+
+        /* access modifiers changed from: protected */
+        public Void doInBackground(Void... voidArr) {
+            final ReentrantLock reentrantLock;
+            final StorageActivity.OverlayProgress overlayProgress = new StorageActivity.OverlayProgress();
+            overlayProgress.show(StorageProcessUploadActivity.this.getString(R.string.uploading_notification), new StorageActivity.CancelRequestCallback() {
+                public void onCancelRequest(Intent intent) {
+                    if (UploadTask.this.uploader != null && UploadTask.this.uploader.isCancelable()) {
+                        UploadTask.this.uploader.cancel();
+                    }
+                    UploadTask.this.canceled = true;
+                }
+            });
+            String str = "";
+            if (StorageServiceClient.UploadFileType.PDF.equals(this.fileType)) {
+                String str2 = new File(this.localPaths.get(0)).getParent() + CommonDefine.SLASH + this.uploadFilename + CommonDefine.FileType_PDF;
+                new libHaru().createPDF((ArrayList) this.localPaths, str2);
+                this.localPaths.clear();
+                this.localPaths.add(str2);
+                str = CommonDefine.FileType_PDF;
+            } else if (StorageServiceClient.UploadFileType.JPEG.equals(this.fileType)) {
+                str = ".jpg";
+            }
+            boolean z = !this.uploadFilename.equals(StorageProcessUploadActivity.this.generateUploadFilename(0));
+            int size = this.localPaths.size();
+            int i = 0;
+            while (true) {
+                if (i >= size) {
+                    break;
+                }
+                String str3 = this.localPaths.get(i);
+                String str4 = this.uploadFilename + str;
+                if (size > 1) {
+                    if (z) {
+                        str4 = String.format("%s%03d%s", new Object[]{this.uploadFilename, Integer.valueOf(i + 1), str});
+                    } else {
+                        str4 = String.format("%s%s", new Object[]{StorageProcessUploadActivity.this.generateUploadFilename(i), str});
+                    }
+                    overlayProgress.changeMessage(StorageProcessUploadActivity.this.getString(R.string.uploading_notification) + (i + 1) + CommonDefine.SLASH + size);
+                }
+                reentrantLock = new ReentrantLock();
+                final Condition newCondition = reentrantLock.newCondition();
+                try {
+                    reentrantLock.lock();
+                    this.uploaded = false;
+                    this.taskError = StorageServiceClient.ProcessError.NONE;
+                    this.uploader = StorageProcessUploadActivity.this.getStorageClient().getUploader(StorageProcessUploadActivity.this, this.fileType, str3, str4);
+                    this.uploader.start(new StorageServiceClient.UploadCompletion() {
+                        public void onUploadComplete(String str, String str2, StorageServiceClient.ProcessError processError) {
+                            try {
+                                reentrantLock.lock();
+                                StorageServiceClient.ProcessError unused = UploadTask.this.taskError = processError;
+                                UploadTask.this.uploaded = true;
+                                newCondition.signal();
+                            } catch (Exception e) {
+                                EPLog.m318w("Storage", "onUploadComplete() exception <" + e.toString() + ">");
+                            } catch (Throwable th) {
+                                reentrantLock.unlock();
+                                throw th;
+                            }
+                            reentrantLock.unlock();
+                        }
+                    });
+                    while (!this.uploaded) {
+                        newCondition.await();
+                    }
+                    if (!this.canceled && this.taskError == StorageServiceClient.ProcessError.NONE) {
+                        reentrantLock.unlock();
+                        i++;
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    this.taskError = StorageServiceClient.ProcessError.ERROR;
+                } catch (Throwable th) {
+                    reentrantLock.unlock();
+                    throw th;
+                }
+            }
+            if (this.canceled) {
+                this.taskError = StorageServiceClient.ProcessError.CANCELED;
+            }
+            reentrantLock.unlock();
+            StorageProcessUploadActivity.this.runOnUiThread(new Runnable() {
+                public void run() {
+                    if (UploadTask.this.taskError == StorageServiceClient.ProcessError.NONE) {
+                        overlayProgress.dismiss();
+                        StorageProcessUploadActivity.this.finish();
+                        return;
+                    }
+                    StorageProcessUploadActivity.this.setEnabledSaveButton(true);
+                    if (UploadTask.this.taskError == StorageServiceClient.ProcessError.ERROR) {
+                        StorageProcessUploadActivity.this.showErrorDialog((int) R.string.upload_error_mes);
+                    }
+                    overlayProgress.dismiss();
+                }
+            });
+            return null;
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public void updateUploadSection(StorageProcessActivity.SignInStatus signInStatus) {
+        ViewGroup viewGroup = (ViewGroup) findViewById(R.id.upload_file_name_file_type_section);
+        if (signInStatus == StorageProcessActivity.SignInStatus.SIGNED_IN) {
+            viewGroup.setVisibility(0);
+            ((RadioGroup) findViewById(R.id.file_type_for_upload)).check(R.id.pdf_type);
+            List<String> list = this.mUploadFileLocalPathList;
+            if (list != null && list.size() > 0) {
+                setFilename(this.mUploadFilename);
+            }
+            ((TextView) findViewById(R.id.file_size)).setText(getTotalFileSize(this.mUploadFileLocalPathList));
+            return;
+        }
+        viewGroup.setVisibility(4);
+    }
+
+    /* access modifiers changed from: package-private */
+    public void updateSaveButton(StorageProcessActivity.SignInStatus signInStatus) {
+        setEnabledSaveButton(signInStatus == StorageProcessActivity.SignInStatus.SIGNED_IN);
+    }
+
+    /* access modifiers changed from: package-private */
+    public void setEnabledSaveButton(boolean z) {
+        Button button = (Button) findViewById(R.id.save_button);
+        if (z) {
+            button.setEnabled(true);
+        } else {
+            button.setEnabled(false);
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public String getFilename() {
+        return ((TextView) findViewById(R.id.upload_dialog_file_name)).getText().toString();
+    }
+
+    /* access modifiers changed from: package-private */
+    public void setFilename(String str) {
+        ((EditText) findViewById(R.id.upload_dialog_file_name)).setText(str);
+    }
+
+    /* access modifiers changed from: package-private */
+    public StorageServiceClient.UploadFileType getFiletype() {
+        return ((RadioGroup) findViewById(R.id.file_type_for_upload)).getCheckedRadioButtonId() == R.id.pdf_type ? StorageServiceClient.UploadFileType.PDF : StorageServiceClient.UploadFileType.JPEG;
+    }
+
+    /* access modifiers changed from: package-private */
+    public String generateUploadFilename(int i) {
+        int count = ScanFileNumber.getCount(this);
+        return "EPSON" + new Utils().editNumber(count + i);
+    }
+
+    /* access modifiers changed from: package-private */
+    public String getTotalFileSize(List<String> list) {
+        Long l = 0L;
+        for (String file : list) {
+            l = Long.valueOf(l.longValue() + new File(file).length());
+        }
+        double longValue = (double) (l.longValue() / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID);
+        if (longValue > 500.0d) {
+            return MyUtility.mathRound(longValue / 1024.0d, 2) + "MB";
+        }
+        return MyUtility.mathRound(longValue, 2) + "KB";
+    }
+}

+ 291 - 0
app/src/main/java/com/epson/iprint/storage/StorageSecureStore.java

@@ -0,0 +1,291 @@
+package com.epson.iprint.storage;
+
+import android.content.Context;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+import com.box.androidsdk.content.requests.BoxRequestsMetadata;
+import java.util.HashMap;
+import java.util.Map;
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+
+public class StorageSecureStore {
+    static StorageSecureStore mInstance;
+    final String COLUMN_KEY = "key";
+    final String COLUMN_VALUE = BoxRequestsMetadata.UpdateItemMetadata.BoxMetadataUpdateTask.VALUE;
+    final String CREATE_KEYVALUE = "CREATE TABLE IF NOT EXISTS keyvalue_tbl (key TEXT PRIMARY KEY, value BLOB);";
+    final String DELETE_KEYVALUE = "key=?";
+    final String DROP_KEYVALUE = "DROP TABLE IF EXISTS keyvalue_tbl;";
+    final String ENCRYPT_ALGORITHM = "AES";
+    final int ENCRYPT_KEY_BYTES = 16;
+    final int INDEX_KEY = 0;
+    final int INDEX_VALUE = 1;
+    final String KEYVALUE_DBNAME = "storage.data";
+    final String KEYVALUE_TBLNAME = "keyvalue_tbl";
+    final int KEYVALUE_VERSION = 1;
+    final String SELECT_KEYVALUE = "SELECT * FROM keyvalue_tbl;";
+    Context mContext = null;
+    Map<String, String> mKeyValueMap = null;
+
+    public enum EXEC_MODE {
+        NONE,
+        OVERWRITE_IF_EXIST
+    }
+
+    public static StorageSecureStore getSharedSecureStore() {
+        return mInstance;
+    }
+
+    public boolean put(String str, String str2) {
+        KeyValueDatabase keyValueDatabase = new KeyValueDatabase(this.mContext);
+        boolean insert = keyValueDatabase.insert(str, str2);
+        keyValueDatabase.close();
+        reloadCache();
+        return insert;
+    }
+
+    public boolean put(String str, String str2, EXEC_MODE exec_mode) {
+        if (exec_mode == EXEC_MODE.OVERWRITE_IF_EXIST && fetch(str) != null) {
+            revoke(str);
+        }
+        return put(str, str2);
+    }
+
+    public String fetch(String str) {
+        return this.mKeyValueMap.get(str);
+    }
+
+    public boolean revoke(String str) {
+        KeyValueDatabase keyValueDatabase = new KeyValueDatabase(this.mContext);
+        boolean delete = keyValueDatabase.delete(str);
+        keyValueDatabase.close();
+        reloadCache();
+        return delete;
+    }
+
+    public static void initSharedSecureStore(Context context) {
+        if (mInstance == null) {
+            mInstance = new StorageSecureStore(context);
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public byte[] encodeAes(byte[] bArr, String str) {
+        if (bArr == null || str == null) {
+            return null;
+        }
+        try {
+            byte[] makeKeyBytes = makeKeyBytes(16, str.getBytes());
+            Cipher instance = Cipher.getInstance("AES");
+            instance.init(1, new SecretKeySpec(makeKeyBytes, "AES"));
+            return instance.doFinal(bArr);
+        } catch (Exception unused) {
+            return null;
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public byte[] decodeAes(byte[] bArr, String str) {
+        if (bArr == null || str == null) {
+            return null;
+        }
+        try {
+            byte[] makeKeyBytes = makeKeyBytes(16, str.getBytes());
+            Cipher instance = Cipher.getInstance("AES");
+            instance.init(2, new SecretKeySpec(makeKeyBytes, "AES"));
+            return instance.doFinal(bArr);
+        } catch (Exception unused) {
+            return null;
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public byte[] makeKeyBytes(int i, byte[] bArr) {
+        byte[] bArr2 = new byte[i];
+        for (int i2 = 0; i2 < bArr2.length; i2++) {
+            if (i2 < bArr.length) {
+                bArr2[i2] = bArr[i2];
+            } else {
+                bArr2[i2] = 0;
+            }
+        }
+        return bArr2;
+    }
+
+    StorageSecureStore(Context context) {
+        this.mContext = context;
+        reloadCache();
+    }
+
+    StorageSecureStore() {
+        reloadCache();
+    }
+
+    /* access modifiers changed from: package-private */
+    public void reloadCache() {
+        KeyValueDatabase keyValueDatabase = new KeyValueDatabase(this.mContext);
+        this.mKeyValueMap = keyValueDatabase.select();
+        keyValueDatabase.close();
+    }
+
+    public static void invalidateCache() {
+        mInstance = null;
+    }
+
+    class KeyValueDatabase {
+        String mSecretText;
+        SQLiteDatabase mSqlDB = null;
+        DatabaseHelper mSqlHelper = null;
+
+        KeyValueDatabase(Context context) {
+            this.mSqlHelper = new DatabaseHelper(context, "storage.data", (SQLiteDatabase.CursorFactory) null, 1);
+            this.mSqlDB = this.mSqlHelper.getWritableDatabase();
+            this.mSecretText = getClass().getName();
+        }
+
+        /* access modifiers changed from: package-private */
+        /* JADX WARNING: Exception block dominator not found, dom blocks: [] */
+        /* Code decompiled incorrectly, please refer to instructions dump. */
+        public synchronized boolean insert(java.lang.String r5, java.lang.String r6) {
+            /*
+                r4 = this;
+                monitor-enter(r4)
+                r0 = -1
+                com.epson.iprint.storage.StorageSecureStore r2 = com.epson.iprint.storage.StorageSecureStore.this     // Catch:{ Exception -> 0x0031, all -> 0x002c }
+                byte[] r6 = r6.getBytes()     // Catch:{ Exception -> 0x0031, all -> 0x002c }
+                java.lang.String r3 = r4.mSecretText     // Catch:{ Exception -> 0x0031, all -> 0x002c }
+                byte[] r6 = r2.encodeAes(r6, r3)     // Catch:{ Exception -> 0x0031, all -> 0x002c }
+                if (r6 == 0) goto L_0x0031
+                android.content.ContentValues r2 = new android.content.ContentValues     // Catch:{ Exception -> 0x0031, all -> 0x002c }
+                r2.<init>()     // Catch:{ Exception -> 0x0031, all -> 0x002c }
+                java.lang.String r3 = "key"
+                r2.put(r3, r5)     // Catch:{ Exception -> 0x0031, all -> 0x002c }
+                java.lang.String r5 = "value"
+                r2.put(r5, r6)     // Catch:{ Exception -> 0x0031, all -> 0x002c }
+                android.database.sqlite.SQLiteDatabase r5 = r4.mSqlDB     // Catch:{ Exception -> 0x0031, all -> 0x002c }
+                java.lang.String r6 = "keyvalue_tbl"
+                java.lang.String r3 = ""
+                long r5 = r5.insert(r6, r3, r2)     // Catch:{ Exception -> 0x0031, all -> 0x002c }
+                r0 = r5
+                goto L_0x0031
+            L_0x002c:
+                r5 = move-exception
+                throw r5     // Catch:{ all -> 0x002e }
+            L_0x002e:
+                r5 = move-exception
+                monitor-exit(r4)
+                throw r5
+            L_0x0031:
+                r5 = 0
+                int r2 = (r0 > r5 ? 1 : (r0 == r5 ? 0 : -1))
+                if (r2 < 0) goto L_0x0039
+                r5 = 1
+                goto L_0x003a
+            L_0x0039:
+                r5 = 0
+            L_0x003a:
+                monitor-exit(r4)
+                return r5
+            */
+            throw new UnsupportedOperationException("Method not decompiled: com.epson.iprint.storage.StorageSecureStore.KeyValueDatabase.insert(java.lang.String, java.lang.String):boolean");
+        }
+
+        /* access modifiers changed from: package-private */
+        /* JADX WARNING: Exception block dominator not found, dom blocks: [] */
+        /* Code decompiled incorrectly, please refer to instructions dump. */
+        public synchronized boolean delete(java.lang.String r7) {
+            /*
+                r6 = this;
+                monitor-enter(r6)
+                r0 = 0
+                android.database.sqlite.SQLiteDatabase r1 = r6.mSqlDB     // Catch:{ Exception -> 0x0018, all -> 0x0015 }
+                java.lang.String r2 = "keyvalue_tbl"
+                java.lang.String r3 = "key=?"
+                r4 = 1
+                java.lang.String[] r5 = new java.lang.String[r4]     // Catch:{ Exception -> 0x0018, all -> 0x0015 }
+                r5[r0] = r7     // Catch:{ Exception -> 0x0018, all -> 0x0015 }
+                int r7 = r1.delete(r2, r3, r5)     // Catch:{ Exception -> 0x0018, all -> 0x0015 }
+                if (r7 <= 0) goto L_0x0018
+                r0 = 1
+                goto L_0x0018
+            L_0x0015:
+                r7 = move-exception
+                monitor-exit(r6)
+                throw r7
+            L_0x0018:
+                monitor-exit(r6)
+                return r0
+            */
+            throw new UnsupportedOperationException("Method not decompiled: com.epson.iprint.storage.StorageSecureStore.KeyValueDatabase.delete(java.lang.String):boolean");
+        }
+
+        /* JADX WARNING: type inference failed for: r1v0, types: [java.lang.String[], android.database.Cursor] */
+        /* access modifiers changed from: package-private */
+        public synchronized Map<String, String> select() {
+            HashMap hashMap;
+            hashMap = new HashMap();
+            Cursor cursor = 0;
+            try {
+                cursor = this.mSqlDB.rawQuery("SELECT * FROM keyvalue_tbl;", cursor);
+                for (int i = 0; i < cursor.getCount(); i++) {
+                    cursor.moveToPosition(i);
+                    String string = cursor.getString(0);
+                    byte[] decodeAes = StorageSecureStore.this.decodeAes(cursor.getBlob(1), this.mSecretText);
+                    if (decodeAes != null) {
+                        hashMap.put(string, new String(decodeAes));
+                    }
+                }
+            } finally {
+                if (cursor != 0) {
+                    cursor.close();
+                }
+            }
+            return hashMap;
+        }
+
+        /* access modifiers changed from: package-private */
+        /* JADX WARNING: Exception block dominator not found, dom blocks: [] */
+        /* Code decompiled incorrectly, please refer to instructions dump. */
+        public synchronized void close() {
+            /*
+                r1 = this;
+                monitor-enter(r1)
+                android.database.sqlite.SQLiteDatabase r0 = r1.mSqlDB     // Catch:{ Exception -> 0x000f, all -> 0x000c }
+                r0.close()     // Catch:{ Exception -> 0x000f, all -> 0x000c }
+                com.epson.iprint.storage.StorageSecureStore$KeyValueDatabase$DatabaseHelper r0 = r1.mSqlHelper     // Catch:{ Exception -> 0x000f, all -> 0x000c }
+                r0.close()     // Catch:{ Exception -> 0x000f, all -> 0x000c }
+                goto L_0x000f
+            L_0x000c:
+                r0 = move-exception
+                monitor-exit(r1)
+                throw r0
+            L_0x000f:
+                monitor-exit(r1)
+                return
+            */
+            throw new UnsupportedOperationException("Method not decompiled: com.epson.iprint.storage.StorageSecureStore.KeyValueDatabase.close():void");
+        }
+
+        class DatabaseHelper extends SQLiteOpenHelper {
+            DatabaseHelper(Context context, String str, SQLiteDatabase.CursorFactory cursorFactory, int i) {
+                super(context, str, cursorFactory, i);
+            }
+
+            public void onCreate(SQLiteDatabase sQLiteDatabase) {
+                try {
+                    sQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS keyvalue_tbl (key TEXT PRIMARY KEY, value BLOB);");
+                } catch (Exception unused) {
+                }
+            }
+
+            public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
+                try {
+                    sQLiteDatabase.execSQL("DROP TABLE IF EXISTS keyvalue_tbl;");
+                } catch (Exception unused) {
+                }
+                onCreate(sQLiteDatabase);
+            }
+        }
+    }
+}

+ 168 - 0
app/src/main/java/com/epson/iprint/storage/StorageServiceClient.java

@@ -0,0 +1,168 @@
+package com.epson.iprint.storage;
+
+import android.app.Activity;
+import android.content.Context;
+import android.support.annotation.Nullable;
+import android.widget.ImageView;
+import com.epson.iprint.storage.box.BoxNetClient;
+import com.epson.iprint.storage.dropbox.DropboxV2Client;
+import com.epson.iprint.storage.evernote.EvernoteClient;
+import com.epson.iprint.storage.gdrivev3.GoogleV3UploadClient;
+import com.epson.iprint.storage.onedrive.OneDriveClient;
+import epson.common.Utils;
+import epson.print.CommonDefine;
+import epson.print.fileBrower;
+import java.util.List;
+import org.apache.commons.lang.CharEncoding;
+
+public abstract class StorageServiceClient {
+    public static final String EPSON_IPRINT_FOLDER = "Epson iPrint";
+    public static String STORAGE_BOX = "box";
+    public static final String STORAGE_DROPBOX = "dropbox";
+    public static String STORAGE_EVERNOTE = "evernote";
+    public static String STORAGE_GOOGLEDRIVE = "googledrive";
+    public static String STORAGE_ONEDRIVE = "onedrive";
+
+    public interface DownloadCompletion {
+        void onDownloadComplete(StorageItem storageItem, String str, ProcessError processError);
+    }
+
+    public interface EnumerateCompletion {
+        void onEnumerateComplete(List<StorageItem> list, ProcessError processError);
+    }
+
+    public enum ProcessError {
+        NONE,
+        CANCELED,
+        RETRY,
+        ERROR
+    }
+
+    public interface SigninCompletion {
+        void onSigninCompletion();
+    }
+
+    public interface UploadCompletion {
+        void onUploadComplete(String str, String str2, ProcessError processError);
+    }
+
+    public enum UploadFileType {
+        PDF,
+        JPEG
+    }
+
+    public abstract Downloader getDownloader(Context context, StorageItem storageItem, String str);
+
+    public abstract Enumerator getEnumerator(Context context);
+
+    public abstract String getStorageServiceName(Context context);
+
+    public abstract Uploader getUploader(Context context, UploadFileType uploadFileType, String str, String str2);
+
+    /* access modifiers changed from: protected */
+    public boolean isNeedSignin() {
+        return false;
+    }
+
+    public abstract boolean isSignedIn(Context context);
+
+    public abstract boolean isSupportedUploadType(UploadFileType uploadFileType);
+
+    public abstract boolean revokeSignedInData(Activity activity);
+
+    public static StorageServiceClient getClient(String str) {
+        if (str.equals(STORAGE_GOOGLEDRIVE)) {
+            return new GoogleV3UploadClient();
+        }
+        if (str.equals(STORAGE_DROPBOX)) {
+            return new DropboxV2Client();
+        }
+        if (str.equals(STORAGE_BOX)) {
+            return BoxNetClient.getInstance();
+        }
+        if (str.equals(STORAGE_EVERNOTE)) {
+            return new EvernoteClient();
+        }
+        if (str.equals(STORAGE_ONEDRIVE)) {
+            return new OneDriveClient();
+        }
+        return null;
+    }
+
+    public abstract class Uploader {
+        public void cancel() {
+        }
+
+        public abstract boolean isCancelable();
+
+        public abstract void start(UploadCompletion uploadCompletion);
+
+        public Uploader() {
+        }
+    }
+
+    public abstract class Downloader {
+        public void cancel() {
+        }
+
+        public abstract boolean isCancelable();
+
+        public abstract void start(DownloadCompletion downloadCompletion);
+
+        public Downloader() {
+        }
+    }
+
+    public abstract class Enumerator {
+        public void cleanUpResources() {
+        }
+
+        public abstract void enumerate(StorageItem storageItem, EnumerateCompletion enumerateCompletion);
+
+        public void enumerate(StorageItem storageItem, EnumerateCompletion enumerateCompletion, SigninCompletion signinCompletion) {
+        }
+
+        public abstract StorageItem getRootItem();
+
+        public void setThumbnailInBackground(StorageItem storageItem, ImageView imageView) {
+        }
+
+        public Enumerator() {
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public boolean isValidUploadName(String str) {
+        try {
+            byte[] bytes = str.getBytes(CharEncoding.UTF_8);
+            if (bytes != null) {
+                if (bytes.length <= 64) {
+                    if (!fileBrower.isAvailableFileName(str)) {
+                        return false;
+                    }
+                    return true;
+                }
+            }
+            return false;
+        } catch (Exception unused) {
+            return false;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public boolean isPrintableFileTypes(StorageItem storageItem) {
+        return isPrintableFilename(storageItem.name);
+    }
+
+    public static boolean isPrintableFilename(@Nullable String str) {
+        if (str == null) {
+            return false;
+        }
+        return Utils.isPhotoFile(str) || StorageItem.endsWith(str, CommonDefine.FileType_PDF) || Utils.isGConvertFile(str);
+    }
+
+    /* access modifiers changed from: protected */
+    public String getDownloadLocalPath(Context context, StorageItem storageItem) {
+        return storageItem.getDownloadLocalPath(context);
+    }
+}

+ 151 - 0
app/src/main/java/com/epson/iprint/storage/StorageSignInActivity.java

@@ -0,0 +1,151 @@
+package com.epson.iprint.storage;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.widget.EditText;
+import com.epson.iprint.storage.StorageActivity;
+import com.epson.iprint.storage.box.BoxNetSignInActivity;
+import com.epson.iprint.storage.dropbox.DropboxV2SignInActivity;
+import com.epson.iprint.storage.evernote.EvernoteSignInActivity;
+import com.epson.iprint.storage.gdrivev3.GoogleV3UploadSignInActivity;
+import com.epson.iprint.storage.onedrive.OneDriveSignInActivity;
+import epson.print.R;
+
+public abstract class StorageSignInActivity extends StorageActivity {
+    private static final String EXTRA_SERVER_NAME = "StorageSignInActivity.ServerName";
+    private final int DEFAULT_INPUT_MAX_LENGTH = 256;
+    /* access modifiers changed from: private */
+    public BasicSignIn mBasicSignIn;
+    private StorageActivity.OverlayProgress mProgressUntilOnDestroy;
+
+    public interface BasicSignIn {
+        boolean signInBackground(String str, String str2);
+    }
+
+    private int getMaxLengthUsername() {
+        return 256;
+    }
+
+    public abstract BasicSignIn getBasicSignIn();
+
+    /* access modifiers changed from: protected */
+    public int getMaxLengthPassword() {
+        return 256;
+    }
+
+    public /* bridge */ /* synthetic */ boolean isConnected() {
+        return super.isConnected();
+    }
+
+    private static Class<?> getActivityClass(String str) {
+        if (str.equals(StorageServiceClient.STORAGE_GOOGLEDRIVE)) {
+            return GoogleV3UploadSignInActivity.class;
+        }
+        if (str.equals(StorageServiceClient.STORAGE_DROPBOX)) {
+            return DropboxV2SignInActivity.class;
+        }
+        if (str.equals(StorageServiceClient.STORAGE_BOX)) {
+            return BoxNetSignInActivity.class;
+        }
+        if (str.equals(StorageServiceClient.STORAGE_EVERNOTE)) {
+            return EvernoteSignInActivity.class;
+        }
+        if (str.equals(StorageServiceClient.STORAGE_ONEDRIVE)) {
+            return OneDriveSignInActivity.class;
+        }
+        return null;
+    }
+
+    public static Intent getStartIntent(Context context, String str, String str2) {
+        Intent intent = new Intent(context, getActivityClass(str));
+        intent.putExtra(EXTRA_SERVER_NAME, str2);
+        return intent;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        BasicSignIn basicSignIn = getBasicSignIn();
+        if (basicSignIn != null) {
+            onInitBasicSignIn(basicSignIn);
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onDestroy() {
+        StorageActivity.OverlayProgress overlayProgress = this.mProgressUntilOnDestroy;
+        if (overlayProgress != null) {
+            overlayProgress.dismiss();
+            this.mProgressUntilOnDestroy = null;
+        }
+        super.onDestroy();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onInitBasicSignIn(BasicSignIn basicSignIn) {
+        this.mBasicSignIn = basicSignIn;
+        setContentView((int) R.layout.login_screen_layout);
+        setActionBar(getIntent().getStringExtra(EXTRA_SERVER_NAME), true);
+        setInputMaxLength((EditText) findViewById(R.id.login_username_content), getMaxLengthUsername());
+        setInputMaxLength((EditText) findViewById(R.id.login_password_content), getMaxLengthPassword());
+        bindClearButton(R.id.login_username_content, R.id.clear_id_btn);
+        bindClearButton(R.id.login_password_content, R.id.clear_password_btn);
+    }
+
+    /* access modifiers changed from: protected */
+    public void showLoginError() {
+        showErrorDialog((int) R.string.authenticate_error_mes);
+    }
+
+    /* access modifiers changed from: protected */
+    public void showLoginErrorAndFinish() {
+        showErrorDialogAndFinish(getString(R.string.authenticate_error_mes));
+    }
+
+    class BasicSignInTask extends AsyncTask<Void, Void, Boolean> {
+        private String mPassword;
+        private String mUserName;
+        StorageActivity.OverlayProgress progress;
+
+        BasicSignInTask() {
+            this.mUserName = ((EditText) StorageSignInActivity.this.findViewById(R.id.login_username_content)).getText().toString();
+            this.mPassword = ((EditText) StorageSignInActivity.this.findViewById(R.id.login_password_content)).getText().toString();
+        }
+
+        /* access modifiers changed from: protected */
+        public Boolean doInBackground(Void... voidArr) {
+            this.progress = new StorageActivity.OverlayProgress();
+            this.progress.show();
+            return Boolean.valueOf(StorageSignInActivity.this.mBasicSignIn.signInBackground(this.mUserName, this.mPassword));
+        }
+
+        /* access modifiers changed from: protected */
+        public void onPostExecute(Boolean bool) {
+            if (!bool.booleanValue()) {
+                StorageSignInActivity.this.showLoginError();
+                this.progress.dismiss();
+                return;
+            }
+            this.progress.dismiss();
+            StorageSignInActivity.this.finish();
+        }
+    }
+
+    public boolean onOptionsItemSelected(MenuItem menuItem) {
+        if (menuItem.getItemId() != R.id.menu_signin) {
+            return super.onOptionsItemSelected(menuItem);
+        }
+        new BasicSignInTask().execute(new Void[0]);
+        return true;
+    }
+
+    public boolean onCreateOptionsMenu(Menu menu) {
+        getMenuInflater().inflate(R.C2138menu.menu_sign_inout, menu);
+        menu.removeItem(R.id.menu_signout);
+        return super.onCreateOptionsMenu(menu);
+    }
+}

+ 137 - 0
app/src/main/java/com/epson/iprint/storage/StorageWaitingActivity.java

@@ -0,0 +1,137 @@
+package com.epson.iprint.storage;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+import epson.print.R;
+
+public class StorageWaitingActivity extends Activity {
+    static String CANCEL_REQUEST_ACTION = "StorageProgressActivity.CancelRequestAction";
+    static String CHANGE_ACTION = "StorageProgressActivity.ChangeAction";
+    static String DISMISS_ACTION = "StorageProgressActivity.DismissAction";
+    static String EXTRA_CANCEL_ENABLED = "StorageProgressActivity.ExtraCancelEnabled";
+    static String EXTRA_MESSAGE = "StorageProgressActivity.ExtraMessage";
+    static String EXTRA_REQUEST_CODE = "StorageProgressActivity.ExtraRequestCode";
+    static String REGISTER_ACTION = "StorageProgressActivity.RegisterAction";
+    public static boolean bShowing = false;
+    BroadcastReceiver mBroadcastReceiver;
+    Button mCancelButton;
+    TextView mMessageText;
+    int mRequestCode;
+
+    public void onBackPressed() {
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        setContentView(R.layout.storage_progress);
+        Intent intent = getIntent();
+        registerBroadcastReceiver(intent);
+        setMessage(intent);
+        setCancelRequest(intent);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onDestroy() {
+        unregisterReceiver(this.mBroadcastReceiver);
+        super.onDestroy();
+    }
+
+    /* access modifiers changed from: package-private */
+    public void registerBroadcastReceiver(Intent intent) {
+        this.mRequestCode = intent.getIntExtra(EXTRA_REQUEST_CODE, 0);
+        this.mBroadcastReceiver = new BroadcastReceiver() {
+            public void onReceive(Context context, Intent intent) {
+                String action = intent.getAction();
+                if (StorageWaitingActivity.this.mRequestCode == intent.getIntExtra(StorageWaitingActivity.EXTRA_REQUEST_CODE, 0)) {
+                    if (action.equals(StorageWaitingActivity.DISMISS_ACTION)) {
+                        StorageWaitingActivity.this.finish();
+                    } else if (action.equals(StorageWaitingActivity.CHANGE_ACTION)) {
+                        StorageWaitingActivity.this.setMessage(intent);
+                    } else if (action.equals(StorageWaitingActivity.REGISTER_ACTION)) {
+                        StorageWaitingActivity.this.setCancelRequest(intent);
+                    }
+                }
+            }
+        };
+        IntentFilter intentFilter = new IntentFilter();
+        intentFilter.addAction(DISMISS_ACTION);
+        intentFilter.addAction(CHANGE_ACTION);
+        intentFilter.addAction(REGISTER_ACTION);
+        registerReceiver(this.mBroadcastReceiver, intentFilter);
+    }
+
+    /* access modifiers changed from: package-private */
+    public Dialog createCancelDialog() {
+        AlertDialog.Builder builder = new AlertDialog.Builder(this);
+        builder.setMessage(getString(R.string.str_msg_scan_cancel));
+        builder.setCancelable(false);
+        builder.setPositiveButton(getString(R.string.str_yes), new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialogInterface, int i) {
+                StorageWaitingActivity.this.mCancelButton.setEnabled(false);
+                StorageWaitingActivity.this.mMessageText.setText(StorageWaitingActivity.this.getString(R.string.EPS_PRNST_CANCELLING_MSG));
+                Intent intent = new Intent(StorageWaitingActivity.CANCEL_REQUEST_ACTION);
+                intent.putExtra(StorageWaitingActivity.EXTRA_REQUEST_CODE, StorageWaitingActivity.this.mRequestCode);
+                StorageWaitingActivity.this.sendBroadcast(intent);
+                dialogInterface.cancel();
+            }
+        });
+        builder.setNegativeButton(getString(R.string.str_no), new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialogInterface, int i) {
+                StorageWaitingActivity.this.mCancelButton.setEnabled(true);
+                dialogInterface.cancel();
+            }
+        });
+        return builder.create();
+    }
+
+    /* access modifiers changed from: package-private */
+    public void setCancelRequest(Intent intent) {
+        this.mCancelButton = (Button) findViewById(R.id.cancelButton);
+        this.mCancelButton.setText(getString(R.string.str_cancel));
+        if (intent.getBooleanExtra(EXTRA_CANCEL_ENABLED, false)) {
+            this.mCancelButton.setOnClickListener(new View.OnClickListener() {
+                public void onClick(View view) {
+                    StorageWaitingActivity.this.createCancelDialog().show();
+                }
+            });
+            this.mCancelButton.setVisibility(0);
+            return;
+        }
+        this.mCancelButton.setVisibility(8);
+    }
+
+    /* access modifiers changed from: package-private */
+    public void setMessage(Intent intent) {
+        this.mMessageText = (TextView) findViewById(R.id.messageText);
+        String stringExtra = intent.getStringExtra(EXTRA_MESSAGE);
+        if (stringExtra != null) {
+            this.mMessageText.setText(stringExtra);
+            this.mMessageText.setVisibility(0);
+            return;
+        }
+        this.mMessageText.setVisibility(8);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onResume() {
+        super.onResume();
+        bShowing = true;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPause() {
+        super.onPause();
+        bShowing = false;
+    }
+}

+ 74 - 0
app/src/main/java/com/epson/iprint/storage/box/BoxAuthStorage.java

@@ -0,0 +1,74 @@
+package com.epson.iprint.storage.box;
+
+import android.content.Context;
+import com.box.androidsdk.content.auth.BoxAuthentication;
+import com.box.androidsdk.content.models.BoxEntity;
+import com.eclipsesource.json.JsonObject;
+import com.eclipsesource.json.JsonValue;
+import com.epson.iprint.storage.StorageSecureStore;
+import epson.server.utils.Define;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class BoxAuthStorage extends BoxAuthentication.AuthStorage {
+    private static final String SECURE_STORE_KEY = "FolderViewer.BOXNET_AUTO_INFO_V4";
+
+    /* access modifiers changed from: protected */
+    public void storeAuthInfoMap(Map<String, BoxAuthentication.BoxAuthenticationInfo> map, Context context) {
+        JsonObject jsonObject = new JsonObject();
+        for (Map.Entry next : map.entrySet()) {
+            jsonObject.add((String) next.getKey(), (JsonValue) ((BoxAuthentication.BoxAuthenticationInfo) next.getValue()).toJsonObject());
+        }
+        StorageSecureStore.getSharedSecureStore().put("FolderViewer.BOXNET_AUTO_INFO_V4", new BoxEntity(jsonObject).toJson(), StorageSecureStore.EXEC_MODE.OVERWRITE_IF_EXIST);
+    }
+
+    /* access modifiers changed from: protected */
+    public void clearAuthInfoMap(Context context) {
+        StorageSecureStore.getSharedSecureStore().revoke("FolderViewer.BOXNET_AUTO_INFO_V4");
+    }
+
+    /* access modifiers changed from: protected */
+    public void storeLastAuthenticatedUserId(String str, Context context) {
+        StorageSecureStore sharedSecureStore = StorageSecureStore.getSharedSecureStore();
+        if (str == null || str.isEmpty()) {
+            sharedSecureStore.revoke(Define.BOXNET_LAST_AUTHENTICATED_USER_ID);
+        } else {
+            sharedSecureStore.put(Define.BOXNET_LAST_AUTHENTICATED_USER_ID, str, StorageSecureStore.EXEC_MODE.OVERWRITE_IF_EXIST);
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public String getLastAuthentictedUserId(Context context) {
+        return StorageSecureStore.getSharedSecureStore().fetch(Define.BOXNET_LAST_AUTHENTICATED_USER_ID);
+    }
+
+    /* access modifiers changed from: protected */
+    public ConcurrentHashMap<String, BoxAuthentication.BoxAuthenticationInfo> loadAuthInfoMap(Context context) {
+        ConcurrentHashMap<String, BoxAuthentication.BoxAuthenticationInfo> concurrentHashMap = new ConcurrentHashMap<>();
+        String fetch = StorageSecureStore.getSharedSecureStore().fetch("FolderViewer.BOXNET_AUTO_INFO_V4");
+        if (fetch != null && fetch.length() > 0) {
+            BoxEntity boxEntity = new BoxEntity();
+            boxEntity.createFromJson(fetch);
+            for (String next : boxEntity.getPropertiesKeySet()) {
+                JsonValue propertyValue = boxEntity.getPropertyValue(next);
+                BoxAuthentication.BoxAuthenticationInfo boxAuthenticationInfo = null;
+                if (propertyValue.isString()) {
+                    boxAuthenticationInfo = new BoxAuthentication.BoxAuthenticationInfo();
+                    boxAuthenticationInfo.createFromJson(propertyValue.asString());
+                } else if (propertyValue.isObject()) {
+                    boxAuthenticationInfo = new BoxAuthentication.BoxAuthenticationInfo();
+                    boxAuthenticationInfo.createFromJson(propertyValue.asObject());
+                }
+                concurrentHashMap.put(next, boxAuthenticationInfo);
+            }
+        }
+        return concurrentHashMap;
+    }
+
+    public static void deleteOldData() {
+        StorageSecureStore sharedSecureStore = StorageSecureStore.getSharedSecureStore();
+        sharedSecureStore.revoke(Define.BOXNET_TOKEN);
+        sharedSecureStore.revoke(Define.BOXNET_USERNAME);
+        sharedSecureStore.revoke(Define.BOXNET_PASSOWRD);
+    }
+}

+ 488 - 0
app/src/main/java/com/epson/iprint/storage/box/BoxNetClient.java

@@ -0,0 +1,488 @@
+package com.epson.iprint.storage.box;
+
+import android.app.Activity;
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import com.box.androidsdk.content.BoxApiFile;
+import com.box.androidsdk.content.BoxApiFolder;
+import com.box.androidsdk.content.BoxApiSearch;
+import com.box.androidsdk.content.BoxConfig;
+import com.box.androidsdk.content.BoxConstants;
+import com.box.androidsdk.content.BoxException;
+import com.box.androidsdk.content.auth.BoxAuthentication;
+import com.box.androidsdk.content.models.BoxEntity;
+import com.box.androidsdk.content.models.BoxError;
+import com.box.androidsdk.content.models.BoxFile;
+import com.box.androidsdk.content.models.BoxFolder;
+import com.box.androidsdk.content.models.BoxItem;
+import com.box.androidsdk.content.models.BoxIteratorItems;
+import com.box.androidsdk.content.models.BoxSession;
+import com.epson.iprint.storage.SecureKeyStore;
+import com.epson.iprint.storage.StorageItem;
+import com.epson.iprint.storage.StorageServiceClient;
+import epson.print.R;
+import epson.print.IprintApplication;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+
+public class BoxNetClient extends StorageServiceClient {
+    private static BoxNetClient sBoxClient;
+    private BoxApiFile mBoxApiFile;
+    private BoxApiFolder mBoxApiFolder;
+    private BoxSession mBoxSession;
+
+    public boolean isSupportedUploadType(StorageServiceClient.UploadFileType uploadFileType) {
+        return false;
+    }
+
+    public static synchronized BoxNetClient getInstance() {
+        BoxNetClient boxNetClient;
+        synchronized (BoxNetClient.class) {
+            if (sBoxClient == null) {
+                sBoxClient = new BoxNetClient();
+            }
+            boxNetClient = sBoxClient;
+        }
+        return boxNetClient;
+    }
+
+    private BoxNetClient() {
+        BoxAuthStorage boxAuthStorage = new BoxAuthStorage();
+        BoxAuthStorage.deleteOldData();
+        BoxAuthentication.getInstance().setAuthStorage(boxAuthStorage);
+        configureClient();
+        initSession();
+        if (isSignedIn(IprintApplication.getInstance())) {
+            setLoginStatus(true);
+        }
+    }
+
+    private void configureClient() {
+        SecureKeyStore secureKeyStore = new SecureKeyStore();
+        IprintApplication instance = IprintApplication.getInstance();
+        BoxConfig.CLIENT_ID = secureKeyStore.getApiKeyC(instance);
+        BoxConfig.CLIENT_SECRET = secureKeyStore.getSecKeyC(instance);
+    }
+
+    public StorageServiceClient.Uploader getUploader(Context context, StorageServiceClient.UploadFileType uploadFileType, final String str, final String str2) {
+        return new StorageServiceClient.Uploader() {
+            public boolean isCancelable() {
+                return false;
+            }
+
+            public void start(StorageServiceClient.UploadCompletion uploadCompletion) {
+                new UploadThread(uploadCompletion, str, str2).start();
+            }
+        };
+    }
+
+    public StorageServiceClient.Downloader getDownloader(Context context, final StorageItem storageItem, final String str) {
+        if (storageItem == null || str == null) {
+            return null;
+        }
+        return new StorageServiceClient.Downloader() {
+            private DownloadThread mDownloadThread;
+
+            public boolean isCancelable() {
+                return true;
+            }
+
+            public void start(StorageServiceClient.DownloadCompletion downloadCompletion) {
+                if (downloadCompletion != null) {
+                    synchronized (this) {
+                        this.mDownloadThread = new DownloadThread(downloadCompletion, storageItem, str);
+                    }
+                    this.mDownloadThread.start();
+                }
+            }
+
+            public void cancel() {
+                synchronized (this) {
+                    if (this.mDownloadThread != null) {
+                        this.mDownloadThread.cancel();
+                    }
+                }
+            }
+        };
+    }
+
+    @NonNull
+    public StorageServiceClient.Enumerator getEnumerator(Context context) {
+        return new StorageServiceClient.Enumerator() {
+            @NonNull
+            public StorageItem getRootItem() {
+                return new StorageItem("", BoxConstants.ROOT_FOLDER_ID, StorageItem.ItemType.DIRECTORY);
+            }
+
+            public void enumerate(StorageItem storageItem, StorageServiceClient.EnumerateCompletion enumerateCompletion) {
+                if (storageItem != null && enumerateCompletion != null) {
+                    String str = storageItem.path;
+                    if (str == null) {
+                        str = BoxConstants.ROOT_FOLDER_ID;
+                    }
+                    new ListThread(enumerateCompletion, str).start();
+                }
+            }
+        };
+    }
+
+    public boolean isSignedIn(Context context) {
+        if (context == null || this.mBoxSession == null || BoxAuthentication.getInstance().getLastAuthenticatedUserId(context) == null) {
+            return false;
+        }
+        return true;
+    }
+
+    public boolean revokeSignedInData(@NonNull Activity activity) {
+        activity.startActivity(BoxNetSignInActivity.getLogoutIntent(activity));
+        return true;
+    }
+
+    public String getStorageServiceName(Context context) {
+        return context.getString(R.string.box_net);
+    }
+
+    public void boxLogout() {
+        try {
+            this.mBoxSession.logout().get();
+        } catch (InterruptedException | ExecutionException unused) {
+        }
+    }
+
+    public void initSession() {
+        this.mBoxSession = new BoxSession((Context) IprintApplication.getInstance());
+    }
+
+    public void setSessionAuthListener(@Nullable BoxAuthentication.AuthListener authListener) {
+        this.mBoxSession.setSessionAuthListener(authListener);
+    }
+
+    public void authenticate() {
+        BoxSession boxSession = this.mBoxSession;
+        if (boxSession != null) {
+            boxSession.authenticate(IprintApplication.getInstance());
+            return;
+        }
+        throw new IllegalStateException();
+    }
+
+    public void setLoginStatus(boolean z) {
+        if (z) {
+            BoxSession boxSession = this.mBoxSession;
+            if (boxSession != null) {
+                this.mBoxApiFolder = new BoxApiFolder(boxSession);
+                this.mBoxApiFile = new BoxApiFile(this.mBoxSession);
+                return;
+            }
+            return;
+        }
+        this.mBoxApiFolder = null;
+        this.mBoxApiFile = null;
+    }
+
+    /* JADX WARNING: Code restructure failed: missing block: B:11:?, code lost:
+        r0.close();
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:12:0x001d, code lost:
+        r5 = move-exception;
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:13:0x001e, code lost:
+        r3.addSuppressed(r5);
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:14:0x0022, code lost:
+        r0.close();
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:5:0x0013, code lost:
+        r4 = move-exception;
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:9:0x0017, code lost:
+        if (r3 != null) goto L_0x0019;
+     */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    private void uploadFile(@android.support.annotation.NonNull java.io.File r3, @android.support.annotation.NonNull java.lang.String r4, java.lang.String r5) throws java.io.IOException, com.box.androidsdk.content.BoxException {
+        /*
+            r2 = this;
+            java.io.FileInputStream r0 = new java.io.FileInputStream
+            r0.<init>(r3)
+            r3 = 0
+            com.box.androidsdk.content.BoxApiFile r1 = r2.mBoxApiFile     // Catch:{ Throwable -> 0x0015 }
+            com.box.androidsdk.content.requests.BoxRequestsFile$UploadFile r4 = r1.getUploadRequest(r0, r4, r5)     // Catch:{ Throwable -> 0x0015 }
+            r4.send()     // Catch:{ Throwable -> 0x0015 }
+            r0.close()
+            return
+        L_0x0013:
+            r4 = move-exception
+            goto L_0x0017
+        L_0x0015:
+            r3 = move-exception
+            throw r3     // Catch:{ all -> 0x0013 }
+        L_0x0017:
+            if (r3 == 0) goto L_0x0022
+            r0.close()     // Catch:{ Throwable -> 0x001d }
+            goto L_0x0025
+        L_0x001d:
+            r5 = move-exception
+            r3.addSuppressed(r5)
+            goto L_0x0025
+        L_0x0022:
+            r0.close()
+        L_0x0025:
+            throw r4
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.iprint.storage.box.BoxNetClient.uploadFile(java.io.File, java.lang.String, java.lang.String):void");
+    }
+
+    /* JADX WARNING: Code restructure failed: missing block: B:11:?, code lost:
+        r0.close();
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:12:0x0021, code lost:
+        r0 = move-exception;
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:13:0x0022, code lost:
+        r3.addSuppressed(r0);
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:14:0x0026, code lost:
+        r0.close();
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:5:0x0017, code lost:
+        r4 = move-exception;
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:9:0x001b, code lost:
+        if (r3 != null) goto L_0x001d;
+     */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    private void uploadNewVersion(@android.support.annotation.NonNull java.io.File r3, @android.support.annotation.NonNull com.box.androidsdk.content.models.BoxFile r4) throws java.io.IOException, com.box.androidsdk.content.BoxException {
+        /*
+            r2 = this;
+            java.io.FileInputStream r0 = new java.io.FileInputStream
+            r0.<init>(r3)
+            r3 = 0
+            com.box.androidsdk.content.BoxApiFile r1 = r2.mBoxApiFile     // Catch:{ Throwable -> 0x0019 }
+            java.lang.String r4 = r4.getId()     // Catch:{ Throwable -> 0x0019 }
+            com.box.androidsdk.content.requests.BoxRequestsFile$UploadNewVersion r4 = r1.getUploadNewVersionRequest((java.io.InputStream) r0, (java.lang.String) r4)     // Catch:{ Throwable -> 0x0019 }
+            r4.send()     // Catch:{ Throwable -> 0x0019 }
+            r0.close()
+            return
+        L_0x0017:
+            r4 = move-exception
+            goto L_0x001b
+        L_0x0019:
+            r3 = move-exception
+            throw r3     // Catch:{ all -> 0x0017 }
+        L_0x001b:
+            if (r3 == 0) goto L_0x0026
+            r0.close()     // Catch:{ Throwable -> 0x0021 }
+            goto L_0x0029
+        L_0x0021:
+            r0 = move-exception
+            r3.addSuppressed(r0)
+            goto L_0x0029
+        L_0x0026:
+            r0.close()
+        L_0x0029:
+            throw r4
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.iprint.storage.box.BoxNetClient.uploadNewVersion(java.io.File, com.box.androidsdk.content.models.BoxFile):void");
+    }
+
+    /* access modifiers changed from: private */
+    public void uploadFileToFolder(@NonNull File file, @NonNull String str, @NonNull String str2) throws BoxException, IOException {
+        if (this.mBoxSession != null) {
+            String findOrCreateFolder = findOrCreateFolder(str);
+            if (findOrCreateFolder != null) {
+                uploadOrUpdate(file, str2, findOrCreateFolder);
+                return;
+            }
+            throw new IOException("box folder can not create");
+        }
+        throw new IOException("Box session not initialized");
+    }
+
+    @Nullable
+    private String findOrCreateFolder(@NonNull String str) throws BoxException {
+        String searchRootFolder = searchRootFolder(str);
+        if (searchRootFolder != null) {
+            return searchRootFolder;
+        }
+        BoxFolder createFolder = createFolder(str);
+        if (createFolder == null) {
+            return null;
+        }
+        return createFolder.getId();
+    }
+
+    @Nullable
+    private String searchFolderInRoot(@NonNull String str) throws BoxException {
+        String str2 = "^" + str.replaceFirst(" .$", "");
+        BoxApiSearch boxApiSearch = new BoxApiSearch(this.mBoxSession);
+        int i = 0;
+        while (true) {
+            Iterator it = ((BoxIteratorItems) boxApiSearch.getSearchRequest(str2).setOffset(i).setLimit(3).limitType(BoxFolder.TYPE).limitAncestorFolderIds(new String[]{BoxConstants.ROOT_FOLDER_ID}).send()).iterator();
+            if (!it.hasNext()) {
+                return null;
+            }
+            while (it.hasNext()) {
+                BoxItem boxItem = (BoxItem) it.next();
+                if (str.equals(boxItem.getName())) {
+                    return boxItem.getId();
+                }
+            }
+            i += 3;
+        }
+    }
+
+    @Nullable
+    private String searchRootFolder(@NonNull String str) throws BoxException {
+        Iterator it = ((BoxIteratorItems) this.mBoxApiFolder.getItemsRequest(BoxConstants.ROOT_FOLDER_ID).send()).iterator();
+        while (it.hasNext()) {
+            BoxItem boxItem = (BoxItem) it.next();
+            if (str.equals(boxItem.getName()) && BoxFolder.TYPE.equals(boxItem.getType())) {
+                return boxItem.getId();
+            }
+        }
+        return null;
+    }
+
+    @Nullable
+    private BoxFolder createFolder(@NonNull String str) throws BoxException {
+        return (BoxFolder) this.mBoxApiFolder.getCreateRequest(BoxConstants.ROOT_FOLDER_ID, str).send();
+    }
+
+    private void uploadOrUpdate(@NonNull File file, @NonNull String str, @NonNull String str2) throws IOException, BoxException {
+        try {
+            uploadFile(file, str, str2);
+        } catch (BoxException e) {
+            BoxError asBoxError = e.getAsBoxError();
+            if (asBoxError == null || asBoxError.getStatus().intValue() != 409) {
+                throw e;
+            }
+            ArrayList<BoxEntity> conflicts = asBoxError.getContextInfo().getConflicts();
+            if (conflicts == null || conflicts.size() != 1 || !(conflicts.get(0) instanceof BoxFile)) {
+                throw e;
+            }
+            uploadNewVersion(file, (BoxFile) conflicts.get(0));
+        }
+    }
+
+    /* access modifiers changed from: private */
+    @NonNull
+    public ArrayList<StorageItem> listFolder(@NonNull String str) throws BoxException {
+        if (this.mBoxApiFolder != null) {
+            ArrayList<StorageItem> arrayList = new ArrayList<>();
+            Iterator it = ((BoxIteratorItems) this.mBoxApiFolder.getItemsRequest(str).send()).iterator();
+            while (it.hasNext()) {
+                BoxItem boxItem = (BoxItem) it.next();
+                String name = boxItem.getName();
+                String id = boxItem.getId();
+                if (filterBoxItem(boxItem)) {
+                    arrayList.add(new StorageItem(name, id, boxItem instanceof BoxFolder ? StorageItem.ItemType.DIRECTORY : StorageItem.ItemType.FILE));
+                }
+            }
+            return arrayList;
+        }
+        throw new IllegalStateException();
+    }
+
+    private boolean filterBoxItem(@NonNull BoxItem boxItem) {
+        return (boxItem instanceof BoxFolder) || StorageServiceClient.isPrintableFilename(boxItem.getName());
+    }
+
+    /* access modifiers changed from: private */
+    public void downloadFile(@NonNull String str, @NonNull String str2) throws IOException, BoxException {
+        if (this.mBoxApiFile != null) {
+            File file = new File(str2);
+            file.createNewFile();
+            this.mBoxApiFile.getDownloadRequest(file, str).send();
+            return;
+        }
+        throw new IllegalStateException();
+    }
+
+    private static class ListThread extends Thread {
+        private final String mBaseFolderId;
+        private final BoxNetClient mBoxClient;
+        private final StorageServiceClient.EnumerateCompletion mCompleteListener;
+
+        private ListThread(@NonNull BoxNetClient boxNetClient, @NonNull StorageServiceClient.EnumerateCompletion enumerateCompletion, @NonNull String str) {
+            super("list-box");
+            this.mBoxClient = boxNetClient;
+            this.mCompleteListener = enumerateCompletion;
+            this.mBaseFolderId = str;
+        }
+
+        public void run() {
+            try {
+                this.mCompleteListener.onEnumerateComplete(this.mBoxClient.listFolder(this.mBaseFolderId), StorageServiceClient.ProcessError.NONE);
+            } catch (BoxException unused) {
+                this.mCompleteListener.onEnumerateComplete((List<StorageItem>) null, StorageServiceClient.ProcessError.ERROR);
+            }
+        }
+    }
+
+    private static class DownloadThread extends Thread {
+        private final BoxNetClient mBoxClient;
+        private volatile boolean mCanceled;
+        private final StorageServiceClient.DownloadCompletion mDownloadEndListener;
+        private final String mLocalPath;
+        private final StorageItem mOnlineStorageItem;
+
+        private DownloadThread(@NonNull BoxNetClient boxNetClient, @NonNull StorageServiceClient.DownloadCompletion downloadCompletion, @NonNull StorageItem storageItem, @NonNull String str) {
+            super("download-box");
+            this.mBoxClient = boxNetClient;
+            this.mDownloadEndListener = downloadCompletion;
+            this.mOnlineStorageItem = storageItem;
+            this.mLocalPath = str;
+            this.mCanceled = false;
+        }
+
+        public void run() {
+            try {
+                this.mBoxClient.downloadFile(this.mOnlineStorageItem.path, this.mLocalPath);
+                if (this.mCanceled) {
+                    this.mDownloadEndListener.onDownloadComplete((StorageItem) null, (String) null, StorageServiceClient.ProcessError.CANCELED);
+                } else {
+                    this.mDownloadEndListener.onDownloadComplete(this.mOnlineStorageItem, this.mLocalPath, StorageServiceClient.ProcessError.NONE);
+                }
+            } catch (BoxException | IOException unused) {
+                if (this.mCanceled) {
+                    this.mDownloadEndListener.onDownloadComplete((StorageItem) null, (String) null, StorageServiceClient.ProcessError.CANCELED);
+                } else {
+                    this.mDownloadEndListener.onDownloadComplete((StorageItem) null, (String) null, StorageServiceClient.ProcessError.ERROR);
+                }
+            }
+        }
+
+        public void cancel() {
+            this.mCanceled = true;
+        }
+    }
+
+    private static class UploadThread extends Thread {
+        private final BoxNetClient mBoxClient;
+        private final String mOrigLocalFilePath;
+        private final StorageServiceClient.UploadCompletion mUploadEndListener;
+        private final String mUploadOnlineName;
+
+        private UploadThread(@NonNull BoxNetClient boxNetClient, @NonNull StorageServiceClient.UploadCompletion uploadCompletion, @NonNull String str, @NonNull String str2) {
+            super("upload-box");
+            this.mBoxClient = boxNetClient;
+            this.mUploadEndListener = uploadCompletion;
+            this.mOrigLocalFilePath = str;
+            this.mUploadOnlineName = str2;
+        }
+
+        public void run() {
+            try {
+                this.mBoxClient.uploadFileToFolder(new File(this.mOrigLocalFilePath), "Epson iPrint", this.mUploadOnlineName);
+                this.mUploadEndListener.onUploadComplete(this.mOrigLocalFilePath, this.mUploadOnlineName, StorageServiceClient.ProcessError.NONE);
+            } catch (BoxException | IOException unused) {
+                this.mUploadEndListener.onUploadComplete((String) null, (String) null, StorageServiceClient.ProcessError.ERROR);
+            }
+        }
+    }
+}

+ 101 - 0
app/src/main/java/com/epson/iprint/storage/box/BoxNetSignInActivity.java

@@ -0,0 +1,101 @@
+package com.epson.iprint.storage.box;
+
+import android.app.Activity;
+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 com.box.androidsdk.content.auth.BoxAuthentication;
+import com.epson.iprint.storage.StorageSignInActivity;
+import epson.print.R;
+import java.lang.ref.WeakReference;
+
+public class BoxNetSignInActivity extends StorageSignInActivity implements BoxAuthentication.AuthListener {
+    private static final String PARAM_KEY_LOGOUT = "logout";
+    private BoxNetClient mBoxClient;
+    private boolean mModeLogout;
+
+    public StorageSignInActivity.BasicSignIn getBasicSignIn() {
+        return null;
+    }
+
+    public void onBackPressed() {
+    }
+
+    @NonNull
+    public static Intent getLogoutIntent(@NonNull Context context) {
+        Intent intent = new Intent(context, BoxNetSignInActivity.class);
+        intent.putExtra(PARAM_KEY_LOGOUT, true);
+        return intent;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        this.mModeLogout = getMode(getIntent());
+        if (this.mModeLogout) {
+            setContentView((int) R.layout.storage_progress);
+            findViewById(R.id.messageText).setVisibility(8);
+            findViewById(R.id.cancelButton).setVisibility(8);
+        }
+        this.mBoxClient = BoxNetClient.getInstance();
+        this.mBoxClient.setSessionAuthListener(this);
+        if (this.mModeLogout) {
+            startLogoutTask();
+        } else {
+            this.mBoxClient.authenticate();
+        }
+    }
+
+    private boolean getMode(@Nullable Intent intent) {
+        if (intent == null) {
+            return false;
+        }
+        return intent.getBooleanExtra(PARAM_KEY_LOGOUT, false);
+    }
+
+    private void startLogoutTask() {
+        if (this.mBoxClient == null) {
+            finish();
+        }
+        new LogoutTask(this, this.mBoxClient).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
+    }
+
+    public void onRefreshed(BoxAuthentication.BoxAuthenticationInfo boxAuthenticationInfo) {
+        this.mBoxClient.setLoginStatus(true);
+        finish();
+    }
+
+    public void onAuthCreated(BoxAuthentication.BoxAuthenticationInfo boxAuthenticationInfo) {
+        this.mBoxClient.setLoginStatus(true);
+        finish();
+    }
+
+    public void onAuthFailure(BoxAuthentication.BoxAuthenticationInfo boxAuthenticationInfo, Exception exc) {
+        this.mBoxClient.setLoginStatus(false);
+        showLoginErrorAndFinish();
+    }
+
+    public void onLoggedOut(BoxAuthentication.BoxAuthenticationInfo boxAuthenticationInfo, Exception exc) {
+        this.mBoxClient.setLoginStatus(false);
+        finish();
+    }
+
+    private static class LogoutTask extends AsyncTask<Void, Void, Void> {
+        private final WeakReference<Activity> mActivityReference;
+        private final BoxNetClient mBoxNetClient;
+
+        LogoutTask(Activity activity, @NonNull BoxNetClient boxNetClient) {
+            this.mActivityReference = new WeakReference<>(activity);
+            this.mBoxNetClient = boxNetClient;
+        }
+
+        /* access modifiers changed from: protected */
+        public Void doInBackground(Void... voidArr) {
+            this.mBoxNetClient.boxLogout();
+            return null;
+        }
+    }
+}

+ 28 - 0
app/src/main/java/com/epson/iprint/storage/dropbox/DropboxClientFactory.java

@@ -0,0 +1,28 @@
+package com.epson.iprint.storage.dropbox;
+
+import com.dropbox.core.DbxRequestConfig;
+import com.dropbox.core.http.OkHttp3Requestor;
+import com.dropbox.core.p005v2.DbxClientV2;
+
+public class DropboxClientFactory {
+    private static final String CLIENT_IDENTIFIER = "Epson-iPrint/6.3";
+    private static DbxClientV2 sDbxClient;
+
+    public static void init(String str) {
+        if (sDbxClient == null) {
+            sDbxClient = new DbxClientV2(DbxRequestConfig.newBuilder(CLIENT_IDENTIFIER).withHttpRequestor(new OkHttp3Requestor(OkHttp3Requestor.defaultOkHttpClient())).build(), str);
+        }
+    }
+
+    public static DbxClientV2 getClient() {
+        DbxClientV2 dbxClientV2 = sDbxClient;
+        if (dbxClientV2 == null) {
+            return null;
+        }
+        return dbxClientV2;
+    }
+
+    public static void deleteClient() {
+        sDbxClient = null;
+    }
+}

+ 57 - 0
app/src/main/java/com/epson/iprint/storage/dropbox/DropboxV2Adapter.java

@@ -0,0 +1,57 @@
+package com.epson.iprint.storage.dropbox;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import com.dropbox.core.android.Auth;
+import com.dropbox.core.p005v2.DbxClientV2;
+import com.epson.iprint.storage.SecureKeyStore;
+import com.epson.iprint.storage.StorageSecureStore;
+import epson.server.utils.Define;
+
+public class DropboxV2Adapter {
+    public static void init(@NonNull Context context) {
+        String savedToken = getSavedToken(context);
+        if (savedToken != null) {
+            DropboxClientFactory.init(savedToken);
+        }
+    }
+
+    public static void getTokenAndInitClient(@NonNull Context context) {
+        String oAuth2Token = Auth.getOAuth2Token();
+        if (oAuth2Token != null) {
+            StorageSecureStore.getSharedSecureStore().put(Define.DROPBOX_V2_TOKEN, oAuth2Token, StorageSecureStore.EXEC_MODE.OVERWRITE_IF_EXIST);
+            eraseOldData();
+            DropboxClientFactory.init(oAuth2Token);
+        }
+    }
+
+    private static void eraseOldData() {
+        StorageSecureStore sharedSecureStore = StorageSecureStore.getSharedSecureStore();
+        for (String revoke : new String[]{Define.DROPBOX_ACCESS_KEY, Define.DROPBOX_ACCESS_SECRET, Define.DROPBOX_PASSWORD, Define.DROPBOX_USERNAME}) {
+            sharedSecureStore.revoke(revoke);
+        }
+    }
+
+    public static boolean hasToken(@NonNull Context context) {
+        return getSavedToken(context) != null;
+    }
+
+    private static String getSavedToken(@NonNull Context context) {
+        return StorageSecureStore.getSharedSecureStore().fetch(Define.DROPBOX_V2_TOKEN);
+    }
+
+    public static void startAuthentication(@NonNull Context context) {
+        Auth.startOAuth2Authentication(context, new SecureKeyStore().getApiKeyA(context));
+    }
+
+    @Nullable
+    public static DbxClientV2 getClient() {
+        return DropboxClientFactory.getClient();
+    }
+
+    public static void clearToken(@NonNull Context context) {
+        StorageSecureStore.getSharedSecureStore().revoke(Define.DROPBOX_V2_TOKEN);
+        DropboxClientFactory.deleteClient();
+    }
+}

+ 365 - 0
app/src/main/java/com/epson/iprint/storage/dropbox/DropboxV2Client.java

@@ -0,0 +1,365 @@
+package com.epson.iprint.storage.dropbox;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.AsyncTask;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.widget.ImageView;
+import com.dropbox.core.DbxException;
+import com.dropbox.core.p005v2.DbxClientV2;
+import com.dropbox.core.p005v2.files.FileMetadata;
+import com.dropbox.core.p005v2.files.FolderMetadata;
+import com.dropbox.core.p005v2.files.ListFolderResult;
+import com.dropbox.core.p005v2.files.Metadata;
+import com.epson.iprint.storage.StorageItem;
+import com.epson.iprint.storage.StorageServiceClient;
+import epson.print.R;
+import epson.print.CommonDefine;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.apache.commons.lang.CharEncoding;
+
+public class DropboxV2Client extends StorageServiceClient {
+    public boolean isSupportedUploadType(StorageServiceClient.UploadFileType uploadFileType) {
+        return true;
+    }
+
+    public StorageServiceClient.Downloader getDownloader(Context context, StorageItem storageItem, String str) {
+        return new DropboxDownloader(context, storageItem, str);
+    }
+
+    public StorageServiceClient.Enumerator getEnumerator(Context context) {
+        return new DropboxV2Enumerator();
+    }
+
+    public String getStorageServiceName(Context context) {
+        return context.getString(R.string.drop_box);
+    }
+
+    public StorageServiceClient.Uploader getUploader(Context context, StorageServiceClient.UploadFileType uploadFileType, String str, String str2) {
+        return new V2Uploader(context, uploadFileType, str, str2);
+    }
+
+    public boolean isSignedIn(Context context) {
+        DropboxV2Adapter.init(context);
+        return DropboxV2Adapter.hasToken(context);
+    }
+
+    /* access modifiers changed from: protected */
+    public boolean isValidUploadName(String str) {
+        if (str.startsWith(CommonDefine.DOT)) {
+            return false;
+        }
+        try {
+            if (str.getBytes(CharEncoding.UTF_8).length > 256) {
+                return false;
+            }
+            for (char indexOf : str.toCharArray()) {
+                if ("\\/:,;*?<>|#、\"".indexOf(indexOf) > -1) {
+                    return false;
+                }
+            }
+            return super.isValidUploadName(str);
+        } catch (Exception unused) {
+            return false;
+        }
+    }
+
+    public boolean revokeSignedInData(Activity activity) {
+        DropboxV2Adapter.clearToken(activity.getApplicationContext());
+        return false;
+    }
+
+    private class DropboxV2Enumerator extends StorageServiceClient.Enumerator {
+        public void cleanUpResources() {
+        }
+
+        public void setThumbnailInBackground(StorageItem storageItem, ImageView imageView) {
+        }
+
+        private DropboxV2Enumerator() {
+            super();
+        }
+
+        public void enumerate(StorageItem storageItem, StorageServiceClient.EnumerateCompletion enumerateCompletion) {
+            DbxClientV2 client = DropboxV2Adapter.getClient();
+            if (client == null) {
+                enumerateCompletion.onEnumerateComplete((List<StorageItem>) null, StorageServiceClient.ProcessError.ERROR);
+                return;
+            }
+            ArrayList arrayList = new ArrayList();
+            try {
+                ListFolderResult listFolder = client.files().listFolder(storageItem.path);
+                while (true) {
+                    for (Metadata convertToStorageItem : listFolder.getEntries()) {
+                        StorageItem convertToStorageItem2 = convertToStorageItem(convertToStorageItem);
+                        if (convertToStorageItem2 != null) {
+                            arrayList.add(convertToStorageItem2);
+                        }
+                    }
+                    if (!listFolder.getHasMore()) {
+                        break;
+                    }
+                    try {
+                        listFolder = client.files().listFolderContinue(listFolder.getCursor());
+                    } catch (DbxException unused) {
+                    }
+                }
+                Collections.sort(arrayList, new StorageItem.NameComparator());
+                enumerateCompletion.onEnumerateComplete(arrayList, StorageServiceClient.ProcessError.NONE);
+            } catch (DbxException e) {
+                e.printStackTrace();
+                enumerateCompletion.onEnumerateComplete((List<StorageItem>) null, StorageServiceClient.ProcessError.ERROR);
+            }
+        }
+
+        @Nullable
+        private StorageItem convertToStorageItem(@NonNull Metadata metadata) {
+            StorageItem.ItemType itemType;
+            if (metadata instanceof FileMetadata) {
+                if (!StorageServiceClient.isPrintableFilename(metadata.getName())) {
+                    return null;
+                }
+                itemType = StorageItem.ItemType.FILE;
+            } else if (!(metadata instanceof FolderMetadata)) {
+                return null;
+            } else {
+                itemType = StorageItem.ItemType.DIRECTORY;
+            }
+            return new StorageItem(metadata.getName(), metadata.getPathLower(), itemType, metadata);
+        }
+
+        public StorageItem getRootItem() {
+            return new StorageItem("", "", StorageItem.ItemType.DIRECTORY, (Object) null);
+        }
+    }
+
+    class DropboxDownloader extends StorageServiceClient.Downloader {
+        private StorageItem mStorageItem;
+        private String mWriteFilename;
+
+        public boolean isCancelable() {
+            return false;
+        }
+
+        DropboxDownloader(Context context, StorageItem storageItem, String str) {
+            super();
+            this.mStorageItem = storageItem;
+            this.mWriteFilename = str;
+        }
+
+        public void start(StorageServiceClient.DownloadCompletion downloadCompletion) {
+            new DownloadTask(downloadCompletion).execute(new Object[]{this.mStorageItem, this.mWriteFilename});
+        }
+    }
+
+    static class DownloadTask extends AsyncTask<Object, Void, Void> {
+        private StorageServiceClient.DownloadCompletion mDownloadCompletion;
+
+        DownloadTask(@NonNull StorageServiceClient.DownloadCompletion downloadCompletion) {
+            this.mDownloadCompletion = downloadCompletion;
+        }
+
+        /* access modifiers changed from: protected */
+        public Void doInBackground(Object... objArr) {
+            String str;
+            StorageItem storageItem;
+            try {
+                if (objArr.length < 2 || !(objArr[0] instanceof StorageItem) || !(objArr[1] instanceof String)) {
+                    throw new IllegalArgumentException();
+                }
+                storageItem = objArr[0];
+                try {
+                    if (storageItem.userInfo instanceof FileMetadata) {
+                        FileMetadata fileMetadata = (FileMetadata) storageItem.userInfo;
+                        DbxClientV2 client = DropboxV2Adapter.getClient();
+                        if (client != null) {
+                            str = objArr[1];
+                            try {
+                                client.files().download(fileMetadata.getPathLower(), fileMetadata.getRev()).download(new FileOutputStream(new File(str)));
+                                this.mDownloadCompletion.onDownloadComplete(storageItem, str, StorageServiceClient.ProcessError.NONE);
+                                return null;
+                            } catch (DbxException | IOException unused) {
+                                this.mDownloadCompletion.onDownloadComplete(storageItem, str, StorageServiceClient.ProcessError.ERROR);
+                                return null;
+                            } catch (IllegalArgumentException | IllegalStateException unused2) {
+                                this.mDownloadCompletion.onDownloadComplete(storageItem, str, StorageServiceClient.ProcessError.ERROR);
+                                return null;
+                            }
+                        } else {
+                            throw new IllegalStateException();
+                        }
+                    } else {
+                        throw new IllegalArgumentException();
+                    }
+                } catch (DbxException | IOException unused3) {
+                    str = null;
+                    this.mDownloadCompletion.onDownloadComplete(storageItem, str, StorageServiceClient.ProcessError.ERROR);
+                    return null;
+                } catch (IllegalArgumentException | IllegalStateException unused4) {
+                    str = null;
+                    this.mDownloadCompletion.onDownloadComplete(storageItem, str, StorageServiceClient.ProcessError.ERROR);
+                    return null;
+                }
+            } catch (DbxException | IOException unused5) {
+                str = null;
+                storageItem = null;
+                this.mDownloadCompletion.onDownloadComplete(storageItem, str, StorageServiceClient.ProcessError.ERROR);
+                return null;
+            } catch (IllegalArgumentException | IllegalStateException unused6) {
+                str = null;
+                storageItem = null;
+                this.mDownloadCompletion.onDownloadComplete(storageItem, str, StorageServiceClient.ProcessError.ERROR);
+                return null;
+            }
+        }
+    }
+
+    private class V2Uploader extends StorageServiceClient.Uploader {
+        private String mOrgFilePath;
+        private String mUploadPath;
+
+        public boolean isCancelable() {
+            return false;
+        }
+
+        V2Uploader(Context context, StorageServiceClient.UploadFileType uploadFileType, String str, String str2) {
+            super();
+            this.mOrgFilePath = str;
+            this.mUploadPath = str2;
+        }
+
+        public void start(StorageServiceClient.UploadCompletion uploadCompletion) {
+            AsyncTask.THREAD_POOL_EXECUTOR.execute(new LocalUploader(this.mOrgFilePath, this.mUploadPath, uploadCompletion));
+        }
+    }
+
+    private static class LocalUploader implements Runnable {
+        private StorageServiceClient.UploadCompletion mNotifier;
+        private String mOrgFilePath;
+        private String mUploadFilename;
+
+        LocalUploader(String str, String str2, @NonNull StorageServiceClient.UploadCompletion uploadCompletion) {
+            this.mOrgFilePath = str;
+            this.mUploadFilename = str2;
+            this.mNotifier = uploadCompletion;
+        }
+
+        /* JADX WARNING: Can't wrap try/catch for region: R(5:23|22|25|26|(0)(0)) */
+        /* JADX WARNING: Code restructure failed: missing block: B:24:0x0071, code lost:
+            r0 = th;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:29:?, code lost:
+            r1.close();
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:33:?, code lost:
+            r1.close();
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:38:?, code lost:
+            return;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:39:?, code lost:
+            return;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:40:?, code lost:
+            return;
+         */
+        /* JADX WARNING: Failed to process nested try/catch */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:25:0x0073 */
+        /* JADX WARNING: Removed duplicated region for block: B:28:0x0080 A[SYNTHETIC, Splitter:B:28:0x0080] */
+        /* JADX WARNING: Removed duplicated region for block: B:32:0x0086 A[SYNTHETIC, Splitter:B:32:0x0086] */
+        /* JADX WARNING: Removed duplicated region for block: B:40:? A[RETURN, SYNTHETIC] */
+        /* Code decompiled incorrectly, please refer to instructions dump. */
+        public void run() {
+            /*
+                r5 = this;
+                java.lang.String r0 = r5.mOrgFilePath
+                if (r0 == 0) goto L_0x008a
+                java.lang.String r0 = r5.mUploadFilename
+                if (r0 != 0) goto L_0x000a
+                goto L_0x008a
+            L_0x000a:
+                com.dropbox.core.v2.DbxClientV2 r0 = com.epson.iprint.storage.dropbox.DropboxV2Adapter.getClient()
+                r1 = 0
+                if (r0 != 0) goto L_0x0019
+                com.epson.iprint.storage.StorageServiceClient$UploadCompletion r0 = r5.mNotifier
+                com.epson.iprint.storage.StorageServiceClient$ProcessError r2 = com.epson.iprint.storage.StorageServiceClient.ProcessError.ERROR
+                r0.onUploadComplete(r1, r1, r2)
+                return
+            L_0x0019:
+                java.lang.StringBuilder r2 = new java.lang.StringBuilder
+                r2.<init>()
+                java.lang.String r3 = "/Epson iPrint/"
+                r2.append(r3)
+                java.lang.String r3 = r5.mUploadFilename
+                r2.append(r3)
+                java.lang.String r2 = r2.toString()
+                java.io.FileInputStream r3 = new java.io.FileInputStream     // Catch:{ DbxException | IOException -> 0x0073 }
+                java.lang.String r4 = r5.mOrgFilePath     // Catch:{ DbxException | IOException -> 0x0073 }
+                r3.<init>(r4)     // Catch:{ DbxException | IOException -> 0x0073 }
+                com.dropbox.core.v2.files.DbxUserFilesRequests r0 = r0.files()     // Catch:{ DbxException | IOException -> 0x006f, all -> 0x006c }
+                com.dropbox.core.v2.files.UploadBuilder r0 = r0.uploadBuilder(r2)     // Catch:{ DbxException | IOException -> 0x006f, all -> 0x006c }
+                com.dropbox.core.v2.files.WriteMode r1 = com.dropbox.core.p005v2.files.WriteMode.ADD     // Catch:{ DbxException | IOException -> 0x006f, all -> 0x006c }
+                com.dropbox.core.v2.files.UploadBuilder r0 = r0.withMode(r1)     // Catch:{ DbxException | IOException -> 0x006f, all -> 0x006c }
+                r1 = 1
+                java.lang.Boolean r1 = java.lang.Boolean.valueOf(r1)     // Catch:{ DbxException | IOException -> 0x006f, all -> 0x006c }
+                com.dropbox.core.v2.files.UploadBuilder r0 = r0.withAutorename(r1)     // Catch:{ DbxException | IOException -> 0x006f, all -> 0x006c }
+                java.lang.Object r0 = r0.uploadAndFinish(r3)     // Catch:{ DbxException | IOException -> 0x006f, all -> 0x006c }
+                com.dropbox.core.v2.files.FileMetadata r0 = (com.dropbox.core.p005v2.files.FileMetadata) r0     // Catch:{ DbxException | IOException -> 0x006f, all -> 0x006c }
+                r3.close()     // Catch:{ IOException -> 0x0053 }
+            L_0x0053:
+                if (r0 != 0) goto L_0x0060
+                com.epson.iprint.storage.StorageServiceClient$UploadCompletion r0 = r5.mNotifier
+                java.lang.String r1 = r5.mOrgFilePath
+                java.lang.String r2 = r5.mUploadFilename
+                com.epson.iprint.storage.StorageServiceClient$ProcessError r3 = com.epson.iprint.storage.StorageServiceClient.ProcessError.ERROR
+                r0.onUploadComplete(r1, r2, r3)
+            L_0x0060:
+                com.epson.iprint.storage.StorageServiceClient$UploadCompletion r0 = r5.mNotifier
+                java.lang.String r1 = r5.mOrgFilePath
+                java.lang.String r2 = r5.mUploadFilename
+                com.epson.iprint.storage.StorageServiceClient$ProcessError r3 = com.epson.iprint.storage.StorageServiceClient.ProcessError.NONE
+                r0.onUploadComplete(r1, r2, r3)
+                return
+            L_0x006c:
+                r0 = move-exception
+                r1 = r3
+                goto L_0x0084
+            L_0x006f:
+                r1 = r3
+                goto L_0x0073
+            L_0x0071:
+                r0 = move-exception
+                goto L_0x0084
+            L_0x0073:
+                com.epson.iprint.storage.StorageServiceClient$UploadCompletion r0 = r5.mNotifier     // Catch:{ all -> 0x0071 }
+                java.lang.String r2 = r5.mOrgFilePath     // Catch:{ all -> 0x0071 }
+                java.lang.String r3 = r5.mUploadFilename     // Catch:{ all -> 0x0071 }
+                com.epson.iprint.storage.StorageServiceClient$ProcessError r4 = com.epson.iprint.storage.StorageServiceClient.ProcessError.ERROR     // Catch:{ all -> 0x0071 }
+                r0.onUploadComplete(r2, r3, r4)     // Catch:{ all -> 0x0071 }
+                if (r1 == 0) goto L_0x0083
+                r1.close()     // Catch:{ IOException -> 0x0083 }
+            L_0x0083:
+                return
+            L_0x0084:
+                if (r1 == 0) goto L_0x0089
+                r1.close()     // Catch:{ IOException -> 0x0089 }
+            L_0x0089:
+                throw r0
+            L_0x008a:
+                com.epson.iprint.storage.StorageServiceClient$UploadCompletion r0 = r5.mNotifier
+                java.lang.String r1 = r5.mOrgFilePath
+                java.lang.String r2 = r5.mUploadFilename
+                com.epson.iprint.storage.StorageServiceClient$ProcessError r3 = com.epson.iprint.storage.StorageServiceClient.ProcessError.ERROR
+                r0.onUploadComplete(r1, r2, r3)
+                return
+            */
+            throw new UnsupportedOperationException("Method not decompiled: com.epson.iprint.storage.dropbox.DropboxV2Client.LocalUploader.run():void");
+        }
+    }
+}

+ 67 - 0
app/src/main/java/com/epson/iprint/storage/dropbox/DropboxV2SignInActivity.java

@@ -0,0 +1,67 @@
+package com.epson.iprint.storage.dropbox;
+
+import android.os.AsyncTask;
+import android.os.Bundle;
+import com.dropbox.core.DbxException;
+import com.dropbox.core.p005v2.DbxClientV2;
+import com.epson.iprint.storage.StorageSignInActivity;
+
+public class DropboxV2SignInActivity extends StorageSignInActivity {
+    private static final String LOG_TAG = "DropboxV2SignInActivity";
+    private boolean mAuthActivityStarted;
+
+    public StorageSignInActivity.BasicSignIn getBasicSignIn() {
+        return null;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+    }
+
+    private void startAuthActivity() {
+        DropboxV2Adapter.init(this);
+        DropboxV2Adapter.startAuthentication(this);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onResume() {
+        super.onResume();
+        if (!this.mAuthActivityStarted) {
+            startAuthActivity();
+            this.mAuthActivityStarted = true;
+            return;
+        }
+        new Task().executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, new Void[0]);
+    }
+
+    class Task extends AsyncTask<Void, Void, Boolean> {
+        Task() {
+        }
+
+        /* access modifiers changed from: protected */
+        public void onPostExecute(Boolean bool) {
+            if (bool == null || !bool.booleanValue()) {
+                DropboxV2SignInActivity.this.showLoginErrorAndFinish();
+            } else {
+                DropboxV2SignInActivity.this.finish();
+            }
+        }
+
+        /* access modifiers changed from: protected */
+        public Boolean doInBackground(Void... voidArr) {
+            DropboxV2Adapter.getTokenAndInitClient(DropboxV2SignInActivity.this.getApplicationContext());
+            DbxClientV2 client = DropboxV2Adapter.getClient();
+            if (client == null) {
+                return false;
+            }
+            try {
+                client.users().getCurrentAccount();
+                return true;
+            } catch (DbxException e) {
+                e.printStackTrace();
+                return false;
+            }
+        }
+    }
+}

+ 195 - 0
app/src/main/java/com/epson/iprint/storage/evernote/EvernoteClient.java

@@ -0,0 +1,195 @@
+package com.epson.iprint.storage.evernote;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.AsyncTask;
+import com.epson.iprint.storage.StorageItem;
+import com.epson.iprint.storage.StorageServiceClient;
+import com.epson.iprint.storage.evernote.EvernoteRequest;
+import epson.print.CommonDefine;
+import epson.print.Util.AsyncTaskExecutor;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang.CharEncoding;
+
+public class EvernoteClient extends StorageServiceClient {
+    public String getStorageServiceName(Context context) {
+        return "Evernote";
+    }
+
+    public boolean isSupportedUploadType(StorageServiceClient.UploadFileType uploadFileType) {
+        return true;
+    }
+
+    public boolean isSignedIn(Context context) {
+        return epson.server.service.EvernoteClient.getEvernoteSession(context).isLoggedIn();
+    }
+
+    public boolean revokeSignedInData(Activity activity) {
+        epson.server.service.EvernoteClient.logout(activity);
+        return true;
+    }
+
+    public boolean isValidUploadName(String str) {
+        if (str.startsWith(CommonDefine.DOT)) {
+            return false;
+        }
+        try {
+            if (str.getBytes(CharEncoding.UTF_8).length > 256) {
+                return false;
+            }
+            for (char indexOf : str.toCharArray()) {
+                if ("\\/:,;*?<>|#、\"".indexOf(indexOf) > -1) {
+                    return false;
+                }
+            }
+            return super.isValidUploadName(str);
+        } catch (Exception unused) {
+            return false;
+        }
+    }
+
+    public StorageServiceClient.Uploader getUploader(final Context context, StorageServiceClient.UploadFileType uploadFileType, final String str, final String str2) {
+        return new StorageServiceClient.Uploader() {
+            EvernoteRequest request = new EvernoteRequest(context);
+            StorageServiceClient.UploadCompletion uploaded;
+            EvernoteRequest.UploadHandler uploader = this.request.getUploadHandler();
+
+            public boolean isCancelable() {
+                return false;
+            }
+
+            /* renamed from: com.epson.iprint.storage.evernote.EvernoteClient$1$UploadTask */
+            class UploadTask extends AsyncTaskExecutor<Void, Void, Void> {
+                UploadTask() {
+                }
+
+                /* access modifiers changed from: protected */
+                public Void doInBackground(Void... voidArr) {
+                    StorageServiceClient.ProcessError processError;
+                    StorageServiceClient.ProcessError processError2 = StorageServiceClient.ProcessError.NONE;
+                    do {
+                        try {
+                            StorageItem uploadFolder = C09441.this.request.getUploadFolder();
+                            if (uploadFolder == null) {
+                                uploadFolder = C09441.this.request.newUploadFolder();
+                            }
+                            processError = C09441.this.uploader.upload(uploadFolder, str, str2);
+                        } catch (Exception e) {
+                            processError = C09441.this.request.handleException(e);
+                        }
+                    } while (StorageServiceClient.ProcessError.RETRY.equals(processError));
+                    C09441.this.uploaded.onUploadComplete(str, str2, processError);
+                    return null;
+                }
+            }
+
+            public void start(StorageServiceClient.UploadCompletion uploadCompletion) {
+                this.uploaded = uploadCompletion;
+                new UploadTask().executeOnExecutor(new Void[0]);
+            }
+
+            public void cancel() {
+                this.uploader.cancel();
+            }
+        };
+    }
+
+    public StorageServiceClient.Downloader getDownloader(final Context context, final StorageItem storageItem, final String str) {
+        return new StorageServiceClient.Downloader() {
+            StorageServiceClient.DownloadCompletion downloaded;
+            EvernoteRequest.DownloadHandler downloader = this.request.getDownloadHandler();
+            EvernoteRequest request = new EvernoteRequest(context);
+
+            public boolean isCancelable() {
+                return true;
+            }
+
+            /* renamed from: com.epson.iprint.storage.evernote.EvernoteClient$2$DownloadTask */
+            class DownloadTask extends AsyncTask<Void, Void, Void> {
+                DownloadTask() {
+                }
+
+                /* access modifiers changed from: protected */
+                public Void doInBackground(Void... voidArr) {
+                    StorageServiceClient.ProcessError processError;
+                    StorageServiceClient.ProcessError processError2 = StorageServiceClient.ProcessError.NONE;
+                    do {
+                        try {
+                            processError = C09452.this.downloader.download(storageItem.path, str);
+                        } catch (Exception e) {
+                            processError = C09452.this.request.handleException(e);
+                        }
+                    } while (StorageServiceClient.ProcessError.RETRY.equals(processError));
+                    C09452.this.downloaded.onDownloadComplete(storageItem, str, processError);
+                    return null;
+                }
+            }
+
+            public void start(StorageServiceClient.DownloadCompletion downloadCompletion) {
+                this.downloaded = downloadCompletion;
+                new DownloadTask().execute(new Void[0]);
+            }
+
+            public void cancel() {
+                this.downloader.cancel();
+            }
+        };
+    }
+
+    public StorageServiceClient.Enumerator getEnumerator(final Context context) {
+        return new StorageServiceClient.Enumerator() {
+            StorageServiceClient.EnumerateCompletion enumerated;
+            EvernoteRequest request = new EvernoteRequest(context);
+
+            /* access modifiers changed from: package-private */
+            public List<StorageItem> getPrintableItems(List<StorageItem> list) {
+                ArrayList arrayList = new ArrayList();
+                for (StorageItem next : list) {
+                    if (next.type != StorageItem.ItemType.FILE || EvernoteClient.this.isPrintableFileTypes(next)) {
+                        arrayList.add(next);
+                    }
+                }
+                return arrayList;
+            }
+
+            /* renamed from: com.epson.iprint.storage.evernote.EvernoteClient$3$EnumerateTask */
+            class EnumerateTask extends AsyncTask<StorageItem, Void, Void> {
+                EnumerateTask() {
+                }
+
+                /* access modifiers changed from: protected */
+                public Void doInBackground(StorageItem... storageItemArr) {
+                    StorageServiceClient.ProcessError processError;
+                    StorageServiceClient.ProcessError processError2 = StorageServiceClient.ProcessError.NONE;
+                    StorageItem storageItem = storageItemArr[0];
+                    List<StorageItem> list = null;
+                    do {
+                        try {
+                            processError = StorageServiceClient.ProcessError.NONE;
+                            list = C09463.this.request.getItemList(storageItem);
+                        } catch (Exception e) {
+                            processError = C09463.this.request.handleException(e);
+                        }
+                    } while (StorageServiceClient.ProcessError.RETRY.equals(processError));
+                    if (list != null) {
+                        list = C09463.this.getPrintableItems(list);
+                    } else {
+                        processError = StorageServiceClient.ProcessError.ERROR;
+                    }
+                    C09463.this.enumerated.onEnumerateComplete(list, processError);
+                    return null;
+                }
+            }
+
+            public StorageItem getRootItem() {
+                return this.request.getFeedItem();
+            }
+
+            public void enumerate(StorageItem storageItem, StorageServiceClient.EnumerateCompletion enumerateCompletion) {
+                this.enumerated = enumerateCompletion;
+                new EnumerateTask().execute(new StorageItem[]{storageItem});
+            }
+        };
+    }
+}

+ 278 - 0
app/src/main/java/com/epson/iprint/storage/evernote/EvernoteRequest.java

@@ -0,0 +1,278 @@
+package com.epson.iprint.storage.evernote;
+
+import android.content.Context;
+import com.epson.iprint.storage.StorageItem;
+import com.epson.iprint.storage.StorageServiceClient;
+import com.evernote.client.android.EvernoteSession;
+import com.evernote.edam.error.EDAMNotFoundException;
+import com.evernote.edam.error.EDAMSystemException;
+import com.evernote.edam.error.EDAMUserException;
+import com.evernote.edam.notestore.NoteFilter;
+import com.evernote.edam.notestore.NoteList;
+import com.evernote.edam.type.Data;
+import com.evernote.edam.type.Note;
+import com.evernote.edam.type.NoteSortOrder;
+import com.evernote.edam.type.Notebook;
+import com.evernote.edam.type.Resource;
+import com.evernote.edam.type.ResourceAttributes;
+import com.evernote.thrift.TException;
+import com.google.common.primitives.UnsignedBytes;
+import epson.common.Utils;
+import epson.print.Util.EPLog;
+import epson.server.service.EvernoteClient;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+public class EvernoteRequest {
+    private static final String NOTE_PREFIX = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\"><en-note>";
+    private static final String NOTE_SUFFIX = "</en-note>";
+    private static final String TAG = "EvernoteRequest";
+    private static final String URI_FILE_DEMI = "/";
+    private static final String URI_FILE_FEED = "root";
+    /* access modifiers changed from: private */
+    public Context mContext = null;
+
+    public EvernoteRequest(Context context) {
+        this.mContext = context;
+    }
+
+    public StorageItem getFeedItem() {
+        StorageItem storageItem = new StorageItem();
+        storageItem.path = URI_FILE_FEED;
+        storageItem.type = StorageItem.ItemType.DIRECTORY;
+        return storageItem;
+    }
+
+    public List<StorageItem> getItemList(StorageItem storageItem) throws IOException, TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException {
+        EvernoteSession evernoteSession = EvernoteClient.getEvernoteSession(this.mContext);
+        if (storageItem.type == StorageItem.ItemType.DIRECTORY) {
+            ArrayList arrayList = new ArrayList();
+            if (URI_FILE_FEED.equals(storageItem.path)) {
+                for (Notebook next : evernoteSession.getEvernoteClientFactory().getNoteStoreClient().listNotebooks()) {
+                    StorageItem storageItem2 = new StorageItem();
+                    storageItem2.path = next.getGuid();
+                    storageItem2.name = next.getName();
+                    storageItem2.type = StorageItem.ItemType.DIRECTORY;
+                    storageItem2.userInfo = next;
+                    arrayList.add(storageItem2);
+                }
+            } else {
+                NoteFilter noteFilter = new NoteFilter();
+                noteFilter.setOrder(NoteSortOrder.UPDATED.getValue());
+                noteFilter.setAscending(false);
+                noteFilter.setNotebookGuid(storageItem.path);
+                Map<String, Integer> notebookCounts = evernoteSession.getEvernoteClientFactory().getNoteStoreClient().findNoteCounts(noteFilter, false).getNotebookCounts();
+                if (notebookCounts != null) {
+                    Integer num = notebookCounts.get(storageItem.path);
+                    if (num == null) {
+                        return new ArrayList();
+                    }
+                    NoteList findNotes = evernoteSession.getEvernoteClientFactory().getNoteStoreClient().findNotes(noteFilter, 0, num.intValue());
+                    if (findNotes == null) {
+                        return new ArrayList();
+                    }
+                    for (Note resources : findNotes.getNotes()) {
+                        List<Resource> resources2 = resources.getResources();
+                        if (resources2 != null) {
+                            for (Resource next2 : resources2) {
+                                if (next2.getAttributes().getFileName() != null) {
+                                    StorageItem storageItem3 = new StorageItem();
+                                    storageItem3.path = next2.getGuid();
+                                    storageItem3.name = next2.getAttributes().getFileName();
+                                    storageItem3.type = StorageItem.ItemType.FILE;
+                                    storageItem3.userInfo = next2;
+                                    arrayList.add(storageItem3);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            return arrayList;
+        }
+        throw new IOException("Invalid ItemType");
+    }
+
+    /* access modifiers changed from: package-private */
+    public StorageItem getUploadFolder() throws TException, EDAMUserException, EDAMSystemException {
+        StorageItem storageItem = null;
+        for (Notebook next : EvernoteClient.getEvernoteSession(this.mContext).getEvernoteClientFactory().getNoteStoreClient().listNotebooks()) {
+            if ("Epson iPrint".equals(next.getName())) {
+                storageItem = new StorageItem();
+                storageItem.path = next.getGuid();
+                storageItem.name = next.getName();
+                storageItem.type = StorageItem.ItemType.DIRECTORY;
+                storageItem.userInfo = next;
+            }
+        }
+        return storageItem;
+    }
+
+    /* access modifiers changed from: package-private */
+    public StorageItem newUploadFolder() throws TException, EDAMUserException, EDAMSystemException {
+        EvernoteSession evernoteSession = EvernoteClient.getEvernoteSession(this.mContext);
+        Notebook notebook = new Notebook();
+        notebook.setName("Epson iPrint");
+        Notebook createNotebook = evernoteSession.getEvernoteClientFactory().getNoteStoreClient().createNotebook(notebook);
+        StorageItem storageItem = new StorageItem();
+        storageItem.path = createNotebook.getGuid();
+        storageItem.name = createNotebook.getName();
+        storageItem.type = StorageItem.ItemType.DIRECTORY;
+        storageItem.userInfo = createNotebook;
+        return storageItem;
+    }
+
+    class UploadHandler {
+        private boolean canceled = false;
+
+        UploadHandler() {
+        }
+
+        /* access modifiers changed from: package-private */
+        public StorageServiceClient.ProcessError upload(StorageItem storageItem, String str, String str2) throws FileNotFoundException, NoSuchAlgorithmException, TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException {
+            EvernoteSession evernoteSession = EvernoteClient.getEvernoteSession(EvernoteRequest.this.mContext);
+            File file = new File(str);
+            Resource resource = new Resource();
+            resource.setData(EvernoteRequest.readFileAsData(file.getAbsolutePath()));
+            resource.setMime(Utils.getExtType(Utils.getExtention(file.getAbsolutePath())));
+            ResourceAttributes resourceAttributes = new ResourceAttributes();
+            resourceAttributes.setFileName(str2);
+            resource.setAttributes(resourceAttributes);
+            Note note = new Note();
+            note.setTitle(str2);
+            note.setCreated(System.currentTimeMillis());
+            note.setUpdated(System.currentTimeMillis());
+            note.setActive(true);
+            note.setResourcesIsSet(true);
+            note.setNotebookGuid(((Notebook) storageItem.userInfo).getGuid());
+            Vector vector = new Vector();
+            vector.add(resource);
+            note.setResources(vector);
+            note.setContent("<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\"><en-note><p>Epson iPrint scan data:</p><en-media type=\"" + resource.getMime() + "\" hash=\"" + EvernoteRequest.bytesToHex(resource.getData().getBodyHash()) + "\"/>" + "</en-note>");
+            evernoteSession.getEvernoteClientFactory().getNoteStoreClient().createNote(note);
+            return this.canceled ? StorageServiceClient.ProcessError.CANCELED : StorageServiceClient.ProcessError.NONE;
+        }
+
+        /* access modifiers changed from: package-private */
+        public void cancel() {
+            this.canceled = true;
+            EPLog.m305d(EvernoteRequest.TAG, "Upload Canceled!!");
+        }
+    }
+
+    class DownloadHandler {
+        private boolean canceled = false;
+
+        DownloadHandler() {
+        }
+
+        /* access modifiers changed from: package-private */
+        public StorageServiceClient.ProcessError download(String str, String str2) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException, IOException {
+            Resource resource = EvernoteClient.getEvernoteSession(EvernoteRequest.this.mContext).getEvernoteClientFactory().getNoteStoreClient().getResource(str, true, false, true, false);
+            resource.getAttributes().getFileName();
+            Data data = resource.getData();
+            FileOutputStream fileOutputStream = new FileOutputStream(new File(str2));
+            try {
+                fileOutputStream.write(data.getBody());
+                try {
+                    fileOutputStream.close();
+                } catch (IOException unused) {
+                }
+                return this.canceled ? StorageServiceClient.ProcessError.CANCELED : StorageServiceClient.ProcessError.NONE;
+            } catch (IOException e) {
+                throw e;
+            } catch (Throwable th) {
+                try {
+                    fileOutputStream.close();
+                } catch (IOException unused2) {
+                }
+                throw th;
+            }
+        }
+
+        /* access modifiers changed from: package-private */
+        public void cancel() {
+            this.canceled = true;
+        }
+    }
+
+    public StorageServiceClient.ProcessError handleException(Exception exc) {
+        EPLog.m307e(TAG, "handleException");
+        String message = exc.getMessage();
+        if (message == null && exc.getCause() != null) {
+            message = exc.getCause().getMessage();
+        }
+        if (message != null) {
+            EPLog.m307e(TAG, message);
+        }
+        EvernoteClient.logout(this.mContext);
+        return StorageServiceClient.ProcessError.ERROR;
+    }
+
+    /* access modifiers changed from: package-private */
+    public UploadHandler getUploadHandler() {
+        return new UploadHandler();
+    }
+
+    /* access modifiers changed from: package-private */
+    public DownloadHandler getDownloadHandler() {
+        return new DownloadHandler();
+    }
+
+    /* access modifiers changed from: private */
+    public static Data readFileAsData(String str) throws FileNotFoundException, NoSuchAlgorithmException {
+        FileInputStream fileInputStream = new FileInputStream(str);
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        byte[] bArr = new byte[10240];
+        while (true) {
+            try {
+                int read = fileInputStream.read(bArr);
+                if (read >= 0) {
+                    byteArrayOutputStream.write(bArr, 0, read);
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            } catch (Throwable th) {
+                try {
+                    fileInputStream.close();
+                } catch (IOException unused) {
+                }
+                throw th;
+            }
+            try {
+                break;
+            } catch (IOException unused2) {
+            }
+        }
+        fileInputStream.close();
+        byte[] byteArray = byteArrayOutputStream.toByteArray();
+        Data data = new Data();
+        data.setSize(byteArray.length);
+        data.setBodyHash(MessageDigest.getInstance("MD5").digest(byteArray));
+        data.setBody(byteArray);
+        return data;
+    }
+
+    /* access modifiers changed from: private */
+    public static String bytesToHex(byte[] bArr) {
+        StringBuilder sb = new StringBuilder();
+        for (byte b : bArr) {
+            byte b2 = b & UnsignedBytes.MAX_VALUE;
+            if (b2 < 16) {
+                sb.append('0');
+            }
+            sb.append(Integer.toHexString(b2));
+        }
+        return sb.toString();
+    }
+}

+ 48 - 0
app/src/main/java/com/epson/iprint/storage/evernote/EvernoteSignInActivity.java

@@ -0,0 +1,48 @@
+package com.epson.iprint.storage.evernote;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import com.epson.iprint.storage.StorageSignInActivity;
+import epson.print.Util.EPLog;
+import epson.server.service.EvernoteClient;
+
+public class EvernoteSignInActivity extends StorageSignInActivity {
+    private static final String TAG = "EvernoteSignInActivity";
+
+    public StorageSignInActivity.BasicSignIn getBasicSignIn() {
+        return null;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        EvernoteClient.getEvernoteSession(this).authenticate((Activity) this);
+    }
+
+    public void onActivityResult(int i, int i2, Intent intent) {
+        if (i == 14390) {
+            if (i2 != -1 || !EvernoteClient.getEvernoteSession(this).isLoggedIn()) {
+                showLoginErrorAndFinish();
+                return;
+            }
+            EPLog.m313i(TAG, "REQUEST_CODE_OAUTH RESULT_OK");
+            finish();
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onDestroy() {
+        super.onDestroy();
+    }
+
+    public void onBackPressed() {
+        revokeUserData();
+        finish();
+    }
+
+    /* access modifiers changed from: package-private */
+    public void revokeUserData() {
+        EvernoteClient.logout(this);
+    }
+}

+ 17 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/ActivityWrapper.java

@@ -0,0 +1,17 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.support.annotation.NonNull;
+import com.epson.iprint.storage.gdrivev3.IprintGoogleSignIn;
+
+public interface ActivityWrapper {
+    @NonNull
+    Activity getActivity();
+
+    int getPlayServiceRequestCode();
+
+    int getSingInAddScopeRequestCode();
+
+    void requestSignIn(@NonNull Intent intent, @NonNull IprintGoogleSignIn.StartActivityResultCallback startActivityResultCallback);
+}

+ 5 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/Canceller.java

@@ -0,0 +1,5 @@
+package com.epson.iprint.storage.gdrivev3;
+
+public interface Canceller {
+    boolean canceled();
+}

+ 35 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/DownloadFile.java

@@ -0,0 +1,35 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.support.annotation.Nullable;
+
+public class DownloadFile implements OnlineFile {
+    private final String mMimeType;
+    private final String mName;
+
+    @Nullable
+    public String getId() {
+        return null;
+    }
+
+    public boolean isDisplayFile() {
+        return true;
+    }
+
+    public boolean isFolder() {
+        return false;
+    }
+
+    public DownloadFile(String str, String str2) {
+        this.mName = str;
+        this.mMimeType = str2;
+    }
+
+    public String getName() {
+        return this.mName;
+    }
+
+    @Nullable
+    public String getMimeType() {
+        return this.mMimeType;
+    }
+}

+ 144 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/DownloadTask.java

@@ -0,0 +1,144 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.os.AsyncTask;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.annotation.VisibleForTesting;
+import epson.common.ExternalFileUtils;
+import epson.common.Utils;
+import epson.print.CommonDefine;
+import java.io.File;
+import java.io.IOException;
+
+public class DownloadTask extends AsyncTask<OnlineFile, Void, OnlineFile> implements Canceller {
+    private static final String DOWNLOAD_TMP_FILE_NAME_BODY = "google_v3";
+    @SuppressLint({"StaticFieldLeak"})
+    private final Context mApplicationContext;
+    private volatile boolean mDownloadCancelled = false;
+    private final DownloadCompleteListener mDownloadCompleteListener;
+    private volatile File mDownloadFile;
+    private final GoogleDownloader mMyDrive;
+    private Exception mThreadException;
+
+    public interface DownloadCompleteListener {
+        void onDownloadComplete(boolean z, @Nullable String str);
+    }
+
+    DownloadTask(@NonNull Context context, @NonNull GoogleDownloader googleDownloader, @NonNull DownloadCompleteListener downloadCompleteListener) {
+        this.mApplicationContext = context;
+        this.mMyDrive = googleDownloader;
+        this.mDownloadCompleteListener = downloadCompleteListener;
+        this.mDownloadFile = null;
+    }
+
+    /* access modifiers changed from: protected */
+    public OnlineFile doInBackground(OnlineFile... onlineFileArr) {
+        GoogleDriveFile googleDriveFile;
+        if (onlineFileArr == null || (googleDriveFile = onlineFileArr[0]) == null) {
+            return null;
+        }
+        try {
+            if (!(googleDriveFile instanceof GoogleDriveFile) || !googleDriveFile.isGoogleDocuments()) {
+                File outFile = getOutFile(this.mApplicationContext, getExtensionFromMimeType((OnlineFile) googleDriveFile));
+                this.mDownloadFile = outFile;
+                if (outFile == null) {
+                    return null;
+                }
+                return this.mMyDrive.downloadFile(googleDriveFile, outFile, this);
+            }
+            File outFile2 = getOutFile(this.mApplicationContext, CommonDefine.FileType_PDF);
+            this.mDownloadFile = outFile2;
+            if (outFile2 == null) {
+                return null;
+            }
+            return this.mMyDrive.downloadPdf(googleDriveFile, outFile2);
+        } catch (Exception e) {
+            this.mThreadException = e;
+            return null;
+        }
+    }
+
+    @VisibleForTesting
+    @NonNull
+    static String getExtensionFromMimeType(OnlineFile onlineFile) {
+        if (onlineFile == null) {
+            return "";
+        }
+        String extensionFromMimeType = getExtensionFromMimeType(onlineFile.getMimeType());
+        return extensionFromMimeType.isEmpty() ? getExtensionFromMimeType(Utils.getMimeType(onlineFile.getName())) : extensionFromMimeType;
+    }
+
+    @NonNull
+    private static String getExtensionFromMimeType(String str) {
+        String mimeExt = Utils.getMimeExt(str);
+        return mimeExt != null ? mimeExt : "";
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPostExecute(OnlineFile onlineFile) {
+        if (this.mDownloadCancelled) {
+            this.mDownloadCompleteListener.onDownloadComplete(false, (String) null);
+        }
+        if (onlineFile != null) {
+            String name = onlineFile.getName();
+            if (name != null) {
+                this.mDownloadCompleteListener.onDownloadComplete(false, name);
+            } else {
+                this.mDownloadCompleteListener.onDownloadComplete(true, (String) null);
+            }
+        } else {
+            Exception exc = this.mThreadException;
+            deleteDownloadFile();
+            this.mDownloadCompleteListener.onDownloadComplete(true, (String) null);
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCancelled() {
+        deleteDownloadFile();
+        this.mDownloadCompleteListener.onDownloadComplete(false, (String) null);
+    }
+
+    public boolean canceled() {
+        return this.mDownloadCancelled;
+    }
+
+    public void cancelTask() {
+        this.mDownloadCancelled = true;
+        cancel(true);
+    }
+
+    @Nullable
+    private File getOutFile(@NonNull Context context, @NonNull String str) {
+        try {
+            File prepareOutDirectory = prepareOutDirectory(context);
+            return new File(prepareOutDirectory, DOWNLOAD_TMP_FILE_NAME_BODY + str);
+        } catch (IOException | SecurityException unused) {
+            return null;
+        }
+    }
+
+    @NonNull
+    private File prepareOutDirectory(@NonNull Context context) throws IOException {
+        File file = new File(ExternalFileUtils.getInstance(context).getDownloadDir());
+        if (file.exists() || file.mkdirs()) {
+            File[] listFiles = file.listFiles();
+            if (listFiles != null) {
+                for (File delete : listFiles) {
+                    delete.delete();
+                }
+            }
+            return file;
+        }
+        throw new IOException();
+    }
+
+    public void deleteDownloadFile() {
+        if (this.mDownloadFile != null && this.mDownloadFile.exists()) {
+            this.mDownloadFile.delete();
+            this.mDownloadFile = null;
+        }
+    }
+}

+ 61 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/DownloaderWrapper.java

@@ -0,0 +1,61 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import com.epson.iprint.storage.gdrivev3.DownloadTask;
+import com.epson.iprint.storage.gdrivev3.DriveListTask;
+import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
+
+public class DownloaderWrapper {
+    private DownloadTask mDownloadTask;
+    private GoogleDownloader mGoogleDownloader;
+
+    public boolean createDownloader(@NonNull ActivityWrapper activityWrapper, @NonNull GoogleSignInAccount googleSignInAccount) {
+        this.mGoogleDownloader = GoogleDownloader.createGoogleDownloader(activityWrapper.getActivity(), googleSignInAccount);
+        return this.mGoogleDownloader != null;
+    }
+
+    public void invalidateDownloader() {
+        this.mGoogleDownloader = null;
+    }
+
+    public boolean isDownloadValid() {
+        return this.mGoogleDownloader != null;
+    }
+
+    public void startDownload(@NonNull ActivityWrapper activityWrapper, @NonNull OnlineFile onlineFile, @NonNull DownloadTask.DownloadCompleteListener downloadCompleteListener) {
+        GoogleDownloader googleDownloader = this.mGoogleDownloader;
+        if (googleDownloader != null) {
+            this.mDownloadTask = googleDownloader.startDownload(activityWrapper, onlineFile, downloadCompleteListener);
+            return;
+        }
+        throw new IllegalStateException();
+    }
+
+    public void startListTask(@Nullable OnlineFile onlineFile, @NonNull DriveListTask.ListTaskCompleteListener listTaskCompleteListener) {
+        GoogleDownloader googleDownloader = this.mGoogleDownloader;
+        if (googleDownloader != null) {
+            googleDownloader.startListTask(onlineFile, listTaskCompleteListener);
+            return;
+        }
+        throw new IllegalStateException();
+    }
+
+    public boolean isRootFolder() {
+        return this.mGoogleDownloader.isRootFolder();
+    }
+
+    public void cancelDownload() {
+        DownloadTask downloadTask = this.mDownloadTask;
+        if (downloadTask != null) {
+            downloadTask.cancelTask();
+        }
+    }
+
+    public void onDownloadPreviewEnd() {
+        DownloadTask downloadTask = this.mDownloadTask;
+        if (downloadTask != null) {
+            downloadTask.deleteDownloadFile();
+        }
+    }
+}

+ 54 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/DriveListTask.java

@@ -0,0 +1,54 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.os.AsyncTask;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class DriveListTask extends AsyncTask<OnlineFile, Void, ArrayList<OnlineFile>> {
+    private Exception mException;
+    private final ListTaskCompleteListener mListTaskCompleteListener;
+    private final GoogleDownloader mMyDrive;
+
+    public interface ListTaskCompleteListener {
+        void listComplete(ArrayList<OnlineFile> arrayList);
+    }
+
+    DriveListTask(@NonNull GoogleDownloader googleDownloader, @NonNull ListTaskCompleteListener listTaskCompleteListener) {
+        this.mMyDrive = googleDownloader;
+        this.mListTaskCompleteListener = listTaskCompleteListener;
+    }
+
+    /* access modifiers changed from: protected */
+    public ArrayList<OnlineFile> doInBackground(OnlineFile... onlineFileArr) {
+        try {
+            return filterFiles(this.mMyDrive.listFile(onlineFileArr != null ? onlineFileArr[0] : null));
+        } catch (Exception e) {
+            e.printStackTrace();
+            this.mException = e;
+            return null;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPostExecute(ArrayList<OnlineFile> arrayList) {
+        this.mListTaskCompleteListener.listComplete(arrayList);
+    }
+
+    @NonNull
+    private ArrayList<OnlineFile> filterFiles(@Nullable ArrayList<OnlineFile> arrayList) {
+        if (arrayList == null) {
+            return new ArrayList<>();
+        }
+        ArrayList<OnlineFile> arrayList2 = new ArrayList<>(arrayList.size());
+        Iterator<OnlineFile> it = arrayList.iterator();
+        while (it.hasNext()) {
+            OnlineFile next = it.next();
+            if (next.isDisplayFile()) {
+                arrayList2.add(next);
+            }
+        }
+        return arrayList2;
+    }
+}

+ 236 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/DriveWriter.java

@@ -0,0 +1,236 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
+import com.google.api.client.extensions.android.http.AndroidHttp;
+import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential;
+import com.google.api.client.http.FileContent;
+import com.google.api.client.json.gson.GsonFactory;
+import com.google.api.services.drive.Drive;
+import com.google.api.services.drive.model.File;
+import com.google.api.services.drive.model.FileList;
+import epson.print.gdconv.ConvertStatus;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+
+public class DriveWriter {
+    private static final String ROOT_ID = "root";
+    private static final String TAG = "DriveConverter ";
+    private Drive mDrive;
+
+    public interface ConvertStatusNotifier {
+        void changeStatus(ConvertStatus convertStatus);
+    }
+
+    @NonNull
+    public static String getWriteScope() {
+        return "https://www.googleapis.com/auth/drive";
+    }
+
+    public DriveWriter(@NonNull Drive drive) {
+        this.mDrive = drive;
+    }
+
+    public void uploadFileToRoot(@NonNull String str, @NonNull String str2, @NonNull String str3) throws IOException {
+        uploadFile(str, str2, str3, ROOT_ID);
+    }
+
+    public String uploadFile(@NonNull String str, @NonNull String str2, @NonNull String str3, @NonNull String str4) throws IOException {
+        return ((File) this.mDrive.files().create(new File().setParents(Collections.singletonList(str4)).setMimeType(str3).setName(str2), new FileContent(str3, new java.io.File(str))).setFields("id, parents, mimeType").execute()).getId();
+    }
+
+    @NonNull
+    public List<String> findFolder(@Nullable String str, String str2) throws IOException {
+        if (str == null) {
+            str = ROOT_ID;
+        }
+        if (str2 == null) {
+            return Arrays.asList(new String[]{ROOT_ID});
+        }
+        List<File> files = ((FileList) this.mDrive.files().list().setQ(String.format(Locale.US, "name = '%s' and '%s' in parents and trashed = false and mimeType contains '%s'", new Object[]{str2, str, GoogleDriveMimeType.MIME_TYPE_GOOGLE_FOLDER})).execute()).getFiles();
+        ArrayList arrayList = new ArrayList();
+        for (File id : files) {
+            arrayList.add(id.getId());
+        }
+        return arrayList;
+    }
+
+    public String createFolderInRoot(@NonNull String str) throws IOException {
+        return ((File) this.mDrive.files().create(new File().setName(str).setMimeType(GoogleDriveMimeType.MIME_TYPE_GOOGLE_FOLDER)).setFields("id").execute()).getId();
+    }
+
+    public void convertFileToPdf(@NonNull String str, @NonNull String str2, @Nullable String str3, @NonNull java.io.File file, ConvertStatusNotifier convertStatusNotifier) throws IOException {
+        if (str3 == null) {
+            str3 = ROOT_ID;
+        }
+        String googleDocsConvertMimeType = getGoogleDocsConvertMimeType(str2);
+        if (googleDocsConvertMimeType != null) {
+            File file2 = (File) this.mDrive.files().create(new File().setParents(Collections.singletonList(str3)).setMimeType(googleDocsConvertMimeType).setName("iprint_convert_tmp.tmp"), new FileContent(str2, new java.io.File(str))).setFields("id, parents").execute();
+            if (convertStatusNotifier != null) {
+                convertStatusNotifier.changeStatus(ConvertStatus.DOWNLOAD);
+            }
+            String id = file2.getId();
+            try {
+                this.mDrive.files().export(id, "application/pdf").executeMediaAndDownloadTo(new FileOutputStream(file));
+            } finally {
+                this.mDrive.files().delete(id).execute();
+            }
+        } else {
+            throw new ConvertMimeTypeException("mime type <" + str2 + "> not supported");
+        }
+    }
+
+    /* JADX WARNING: Can't fix incorrect switch cases order */
+    @android.support.annotation.Nullable
+    @android.support.annotation.VisibleForTesting
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    static java.lang.String getGoogleDocsConvertMimeType(@android.support.annotation.NonNull java.lang.String r1) {
+        /*
+            int r0 = r1.hashCode()
+            switch(r0) {
+                case -1248332507: goto L_0x0071;
+                case -1082243251: goto L_0x0067;
+                case -1073633483: goto L_0x005c;
+                case -1071817359: goto L_0x0051;
+                case -1050893613: goto L_0x0047;
+                case -1004747228: goto L_0x003c;
+                case -366307023: goto L_0x0032;
+                case 717553764: goto L_0x0028;
+                case 817335912: goto L_0x001e;
+                case 904647503: goto L_0x0014;
+                case 1993842850: goto L_0x0009;
+                default: goto L_0x0007;
+            }
+        L_0x0007:
+            goto L_0x007b
+        L_0x0009:
+            java.lang.String r0 = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
+            boolean r1 = r1.equals(r0)
+            if (r1 == 0) goto L_0x007b
+            r1 = 6
+            goto L_0x007c
+        L_0x0014:
+            java.lang.String r0 = "application/msword"
+            boolean r1 = r1.equals(r0)
+            if (r1 == 0) goto L_0x007b
+            r1 = 1
+            goto L_0x007c
+        L_0x001e:
+            java.lang.String r0 = "text/plain"
+            boolean r1 = r1.equals(r0)
+            if (r1 == 0) goto L_0x007b
+            r1 = 2
+            goto L_0x007c
+        L_0x0028:
+            java.lang.String r0 = "application/vnd.google-apps.document"
+            boolean r1 = r1.equals(r0)
+            if (r1 == 0) goto L_0x007b
+            r1 = 5
+            goto L_0x007c
+        L_0x0032:
+            java.lang.String r0 = "application/vnd.ms-excel"
+            boolean r1 = r1.equals(r0)
+            if (r1 == 0) goto L_0x007b
+            r1 = 7
+            goto L_0x007c
+        L_0x003c:
+            java.lang.String r0 = "text/csv"
+            boolean r1 = r1.equals(r0)
+            if (r1 == 0) goto L_0x007b
+            r1 = 8
+            goto L_0x007c
+        L_0x0047:
+            java.lang.String r0 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
+            boolean r1 = r1.equals(r0)
+            if (r1 == 0) goto L_0x007b
+            r1 = 0
+            goto L_0x007c
+        L_0x0051:
+            java.lang.String r0 = "application/vnd.ms-powerpoint"
+            boolean r1 = r1.equals(r0)
+            if (r1 == 0) goto L_0x007b
+            r1 = 9
+            goto L_0x007c
+        L_0x005c:
+            java.lang.String r0 = "application/vnd.openxmlformats-officedocument.presentationml.presentation"
+            boolean r1 = r1.equals(r0)
+            if (r1 == 0) goto L_0x007b
+            r1 = 10
+            goto L_0x007c
+        L_0x0067:
+            java.lang.String r0 = "text/html"
+            boolean r1 = r1.equals(r0)
+            if (r1 == 0) goto L_0x007b
+            r1 = 3
+            goto L_0x007c
+        L_0x0071:
+            java.lang.String r0 = "application/rtf"
+            boolean r1 = r1.equals(r0)
+            if (r1 == 0) goto L_0x007b
+            r1 = 4
+            goto L_0x007c
+        L_0x007b:
+            r1 = -1
+        L_0x007c:
+            switch(r1) {
+                case 0: goto L_0x0087;
+                case 1: goto L_0x0087;
+                case 2: goto L_0x0087;
+                case 3: goto L_0x0087;
+                case 4: goto L_0x0087;
+                case 5: goto L_0x0087;
+                case 6: goto L_0x0084;
+                case 7: goto L_0x0084;
+                case 8: goto L_0x0084;
+                case 9: goto L_0x0081;
+                case 10: goto L_0x0081;
+                default: goto L_0x007f;
+            }
+        L_0x007f:
+            r1 = 0
+            return r1
+        L_0x0081:
+            java.lang.String r1 = "application/vnd.google-apps.presentation"
+            return r1
+        L_0x0084:
+            java.lang.String r1 = "application/vnd.google-apps.spreadsheet"
+            return r1
+        L_0x0087:
+            java.lang.String r1 = "application/vnd.google-apps.document"
+            return r1
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.iprint.storage.gdrivev3.DriveWriter.getGoogleDocsConvertMimeType(java.lang.String):java.lang.String");
+    }
+
+    public String findOrCreateFolder(@NonNull String str) throws IOException {
+        List<String> findFolder = findFolder((String) null, str);
+        if (!findFolder.isEmpty()) {
+            return findFolder.get(0);
+        }
+        return createFolderInRoot(str);
+    }
+
+    @NonNull
+    public static DriveWriter createDriveWriter(@NonNull Context context) {
+        GoogleSignInAccount signInAccount = new IprintGoogleSignIn().getSignInAccount(context);
+        if (signInAccount != null) {
+            GoogleAccountCredential usingOAuth2 = GoogleAccountCredential.usingOAuth2(context, Collections.singleton(getWriteScope()));
+            usingOAuth2.setSelectedAccount(signInAccount.getAccount());
+            return new DriveWriter(new Drive.Builder(AndroidHttp.newCompatibleTransport(), new GsonFactory(), usingOAuth2).setApplicationName(GoogleDownloader.getDriveApplicationName(context)).build());
+        }
+        throw new IllegalStateException();
+    }
+
+    public static class ConvertMimeTypeException extends IOException {
+        public ConvertMimeTypeException(String str) {
+            super(str);
+        }
+    }
+}

+ 84 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/FileListAdapter.java

@@ -0,0 +1,84 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.support.annotation.UiThread;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+import epson.print.R;
+import java.util.ArrayList;
+
+public class FileListAdapter extends BaseAdapter {
+    private ArrayList<OnlineFile> mDriveFiles;
+    private final LayoutInflater mLayoutInflater;
+
+    public Object getItem(int i) {
+        return null;
+    }
+
+    public long getItemId(int i) {
+        return 0;
+    }
+
+    public FileListAdapter(@NonNull Context context) {
+        this.mLayoutInflater = LayoutInflater.from(context);
+    }
+
+    @UiThread
+    public void setDriveFile(ArrayList<OnlineFile> arrayList) {
+        this.mDriveFiles = arrayList;
+        notifyDataSetChanged();
+    }
+
+    public int getCount() {
+        ArrayList<OnlineFile> arrayList = this.mDriveFiles;
+        if (arrayList == null) {
+            return 0;
+        }
+        return arrayList.size();
+    }
+
+    public OnlineFile getDriveItem(int i) {
+        return this.mDriveFiles.get(i);
+    }
+
+    public View getView(int i, View view, ViewGroup viewGroup) {
+        int i2;
+        if (view == null) {
+            view = this.mLayoutInflater.inflate(R.layout.file_list_item, viewGroup, false);
+        }
+        OnlineFile onlineFile = this.mDriveFiles.get(i);
+        String name = onlineFile.getName();
+        int i3 = R.C2136drawable.file;
+        if (onlineFile.isFolder()) {
+            i3 = onlineFile instanceof ParentFolder ? R.C2136drawable.parent_folder : R.C2136drawable.folder;
+            i2 = R.C2136drawable.more;
+        } else {
+            i2 = 0;
+        }
+        ((TextView) view.findViewById(R.id.file_folder_name)).setText(name);
+        ImageView imageView = (ImageView) view.findViewById(R.id.file_folder_icon);
+        imageView.setImageResource(i3);
+        imageView.setVisibility(0);
+        ImageView imageView2 = (ImageView) view.findViewById(R.id.browse_folder);
+        if (i2 != 0) {
+            imageView2.setVisibility(0);
+            imageView2.setImageResource(i2);
+        } else {
+            imageView2.setVisibility(8);
+        }
+        return view;
+    }
+
+    public void clearItems() {
+        ArrayList<OnlineFile> arrayList = this.mDriveFiles;
+        if (arrayList != null) {
+            arrayList.clear();
+        }
+        notifyDataSetChanged();
+    }
+}

+ 63 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/GoogleDownloadContract.java

@@ -0,0 +1,63 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import java.util.ArrayList;
+
+public interface GoogleDownloadContract {
+    public static final int BUTTON_FOR_SIGN_IN_STATUS = 1;
+    public static final int BUTTON_FOR_SIGN_OUT_STATUS = 0;
+
+    public interface UserActionListener {
+        void activityOnPause();
+
+        void activityOnResume();
+
+        void backKeyPressed();
+
+        void cancelDownload();
+
+        void initView();
+
+        boolean isDownloading();
+
+        void itemSelected(@NonNull OnlineFile onlineFile);
+
+        void onAddScopeCompleted(boolean z);
+
+        void onPreviewActivityEnd();
+
+        void signInOrDisconnectClicked();
+
+        void startListTask(@Nullable OnlineFile onlineFile);
+    }
+
+    public interface View {
+        void changeSignInOutButton(int i);
+
+        void clearListItems();
+
+        void dismissProgress();
+
+        void finishActivity();
+
+        @NonNull
+        ActivityWrapper getActivityWrapper();
+
+        void listFiles(@Nullable ArrayList<OnlineFile> arrayList);
+
+        void setSignInButtonEnabled(boolean z);
+
+        void showDownloadErrorDialog();
+
+        void showDownloadProgress();
+
+        void showOfflineErrorDialog();
+
+        void showProgress();
+
+        void showSignInFailDialog();
+
+        void startPreviewActivity(String str);
+    }
+}

+ 246 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/GoogleDownloadPresenter.java

@@ -0,0 +1,246 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import com.epson.iprint.storage.Network;
+import com.epson.iprint.storage.gdrivev3.DownloadTask;
+import com.epson.iprint.storage.gdrivev3.DriveListTask;
+import com.epson.iprint.storage.gdrivev3.GoogleDownloadContract;
+import com.epson.iprint.storage.gdrivev3.IprintGoogleSignIn;
+import com.epson.iprint.storage.gdrivev3.PlayServiceDialogManager;
+import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+
+public class GoogleDownloadPresenter implements GoogleDownloadContract.UserActionListener, IprintGoogleSignIn.SignInListener, DriveListTask.ListTaskCompleteListener, DownloadTask.DownloadCompleteListener, PlayServiceDialogManager.SingInCancelNotifier {
+    private final WeakReference<GoogleDownloadContract.View> mDownloadViewReference;
+    private final DownloaderWrapper mGoogleDownloader;
+    private final IprintGoogleSignIn mIprintGoogleSignIn;
+    private boolean mIsDownloading = false;
+    private final Network mMisc;
+    private final PlayServiceDialogManager mPlayServiceDialogManager;
+    private SignInState mSignInStatus;
+    private boolean mStartListDone;
+    private TaskState mTaskRunning;
+
+    private enum SignInState {
+        SIGN_IN,
+        SIGN_OUT
+    }
+
+    private enum TaskState {
+        RUNNING,
+        STOP
+    }
+
+    private enum TaskType {
+        FILE_LIST,
+        DOWNLOAD
+    }
+
+    public GoogleDownloadPresenter(@NonNull IprintGoogleSignIn iprintGoogleSignIn, @NonNull PlayServiceDialogManager playServiceDialogManager, @NonNull DownloaderWrapper downloaderWrapper, @NonNull Network network, @NonNull GoogleDownloadContract.View view) {
+        this.mIprintGoogleSignIn = iprintGoogleSignIn;
+        this.mPlayServiceDialogManager = playServiceDialogManager;
+        this.mGoogleDownloader = downloaderWrapper;
+        this.mMisc = network;
+        this.mDownloadViewReference = new WeakReference<>(view);
+        this.mSignInStatus = SignInState.SIGN_OUT;
+        this.mStartListDone = false;
+        this.mTaskRunning = TaskState.STOP;
+    }
+
+    @Nullable
+    private GoogleDownloadContract.View getDownloadView() {
+        return (GoogleDownloadContract.View) this.mDownloadViewReference.get();
+    }
+
+    public void initView() {
+        GoogleDownloadContract.View downloadView = getDownloadView();
+        if (downloadView != null) {
+            changeSignInStatus(downloadView, SignInState.SIGN_OUT);
+            downloadView.setSignInButtonEnabled(false);
+            downloadView.dismissProgress();
+        }
+    }
+
+    public void activityOnResume() {
+        GoogleDownloadContract.View downloadView = getDownloadView();
+        if (downloadView != null) {
+            this.mMisc.selectSimpleAp(downloadView.getActivityWrapper(), false);
+            if (!this.mMisc.isOnline(downloadView.getActivityWrapper())) {
+                downloadView.showOfflineErrorDialog();
+            } else if (!this.mPlayServiceDialogManager.checkPlayService(downloadView.getActivityWrapper(), this) && this.mTaskRunning == TaskState.STOP) {
+                downloadView.setSignInButtonEnabled(true);
+                if (this.mIprintGoogleSignIn.isSignInValid(downloadView.getActivityWrapper().getActivity(), IprintGoogleSignIn.OperationType.DOWNLOAD)) {
+                    changeSignInStatus(downloadView, SignInState.SIGN_IN);
+                    if (!this.mStartListDone) {
+                        start1stListTask(downloadView, this.mIprintGoogleSignIn.getSignInAccount(downloadView.getActivityWrapper().getActivity()));
+                        return;
+                    }
+                    return;
+                }
+                changeSignInStatus(downloadView, SignInState.SIGN_OUT);
+            }
+        }
+    }
+
+    public void activityOnPause() {
+        this.mPlayServiceDialogManager.onActivityPaused();
+    }
+
+    public boolean isDownloading() {
+        return this.mIsDownloading;
+    }
+
+    public void playServiceInstallCancel() {
+        GoogleDownloadContract.View downloadView = getDownloadView();
+        if (downloadView != null) {
+            downloadView.setSignInButtonEnabled(true);
+            downloadView.showSignInFailDialog();
+        }
+    }
+
+    public void signInOrDisconnectClicked() {
+        GoogleDownloadContract.View downloadView = getDownloadView();
+        if (downloadView != null) {
+            downloadView.setSignInButtonEnabled(false);
+            if (this.mSignInStatus == SignInState.SIGN_IN) {
+                this.mIprintGoogleSignIn.disconnectAccount(downloadView.getActivityWrapper(), this);
+            } else {
+                this.mIprintGoogleSignIn.startSignIn(this, downloadView.getActivityWrapper(), IprintGoogleSignIn.OperationType.DOWNLOAD);
+            }
+        }
+    }
+
+    public void onSignInComplete(boolean z, GoogleSignInAccount googleSignInAccount) {
+        GoogleDownloadContract.View downloadView = getDownloadView();
+        if (downloadView != null) {
+            downloadView.clearListItems();
+            changeSignInStatus(downloadView, z ? SignInState.SIGN_IN : SignInState.SIGN_OUT);
+            if (!z) {
+                downloadView.setSignInButtonEnabled(true);
+                downloadView.dismissProgress();
+                downloadView.showSignInFailDialog();
+            } else if (googleSignInAccount != null) {
+                start1stListTask(downloadView, googleSignInAccount);
+            } else {
+                throw new IllegalStateException();
+            }
+        }
+    }
+
+    public void onAddScopeCompleted(boolean z) {
+        GoogleDownloadContract.View downloadView = getDownloadView();
+        if (downloadView != null) {
+            onSignInComplete(z, z ? this.mIprintGoogleSignIn.getSignInAccount(downloadView.getActivityWrapper().getActivity()) : null);
+        }
+    }
+
+    public void onDisconnectCompleted() {
+        GoogleDownloadContract.View downloadView = getDownloadView();
+        if (downloadView != null) {
+            this.mGoogleDownloader.invalidateDownloader();
+            changeSignInStatus(downloadView, SignInState.SIGN_OUT);
+            downloadView.setSignInButtonEnabled(true);
+            downloadView.clearListItems();
+        }
+    }
+
+    private void start1stListTask(GoogleDownloadContract.View view, @Nullable GoogleSignInAccount googleSignInAccount) {
+        if (googleSignInAccount != null) {
+            this.mGoogleDownloader.createDownloader(view.getActivityWrapper(), googleSignInAccount);
+            startListTask((OnlineFile) null);
+            return;
+        }
+        throw new IllegalStateException();
+    }
+
+    public void startListTask(@Nullable OnlineFile onlineFile) {
+        GoogleDownloadContract.View downloadView = getDownloadView();
+        if (downloadView != null) {
+            onTaskStart(downloadView, TaskType.FILE_LIST);
+            this.mStartListDone = true;
+            this.mGoogleDownloader.startListTask(onlineFile, this);
+        }
+    }
+
+    private void changeSignInStatus(GoogleDownloadContract.View view, SignInState signInState) {
+        this.mSignInStatus = signInState;
+        view.changeSignInOutButton(signInState == SignInState.SIGN_IN ? 1 : 0);
+    }
+
+    public void listComplete(ArrayList<OnlineFile> arrayList) {
+        GoogleDownloadContract.View downloadView = getDownloadView();
+        if (downloadView != null) {
+            onTaskEnd(downloadView);
+            downloadView.listFiles(arrayList);
+        }
+    }
+
+    public void itemSelected(@NonNull OnlineFile onlineFile) {
+        GoogleDownloadContract.View downloadView = getDownloadView();
+        if (downloadView != null) {
+            if (!this.mGoogleDownloader.isDownloadValid()) {
+                throw new IllegalStateException();
+            } else if (onlineFile.isFolder()) {
+                startListTask(onlineFile);
+            } else {
+                onTaskStart(downloadView, TaskType.DOWNLOAD);
+                this.mIsDownloading = true;
+                this.mGoogleDownloader.startDownload(downloadView.getActivityWrapper(), onlineFile, this);
+            }
+        }
+    }
+
+    public void backKeyPressed() {
+        GoogleDownloadContract.View downloadView = getDownloadView();
+        if (downloadView != null) {
+            if (this.mSignInStatus != SignInState.SIGN_IN) {
+                downloadView.finishActivity();
+            } else if (!this.mGoogleDownloader.isDownloadValid()) {
+                throw new IllegalStateException();
+            } else if (this.mGoogleDownloader.isRootFolder()) {
+                downloadView.finishActivity();
+            } else {
+                startListTask(new ParentFolder());
+            }
+        }
+    }
+
+    public void cancelDownload() {
+        this.mGoogleDownloader.cancelDownload();
+    }
+
+    public void onPreviewActivityEnd() {
+        this.mGoogleDownloader.onDownloadPreviewEnd();
+    }
+
+    public void onDownloadComplete(boolean z, @Nullable String str) {
+        GoogleDownloadContract.View downloadView = getDownloadView();
+        this.mIsDownloading = false;
+        if (downloadView != null) {
+            onTaskEnd(downloadView);
+            if (str != null) {
+                downloadView.startPreviewActivity(str);
+            } else if (z) {
+                downloadView.showDownloadErrorDialog();
+            }
+        }
+    }
+
+    private void onTaskEnd(GoogleDownloadContract.View view) {
+        this.mTaskRunning = TaskState.STOP;
+        view.dismissProgress();
+        view.setSignInButtonEnabled(true);
+    }
+
+    private void onTaskStart(GoogleDownloadContract.View view, TaskType taskType) {
+        this.mTaskRunning = TaskState.RUNNING;
+        if (taskType == TaskType.DOWNLOAD) {
+            view.showDownloadProgress();
+        } else {
+            view.showProgress();
+        }
+        view.setSignInButtonEnabled(false);
+    }
+}

+ 286 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/GoogleDownloader.java

@@ -0,0 +1,286 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.content.Context;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import com.epson.iprint.storage.gdrivev3.DownloadTask;
+import com.epson.iprint.storage.gdrivev3.DriveListTask;
+import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
+import com.google.api.client.extensions.android.http.AndroidHttp;
+import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential;
+import com.google.api.client.json.gson.GsonFactory;
+import com.google.api.services.drive.Drive;
+import com.google.api.services.drive.model.FileList;
+import epson.print.CommonDefine;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+
+public class GoogleDownloader {
+    private static final String ROOT_ID = "root";
+    private static final String TARGET_SCOPE = "https://www.googleapis.com/auth/drive";
+    private final Drive mDrive;
+    private final FolderManager mFolderManager = new FolderManager();
+
+    public static String getTargetScope() {
+        return "https://www.googleapis.com/auth/drive";
+    }
+
+    private GoogleDownloader(@NonNull Drive drive) {
+        this.mDrive = drive;
+    }
+
+    public DownloadTask startDownload(@NonNull ActivityWrapper activityWrapper, @NonNull OnlineFile onlineFile, @NonNull DownloadTask.DownloadCompleteListener downloadCompleteListener) {
+        DownloadTask downloadTask = new DownloadTask(activityWrapper.getActivity().getApplicationContext(), this, downloadCompleteListener);
+        downloadTask.execute(new OnlineFile[]{onlineFile});
+        return downloadTask;
+    }
+
+    public void startListTask(@Nullable OnlineFile onlineFile, @NonNull DriveListTask.ListTaskCompleteListener listTaskCompleteListener) {
+        new DriveListTask(this, listTaskCompleteListener).execute(new OnlineFile[]{onlineFile});
+    }
+
+    public boolean isRootFolder() {
+        return this.mFolderManager.isRootFolder();
+    }
+
+    @Nullable
+    public OnlineFile downloadPdf(GoogleDriveFile googleDriveFile, File file) throws IOException {
+        Throwable th;
+        String id = googleDriveFile.getId();
+        if (id != null) {
+            FileOutputStream fileOutputStream = new FileOutputStream(file);
+            try {
+                this.mDrive.files().export(id, "application/pdf").executeMediaAndDownloadTo(fileOutputStream);
+                fileOutputStream.close();
+                return new DownloadFile(file.getPath(), "application/pdf");
+            } catch (Throwable th2) {
+                th.addSuppressed(th2);
+            }
+        } else {
+            throw new IllegalStateException();
+        }
+        throw th;
+    }
+
+    /* JADX WARNING: Code restructure failed: missing block: B:12:?, code lost:
+        r2.close();
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:13:0x002f, code lost:
+        if (r7 == null) goto L_0x0034;
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:14:0x0031, code lost:
+        r7.close();
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:15:0x0034, code lost:
+        return r0;
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:16:0x0035, code lost:
+        r8 = th;
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:17:0x0036, code lost:
+        r9 = null;
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:21:0x003a, code lost:
+        r9 = move-exception;
+     */
+    /* JADX WARNING: Code restructure failed: missing block: B:22:0x003b, code lost:
+        r5 = r9;
+        r9 = r8;
+        r8 = r5;
+     */
+    @android.support.annotation.Nullable
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    public com.epson.iprint.storage.gdrivev3.OnlineFile downloadFile(com.epson.iprint.storage.gdrivev3.OnlineFile r7, java.io.File r8, @android.support.annotation.NonNull com.epson.iprint.storage.gdrivev3.Canceller r9) throws java.io.IOException {
+        /*
+            r6 = this;
+            com.epson.iprint.storage.gdrivev3.DownloadFile r0 = new com.epson.iprint.storage.gdrivev3.DownloadFile
+            java.lang.String r1 = r8.getPath()
+            java.lang.String r2 = r7.getMimeType()
+            r0.<init>(r1, r2)
+            java.io.InputStream r7 = r6.getFileInputStream(r7)
+            r1 = 0
+            java.io.FileOutputStream r2 = new java.io.FileOutputStream     // Catch:{ Throwable -> 0x004f }
+            r2.<init>(r8)     // Catch:{ Throwable -> 0x004f }
+            r8 = 1024(0x400, float:1.435E-42)
+            byte[] r8 = new byte[r8]     // Catch:{ Throwable -> 0x0038, all -> 0x0035 }
+        L_0x001b:
+            int r3 = r7.read(r8)     // Catch:{ Throwable -> 0x0038, all -> 0x0035 }
+            if (r3 < 0) goto L_0x002c
+            boolean r4 = r9.canceled()     // Catch:{ Throwable -> 0x0038, all -> 0x0035 }
+            if (r4 != 0) goto L_0x002c
+            r4 = 0
+            r2.write(r8, r4, r3)     // Catch:{ Throwable -> 0x0038, all -> 0x0035 }
+            goto L_0x001b
+        L_0x002c:
+            r2.close()     // Catch:{ Throwable -> 0x004f }
+            if (r7 == 0) goto L_0x0034
+            r7.close()
+        L_0x0034:
+            return r0
+        L_0x0035:
+            r8 = move-exception
+            r9 = r1
+            goto L_0x003e
+        L_0x0038:
+            r8 = move-exception
+            throw r8     // Catch:{ all -> 0x003a }
+        L_0x003a:
+            r9 = move-exception
+            r5 = r9
+            r9 = r8
+            r8 = r5
+        L_0x003e:
+            if (r9 == 0) goto L_0x0049
+            r2.close()     // Catch:{ Throwable -> 0x0044 }
+            goto L_0x004c
+        L_0x0044:
+            r0 = move-exception
+            r9.addSuppressed(r0)     // Catch:{ Throwable -> 0x004f }
+            goto L_0x004c
+        L_0x0049:
+            r2.close()     // Catch:{ Throwable -> 0x004f }
+        L_0x004c:
+            throw r8     // Catch:{ Throwable -> 0x004f }
+        L_0x004d:
+            r8 = move-exception
+            goto L_0x0052
+        L_0x004f:
+            r8 = move-exception
+            r1 = r8
+            throw r1     // Catch:{ all -> 0x004d }
+        L_0x0052:
+            if (r7 == 0) goto L_0x0062
+            if (r1 == 0) goto L_0x005f
+            r7.close()     // Catch:{ Throwable -> 0x005a }
+            goto L_0x0062
+        L_0x005a:
+            r7 = move-exception
+            r1.addSuppressed(r7)
+            goto L_0x0062
+        L_0x005f:
+            r7.close()
+        L_0x0062:
+            throw r8
+        */
+        throw new UnsupportedOperationException("Method not decompiled: com.epson.iprint.storage.gdrivev3.GoogleDownloader.downloadFile(com.epson.iprint.storage.gdrivev3.OnlineFile, java.io.File, com.epson.iprint.storage.gdrivev3.Canceller):com.epson.iprint.storage.gdrivev3.OnlineFile");
+    }
+
+    @NonNull
+    public static GoogleDownloader createGoogleDownloader(@NonNull Context context, @NonNull GoogleSignInAccount googleSignInAccount) {
+        GoogleAccountCredential usingOAuth2 = GoogleAccountCredential.usingOAuth2(context, Collections.singleton(getTargetScope()));
+        usingOAuth2.setSelectedAccount(googleSignInAccount.getAccount());
+        return new GoogleDownloader(new Drive.Builder(AndroidHttp.newCompatibleTransport(), new GsonFactory(), usingOAuth2).setApplicationName(getDriveApplicationName(context)).build());
+    }
+
+    public static String getDriveApplicationName(@NonNull Context context) {
+        String appName = getAppName(context);
+        return appName == null ? context.getPackageName() : appName;
+    }
+
+    private static String getAppName(@NonNull Context context) {
+        try {
+            PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 128);
+            String str = (String) packageInfo.applicationInfo.loadLabel(context.getPackageManager());
+            if (packageInfo.versionName == null) {
+                return str;
+            }
+            return str + CommonDefine.SLASH + packageInfo.versionName;
+        } catch (PackageManager.NameNotFoundException unused) {
+            return null;
+        }
+    }
+
+    @NonNull
+    public ArrayList<OnlineFile> listFile(@Nullable OnlineFile onlineFile) throws IOException {
+        Drive.Files files = this.mDrive.files();
+        this.mFolderManager.changeCurrentFolder(onlineFile);
+        String currentFolderId = this.mFolderManager.getCurrentFolderId();
+        ArrayList<OnlineFile> arrayList = new ArrayList<>();
+        String str = null;
+        do {
+            Drive.Files.List list = files.list();
+            FileList fileList = (FileList) list.setQ("'" + currentFolderId + "' in parents and trashed = false and (mimeType contains 'image/' or mimeType contains 'application/' or mimeType contains 'text/')").setFields("nextPageToken, files(id, name, mimeType, trashed)").setPageToken(str).execute();
+            if (!this.mFolderManager.isRootFolder()) {
+                arrayList.add(new ParentFolder());
+            }
+            for (com.google.api.services.drive.model.File googleDriveFile : fileList.getFiles()) {
+                arrayList.add(new GoogleDriveFile(googleDriveFile));
+            }
+            str = fileList.getNextPageToken();
+        } while (str != null);
+        return arrayList;
+    }
+
+    private InputStream getFileInputStream(@NonNull OnlineFile onlineFile) throws IOException {
+        String id = onlineFile.getId();
+        if (id != null) {
+            return this.mDrive.files().get(id).executeMediaAsInputStream();
+        }
+        throw new IOException("getId() return null");
+    }
+
+    private static class FolderManager {
+        private OnlineFile mCurrentFolder = null;
+        private final LinkedList<OnlineFile> mParentDirList = new LinkedList<>();
+
+        FolderManager() {
+        }
+
+        /* access modifiers changed from: private */
+        public void changeCurrentFolder(@Nullable OnlineFile onlineFile) {
+            if (onlineFile == null || !onlineFile.isFolder()) {
+                return;
+            }
+            if (onlineFile instanceof ParentFolder) {
+                gotoParent();
+                return;
+            }
+            OnlineFile onlineFile2 = this.mCurrentFolder;
+            if (onlineFile2 != null) {
+                this.mParentDirList.push(onlineFile2);
+            }
+            this.mCurrentFolder = onlineFile;
+        }
+
+        private void gotoRoot() {
+            this.mParentDirList.clear();
+            this.mCurrentFolder = null;
+        }
+
+        private void gotoParent() {
+            if (this.mParentDirList.isEmpty()) {
+                this.mCurrentFolder = null;
+                gotoRoot();
+                return;
+            }
+            OnlineFile pop = this.mParentDirList.pop();
+            if (pop == null) {
+                gotoRoot();
+                return;
+            }
+            this.mCurrentFolder = pop;
+            this.mCurrentFolder.getId();
+        }
+
+        /* access modifiers changed from: package-private */
+        public String getCurrentFolderId() {
+            OnlineFile onlineFile = this.mCurrentFolder;
+            if (onlineFile == null) {
+                return GoogleDownloader.ROOT_ID;
+            }
+            return onlineFile.getId();
+        }
+
+        /* access modifiers changed from: private */
+        public boolean isRootFolder() {
+            return this.mCurrentFolder == null;
+        }
+    }
+}

+ 76 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/GoogleDriveFile.java

@@ -0,0 +1,76 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import com.epson.iprint.storage.StorageServiceClient;
+import com.google.api.services.drive.model.File;
+import java.util.HashSet;
+
+public class GoogleDriveFile implements OnlineFile {
+    private static HashSet<String> sGoogleDocumentsTypeSet;
+    private final File mDriveFile;
+
+    public GoogleDriveFile(@NonNull File file) {
+        this.mDriveFile = file;
+    }
+
+    public String getName() {
+        return this.mDriveFile.getName();
+    }
+
+    public boolean isFolder() {
+        return GoogleDriveMimeType.MIME_TYPE_GOOGLE_FOLDER.equals(this.mDriveFile.getMimeType());
+    }
+
+    @Nullable
+    public String getId() {
+        return this.mDriveFile.getId();
+    }
+
+    public String getMimeType() {
+        return this.mDriveFile.getMimeType();
+    }
+
+    public boolean isDisplayFile() {
+        if (localGetTrashed()) {
+            return false;
+        }
+        if (!isFolder() && !isIprintFile()) {
+            return false;
+        }
+        return true;
+    }
+
+    private boolean isIprintFile() {
+        if (localGetTrashed()) {
+            return false;
+        }
+        prepareFileTypeSet();
+        if (sGoogleDocumentsTypeSet.contains(getMimeType())) {
+            return true;
+        }
+        return StorageServiceClient.isPrintableFilename(getName());
+    }
+
+    public boolean isGoogleDocuments() {
+        prepareFileTypeSet();
+        return sGoogleDocumentsTypeSet.contains(getMimeType());
+    }
+
+    private boolean localGetTrashed() {
+        Boolean trashed = this.mDriveFile.getTrashed();
+        return trashed != null && trashed.booleanValue();
+    }
+
+    private static synchronized void prepareFileTypeSet() {
+        synchronized (GoogleDriveFile.class) {
+            if (sGoogleDocumentsTypeSet == null) {
+                sGoogleDocumentsTypeSet = new HashSet<>();
+                sGoogleDocumentsTypeSet.add(GoogleDriveMimeType.MIME_TYPE_GOOGLE_DOC);
+                sGoogleDocumentsTypeSet.add(GoogleDriveMimeType.MIME_TYPE_GOOGLE_SHEETS);
+                sGoogleDocumentsTypeSet.add(GoogleDriveMimeType.MIME_TYPE_GOOGLE_DRAWING);
+                sGoogleDocumentsTypeSet.add(GoogleDriveMimeType.MIME_TYPE_GOOGLE_SLIDES);
+            }
+        }
+    }
+}

+ 9 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/GoogleDriveMimeType.java

@@ -0,0 +1,9 @@
+package com.epson.iprint.storage.gdrivev3;
+
+public class GoogleDriveMimeType {
+    public static final String MIME_TYPE_GOOGLE_DOC = "application/vnd.google-apps.document";
+    public static final String MIME_TYPE_GOOGLE_DRAWING = "application/vnd.google-apps.drawing";
+    public static final String MIME_TYPE_GOOGLE_FOLDER = "application/vnd.google-apps.folder";
+    public static final String MIME_TYPE_GOOGLE_SHEETS = "application/vnd.google-apps.spreadsheet";
+    public static final String MIME_TYPE_GOOGLE_SLIDES = "application/vnd.google-apps.presentation";
+}

+ 127 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/GoogleV3UploadClient.java

@@ -0,0 +1,127 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.AsyncTask;
+import android.support.annotation.NonNull;
+import com.epson.iprint.storage.StorageItem;
+import com.epson.iprint.storage.StorageServiceClient;
+import com.epson.iprint.storage.gdrivev3.IprintGoogleSignIn;
+import epson.print.R;
+
+public class GoogleV3UploadClient extends StorageServiceClient {
+    public static final String UPLOAD_FOLDER_NAME = "Epson iPrint";
+    private static boolean sCheckSignIn;
+    private IprintGoogleSignIn mIprintGoogleSignIn = new IprintGoogleSignIn();
+
+    public boolean isSupportedUploadType(StorageServiceClient.UploadFileType uploadFileType) {
+        return true;
+    }
+
+    public static boolean isCheckSignIn() {
+        return sCheckSignIn;
+    }
+
+    public static void setSingInValue(boolean z) {
+        sCheckSignIn = z;
+    }
+
+    public GoogleV3UploadClient() {
+        sCheckSignIn = false;
+    }
+
+    public StorageServiceClient.Uploader getUploader(Context context, StorageServiceClient.UploadFileType uploadFileType, String str, String str2) {
+        return new GoogleV3Uploader(context, new UploadInfo(uploadFileType, str, str2));
+    }
+
+    public StorageServiceClient.Downloader getDownloader(Context context, StorageItem storageItem, String str) {
+        throw new UnsupportedOperationException();
+    }
+
+    @NonNull
+    public StorageServiceClient.Enumerator getEnumerator(Context context) {
+        throw new UnsupportedOperationException();
+    }
+
+    public boolean isSignedIn(Context context) {
+        if (!isCheckSignIn()) {
+            return false;
+        }
+        return this.mIprintGoogleSignIn.isSignInValid(context, IprintGoogleSignIn.OperationType.UPLOAD);
+    }
+
+    public boolean revokeSignedInData(Activity activity) {
+        activity.startActivity(GoogleV3UploadSignInActivity.getDisconnectIntent(activity));
+        return false;
+    }
+
+    public String getStorageServiceName(Context context) {
+        return context.getString(R.string.google_drive);
+    }
+
+    class GoogleV3Uploader extends StorageServiceClient.Uploader {
+        private final Context mContext;
+        private UploadInfo mUploadInfo;
+
+        public boolean isCancelable() {
+            return false;
+        }
+
+        public GoogleV3Uploader(Context context, @NonNull UploadInfo uploadInfo) {
+            super();
+            this.mContext = context.getApplicationContext();
+            this.mUploadInfo = uploadInfo;
+        }
+
+        public void start(StorageServiceClient.UploadCompletion uploadCompletion) {
+            new UploadTask(this.mContext, uploadCompletion).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new UploadInfo[]{this.mUploadInfo});
+        }
+    }
+
+    private static class UploadTask extends AsyncTask<UploadInfo, Void, Void> {
+        private final Context mContext;
+        private final StorageServiceClient.UploadCompletion mUploadNotifier;
+
+        UploadTask(Context context, StorageServiceClient.UploadCompletion uploadCompletion) {
+            this.mContext = context;
+            this.mUploadNotifier = uploadCompletion;
+        }
+
+        /* access modifiers changed from: protected */
+        public Void doInBackground(UploadInfo... uploadInfoArr) {
+            if (uploadInfoArr == null || uploadInfoArr[0] == null) {
+                this.mUploadNotifier.onUploadComplete((String) null, (String) null, StorageServiceClient.ProcessError.ERROR);
+                return null;
+            }
+            UploadInfo uploadInfo = uploadInfoArr[0];
+            DriveWriter createDriveWriter = DriveWriter.createDriveWriter(this.mContext);
+            try {
+                createDriveWriter.uploadFile(uploadInfo.originalLocalPath, uploadInfo.uploadFilename, uploadInfo.fileType == StorageServiceClient.UploadFileType.PDF ? "application/pdf" : "image/jpeg", createDriveWriter.findOrCreateFolder("Epson iPrint"));
+                notifyUploadEnd(uploadInfo, StorageServiceClient.ProcessError.NONE);
+                return null;
+            } catch (Exception unused) {
+                notifyUploadEnd(uploadInfo, StorageServiceClient.ProcessError.ERROR);
+                return null;
+            }
+        }
+
+        private void notifyUploadEnd(UploadInfo uploadInfo, StorageServiceClient.ProcessError processError) {
+            StorageServiceClient.UploadCompletion uploadCompletion = this.mUploadNotifier;
+            if (uploadCompletion != null) {
+                uploadCompletion.onUploadComplete(uploadInfo.originalLocalPath, uploadInfo.uploadFilename, processError);
+            }
+        }
+    }
+
+    public static class UploadInfo {
+        StorageServiceClient.UploadFileType fileType;
+        String originalLocalPath;
+        String uploadFilename;
+
+        public UploadInfo(@NonNull StorageServiceClient.UploadFileType uploadFileType, @NonNull String str, @NonNull String str2) {
+            this.fileType = uploadFileType;
+            this.originalLocalPath = str;
+            this.uploadFilename = str2;
+        }
+    }
+}

+ 212 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/GoogleV3UploadSignInActivity.java

@@ -0,0 +1,212 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.p003v7.app.AppCompatActivity;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.epson.iprint.storage.Network;
+import com.epson.iprint.storage.OneButtonDialogFragment;
+import com.epson.iprint.storage.gdrivev3.IprintGoogleSignIn;
+import com.epson.iprint.storage.gdrivev3.PlayServiceDialogManager;
+import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
+import epson.print.R;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+public class GoogleV3UploadSignInActivity extends AppCompatActivity implements ActivityWrapper, PlayServiceDialogManager.SingInCancelNotifier, OneButtonDialogFragment.DialogCallback, IprintGoogleSignIn.SignInListener {
+    private static final String DIALOG_TAG_OFFLINE_ERROR = "offline_error";
+    private static final String DIALOG_TAG_SIGN_IN_FAILED = "sign-in_failed";
+    private static final String PARAM_KEY_CHECK_SERVICE_ONLY = "check-service_only";
+    private static final String PARAM_KEY_FOR_DISCONNECT = "for-disconnect";
+    private static final int REQUEST_CODE_CHECK_PLAY_SERVICE = 11;
+    private static final int REQUEST_CODE_SIGN_IN = 10;
+    private static final int REQUEST_CODE_SIGN_IN_ADD_SCOPE = 12;
+    private boolean mActivityForeground;
+    private boolean mCheckServiceOnly;
+    private LinkedList<Runnable> mForegroundRunnableList;
+    private IprintGoogleSignIn mIprintGoogleSignIn;
+    private Network mMisc;
+    private PlayServiceDialogManager mPlayServiceDialogManager;
+    private IprintGoogleSignIn.StartActivityResultCallback mSignInStartActivityCallback;
+    private boolean mStartForDisconnect;
+    private boolean mWaitSingInProcess;
+
+    @NonNull
+    public Activity getActivity() {
+        return this;
+    }
+
+    public int getPlayServiceRequestCode() {
+        return 11;
+    }
+
+    public int getSingInAddScopeRequestCode() {
+        return 12;
+    }
+
+    @NonNull
+    public static Intent getDisconnectIntent(@NonNull Context context) {
+        Intent intent = new Intent(context, GoogleV3UploadSignInActivity.class);
+        intent.putExtra(PARAM_KEY_FOR_DISCONNECT, true);
+        return intent;
+    }
+
+    @NonNull
+    public static Intent getPlayServiceCheckIntent(@NonNull Context context) {
+        Intent intent = new Intent(context, GoogleV3UploadSignInActivity.class);
+        intent.putExtra(PARAM_KEY_CHECK_SERVICE_ONLY, true);
+        return intent;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        this.mPlayServiceDialogManager = new PlayServiceDialogManager();
+        this.mMisc = new Network();
+        this.mIprintGoogleSignIn = new IprintGoogleSignIn();
+        this.mWaitSingInProcess = false;
+        this.mActivityForeground = false;
+        this.mForegroundRunnableList = new LinkedList<>();
+        Intent intent = getIntent();
+        this.mStartForDisconnect = intent.getBooleanExtra(PARAM_KEY_FOR_DISCONNECT, false);
+        this.mCheckServiceOnly = intent.getBooleanExtra(PARAM_KEY_CHECK_SERVICE_ONLY, false);
+    }
+
+    /* access modifiers changed from: private */
+    public void showErrorDialog(final int i, final String str) {
+        if (!this.mActivityForeground) {
+            this.mForegroundRunnableList.addLast(new Runnable() {
+                public void run() {
+                    GoogleV3UploadSignInActivity.this.showErrorDialog(i, str);
+                }
+            });
+        } else {
+            OneButtonDialogFragment.newInstance(i, str).show(getSupportFragmentManager(), str);
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPostResume() {
+        super.onPostResume();
+        this.mMisc.selectSimpleAp(this, false);
+        this.mActivityForeground = true;
+        processForegroundList();
+        if (!this.mMisc.isOnline(this)) {
+            showErrorDialog(R.string.network_error_mes, DIALOG_TAG_OFFLINE_ERROR);
+        } else if (!this.mPlayServiceDialogManager.checkPlayService(this, this)) {
+            if (this.mCheckServiceOnly) {
+                finishWithResult(true);
+            } else if (!this.mWaitSingInProcess) {
+                this.mWaitSingInProcess = true;
+                if (this.mStartForDisconnect) {
+                    this.mIprintGoogleSignIn.disconnectAccount(this, this);
+                } else {
+                    this.mIprintGoogleSignIn.startSignIn(this, this, IprintGoogleSignIn.OperationType.UPLOAD);
+                }
+            }
+        }
+    }
+
+    private void processForegroundList() {
+        Iterator it = this.mForegroundRunnableList.iterator();
+        while (it.hasNext()) {
+            it.remove();
+            ((Runnable) it.next()).run();
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPause() {
+        super.onPause();
+        this.mPlayServiceDialogManager.onActivityPaused();
+        this.mActivityForeground = false;
+    }
+
+    public void requestSignIn(@NonNull Intent intent, @NonNull IprintGoogleSignIn.StartActivityResultCallback startActivityResultCallback) {
+        this.mSignInStartActivityCallback = startActivityResultCallback;
+        startActivityForResult(intent, 10);
+    }
+
+    public void playServiceInstallCancel() {
+        if (this.mCheckServiceOnly) {
+            finishWithResult(false);
+        } else {
+            showErrorDialog(R.string.authenticate_error_mes, DIALOG_TAG_SIGN_IN_FAILED);
+        }
+    }
+
+    public void buttonPressed(@Nullable String str) {
+        if (str != null) {
+            char c = 65535;
+            int hashCode = str.hashCode();
+            if (hashCode != -683930452) {
+                if (hashCode == 366991495 && str.equals(DIALOG_TAG_SIGN_IN_FAILED)) {
+                    c = 0;
+                }
+            } else if (str.equals(DIALOG_TAG_OFFLINE_ERROR)) {
+                c = 1;
+            }
+            switch (c) {
+                case 0:
+                    finishWithResult(false);
+                    return;
+                case 1:
+                    startActivity(new Intent("android.settings.WIRELESS_SETTINGS"));
+                    finishWithResult(false);
+                    return;
+                default:
+                    return;
+            }
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onActivityResult(int i, int i2, Intent intent) {
+        switch (i) {
+            case 10:
+                IprintGoogleSignIn.StartActivityResultCallback startActivityResultCallback = this.mSignInStartActivityCallback;
+                if (startActivityResultCallback != null) {
+                    startActivityResultCallback.onActivityResult(i2, intent);
+                    this.mSignInStartActivityCallback = null;
+                    return;
+                }
+                return;
+            case 11:
+                return;
+            case 12:
+                if (i2 == -1) {
+                    finishWithResult(true);
+                    return;
+                } else {
+                    showErrorDialog(R.string.authenticate_error_mes, DIALOG_TAG_SIGN_IN_FAILED);
+                    return;
+                }
+            default:
+                return;
+        }
+    }
+
+    public void onSignInComplete(boolean z, GoogleSignInAccount googleSignInAccount) {
+        if (z) {
+            finishWithResult(true);
+        } else {
+            showErrorDialog(R.string.authenticate_error_mes, DIALOG_TAG_SIGN_IN_FAILED);
+        }
+    }
+
+    public void onDisconnectCompleted() {
+        finishWithResult(true);
+    }
+
+    private void finishWithResult(boolean z) {
+        GoogleV3UploadClient.setSingInValue(z);
+        setResult(z ? -1 : 0);
+        finish();
+    }
+}

+ 24 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/Injection.java

@@ -0,0 +1,24 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import com.epson.iprint.storage.Network;
+import com.epson.iprint.storage.gdrivev3.GoogleDownloadContract;
+
+class Injection {
+    private static volatile DownloadPresenterFactory sDownloadPresenterFactory;
+
+    interface DownloadPresenterFactory {
+        GoogleDownloadPresenter createDownloadPresenter(@NonNull GoogleDownloadContract.View view);
+    }
+
+    static void setDownloadPresenterFactory(@Nullable DownloadPresenterFactory downloadPresenterFactory) {
+    }
+
+    Injection() {
+    }
+
+    static GoogleDownloadPresenter provideDownloadPresenter(@NonNull GoogleDownloadContract.View view) {
+        return new GoogleDownloadPresenter(new IprintGoogleSignIn(), new PlayServiceDialogManager(), new DownloaderWrapper(), new Network(), view);
+    }
+}

+ 108 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/IprintGoogleSignIn.java

@@ -0,0 +1,108 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import com.google.android.gms.auth.api.signin.GoogleSignIn;
+import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
+import com.google.android.gms.auth.api.signin.GoogleSignInClient;
+import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
+import com.google.android.gms.common.api.Scope;
+import com.google.android.gms.tasks.OnCompleteListener;
+import com.google.android.gms.tasks.OnFailureListener;
+import com.google.android.gms.tasks.OnSuccessListener;
+import com.google.android.gms.tasks.Task;
+
+public class IprintGoogleSignIn {
+
+    public enum OperationType {
+        DOWNLOAD,
+        UPLOAD
+    }
+
+    public interface SignInListener {
+        void onDisconnectCompleted();
+
+        void onSignInComplete(boolean z, GoogleSignInAccount googleSignInAccount);
+    }
+
+    public interface StartActivityResultCallback {
+        void onActivityResult(int i, Intent intent);
+    }
+
+    /* access modifiers changed from: private */
+    public static void handleLogin(Intent intent, final SignInListener signInListener) {
+        GoogleSignIn.getSignedInAccountFromIntent(intent).addOnSuccessListener(new OnSuccessListener<GoogleSignInAccount>() {
+            public void onSuccess(GoogleSignInAccount googleSignInAccount) {
+                signInListener.onSignInComplete(true, googleSignInAccount);
+            }
+        }).addOnFailureListener(new OnFailureListener() {
+            public void onFailure(@NonNull Exception exc) {
+                signInListener.onSignInComplete(false, (GoogleSignInAccount) null);
+            }
+        });
+    }
+
+    public void startSignIn(@NonNull final SignInListener signInListener, @NonNull ActivityWrapper activityWrapper, @NonNull OperationType operationType) {
+        if (getSignInAccount(activityWrapper.getActivity()) != null) {
+            addTargetScope(activityWrapper, operationType);
+        } else {
+            activityWrapper.requestSignIn(getSignInIntent(activityWrapper.getActivity(), operationType), new StartActivityResultCallback() {
+                public void onActivityResult(int i, Intent intent) {
+                    if (i != -1) {
+                        signInListener.onSignInComplete(false, (GoogleSignInAccount) null);
+                    } else {
+                        IprintGoogleSignIn.handleLogin(intent, signInListener);
+                    }
+                }
+            });
+        }
+    }
+
+    private void addTargetScope(@NonNull ActivityWrapper activityWrapper, @NonNull OperationType operationType) {
+        Scope targetScope = getTargetScope(operationType);
+        GoogleSignInAccount signInAccount = getSignInAccount(activityWrapper.getActivity());
+        GoogleSignIn.requestPermissions(activityWrapper.getActivity(), activityWrapper.getSingInAddScopeRequestCode(), signInAccount, targetScope);
+    }
+
+    @NonNull
+    private static Intent getSignInIntent(Activity activity, OperationType operationType) {
+        return getGoogleSignInClient(activity, operationType).getSignInIntent();
+    }
+
+    @NonNull
+    private static GoogleSignInClient getGoogleSignInClient(@NonNull Activity activity, OperationType operationType) {
+        return GoogleSignIn.getClient(activity, new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestEmail().requestScopes(getTargetScope(operationType), new Scope[0]).build());
+    }
+
+    @NonNull
+    private static Scope getTargetScope(OperationType operationType) {
+        if (operationType == OperationType.DOWNLOAD) {
+            return new Scope(GoogleDownloader.getTargetScope());
+        }
+        return new Scope(DriveWriter.getWriteScope());
+    }
+
+    public void disconnectAccount(@NonNull ActivityWrapper activityWrapper, @NonNull final SignInListener signInListener) {
+        getGoogleSignInClient(activityWrapper.getActivity(), OperationType.DOWNLOAD).revokeAccess().addOnCompleteListener(activityWrapper.getActivity(), new OnCompleteListener<Void>() {
+            public void onComplete(@NonNull Task<Void> task) {
+                signInListener.onDisconnectCompleted();
+            }
+        });
+    }
+
+    public boolean isSignInValid(@NonNull Context context, OperationType operationType) {
+        GoogleSignInAccount signInAccount = getSignInAccount(context);
+        if (signInAccount == null) {
+            return false;
+        }
+        return signInAccount.getGrantedScopes().contains(getTargetScope(operationType));
+    }
+
+    @Nullable
+    public GoogleSignInAccount getSignInAccount(@NonNull Context context) {
+        return GoogleSignIn.getLastSignedInAccount(context);
+    }
+}

+ 382 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/ListAndDownloadActivity.java

@@ -0,0 +1,382 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.graphics.Typeface;
+import android.os.Build;
+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.Fragment;
+import android.support.p000v4.app.FragmentManager;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ListView;
+import android.widget.TextView;
+import com.epson.iprint.prtlogger.PrintLog;
+import com.epson.iprint.storage.ConfirmCancelDialog;
+import com.epson.iprint.storage.LocalProgressDialog;
+import com.epson.iprint.storage.OneButtonDialogFragment;
+import com.epson.iprint.storage.StorageProcessDownloadActivity;
+import com.epson.iprint.storage.gdrivev3.GoogleDownloadContract;
+import com.epson.iprint.storage.gdrivev3.IprintGoogleSignIn;
+import epson.print.ActivityIACommon;
+import epson.print.R;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+public class ListAndDownloadActivity extends ActivityIACommon implements ActivityWrapper, GoogleDownloadContract.View, OneButtonDialogFragment.DialogCallback, ConfirmCancelDialog.DialogCancelListener {
+    private static final String DIALOG_TAG_CONFIRM_CANCEL = "confirm-cancel";
+    private static final String DIALOG_TAG_DOWNLOAD_FAILED = "download_failed";
+    private static final String DIALOG_TAG_OFFLINE_ERROR = "offline_error";
+    private static final String DIALOG_TAG_SIGN_IN_FAILED = "sign-in_failed";
+    private static final String FRAGMENT_TAG_PROGRESS = "fragment-progress";
+    private static final int REQUEST_CODE_CHECK_PLAY_SERVICE = 11;
+    private static final int REQUEST_CODE_DOWNLOAD_PREVIEW_END = 12;
+    private static final int REQUEST_CODE_SIGN_IN = 10;
+    private static final int REQUEST_CODE_SIGN_IN_ADD_SCOPE = 13;
+    private boolean mActivityForeground;
+    private FileListAdapter mFileListAdapter;
+    private LinkedList<Runnable> mForegroundRunnableList;
+    private GoogleDownloadContract.UserActionListener mGoogleDownloadPresenter;
+    private boolean mIsDownloadInterruption = false;
+    private ListView mListView;
+    /* access modifiers changed from: private */
+    public int mPosition = 0;
+    private TextView mSignInMessage;
+    private boolean mSignInOutButtonEnabled;
+    private int mSignInOutButtonType;
+    private IprintGoogleSignIn.StartActivityResultCallback mSignInStartActivityCallback;
+
+    @NonNull
+    public Activity getActivity() {
+        return this;
+    }
+
+    @NonNull
+    public ActivityWrapper getActivityWrapper() {
+        return this;
+    }
+
+    public int getPlayServiceRequestCode() {
+        return 11;
+    }
+
+    public int getSingInAddScopeRequestCode() {
+        return 13;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        setContentView((int) R.layout.activity_list_and_download);
+        setActionBar(getString(R.string.google_drive), true);
+        this.mGoogleDownloadPresenter = Injection.provideDownloadPresenter(this);
+        this.mSignInOutButtonEnabled = true;
+        this.mForegroundRunnableList = new LinkedList<>();
+        this.mListView = (ListView) findViewById(16908298);
+        this.mListView.setCacheColorHint(0);
+        this.mFileListAdapter = new FileListAdapter(getApplicationContext());
+        this.mListView.setAdapter(this.mFileListAdapter);
+        this.mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+            public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
+                int unused = ListAndDownloadActivity.this.mPosition = i;
+                ListAndDownloadActivity.this.localOnItemClick(i);
+            }
+        });
+        this.mSignInMessage = (TextView) findViewById(16908292);
+        this.mSignInMessage.setText(R.string.sign_in_request);
+        this.mSignInMessage.setTypeface((Typeface) null, 1);
+        this.mSignInMessage.setTextSize(18.0f);
+        if (bundle != null) {
+            clearFragments();
+        }
+        this.mGoogleDownloadPresenter.initView();
+    }
+
+    private void clearFragments() {
+        removeProgressIfExists();
+        deleteAllDialog();
+    }
+
+    private void deleteAllDialog() {
+        for (String dismissDialog : new String[]{DIALOG_TAG_SIGN_IN_FAILED, DIALOG_TAG_DOWNLOAD_FAILED, DIALOG_TAG_OFFLINE_ERROR, DIALOG_TAG_CONFIRM_CANCEL}) {
+            dismissDialog(dismissDialog);
+        }
+    }
+
+    /* access modifiers changed from: private */
+    public void dismissDialog(@NonNull final String str) {
+        if (!this.mActivityForeground) {
+            this.mForegroundRunnableList.addLast(new Runnable() {
+                public void run() {
+                    ListAndDownloadActivity.this.dismissDialog(str);
+                }
+            });
+            return;
+        }
+        Fragment findFragmentByTag = getSupportFragmentManager().findFragmentByTag(str);
+        if (findFragmentByTag != null) {
+            ((DialogFragment) findFragmentByTag).dismiss();
+        }
+    }
+
+    /* access modifiers changed from: private */
+    public void localOnItemClick(int i) {
+        OnlineFile driveItem = this.mFileListAdapter.getDriveItem(i);
+        if (driveItem != null) {
+            this.mGoogleDownloadPresenter.itemSelected(driveItem);
+        }
+    }
+
+    public boolean onOptionsItemSelected(MenuItem menuItem) {
+        switch (menuItem.getItemId()) {
+            case R.id.menu_signin /*2131231253*/:
+                this.mGoogleDownloadPresenter.signInOrDisconnectClicked();
+                return true;
+            case R.id.menu_signout /*2131231254*/:
+                this.mGoogleDownloadPresenter.signInOrDisconnectClicked();
+                return true;
+            default:
+                return super.onOptionsItemSelected(menuItem);
+        }
+    }
+
+    public boolean onCreateOptionsMenu(Menu menu) {
+        getMenuInflater().inflate(R.C2138menu.menu_sign_inout, menu);
+        if (this.mSignInOutButtonType == 0) {
+            menu.removeItem(R.id.menu_signout);
+            menu.findItem(R.id.menu_signin).setEnabled(this.mSignInOutButtonEnabled);
+            return true;
+        }
+        menu.removeItem(R.id.menu_signin);
+        menu.findItem(R.id.menu_signout).setEnabled(this.mSignInOutButtonEnabled);
+        return true;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onActivityResult(int i, int i2, Intent intent) {
+        switch (i) {
+            case 10:
+                IprintGoogleSignIn.StartActivityResultCallback startActivityResultCallback = this.mSignInStartActivityCallback;
+                if (startActivityResultCallback != null) {
+                    startActivityResultCallback.onActivityResult(i2, intent);
+                    this.mSignInStartActivityCallback = null;
+                    return;
+                }
+                return;
+            case 11:
+                return;
+            case 12:
+                this.mGoogleDownloadPresenter.onPreviewActivityEnd();
+                return;
+            case 13:
+                this.mGoogleDownloadPresenter.onAddScopeCompleted(i2 == -1);
+                return;
+            default:
+                return;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPostResume() {
+        super.onPostResume();
+        this.mActivityForeground = true;
+        processForegroundList();
+        this.mGoogleDownloadPresenter.activityOnResume();
+    }
+
+    private void processForegroundList() {
+        Iterator it = this.mForegroundRunnableList.iterator();
+        while (it.hasNext()) {
+            it.remove();
+            ((Runnable) it.next()).run();
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPause() {
+        super.onPause();
+        this.mGoogleDownloadPresenter.activityOnPause();
+        this.mActivityForeground = false;
+    }
+
+    public void onBackPressed() {
+        this.mGoogleDownloadPresenter.backKeyPressed();
+    }
+
+    public void requestSignIn(@NonNull Intent intent, @NonNull IprintGoogleSignIn.StartActivityResultCallback startActivityResultCallback) {
+        this.mSignInStartActivityCallback = startActivityResultCallback;
+        startActivityForResult(intent, 10);
+    }
+
+    public void setSignInButtonEnabled(boolean z) {
+        invalidateOptionsMenu();
+    }
+
+    public void changeSignInOutButton(int i) {
+        int i2 = 0;
+        this.mSignInMessage.setVisibility(i == 0 ? 0 : 8);
+        ListView listView = this.mListView;
+        if (i == 0) {
+            i2 = 8;
+        }
+        listView.setVisibility(i2);
+        this.mSignInOutButtonType = i;
+        invalidateOptionsMenu();
+    }
+
+    /* access modifiers changed from: private */
+    public void showErrorDialog(final int i, final String str) {
+        if (!this.mActivityForeground) {
+            this.mForegroundRunnableList.addLast(new Runnable() {
+                public void run() {
+                    ListAndDownloadActivity.this.showErrorDialog(i, str);
+                }
+            });
+        } else {
+            OneButtonDialogFragment.newInstance(i, str).show(getSupportFragmentManager(), str);
+        }
+    }
+
+    public void showSignInFailDialog() {
+        showErrorDialog(R.string.authenticate_error_mes, DIALOG_TAG_SIGN_IN_FAILED);
+    }
+
+    public void showDownloadErrorDialog() {
+        showErrorDialog(R.string.download_error_mes, DIALOG_TAG_DOWNLOAD_FAILED);
+    }
+
+    public void showOfflineErrorDialog() {
+        showErrorDialog(R.string.network_error_mes, DIALOG_TAG_OFFLINE_ERROR);
+    }
+
+    public void clearListItems() {
+        this.mFileListAdapter.clearItems();
+    }
+
+    public void showProgress() {
+        this.mSignInOutButtonEnabled = false;
+        invalidateOptionsMenu();
+        showProgressFragment(false, 0);
+    }
+
+    /* access modifiers changed from: private */
+    public void showProgressFragment(final boolean z, final int i) {
+        if (!this.mActivityForeground) {
+            this.mForegroundRunnableList.addLast(new Runnable() {
+                public void run() {
+                    ListAndDownloadActivity.this.showProgressFragment(z, i);
+                }
+            });
+            return;
+        }
+        FragmentManager supportFragmentManager = getSupportFragmentManager();
+        supportFragmentManager.beginTransaction().add(16908290, LocalProgressDialog.newInstance(z, i, DIALOG_TAG_CONFIRM_CANCEL), FRAGMENT_TAG_PROGRESS).commit();
+    }
+
+    public void showDownloadProgress() {
+        this.mSignInOutButtonEnabled = false;
+        invalidateOptionsMenu();
+        showProgressFragment(true, R.string.downloading_notification);
+    }
+
+    public void dismissProgress() {
+        dismissDialog(DIALOG_TAG_CONFIRM_CANCEL);
+        removeProgressIfExists();
+        this.mSignInOutButtonEnabled = true;
+        invalidateOptionsMenu();
+    }
+
+    public void listFiles(@Nullable ArrayList<OnlineFile> arrayList) {
+        if (arrayList == null) {
+            clearListItems();
+            showErrorDialog(R.string.unknow_error_mes, DIALOG_TAG_DOWNLOAD_FAILED);
+            return;
+        }
+        this.mFileListAdapter.setDriveFile(arrayList);
+    }
+
+    public void startPreviewActivity(String str) {
+        startActivityForResult(StorageProcessDownloadActivity.getPreviewIntent(str, getApplicationContext(), new PrintLog()), 12);
+    }
+
+    public void finishActivity() {
+        finish();
+    }
+
+    public void buttonPressed(@Nullable String str) {
+        if (str != null) {
+            char c = 65535;
+            int hashCode = str.hashCode();
+            if (hashCode != -683930452) {
+                if (hashCode != 156934100) {
+                    if (hashCode == 366991495 && str.equals(DIALOG_TAG_SIGN_IN_FAILED)) {
+                        c = 0;
+                    }
+                } else if (str.equals(DIALOG_TAG_DOWNLOAD_FAILED)) {
+                    c = 1;
+                }
+            } else if (str.equals(DIALOG_TAG_OFFLINE_ERROR)) {
+                c = 2;
+            }
+            switch (c) {
+                case 0:
+                    return;
+                case 1:
+                    return;
+                case 2:
+                    startActivity(new Intent("android.settings.WIRELESS_SETTINGS"));
+                    finish();
+                    return;
+                default:
+                    return;
+            }
+        }
+    }
+
+    public void cancel() {
+        this.mGoogleDownloadPresenter.cancelDownload();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onStop() {
+        super.onStop();
+        if (!this.mGoogleDownloadPresenter.isDownloading() || Build.VERSION.SDK_INT < 29) {
+            this.mIsDownloadInterruption = false;
+            return;
+        }
+        this.mIsDownloadInterruption = true;
+        cancel();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onRestart() {
+        super.onRestart();
+        if (this.mIsDownloadInterruption) {
+            localOnItemClick(this.mPosition);
+        }
+        this.mIsDownloadInterruption = false;
+    }
+
+    /* access modifiers changed from: private */
+    public void removeProgressIfExists() {
+        if (!this.mActivityForeground) {
+            this.mForegroundRunnableList.addLast(new Runnable() {
+                public void run() {
+                    ListAndDownloadActivity.this.removeProgressIfExists();
+                }
+            });
+            return;
+        }
+        FragmentManager supportFragmentManager = getSupportFragmentManager();
+        Fragment findFragmentByTag = supportFragmentManager.findFragmentByTag(FRAGMENT_TAG_PROGRESS);
+        if (findFragmentByTag != null) {
+            supportFragmentManager.beginTransaction().remove(findFragmentByTag).commit();
+        }
+    }
+}

+ 16 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/OnlineFile.java

@@ -0,0 +1,16 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.support.annotation.Nullable;
+
+public interface OnlineFile {
+    @Nullable
+    String getId();
+
+    String getMimeType();
+
+    String getName();
+
+    boolean isDisplayFile();
+
+    boolean isFolder();
+}

+ 26 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/ParentFolder.java

@@ -0,0 +1,26 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.support.annotation.Nullable;
+
+public class ParentFolder implements OnlineFile {
+    @Nullable
+    public String getId() {
+        return "..";
+    }
+
+    public String getMimeType() {
+        return GoogleDriveMimeType.MIME_TYPE_GOOGLE_FOLDER;
+    }
+
+    public String getName() {
+        return "..";
+    }
+
+    public boolean isDisplayFile() {
+        return true;
+    }
+
+    public boolean isFolder() {
+        return true;
+    }
+}

+ 49 - 0
app/src/main/java/com/epson/iprint/storage/gdrivev3/PlayServiceDialogManager.java

@@ -0,0 +1,49 @@
+package com.epson.iprint.storage.gdrivev3;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.support.annotation.NonNull;
+import com.google.android.gms.common.GoogleApiAvailability;
+
+public class PlayServiceDialogManager {
+    private Dialog mGooglePlayServiceDialog;
+
+    public interface SingInCancelNotifier {
+        void playServiceInstallCancel();
+    }
+
+    private boolean checkPlayService(@NonNull Activity activity, int i, @NonNull final SingInCancelNotifier singInCancelNotifier) {
+        Dialog dialog = this.mGooglePlayServiceDialog;
+        if (dialog != null && dialog.isShowing()) {
+            this.mGooglePlayServiceDialog.dismiss();
+        }
+        GoogleApiAvailability instance = GoogleApiAvailability.getInstance();
+        int isGooglePlayServicesAvailable = instance.isGooglePlayServicesAvailable(activity);
+        if (isGooglePlayServicesAvailable == 0) {
+            return false;
+        }
+        if (instance.isUserResolvableError(isGooglePlayServicesAvailable)) {
+            this.mGooglePlayServiceDialog = instance.getErrorDialog(activity, isGooglePlayServicesAvailable, i, new DialogInterface.OnCancelListener() {
+                public void onCancel(DialogInterface dialogInterface) {
+                    singInCancelNotifier.playServiceInstallCancel();
+                }
+            });
+            this.mGooglePlayServiceDialog.show();
+            return true;
+        }
+        singInCancelNotifier.playServiceInstallCancel();
+        return false;
+    }
+
+    public boolean checkPlayService(@NonNull ActivityWrapper activityWrapper, @NonNull SingInCancelNotifier singInCancelNotifier) {
+        return checkPlayService(activityWrapper.getActivity(), activityWrapper.getPlayServiceRequestCode(), singInCancelNotifier);
+    }
+
+    public void onActivityPaused() {
+        Dialog dialog = this.mGooglePlayServiceDialog;
+        if (dialog != null && dialog.isShowing()) {
+            this.mGooglePlayServiceDialog.dismiss();
+        }
+    }
+}

+ 59 - 0
app/src/main/java/com/epson/iprint/storage/onedrive/OneDriveAuthenticator.java

@@ -0,0 +1,59 @@
+package com.epson.iprint.storage.onedrive;
+
+import android.app.Activity;
+import android.content.Context;
+import com.epson.iprint.storage.SecureKeyStore;
+import com.onedrive.sdk.authentication.IAuthenticator;
+import com.onedrive.sdk.authentication.MSAAuthenticator;
+import com.onedrive.sdk.concurrency.ICallback;
+import com.onedrive.sdk.core.ClientException;
+import com.onedrive.sdk.core.DefaultClientConfig;
+import com.onedrive.sdk.extensions.IOneDriveClient;
+import com.onedrive.sdk.extensions.OneDriveClient;
+
+public class OneDriveAuthenticator {
+    protected static final String TAG = "OneDriveAuthenticator";
+
+    public interface OnOneDriveAuthenticatorListener {
+        void onNotifyOneDriveClient(IOneDriveClient iOneDriveClient);
+    }
+
+    public static void getOneDriveClient(Activity activity, final OnOneDriveAuthenticatorListener onOneDriveAuthenticatorListener) {
+        new OneDriveClient.Builder().fromConfig(DefaultClientConfig.createWithAuthenticator(getMSAAuthenticator(activity))).loginAndBuildClient(activity, new ICallback<IOneDriveClient>() {
+            public void success(IOneDriveClient iOneDriveClient) {
+                IAuthenticator authenticator;
+                if (!(iOneDriveClient == null || (authenticator = iOneDriveClient.getAuthenticator()) == null)) {
+                    OneDriveClient.saveToken(authenticator.getAccountInfo());
+                }
+                OnOneDriveAuthenticatorListener onOneDriveAuthenticatorListener = onOneDriveAuthenticatorListener;
+                if (onOneDriveAuthenticatorListener != null) {
+                    onOneDriveAuthenticatorListener.onNotifyOneDriveClient(iOneDriveClient);
+                }
+            }
+
+            public void failure(ClientException clientException) {
+                clientException.printStackTrace();
+                OnOneDriveAuthenticatorListener onOneDriveAuthenticatorListener = onOneDriveAuthenticatorListener;
+                if (onOneDriveAuthenticatorListener != null) {
+                    onOneDriveAuthenticatorListener.onNotifyOneDriveClient((IOneDriveClient) null);
+                }
+            }
+        });
+    }
+
+    private static MSAAuthenticator getMSAAuthenticator(final Context context) {
+        return new MSAAuthenticator() {
+            public String getClientId() {
+                return getMicrosoftAccountForOneDrive(context);
+            }
+
+            public String[] getScopes() {
+                return new String[]{"onedrive.readwrite", "offline_access"};
+            }
+
+            private String getMicrosoftAccountForOneDrive(Context context) {
+                return new SecureKeyStore().getApiKeyD(context);
+            }
+        };
+    }
+}

+ 745 - 0
app/src/main/java/com/epson/iprint/storage/onedrive/OneDriveClient.java

@@ -0,0 +1,745 @@
+package com.epson.iprint.storage.onedrive;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.AsyncTask;
+import android.support.annotation.NonNull;
+import android.support.p000v4.app.NotificationCompat;
+import com.box.androidsdk.content.models.BoxRepresentation;
+import com.epson.iprint.storage.StorageItem;
+import com.epson.iprint.storage.StorageSecureStore;
+import com.epson.iprint.storage.StorageServiceClient;
+import com.epson.iprint.storage.onedrive.OneDriveAuthenticator;
+import com.onedrive.sdk.authentication.IAccountInfo;
+import com.onedrive.sdk.concurrency.ChunkedUploadProvider;
+import com.onedrive.sdk.concurrency.ICallback;
+import com.onedrive.sdk.concurrency.IProgressCallback;
+import com.onedrive.sdk.core.ClientException;
+import com.onedrive.sdk.core.OneDriveErrorCodes;
+import com.onedrive.sdk.extensions.ChunkedUploadSessionDescriptor;
+import com.onedrive.sdk.extensions.IItemCollectionPage;
+import com.onedrive.sdk.extensions.IItemCollectionRequestBuilder;
+import com.onedrive.sdk.extensions.IOneDriveClient;
+import com.onedrive.sdk.extensions.Item;
+import com.onedrive.sdk.extensions.Shared;
+import com.onedrive.sdk.extensions.UploadSession;
+import com.onedrive.sdk.options.QueryOption;
+import epson.print.R;
+import epson.print.CommonDefine;
+import epson.server.utils.Define;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class OneDriveClient extends StorageServiceClient {
+    private static final String[] EXTENSIONS_IPRINT_SPEC = {"doc", "docx", "rtf", "xls", "xlsm", "xlsx", "ppt", "pptx", "pps", "ppsx"};
+    private static final String[] EXTENSIONS_ONEDRIVE_SPEC = {"doc", "docx", "epub", "eml", "htm", "html", "md", NotificationCompat.CATEGORY_MESSAGE, "odp", "ods", "odt", "pps", "ppsx", "ppt", "pptx", "rtf", "tif", "tiff", "xls", "xlsm", "xlsx"};
+    private static final String[] MIMETYPE_IPRINT_SPEC = {CommonDefine.DOC_TYPE_1, CommonDefine.DOCX_TYPE_2, CommonDefine.POWERPOINT_TYPE_1, "application/vnd.openxmlformats-officedocument.presentationml.slideshow", CommonDefine.POWERPOINT_TYPE_2, CommonDefine.RTF_TYPE, CommonDefine.EXCEL_TYPE_1, CommonDefine.EXCEL_TYPE_2, "application/vnd.ms-excel.sheet.macroEnabled.12"};
+    protected static final String TAG = "OneDriveClient";
+    /* access modifiers changed from: private */
+    public List<StorageItem> mStorageItemList;
+    /* access modifiers changed from: private */
+    public StorageServiceClient.ProcessError mUploadProcessError;
+    /* access modifiers changed from: private */
+    public IOneDriveClient oneDriveClient;
+
+    public interface OnOneDriveClientListener {
+        void onNotifyOneDriveClientCollectionPage(List<StorageItem> list);
+    }
+
+    /* access modifiers changed from: protected */
+    public boolean isNeedSignin() {
+        return true;
+    }
+
+    public boolean isSupportedUploadType(StorageServiceClient.UploadFileType uploadFileType) {
+        return false;
+    }
+
+    public OneDriveClient() {
+        resetUploadProcessError();
+    }
+
+    public StorageServiceClient.ProcessError getUploadProcessError() {
+        return this.mUploadProcessError;
+    }
+
+    public void resetUploadProcessError() {
+        this.mUploadProcessError = StorageServiceClient.ProcessError.NONE;
+    }
+
+    public StorageServiceClient.Uploader getUploader(Context context, StorageServiceClient.UploadFileType uploadFileType, String str, String str2) {
+        return new OneDriveUploader(context, uploadFileType, str, str2);
+    }
+
+    public StorageServiceClient.Downloader getDownloader(Context context, StorageItem storageItem, String str) {
+        return new OneDriveDownloader(context, storageItem, str);
+    }
+
+    public StorageServiceClient.Enumerator getEnumerator(final Context context) {
+        return new StorageServiceClient.Enumerator() {
+            public void enumerate(StorageItem storageItem, StorageServiceClient.EnumerateCompletion enumerateCompletion) {
+            }
+
+            public StorageItem getRootItem() {
+                return new StorageItem("", "", StorageItem.ItemType.DIRECTORY, (Object) null);
+            }
+
+            public void enumerate(StorageItem storageItem, final StorageServiceClient.EnumerateCompletion enumerateCompletion, final StorageServiceClient.SigninCompletion signinCompletion) {
+                if (storageItem.path.isEmpty()) {
+                    OneDriveClient.this.getClient((Activity) context, new OneDriveAuthenticator.OnOneDriveAuthenticatorListener() {
+                        public void onNotifyOneDriveClient(IOneDriveClient iOneDriveClient) {
+                            if (iOneDriveClient != null) {
+                                StorageServiceClient.SigninCompletion signinCompletion = signinCompletion;
+                                if (signinCompletion != null) {
+                                    signinCompletion.onSigninCompletion();
+                                }
+                                OneDriveClient.this.getRootFolder(iOneDriveClient, enumerateCompletion);
+                                return;
+                            }
+                            enumerateCompletion.onEnumerateComplete(OneDriveClient.this.mStorageItemList, StorageServiceClient.ProcessError.ERROR);
+                        }
+                    });
+                    return;
+                }
+                String str = ((Item) storageItem.userInfo).f323id;
+                OneDriveClient oneDriveClient = OneDriveClient.this;
+                oneDriveClient.getItems(oneDriveClient.oneDriveClient, str, enumerateCompletion);
+            }
+        };
+    }
+
+    public boolean isSignedIn(Context context) {
+        return StorageSecureStore.getSharedSecureStore().fetch(Define.ONEDRIVE_TOKEN) != null;
+    }
+
+    public boolean revokeSignedInData(Activity activity) {
+        StorageSecureStore.getSharedSecureStore().revoke(Define.ONEDRIVE_TOKEN);
+        IOneDriveClient iOneDriveClient = this.oneDriveClient;
+        if (iOneDriveClient == null) {
+            return false;
+        }
+        logOut(iOneDriveClient, new ICallback<Void>() {
+            public void success(Void voidR) {
+                IOneDriveClient unused = OneDriveClient.this.oneDriveClient = null;
+            }
+
+            public void failure(ClientException clientException) {
+                clientException.printStackTrace();
+                IOneDriveClient unused = OneDriveClient.this.oneDriveClient = null;
+            }
+        });
+        return false;
+    }
+
+    public String getStorageServiceName(Context context) {
+        return context.getString(R.string.onedrive);
+    }
+
+    /* access modifiers changed from: private */
+    public void getItems(IOneDriveClient iOneDriveClient, String str, StorageServiceClient.EnumerateCompletion enumerateCompletion) {
+        this.mStorageItemList = new ArrayList();
+        getItem(iOneDriveClient, str, getCallbackItemCollectionPage(enumerateCompletion));
+    }
+
+    private ICallback<IItemCollectionPage> getCallbackItemCollectionPage(final StorageServiceClient.EnumerateCompletion enumerateCompletion) {
+        return getCallbackCollectionPage(new OnOneDriveClientListener() {
+            public void onNotifyOneDriveClientCollectionPage(List<StorageItem> list) {
+                if (list != null) {
+                    list = OneDriveClient.this.getPrintableItems(list);
+                }
+                enumerateCompletion.onEnumerateComplete(list, list != null ? StorageServiceClient.ProcessError.NONE : StorageServiceClient.ProcessError.ERROR);
+            }
+        });
+    }
+
+    private void debug_list(List<StorageItem> list) {
+        for (StorageItem storageItem : list) {
+            getItemPhotos((Item) storageItem.userInfo);
+        }
+    }
+
+    /* access modifiers changed from: private */
+    public List<StorageItem> getPrintableItems(List<StorageItem> list) {
+        ArrayList arrayList = new ArrayList();
+        for (StorageItem next : list) {
+            if (next.type != StorageItem.ItemType.FILE || isPrintableFileTypes(next) || isConvertPdfExtension((Item) next.userInfo) || isConvertPdfMimeType((Item) next.userInfo)) {
+                arrayList.add(next);
+            }
+        }
+        return arrayList;
+    }
+
+    /* access modifiers changed from: private */
+    public ICallback<IItemCollectionPage> getCallbackCollectionPage(final OnOneDriveClientListener onOneDriveClientListener) {
+        return new ICallback<IItemCollectionPage>() {
+            public void success(IItemCollectionPage iItemCollectionPage) {
+                if (iItemCollectionPage != null) {
+                    List currentPage = iItemCollectionPage.getCurrentPage();
+                    if (currentPage != null) {
+                        for (int i = 0; i < currentPage.size(); i++) {
+                            StorageItem access$600 = OneDriveClient.this.getStorageItem((Item) currentPage.get(i));
+                            if (access$600 != null) {
+                                OneDriveClient.this.mStorageItemList.add(access$600);
+                            }
+                        }
+                        if (iItemCollectionPage.getNextPage() != null) {
+                            OneDriveClient oneDriveClient = OneDriveClient.this;
+                            oneDriveClient.getNextPage(iItemCollectionPage, oneDriveClient.getCallbackCollectionPage(onOneDriveClientListener));
+                            return;
+                        }
+                        result(OneDriveClient.this.mStorageItemList);
+                        return;
+                    }
+                    result((List<StorageItem>) null);
+                    return;
+                }
+                result((List<StorageItem>) null);
+            }
+
+            public void failure(ClientException clientException) {
+                clientException.printStackTrace();
+                result((List<StorageItem>) null);
+            }
+
+            private void result(List<StorageItem> list) {
+                OnOneDriveClientListener onOneDriveClientListener = onOneDriveClientListener;
+                if (onOneDriveClientListener != null) {
+                    onOneDriveClientListener.onNotifyOneDriveClientCollectionPage(list);
+                }
+            }
+        };
+    }
+
+    /* access modifiers changed from: private */
+    public StorageItem getStorageItem(Item item) {
+        StorageItem storageItem = new StorageItem();
+        storageItem.name = item.name;
+        storageItem.path = File.separator + item.name;
+        storageItem.userInfo = item;
+        if (item.folder != null) {
+            storageItem.type = StorageItem.ItemType.DIRECTORY;
+        } else if (item.file != null) {
+            storageItem.type = StorageItem.ItemType.FILE;
+        } else if (item.image != null) {
+            storageItem.type = StorageItem.ItemType.FILE;
+        } else if (item.photo == null) {
+            return null;
+        } else {
+            storageItem.type = StorageItem.ItemType.FILE;
+        }
+        return storageItem;
+    }
+
+    private void getRoot(IOneDriveClient iOneDriveClient, ICallback<Item> iCallback) {
+        iOneDriveClient.getDrive().getRoot().buildRequest().get(iCallback);
+    }
+
+    private void getItem(IOneDriveClient iOneDriveClient, String str, ICallback<IItemCollectionPage> iCallback) {
+        iOneDriveClient.getDrive().getItems(str).getChildren().buildRequest().get(iCallback);
+    }
+
+    /* access modifiers changed from: private */
+    public void getNextPage(IItemCollectionPage iItemCollectionPage, ICallback<IItemCollectionPage> iCallback) {
+        ((IItemCollectionRequestBuilder) iItemCollectionPage.getNextPage()).buildRequest().get(iCallback);
+    }
+
+    /* access modifiers changed from: private */
+    public UploadSession getUploadSession(IOneDriveClient iOneDriveClient, String str) {
+        return iOneDriveClient.getDrive().getRoot().getItemWithPath(str).getCreateSession(new ChunkedUploadSessionDescriptor()).buildRequest().post();
+    }
+
+    /* access modifiers changed from: private */
+    public void uploadLargeFile(UploadSession uploadSession, InputStream inputStream, int i, IProgressCallback<Item> iProgressCallback) {
+        ChunkedUploadProvider createUploadProvider;
+        QueryOption queryOption = new QueryOption("@name.conflictBehavior", "rename");
+        if (uploadSession != null && (createUploadProvider = uploadSession.createUploadProvider(this.oneDriveClient, inputStream, i, Item.class)) != null) {
+            try {
+                createUploadProvider.upload(Collections.singletonList(queryOption), iProgressCallback, 655360, 5);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    /* access modifiers changed from: private */
+    public InputStream getDownloadInputStream(IOneDriveClient iOneDriveClient, String str) {
+        return iOneDriveClient.getDrive().getItems(str).getContent().buildRequest().get();
+    }
+
+    /* access modifiers changed from: private */
+    public InputStream getDownloadInputStreamPdf(IOneDriveClient iOneDriveClient, String str) {
+        return iOneDriveClient.getDrive().getItems(str).getContent().buildRequest(Collections.singletonList(new QueryOption("format", BoxRepresentation.TYPE_PDF))).get();
+    }
+
+    private void logOut(IOneDriveClient iOneDriveClient, ICallback<Void> iCallback) {
+        iOneDriveClient.getAuthenticator().logout(iCallback);
+    }
+
+    public static void saveToken(IAccountInfo iAccountInfo) {
+        String accessToken;
+        if (iAccountInfo != null && (accessToken = iAccountInfo.getAccessToken()) != null && !accessToken.isEmpty()) {
+            StorageSecureStore.getSharedSecureStore().put(Define.ONEDRIVE_TOKEN, accessToken, StorageSecureStore.EXEC_MODE.OVERWRITE_IF_EXIST);
+        }
+    }
+
+    public boolean isSessionExpired() {
+        IOneDriveClient iOneDriveClient = this.oneDriveClient;
+        if (iOneDriveClient != null) {
+            return isExpired(iOneDriveClient);
+        }
+        return true;
+    }
+
+    /* access modifiers changed from: private */
+    public boolean isExpired(IOneDriveClient iOneDriveClient) {
+        return iOneDriveClient.getAuthenticator().getAccountInfo().isExpired();
+    }
+
+    /* access modifiers changed from: private */
+    public void getClient(Activity activity, OneDriveAuthenticator.OnOneDriveAuthenticatorListener onOneDriveAuthenticatorListener) {
+        IOneDriveClient iOneDriveClient = this.oneDriveClient;
+        if (iOneDriveClient == null) {
+            getOneDriveClient(activity, onOneDriveAuthenticatorListener);
+        } else if (onOneDriveAuthenticatorListener != null) {
+            onOneDriveAuthenticatorListener.onNotifyOneDriveClient(iOneDriveClient);
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public void getOneDriveClient(Activity activity, final OneDriveAuthenticator.OnOneDriveAuthenticatorListener onOneDriveAuthenticatorListener) {
+        OneDriveAuthenticator.getOneDriveClient(activity, new OneDriveAuthenticator.OnOneDriveAuthenticatorListener() {
+            public void onNotifyOneDriveClient(IOneDriveClient iOneDriveClient) {
+                IOneDriveClient unused = OneDriveClient.this.oneDriveClient = iOneDriveClient;
+                OneDriveAuthenticator.OnOneDriveAuthenticatorListener onOneDriveAuthenticatorListener = onOneDriveAuthenticatorListener;
+                if (onOneDriveAuthenticatorListener != null) {
+                    onOneDriveAuthenticatorListener.onNotifyOneDriveClient(OneDriveClient.this.oneDriveClient);
+                }
+            }
+        });
+    }
+
+    private void getRootFolder(Activity activity, final StorageServiceClient.EnumerateCompletion enumerateCompletion) {
+        getClient(activity, new OneDriveAuthenticator.OnOneDriveAuthenticatorListener() {
+            public void onNotifyOneDriveClient(IOneDriveClient iOneDriveClient) {
+                if (iOneDriveClient != null) {
+                    OneDriveClient.this.getRootFolder(iOneDriveClient, enumerateCompletion);
+                } else {
+                    enumerateCompletion.onEnumerateComplete(OneDriveClient.this.mStorageItemList, StorageServiceClient.ProcessError.ERROR);
+                }
+            }
+        });
+    }
+
+    /* access modifiers changed from: private */
+    public void getRootFolder(final IOneDriveClient iOneDriveClient, final StorageServiceClient.EnumerateCompletion enumerateCompletion) {
+        getRoot(iOneDriveClient, new ICallback<Item>() {
+            public void success(Item item) {
+                if (item != null) {
+                    OneDriveClient.this.getItems(iOneDriveClient, item.f323id, enumerateCompletion);
+                } else {
+                    enumerateCompletion.onEnumerateComplete(OneDriveClient.this.mStorageItemList, StorageServiceClient.ProcessError.ERROR);
+                }
+            }
+
+            public void failure(ClientException clientException) {
+                clientException.printStackTrace();
+                enumerateCompletion.onEnumerateComplete(OneDriveClient.this.mStorageItemList, StorageServiceClient.ProcessError.ERROR);
+            }
+        });
+    }
+
+    /* access modifiers changed from: private */
+    public boolean isConvertPdfExtension(Item item) {
+        int lastIndexOf;
+        if (item != null && item.name != null && !item.name.isEmpty() && (lastIndexOf = item.name.lastIndexOf(CommonDefine.DOT)) > 0) {
+            String substring = item.name.substring(lastIndexOf + 1);
+            for (String equalsIgnoreCase : EXTENSIONS_IPRINT_SPEC) {
+                if (substring.equalsIgnoreCase(equalsIgnoreCase)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    /* access modifiers changed from: private */
+    public boolean isConvertPdfMimeType(Item item) {
+        if (!(item == null || item.file == null || item.file.mimeType == null)) {
+            for (String equalsIgnoreCase : MIMETYPE_IPRINT_SPEC) {
+                if (item.file.mimeType.equalsIgnoreCase(equalsIgnoreCase)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    /* access modifiers changed from: private */
+    public String getConvertPdfName(String str) {
+        if (str == null || str.isEmpty()) {
+            return "";
+        }
+        int lastIndexOf = str.lastIndexOf(CommonDefine.DOT);
+        if (lastIndexOf > 0) {
+            return str.substring(0, lastIndexOf) + CommonDefine.FileType_PDF;
+        }
+        return str + CommonDefine.FileType_PDF;
+    }
+
+    private String getItemPhotos(Item item) {
+        String str = "";
+        if (item == null) {
+            return str;
+        }
+        if (item.name != null) {
+            str = str + " name: " + item.name;
+        }
+        if (item.size != null) {
+            str = str + " size: " + item.size;
+        }
+        if (item.file != null) {
+            if (item.file.mimeType != null) {
+                str = str + " mimeType: " + item.file.mimeType;
+            }
+            str = str + " -FILE- ";
+        }
+        if (item.folder != null) {
+            str = str + " -FOLDER- ";
+        }
+        if (item.image != null) {
+            str = str + " -IMAGE- ";
+        }
+        if (item.photo == null) {
+            return str;
+        }
+        return str + " -PHOTO- ";
+    }
+
+    private String getItemDetails(Item item) {
+        String str = "";
+        if (item != null) {
+            if (item.name != null) {
+                str = str + " name: " + item.name;
+            }
+            if (item.size != null) {
+                str = str + " size: " + item.size;
+            }
+            if (!(item.file == null || item.file.mimeType == null)) {
+                str = str + " mimeType: " + item.file.mimeType;
+            }
+            if (!(item.folder == null || item.folder.childCount == null)) {
+                str = str + " childCount: " + item.folder.childCount;
+            }
+            if (item.image != null) {
+                if (item.image.width != null) {
+                    str = str + " width: " + item.image.width;
+                }
+                if (item.image.height != null) {
+                    str = str + " height: " + item.image.height;
+                }
+            }
+            if (item.audio != null) {
+                if (item.audio.title != null) {
+                    str = str + " title: " + item.audio.title;
+                }
+                if (item.audio.artist != null) {
+                    str = str + " artist: " + item.audio.artist;
+                }
+                if (item.audio.bitrate != null) {
+                    str = str + " bitrate: " + item.audio.bitrate;
+                }
+            }
+            if (item.photo != null) {
+                if (item.photo.cameraMake != null) {
+                    str = str + " cameraMake: " + item.photo.cameraMake;
+                }
+                if (item.photo.cameraModel != null) {
+                    str = str + " cameraModel: " + item.photo.cameraModel;
+                }
+                if (item.photo.exposureDenominator != null) {
+                    str = str + " exposureDenominator: " + item.photo.exposureDenominator;
+                }
+                if (item.photo.exposureNumerator != null) {
+                    str = str + " exposureNumerator: " + item.photo.exposureNumerator;
+                }
+                if (item.photo.fNumber != null) {
+                    str = str + " fNumber: " + item.photo.fNumber;
+                }
+                if (item.photo.focalLength != null) {
+                    str = str + " focalLength: " + item.photo.focalLength;
+                }
+                if (item.photo.iso != null) {
+                    str = str + " iso: " + item.photo.iso;
+                }
+            }
+            if (item.video != null) {
+                if (item.video.width != null) {
+                    str = str + " width: " + item.video.width;
+                }
+                if (item.video.height != null) {
+                    str = str + " height: " + item.video.height;
+                }
+            }
+            if (!(item.createdBy == null || item.createdBy.application == null || item.createdBy.application.displayName == null)) {
+                str = str + " createdBy-displayName: " + item.createdBy.application.displayName;
+            }
+            if (!(item.lastModifiedBy == null || item.lastModifiedBy.application == null || item.lastModifiedBy.application.displayName == null)) {
+                str = str + " lastModifiedBy-displayName: " + item.lastModifiedBy.application.displayName;
+            }
+            if (!(item.parentReference == null || item.parentReference.path == null)) {
+                str = str + " parentReference-path: " + item.parentReference.path;
+            }
+            Shared shared = item.shared;
+        }
+        return str;
+    }
+
+    class OneDriveDownloader extends StorageServiceClient.Downloader {
+        /* access modifiers changed from: private */
+        public String mItemid;
+        /* access modifiers changed from: private */
+        public StorageItem mStorageItem;
+        private DownloadThread mThread = null;
+        /* access modifiers changed from: private */
+        public String mWriteFilename;
+
+        public boolean isCancelable() {
+            return true;
+        }
+
+        OneDriveDownloader(Context context, StorageItem storageItem, String str) {
+            super();
+            this.mStorageItem = storageItem;
+            this.mItemid = ((Item) storageItem.userInfo).f323id;
+            this.mWriteFilename = str;
+        }
+
+        public void start(StorageServiceClient.DownloadCompletion downloadCompletion) {
+            this.mThread = new DownloadThread(downloadCompletion);
+            this.mThread.start();
+        }
+
+        public void cancel() {
+            DownloadThread downloadThread = this.mThread;
+            if (downloadThread != null) {
+                downloadThread.cancel();
+            }
+        }
+
+        class DownloadThread extends Thread {
+            private volatile boolean bCanceled;
+            private boolean bConvertPdf;
+            private StorageServiceClient.DownloadCompletion downloaded;
+            private InputStream inputStream;
+
+            DownloadThread(StorageServiceClient.DownloadCompletion downloadCompletion) {
+                this.downloaded = downloadCompletion;
+            }
+
+            public void run() {
+                this.inputStream = null;
+                boolean z = false;
+                this.bCanceled = false;
+                this.bConvertPdf = OneDriveClient.this.isConvertPdfExtension((Item) OneDriveDownloader.this.mStorageItem.userInfo) || OneDriveClient.this.isConvertPdfMimeType((Item) OneDriveDownloader.this.mStorageItem.userInfo);
+                if (this.bConvertPdf && !this.bCanceled) {
+                    try {
+                        this.inputStream = OneDriveClient.this.getDownloadInputStreamPdf(OneDriveClient.this.oneDriveClient, OneDriveDownloader.this.mItemid);
+                    } catch (ClientException e) {
+                        e.printStackTrace();
+                        if (e.isError(OneDriveErrorCodes.NotSupported)) {
+                            this.bConvertPdf = this.inputStream != null;
+                        } else {
+                            this.bConvertPdf = this.inputStream != null;
+                        }
+                    }
+                }
+                if (!this.bConvertPdf && !this.bCanceled) {
+                    try {
+                        this.inputStream = OneDriveClient.this.getDownloadInputStream(OneDriveClient.this.oneDriveClient, OneDriveDownloader.this.mItemid);
+                    } catch (ClientException e2) {
+                        e2.printStackTrace();
+                        this.inputStream = null;
+                    }
+                }
+                String access$1600 = this.bConvertPdf ? OneDriveClient.this.getConvertPdfName(OneDriveDownloader.this.mWriteFilename) : OneDriveDownloader.this.mWriteFilename;
+                if (this.inputStream != null && !this.bCanceled) {
+                    try {
+                        File file = new File(access$1600);
+                        if (!file.exists()) {
+                            file.getParentFile().mkdirs();
+                        }
+                        FileOutputStream fileOutputStream = new FileOutputStream(file, false);
+                        byte[] bArr = new byte[1048576];
+                        while (true) {
+                            try {
+                                int read = this.inputStream.read(bArr);
+                                if (read != -1 && !this.bCanceled) {
+                                    fileOutputStream.write(bArr, 0, read);
+                                }
+                            } catch (IOException e3) {
+                                e3.printStackTrace();
+                            }
+                        }
+                        z = !this.bCanceled;
+                        try {
+                            fileOutputStream.close();
+                        } catch (IOException e4) {
+                            e4.printStackTrace();
+                        }
+                    } catch (IOException e5) {
+                        e5.printStackTrace();
+                    }
+                }
+                closeStream();
+                this.downloaded.onDownloadComplete(OneDriveDownloader.this.mStorageItem, access$1600, z ? StorageServiceClient.ProcessError.NONE : this.bCanceled ? StorageServiceClient.ProcessError.CANCELED : StorageServiceClient.ProcessError.ERROR);
+            }
+
+            private void closeStream() {
+                try {
+                    if (this.inputStream != null) {
+                        this.inputStream.close();
+                        this.inputStream = null;
+                    }
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+
+            public void cancel() {
+                this.bCanceled = true;
+            }
+        }
+    }
+
+    class OneDriveUploader extends StorageServiceClient.Uploader {
+        private Activity mActivity;
+        private LocalUploader mLocalUploader;
+        private String mOrgFilePath;
+        private String mUploadPath;
+
+        public boolean isCancelable() {
+            return true;
+        }
+
+        OneDriveUploader(Context context, StorageServiceClient.UploadFileType uploadFileType, String str, String str2) {
+            super();
+            this.mActivity = (Activity) context;
+            this.mOrgFilePath = str;
+            this.mUploadPath = str2;
+        }
+
+        public void start(StorageServiceClient.UploadCompletion uploadCompletion) {
+            StorageServiceClient.ProcessError unused = OneDriveClient.this.mUploadProcessError = StorageServiceClient.ProcessError.NONE;
+            OneDriveClient oneDriveClient = OneDriveClient.this;
+            if (!oneDriveClient.isExpired(oneDriveClient.oneDriveClient)) {
+                this.mLocalUploader = new LocalUploader(this.mActivity, this.mOrgFilePath, this.mUploadPath, uploadCompletion);
+                AsyncTask.THREAD_POOL_EXECUTOR.execute(this.mLocalUploader);
+                return;
+            }
+            StorageServiceClient.ProcessError unused2 = OneDriveClient.this.mUploadProcessError = StorageServiceClient.ProcessError.RETRY;
+            uploadCompletion.onUploadComplete("", "", StorageServiceClient.ProcessError.RETRY);
+        }
+
+        public void cancel() {
+            super.cancel();
+            this.mLocalUploader.cancel();
+        }
+    }
+
+    private class LocalUploader implements Runnable {
+        /* access modifiers changed from: private */
+        public volatile boolean bCanceled = false;
+        private FileInputStream fileInputStream;
+        private StorageServiceClient.UploadCompletion mNotifier;
+        private String mOrgFilePath;
+        private String mUploadFilename;
+        /* access modifiers changed from: private */
+        public boolean result = true;
+        private UploadSession uploadSession;
+
+        LocalUploader(Activity activity, String str, String str2, @NonNull StorageServiceClient.UploadCompletion uploadCompletion) {
+            this.mOrgFilePath = str;
+            this.mUploadFilename = str2;
+            this.mNotifier = uploadCompletion;
+        }
+
+        public void run() {
+            this.bCanceled = false;
+            this.result = false;
+            if (!(this.mOrgFilePath == null || this.mUploadFilename == null || this.bCanceled)) {
+                this.fileInputStream = null;
+                try {
+                    this.fileInputStream = new FileInputStream(this.mOrgFilePath);
+                    try {
+                        int available = this.fileInputStream.available();
+                        if (available > 0 && !this.bCanceled) {
+                            upload(available);
+                        }
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                } catch (FileNotFoundException e2) {
+                    e2.printStackTrace();
+                } catch (Throwable th) {
+                    closefile();
+                    throw th;
+                }
+                closefile();
+            }
+            this.mNotifier.onUploadComplete(this.mOrgFilePath, this.mUploadFilename, this.result ? StorageServiceClient.ProcessError.NONE : this.bCanceled ? StorageServiceClient.ProcessError.CANCELED : StorageServiceClient.ProcessError.ERROR);
+        }
+
+        private void upload(int i) {
+            this.uploadSession = null;
+            try {
+                this.uploadSession = OneDriveClient.this.getUploadSession(OneDriveClient.this.oneDriveClient, "/Epson iPrint/" + this.mUploadFilename);
+            } catch (ClientException e) {
+                e.printStackTrace();
+            }
+            UploadSession uploadSession2 = this.uploadSession;
+            if (uploadSession2 != null) {
+                OneDriveClient.this.uploadLargeFile(uploadSession2, this.fileInputStream, i, new IProgressCallback<Item>() {
+                    public void success(Item item) {
+                        boolean unused = LocalUploader.this.result = true;
+                    }
+
+                    public void failure(ClientException clientException) {
+                        clientException.printStackTrace();
+                    }
+
+                    public void progress(long j, long j2) {
+                        if (LocalUploader.this.bCanceled) {
+                            LocalUploader.this.uploadcancel();
+                        }
+                    }
+                });
+            }
+        }
+
+        /* access modifiers changed from: private */
+        public void uploadcancel() {
+            closefile();
+        }
+
+        private void closefile() {
+            try {
+                if (this.fileInputStream != null) {
+                    this.fileInputStream.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+
+        public void cancel() {
+            this.bCanceled = true;
+        }
+    }
+}

+ 33 - 0
app/src/main/java/com/epson/iprint/storage/onedrive/OneDriveSignInActivity.java

@@ -0,0 +1,33 @@
+package com.epson.iprint.storage.onedrive;
+
+import com.epson.iprint.storage.StorageSignInActivity;
+import com.epson.iprint.storage.onedrive.OneDriveAuthenticator;
+import com.onedrive.sdk.extensions.IOneDriveClient;
+
+public class OneDriveSignInActivity extends StorageSignInActivity {
+    protected static final String TAG = "OneDriveSignInActivity";
+    private boolean mAuthActivityStarted;
+
+    public StorageSignInActivity.BasicSignIn getBasicSignIn() {
+        return null;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onResume() {
+        super.onResume();
+        if (!this.mAuthActivityStarted) {
+            OneDriveAuthenticator.getOneDriveClient(this, new OneDriveAuthenticator.OnOneDriveAuthenticatorListener() {
+                public void onNotifyOneDriveClient(IOneDriveClient iOneDriveClient) {
+                    if (iOneDriveClient != null) {
+                        OneDriveSignInActivity.this.finish();
+                    } else {
+                        OneDriveSignInActivity.this.showLoginErrorAndFinish();
+                    }
+                }
+            });
+            this.mAuthActivityStarted = true;
+            return;
+        }
+        finish();
+    }
+}

+ 69 - 0
app/src/main/java/com/epson/iprint/storage/onedrive/OneDriveStorageProcessUploadActivity.java

@@ -0,0 +1,69 @@
+package com.epson.iprint.storage.onedrive;
+
+import android.content.Context;
+import android.content.Intent;
+import android.widget.Button;
+import com.epson.iprint.storage.StorageProcessActivity;
+import com.epson.iprint.storage.StorageProcessUploadActivity;
+import com.epson.iprint.storage.StorageServiceClient;
+import com.epson.iprint.storage.onedrive.OneDriveAuthenticator;
+import com.onedrive.sdk.extensions.IOneDriveClient;
+import epson.print.R;
+
+public class OneDriveStorageProcessUploadActivity extends StorageProcessUploadActivity {
+    protected static final String TAG = "OneDriveStorageProcessUploadActivity";
+    boolean mExpired;
+    /* access modifiers changed from: private */
+    public OneDriveClient mStorageServiceClient;
+
+    /* access modifiers changed from: protected */
+    public void onStart() {
+        super.onStart();
+        this.mExpired = false;
+        checkSession();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onResume() {
+        super.onResume();
+        this.mExpired = false;
+        OneDriveClient oneDriveClient = this.mStorageServiceClient;
+        if (oneDriveClient != null && oneDriveClient.getUploadProcessError().equals(StorageServiceClient.ProcessError.RETRY)) {
+            this.mExpired = true;
+            checkSession();
+        }
+    }
+
+    private void checkSession() {
+        if (isConnected()) {
+            this.mStorageServiceClient = (OneDriveClient) getStorageClient();
+            if (this.mStorageServiceClient.isSignedIn(this) && this.mStorageServiceClient.isSessionExpired()) {
+                new Thread() {
+                    public void run() {
+                        super.run();
+                        OneDriveStorageProcessUploadActivity.this.mStorageServiceClient.getOneDriveClient(OneDriveStorageProcessUploadActivity.this, new OneDriveAuthenticator.OnOneDriveAuthenticatorListener() {
+                            public void onNotifyOneDriveClient(IOneDriveClient iOneDriveClient) {
+                                OneDriveStorageProcessUploadActivity.this.findViewById(R.id.folder_content_layout_for_upload).setVisibility(0);
+                                if (iOneDriveClient == null) {
+                                    OneDriveStorageProcessUploadActivity.this.mStorageServiceClient.revokeSignedInData(OneDriveStorageProcessUploadActivity.this);
+                                    OneDriveStorageProcessUploadActivity.this.updateSignInStatus();
+                                } else if (OneDriveStorageProcessUploadActivity.this.mExpired) {
+                                    OneDriveStorageProcessUploadActivity.this.mExpired = false;
+                                    OneDriveStorageProcessUploadActivity.this.mStorageServiceClient.resetUploadProcessError();
+                                    ((Button) OneDriveStorageProcessUploadActivity.this.findViewById(R.id.save_button)).performClick();
+                                }
+                            }
+                        });
+                    }
+                }.start();
+                findViewById(R.id.folder_content_layout_for_upload).setVisibility(4);
+            }
+        }
+    }
+
+    public static Intent getProcessIntent(Context context, String str, StorageProcessActivity.ProcessType processType) {
+        Intent intent = new Intent(context, OneDriveStorageProcessUploadActivity.class);
+        setCommonExtra(intent, str);
+        return intent;
+    }
+}

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

@@ -5,6 +5,7 @@ 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;
 

+ 5 - 3
app/src/main/java/com/epson/memcardacc/PhotoCopyImageSelectActivity.java

@@ -1,19 +1,21 @@
 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.Build;
 import android.os.Bundle;
 
 
-
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.FragmentActivity;
+import androidx.lifecycle.Observer;
 
 import com.epson.memcardacc.AltAlertDialogFragment;
 import com.epson.memcardacc.FileConvertTask;
 import com.epson.memcardacc.FileConvertViewModel;
 
+import epson.print.R;
 import epson.print.imgsel.ImageFinder;
 import epson.print.imgsel.ImageSelectActivity;
 import epson.print.imgsel.JpegHeifImageFinder;

+ 3 - 0
app/src/main/java/epson/maintain/activity/GetPrinterReplyData.java

@@ -16,6 +16,9 @@ import android.view.View;
 import android.view.ViewGroup;
 import android.widget.Button;
 
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.fragment.app.FragmentActivity;
+
 import com.epson.iprint.shared.SharedParamStatus;
 import com.epson.mobilephone.common.escpr.MediaInfo;
 import com.epson.mobilephone.common.maintain2.MaintainPrinter2;

+ 15 - 0
app/src/main/java/epson/print/activity/AFolderPhoto.java

@@ -0,0 +1,15 @@
+package epson.print.activity;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import epson.print.imgsel.PhotoImageSelectActivity;
+
+public class AFolderPhoto extends Activity {
+    /* access modifiers changed from: protected */
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        startActivity(new Intent(this, PhotoImageSelectActivity.class));
+        finish();
+    }
+}

+ 569 - 0
app/src/main/java/epson/print/copy/ActivityBase.java

@@ -0,0 +1,569 @@
+package epson.print.copy;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+import epson.common.Constants;
+import epson.print.ActivityIACommon;
+import epson.print.R;
+import epson.print.CommonDefine;
+import epson.print.Util.EPLog;
+import epson.print.copy.Component.ecopycomponent.ECopyComponent;
+import epson.print.copy.Component.ecopycomponent.ECopyOptionContext;
+import epson.print.copy.Component.ecopycomponent.ECopyOptionItem;
+import epson.print.copy.Component.eremoteoperation.ERemoteOperation;
+import epson.print.screen.WorkingDialog;
+import epson.print.widgets.CustomTitleAlertDialogBuilder;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+class ActivityBase extends ActivityIACommon {
+    static final String Title = "Title";
+    static String printerId;
+    static String printerIp;
+    static final HashMap<String, String> strings = new HashMap<>();
+    /* access modifiers changed from: private */
+    public String TAG = "ActivityBase";
+    ECopyComponent copyComponent = ECopyComponent.sharedComponent();
+    ECopyComponent.ECopyType copyType = ECopyComponent.ECopyType.Standard;
+    boolean isKeepSimpleAPConnection = false;
+    boolean isTryConnectSimpleAp = false;
+    WorkingDialog loading;
+    ECopyOptionContext optionContext;
+    HashMap<ECopyOptionItem.ECopyOptionItemKey, OptionValue> optionValueMap = new HashMap<>();
+
+    public interface CancelRequestCallback {
+        void onCancelRequest();
+    }
+
+    enum ClickButton {
+        Ok,
+        Cancel,
+        ClearError
+    }
+
+    enum DialogButtons {
+        Ok,
+        Cancel,
+        ClearErrorCancel
+    }
+
+    interface IClose {
+        void onClose(ClickButton clickButton);
+    }
+
+    interface INextPageClose {
+        void onClose(ECopyComponent.ICopyResumeRequest.ResumeState resumeState);
+    }
+
+    interface OptionItemChangedListener {
+        void onOptionItemChanged(ECopyOptionItem eCopyOptionItem);
+    }
+
+    /* access modifiers changed from: package-private */
+    public void buildCopyOptions(ArrayList<ECopyOptionItem> arrayList) {
+    }
+
+    ActivityBase() {
+    }
+
+    class WheelDialog extends Dialog {
+        Button cancelButton;
+        CancelRequestCallback cancelCallback;
+        Dialog cancelDialog;
+        TextView messageText = ((TextView) findViewById(R.id.messageText));
+
+        /* access modifiers changed from: package-private */
+        public Dialog createCancelDialog() {
+            AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
+            builder.setMessage(ActivityBase.this.getString(R.string.str_msg_scan_cancel));
+            builder.setCancelable(false);
+            builder.setPositiveButton(ActivityBase.this.getString(R.string.str_yes), new DialogInterface.OnClickListener() {
+                public void onClick(DialogInterface dialogInterface, int i) {
+                    WheelDialog.this.cancelButton.setEnabled(false);
+                    WheelDialog.this.cancelCallback.onCancelRequest();
+                    dialogInterface.cancel();
+                }
+            });
+            builder.setNegativeButton(ActivityBase.this.getString(R.string.str_no), new DialogInterface.OnClickListener() {
+                public void onClick(DialogInterface dialogInterface, int i) {
+                    WheelDialog.this.cancelButton.setEnabled(true);
+                    dialogInterface.cancel();
+                }
+            });
+            return builder.create();
+        }
+
+        public WheelDialog(Context context) {
+            super(context, R.style.AppTheme_Translucent_Gray);
+            setContentView(R.layout.wheel_dialog);
+            setCancelable(false);
+        }
+
+        /* access modifiers changed from: package-private */
+        public void show(String str, CancelRequestCallback cancelRequestCallback) {
+            this.cancelCallback = cancelRequestCallback;
+            this.messageText.setText(str);
+            this.messageText.setVisibility(0);
+            this.cancelButton = (Button) findViewById(R.id.cancelButton);
+            this.cancelButton.setOnClickListener(new View.OnClickListener() {
+                public void onClick(View view) {
+                    WheelDialog wheelDialog = WheelDialog.this;
+                    wheelDialog.cancelDialog = wheelDialog.createCancelDialog();
+                    WheelDialog.this.cancelDialog.show();
+                }
+            });
+            this.cancelButton.setVisibility(0);
+            show();
+        }
+
+        /* access modifiers changed from: package-private */
+        public void setText(String str) {
+            this.messageText.setText(str);
+        }
+
+        /* access modifiers changed from: package-private */
+        public void hideCancelButton() {
+            this.cancelButton.setVisibility(4);
+        }
+
+        /* access modifiers changed from: package-private */
+        public void dissmiss() {
+            super.dismiss();
+            Dialog dialog = this.cancelDialog;
+            if (dialog != null) {
+                dialog.dismiss();
+            }
+        }
+    }
+
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        this.loading = new WorkingDialog(this);
+        DisplayUtil.setMap(this, strings);
+    }
+
+    public class errorDialog {
+        public static final int MESSAGE = 1;
+        public static final int TITLE = 0;
+        Context context;
+        Dialog dialog;
+
+        public errorDialog(Context context2) {
+            this.context = context2;
+        }
+
+        /* access modifiers changed from: package-private */
+        public void showErrorDialog(String str, String str2) {
+            showErrorDialog(str, str2, DialogButtons.Ok, (IClose) null);
+        }
+
+        /* access modifiers changed from: package-private */
+        public void showErrorDialog(int i) {
+            showErrorDialog((String) null, ActivityBase.this.getString(i));
+        }
+
+        /* access modifiers changed from: package-private */
+        public void showErrorDialog(String str, String str2, final DialogButtons dialogButtons, final IClose iClose) {
+            String str3;
+            CustomTitleAlertDialogBuilder customTitleAlertDialogBuilder = new CustomTitleAlertDialogBuilder(this.context);
+            String str4 = null;
+            switch (dialogButtons) {
+                case Ok:
+                    str4 = ActivityBase.this.getString(R.string.str_ok);
+                    str3 = null;
+                    break;
+                case Cancel:
+                    str3 = ActivityBase.this.getString(R.string.str_cancel);
+                    break;
+                case ClearErrorCancel:
+                    str4 = ActivityBase.this.getString(R.string.str_continue);
+                    str3 = ActivityBase.this.getString(R.string.str_cancel);
+                    break;
+                default:
+                    str3 = null;
+                    break;
+            }
+            if (str != null) {
+                customTitleAlertDialogBuilder.setTitle(str);
+            }
+            customTitleAlertDialogBuilder.setMessage(str2);
+            customTitleAlertDialogBuilder.setCancelable(false);
+            if (str4 != null) {
+                customTitleAlertDialogBuilder.setPositiveButton(str4, new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialogInterface, int i) {
+                        dialogInterface.cancel();
+                        IClose iClose = iClose;
+                        if (iClose != null) {
+                            iClose.onClose(dialogButtons == DialogButtons.Ok ? ClickButton.Ok : ClickButton.ClearError);
+                        }
+                    }
+                });
+            }
+            if (str3 != null) {
+                customTitleAlertDialogBuilder.setNegativeButton(str3, new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialogInterface, int i) {
+                        dialogInterface.cancel();
+                        IClose iClose = iClose;
+                        if (iClose != null) {
+                            iClose.onClose(ClickButton.Cancel);
+                        }
+                    }
+                });
+            }
+            this.dialog = customTitleAlertDialogBuilder.create();
+            this.dialog.show();
+        }
+
+        /* access modifiers changed from: package-private */
+        public void Cancel() {
+            Dialog dialog2 = this.dialog;
+            if (dialog2 != null) {
+                dialog2.cancel();
+            }
+        }
+
+        public String[] getReasonText(ECopyComponent.ICopyStatusListener.CopyTaskResult copyTaskResult) {
+            String[] strArr = new String[2];
+            switch (copyTaskResult) {
+                case ErrorCommunication:
+                    strArr[0] = ActivityBase.this.getString(R.string.EPS_PRNERR_COMM_TITLE);
+                    strArr[1] = ActivityBase.this.getString(R.string.CopyCommErrorText);
+                    break;
+                case Busy:
+                    strArr[0] = ActivityBase.this.getString(R.string.EPS_PRNST_BUSY_TITLE);
+                    strArr[1] = ActivityBase.this.getString(R.string.EPS_PRNST_BUSY_MSG);
+                    break;
+                case RemoveAdfPaper:
+                    strArr[0] = ActivityBase.this.getString(R.string.CopyTaskResultRemoveAdfPaperTitle);
+                    strArr[1] = ActivityBase.this.getString(R.string.CopyTaskResultRemoveAdfPaper);
+                    break;
+                case ErrorOther:
+                    strArr[0] = ActivityBase.this.getString(R.string.EPS_PRNERR_GENERAL_ERR);
+                    strArr[1] = ActivityBase.this.getString(R.string.CopyTaskResultErrorOtherText);
+                    break;
+            }
+            return strArr;
+        }
+
+        public String[] getReasonText(ECopyComponent.ICopyOptionContextListener.ContextCreationError contextCreationError) {
+            String[] strArr = new String[2];
+            switch (contextCreationError) {
+                case ErrorCommunication:
+                    strArr[0] = ActivityBase.this.getString(R.string.EPS_PRNERR_COMM_TITLE);
+                    strArr[1] = ActivityBase.this.getString(R.string.EPS_PRNERR_COMM5);
+                    break;
+                case ErrorNotCopySupported:
+                case Error:
+                    strArr[0] = ActivityBase.this.getString(R.string.EPS_PRNERR_GENERAL_ERR);
+                    strArr[1] = ActivityBase.this.getString(R.string.CopyTaskResultErrorOtherText);
+                    break;
+            }
+            return strArr;
+        }
+
+        public String[] getReasonText(ECopyComponent.ICopyOptionListener.CopyOptionChangedError copyOptionChangedError) {
+            String[] strArr = new String[2];
+            switch (copyOptionChangedError) {
+                case ErrorCommunication:
+                    strArr[0] = ActivityBase.this.getString(R.string.EPS_PRNERR_COMM_TITLE);
+                    strArr[1] = ActivityBase.this.getString(R.string.EPS_PRNERR_COMM5);
+                    break;
+                case ErrorInvalidOption:
+                case Error:
+                    strArr[0] = ActivityBase.this.getString(R.string.EPS_PRNERR_GENERAL_ERR);
+                    strArr[1] = ActivityBase.this.getString(R.string.CopyTaskResultErrorOtherText);
+                    break;
+            }
+            return strArr;
+        }
+
+        public String[] getReasonText(ECopyComponent.ICopyResumeRequest.StopReason stopReason) {
+            String[] strArr = new String[2];
+            switch (stopReason) {
+                case PrinterMarkerSupplyEmptyError:
+                    strArr[0] = ActivityBase.this.getString(R.string.EPS_PRNERR_INKOUT_TITLE);
+                    strArr[1] = ActivityBase.this.getString(R.string.EPS_PRNERR_INKOUT_MSG);
+                    break;
+                case PrinterMarkerWasteFullError:
+                    strArr[0] = ActivityBase.this.getString(R.string.EPS_PRNERR_WEB_REMOTE_MAINTENANCE_BOX_TITLE);
+                    strArr[1] = ActivityBase.this.getString(R.string.EPS_PRNERR_WEB_REMOTE_MAINTENANCE_BOX_MSG);
+                    break;
+                case PrinterMediaJamError:
+                    strArr[0] = ActivityBase.this.getString(R.string.EPS_PRNERR_PAPERJAM_TITLE);
+                    strArr[1] = ActivityBase.this.getString(R.string.CopyPaperJamErrorText);
+                    break;
+                case PrinterMediaEmptyError:
+                    strArr[0] = ActivityBase.this.getString(R.string.EPS_PRNERR_PAPEROUT_TITLE);
+                    strArr[1] = ActivityBase.this.getString(R.string.EPS_PRNERR_PAPEROUT_MSG);
+                    break;
+                case ManualfeedGuide:
+                    strArr[0] = ActivityBase.this.getString(R.string.EPS_PRNERR_MANUALFEED_SET_PAPER_TITLE);
+                    strArr[1] = ActivityBase.this.getString(R.string.EPS_PRNERR_MANUALFEED_SET_PAPER_MSG);
+                    break;
+                case PrinterCoverOpenError:
+                    strArr[0] = ActivityBase.this.getString(R.string.EPS_PRNERR_COVEROPEN_TITLE);
+                    strArr[1] = ActivityBase.this.getString(R.string.EPS_PRNERR_COVEROPEN_MSG);
+                    break;
+                case PrinterOutputAreaFullError:
+                    strArr[0] = ActivityBase.this.getString(R.string.EPS_PRNERR_CDRGUIDEOPEN_TITLE);
+                    strArr[1] = ActivityBase.this.getString(R.string.CopyCDdiscErrorText);
+                    break;
+                case PrinterOtherError:
+                    strArr[0] = ActivityBase.this.getString(R.string.EPS_PRNERR_GENERAL_ERR);
+                    strArr[1] = ActivityBase.this.getString(R.string.CopyTaskResultErrorOtherText);
+                    break;
+                case ScannerOtherError:
+                    strArr[0] = ActivityBase.this.getString(R.string.str_err_msg_scan_generic_internal_title);
+                    strArr[1] = ActivityBase.this.getString(R.string.str_err_msg_scan_generic_internal);
+                    break;
+            }
+            return strArr;
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public void showNextPageDialog(final INextPageClose iNextPageClose) {
+        C21591 r0 = new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialogInterface, int i) {
+                ECopyComponent.ICopyResumeRequest.ResumeState resumeState;
+                dialogInterface.cancel();
+                if (i == -1) {
+                    resumeState = ECopyComponent.ICopyResumeRequest.ResumeState.NextPageReady;
+                } else if (i == -3) {
+                    resumeState = ECopyComponent.ICopyResumeRequest.ResumeState.NextPageNotExist;
+                } else {
+                    resumeState = ECopyComponent.ICopyResumeRequest.ResumeState.Cancel;
+                }
+                iNextPageClose.onClose(resumeState);
+            }
+        };
+        AlertDialog.Builder builder = new AlertDialog.Builder(this);
+        builder.setMessage(R.string.waiting_2nd_page);
+        builder.setCancelable(true);
+        builder.setPositiveButton(getString(R.string.next_page_ready), r0);
+        builder.setNeutralButton(R.string.next_page_not_exist, r0);
+        builder.setNegativeButton(getString(R.string.str_cancel), r0);
+        builder.create().show();
+    }
+
+    abstract class OptionValue {
+        OptionItemChangedListener changedListener;
+        ECopyOptionItem optionItem;
+
+        OptionValue() {
+        }
+
+        /* access modifiers changed from: package-private */
+        public void setOptionValueChangedListener(OptionItemChangedListener optionItemChangedListener) {
+            this.changedListener = optionItemChangedListener;
+        }
+
+        /* access modifiers changed from: package-private */
+        public String getChoiceString(ECopyOptionItem.ECopyOptionItemChoice eCopyOptionItemChoice) {
+            return ActivityBase.this.string(eCopyOptionItemChoice.name());
+        }
+    }
+
+    class ListOptionValue extends OptionValue {
+        List<ECopyOptionItem.ECopyOptionItemChoice> choices;
+        ECopyOptionItem.ECopyOptionItemChoice selected;
+
+        ListOptionValue() {
+            super();
+        }
+
+        /* access modifiers changed from: package-private */
+        public void bindOption(ECopyOptionItem eCopyOptionItem) {
+            this.optionItem = eCopyOptionItem;
+            this.choices = eCopyOptionItem.getSelectableChoices();
+            this.selected = eCopyOptionItem.getSelectedChoice();
+        }
+
+        /* access modifiers changed from: package-private */
+        public String[] getKeyArray() {
+            String[] strArr = new String[this.choices.size()];
+            for (int i = 0; i < this.choices.size(); i++) {
+                strArr[i] = ActivityBase.this.string(this.choices.get(i).name());
+            }
+            return strArr;
+        }
+    }
+
+    class NumberOptionValue extends OptionValue {
+        Button countDown;
+        Button countUp;
+        TextView editText;
+        int value;
+
+        NumberOptionValue() {
+            super();
+        }
+
+        /* access modifiers changed from: package-private */
+        public void updateWithAddition(int i) {
+            try {
+                this.value = Integer.valueOf(this.editText.getText().toString()).intValue();
+                this.value = Math.min(Math.max(this.optionItem.getMinimumValue(), this.value + i), this.optionItem.getMaximumValue());
+                this.optionItem.selectValue(this.value);
+                if (this.changedListener != null) {
+                    this.changedListener.onOptionItemChanged(this.optionItem);
+                }
+            } catch (NumberFormatException unused) {
+            }
+        }
+
+        class Counter implements View.OnClickListener {
+            int amount;
+
+            public Counter(int i) {
+                this.amount = i;
+            }
+
+            public void onClick(View view) {
+                NumberOptionValue.this.updateWithAddition(this.amount);
+            }
+        }
+
+        /* access modifiers changed from: package-private */
+        public void bindOption(ECopyOptionItem eCopyOptionItem) {
+            this.optionItem = eCopyOptionItem;
+            this.value = eCopyOptionItem.getSelectedValue();
+        }
+
+        /* access modifiers changed from: package-private */
+        public void bindOption(int i, ECopyOptionItem eCopyOptionItem) {
+            this.optionItem = eCopyOptionItem;
+            this.editText = (TextView) ActivityBase.this.findViewById(i);
+            this.value = eCopyOptionItem.getSelectedValue();
+            this.editText.setText(String.valueOf(this.value));
+            this.editText.setEnabled(eCopyOptionItem.isEnabled());
+        }
+
+        /* access modifiers changed from: package-private */
+        public void bindCountUp(int i) {
+            this.countUp = (Button) ActivityBase.this.findViewById(i);
+            this.countUp.setOnClickListener(new Counter(1));
+            if (this.value == this.optionItem.getMaximumValue()) {
+                this.countUp.setEnabled(false);
+            } else {
+                this.countUp.setEnabled(true);
+            }
+        }
+
+        /* access modifiers changed from: package-private */
+        public void bindCountDown(int i) {
+            this.countDown = (Button) ActivityBase.this.findViewById(i);
+            this.countDown.setOnClickListener(new Counter(-1));
+            if (this.value == this.optionItem.getMinimumValue()) {
+                this.countDown.setEnabled(false);
+            } else {
+                this.countDown.setEnabled(true);
+            }
+        }
+    }
+
+    class CopyMagnificationValue extends NumberOptionValue {
+        public CopyMagnificationValue(ECopyOptionItem eCopyOptionItem) {
+            super();
+            bindOption(eCopyOptionItem);
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public String string(String str) {
+        return (String) (strings.containsKey(str) ? strings.get(str) : strings.get("Unknown"));
+    }
+
+    class settingPreference {
+        SharedPreferences.Editor editer;
+        SharedPreferences presettings;
+
+        settingPreference() {
+        }
+
+        /* access modifiers changed from: package-private */
+        public String loadPrePrinter() {
+            this.presettings = ActivityBase.this.getSharedPreferences(CommonDefine.PREFS_INFO_COPY, 0);
+            return this.presettings.getString(Constants.PRINTER_ID, (String) null);
+        }
+
+        /* access modifiers changed from: package-private */
+        public void savePrePrinter() {
+            this.presettings = ActivityBase.this.getSharedPreferences(CommonDefine.PREFS_INFO_COPY, 0);
+            this.editer = this.presettings.edit();
+            this.editer.putString(Constants.PRINTER_ID, ActivityBase.printerId);
+            this.editer.commit();
+        }
+
+        /* access modifiers changed from: package-private */
+        public void setCopyOptions(ArrayList<ECopyOptionItem> arrayList) {
+            ECopyOptionContext bindedCopyOptionContext = ActivityBase.this.copyComponent.getBindedCopyOptionContext();
+            Iterator<ECopyOptionItem> it = arrayList.iterator();
+            while (it.hasNext()) {
+                ECopyOptionItem next = it.next();
+                ECopyOptionItem.ECopyOptionItemKey key = next.getKey();
+                if (!key.equals(ECopyOptionItem.ECopyOptionItemKey.Copies)) {
+                    setOption(key, next);
+                    bindedCopyOptionContext.replace(next);
+                }
+            }
+            Iterator<ECopyOptionItem> it2 = arrayList.iterator();
+            while (it2.hasNext()) {
+                ActivityBase.this.copyComponent.setCopyOptionItem(it2.next());
+            }
+        }
+
+        /* access modifiers changed from: package-private */
+        public void setOption(ECopyOptionItem.ECopyOptionItemKey eCopyOptionItemKey, ECopyOptionItem eCopyOptionItem) {
+            this.presettings = ActivityBase.this.getSharedPreferences(CommonDefine.PREFS_INFO_COPY, 0);
+            if (eCopyOptionItem.getChoiceType() == ECopyOptionItem.ECopyOptionItemChoiceType.ChoiceArray) {
+                eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.valueOf(eCopyOptionItemKey, ERemoteOperation.ERemoteParam.stringOf(this.presettings.getString(eCopyOptionItemKey.name(), eCopyOptionItem.getDefaultChoice().getParam().toString()))));
+                return;
+            }
+            eCopyOptionItem.selectValue(this.presettings.getInt(eCopyOptionItemKey.name(), eCopyOptionItem.getDefaultValue()));
+            if (eCopyOptionItemKey.equals(ECopyOptionItem.ECopyOptionItemKey.CopyMagnification)) {
+                ActivityBase.this.optionValueMap.put(eCopyOptionItemKey, new CopyMagnificationValue(eCopyOptionItem));
+            }
+        }
+
+        /* access modifiers changed from: package-private */
+        public void saveCopyOptions(ArrayList<ECopyOptionItem> arrayList) {
+            savePrePrinter();
+            Iterator<ECopyOptionItem> it = arrayList.iterator();
+            while (it.hasNext()) {
+                ECopyOptionItem next = it.next();
+                ECopyOptionItem.ECopyOptionItemKey key = next.getKey();
+                if (!key.equals(ECopyOptionItem.ECopyOptionItemKey.Copies)) {
+                    saveOption(key, next);
+                }
+            }
+        }
+
+        /* access modifiers changed from: package-private */
+        public void saveOption(ECopyOptionItem.ECopyOptionItemKey eCopyOptionItemKey, ECopyOptionItem eCopyOptionItem) {
+            this.presettings = ActivityBase.this.getSharedPreferences(CommonDefine.PREFS_INFO_COPY, 0);
+            if (eCopyOptionItem.getChoiceType() == ECopyOptionItem.ECopyOptionItemChoiceType.ChoiceArray) {
+                String access$000 = ActivityBase.this.TAG;
+                EPLog.m313i(access$000, "cursetting:" + eCopyOptionItem.getSelectedChoice().name());
+                this.editer = this.presettings.edit();
+                this.editer.putString(eCopyOptionItemKey.name(), eCopyOptionItem.getSelectedChoice().getParam().toString());
+                this.editer.commit();
+                return;
+            }
+            String access$0002 = ActivityBase.this.TAG;
+            EPLog.m313i(access$0002, "cursetting:" + String.valueOf(eCopyOptionItem.getSelectedValue()));
+            this.editer = this.presettings.edit();
+            this.editer.putInt(eCopyOptionItemKey.name(), eCopyOptionItem.getSelectedValue());
+            this.editer.commit();
+        }
+    }
+}

+ 12 - 0
app/src/main/java/epson/print/copy/Component/ecopycomponent/CopyParams.java

@@ -0,0 +1,12 @@
+package epson.print.copy.Component.ecopycomponent;
+
+public class CopyParams {
+    public String colorMode;
+    public String copyQuality;
+    public String copyType;
+    public String density;
+    public String magnification;
+    public String paperSize;
+    public String paperType;
+    public String printDevice;
+}

+ 98 - 0
app/src/main/java/epson/print/copy/Component/ecopycomponent/CopyPhotoSettingHandler.java

@@ -0,0 +1,98 @@
+package epson.print.copy.Component.ecopycomponent;
+
+import com.box.androidsdk.content.requests.BoxRequestsMetadata;
+import java.io.File;
+import java.util.ArrayList;
+import javax.xml.parsers.SAXParserFactory;
+import org.xml.sax.Attributes;
+import org.xml.sax.helpers.DefaultHandler;
+
+/* compiled from: RemoteCopyPhotoTask */
+class CopyPhotoSettingHandler extends DefaultHandler {
+
+    /* renamed from: b */
+    final String f351b = "b";
+    final String copies = "copies";
+    final String dpi = "dpi";
+
+    /* renamed from: g */
+    final String f352g = "g";
+    final String height = "height";
+    String path;
+    final String photoCopySetting = "photoCopySetting";
+    final String photoCopySettings = "photoCopySettings";
+
+    /* renamed from: r */
+    final String f353r = "r";
+    public ArrayList<String> scanAreaHeight = new ArrayList<>();
+    public ArrayList<String> scanAreaResolution = new ArrayList<>();
+    public ArrayList<String> scanAreaWidth = new ArrayList<>();
+    public ArrayList<String> scanAreaX = new ArrayList<>();
+    public ArrayList<String> scanAreaY = new ArrayList<>();
+    public ArrayList<String> scanCopies = new ArrayList<>();
+    final String trimmingRect = "trimmingRect";
+    final String value = BoxRequestsMetadata.UpdateItemMetadata.BoxMetadataUpdateTask.VALUE;
+    final String width = "width";
+
+    /* renamed from: x */
+    final String f354x = "x";
+    public ArrayList<String> xFitGamma = new ArrayList<>();
+    public ArrayList<String> xFitMatrix = new ArrayList<>();
+    final String xGamma = "xGamma";
+    final String xMatrix = "xMatrix";
+
+    /* renamed from: y */
+    final String f355y = "y";
+
+    public CopyPhotoSettingHandler(String str) {
+        this.path = str;
+    }
+
+    public int getScanCount() {
+        return this.scanCopies.size();
+    }
+
+    public boolean parse() {
+        try {
+            SAXParserFactory.newInstance().newSAXParser().parse(new File(this.path), this);
+        } catch (Exception e) {
+            this.scanCopies.clear();
+            e.printStackTrace();
+        }
+        return this.scanCopies.size() > 0;
+    }
+
+    /* access modifiers changed from: package-private */
+    public String xFormat(String str, String str2) {
+        StringBuffer stringBuffer = new StringBuffer();
+        String[] split = str.split(PreferencesConstants.COOKIE_DELIMITER);
+        int length = split.length;
+        for (int i = 0; i < length; i++) {
+            stringBuffer.append(String.format(str2, new Object[]{Integer.valueOf(Integer.parseInt(split[i], 16))}));
+        }
+        return stringBuffer.toString();
+    }
+
+    public void startElement(String str, String str2, String str3, Attributes attributes) {
+        if (str2.equalsIgnoreCase("photoCopySettings") || str2.equalsIgnoreCase("photoCopySetting")) {
+            return;
+        }
+        if (str2.equalsIgnoreCase("xGamma")) {
+            StringBuffer stringBuffer = new StringBuffer();
+            stringBuffer.append(xFormat(attributes.getValue("r"), "%02X"));
+            stringBuffer.append(xFormat(attributes.getValue("g"), "%02X"));
+            stringBuffer.append(xFormat(attributes.getValue("b"), "%02X"));
+            this.xFitGamma.add(stringBuffer.toString());
+        } else if (str2.equalsIgnoreCase("xMatrix")) {
+            this.xFitMatrix.add(xFormat(attributes.getValue(BoxRequestsMetadata.UpdateItemMetadata.BoxMetadataUpdateTask.VALUE), "%04X"));
+        } else if (str2.equalsIgnoreCase("copies")) {
+            this.scanCopies.add(attributes.getValue(BoxRequestsMetadata.UpdateItemMetadata.BoxMetadataUpdateTask.VALUE));
+        } else if (str2.equalsIgnoreCase("trimmingRect")) {
+            this.scanAreaResolution.add(attributes.getValue("dpi"));
+            this.scanAreaX.add(attributes.getValue("x"));
+            this.scanAreaY.add(attributes.getValue("y"));
+            this.scanAreaWidth.add(attributes.getValue("width"));
+            this.scanAreaHeight.add(attributes.getValue("height"));
+        }
+    }
+}

+ 342 - 0
app/src/main/java/epson/print/copy/Component/ecopycomponent/ECopyComponent.java

@@ -0,0 +1,342 @@
+package epson.print.copy.Component.ecopycomponent;
+
+import android.content.Context;
+import com.epson.mobilephone.common.wifidirect.ActivityControlWiFi;
+import epson.common.Utils;
+import epson.print.copy.Component.ecopycomponent.ECopyOptionItem;
+import epson.print.copy.Component.ecopycomponent.ECopyPreview;
+import epson.print.copy.Component.ecopycomponent.RemoteCopyTask;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+public final class ECopyComponent {
+    String clientID;
+    ICopyOptionListener optionChangedListener;
+    ECopyOptionContext optionContext = new ECopyOptionContext();
+    HashMap<Property, Object> properties = new HashMap<>();
+    ICopySystemSettings systemSettings;
+
+    public enum ECopyType {
+        Standard,
+        Borderless,
+        A4_2up,
+        B5_2up,
+        A4_2up_Book,
+        B5_2up_Book,
+        Mirror,
+        Photo
+    }
+
+    public interface ICopyCancelRequest {
+        void cancel();
+    }
+
+    interface ICopyInvalidateResumeRequest extends ICopyResumeRequest {
+        void invalidate();
+    }
+
+    public interface ICopyOptionContextListener {
+
+        public enum ContextCreationError {
+            ErrorCommunication,
+            ErrorNotCopySupported,
+            Error
+        }
+
+        void onCopyOptionContextCreated(ECopyType eCopyType, ECopyOptionContext eCopyOptionContext, ContextCreationError contextCreationError);
+    }
+
+    public interface ICopyOptionListener {
+
+        public enum CopyOptionChangedError {
+            ErrorCommunication,
+            ErrorInvalidOption,
+            Error
+        }
+
+        void onCopyOptionChanged(ECopyOptionItem eCopyOptionItem, ArrayList<ECopyOptionItem> arrayList, CopyOptionChangedError copyOptionChangedError);
+    }
+
+    public interface ICopyStatusListener {
+
+        public enum CopyTaskProgress {
+            Copying,
+            Waiting2ndPage,
+            Canceling,
+            Scanning,
+            Stopped,
+            Processing
+        }
+
+        public enum CopyTaskResult {
+            Succeed,
+            Canceled,
+            Busy,
+            ErrorInvalidOption,
+            ErrorCommunication,
+            RemoveAdfPaper,
+            ErrorOther
+        }
+
+        public enum CopyTaskType {
+            Preview,
+            Copy
+        }
+
+        void onFinished(CopyTaskType copyTaskType, CopyTaskResult copyTaskResult);
+
+        void onProcessed(CopyTaskType copyTaskType, int i, int i2, CopyTaskProgress copyTaskProgress, ICopyResumeRequest iCopyResumeRequest);
+
+        void onStarted(CopyTaskType copyTaskType);
+    }
+
+    public interface ICopySystemSettings {
+        String getPrinterIPAddress();
+
+        int getThickPaper();
+    }
+
+    protected interface ITask {
+        void setClientID(String str);
+
+        void setOptionContext(ECopyOptionContext eCopyOptionContext);
+
+        void setRequestConnectionTimeout(int i);
+
+        void setSystemSettings(ICopySystemSettings iCopySystemSettings);
+
+        ICopyCancelRequest start();
+    }
+
+    public enum Property {
+        RequestConnectionTimeout
+    }
+
+    ECopyComponent() {
+        this.properties.put(Property.RequestConnectionTimeout, Integer.valueOf(ActivityControlWiFi.SCANNING_TIMEOUT));
+        this.systemSettings = new ICopySystemSettings() {
+            public String getPrinterIPAddress() {
+                return "192.168.10.1";
+            }
+
+            public int getThickPaper() {
+                return 0;
+            }
+        };
+    }
+
+    /* renamed from: epson.print.copy.Component.ecopycomponent.ECopyComponent$3 */
+    static /* synthetic */ class C21683 {
+
+        /* renamed from: $SwitchMap$epson$print$copy$Component$ecopycomponent$ECopyComponent$Property */
+        static final /* synthetic */ int[] f356x1c67737 = new int[Property.values().length];
+
+        static {
+            try {
+                f356x1c67737[Property.RequestConnectionTimeout.ordinal()] = 1;
+            } catch (NoSuchFieldError unused) {
+            }
+        }
+    }
+
+    public void setProperty(Property property, int i) {
+        if (C21683.f356x1c67737[property.ordinal()] == 1) {
+            this.properties.put(property, Integer.valueOf(i));
+        }
+    }
+
+    public void setSystemSettings(ICopySystemSettings iCopySystemSettings) {
+        this.systemSettings = iCopySystemSettings;
+    }
+
+    static class ECopyComponentHolder {
+        static final ECopyComponent instance = new ECopyComponent();
+
+        ECopyComponentHolder() {
+        }
+    }
+
+    public static ECopyComponent sharedComponent() {
+        return ECopyComponentHolder.instance;
+    }
+
+    public void getRemoteOperationUUID(Context context) {
+        this.clientID = Utils.getRemoteOperationUUID(context);
+    }
+
+    public interface ICopyResumeRequest {
+
+        public enum ResumeState {
+            NextPageReady,
+            NextPageNotExist,
+            ClearError,
+            Cancel
+        }
+
+        StopReason getStopReason();
+
+        boolean isPossibleClearError();
+
+        void resume(ResumeState resumeState);
+
+        public enum StopReason {
+            None,
+            ChangePage,
+            PrinterMarkerSupplyEmptyError,
+            PrinterMarkerWasteFullError,
+            PrinterMediaJamError,
+            PrinterMediaEmptyError,
+            ManualfeedGuide,
+            PrinterInputTrayMissingError,
+            PrinterCoverOpenError,
+            PrinterOutputAreaFullError,
+            PrinterOtherError,
+            ScannerMediaEmptyError,
+            ScannerMediaJamError,
+            ScannerMediaSizeMissmatchError,
+            ScannerOtherError;
+            
+            String string;
+
+            public String getDebugString() {
+                return this.string;
+            }
+        }
+    }
+
+    public interface ICopyDeviceStatusListener {
+
+        public enum Connection {
+            Succeed,
+            Failed
+        }
+
+        public enum DeviceState {
+            Idle,
+            Processing,
+            Stopped
+        }
+
+        void onDeviceStatus(Connection connection, DeviceState deviceState, DeviceState deviceState2, ArrayList<PrinterStateReason> arrayList, ArrayList<ScannerStateReason> arrayList2, ArrayList<String> arrayList3);
+
+        public enum PrinterStateReason {
+            None,
+            MarkerSupplyEmptyError,
+            MarkerWasteFullError,
+            MediaJamError,
+            MediaEmptyError,
+            InputTrayMissingError,
+            CoverOpenError,
+            OutputAreaFullError,
+            OtherError,
+            MarkerSupplyLowWarning,
+            CoverOpen;
+            
+            String string;
+
+            public String getDebugString() {
+                return this.string;
+            }
+        }
+
+        public enum ScannerStateReason {
+            None,
+            MediaEmptyError,
+            MediaJamError,
+            MediaSizeMissmatchError,
+            OtherError;
+            
+            public String string;
+
+            public String getDebugString() {
+                return this.string;
+            }
+        }
+    }
+
+    public void bindCopyOptionContext(ECopyOptionContext eCopyOptionContext, ICopyOptionListener iCopyOptionListener) {
+        this.optionContext = new ECopyOptionContext(eCopyOptionContext);
+        this.optionChangedListener = iCopyOptionListener;
+    }
+
+    public ECopyOptionContext getBindedCopyOptionContext() {
+        if (this.optionContext.isNull()) {
+            return null;
+        }
+        return this.optionContext;
+    }
+
+    public ECopyPreview getComposedCopyPreview(Context context, int i, int i2, ECopyPreview.ECopyPreviewInvalidateListener eCopyPreviewInvalidateListener) {
+        ECopyPreview createPreview = ECopyPreview.createPreview(context, i, i2, eCopyPreviewInvalidateListener);
+        createPreview.compose(new ECopyOptionContext(this.optionContext), new ECopyPreview.ICopyPreviewCommitEditedOptionContext() {
+            public void commit(ECopyOptionContext eCopyOptionContext) {
+                eCopyOptionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.XScale).selectChoice(RemoteCopySetOptionTask.getScaleChoice(eCopyOptionContext.copyType, eCopyOptionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.CopyMagnification).getSelectedValue()));
+                ECopyComponent.this.optionContext = eCopyOptionContext;
+            }
+        });
+        return createPreview;
+    }
+
+    public ArrayList<ECopyOptionItem> getCopyOptionItems() {
+        ArrayList<ECopyOptionItem> arrayList = new ArrayList<>();
+        Iterator<ECopyOptionItem> it = this.optionContext.optionItems.iterator();
+        while (it.hasNext()) {
+            arrayList.add(new ECopyOptionItem(it.next()));
+        }
+        return arrayList;
+    }
+
+    public void createCopyOptionContext(ECopyType eCopyType, ICopyOptionContextListener iCopyOptionContextListener) {
+        ITask iTask;
+        if (eCopyType == ECopyType.Photo) {
+            iTask = new RemoteCopyPhotoGetOptionTask(eCopyType, iCopyOptionContextListener);
+        } else {
+            iTask = new RemoteCopyGetOptionTask(eCopyType, iCopyOptionContextListener);
+        }
+        execute(iTask);
+    }
+
+    public void setCopyOptionItem(ECopyOptionItem eCopyOptionItem) {
+        ITask iTask;
+        if (this.optionContext.getCopyType() == ECopyType.Photo) {
+            iTask = new RemoteCopyPhotoSetOptionTask(eCopyOptionItem, this.optionChangedListener);
+        } else {
+            iTask = new RemoteCopySetOptionTask(eCopyOptionItem, this.optionChangedListener);
+        }
+        execute(iTask);
+    }
+
+    public ICopyCancelRequest startPreview(ECopyPreview eCopyPreview, ICopyStatusListener iCopyStatusListener) {
+        return execute(new PreviewScanTask(eCopyPreview, iCopyStatusListener));
+    }
+
+    public ICopyCancelRequest startCopy(ICopyStatusListener iCopyStatusListener, Context context) {
+        return execute(new RemoteCopyTask(RemoteCopyTask.CopyMode.Copy, iCopyStatusListener, context));
+    }
+
+    public ICopyCancelRequest startCopyPhoto(String str, ICopyStatusListener iCopyStatusListener) {
+        return execute(new RemoteCopyPhotoTask(str, iCopyStatusListener));
+    }
+
+    public ICopyCancelRequest recoverCopy(String str, ICopyStatusListener iCopyStatusListener) {
+        return execute(new RemoteCopyTask(RemoteCopyTask.CopyMode.Recover, str, iCopyStatusListener, (Context) null));
+    }
+
+    public void getDeviceStatus(ICopyDeviceStatusListener iCopyDeviceStatusListener) {
+        execute(new RemoteDeviceTask(iCopyDeviceStatusListener));
+    }
+
+    public int getCopyValue(ECopyType eCopyType, ECopyOptionItem.ECopyOptionItemChoice eCopyOptionItemChoice) {
+        return RemoteCopySetOptionTask.getcopyMagnification(eCopyType, eCopyOptionItemChoice);
+    }
+
+    /* access modifiers changed from: protected */
+    public ICopyCancelRequest execute(ITask iTask) {
+        iTask.setSystemSettings(this.systemSettings);
+        iTask.setRequestConnectionTimeout(((Integer) this.properties.get(Property.RequestConnectionTimeout)).intValue());
+        iTask.setClientID(this.clientID);
+        iTask.setOptionContext(this.optionContext);
+        return iTask.start();
+    }
+}

+ 151 - 0
app/src/main/java/epson/print/copy/Component/ecopycomponent/ECopyOptionContext.java

@@ -0,0 +1,151 @@
+package epson.print.copy.Component.ecopycomponent;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import epson.print.copy.Component.ecopycomponent.ECopyComponent;
+import epson.print.copy.Component.ecopycomponent.ECopyOptionItem;
+import epson.print.copy.Component.eremoteoperation.ERemoteCopy;
+import java.util.ArrayList;
+import java.util.Iterator;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class ECopyOptionContext implements Parcelable {
+    public static final Parcelable.Creator<ECopyOptionContext> CREATOR = new Parcelable.Creator<ECopyOptionContext>() {
+        public ECopyOptionContext createFromParcel(Parcel parcel) {
+            return new ECopyOptionContext(parcel);
+        }
+
+        public ECopyOptionContext[] newArray(int i) {
+            return new ECopyOptionContext[i];
+        }
+    };
+    ERemoteCopy.ERemoteCopyOptionsResult copyOptionsResult;
+    ECopyComponent.ECopyType copyType;
+    ArrayList<ECopyOptionItem> optionItems;
+
+    public int describeContents() {
+        return 0;
+    }
+
+    public void writeToParcel(Parcel parcel, int i) {
+        parcel.writeString(this.copyType.name());
+        parcel.writeInt(this.optionItems.size());
+        Iterator<ECopyOptionItem> it = this.optionItems.iterator();
+        while (it.hasNext()) {
+            parcel.writeParcelable(it.next(), 0);
+        }
+        parcel.writeString(this.copyOptionsResult.toString());
+    }
+
+    ECopyOptionContext(Parcel parcel) {
+        this.optionItems = new ArrayList<>();
+        this.copyType = ECopyComponent.ECopyType.valueOf(parcel.readString());
+        int readInt = parcel.readInt();
+        for (int i = 0; i < readInt; i++) {
+            this.optionItems.add((ECopyOptionItem) parcel.readParcelable(ECopyOptionItem.class.getClassLoader()));
+        }
+        try {
+            JSONObject jSONObject = new JSONObject(parcel.readString());
+            ERemoteCopy eRemoteCopy = new ERemoteCopy();
+            eRemoteCopy.getClass();
+            this.copyOptionsResult = new ERemoteCopy.ERemoteCopyOptionsResult(jSONObject);
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public boolean isNull() {
+        return this.copyType == null;
+    }
+
+    ECopyOptionContext() {
+        this.optionItems = new ArrayList<>();
+        this.copyType = null;
+    }
+
+    ECopyOptionContext(ECopyComponent.ECopyType eCopyType) {
+        this.optionItems = new ArrayList<>();
+        this.copyType = eCopyType;
+    }
+
+    ECopyOptionContext(ECopyOptionContext eCopyOptionContext) {
+        this.optionItems = new ArrayList<>();
+        this.copyType = null;
+        if (eCopyOptionContext != null) {
+            this.copyType = eCopyOptionContext.copyType;
+            Iterator<ECopyOptionItem> it = eCopyOptionContext.optionItems.iterator();
+            while (it.hasNext()) {
+                this.optionItems.add(new ECopyOptionItem(it.next()));
+            }
+            this.copyOptionsResult = eCopyOptionContext.copyOptionsResult;
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public ECopyComponent.ECopyType getCopyType() {
+        return this.copyType;
+    }
+
+    /* access modifiers changed from: package-private */
+    public ArrayList<ECopyOptionItem> getCopyOptionItems() {
+        return this.optionItems;
+    }
+
+    /* access modifiers changed from: package-private */
+    public ECopyOptionItem getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey eCopyOptionItemKey) {
+        Iterator<ECopyOptionItem> it = this.optionItems.iterator();
+        while (it.hasNext()) {
+            ECopyOptionItem next = it.next();
+            if (next.key == eCopyOptionItemKey) {
+                return next;
+            }
+        }
+        return null;
+    }
+
+    /* access modifiers changed from: package-private */
+    public void add(ECopyOptionItem eCopyOptionItem) {
+        this.optionItems.add(eCopyOptionItem);
+    }
+
+    public ECopyOptionItem replace(ECopyOptionItem eCopyOptionItem) {
+        Iterator<ECopyOptionItem> it = this.optionItems.iterator();
+        int i = 0;
+        while (it.hasNext()) {
+            if (it.next().key == eCopyOptionItem.key) {
+                return this.optionItems.set(i, eCopyOptionItem);
+            }
+            i++;
+        }
+        return null;
+    }
+
+    /* access modifiers changed from: package-private */
+    public boolean isChanged(ECopyOptionItem eCopyOptionItem) {
+        Iterator<ECopyOptionItem> it = this.optionItems.iterator();
+        while (true) {
+            if (!it.hasNext()) {
+                break;
+            }
+            ECopyOptionItem next = it.next();
+            if (next.key == eCopyOptionItem.key) {
+                if (!next.equals(eCopyOptionItem)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    /* access modifiers changed from: package-private */
+    public void setCopyOptionsResult(ERemoteCopy.ERemoteCopyOptionsResult eRemoteCopyOptionsResult) {
+        this.copyOptionsResult = eRemoteCopyOptionsResult;
+    }
+
+    /* access modifiers changed from: package-private */
+    public ERemoteCopy.ERemoteCopyOptionsResult getCopyOptionsResult() {
+        return this.copyOptionsResult;
+    }
+}

+ 1577 - 0
app/src/main/java/epson/print/copy/Component/ecopycomponent/ECopyOptionItem.java

@@ -0,0 +1,1577 @@
+package epson.print.copy.Component.ecopycomponent;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import epson.print.copy.Component.ecopycomponent.ECopyComponent;
+import epson.print.copy.Component.eremoteoperation.ERemoteCopy;
+import epson.print.copy.Component.eremoteoperation.ERemoteOperation;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class ECopyOptionItem implements Parcelable {
+    public static final Parcelable.Creator<ECopyOptionItem> CREATOR = new Parcelable.Creator<ECopyOptionItem>() {
+        public ECopyOptionItem createFromParcel(Parcel parcel) {
+            return new ECopyOptionItem(parcel);
+        }
+
+        public ECopyOptionItem[] newArray(int i) {
+            return new ECopyOptionItem[i];
+        }
+    };
+    public static int CopyMagnificationAutofitValue = -999;
+    static int DefaultExceptionValue = -10000;
+    ChoiceArray choiceArray;
+    ECopyOptionItemChoiceType choiceType;
+    boolean enabled;
+    boolean isLocalOption;
+    ECopyOptionItemKey key;
+    NumberRange numberRange;
+
+    public enum ECopyOptionItemChoiceType {
+        ChoiceArray,
+        NumberRange
+    }
+
+    public int describeContents() {
+        return 0;
+    }
+
+    class ChoiceArray {
+        ArrayList<ECopyOptionItemChoice> choices = new ArrayList<>();
+        int defaultChoice;
+        int selectedChoice;
+
+        public ChoiceArray() {
+        }
+
+        public ChoiceArray(ChoiceArray choiceArray) {
+            Iterator<ECopyOptionItemChoice> it = choiceArray.choices.iterator();
+            while (it.hasNext()) {
+                this.choices.add(it.next());
+            }
+            this.selectedChoice = choiceArray.selectedChoice;
+            this.defaultChoice = choiceArray.defaultChoice;
+        }
+
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (!(obj instanceof ChoiceArray)) {
+                return false;
+            }
+            ChoiceArray choiceArray = (ChoiceArray) obj;
+            if (this.selectedChoice != choiceArray.selectedChoice || this.defaultChoice != choiceArray.defaultChoice || this.choices.size() != choiceArray.choices.size()) {
+                return false;
+            }
+            for (int i = 0; i < this.choices.size(); i++) {
+                if (this.choices.get(i) != choiceArray.choices.get(i)) {
+                    return false;
+                }
+            }
+            return true;
+        }
+    }
+
+    class NumberRange {
+        int defaultValue;
+        int exceptionValue;
+        int max;
+        int min;
+        int selectedValue;
+
+        public NumberRange() {
+        }
+
+        public NumberRange(NumberRange numberRange) {
+            this.min = numberRange.min;
+            this.max = numberRange.max;
+            this.selectedValue = numberRange.selectedValue;
+            this.defaultValue = numberRange.defaultValue;
+            this.exceptionValue = numberRange.exceptionValue;
+        }
+
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (!(obj instanceof NumberRange)) {
+                return false;
+            }
+            NumberRange numberRange = (NumberRange) obj;
+            if (this.min == numberRange.min && this.max == numberRange.max && this.selectedValue == numberRange.selectedValue && this.defaultValue == numberRange.defaultValue && this.exceptionValue == numberRange.exceptionValue) {
+                return true;
+            }
+            return false;
+        }
+    }
+
+    public void writeToParcel(Parcel parcel, int i) {
+        parcel.writeString(this.key.name());
+        parcel.writeString(this.choiceType.name());
+        parcel.writeInt(this.enabled ? 1 : 0);
+        parcel.writeInt(this.isLocalOption ? 1 : 0);
+        if (this.choiceType == ECopyOptionItemChoiceType.ChoiceArray) {
+            parcel.writeInt(this.choiceArray.choices.size());
+            Iterator<ECopyOptionItemChoice> it = this.choiceArray.choices.iterator();
+            while (it.hasNext()) {
+                parcel.writeString(it.next().param.name());
+            }
+            parcel.writeInt(this.choiceArray.selectedChoice);
+            parcel.writeInt(this.choiceArray.defaultChoice);
+            return;
+        }
+        parcel.writeInt(this.numberRange.min);
+        parcel.writeInt(this.numberRange.max);
+        parcel.writeInt(this.numberRange.selectedValue);
+        parcel.writeInt(this.numberRange.defaultValue);
+        parcel.writeInt(this.numberRange.exceptionValue);
+    }
+
+    ECopyOptionItem(Parcel parcel) {
+        this.key = ECopyOptionItemKey.valueOf(parcel.readString());
+        this.choiceType = ECopyOptionItemChoiceType.valueOf(parcel.readString());
+        boolean z = true;
+        this.enabled = parcel.readInt() == 1;
+        this.isLocalOption = parcel.readInt() != 1 ? false : z;
+        if (this.choiceType == ECopyOptionItemChoiceType.ChoiceArray) {
+            this.choiceArray = new ChoiceArray();
+            int readInt = parcel.readInt();
+            for (int i = 0; i < readInt; i++) {
+                this.choiceArray.choices.add(ECopyOptionItemChoice.valueOf(this.key, ERemoteOperation.ERemoteParam.valueOf(parcel.readString())));
+            }
+            this.choiceArray.selectedChoice = parcel.readInt();
+            this.choiceArray.defaultChoice = parcel.readInt();
+            return;
+        }
+        this.numberRange = new NumberRange();
+        this.numberRange.min = parcel.readInt();
+        this.numberRange.max = parcel.readInt();
+        this.numberRange.selectedValue = parcel.readInt();
+        this.numberRange.defaultValue = parcel.readInt();
+        this.numberRange.exceptionValue = parcel.readInt();
+    }
+
+    ECopyOptionItem(ECopyOptionItemKey eCopyOptionItemKey, int i, int i2, int i3, int i4) {
+        this.key = eCopyOptionItemKey;
+        this.choiceType = ECopyOptionItemChoiceType.NumberRange;
+        this.enabled = true;
+        this.numberRange = new NumberRange();
+        NumberRange numberRange2 = this.numberRange;
+        numberRange2.min = i;
+        numberRange2.max = i2;
+        numberRange2.selectedValue = i3;
+        numberRange2.defaultValue = i3;
+        numberRange2.exceptionValue = i4;
+    }
+
+    ECopyOptionItem(ECopyOptionItemKey eCopyOptionItemKey, ArrayList<ERemoteOperation.ERemoteParam> arrayList, ERemoteOperation.ERemoteParam eRemoteParam) {
+        this.key = eCopyOptionItemKey;
+        this.choiceType = ECopyOptionItemChoiceType.ChoiceArray;
+        this.choiceArray = new ChoiceArray();
+        this.choiceArray.defaultChoice = 0;
+        Iterator<ERemoteOperation.ERemoteParam> it = arrayList.iterator();
+        while (it.hasNext()) {
+            ERemoteOperation.ERemoteParam next = it.next();
+            this.choiceArray.choices.add(ECopyOptionItemChoice.valueOf(this.key, next));
+            if (next == eRemoteParam) {
+                ChoiceArray choiceArray2 = this.choiceArray;
+                choiceArray2.defaultChoice = choiceArray2.choices.size() - 1;
+            }
+        }
+        ChoiceArray choiceArray3 = this.choiceArray;
+        choiceArray3.selectedChoice = choiceArray3.defaultChoice;
+        if (arrayList.size() > 1) {
+            this.enabled = true;
+        } else {
+            this.enabled = false;
+        }
+    }
+
+    ECopyOptionItem(ECopyOptionItem eCopyOptionItem) {
+        this.key = eCopyOptionItem.key;
+        this.choiceType = eCopyOptionItem.choiceType;
+        this.enabled = eCopyOptionItem.enabled;
+        this.isLocalOption = eCopyOptionItem.isLocalOption;
+        if (this.choiceType == ECopyOptionItemChoiceType.ChoiceArray) {
+            this.choiceArray = new ChoiceArray(eCopyOptionItem.choiceArray);
+        } else {
+            this.numberRange = new NumberRange(eCopyOptionItem.numberRange);
+        }
+    }
+
+    public boolean equals(Object obj) {
+        ECopyOptionItemChoiceType eCopyOptionItemChoiceType;
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof ECopyOptionItem)) {
+            return false;
+        }
+        ECopyOptionItem eCopyOptionItem = (ECopyOptionItem) obj;
+        if (this.key != eCopyOptionItem.key || (eCopyOptionItemChoiceType = this.choiceType) != eCopyOptionItem.choiceType || this.isLocalOption != eCopyOptionItem.isLocalOption) {
+            return false;
+        }
+        if (eCopyOptionItemChoiceType == ECopyOptionItemChoiceType.ChoiceArray) {
+            return this.choiceArray.equals(eCopyOptionItem.choiceArray);
+        }
+        return this.numberRange.equals(eCopyOptionItem.numberRange);
+    }
+
+    public enum ECopyOptionItemKey {
+        ColorEffectsType(ERemoteOperation.ERemoteParam.color_effects_type),
+        ScanContentType(ERemoteOperation.ERemoteParam.scan_content_type),
+        PrintMediaType(ERemoteOperation.ERemoteParam.print_media_type),
+        PrintMediaSize(ERemoteOperation.ERemoteParam.print_media_size),
+        PrintMediaSource(ERemoteOperation.ERemoteParam.print_media_source),
+        PrintQuality(ERemoteOperation.ERemoteParam.print_quality),
+        PrintXBleed(ERemoteOperation.ERemoteParam.print_x_bleed),
+        XDensity(ERemoteOperation.ERemoteParam.x_density),
+        XApf(ERemoteOperation.ERemoteParam.x_apf),
+        XColorRestoration(ERemoteOperation.ERemoteParam.x_color_restoration),
+        XBorderless(ERemoteOperation.ERemoteParam.x_borderless),
+        CopyMagnification(ERemoteOperation.ERemoteParam.copy_magnification),
+        Copies(ERemoteOperation.ERemoteParam.copies),
+        XScale(ERemoteOperation.ERemoteParam.x_scale),
+        InvalidKey(ERemoteOperation.ERemoteParam.x_null);
+        
+        ERemoteOperation.ERemoteParam param;
+
+        private ECopyOptionItemKey(ERemoteOperation.ERemoteParam eRemoteParam) {
+            this.param = eRemoteParam;
+        }
+    }
+
+    public enum ECopyOptionItemChoice {
+        ColorEffectsType_Color(ECopyOptionItemKey.ColorEffectsType, ERemoteOperation.ERemoteParam.color),
+        ColorEffectsType_MonochromeGrayscale(ECopyOptionItemKey.ColorEffectsType, ERemoteOperation.ERemoteParam.monochrome_grayscale),
+        ScanContentType_Text(ECopyOptionItemKey.ScanContentType, ERemoteOperation.ERemoteParam.text),
+        ScanContentType_Mixed(ECopyOptionItemKey.ScanContentType, ERemoteOperation.ERemoteParam.mixed),
+        ScanContentType_Photographic(ECopyOptionItemKey.ScanContentType, ERemoteOperation.ERemoteParam.photographic),
+        PrintMediaSource_Top(ECopyOptionItemKey.PrintMediaSource, ERemoteOperation.ERemoteParam.top),
+        PrintMediaSource_Bottom(ECopyOptionItemKey.PrintMediaSource, ERemoteOperation.ERemoteParam.bottom),
+        PrintMediaSource_Rear(ECopyOptionItemKey.PrintMediaSource, ERemoteOperation.ERemoteParam.rear),
+        PrintMediaSource_Manual(ECopyOptionItemKey.PrintMediaSource, ERemoteOperation.ERemoteParam.manual),
+        PrintMediaType_Stationery(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.stationery),
+        PrintMediaType_PhotographicHighGloss(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.photographic_high_gloss),
+        PrintMediaType_Photographic(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.photographic),
+        PrintMediaType_PhotographicSemiGloss(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.photographic_semi_gloss),
+        PrintMediaType_PhotographicGlossy(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.photographic_glossy),
+        PrintMediaType_CustomMediaTypeEpson44(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.custom_media_type_epson_44),
+        PrintMediaType_PhotographicMatte(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.photographic_matte),
+        PrintMediaType_StationeryCoated(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.stationery_coated),
+        PrintMediaType_CustomMediaTypeEpson2A(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.custom_media_type_epson_2a),
+        PrintMediaType_StationeryInkjet(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.stationery_inkjet),
+        PrintMediaType_CustomMediaTypeEpson1B(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.custom_media_type_epson_1b),
+        PrintMediaType_CustomMediaTypeEpson02(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.custom_media_type_epson_02),
+        PrintMediaType_CustomMediaTypeEpson19(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.custom_media_type_epson_19),
+        PrintMediaType_Lebals(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.labels),
+        PrintMediaType_Envelope(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.envelope),
+        PrintMediaType_DBLMEISHI_HALFGROSSY(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.custom_media_type_epson_47),
+        PrintMediaType_HagakiAtena(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.custom_media_type_epson_20),
+        PrintMediaType_BussnessPlain(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.custom_media_type_epson_39),
+        PrintMediaType_StationeryHeavyweight(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.stationery_heavyweight),
+        PrintMediaType_StationeryLetterhead(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.stationery_letterhead),
+        PrintMediaType_BrightColorPlain(ECopyOptionItemKey.PrintMediaType, ERemoteOperation.ERemoteParam.custom_media_type_epson_46),
+        PrintMediaSize_A4(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.iso_a4_210x297mm),
+        PrintMediaSize_B4(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.jis_b4_257x364mm),
+        PrintMediaSize_B5(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.jis_b5_182x257mm),
+        PrintMediaSize_L(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.oe_photo_l_3_5x5in),
+        PrintMediaSize_2L(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.na_5x7_5x7in),
+        PrintMediaSize_Postcard(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.jpn_hagaki_100x148mm),
+        PrintMediaSize_KG(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.na_index_4x6_4x6in),
+        PrintMediaSize_8x10in(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.na_govt_letter_8x10in),
+        PrintMediaSize_Letter(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.na_letter_8_5x11in),
+        PrintMediaSize_Legal(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.na_legal_8_5x14in),
+        PrintMediaSize_A5(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.iso_a5_148x210mm),
+        PrintMediaSize_254x305mm(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.custom_4psize_254x305mm),
+        PrintMediaSize_A3(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.iso_a3_297x420mm),
+        PrintMediaSize_US_B(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.na_ledger_11x17in),
+        PrintMediaSize_A6(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.iso_a6_105x148mm),
+        PrintMediaSize_CHOU3(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.jpn_chou3_120x235mm),
+        PrintMediaSize_CHOU4(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.jpn_chou4_90x205mm),
+        PrintMediaSize_YOU1(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.custom_epson_18_120x176mm),
+        PrintMediaSize_YOU3(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.custom_epson_1A_98x148mm),
+        PrintMediaSize_YOU4(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.jpn_you4_105x235mm),
+        PrintMediaSize_YOU2(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.iso_c6_114x162mm),
+        PrintMediaSize_KAKU2(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.jpn_kaku2_240x332mm),
+        PrintMediaSize_KAKU20(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.iso_c4_229x324mm),
+        PrintMediaSize_MEISHI(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.custom_cardsize_55x91mm),
+        PrintMediaSize_CARD(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.custom_creditcardsize_54x86mm),
+        PrintMediaSize_Hivision(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.custom_hivision_101_6x180_6mm),
+        PrintMediaSize_EnvelopeDL(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.iso_dl_110x220mm),
+        PrintMediaSize_B6(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.jis_b6_128x182mm),
+        PrintMediaSize_Executive(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.na_executive_7_25x10_5in),
+        PrintMediaSize_8d5x13in(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.na_foolscap_8_5x13in),
+        PrintMediaSize_11x14in(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.na_edp_11x14in),
+        PrintMediaSize_EnvelopeNumber10(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.na_number_10_4_125x9_5in),
+        PrintMediaSize_8K(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.om_8k_270x390mm),
+        PrintMediaSize_16K(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.om_16k_195x270mm),
+        PrintMediaSize_HalfLetter(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.na_invoice_5_5x8_5in),
+        PrintMediaSize_IndianLegal215x345mm(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.custom_epson_indianlegal_215x345mm),
+        PrintMediaSize_MexicoOficio8d5x13d4in(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.na_oficio_8_5x13_4in),
+        PrintMediaSize_Oficio9_8d46x12d4in(ECopyOptionItemKey.PrintMediaSize, ERemoteOperation.ERemoteParam.om_folio_sp_215x315mm),
+        PrintXBleed_Standard(ECopyOptionItemKey.PrintXBleed, ERemoteOperation.ERemoteParam.standard),
+        PrintXBleed_Midium(ECopyOptionItemKey.PrintXBleed, ERemoteOperation.ERemoteParam.midium),
+        PrintXBleed_Minimum(ECopyOptionItemKey.PrintXBleed, ERemoteOperation.ERemoteParam.minimum),
+        PrintQuality_Economy(ECopyOptionItemKey.PrintQuality, ERemoteOperation.ERemoteParam.draft),
+        PrintQuality_Normal(ECopyOptionItemKey.PrintQuality, ERemoteOperation.ERemoteParam.normal),
+        PrintQuality_High(ECopyOptionItemKey.PrintQuality, ERemoteOperation.ERemoteParam.high),
+        PrintQuality_Best(ECopyOptionItemKey.PrintQuality, ERemoteOperation.ERemoteParam.best),
+        XApf_On(ECopyOptionItemKey.XApf, ERemoteOperation.ERemoteParam.on),
+        XApf_Off(ECopyOptionItemKey.XApf, ERemoteOperation.ERemoteParam.off),
+        XColorRestoration_On(ECopyOptionItemKey.XColorRestoration, ERemoteOperation.ERemoteParam.on),
+        XColorRestoration_Off(ECopyOptionItemKey.XColorRestoration, ERemoteOperation.ERemoteParam.off),
+        XBorderless_Borderless(ECopyOptionItemKey.XBorderless, ERemoteOperation.ERemoteParam.borderless),
+        XBorderless_Standard(ECopyOptionItemKey.XBorderless, ERemoteOperation.ERemoteParam.standard),
+        XScale_FullSize(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_fullsize),
+        XScale_Custom(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_custom),
+        XScale_Autofit(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_autofit),
+        XScale_A4_to_Postcard(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_a4_to_postcard),
+        XScale_2L_to_Postcard(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_2l_to_postcard),
+        XScale_L_to_Postcard(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_l_to_postcard),
+        XScale_L_to_2L(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_l_to_2l),
+        XScale_2L_to_A4(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_2l_to_a4),
+        XScale_Postcard_to_A4(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_postcard_to_a4),
+        XScale_L_to_A4(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_l_to_a4),
+        XScale_A4_to_B5(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_a4_to_b5),
+        XScale_B5_to_A4(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_b5_to_a4),
+        XScale_Letter_to_KG(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_letter_to_kg),
+        XScale_KG_to_Letter(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_kg_to_letter),
+        XScale_Letter_to_2L(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_letter_to_2l),
+        XScale_2L_to_Letter(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_2l_to_letter),
+        XScale_KG_to_A4(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_kg_to_a4),
+        XScale_A4_to_KG(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_a4_to_kg),
+        XScale_A4_to_2L(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_a4_to_2l),
+        XScale_KG_to_8x10(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_kg_to_8x10),
+        XScale_8x10_to_2L(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_8x10_to_2l),
+        XScale_Legal_to_Letter(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_legal_to_letter),
+        XScale_2L_to_KG(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_2l_to_kg),
+        XScale_KG_to_2L(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_kg_to_2l),
+        XScale_A5_to_A4(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_a5_to_a4),
+        XScale_A4_to_A5(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_a4_to_a5),
+        XScale_A4_to_A3(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_a4_to_a3),
+        XScale_Letter_to_11x17(ECopyOptionItemKey.XScale, ERemoteOperation.ERemoteParam.x_scale_letter_to_11x17);
+        
+        ECopyOptionItemKey key;
+        ERemoteOperation.ERemoteParam param;
+
+        private ECopyOptionItemChoice(ECopyOptionItemKey eCopyOptionItemKey, ERemoteOperation.ERemoteParam eRemoteParam) {
+            this.param = eRemoteParam;
+        }
+
+        public ERemoteOperation.ERemoteParam getParam() {
+            return this.param;
+        }
+
+        /* JADX WARNING: Code restructure failed: missing block: B:101:0x00c6, code lost:
+            return PrintMediaSize_YOU3;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:103:0x00c9, code lost:
+            return PrintMediaSize_YOU1;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:105:0x00cc, code lost:
+            return PrintMediaSize_CHOU4;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:107:0x00cf, code lost:
+            return PrintMediaSize_CHOU3;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:109:0x00d2, code lost:
+            return PrintMediaSize_A6;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:111:0x00d5, code lost:
+            return PrintMediaSize_US_B;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:113:0x00d8, code lost:
+            return PrintMediaSize_A3;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:115:0x00db, code lost:
+            return PrintMediaSize_254x305mm;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:117:0x00de, code lost:
+            return PrintMediaSize_A5;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:119:0x00e1, code lost:
+            return PrintMediaSize_Legal;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:11:0x002d, code lost:
+            return ScanContentType_Photographic;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:121:0x00e4, code lost:
+            return PrintMediaSize_Letter;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:123:0x00e7, code lost:
+            return PrintMediaSize_8x10in;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:125:0x00ea, code lost:
+            return PrintMediaSize_KG;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:127:0x00ed, code lost:
+            return PrintMediaSize_Postcard;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:129:0x00f0, code lost:
+            return PrintMediaSize_2L;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:131:0x00f3, code lost:
+            return PrintMediaSize_L;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:133:0x00f6, code lost:
+            return PrintMediaSize_B5;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:135:0x00f9, code lost:
+            return PrintMediaSize_B4;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:137:0x00fc, code lost:
+            return PrintMediaSize_A4;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:139:0x0105, code lost:
+            switch(r2) {
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.top :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0112;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.bottom :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x010f;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.rear :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x010c;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.manual :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0109;
+                default: goto L_0x0108;
+            };
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:13:0x0030, code lost:
+            return ScanContentType_Mixed;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:141:0x010b, code lost:
+            return PrintMediaSource_Manual;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:143:0x010e, code lost:
+            return PrintMediaSource_Rear;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:145:0x0111, code lost:
+            return PrintMediaSource_Bottom;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:147:0x0114, code lost:
+            return PrintMediaSource_Top;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:149:0x011d, code lost:
+            switch(r2) {
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.draft :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x012a;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.normal :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0127;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.high :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0124;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.best :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0121;
+                default: goto L_0x0120;
+            };
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:151:0x0123, code lost:
+            return PrintQuality_Best;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:153:0x0126, code lost:
+            return PrintQuality_High;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:155:0x0129, code lost:
+            return PrintQuality_Normal;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:157:0x012c, code lost:
+            return PrintQuality_Economy;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:159:0x0135, code lost:
+            switch(r2) {
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.standard :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x013f;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.midium :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x013c;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.minimum :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0139;
+                default: goto L_0x0138;
+            };
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:15:0x0033, code lost:
+            return ScanContentType_Text;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:161:0x013b, code lost:
+            return PrintXBleed_Minimum;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:163:0x013e, code lost:
+            return PrintXBleed_Midium;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:165:0x0141, code lost:
+            return PrintXBleed_Standard;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:167:0x014a, code lost:
+            switch(r2) {
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.on :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0151;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.off :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x014e;
+                default: goto L_0x014d;
+            };
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:169:0x0150, code lost:
+            return XApf_Off;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:171:0x0153, code lost:
+            return XApf_On;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:173:0x015c, code lost:
+            switch(r2) {
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.on :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0163;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.off :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0160;
+                default: goto L_0x015f;
+            };
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:175:0x0162, code lost:
+            return XColorRestoration_Off;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:177:0x0165, code lost:
+            return XColorRestoration_On;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:178:0x0166, code lost:
+            r1 = epson.print.copy.Component.ecopycomponent.ECopyOptionItem.C21712.f359xed9088c4[r2.ordinal()];
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:179:0x0170, code lost:
+            if (r1 == 72) goto L_0x01d9;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:17:0x003c, code lost:
+            switch(r2) {
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.photographic :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x007c;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.stationery :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0079;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.photographic_high_gloss :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0076;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.photographic_semi_gloss :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0073;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.photographic_glossy :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0070;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.custom_media_type_epson_44 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x006d;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.photographic_matte :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x006a;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.stationery_coated :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0067;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.custom_media_type_epson_2a :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0064;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.stationery_inkjet :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0061;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.custom_media_type_epson_1b :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x005e;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.custom_media_type_epson_02 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x005b;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.custom_media_type_epson_19 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0058;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.labels :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0055;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.envelope :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0052;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.custom_media_type_epson_47 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x004f;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.custom_media_type_epson_20 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x004c;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.custom_media_type_epson_39 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0049;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.stationery_heavyweight :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0046;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.stationery_letterhead :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0043;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.custom_media_type_epson_46 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0040;
+                default: goto L_0x003f;
+            };
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:181:0x0174, code lost:
+            if (r1 == 77) goto L_0x01d6;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:183:0x017e, code lost:
+            switch(r2) {
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_fullsize :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01d3;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_custom :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01d0;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_autofit :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01cd;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_a4_to_postcard :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01ca;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_2l_to_postcard :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01c7;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_l_to_postcard :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01c4;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_l_to_2l :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01c1;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_2l_to_a4 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01be;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_a4_to_2l :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01bb;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_postcard_to_a4 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01b8;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_l_to_a4 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01b5;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_a4_to_b5 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01b2;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_b5_to_a4 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01af;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_letter_to_kg :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01ac;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_kg_to_letter :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01a9;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_letter_to_2l :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01a6;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_2l_to_letter :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01a3;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_kg_to_a4 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x01a0;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_a4_to_kg :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x019d;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_kg_to_8x10 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x019a;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_8x10_to_2l :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0197;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_legal_to_letter :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0194;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_2l_to_kg :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0191;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_kg_to_2l :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x018e;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_a5_to_a4 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x018b;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_a4_to_a5 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0188;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_a4_to_a3 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0185;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_scale_letter_to_11x17 :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0182;
+                default: goto L_0x0181;
+            };
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:185:0x0184, code lost:
+            return XScale_Letter_to_11x17;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:187:0x0187, code lost:
+            return XScale_A4_to_A3;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:189:0x018a, code lost:
+            return XScale_A4_to_A5;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:191:0x018d, code lost:
+            return XScale_A5_to_A4;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:193:0x0190, code lost:
+            return XScale_KG_to_2L;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:195:0x0193, code lost:
+            return XScale_2L_to_KG;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:197:0x0196, code lost:
+            return XScale_Legal_to_Letter;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:199:0x0199, code lost:
+            return XScale_8x10_to_2L;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:19:0x0042, code lost:
+            return PrintMediaType_BrightColorPlain;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:201:0x019c, code lost:
+            return XScale_KG_to_8x10;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:203:0x019f, code lost:
+            return XScale_A4_to_KG;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:205:0x01a2, code lost:
+            return XScale_KG_to_A4;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:207:0x01a5, code lost:
+            return XScale_2L_to_Letter;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:209:0x01a8, code lost:
+            return XScale_Letter_to_2L;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:211:0x01ab, code lost:
+            return XScale_KG_to_Letter;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:213:0x01ae, code lost:
+            return XScale_Letter_to_KG;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:215:0x01b1, code lost:
+            return XScale_B5_to_A4;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:217:0x01b4, code lost:
+            return XScale_A4_to_B5;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:219:0x01b7, code lost:
+            return XScale_L_to_A4;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:21:0x0045, code lost:
+            return PrintMediaType_StationeryLetterhead;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:221:0x01ba, code lost:
+            return XScale_Postcard_to_A4;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:223:0x01bd, code lost:
+            return XScale_A4_to_2L;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:225:0x01c0, code lost:
+            return XScale_2L_to_A4;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:227:0x01c3, code lost:
+            return XScale_L_to_2L;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:229:0x01c6, code lost:
+            return XScale_L_to_Postcard;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:231:0x01c9, code lost:
+            return XScale_2L_to_Postcard;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:233:0x01cc, code lost:
+            return XScale_A4_to_Postcard;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:235:0x01cf, code lost:
+            return XScale_Autofit;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:237:0x01d2, code lost:
+            return XScale_Custom;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:239:0x01d5, code lost:
+            return XScale_FullSize;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:23:0x0048, code lost:
+            return PrintMediaType_StationeryHeavyweight;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:241:0x01d8, code lost:
+            return XBorderless_Borderless;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:243:0x01db, code lost:
+            return XBorderless_Standard;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:245:?, code lost:
+            return null;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:25:0x004b, code lost:
+            return PrintMediaType_BussnessPlain;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:27:0x004e, code lost:
+            return PrintMediaType_HagakiAtena;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:29:0x0051, code lost:
+            return PrintMediaType_DBLMEISHI_HALFGROSSY;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:31:0x0054, code lost:
+            return PrintMediaType_Envelope;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:33:0x0057, code lost:
+            return PrintMediaType_Lebals;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:35:0x005a, code lost:
+            return PrintMediaType_CustomMediaTypeEpson19;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:37:0x005d, code lost:
+            return PrintMediaType_CustomMediaTypeEpson02;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:39:0x0060, code lost:
+            return PrintMediaType_CustomMediaTypeEpson1B;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:41:0x0063, code lost:
+            return PrintMediaType_StationeryInkjet;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:43:0x0066, code lost:
+            return PrintMediaType_CustomMediaTypeEpson2A;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:45:0x0069, code lost:
+            return PrintMediaType_StationeryCoated;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:47:0x006c, code lost:
+            return PrintMediaType_PhotographicMatte;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:49:0x006f, code lost:
+            return PrintMediaType_CustomMediaTypeEpson44;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:51:0x0072, code lost:
+            return PrintMediaType_PhotographicGlossy;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:53:0x0075, code lost:
+            return PrintMediaType_PhotographicSemiGloss;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:55:0x0078, code lost:
+            return PrintMediaType_PhotographicHighGloss;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:57:0x007b, code lost:
+            return PrintMediaType_Stationery;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:59:0x007e, code lost:
+            return PrintMediaType_Photographic;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:61:0x0087, code lost:
+            switch(r2) {
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.iso_a4_210x297mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00fa;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.jis_b4_257x364mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00f7;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.jis_b5_182x257mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00f4;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.oe_photo_l_3_5x5in :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00f1;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.na_5x7_5x7in :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00ee;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.jpn_hagaki_100x148mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00eb;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.na_index_4x6_4x6in :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00e8;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.na_govt_letter_8x10in :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00e5;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.na_letter_8_5x11in :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00e2;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.na_legal_8_5x14in :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00df;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.iso_a5_148x210mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00dc;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.custom_4psize_254x305mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00d9;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.iso_a3_297x420mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00d6;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.na_ledger_11x17in :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00d3;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.iso_a6_105x148mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00d0;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.jpn_chou3_120x235mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00cd;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.jpn_chou4_90x205mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00ca;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.custom_epson_18_120x176mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00c7;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.custom_epson_1A_98x148mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00c4;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.jpn_you4_105x235mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00c1;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.iso_c6_114x162mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00be;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.jpn_kaku2_240x332mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00bb;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.iso_c4_229x324mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00b8;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.custom_cardsize_55x91mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00b5;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.custom_creditcardsize_54x86mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00b2;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.custom_hivision_101_6x180_6mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00af;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.iso_dl_110x220mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00ac;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.jis_b6_128x182mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00a9;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.na_executive_7_25x10_5in :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00a6;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.na_foolscap_8_5x13in :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00a3;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.na_edp_11x14in :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x00a0;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.na_number_10_4_125x9_5in :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x009d;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.om_8k_270x390mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x009a;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.om_16k_195x270mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0097;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.na_invoice_5_5x8_5in :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0094;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.custom_epson_indianlegal_215x345mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0091;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.na_oficio_8_5x13_4in :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x008e;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.om_folio_sp_215x315mm :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x008b;
+                default: goto L_0x008a;
+            };
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:63:0x008d, code lost:
+            return PrintMediaSize_Oficio9_8d46x12d4in;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:65:0x0090, code lost:
+            return PrintMediaSize_MexicoOficio8d5x13d4in;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:67:0x0093, code lost:
+            return PrintMediaSize_IndianLegal215x345mm;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:69:0x0096, code lost:
+            return PrintMediaSize_HalfLetter;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:71:0x0099, code lost:
+            return PrintMediaSize_16K;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:73:0x009c, code lost:
+            return PrintMediaSize_8K;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:75:0x009f, code lost:
+            return PrintMediaSize_EnvelopeNumber10;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:77:0x00a2, code lost:
+            return PrintMediaSize_11x14in;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:79:0x00a5, code lost:
+            return PrintMediaSize_8d5x13in;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:81:0x00a8, code lost:
+            return PrintMediaSize_Executive;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:83:0x00ab, code lost:
+            return PrintMediaSize_B6;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:85:0x00ae, code lost:
+            return PrintMediaSize_EnvelopeDL;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:87:0x00b1, code lost:
+            return PrintMediaSize_Hivision;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:89:0x00b4, code lost:
+            return PrintMediaSize_CARD;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:91:0x00b7, code lost:
+            return PrintMediaSize_MEISHI;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:93:0x00ba, code lost:
+            return PrintMediaSize_KAKU20;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:95:0x00bd, code lost:
+            return PrintMediaSize_KAKU2;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:97:0x00c0, code lost:
+            return PrintMediaSize_YOU2;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:99:0x00c3, code lost:
+            return PrintMediaSize_YOU4;
+         */
+        /* JADX WARNING: Code restructure failed: missing block: B:9:0x0027, code lost:
+            switch(r2) {
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.text :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x0031;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.mixed :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x002e;
+                case epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.photographic :epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam: goto L_0x002b;
+                default: goto L_0x002a;
+            };
+         */
+        /* Code decompiled incorrectly, please refer to instructions dump. */
+        public static epson.print.copy.Component.ecopycomponent.ECopyOptionItem.ECopyOptionItemChoice valueOf(epson.print.copy.Component.ecopycomponent.ECopyOptionItem.ECopyOptionItemKey r1, epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam r2) {
+            /*
+                int[] r0 = epson.print.copy.Component.ecopycomponent.ECopyOptionItem.C21712.f358x5d658d7e
+                int r1 = r1.ordinal()
+                r1 = r0[r1]
+                switch(r1) {
+                    case 1: goto L_0x000d;
+                    case 2: goto L_0x001f;
+                    case 3: goto L_0x0034;
+                    case 4: goto L_0x007f;
+                    case 5: goto L_0x00fd;
+                    case 6: goto L_0x0115;
+                    case 7: goto L_0x012d;
+                    case 8: goto L_0x0142;
+                    case 9: goto L_0x0154;
+                    case 10: goto L_0x0166;
+                    case 11: goto L_0x0176;
+                    default: goto L_0x000b;
+                }
+            L_0x000b:
+                goto L_0x01dc
+            L_0x000d:
+                int[] r1 = epson.print.copy.Component.ecopycomponent.ECopyOptionItem.C21712.f359xed9088c4
+                int r0 = r2.ordinal()
+                r1 = r1[r0]
+                switch(r1) {
+                    case 1: goto L_0x001c;
+                    case 2: goto L_0x0019;
+                    default: goto L_0x0018;
+                }
+            L_0x0018:
+                goto L_0x001f
+            L_0x0019:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = ColorEffectsType_MonochromeGrayscale
+                return r1
+            L_0x001c:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = ColorEffectsType_Color
+                return r1
+            L_0x001f:
+                int[] r1 = epson.print.copy.Component.ecopycomponent.ECopyOptionItem.C21712.f359xed9088c4
+                int r0 = r2.ordinal()
+                r1 = r1[r0]
+                switch(r1) {
+                    case 3: goto L_0x0031;
+                    case 4: goto L_0x002e;
+                    case 5: goto L_0x002b;
+                    default: goto L_0x002a;
+                }
+            L_0x002a:
+                goto L_0x0034
+            L_0x002b:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = ScanContentType_Photographic
+                return r1
+            L_0x002e:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = ScanContentType_Mixed
+                return r1
+            L_0x0031:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = ScanContentType_Text
+                return r1
+            L_0x0034:
+                int[] r1 = epson.print.copy.Component.ecopycomponent.ECopyOptionItem.C21712.f359xed9088c4
+                int r0 = r2.ordinal()
+                r1 = r1[r0]
+                switch(r1) {
+                    case 5: goto L_0x007c;
+                    case 6: goto L_0x0079;
+                    case 7: goto L_0x0076;
+                    case 8: goto L_0x0073;
+                    case 9: goto L_0x0070;
+                    case 10: goto L_0x006d;
+                    case 11: goto L_0x006a;
+                    case 12: goto L_0x0067;
+                    case 13: goto L_0x0064;
+                    case 14: goto L_0x0061;
+                    case 15: goto L_0x005e;
+                    case 16: goto L_0x005b;
+                    case 17: goto L_0x0058;
+                    case 18: goto L_0x0055;
+                    case 19: goto L_0x0052;
+                    case 20: goto L_0x004f;
+                    case 21: goto L_0x004c;
+                    case 22: goto L_0x0049;
+                    case 23: goto L_0x0046;
+                    case 24: goto L_0x0043;
+                    case 25: goto L_0x0040;
+                    default: goto L_0x003f;
+                }
+            L_0x003f:
+                goto L_0x007f
+            L_0x0040:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_BrightColorPlain
+                return r1
+            L_0x0043:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_StationeryLetterhead
+                return r1
+            L_0x0046:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_StationeryHeavyweight
+                return r1
+            L_0x0049:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_BussnessPlain
+                return r1
+            L_0x004c:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_HagakiAtena
+                return r1
+            L_0x004f:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_DBLMEISHI_HALFGROSSY
+                return r1
+            L_0x0052:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_Envelope
+                return r1
+            L_0x0055:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_Lebals
+                return r1
+            L_0x0058:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_CustomMediaTypeEpson19
+                return r1
+            L_0x005b:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_CustomMediaTypeEpson02
+                return r1
+            L_0x005e:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_CustomMediaTypeEpson1B
+                return r1
+            L_0x0061:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_StationeryInkjet
+                return r1
+            L_0x0064:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_CustomMediaTypeEpson2A
+                return r1
+            L_0x0067:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_StationeryCoated
+                return r1
+            L_0x006a:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_PhotographicMatte
+                return r1
+            L_0x006d:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_CustomMediaTypeEpson44
+                return r1
+            L_0x0070:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_PhotographicGlossy
+                return r1
+            L_0x0073:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_PhotographicSemiGloss
+                return r1
+            L_0x0076:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_PhotographicHighGloss
+                return r1
+            L_0x0079:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_Stationery
+                return r1
+            L_0x007c:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaType_Photographic
+                return r1
+            L_0x007f:
+                int[] r1 = epson.print.copy.Component.ecopycomponent.ECopyOptionItem.C21712.f359xed9088c4
+                int r0 = r2.ordinal()
+                r1 = r1[r0]
+                switch(r1) {
+                    case 26: goto L_0x00fa;
+                    case 27: goto L_0x00f7;
+                    case 28: goto L_0x00f4;
+                    case 29: goto L_0x00f1;
+                    case 30: goto L_0x00ee;
+                    case 31: goto L_0x00eb;
+                    case 32: goto L_0x00e8;
+                    case 33: goto L_0x00e5;
+                    case 34: goto L_0x00e2;
+                    case 35: goto L_0x00df;
+                    case 36: goto L_0x00dc;
+                    case 37: goto L_0x00d9;
+                    case 38: goto L_0x00d6;
+                    case 39: goto L_0x00d3;
+                    case 40: goto L_0x00d0;
+                    case 41: goto L_0x00cd;
+                    case 42: goto L_0x00ca;
+                    case 43: goto L_0x00c7;
+                    case 44: goto L_0x00c4;
+                    case 45: goto L_0x00c1;
+                    case 46: goto L_0x00be;
+                    case 47: goto L_0x00bb;
+                    case 48: goto L_0x00b8;
+                    case 49: goto L_0x00b5;
+                    case 50: goto L_0x00b2;
+                    case 51: goto L_0x00af;
+                    case 52: goto L_0x00ac;
+                    case 53: goto L_0x00a9;
+                    case 54: goto L_0x00a6;
+                    case 55: goto L_0x00a3;
+                    case 56: goto L_0x00a0;
+                    case 57: goto L_0x009d;
+                    case 58: goto L_0x009a;
+                    case 59: goto L_0x0097;
+                    case 60: goto L_0x0094;
+                    case 61: goto L_0x0091;
+                    case 62: goto L_0x008e;
+                    case 63: goto L_0x008b;
+                    default: goto L_0x008a;
+                }
+            L_0x008a:
+                goto L_0x00fd
+            L_0x008b:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_Oficio9_8d46x12d4in
+                return r1
+            L_0x008e:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_MexicoOficio8d5x13d4in
+                return r1
+            L_0x0091:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_IndianLegal215x345mm
+                return r1
+            L_0x0094:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_HalfLetter
+                return r1
+            L_0x0097:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_16K
+                return r1
+            L_0x009a:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_8K
+                return r1
+            L_0x009d:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_EnvelopeNumber10
+                return r1
+            L_0x00a0:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_11x14in
+                return r1
+            L_0x00a3:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_8d5x13in
+                return r1
+            L_0x00a6:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_Executive
+                return r1
+            L_0x00a9:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_B6
+                return r1
+            L_0x00ac:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_EnvelopeDL
+                return r1
+            L_0x00af:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_Hivision
+                return r1
+            L_0x00b2:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_CARD
+                return r1
+            L_0x00b5:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_MEISHI
+                return r1
+            L_0x00b8:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_KAKU20
+                return r1
+            L_0x00bb:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_KAKU2
+                return r1
+            L_0x00be:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_YOU2
+                return r1
+            L_0x00c1:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_YOU4
+                return r1
+            L_0x00c4:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_YOU3
+                return r1
+            L_0x00c7:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_YOU1
+                return r1
+            L_0x00ca:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_CHOU4
+                return r1
+            L_0x00cd:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_CHOU3
+                return r1
+            L_0x00d0:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_A6
+                return r1
+            L_0x00d3:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_US_B
+                return r1
+            L_0x00d6:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_A3
+                return r1
+            L_0x00d9:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_254x305mm
+                return r1
+            L_0x00dc:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_A5
+                return r1
+            L_0x00df:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_Legal
+                return r1
+            L_0x00e2:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_Letter
+                return r1
+            L_0x00e5:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_8x10in
+                return r1
+            L_0x00e8:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_KG
+                return r1
+            L_0x00eb:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_Postcard
+                return r1
+            L_0x00ee:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_2L
+                return r1
+            L_0x00f1:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_L
+                return r1
+            L_0x00f4:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_B5
+                return r1
+            L_0x00f7:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_B4
+                return r1
+            L_0x00fa:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSize_A4
+                return r1
+            L_0x00fd:
+                int[] r1 = epson.print.copy.Component.ecopycomponent.ECopyOptionItem.C21712.f359xed9088c4
+                int r0 = r2.ordinal()
+                r1 = r1[r0]
+                switch(r1) {
+                    case 64: goto L_0x0112;
+                    case 65: goto L_0x010f;
+                    case 66: goto L_0x010c;
+                    case 67: goto L_0x0109;
+                    default: goto L_0x0108;
+                }
+            L_0x0108:
+                goto L_0x0115
+            L_0x0109:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSource_Manual
+                return r1
+            L_0x010c:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSource_Rear
+                return r1
+            L_0x010f:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSource_Bottom
+                return r1
+            L_0x0112:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintMediaSource_Top
+                return r1
+            L_0x0115:
+                int[] r1 = epson.print.copy.Component.ecopycomponent.ECopyOptionItem.C21712.f359xed9088c4
+                int r0 = r2.ordinal()
+                r1 = r1[r0]
+                switch(r1) {
+                    case 68: goto L_0x012a;
+                    case 69: goto L_0x0127;
+                    case 70: goto L_0x0124;
+                    case 71: goto L_0x0121;
+                    default: goto L_0x0120;
+                }
+            L_0x0120:
+                goto L_0x012d
+            L_0x0121:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintQuality_Best
+                return r1
+            L_0x0124:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintQuality_High
+                return r1
+            L_0x0127:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintQuality_Normal
+                return r1
+            L_0x012a:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintQuality_Economy
+                return r1
+            L_0x012d:
+                int[] r1 = epson.print.copy.Component.ecopycomponent.ECopyOptionItem.C21712.f359xed9088c4
+                int r0 = r2.ordinal()
+                r1 = r1[r0]
+                switch(r1) {
+                    case 72: goto L_0x013f;
+                    case 73: goto L_0x013c;
+                    case 74: goto L_0x0139;
+                    default: goto L_0x0138;
+                }
+            L_0x0138:
+                goto L_0x0142
+            L_0x0139:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintXBleed_Minimum
+                return r1
+            L_0x013c:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintXBleed_Midium
+                return r1
+            L_0x013f:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = PrintXBleed_Standard
+                return r1
+            L_0x0142:
+                int[] r1 = epson.print.copy.Component.ecopycomponent.ECopyOptionItem.C21712.f359xed9088c4
+                int r0 = r2.ordinal()
+                r1 = r1[r0]
+                switch(r1) {
+                    case 75: goto L_0x0151;
+                    case 76: goto L_0x014e;
+                    default: goto L_0x014d;
+                }
+            L_0x014d:
+                goto L_0x0154
+            L_0x014e:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XApf_Off
+                return r1
+            L_0x0151:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XApf_On
+                return r1
+            L_0x0154:
+                int[] r1 = epson.print.copy.Component.ecopycomponent.ECopyOptionItem.C21712.f359xed9088c4
+                int r0 = r2.ordinal()
+                r1 = r1[r0]
+                switch(r1) {
+                    case 75: goto L_0x0163;
+                    case 76: goto L_0x0160;
+                    default: goto L_0x015f;
+                }
+            L_0x015f:
+                goto L_0x0166
+            L_0x0160:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XColorRestoration_Off
+                return r1
+            L_0x0163:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XColorRestoration_On
+                return r1
+            L_0x0166:
+                int[] r1 = epson.print.copy.Component.ecopycomponent.ECopyOptionItem.C21712.f359xed9088c4
+                int r0 = r2.ordinal()
+                r1 = r1[r0]
+                r0 = 72
+                if (r1 == r0) goto L_0x01d9
+                r0 = 77
+                if (r1 == r0) goto L_0x01d6
+            L_0x0176:
+                int[] r1 = epson.print.copy.Component.ecopycomponent.ECopyOptionItem.C21712.f359xed9088c4
+                int r2 = r2.ordinal()
+                r1 = r1[r2]
+                switch(r1) {
+                    case 78: goto L_0x01d3;
+                    case 79: goto L_0x01d0;
+                    case 80: goto L_0x01cd;
+                    case 81: goto L_0x01ca;
+                    case 82: goto L_0x01c7;
+                    case 83: goto L_0x01c4;
+                    case 84: goto L_0x01c1;
+                    case 85: goto L_0x01be;
+                    case 86: goto L_0x01bb;
+                    case 87: goto L_0x01b8;
+                    case 88: goto L_0x01b5;
+                    case 89: goto L_0x01b2;
+                    case 90: goto L_0x01af;
+                    case 91: goto L_0x01ac;
+                    case 92: goto L_0x01a9;
+                    case 93: goto L_0x01a6;
+                    case 94: goto L_0x01a3;
+                    case 95: goto L_0x01a0;
+                    case 96: goto L_0x019d;
+                    case 97: goto L_0x019a;
+                    case 98: goto L_0x0197;
+                    case 99: goto L_0x0194;
+                    case 100: goto L_0x0191;
+                    case 101: goto L_0x018e;
+                    case 102: goto L_0x018b;
+                    case 103: goto L_0x0188;
+                    case 104: goto L_0x0185;
+                    case 105: goto L_0x0182;
+                    default: goto L_0x0181;
+                }
+            L_0x0181:
+                goto L_0x01dc
+            L_0x0182:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_Letter_to_11x17
+                return r1
+            L_0x0185:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_A4_to_A3
+                return r1
+            L_0x0188:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_A4_to_A5
+                return r1
+            L_0x018b:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_A5_to_A4
+                return r1
+            L_0x018e:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_KG_to_2L
+                return r1
+            L_0x0191:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_2L_to_KG
+                return r1
+            L_0x0194:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_Legal_to_Letter
+                return r1
+            L_0x0197:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_8x10_to_2L
+                return r1
+            L_0x019a:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_KG_to_8x10
+                return r1
+            L_0x019d:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_A4_to_KG
+                return r1
+            L_0x01a0:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_KG_to_A4
+                return r1
+            L_0x01a3:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_2L_to_Letter
+                return r1
+            L_0x01a6:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_Letter_to_2L
+                return r1
+            L_0x01a9:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_KG_to_Letter
+                return r1
+            L_0x01ac:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_Letter_to_KG
+                return r1
+            L_0x01af:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_B5_to_A4
+                return r1
+            L_0x01b2:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_A4_to_B5
+                return r1
+            L_0x01b5:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_L_to_A4
+                return r1
+            L_0x01b8:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_Postcard_to_A4
+                return r1
+            L_0x01bb:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_A4_to_2L
+                return r1
+            L_0x01be:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_2L_to_A4
+                return r1
+            L_0x01c1:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_L_to_2L
+                return r1
+            L_0x01c4:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_L_to_Postcard
+                return r1
+            L_0x01c7:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_2L_to_Postcard
+                return r1
+            L_0x01ca:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_A4_to_Postcard
+                return r1
+            L_0x01cd:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_Autofit
+                return r1
+            L_0x01d0:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_Custom
+                return r1
+            L_0x01d3:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XScale_FullSize
+                return r1
+            L_0x01d6:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XBorderless_Borderless
+                return r1
+            L_0x01d9:
+                epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice r1 = XBorderless_Standard
+                return r1
+            L_0x01dc:
+                r1 = 0
+                return r1
+            */
+            throw new UnsupportedOperationException("Method not decompiled: epson.print.copy.Component.ecopycomponent.ECopyOptionItem.ECopyOptionItemChoice.valueOf(epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemKey, epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam):epson.print.copy.Component.ecopycomponent.ECopyOptionItem$ECopyOptionItemChoice");
+        }
+    }
+
+    public ECopyOptionItemKey getKey() {
+        return this.key;
+    }
+
+    public boolean isEnabled() {
+        return this.enabled;
+    }
+
+    public ECopyOptionItemChoiceType getChoiceType() {
+        return this.choiceType;
+    }
+
+    public int getMinimumValue() {
+        return this.numberRange.min;
+    }
+
+    public int getMaximumValue() {
+        return this.numberRange.max;
+    }
+
+    public int getDefaultValue() {
+        return this.numberRange.defaultValue;
+    }
+
+    /* access modifiers changed from: protected */
+    public void setDefaultValue(int i) {
+        this.numberRange.defaultValue = i;
+        selectValue(i);
+    }
+
+    public int getSelectedValue() {
+        return this.numberRange.selectedValue;
+    }
+
+    public void selectValue(int i) {
+        NumberRange numberRange2 = this.numberRange;
+        if (i != numberRange2.exceptionValue) {
+            i = Math.min(Math.max(this.numberRange.min, i), this.numberRange.max);
+        }
+        numberRange2.selectedValue = i;
+    }
+
+    public ArrayList<ECopyOptionItemChoice> getSelectableChoices() {
+        try {
+            return this.choiceArray.choices;
+        } catch (IndexOutOfBoundsException unused) {
+            return null;
+        }
+    }
+
+    public ECopyOptionItemChoice getDefaultChoice() {
+        try {
+            return this.choiceArray.choices.get(this.choiceArray.defaultChoice);
+        } catch (IndexOutOfBoundsException unused) {
+            return null;
+        }
+    }
+
+    public ECopyOptionItemChoice getSelectedChoice() {
+        try {
+            return this.choiceArray.choices.get(this.choiceArray.selectedChoice);
+        } catch (IndexOutOfBoundsException unused) {
+            return null;
+        }
+    }
+
+    public void selectChoice(ECopyOptionItemChoice eCopyOptionItemChoice) {
+        Iterator<ECopyOptionItemChoice> it = this.choiceArray.choices.iterator();
+        int i = 0;
+        while (it.hasNext()) {
+            if (it.next() == eCopyOptionItemChoice) {
+                this.choiceArray.selectedChoice = i;
+                return;
+            }
+            i++;
+        }
+    }
+
+    static ERemoteOperation.ERemoteParam layoutOf(ECopyComponent.ECopyType eCopyType) {
+        ERemoteOperation.ERemoteParam eRemoteParam = ERemoteOperation.ERemoteParam.standard;
+        switch (eCopyType) {
+            case Standard:
+                return ERemoteOperation.ERemoteParam.standard;
+            case Borderless:
+                return ERemoteOperation.ERemoteParam.borderless;
+            case A4_2up:
+                return ERemoteOperation.ERemoteParam.two_up;
+            case B5_2up:
+                return ERemoteOperation.ERemoteParam.two_up;
+            case A4_2up_Book:
+                return ERemoteOperation.ERemoteParam.two_up_book;
+            case B5_2up_Book:
+                return ERemoteOperation.ERemoteParam.two_up_book;
+            case Mirror:
+                return ERemoteOperation.ERemoteParam.mirror;
+            case Photo:
+                return ERemoteOperation.ERemoteParam.standard;
+            default:
+                return eRemoteParam;
+        }
+    }
+
+    static ECopyOptionItemKey key(ERemoteOperation.ERemoteParam eRemoteParam) {
+        ECopyOptionItemKey eCopyOptionItemKey = ECopyOptionItemKey.InvalidKey;
+        switch (eRemoteParam) {
+            case color_effects_type:
+                return ECopyOptionItemKey.ColorEffectsType;
+            case copies:
+                return ECopyOptionItemKey.Copies;
+            case copy_magnification:
+                return ECopyOptionItemKey.CopyMagnification;
+            case print_media_size:
+                return ECopyOptionItemKey.PrintMediaSize;
+            case print_media_source:
+                return ECopyOptionItemKey.PrintMediaSource;
+            case print_media_type:
+                return ECopyOptionItemKey.PrintMediaType;
+            case print_quality:
+                return ECopyOptionItemKey.PrintQuality;
+            case print_x_bleed:
+                return ECopyOptionItemKey.PrintXBleed;
+            case scan_content_type:
+                return ECopyOptionItemKey.ScanContentType;
+            case x_apf:
+                return ECopyOptionItemKey.XApf;
+            case x_color_restoration:
+                return ECopyOptionItemKey.XColorRestoration;
+            case x_borderless:
+                return ECopyOptionItemKey.XBorderless;
+            case x_scale:
+                return ECopyOptionItemKey.XScale;
+            case x_density:
+                return ECopyOptionItemKey.XDensity;
+            default:
+                return eCopyOptionItemKey;
+        }
+    }
+
+    static ECopyOptionItem createOptionItem(ERemoteOperation.ERemoteParam eRemoteParam, ERemoteCopy.ERemoteCopyOptionsResult eRemoteCopyOptionsResult) {
+        return new ECopyOptionItem(key(eRemoteParam), eRemoteCopyOptionsResult.parameter_options(eRemoteParam), eRemoteCopyOptionsResult.parameter_default(eRemoteParam));
+    }
+
+    public static ECopyOptionItem createOptionItem(ERemoteOperation.ERemoteParam eRemoteParam, int i, int i2, int i3) {
+        return new ECopyOptionItem(key(eRemoteParam), i, i2, i3, DefaultExceptionValue);
+    }
+
+    static ECopyOptionItem createLocalOptionItem(ERemoteOperation.ERemoteParam eRemoteParam, ERemoteCopy.ERemoteCopyOptionsResult eRemoteCopyOptionsResult) {
+        ECopyOptionItem eCopyOptionItem = new ECopyOptionItem(key(eRemoteParam), eRemoteCopyOptionsResult.local_options(eRemoteParam), eRemoteCopyOptionsResult.local_default(eRemoteParam));
+        eCopyOptionItem.isLocalOption = true;
+        return eCopyOptionItem;
+    }
+
+    static ECopyOptionItem createScaleOptionItem(ERemoteOperation.ERemoteParam eRemoteParam, ERemoteCopy.ERemoteCopyOptionsResult eRemoteCopyOptionsResult) {
+        ArrayList<ERemoteOperation.ERemoteParam> parameter_options = eRemoteCopyOptionsResult.parameter_options(ERemoteOperation.ERemoteParam.print_media_size);
+        eRemoteCopyOptionsResult.getClass();
+        ECopyOptionItem eCopyOptionItem = new ECopyOptionItem(key(eRemoteParam), new ERemoteCopy.ERemoteCopyOptionsResult.ScaleOptions(parameter_options).scale_options(), eRemoteCopyOptionsResult.local_default(eRemoteParam));
+        eCopyOptionItem.isLocalOption = true;
+        return eCopyOptionItem;
+    }
+
+    static ECopyOptionItem createLocalOptionItem(ERemoteOperation.ERemoteParam eRemoteParam, int i, int i2, int i3) {
+        ECopyOptionItem eCopyOptionItem = new ECopyOptionItem(key(eRemoteParam), i, i2, i3, DefaultExceptionValue);
+        eCopyOptionItem.isLocalOption = true;
+        return eCopyOptionItem;
+    }
+}

+ 711 - 0
app/src/main/java/epson/print/copy/Component/ecopycomponent/ECopyPreview.java

@@ -0,0 +1,711 @@
+package epson.print.copy.Component.ecopycomponent;
+
+import android.app.Activity;
+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.Path;
+import android.graphics.Point;
+import android.graphics.PointF;
+import android.graphics.Rect;
+import android.graphics.RectF;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+import android.support.p000v4.internal.view.SupportMenu;
+import android.view.View;
+import android.widget.LinearLayout;
+import epson.common.Constants;
+import epson.print.copy.Component.ecopycomponent.ECopyComponent;
+import epson.print.copy.Component.ecopycomponent.ECopyOptionItem;
+
+public class ECopyPreview extends View {
+
+    /* renamed from: A4 */
+    final Size f360A4 = new Size(1240, Constants.SCAN_MAX_HEIGHT);
+    final Size A4_2Up = new Size(Constants.SCAN_MAX_HEIGHT, 1240);
+    final Size A4_2UpPage = new Size(827, 1176);
+
+    /* renamed from: B5 */
+    final Size f361B5 = new Size(1075, 1518);
+    final int BM_2Up = 35;
+    final int BM_Border = 18;
+    final int BO_Type1 = 24;
+    final int BO_Type2 = 15;
+    final Size Hagaki = new Size(591, 874);
+
+    /* renamed from: KG */
+    final Size f362KG = new Size(602, 898);
+
+    /* renamed from: L */
+    final Size f363L = new Size(526, 750);
+
+    /* renamed from: L2 */
+    final Size f364L2 = new Size(750, 1051);
+    final int LM_2Up = 32;
+    final int LM_Border = 18;
+    final int LO_Type1 = 15;
+    final int LO_Type2 = 15;
+    final Size Max = new Size(Constants.SCAN_MAX_WIDTH, Constants.SCAN_MAX_HEIGHT);
+
+    /* renamed from: P6 */
+    final Size f365P6 = new Size(1199, 1500);
+    final int PG_2Up = 35;
+    final int PL_A4 = Constants.SCAN_MAX_HEIGHT;
+    final int PL_B5 = 1518;
+    final int PL_Hagaki = 874;
+    final int PL_KG = 898;
+    final int PL_L = 750;
+    final int PL_L2 = 1051;
+    final int PL_MAX = Constants.SCAN_MAX_HEIGHT;
+    final int PL_P6 = 1500;
+    final int PW_A4 = 1240;
+    final int PW_B5 = 1075;
+    final int PW_Hagaki = 591;
+    final int PW_KG = 602;
+    final int PW_L = 526;
+    final int PW_L2 = 750;
+    final int PW_MAX = Constants.SCAN_MAX_WIDTH;
+    final int PW_P6 = 1199;
+    final int RM_2Up = 32;
+    final int RM_Border = 18;
+    final int RO_Type1 = 15;
+    final int RO_Type2 = 15;
+    final int TM_2Up = 30;
+    final int TM_Border = 18;
+    final int TO_Type1 = 17;
+    final int TO_Type2 = 8;
+    Drawable backgroundDrawable = new ColorDrawable(0);
+    ECopyOptionItem colorOption;
+    ECopyOptionItem copiesOpiton;
+    Paint copyFramePaint = new Paint();
+    Size drawSize;
+    Paint grayscalePaint;
+    Layout layout;
+    ECopyPreviewInvalidateListener listener;
+    ICopyPreviewCommitEditedOptionContext optionCommitter;
+    ECopyOptionContext optionContext;
+    Drawable paperDrawable = new ColorDrawable(-1);
+    RectF paperFrame;
+    Rect paperPadding;
+    Paint paperShadowPaint;
+    ECopyOptionItem scaleOption;
+
+    public enum ECopyPreviewColor {
+        Color,
+        Monochrome
+    }
+
+    public interface ECopyPreviewInvalidateListener {
+        void needInvalidateView();
+    }
+
+    interface ICopyPreviewCommitEditedOptionContext {
+        void commit(ECopyOptionContext eCopyOptionContext);
+    }
+
+    protected interface ScanImageSizeCalculator {
+        void onScanImageSize(int i, int i2, float f);
+    }
+
+    private ECopyPreview(Context context) {
+        super(context);
+        this.copyFramePaint.setColor(SupportMenu.CATEGORY_MASK);
+        this.copyFramePaint.setStyle(Paint.Style.STROKE);
+        this.copyFramePaint.setStrokeWidth(2.0f);
+        this.paperPadding = new Rect();
+        this.grayscalePaint = new Paint();
+        this.paperShadowPaint = new Paint();
+        this.paperFrame = new RectF();
+        ColorMatrix colorMatrix = new ColorMatrix();
+        colorMatrix.setSaturation(0.0f);
+        this.grayscalePaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));
+    }
+
+    public void setBackground(Drawable drawable) {
+        this.backgroundDrawable = drawable;
+    }
+
+    public void setPaperDrawable(Drawable drawable) {
+        this.paperDrawable = drawable;
+    }
+
+    public void setCopyFramePaint(Paint paint) {
+        this.copyFramePaint = paint;
+    }
+
+    public void setPaperShadowPaint(Paint paint) {
+        this.paperShadowPaint = paint;
+    }
+
+    public void setPaperPadding(Rect rect) {
+        this.paperPadding = new Rect(rect);
+        resize();
+    }
+
+    /* access modifiers changed from: package-private */
+    public void requestInvalidateView() {
+        ((Activity) getContext()).runOnUiThread(new Runnable() {
+            public void run() {
+                ECopyPreview.this.listener.needInvalidateView();
+            }
+        });
+    }
+
+    public void setColor(ECopyPreviewColor eCopyPreviewColor) {
+        ECopyOptionItem.ECopyOptionItemChoice eCopyOptionItemChoice = ECopyOptionItem.ECopyOptionItemChoice.ColorEffectsType_Color;
+        if (eCopyPreviewColor == ECopyPreviewColor.Monochrome) {
+            eCopyOptionItemChoice = ECopyOptionItem.ECopyOptionItemChoice.ColorEffectsType_MonochromeGrayscale;
+        }
+        this.colorOption.selectChoice(eCopyOptionItemChoice);
+        requestInvalidateView();
+    }
+
+    public ECopyPreviewColor getColor() {
+        return this.colorOption.getSelectedChoice() == ECopyOptionItem.ECopyOptionItemChoice.ColorEffectsType_MonochromeGrayscale ? ECopyPreviewColor.Monochrome : ECopyPreviewColor.Color;
+    }
+
+    public void setScale(int i) {
+        this.scaleOption.selectValue(i);
+        this.layout.setCopyScale(((float) this.scaleOption.getSelectedValue()) / 100.0f);
+        requestInvalidateView();
+    }
+
+    public int getScale() {
+        return this.scaleOption.getSelectedValue();
+    }
+
+    public void setCopies(int i) {
+        this.copiesOpiton.selectValue(i);
+    }
+
+    public int getCopies() {
+        return this.copiesOpiton.getSelectedValue();
+    }
+
+    public void dismiss(boolean z) {
+        if (z) {
+            this.optionCommitter.commit(this.optionContext);
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public void compose(ECopyOptionContext eCopyOptionContext, ICopyPreviewCommitEditedOptionContext iCopyPreviewCommitEditedOptionContext) {
+        this.optionContext = eCopyOptionContext;
+        this.optionCommitter = iCopyPreviewCommitEditedOptionContext;
+        this.copiesOpiton = this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.Copies);
+        this.scaleOption = this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.CopyMagnification);
+        this.colorOption = this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.ColorEffectsType);
+        resize();
+    }
+
+    /* access modifiers changed from: package-private */
+    public void resize() {
+        int i = (this.drawSize.width - this.paperPadding.left) - this.paperPadding.right;
+        int i2 = (this.drawSize.height - this.paperPadding.top) - this.paperPadding.bottom;
+        ECopyComponent.ECopyType copyType = this.optionContext.getCopyType();
+        if (copyType == ECopyComponent.ECopyType.A4_2up || copyType == ECopyComponent.ECopyType.B5_2up || copyType == ECopyComponent.ECopyType.A4_2up_Book || copyType == ECopyComponent.ECopyType.B5_2up_Book) {
+            this.layout = new Layout2Up(i, i2);
+        } else if (copyType == ECopyComponent.ECopyType.Mirror) {
+            this.layout = new LayoutMirror(i, i2);
+        } else if (copyType == ECopyComponent.ECopyType.Borderless) {
+            this.layout = new LayoutBorderless(i, i2);
+        } else {
+            this.layout = new LayoutStandard(i, i2);
+        }
+        this.layout.setCopyScale(((float) this.scaleOption.getSelectedValue()) / 100.0f);
+    }
+
+    protected static ECopyPreview createPreview(Context context, int i, int i2, ECopyPreviewInvalidateListener eCopyPreviewInvalidateListener) {
+        ECopyPreview eCopyPreview = new ECopyPreview(context);
+        eCopyPreview.setLayoutParams(new LinearLayout.LayoutParams(i, i2));
+        eCopyPreview.getClass();
+        eCopyPreview.drawSize = new Size(i, i2);
+        eCopyPreview.listener = eCopyPreviewInvalidateListener;
+        return eCopyPreview;
+    }
+
+    /* access modifiers changed from: protected */
+    public void drawScanPreview(Bitmap bitmap) {
+        this.layout.setScanImage(bitmap);
+        requestInvalidateView();
+    }
+
+    /* access modifiers changed from: protected */
+    public void calculateScanImageSize(int i, int i2, ScanImageSizeCalculator scanImageSizeCalculator) {
+        float scanImageScale = this.layout.getScanImageScale(i, i2);
+        scanImageSizeCalculator.onScanImageSize((int) (((float) i) * scanImageScale), (int) (((float) i2) * scanImageScale), scanImageScale);
+    }
+
+    /* access modifiers changed from: protected */
+    public void setPaperFrame(RectF rectF) {
+        this.paperFrame = rectF;
+        this.layout.setPaperFrame(rectF);
+        requestInvalidateView();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onDraw(Canvas canvas) {
+        canvas.save();
+        this.backgroundDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
+        this.backgroundDrawable.draw(canvas);
+        Point offset = this.layout.getOffset();
+        offset.offset(this.paperPadding.left, this.paperPadding.top);
+        RectF paperRect = this.layout.getPaperRect();
+        paperRect.offset((float) offset.x, (float) offset.y);
+        if (this.optionContext.copyType == ECopyComponent.ECopyType.Mirror) {
+            canvas.scale(-1.0f, 1.0f);
+            canvas.translate(-(paperRect.centerX() * 2.0f), 0.0f);
+        }
+        canvas.drawRect(paperRect, this.paperShadowPaint);
+        Paint paint = null;
+        if (this.colorOption.getSelectedChoice() == ECopyOptionItem.ECopyOptionItemChoice.ColorEffectsType_MonochromeGrayscale) {
+            paint = this.grayscalePaint;
+        }
+        canvas.drawBitmap(this.layout.getBitmap(), (float) offset.x, (float) offset.y, paint);
+        RectF copyFrame = this.layout.getCopyFrame();
+        if (!this.paperFrame.isEmpty() && copyFrame != null) {
+            copyFrame.offset((float) offset.x, (float) offset.y);
+            Path path = new Path();
+            path.addRect(copyFrame, Path.Direction.CW);
+            canvas.drawPath(path, this.copyFramePaint);
+        }
+        canvas.restore();
+    }
+
+    class Size {
+        int height;
+        int width;
+
+        Size(int i, int i2) {
+            this.width = i;
+            this.height = i2;
+        }
+
+        Size(Size size) {
+            this.width = size.width;
+            this.height = size.height;
+        }
+
+        /* access modifiers changed from: package-private */
+        public void scale(float f) {
+            this.width = (int) (((float) this.width) * f);
+            this.height = (int) (((float) this.height) * f);
+        }
+    }
+
+    static abstract class Layout {
+
+        enum AspectFit {
+            Max,
+            Min
+        }
+
+        /* access modifiers changed from: package-private */
+        public abstract Bitmap getBitmap();
+
+        /* access modifiers changed from: package-private */
+        public abstract RectF getCopyFrame();
+
+        /* access modifiers changed from: package-private */
+        public abstract Point getOffset();
+
+        /* access modifiers changed from: package-private */
+        public abstract RectF getPaperRect();
+
+        /* access modifiers changed from: package-private */
+        public abstract float getScanImageScale(int i, int i2);
+
+        /* access modifiers changed from: package-private */
+        public abstract void setCopyScale(float f);
+
+        /* access modifiers changed from: package-private */
+        public abstract void setPaperFrame(RectF rectF);
+
+        /* access modifiers changed from: package-private */
+        public abstract void setScanImage(Bitmap bitmap);
+
+        Layout() {
+        }
+
+        /* access modifiers changed from: package-private */
+        public void scaleRect(float f, RectF rectF) {
+            Matrix matrix = new Matrix();
+            matrix.postScale(f, f);
+            matrix.mapRect(rectF);
+        }
+
+        /* access modifiers changed from: package-private */
+        public float getAspectFitScale(float f, float f2, float f3, float f4, AspectFit aspectFit) {
+            PointF pointF = new PointF();
+            pointF.x = f / f3;
+            pointF.y = f2 / f4;
+            return aspectFit == AspectFit.Min ? Math.min(pointF.x, pointF.y) : Math.max(pointF.x, pointF.y);
+        }
+    }
+
+    class LayoutStandard extends Layout {
+        boolean autofitEnabled = false;
+        Canvas canvas;
+        RectF copyFrame;
+        float copyScale = 1.0f;
+        float imageScale = 1.0f;
+        int layoutHeight;
+        int layoutWidth;
+        float limitCopyScaleDown = 0.0f;
+        Bitmap maxPaperImage;
+        Point offset = new Point();
+        RectF paper;
+        Path paperBorderClipPath = new Path();
+        Bitmap paperImage;
+        Size paperSize;
+        RectF scanFrame;
+        Bitmap scanImage;
+
+        LayoutStandard(int i, int i2) {
+            this.layoutWidth = i;
+            this.layoutHeight = i2;
+            if (ECopyPreview.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.XScale).getSelectedChoice() == ECopyOptionItem.ECopyOptionItemChoice.XScale_Autofit) {
+                this.autofitEnabled = true;
+            }
+            ECopyOptionItem copyOptionItemOf = ECopyPreview.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.PrintMediaSize);
+            switch (copyOptionItemOf.getSelectedChoice()) {
+                case PrintMediaSize_A4:
+                    this.paperSize = ECopyPreview.this.f360A4;
+                    break;
+                case PrintMediaSize_B5:
+                    this.paperSize = ECopyPreview.this.f361B5;
+                    break;
+                case PrintMediaSize_L:
+                    this.paperSize = ECopyPreview.this.f363L;
+                    break;
+                case PrintMediaSize_2L:
+                    this.paperSize = ECopyPreview.this.f364L2;
+                    break;
+                case PrintMediaSize_Postcard:
+                    this.paperSize = ECopyPreview.this.Hagaki;
+                    break;
+                case PrintMediaSize_KG:
+                    this.paperSize = ECopyPreview.this.f362KG;
+                    break;
+                case PrintMediaSize_8x10in:
+                    this.paperSize = ECopyPreview.this.f365P6;
+                    break;
+                default:
+                    this.paperSize = ECopyPreview.this.Max;
+                    break;
+            }
+            float f = (float) i;
+            float f2 = (float) i2;
+            float aspectFitScale = getAspectFitScale(f, f2, (float) this.paperSize.width, (float) this.paperSize.height, Layout.AspectFit.Min);
+            RectF rectF = new RectF(0.0f, 0.0f, (float) this.paperSize.width, (float) this.paperSize.height);
+            scaleRect(aspectFitScale, rectF);
+            this.paperImage = Bitmap.createBitmap((int) rectF.width(), (int) rectF.height(), Bitmap.Config.ARGB_8888);
+            RectF rectF2 = new RectF(0.0f, 0.0f, (float) this.paperSize.width, (float) this.paperSize.height);
+            rectF2.left += 18.0f;
+            rectF2.top += 18.0f;
+            rectF2.right -= 18.0f;
+            rectF2.bottom -= 18.0f;
+            scaleRect(aspectFitScale, rectF2);
+            this.paperBorderClipPath.addRect(rectF2, Path.Direction.CW);
+            float aspectFitScale2 = getAspectFitScale(f, f2, (float) ECopyPreview.this.Max.width, (float) ECopyPreview.this.Max.height, Layout.AspectFit.Min);
+            RectF rectF3 = new RectF(0.0f, 0.0f, (float) ECopyPreview.this.Max.width, (float) ECopyPreview.this.Max.height);
+            scaleRect(aspectFitScale2, rectF3);
+            this.maxPaperImage = Bitmap.createBitmap((int) rectF3.width(), (int) rectF3.height(), Bitmap.Config.ARGB_8888);
+            invalidatePaperSize();
+        }
+
+        /* access modifiers changed from: package-private */
+        public Bitmap getBitmap() {
+            boolean showPaper = showPaper();
+            Bitmap bitmap = showPaper ? this.paperImage : this.maxPaperImage;
+            this.canvas = new Canvas(bitmap);
+            this.canvas.save();
+            ECopyPreview.this.paperDrawable.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());
+            ECopyPreview.this.paperDrawable.draw(this.canvas);
+            Bitmap bitmap2 = this.scanImage;
+            if (bitmap2 != null) {
+                if (showPaper) {
+                    float f = this.copyScale / this.limitCopyScaleDown;
+                    if (this.autofitEnabled) {
+                        f = 1.0f / getAspectFitScale(this.scanFrame.width(), this.scanFrame.height(), (float) this.canvas.getWidth(), (float) this.canvas.getHeight(), Layout.AspectFit.Max);
+                    }
+                    Matrix matrix = new Matrix();
+                    matrix.postScale(f, f);
+                    this.canvas.clipPath(this.paperBorderClipPath);
+                    this.canvas.drawBitmap(this.scanImage, matrix, (Paint) null);
+                } else {
+                    this.canvas.drawBitmap(bitmap2, 0.0f, 0.0f, (Paint) null);
+                }
+            }
+            this.canvas.restore();
+            return bitmap;
+        }
+
+        /* access modifiers changed from: package-private */
+        public float getScanImageScale(int i, int i2) {
+            this.imageScale = getAspectFitScale((float) ((ECopyPreview.this.drawSize.width - ECopyPreview.this.paperPadding.left) - ECopyPreview.this.paperPadding.right), (float) ((ECopyPreview.this.drawSize.height - ECopyPreview.this.paperPadding.top) - ECopyPreview.this.paperPadding.bottom), (float) i, (float) i2, Layout.AspectFit.Min);
+            return this.imageScale;
+        }
+
+        /* access modifiers changed from: package-private */
+        public void setScanImage(Bitmap bitmap) {
+            this.scanImage = bitmap;
+        }
+
+        /* access modifiers changed from: package-private */
+        public Point getOffset() {
+            return new Point(this.offset);
+        }
+
+        /* access modifiers changed from: package-private */
+        public void setPaperFrame(RectF rectF) {
+            this.scanFrame = new RectF(rectF);
+            scaleRect(this.imageScale, this.scanFrame);
+            this.copyFrame = new RectF(rectF);
+            this.copyFrame.left += 18.0f;
+            this.copyFrame.top += 18.0f;
+            this.copyFrame.right -= 36.0f;
+            this.copyFrame.bottom -= 36.0f;
+            scaleRect(this.imageScale, this.copyFrame);
+            calcLimitCopyScaleDown();
+            invalidatePaperSize();
+        }
+
+        /* access modifiers changed from: package-private */
+        public RectF getCopyFrame() {
+            RectF rectF;
+            if (showPaper() || this.scanImage == null || (rectF = this.copyFrame) == null) {
+                return null;
+            }
+            RectF rectF2 = new RectF(rectF);
+            float max = 1.0f / Math.max(this.copyScale, this.limitCopyScaleDown);
+            rectF2.right *= max;
+            rectF2.bottom *= max;
+            return rectF2;
+        }
+
+        /* access modifiers changed from: package-private */
+        public void setCopyScale(float f) {
+            this.copyScale = f;
+            invalidatePaperSize();
+        }
+
+        /* access modifiers changed from: package-private */
+        public boolean showPaper() {
+            boolean z = this.copyScale < this.limitCopyScaleDown;
+            if (this.autofitEnabled) {
+                return true;
+            }
+            return z;
+        }
+
+        /* access modifiers changed from: package-private */
+        public void invalidatePaperSize() {
+            Size size = showPaper() ? this.paperSize : ECopyPreview.this.Max;
+            float aspectFitScale = getAspectFitScale((float) this.layoutWidth, (float) this.layoutHeight, (float) size.width, (float) size.height, Layout.AspectFit.Min);
+            this.paper = new RectF(0.0f, 0.0f, (float) size.width, (float) size.height);
+            scaleRect(aspectFitScale, this.paper);
+            this.offset.x = ((int) (((float) this.layoutWidth) - this.paper.right)) / 2;
+            this.offset.y = ((int) (((float) this.layoutHeight) - this.paper.bottom)) / 2;
+        }
+
+        /* access modifiers changed from: package-private */
+        public void calcLimitCopyScaleDown() {
+            this.limitCopyScaleDown = getAspectFitScale(this.copyFrame.right, this.copyFrame.bottom, this.paper.width(), this.paper.height(), Layout.AspectFit.Max);
+        }
+
+        /* access modifiers changed from: package-private */
+        public RectF getPaperRect() {
+            return new RectF(0.0f, 0.0f, this.paper.width(), this.paper.height());
+        }
+    }
+
+    class LayoutMirror extends LayoutStandard {
+        LayoutMirror(int i, int i2) {
+            super(i, i2);
+        }
+
+        /* access modifiers changed from: package-private */
+        public Bitmap getBitmap() {
+            boolean showPaper = showPaper();
+            Bitmap bitmap = showPaper ? this.paperImage : this.maxPaperImage;
+            this.canvas = new Canvas(bitmap);
+            this.canvas.save();
+            ECopyPreview.this.paperDrawable.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());
+            ECopyPreview.this.paperDrawable.draw(this.canvas);
+            if (this.scanImage != null) {
+                if (showPaper) {
+                    float f = this.copyScale / this.limitCopyScaleDown;
+                    if (this.autofitEnabled) {
+                        f = 1.0f / getAspectFitScale(this.scanFrame.width(), this.scanFrame.height(), (float) this.canvas.getWidth(), (float) this.canvas.getHeight(), Layout.AspectFit.Max);
+                    }
+                    Matrix matrix = new Matrix();
+                    matrix.postScale(f, f);
+                    matrix.postTranslate(((float) bitmap.getWidth()) - (((float) this.scanImage.getWidth()) * f), 0.0f);
+                    this.canvas.clipPath(this.paperBorderClipPath);
+                    this.canvas.drawBitmap(this.scanImage, matrix, (Paint) null);
+                } else {
+                    this.canvas.drawBitmap(this.scanImage, 0.0f, 0.0f, (Paint) null);
+                }
+            }
+            this.canvas.restore();
+            return bitmap;
+        }
+    }
+
+    class LayoutBorderless extends LayoutStandard {
+
+        /* renamed from: BO */
+        int f367BO;
+
+        /* renamed from: LO */
+        int f368LO;
+
+        /* renamed from: RO */
+        int f369RO;
+
+        /* renamed from: TO */
+        int f370TO;
+
+        LayoutBorderless(int i, int i2) {
+            super(i, i2);
+            ECopyOptionItem.ECopyOptionItemChoice selectedChoice = ECopyPreview.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.PrintMediaSize).getSelectedChoice();
+            if (selectedChoice == ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_KG || selectedChoice == ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_L || selectedChoice == ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_Postcard) {
+                this.f368LO = 15;
+                this.f369RO = 15;
+                this.f370TO = 8;
+                this.f367BO = 15;
+                return;
+            }
+            this.f368LO = 15;
+            this.f369RO = 15;
+            this.f370TO = 17;
+            this.f367BO = 15;
+        }
+
+        /* access modifiers changed from: package-private */
+        public Bitmap getBitmap() {
+            boolean showPaper = showPaper();
+            Bitmap bitmap = showPaper ? this.paperImage : this.maxPaperImage;
+            this.canvas = new Canvas(bitmap);
+            this.canvas.save();
+            ECopyPreview.this.paperDrawable.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());
+            ECopyPreview.this.paperDrawable.draw(this.canvas);
+            if (this.scanImage != null) {
+                if (showPaper) {
+                    float f = this.copyScale;
+                    if (this.autofitEnabled) {
+                        f = 1.0f / getAspectFitScale(this.scanFrame.width(), this.scanFrame.height(), (float) ((this.paperImage.getWidth() + this.f368LO) + this.f369RO), (float) ((this.paperImage.getHeight() + this.f370TO) + this.f367BO), Layout.AspectFit.Min);
+                    }
+                    Matrix matrix = new Matrix();
+                    matrix.postTranslate((float) (-this.f368LO), (float) (-this.f370TO));
+                    matrix.postScale(f, f);
+                    this.canvas.drawBitmap(this.scanImage, matrix, (Paint) null);
+                } else {
+                    this.canvas.drawBitmap(this.scanImage, (float) (-this.f368LO), (float) (-this.f370TO), (Paint) null);
+                }
+            }
+            this.canvas.restore();
+            return bitmap;
+        }
+
+        /* access modifiers changed from: package-private */
+        public void setPaperFrame(RectF rectF) {
+            this.scanFrame = new RectF(rectF);
+            scaleRect(this.imageScale, this.scanFrame);
+            this.copyFrame = new RectF(rectF);
+            scaleRect(this.imageScale, this.copyFrame);
+            calcLimitCopyScaleDown();
+            invalidatePaperSize();
+            this.f368LO = (int) (((float) this.f368LO) * this.imageScale);
+            this.f369RO = (int) (((float) this.f369RO) * this.imageScale);
+            this.f370TO = (int) (((float) this.f370TO) * this.imageScale);
+            this.f367BO = (int) (((float) this.f367BO) * this.imageScale);
+        }
+    }
+
+    class Layout2Up extends Layout {
+        RectF copyFrame;
+        float imageScale;
+        Point offset = new Point();
+        RectF page1;
+        Bitmap page1Bitmap;
+        RectF page2;
+        RectF paper;
+
+        /* access modifiers changed from: package-private */
+        public RectF getCopyFrame() {
+            return null;
+        }
+
+        /* access modifiers changed from: package-private */
+        public void setCopyScale(float f) {
+        }
+
+        Layout2Up(int i, int i2) {
+            Size size = ECopyPreview.this.A4_2Up;
+            Size size2 = ECopyPreview.this.A4_2UpPage;
+            this.paper = new RectF(0.0f, 0.0f, (float) size.width, (float) size.height);
+            this.page1 = new RectF(30.0f, 32.0f, (float) (size2.width + 30), (float) (size2.height + 32));
+            this.page2 = new RectF(this.page1.right + 35.0f, this.page1.top, this.page1.right + 35.0f + ((float) size2.width), this.page1.bottom);
+            float f = (float) i;
+            float f2 = (float) i2;
+            float aspectFitScale = getAspectFitScale(f, f2, (float) size.width, (float) size.height, Layout.AspectFit.Min);
+            scaleRect(aspectFitScale, this.paper);
+            scaleRect(aspectFitScale, this.page1);
+            scaleRect(aspectFitScale, this.page2);
+            this.offset.x = ((int) (f - this.paper.right)) / 2;
+            this.offset.y = ((int) (f2 - this.paper.bottom)) / 2;
+        }
+
+        public Bitmap getBitmap() {
+            Bitmap createBitmap = Bitmap.createBitmap((int) this.paper.width(), (int) this.paper.height(), Bitmap.Config.ARGB_8888);
+            Canvas canvas = new Canvas(createBitmap);
+            ECopyPreview.this.paperDrawable.setBounds(0, 0, createBitmap.getWidth(), createBitmap.getHeight());
+            ECopyPreview.this.paperDrawable.draw(canvas);
+            Bitmap createBitmap2 = Bitmap.createBitmap((int) this.page1.width(), (int) this.page1.height(), Bitmap.Config.ARGB_8888);
+            new Canvas(createBitmap2).drawColor(-3355444);
+            Bitmap bitmap = this.page1Bitmap;
+            if (bitmap == null) {
+                bitmap = createBitmap2;
+            }
+            canvas.drawBitmap(bitmap, (Rect) null, this.page1, (Paint) null);
+            canvas.drawBitmap(createBitmap2, (Rect) null, this.page2, (Paint) null);
+            return createBitmap;
+        }
+
+        /* access modifiers changed from: package-private */
+        public float getScanImageScale(int i, int i2) {
+            this.imageScale = getAspectFitScale(this.page1.width(), this.page1.height(), (float) i, (float) i2, Layout.AspectFit.Min);
+            return this.imageScale;
+        }
+
+        /* access modifiers changed from: package-private */
+        public void setScanImage(Bitmap bitmap) {
+            Rect rect = new Rect((int) this.copyFrame.left, (int) this.copyFrame.top, (int) this.copyFrame.right, (int) this.copyFrame.bottom);
+            this.page1Bitmap = Bitmap.createBitmap((int) this.page1.width(), (int) this.page1.height(), Bitmap.Config.ARGB_8888);
+            Canvas canvas = new Canvas(this.page1Bitmap);
+            canvas.drawBitmap(bitmap, rect, new RectF(0.0f, 0.0f, (float) canvas.getWidth(), (float) canvas.getHeight()), (Paint) null);
+        }
+
+        /* access modifiers changed from: package-private */
+        public Point getOffset() {
+            return new Point(this.offset);
+        }
+
+        /* access modifiers changed from: package-private */
+        public void setPaperFrame(RectF rectF) {
+            this.copyFrame = new RectF(rectF);
+            scaleRect(this.imageScale, this.copyFrame);
+        }
+
+        /* access modifiers changed from: package-private */
+        public RectF getPaperRect() {
+            return new RectF(0.0f, 0.0f, this.paper.width(), this.paper.height());
+        }
+    }
+}

+ 196 - 0
app/src/main/java/epson/print/copy/Component/ecopycomponent/PreviewScanTask.java

@@ -0,0 +1,196 @@
+package epson.print.copy.Component.ecopycomponent;
+
+import android.app.Activity;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Matrix;
+import android.graphics.Paint;
+import android.graphics.RectF;
+import android.os.AsyncTask;
+import epson.print.copy.Component.ecopycomponent.ECopyComponent;
+import epson.print.copy.Component.ecopycomponent.ECopyOptionItem;
+import epson.print.copy.Component.ecopycomponent.ECopyPreview;
+import epson.print.copy.Component.escandevice.EScanDevice;
+import epson.print.copy.Component.escandevice.IScanController;
+import java.util.HashMap;
+
+class PreviewScanTask extends AsyncTask<Void, Void, Void> implements IScanController, ECopyComponent.ITask {
+    boolean cancelRequested;
+    Canvas canvas;
+    ECopyPreview copyPreview;
+    ECopyOptionContext optionContext;
+    Bitmap previewScanBitmap;
+    HashMap<Integer, Object> properties = new HashMap<>();
+    float scale;
+    ECopyComponent.ICopyStatusListener statusListener;
+    ECopyComponent.ICopySystemSettings systemSettings;
+
+    public void setClientID(String str) {
+    }
+
+    public void setRequestConnectionTimeout(int i) {
+    }
+
+    public PreviewScanTask(ECopyPreview eCopyPreview, ECopyComponent.ICopyStatusListener iCopyStatusListener) {
+        this.copyPreview = eCopyPreview;
+        this.statusListener = iCopyStatusListener;
+    }
+
+    /* access modifiers changed from: package-private */
+    public void setPropertyValue(int i, Object obj) {
+        this.properties.put(Integer.valueOf(i), obj);
+    }
+
+    public ECopyComponent.ICopyCancelRequest start() {
+        super.execute(new Void[0]);
+        return new ECopyComponent.ICopyCancelRequest() {
+            public void cancel() {
+                synchronized (this) {
+                    PreviewScanTask.this.cancelRequested = true;
+                }
+            }
+        };
+    }
+
+    public void setSystemSettings(ECopyComponent.ICopySystemSettings iCopySystemSettings) {
+        this.systemSettings = iCopySystemSettings;
+    }
+
+    public void setOptionContext(ECopyOptionContext eCopyOptionContext) {
+        int i;
+        this.optionContext = eCopyOptionContext;
+        if (this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.XScale).getSelectedChoice() != ECopyOptionItem.ECopyOptionItemChoice.XScale_Autofit) {
+            ECopyOptionItem copyOptionItemOf = this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.PrintMediaSize);
+            switch (copyOptionItemOf.getSelectedChoice()) {
+                case PrintMediaSize_A4:
+                    i = IScanController.CPPREV_VALUE_SCAN_COPYFRAME_A4;
+                    break;
+                case PrintMediaSize_B5:
+                    i = IScanController.CPPREV_VALUE_SCAN_COPYFRAME_B5;
+                    break;
+                case PrintMediaSize_L:
+                    i = IScanController.CPPREV_VALUE_SCAN_COPYFRAME_L;
+                    break;
+                case PrintMediaSize_2L:
+                    i = IScanController.CPPREV_VALUE_SCAN_COPYFRAME_2L;
+                    break;
+                case PrintMediaSize_Postcard:
+                    i = IScanController.CPPREV_VALUE_SCAN_COPYFRAME_HAGAKI;
+                    break;
+                case PrintMediaSize_KG:
+                    i = IScanController.CPPREV_VALUE_SCAN_COPYFRAME_KG;
+                    break;
+                case PrintMediaSize_8x10in:
+                    i = IScanController.CPPREV_VALUE_SCAN_COPYFRAME_6GIRI;
+                    break;
+            }
+        }
+        i = IScanController.CPPREV_VALUE_SCAN_COPYFRAME_AUTOFIT;
+        ECopyComponent.ECopyType copyType = this.optionContext.getCopyType();
+        if (copyType == ECopyComponent.ECopyType.A4_2up || copyType == ECopyComponent.ECopyType.A4_2up_Book) {
+            i = IScanController.CPPREV_VALUE_SCAN_COPYFRAME_A4;
+        } else if (copyType == ECopyComponent.ECopyType.B5_2up || copyType == ECopyComponent.ECopyType.B5_2up_Book) {
+            i = IScanController.CPPREV_VALUE_SCAN_COPYFRAME_B5;
+        }
+        setPropertyValue(3, Integer.valueOf(i));
+        setPropertyValue(1, 65536);
+        setPropertyValue(2, Integer.valueOf(IScanController.CPPREV_VALUE_SCAN_RESO_PREVIEW));
+    }
+
+    /* access modifiers changed from: protected */
+    public Void doInBackground(Void... voidArr) {
+        setPropertyValue(4, this.systemSettings.getPrinterIPAddress());
+        EScanDevice.nativeStartScan(this);
+        return null;
+    }
+
+    public int getIntegerValue(int i) {
+        return ((Integer) this.properties.get(Integer.valueOf(i))).intValue();
+    }
+
+    public String getStringValue(int i) {
+        return (String) this.properties.get(Integer.valueOf(i));
+    }
+
+    public boolean isCancelRequested() {
+        boolean z;
+        synchronized (this) {
+            z = this.cancelRequested;
+        }
+        return z;
+    }
+
+    public void setScanStatusChanged(final int i, final int i2) {
+        ((Activity) this.copyPreview.getContext()).runOnUiThread(new Runnable() {
+            public void run() {
+                ECopyComponent.ICopyStatusListener.CopyTaskResult copyTaskResult;
+                switch (i) {
+                    case 1:
+                        PreviewScanTask previewScanTask = PreviewScanTask.this;
+                        previewScanTask.previewScanBitmap = null;
+                        previewScanTask.statusListener.onStarted(ECopyComponent.ICopyStatusListener.CopyTaskType.Preview);
+                        return;
+                    case 2:
+                        int i = i2;
+                        if (i != 3) {
+                            switch (i) {
+                                case 0:
+                                    copyTaskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.Succeed;
+                                    break;
+                                case 1:
+                                    copyTaskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.Canceled;
+                                    break;
+                                default:
+                                    copyTaskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.ErrorOther;
+                                    break;
+                            }
+                        } else {
+                            copyTaskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.Busy;
+                        }
+                        PreviewScanTask.this.statusListener.onFinished(ECopyComponent.ICopyStatusListener.CopyTaskType.Preview, copyTaskResult);
+                        return;
+                    case 3:
+                        PreviewScanTask.this.previewScanBitmap.eraseColor(-1);
+                        return;
+                    case 4:
+                        PreviewScanTask.this.copyPreview.drawScanPreview(PreviewScanTask.this.previewScanBitmap);
+                        return;
+                    default:
+                        return;
+                }
+            }
+        });
+    }
+
+    public void setScanImageSize(int i, int i2) {
+        this.copyPreview.calculateScanImageSize(i, i2, new ECopyPreview.ScanImageSizeCalculator() {
+            public void onScanImageSize(int i, int i2, float f) {
+                PreviewScanTask previewScanTask = PreviewScanTask.this;
+                previewScanTask.scale = f;
+                previewScanTask.previewScanBitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.ARGB_8888);
+                PreviewScanTask previewScanTask2 = PreviewScanTask.this;
+                previewScanTask2.canvas = new Canvas(previewScanTask2.previewScanBitmap);
+            }
+        });
+    }
+
+    public void setScanImageBlockReceived(int[] iArr, int i, int i2, int i3, int i4) {
+        Bitmap createBitmap = Bitmap.createBitmap(iArr, i3, i4, Bitmap.Config.ARGB_8888);
+        Matrix matrix = new Matrix();
+        float f = this.scale;
+        matrix.postScale(f, f);
+        float f2 = this.scale;
+        matrix.postTranslate(((float) i) * f2, ((float) i2) * f2);
+        this.canvas.drawBitmap(createBitmap, matrix, (Paint) null);
+    }
+
+    public void setCopyFrameSize(int i, int i2, int i3, int i4) {
+        RectF rectF = new RectF((float) i, (float) i2, (float) i3, (float) i4);
+        synchronized (this) {
+            if (this.cancelRequested) {
+                rectF = new RectF();
+            }
+        }
+        this.copyPreview.setPaperFrame(rectF);
+    }
+}

+ 165 - 0
app/src/main/java/epson/print/copy/Component/ecopycomponent/RemoteCopyGetOptionTask.java

@@ -0,0 +1,165 @@
+package epson.print.copy.Component.ecopycomponent;
+
+import android.os.AsyncTask;
+import epson.print.copy.Component.ecopycomponent.ECopyComponent;
+import epson.print.copy.Component.eremoteoperation.ERemoteCopy;
+import epson.print.copy.Component.eremoteoperation.ERemoteDevice;
+import epson.print.copy.Component.eremoteoperation.ERemoteOperation;
+import epson.print.copy.Component.eremoteoperation.ERemotePrinter;
+import epson.print.copy.Component.eremoteoperation.ERemoteScanner;
+import java.util.Iterator;
+
+class RemoteCopyGetOptionTask extends AsyncTask<Void, Void, Result> implements ECopyComponent.ITask {
+    String clientID;
+    ECopyComponent.ICopyOptionContextListener contextListener;
+    ECopyComponent.ECopyType copyType;
+    ERemoteCopy operation = new ERemoteCopy();
+    ECopyComponent.ICopySystemSettings systemSettings;
+
+    public void setOptionContext(ECopyOptionContext eCopyOptionContext) {
+    }
+
+    class Result {
+        ECopyComponent.ECopyType copyType;
+        ECopyComponent.ICopyOptionContextListener.ContextCreationError error;
+        ECopyOptionContext optionContext;
+
+        Result() {
+        }
+    }
+
+    public RemoteCopyGetOptionTask(ECopyComponent.ECopyType eCopyType, ECopyComponent.ICopyOptionContextListener iCopyOptionContextListener) {
+        this.copyType = eCopyType;
+        this.contextListener = iCopyOptionContextListener;
+    }
+
+    public ECopyComponent.ICopyCancelRequest start() {
+        super.execute(new Void[0]);
+        return null;
+    }
+
+    public void setSystemSettings(ECopyComponent.ICopySystemSettings iCopySystemSettings) {
+        this.systemSettings = iCopySystemSettings;
+    }
+
+    public void setRequestConnectionTimeout(int i) {
+        this.operation.setRequestConnectionTimeout(i);
+    }
+
+    public void setClientID(String str) {
+        this.clientID = str;
+    }
+
+    /* access modifiers changed from: package-private */
+    public Result getErrorResult(ERemoteOperation.ERemoteOperationResult eRemoteOperationResult) {
+        Result result = new Result();
+        if (eRemoteOperationResult.isNull(ERemoteOperation.ERemoteParam.success)) {
+            result.error = ECopyComponent.ICopyOptionContextListener.ContextCreationError.ErrorCommunication;
+        } else {
+            result.error = ECopyComponent.ICopyOptionContextListener.ContextCreationError.Error;
+        }
+        return result;
+    }
+
+    /* access modifiers changed from: package-private */
+    public Result checkDeviceError() {
+        Result result = new Result();
+        result.copyType = this.copyType;
+        ERemoteDevice eRemoteDevice = new ERemoteDevice();
+        eRemoteDevice.setHostIP(this.operation.getHostIP());
+        eRemoteDevice.setRequestConnectionTimeout(this.operation.getRequestConnectionTimeout());
+        ERemoteDevice.ERemoteDeviceFunctionsResult functions = eRemoteDevice.getFunctions(new ERemoteOperation.IRemoteOperationParameter() {
+            public String client_id() {
+                return RemoteCopyGetOptionTask.this.clientID;
+            }
+        });
+        if (!functions.success()) {
+            return getErrorResult(functions);
+        }
+        boolean z = false;
+        Iterator<ERemoteOperation.ERemoteParam> it = functions.functions().iterator();
+        while (true) {
+            if (it.hasNext()) {
+                if (it.next() == ERemoteOperation.ERemoteParam.copy) {
+                    z = true;
+                    break;
+                }
+            } else {
+                break;
+            }
+        }
+        if (!z) {
+            result.error = ECopyComponent.ICopyOptionContextListener.ContextCreationError.ErrorNotCopySupported;
+            return result;
+        }
+        ERemotePrinter eRemotePrinter = new ERemotePrinter();
+        eRemotePrinter.setHostIP(this.operation.getHostIP());
+        eRemotePrinter.setRequestConnectionTimeout(this.operation.getRequestConnectionTimeout());
+        ERemotePrinter.ERemotePrinterComponentsResult components = eRemotePrinter.getComponents(new ERemoteOperation.IRemoteOperationParameter() {
+            public String client_id() {
+                return RemoteCopyGetOptionTask.this.clientID;
+            }
+        });
+        if (!components.success()) {
+            return getErrorResult(components);
+        }
+        ERemoteScanner eRemoteScanner = new ERemoteScanner();
+        eRemoteScanner.setHostIP(this.operation.getHostIP());
+        eRemoteScanner.setRequestConnectionTimeout(this.operation.getRequestConnectionTimeout());
+        ERemoteScanner.ERemoteScannerComponentsResult components2 = eRemoteScanner.getComponents(new ERemoteOperation.IRemoteOperationParameter() {
+            public String client_id() {
+                return RemoteCopyGetOptionTask.this.clientID;
+            }
+        });
+        if (!components2.success()) {
+            return getErrorResult(components2);
+        }
+        return null;
+    }
+
+    /* access modifiers changed from: protected */
+    public Result doInBackground(Void... voidArr) {
+        this.operation.setHostIP(this.systemSettings.getPrinterIPAddress());
+        Result checkDeviceError = checkDeviceError();
+        if (checkDeviceError != null) {
+            return checkDeviceError;
+        }
+        Result result = new Result();
+        result.copyType = this.copyType;
+        ERemoteCopy.ERemoteCopyOptionsResult selectableOptions = this.operation.getSelectableOptions();
+        if (selectableOptions.success()) {
+            result.optionContext = new ECopyOptionContext(result.copyType);
+            result.optionContext.setCopyOptionsResult(selectableOptions);
+            result.optionContext.add(ECopyOptionItem.createOptionItem(ERemoteOperation.ERemoteParam.print_media_size, selectableOptions));
+            result.optionContext.add(ECopyOptionItem.createOptionItem(ERemoteOperation.ERemoteParam.print_media_type, selectableOptions));
+            result.optionContext.add(ECopyOptionItem.createOptionItem(ERemoteOperation.ERemoteParam.print_media_source, selectableOptions));
+            result.optionContext.add(ECopyOptionItem.createOptionItem(ERemoteOperation.ERemoteParam.print_quality, selectableOptions));
+            result.optionContext.add(ECopyOptionItem.createOptionItem(ERemoteOperation.ERemoteParam.scan_content_type, selectableOptions));
+            ECopyOptionItem createScaleOptionItem = ECopyOptionItem.createScaleOptionItem(ERemoteOperation.ERemoteParam.x_scale, selectableOptions);
+            ECopyOptionItem createLocalOptionItem = ECopyOptionItem.createLocalOptionItem(ERemoteOperation.ERemoteParam.copy_magnification, 25, 400, ECopyOptionItem.CopyMagnificationAutofitValue);
+            createLocalOptionItem.numberRange.exceptionValue = ECopyOptionItem.CopyMagnificationAutofitValue;
+            result.optionContext.add(createScaleOptionItem);
+            result.optionContext.add(createLocalOptionItem);
+            boolean z = true;
+            result.optionContext.add(ECopyOptionItem.createLocalOptionItem(ERemoteOperation.ERemoteParam.copies, 1, 99, 1));
+            result.optionContext.add(ECopyOptionItem.createLocalOptionItem(ERemoteOperation.ERemoteParam.x_density, -4, 4, 0));
+            result.optionContext.add(ECopyOptionItem.createLocalOptionItem(ERemoteOperation.ERemoteParam.color_effects_type, selectableOptions));
+            ECopyOptionItem createLocalOptionItem2 = ECopyOptionItem.createLocalOptionItem(ERemoteOperation.ERemoteParam.print_x_bleed, selectableOptions);
+            if (result.copyType != ECopyComponent.ECopyType.Borderless) {
+                z = false;
+            }
+            createLocalOptionItem2.enabled = z;
+            result.optionContext.add(createLocalOptionItem2);
+        } else if (selectableOptions.isNull(ERemoteOperation.ERemoteParam.success)) {
+            result.error = ECopyComponent.ICopyOptionContextListener.ContextCreationError.ErrorCommunication;
+        } else {
+            result.error = ECopyComponent.ICopyOptionContextListener.ContextCreationError.Error;
+        }
+        return result;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPostExecute(Result result) {
+        this.contextListener.onCopyOptionContextCreated(result.copyType, result.optionContext, result.error);
+    }
+}

+ 142 - 0
app/src/main/java/epson/print/copy/Component/ecopycomponent/RemoteCopyPhotoGetOptionTask.java

@@ -0,0 +1,142 @@
+package epson.print.copy.Component.ecopycomponent;
+
+import android.os.AsyncTask;
+import epson.print.copy.Component.ecopycomponent.ECopyComponent;
+import epson.print.copy.Component.eremoteoperation.ERemoteCopyPhoto;
+import epson.print.copy.Component.eremoteoperation.ERemoteOperation;
+import java.util.ArrayList;
+
+class RemoteCopyPhotoGetOptionTask extends AsyncTask<Void, Void, Result> implements ECopyComponent.ITask {
+    String clientID;
+    ECopyComponent.ICopyOptionContextListener contextListener;
+    ECopyComponent.ECopyType copyType;
+    ERemoteCopyPhoto operation = new ERemoteCopyPhoto();
+    ECopyOptionContext optionContext;
+    ECopyComponent.ICopySystemSettings systemSettings;
+
+    class Result {
+        ECopyComponent.ECopyType copyType;
+        ECopyComponent.ICopyOptionContextListener.ContextCreationError error;
+        ECopyOptionContext optionContext;
+
+        Result() {
+        }
+    }
+
+    public RemoteCopyPhotoGetOptionTask(ECopyComponent.ECopyType eCopyType, ECopyComponent.ICopyOptionContextListener iCopyOptionContextListener) {
+        this.copyType = eCopyType;
+        this.contextListener = iCopyOptionContextListener;
+    }
+
+    public ECopyComponent.ICopyCancelRequest start() {
+        super.execute(new Void[0]);
+        return null;
+    }
+
+    public void setOptionContext(ECopyOptionContext eCopyOptionContext) {
+        this.optionContext = eCopyOptionContext;
+    }
+
+    public void setSystemSettings(ECopyComponent.ICopySystemSettings iCopySystemSettings) {
+        this.systemSettings = iCopySystemSettings;
+    }
+
+    public void setRequestConnectionTimeout(int i) {
+        this.operation.setRequestConnectionTimeout(i);
+    }
+
+    public void setClientID(String str) {
+        this.clientID = str;
+    }
+
+    /* access modifiers changed from: protected */
+    public Result doInBackground(Void... voidArr) {
+        this.operation.setHostIP(this.systemSettings.getPrinterIPAddress());
+        Result result = new Result();
+        result.copyType = this.copyType;
+        final ERemoteCopyPhoto.ERemoteCopyPhotoOptionResult selectableOptions = this.operation.getSelectableOptions();
+        if (!selectableOptions.success()) {
+            if (selectableOptions.isNull(ERemoteOperation.ERemoteParam.success)) {
+                result.error = ECopyComponent.ICopyOptionContextListener.ContextCreationError.ErrorCommunication;
+            } else {
+                result.error = ECopyComponent.ICopyOptionContextListener.ContextCreationError.Error;
+            }
+            return result;
+        }
+        ERemoteCopyPhoto.ERemoteCopyPhotoOptionResult options = this.operation.getOptions(new ERemoteCopyPhoto.IRemoteCopyPhotoOptionsParameter() {
+            public boolean default_as_fixed() {
+                return true;
+            }
+
+            public String client_id() {
+                return RemoteCopyPhotoGetOptionTask.this.clientID;
+            }
+
+            public ERemoteOperation.ERemoteParam layout() {
+                return selectableOptions.parameter_default(ERemoteOperation.ERemoteParam.layout);
+            }
+
+            public ERemoteOperation.ERemoteParam print_media_type() {
+                return selectableOptions.parameter_default(ERemoteOperation.ERemoteParam.print_media_type);
+            }
+
+            public ERemoteOperation.ERemoteParam print_media_size() {
+                return selectableOptions.parameter_default(ERemoteOperation.ERemoteParam.print_media_size);
+            }
+
+            public ERemoteOperation.ERemoteParam print_quality() {
+                return selectableOptions.parameter_default(ERemoteOperation.ERemoteParam.print_quality);
+            }
+
+            public ERemoteOperation.ERemoteParam print_media_source() {
+                return selectableOptions.parameter_default(ERemoteOperation.ERemoteParam.print_media_source);
+            }
+
+            public ERemoteOperation.ERemoteParam x_apf() {
+                return selectableOptions.parameter_default(ERemoteOperation.ERemoteParam.x_apf);
+            }
+
+            public ArrayList<ERemoteOperation.ERemoteParam> fixed_parameters() {
+                return new ArrayList<>();
+            }
+
+            public ArrayList<ERemoteOperation.ERemoteParam> preferred_parameters() {
+                return new ArrayList<>();
+            }
+
+            public ArrayList<ERemoteOperation.ERemoteParam> priority_order() {
+                ArrayList<ERemoteOperation.ERemoteParam> arrayList = new ArrayList<>();
+                arrayList.add(ERemoteOperation.ERemoteParam.layout);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_media_size);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_media_type);
+                arrayList.add(ERemoteOperation.ERemoteParam.x_apf);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_quality);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_media_source);
+                return arrayList;
+            }
+        });
+        if (options.success()) {
+            result.optionContext = new ECopyOptionContext(this.copyType);
+            result.optionContext.setCopyOptionsResult(options);
+            result.optionContext.add(ECopyOptionItem.createOptionItem(ERemoteOperation.ERemoteParam.print_media_size, options));
+            result.optionContext.add(ECopyOptionItem.createOptionItem(ERemoteOperation.ERemoteParam.print_media_type, options));
+            result.optionContext.add(ECopyOptionItem.createOptionItem(ERemoteOperation.ERemoteParam.print_media_source, options));
+            result.optionContext.add(ECopyOptionItem.createOptionItem(ERemoteOperation.ERemoteParam.print_quality, options));
+            result.optionContext.add(ECopyOptionItem.createOptionItem(ERemoteOperation.ERemoteParam.x_apf, options));
+            result.optionContext.add(ECopyOptionItem.createOptionItem(ERemoteOperation.ERemoteParam.x_borderless, options));
+            result.optionContext.add(ECopyOptionItem.createLocalOptionItem(ERemoteOperation.ERemoteParam.x_color_restoration, options));
+            result.optionContext.add(ECopyOptionItem.createLocalOptionItem(ERemoteOperation.ERemoteParam.print_x_bleed, options));
+            result.optionContext.add(ECopyOptionItem.createLocalOptionItem(ERemoteOperation.ERemoteParam.color_effects_type, options));
+        } else if (options.isNull(ERemoteOperation.ERemoteParam.success)) {
+            result.error = ECopyComponent.ICopyOptionContextListener.ContextCreationError.ErrorCommunication;
+        } else {
+            result.error = ECopyComponent.ICopyOptionContextListener.ContextCreationError.Error;
+        }
+        return result;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPostExecute(Result result) {
+        this.contextListener.onCopyOptionContextCreated(result.copyType, result.optionContext, result.error);
+    }
+}

+ 175 - 0
app/src/main/java/epson/print/copy/Component/ecopycomponent/RemoteCopyPhotoSetOptionTask.java

@@ -0,0 +1,175 @@
+package epson.print.copy.Component.ecopycomponent;
+
+import android.os.AsyncTask;
+import epson.print.copy.Component.ecopycomponent.ECopyComponent;
+import epson.print.copy.Component.ecopycomponent.ECopyOptionItem;
+import epson.print.copy.Component.eremoteoperation.ERemoteCopyPhoto;
+import epson.print.copy.Component.eremoteoperation.ERemoteOperation;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+class RemoteCopyPhotoSetOptionTask extends AsyncTask<Void, Void, Result> implements ECopyComponent.ITask {
+    ArrayList<ERemoteOperation.ERemoteParam> changableParams;
+    String clientID;
+    ERemoteCopyPhoto operation = new ERemoteCopyPhoto();
+    ECopyComponent.ICopyOptionListener optionChangedListener;
+    ECopyOptionContext optionContext;
+    ECopyOptionItem replacedItem;
+    ECopyOptionItem selectedItem;
+    ECopyComponent.ICopySystemSettings systemSettings;
+
+    class Result {
+        ArrayList<ECopyOptionItem> changedItems;
+        ECopyComponent.ICopyOptionListener.CopyOptionChangedError error;
+        ECopyOptionItem selectedItem;
+
+        Result() {
+        }
+    }
+
+    public RemoteCopyPhotoSetOptionTask(ECopyOptionItem eCopyOptionItem, ECopyComponent.ICopyOptionListener iCopyOptionListener) {
+        this.selectedItem = eCopyOptionItem;
+        this.optionChangedListener = iCopyOptionListener;
+    }
+
+    public ECopyComponent.ICopyCancelRequest start() {
+        super.execute(new Void[0]);
+        return null;
+    }
+
+    public void setSystemSettings(ECopyComponent.ICopySystemSettings iCopySystemSettings) {
+        this.systemSettings = iCopySystemSettings;
+    }
+
+    public void setRequestConnectionTimeout(int i) {
+        this.operation.setRequestConnectionTimeout(i);
+    }
+
+    public void setClientID(String str) {
+        this.clientID = str;
+    }
+
+    public void setOptionContext(ECopyOptionContext eCopyOptionContext) {
+        this.optionContext = eCopyOptionContext;
+        this.replacedItem = this.optionContext.replace(new ECopyOptionItem(this.selectedItem));
+        this.changableParams = new ArrayList<>();
+        this.changableParams.add(ERemoteOperation.ERemoteParam.x_borderless);
+        this.changableParams.add(ERemoteOperation.ERemoteParam.print_media_size);
+        this.changableParams.add(ERemoteOperation.ERemoteParam.print_media_type);
+        this.changableParams.add(ERemoteOperation.ERemoteParam.x_apf);
+        this.changableParams.add(ERemoteOperation.ERemoteParam.print_quality);
+        this.changableParams.add(ERemoteOperation.ERemoteParam.print_media_source);
+    }
+
+    public Result getResultLocalOptions() {
+        Result result = new Result();
+        result.selectedItem = this.selectedItem;
+        result.changedItems = new ArrayList<>();
+        return result;
+    }
+
+    /* access modifiers changed from: protected */
+    public Result doInBackground(Void... voidArr) {
+        this.operation.setHostIP(this.systemSettings.getPrinterIPAddress());
+        if (this.selectedItem.isLocalOption) {
+            return getResultLocalOptions();
+        }
+        ERemoteCopyPhoto.ERemoteCopyPhotoOptionResult options = this.operation.getOptions(new ERemoteCopyPhoto.IRemoteCopyPhotoOptionsParameter() {
+            public boolean default_as_fixed() {
+                return true;
+            }
+
+            public String client_id() {
+                return RemoteCopyPhotoSetOptionTask.this.clientID;
+            }
+
+            public ERemoteOperation.ERemoteParam layout() {
+                return RemoteCopyPhotoSetOptionTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.XBorderless).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam print_media_type() {
+                return RemoteCopyPhotoSetOptionTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.PrintMediaType).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam print_media_size() {
+                return RemoteCopyPhotoSetOptionTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.PrintMediaSize).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam print_quality() {
+                return RemoteCopyPhotoSetOptionTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.PrintQuality).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam print_media_source() {
+                return RemoteCopyPhotoSetOptionTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.PrintMediaSource).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam x_apf() {
+                return RemoteCopyPhotoSetOptionTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.XApf).getSelectedChoice().param;
+            }
+
+            public ArrayList<ERemoteOperation.ERemoteParam> fixed_parameters() {
+                return new ArrayList<>();
+            }
+
+            public ArrayList<ERemoteOperation.ERemoteParam> preferred_parameters() {
+                return new ArrayList<>();
+            }
+
+            public ArrayList<ERemoteOperation.ERemoteParam> priority_order() {
+                ArrayList<ERemoteOperation.ERemoteParam> arrayList = new ArrayList<>();
+                arrayList.add(ERemoteOperation.ERemoteParam.layout);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_media_size);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_media_type);
+                arrayList.add(ERemoteOperation.ERemoteParam.x_apf);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_quality);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_media_source);
+                return arrayList;
+            }
+        });
+        Result result = new Result();
+        result.selectedItem = this.selectedItem;
+        if (options.success()) {
+            this.optionContext.setCopyOptionsResult(options);
+            result.changedItems = new ArrayList<>();
+            Iterator<ERemoteOperation.ERemoteParam> it = this.changableParams.iterator();
+            while (it.hasNext()) {
+                ECopyOptionItem createOptionItem = ECopyOptionItem.createOptionItem(it.next(), options);
+                if (this.optionContext.isChanged(createOptionItem)) {
+                    result.changedItems.add(createOptionItem);
+                    this.optionContext.replace(createOptionItem);
+                }
+            }
+            Iterator<ECopyOptionItem> it2 = result.changedItems.iterator();
+            while (true) {
+                if (!it2.hasNext()) {
+                    break;
+                }
+                ECopyOptionItem next = it2.next();
+                if (next.getKey() == ECopyOptionItem.ECopyOptionItemKey.XBorderless) {
+                    ECopyOptionItem createLocalOptionItem = ECopyOptionItem.createLocalOptionItem(ERemoteOperation.ERemoteParam.print_x_bleed, options);
+                    if (next.getSelectedChoice() == ECopyOptionItem.ECopyOptionItemChoice.XBorderless_Standard) {
+                        createLocalOptionItem.enabled = false;
+                    }
+                    result.changedItems.add(createLocalOptionItem);
+                }
+            }
+            if (result.changedItems.size() == 0) {
+                result.changedItems = null;
+            }
+        } else {
+            if (options.isNull(ERemoteOperation.ERemoteParam.success)) {
+                result.error = ECopyComponent.ICopyOptionListener.CopyOptionChangedError.ErrorCommunication;
+            } else {
+                result.error = ECopyComponent.ICopyOptionListener.CopyOptionChangedError.Error;
+            }
+            result.selectedItem = new ECopyOptionItem(this.replacedItem);
+            this.optionContext.replace(this.replacedItem);
+        }
+        return result;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPostExecute(Result result) {
+        this.optionChangedListener.onCopyOptionChanged(result.selectedItem, result.changedItems, result.error);
+    }
+}

+ 631 - 0
app/src/main/java/epson/print/copy/Component/ecopycomponent/RemoteCopyPhotoTask.java

@@ -0,0 +1,631 @@
+package epson.print.copy.Component.ecopycomponent;
+
+import android.os.AsyncTask;
+import epson.print.copy.Component.ecopycomponent.ECopyComponent;
+import epson.print.copy.Component.ecopycomponent.ECopyOptionItem;
+import epson.print.copy.Component.eremoteoperation.ERemoteCopy;
+import epson.print.copy.Component.eremoteoperation.ERemoteCopyPhoto;
+import epson.print.copy.Component.eremoteoperation.ERemoteOperation;
+import epson.print.copy.Component.eremoteoperation.ERemotePrinter;
+import java.util.ArrayList;
+
+class RemoteCopyPhotoTask extends AsyncTask<Void, Progress, Result> implements ECopyComponent.ITask {
+    ERemoteCopy.IRemoteCancelParameter cancelParameter;
+    boolean cancelRequested;
+    String clientID;
+    String jobToken;
+    ERemoteCopyPhoto operation = new ERemoteCopyPhoto();
+    ECopyOptionContext optionContext;
+    CopyPhotoSettingHandler photoSetting;
+    Progress progress = new Progress();
+    ECopyComponent.ICopyStatusListener statusListener;
+    ERemoteCopy.IRemoteCopyStatusParameter statusParameter;
+    ECopyComponent.ICopySystemSettings systemSettings;
+
+    class Progress {
+        int currentPages;
+        ECopyComponent.ICopyInvalidateResumeRequest resumeRequest;
+        ECopyComponent.ICopyResumeRequest.ResumeState resumeState;
+        ECopyComponent.ICopyStatusListener.CopyTaskProgress taskProgress;
+        int totalPages;
+
+        Progress() {
+        }
+    }
+
+    class Result {
+        ECopyComponent.ICopyStatusListener.CopyTaskResult taskResult;
+
+        /* access modifiers changed from: package-private */
+        public void setResult(ERemoteOperation.ERemoteParam eRemoteParam) {
+            switch (eRemoteParam) {
+                case none:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.Succeed;
+                    return;
+                case success:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.Succeed;
+                    return;
+                case canceled:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.Canceled;
+                    return;
+                case busy:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.Busy;
+                    return;
+                case document_error:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.ErrorOther;
+                    return;
+                case x_failed_communication:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.ErrorCommunication;
+                    return;
+                case unknown_token:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.ErrorOther;
+                    return;
+                case x_invalid_photo_setting:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.ErrorInvalidOption;
+                    return;
+                default:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.ErrorOther;
+                    return;
+            }
+        }
+
+        public Result(ERemoteOperation.ERemoteParam eRemoteParam) {
+            setResult(eRemoteParam);
+        }
+
+        public Result(ERemoteOperation.ERemoteReasonResult eRemoteReasonResult) {
+            if (eRemoteReasonResult.isNull(ERemoteOperation.ERemoteParam.success)) {
+                setResult(ERemoteOperation.ERemoteParam.x_failed_communication);
+            } else {
+                setResult(eRemoteReasonResult.reason());
+            }
+        }
+    }
+
+    public RemoteCopyPhotoTask(String str, ECopyComponent.ICopyStatusListener iCopyStatusListener) {
+        this.photoSetting = new CopyPhotoSettingHandler(str);
+        this.statusListener = iCopyStatusListener;
+    }
+
+    public ECopyComponent.ICopyCancelRequest start() {
+        super.execute(new Void[0]);
+        return new ECopyComponent.ICopyCancelRequest() {
+            public void cancel() {
+                synchronized (this) {
+                    RemoteCopyPhotoTask.this.cancelRequested = true;
+                }
+            }
+        };
+    }
+
+    public void setSystemSettings(ECopyComponent.ICopySystemSettings iCopySystemSettings) {
+        this.systemSettings = iCopySystemSettings;
+    }
+
+    public void setRequestConnectionTimeout(int i) {
+        this.operation.setRequestConnectionTimeout(i);
+    }
+
+    public void setClientID(String str) {
+        this.clientID = str;
+    }
+
+    public void setOptionContext(ECopyOptionContext eCopyOptionContext) {
+        this.optionContext = eCopyOptionContext;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPreExecute() {
+        this.cancelParameter = new ERemoteCopy.IRemoteCancelParameter() {
+            public String client_id() {
+                return RemoteCopyPhotoTask.this.clientID;
+            }
+
+            public String job_token() {
+                return RemoteCopyPhotoTask.this.jobToken;
+            }
+        };
+        this.statusParameter = new ERemoteCopy.IRemoteCopyStatusParameter() {
+            public String client_id() {
+                return RemoteCopyPhotoTask.this.clientID;
+            }
+
+            public String job_token() {
+                return RemoteCopyPhotoTask.this.jobToken;
+            }
+
+            public ArrayList<ERemoteOperation.ERemoteParam> keys() {
+                ArrayList<ERemoteOperation.ERemoteParam> arrayList = new ArrayList<>();
+                arrayList.add(ERemoteOperation.ERemoteParam.print_x_disc_tray_state);
+                arrayList.add(ERemoteOperation.ERemoteParam.printer_state);
+                arrayList.add(ERemoteOperation.ERemoteParam.printer_state_reasons);
+                arrayList.add(ERemoteOperation.ERemoteParam.scanner_state);
+                arrayList.add(ERemoteOperation.ERemoteParam.scanner_state_reasons);
+                arrayList.add(ERemoteOperation.ERemoteParam.job_state);
+                arrayList.add(ERemoteOperation.ERemoteParam.job_result);
+                arrayList.add(ERemoteOperation.ERemoteParam.job_tokens);
+                arrayList.add(ERemoteOperation.ERemoteParam.job_print_total_pages);
+                arrayList.add(ERemoteOperation.ERemoteParam.job_print_current_pages);
+                return arrayList;
+            }
+        };
+        this.statusListener.onStarted(ECopyComponent.ICopyStatusListener.CopyTaskType.Copy);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onProgressUpdate(Progress... progressArr) {
+        Progress progress2 = progressArr[0];
+        this.statusListener.onProcessed(ECopyComponent.ICopyStatusListener.CopyTaskType.Copy, progress2.totalPages, progress2.currentPages, progress2.taskProgress, progress2.resumeRequest);
+    }
+
+    /* access modifiers changed from: package-private */
+    public void resumeNotify(ECopyComponent.ICopyResumeRequest.ResumeState resumeState) {
+        synchronized (this.progress) {
+            this.progress.resumeState = resumeState;
+            this.progress.notify();
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public int resumeExecute() {
+        int i = 1000;
+        if (this.progress.resumeRequest == null) {
+            return 1000;
+        }
+        synchronized (this.progress) {
+            while (this.progress.resumeState == null) {
+                try {
+                    this.progress.wait(1000);
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        switch (this.progress.resumeState) {
+            case ClearError:
+                ERemotePrinter eRemotePrinter = new ERemotePrinter();
+                eRemotePrinter.setHostIP(this.operation.getHostIP());
+                eRemotePrinter.setRequestConnectionTimeout(this.operation.getRequestConnectionTimeout());
+                eRemotePrinter.clearError(new ERemoteOperation.IRemoteOperationParameter() {
+                    public String client_id() {
+                        return RemoteCopyPhotoTask.this.clientID;
+                    }
+                });
+                i = 15000;
+                break;
+            case Cancel:
+                this.cancelRequested = true;
+                break;
+        }
+        Progress progress2 = this.progress;
+        progress2.resumeState = null;
+        progress2.resumeRequest = null;
+        return i;
+    }
+
+    /* access modifiers changed from: package-private */
+    public ERemoteOperation.ERemoteReasonResult startCopy() {
+        ERemoteCopy.ERemoteCopyResult copy = this.operation.copy(new ERemoteCopyPhoto.IRemoteCopyPhotoParameter() {
+            public String client_id() {
+                return RemoteCopyPhotoTask.this.clientID;
+            }
+
+            public ERemoteOperation.ERemoteParam layout() {
+                return RemoteCopyPhotoTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.XBorderless).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam print_media_type() {
+                return RemoteCopyPhotoTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.PrintMediaType).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam print_media_size() {
+                return RemoteCopyPhotoTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.PrintMediaSize).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam print_quality() {
+                return RemoteCopyPhotoTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.PrintQuality).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam print_media_source() {
+                return RemoteCopyPhotoTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.PrintMediaSource).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam x_apf() {
+                return RemoteCopyPhotoTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.XApf).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam x_color_restoration() {
+                return RemoteCopyPhotoTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.XColorRestoration).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam color_effects_type() {
+                return RemoteCopyPhotoTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.ColorEffectsType).getSelectedChoice().param;
+            }
+
+            public int scan_count() {
+                return RemoteCopyPhotoTask.this.photoSetting.getScanCount();
+            }
+
+            public ArrayList<String> copies() {
+                return RemoteCopyPhotoTask.this.photoSetting.scanCopies;
+            }
+
+            public ArrayList<String> scan_area_x() {
+                return RemoteCopyPhotoTask.this.photoSetting.scanAreaX;
+            }
+
+            public ArrayList<String> scan_area_y() {
+                return RemoteCopyPhotoTask.this.photoSetting.scanAreaY;
+            }
+
+            public ArrayList<String> scan_area_width() {
+                return RemoteCopyPhotoTask.this.photoSetting.scanAreaWidth;
+            }
+
+            public ArrayList<String> scan_area_height() {
+                return RemoteCopyPhotoTask.this.photoSetting.scanAreaHeight;
+            }
+
+            public ArrayList<String> scan_area_resolution() {
+                return RemoteCopyPhotoTask.this.photoSetting.scanAreaResolution;
+            }
+
+            public ERemoteOperation.ERemoteParam print_x_bleed() {
+                if (RemoteCopyPhotoTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.XBorderless).getSelectedChoice().param == ERemoteOperation.ERemoteParam.standard) {
+                    return ERemoteOperation.ERemoteParam.x_null;
+                }
+                return RemoteCopyPhotoTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.PrintXBleed).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam print_x_auto_pg() {
+                return ERemoteOperation.ERemoteParam.off;
+            }
+
+            public ArrayList<String> x_fit_gamma() {
+                return RemoteCopyPhotoTask.this.photoSetting.xFitGamma;
+            }
+
+            public ArrayList<String> x_fit_matrix() {
+                return RemoteCopyPhotoTask.this.photoSetting.xFitMatrix;
+            }
+        });
+        if (copy.success()) {
+            this.jobToken = copy.job_token();
+        }
+        return copy;
+    }
+
+    /* access modifiers changed from: protected */
+    public Result doInBackground(Void... voidArr) {
+        this.operation.setHostIP(this.systemSettings.getPrinterIPAddress());
+        if (!this.photoSetting.parse()) {
+            return new Result(ERemoteOperation.ERemoteParam.x_invalid_photo_setting);
+        }
+        ERemoteOperation.ERemoteReasonResult startCopy = startCopy();
+        if (!startCopy.success()) {
+            return new Result(startCopy);
+        }
+        Result result = null;
+        boolean z = false;
+        boolean z2 = false;
+        while (!z) {
+            if (this.cancelRequested && !z2) {
+                if (!this.operation.cancel(this.cancelParameter).success()) {
+                    return new Result(ERemoteOperation.ERemoteParam.canceled);
+                }
+                z2 = true;
+            }
+            final ERemoteCopy.ERemoteCopyStatusResult status = this.operation.getStatus(this.statusParameter);
+            if (!status.success()) {
+                return new Result((ERemoteOperation.ERemoteReasonResult) status);
+            }
+            Result result2 = new Result(status.job_result());
+            this.progress.totalPages = status.job_print_total_pages();
+            this.progress.currentPages = status.job_print_current_pages();
+            if (this.progress.currentPages < 1) {
+                this.progress.currentPages = 1;
+            }
+            ERemoteOperation.ERemoteParam job_state = status.job_state();
+            switch (job_state) {
+                case scanning:
+                    this.progress.taskProgress = ECopyComponent.ICopyStatusListener.CopyTaskProgress.Scanning;
+                    break;
+                case copying:
+                    this.progress.taskProgress = ECopyComponent.ICopyStatusListener.CopyTaskProgress.Copying;
+                    break;
+                case canceling:
+                    this.progress.taskProgress = ECopyComponent.ICopyStatusListener.CopyTaskProgress.Canceling;
+                    break;
+                case finished:
+                    result = result2;
+                    z = true;
+                    continue;
+            }
+            switch (status.printer_state()) {
+                case stopped:
+                    if (job_state == ERemoteOperation.ERemoteParam.copying || job_state == ERemoteOperation.ERemoteParam.scanning) {
+                        Progress progress2 = this.progress;
+                        progress2.resumeState = null;
+                        progress2.taskProgress = ECopyComponent.ICopyStatusListener.CopyTaskProgress.Stopped;
+                        this.progress.resumeRequest = new ECopyComponent.ICopyInvalidateResumeRequest() {
+                            public void invalidate() {
+                            }
+
+                            public ECopyComponent.ICopyResumeRequest.StopReason getStopReason() {
+                                ECopyComponent.ICopyResumeRequest.StopReason printerStopReason = RemoteCopyTask.getPrinterStopReason(status.printer_state_reasons());
+                                return printerStopReason == ECopyComponent.ICopyResumeRequest.StopReason.None ? RemoteCopyTask.getScannerStopReason(status.scanner_state_reasons()) : printerStopReason;
+                            }
+
+                            public boolean isPossibleClearError() {
+                                switch (C21897.f373xc6bf26c4[RemoteCopyTask.getPrinterStopReason(status.printer_state_reasons()).ordinal()]) {
+                                    case 1:
+                                        return false;
+                                    case 2:
+                                        return false;
+                                    case 3:
+                                        return false;
+                                    case 4:
+                                        return true;
+                                    case 5:
+                                        return true;
+                                    case 6:
+                                        return true;
+                                    case 7:
+                                        return true;
+                                    case 8:
+                                        return false;
+                                    default:
+                                        switch (C21897.f373xc6bf26c4[RemoteCopyTask.getScannerStopReason(status.scanner_state_reasons()).ordinal()]) {
+                                            case 9:
+                                                return false;
+                                            case 10:
+                                                return false;
+                                            case 11:
+                                                return false;
+                                            case 12:
+                                                return false;
+                                            default:
+                                                return false;
+                                        }
+                                }
+                            }
+
+                            public void resume(ECopyComponent.ICopyResumeRequest.ResumeState resumeState) {
+                                RemoteCopyPhotoTask.this.progress.taskProgress = ECopyComponent.ICopyStatusListener.CopyTaskProgress.Processing;
+                                RemoteCopyPhotoTask remoteCopyPhotoTask = RemoteCopyPhotoTask.this;
+                                remoteCopyPhotoTask.publishProgress(new Progress[]{remoteCopyPhotoTask.progress});
+                                RemoteCopyPhotoTask.this.resumeNotify(resumeState);
+                            }
+                        };
+                        break;
+                    }
+            }
+            publishProgress(new Progress[]{this.progress});
+            try {
+                Thread.sleep((long) resumeExecute());
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            result = result2;
+        }
+        return result;
+    }
+
+    /* renamed from: epson.print.copy.Component.ecopycomponent.RemoteCopyPhotoTask$7 */
+    static /* synthetic */ class C21897 {
+
+        /* renamed from: $SwitchMap$epson$print$copy$Component$ecopycomponent$ECopyComponent$ICopyResumeRequest$StopReason */
+        static final /* synthetic */ int[] f373xc6bf26c4 = new int[ECopyComponent.ICopyResumeRequest.StopReason.values().length];
+
+        /* JADX WARNING: Can't wrap try/catch for region: R(59:0|(2:1|2)|3|(2:5|6)|7|(2:9|10)|11|(2:13|14)|15|(2:17|18)|19|(2:21|22)|23|(2:25|26)|27|(2:29|30)|31|(2:33|34)|35|(2:37|38)|39|(2:41|42)|43|(2:45|46)|47|49|50|51|52|53|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|(3:83|84|86)) */
+        /* JADX WARNING: Can't wrap try/catch for region: R(60:0|(2:1|2)|3|(2:5|6)|7|(2:9|10)|11|(2:13|14)|15|(2:17|18)|19|(2:21|22)|23|(2:25|26)|27|(2:29|30)|31|(2:33|34)|35|(2:37|38)|39|41|42|43|(2:45|46)|47|49|50|51|52|53|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|(3:83|84|86)) */
+        /* JADX WARNING: Can't wrap try/catch for region: R(61:0|(2:1|2)|3|(2:5|6)|7|(2:9|10)|11|(2:13|14)|15|17|18|19|(2:21|22)|23|(2:25|26)|27|(2:29|30)|31|(2:33|34)|35|(2:37|38)|39|41|42|43|(2:45|46)|47|49|50|51|52|53|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|(3:83|84|86)) */
+        /* JADX WARNING: Can't wrap try/catch for region: R(62:0|(2:1|2)|3|(2:5|6)|7|(2:9|10)|11|(2:13|14)|15|17|18|19|(2:21|22)|23|(2:25|26)|27|(2:29|30)|31|(2:33|34)|35|37|38|39|41|42|43|(2:45|46)|47|49|50|51|52|53|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|(3:83|84|86)) */
+        /* JADX WARNING: Can't wrap try/catch for region: R(63:0|(2:1|2)|3|(2:5|6)|7|(2:9|10)|11|13|14|15|17|18|19|(2:21|22)|23|(2:25|26)|27|(2:29|30)|31|(2:33|34)|35|37|38|39|41|42|43|(2:45|46)|47|49|50|51|52|53|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|(3:83|84|86)) */
+        /* JADX WARNING: Can't wrap try/catch for region: R(64:0|(2:1|2)|3|(2:5|6)|7|(2:9|10)|11|13|14|15|17|18|19|(2:21|22)|23|(2:25|26)|27|(2:29|30)|31|33|34|35|37|38|39|41|42|43|(2:45|46)|47|49|50|51|52|53|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|(3:83|84|86)) */
+        /* JADX WARNING: Can't wrap try/catch for region: R(65:0|(2:1|2)|3|(2:5|6)|7|9|10|11|13|14|15|17|18|19|(2:21|22)|23|(2:25|26)|27|(2:29|30)|31|33|34|35|37|38|39|41|42|43|(2:45|46)|47|49|50|51|52|53|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|(3:83|84|86)) */
+        /* JADX WARNING: Can't wrap try/catch for region: R(66:0|(2:1|2)|3|(2:5|6)|7|9|10|11|13|14|15|17|18|19|(2:21|22)|23|(2:25|26)|27|29|30|31|33|34|35|37|38|39|41|42|43|(2:45|46)|47|49|50|51|52|53|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|(3:83|84|86)) */
+        /* JADX WARNING: Can't wrap try/catch for region: R(67:0|(2:1|2)|3|5|6|7|9|10|11|13|14|15|17|18|19|(2:21|22)|23|(2:25|26)|27|29|30|31|33|34|35|37|38|39|41|42|43|(2:45|46)|47|49|50|51|52|53|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|(3:83|84|86)) */
+        /* JADX WARNING: Can't wrap try/catch for region: R(68:0|(2:1|2)|3|5|6|7|9|10|11|13|14|15|17|18|19|(2:21|22)|23|25|26|27|29|30|31|33|34|35|37|38|39|41|42|43|(2:45|46)|47|49|50|51|52|53|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|(3:83|84|86)) */
+        /* JADX WARNING: Can't wrap try/catch for region: R(72:0|1|2|3|5|6|7|9|10|11|13|14|15|17|18|19|(2:21|22)|23|25|26|27|29|30|31|33|34|35|37|38|39|41|42|43|45|46|47|49|50|51|52|53|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|86) */
+        /* JADX WARNING: Failed to process nested try/catch */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:51:0x00a5 */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:57:0x00c2 */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:59:0x00cc */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:61:0x00d6 */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:63:0x00e0 */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:65:0x00ea */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:67:0x00f4 */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:69:0x00fe */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:71:0x0108 */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:73:0x0112 */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:75:0x011c */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:77:0x0126 */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:79:0x0130 */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:81:0x013c */
+        /* JADX WARNING: Missing exception handler attribute for start block: B:83:0x0148 */
+        static {
+            /*
+                epson.print.copy.Component.ecopycomponent.ECopyComponent$ICopyResumeRequest$StopReason[] r0 = epson.print.copy.Component.ecopycomponent.ECopyComponent.ICopyResumeRequest.StopReason.values()
+                int r0 = r0.length
+                int[] r0 = new int[r0]
+                f373xc6bf26c4 = r0
+                r0 = 1
+                int[] r1 = f373xc6bf26c4     // Catch:{ NoSuchFieldError -> 0x0014 }
+                epson.print.copy.Component.ecopycomponent.ECopyComponent$ICopyResumeRequest$StopReason r2 = epson.print.copy.Component.ecopycomponent.ECopyComponent.ICopyResumeRequest.StopReason.PrinterMarkerSupplyEmptyError     // Catch:{ NoSuchFieldError -> 0x0014 }
+                int r2 = r2.ordinal()     // Catch:{ NoSuchFieldError -> 0x0014 }
+                r1[r2] = r0     // Catch:{ NoSuchFieldError -> 0x0014 }
+            L_0x0014:
+                r1 = 2
+                int[] r2 = f373xc6bf26c4     // Catch:{ NoSuchFieldError -> 0x001f }
+                epson.print.copy.Component.ecopycomponent.ECopyComponent$ICopyResumeRequest$StopReason r3 = epson.print.copy.Component.ecopycomponent.ECopyComponent.ICopyResumeRequest.StopReason.PrinterMarkerWasteFullError     // Catch:{ NoSuchFieldError -> 0x001f }
+                int r3 = r3.ordinal()     // Catch:{ NoSuchFieldError -> 0x001f }
+                r2[r3] = r1     // Catch:{ NoSuchFieldError -> 0x001f }
+            L_0x001f:
+                r2 = 3
+                int[] r3 = f373xc6bf26c4     // Catch:{ NoSuchFieldError -> 0x002a }
+                epson.print.copy.Component.ecopycomponent.ECopyComponent$ICopyResumeRequest$StopReason r4 = epson.print.copy.Component.ecopycomponent.ECopyComponent.ICopyResumeRequest.StopReason.PrinterMediaJamError     // Catch:{ NoSuchFieldError -> 0x002a }
+                int r4 = r4.ordinal()     // Catch:{ NoSuchFieldError -> 0x002a }
+                r3[r4] = r2     // Catch:{ NoSuchFieldError -> 0x002a }
+            L_0x002a:
+                r3 = 4
+                int[] r4 = f373xc6bf26c4     // Catch:{ NoSuchFieldError -> 0x0035 }
+                epson.print.copy.Component.ecopycomponent.ECopyComponent$ICopyResumeRequest$StopReason r5 = epson.print.copy.Component.ecopycomponent.ECopyComponent.ICopyResumeRequest.StopReason.PrinterMediaEmptyError     // Catch:{ NoSuchFieldError -> 0x0035 }
+                int r5 = r5.ordinal()     // Catch:{ NoSuchFieldError -> 0x0035 }
+                r4[r5] = r3     // Catch:{ NoSuchFieldError -> 0x0035 }
+            L_0x0035:
+                r4 = 5
+                int[] r5 = f373xc6bf26c4     // Catch:{ NoSuchFieldError -> 0x0040 }
+                epson.print.copy.Component.ecopycomponent.ECopyComponent$ICopyResumeRequest$StopReason r6 = epson.print.copy.Component.ecopycomponent.ECopyComponent.ICopyResumeRequest.StopReason.PrinterInputTrayMissingError     // Catch:{ NoSuchFieldError -> 0x0040 }
+                int r6 = r6.ordinal()     // Catch:{ NoSuchFieldError -> 0x0040 }
+                r5[r6] = r4     // Catch:{ NoSuchFieldError -> 0x0040 }
+            L_0x0040:
+                r5 = 6
+                int[] r6 = f373xc6bf26c4     // Catch:{ NoSuchFieldError -> 0x004b }
+                epson.print.copy.Component.ecopycomponent.ECopyComponent$ICopyResumeRequest$StopReason r7 = epson.print.copy.Component.ecopycomponent.ECopyComponent.ICopyResumeRequest.StopReason.PrinterCoverOpenError     // Catch:{ NoSuchFieldError -> 0x004b }
+                int r7 = r7.ordinal()     // Catch:{ NoSuchFieldError -> 0x004b }
+                r6[r7] = r5     // Catch:{ NoSuchFieldError -> 0x004b }
+            L_0x004b:
+                r6 = 7
+                int[] r7 = f373xc6bf26c4     // Catch:{ NoSuchFieldError -> 0x0056 }
+                epson.print.copy.Component.ecopycomponent.ECopyComponent$ICopyResumeRequest$StopReason r8 = epson.print.copy.Component.ecopycomponent.ECopyComponent.ICopyResumeRequest.StopReason.PrinterOutputAreaFullError     // Catch:{ NoSuchFieldError -> 0x0056 }
+                int r8 = r8.ordinal()     // Catch:{ NoSuchFieldError -> 0x0056 }
+                r7[r8] = r6     // Catch:{ NoSuchFieldError -> 0x0056 }
+            L_0x0056:
+                r7 = 8
+                int[] r8 = f373xc6bf26c4     // Catch:{ NoSuchFieldError -> 0x0062 }
+                epson.print.copy.Component.ecopycomponent.ECopyComponent$ICopyResumeRequest$StopReason r9 = epson.print.copy.Component.ecopycomponent.ECopyComponent.ICopyResumeRequest.StopReason.PrinterOtherError     // Catch:{ NoSuchFieldError -> 0x0062 }
+                int r9 = r9.ordinal()     // Catch:{ NoSuchFieldError -> 0x0062 }
+                r8[r9] = r7     // Catch:{ NoSuchFieldError -> 0x0062 }
+            L_0x0062:
+                r8 = 9
+                int[] r9 = f373xc6bf26c4     // Catch:{ NoSuchFieldError -> 0x006e }
+                epson.print.copy.Component.ecopycomponent.ECopyComponent$ICopyResumeRequest$StopReason r10 = epson.print.copy.Component.ecopycomponent.ECopyComponent.ICopyResumeRequest.StopReason.ScannerMediaEmptyError     // Catch:{ NoSuchFieldError -> 0x006e }
+                int r10 = r10.ordinal()     // Catch:{ NoSuchFieldError -> 0x006e }
+                r9[r10] = r8     // Catch:{ NoSuchFieldError -> 0x006e }
+            L_0x006e:
+                r9 = 10
+                int[] r10 = f373xc6bf26c4     // Catch:{ NoSuchFieldError -> 0x007a }
+                epson.print.copy.Component.ecopycomponent.ECopyComponent$ICopyResumeRequest$StopReason r11 = epson.print.copy.Component.ecopycomponent.ECopyComponent.ICopyResumeRequest.StopReason.ScannerMediaJamError     // Catch:{ NoSuchFieldError -> 0x007a }
+                int r11 = r11.ordinal()     // Catch:{ NoSuchFieldError -> 0x007a }
+                r10[r11] = r9     // Catch:{ NoSuchFieldError -> 0x007a }
+            L_0x007a:
+                r10 = 11
+                int[] r11 = f373xc6bf26c4     // Catch:{ NoSuchFieldError -> 0x0086 }
+                epson.print.copy.Component.ecopycomponent.ECopyComponent$ICopyResumeRequest$StopReason r12 = epson.print.copy.Component.ecopycomponent.ECopyComponent.ICopyResumeRequest.StopReason.ScannerMediaSizeMissmatchError     // Catch:{ NoSuchFieldError -> 0x0086 }
+                int r12 = r12.ordinal()     // Catch:{ NoSuchFieldError -> 0x0086 }
+                r11[r12] = r10     // Catch:{ NoSuchFieldError -> 0x0086 }
+            L_0x0086:
+                r11 = 12
+                int[] r12 = f373xc6bf26c4     // Catch:{ NoSuchFieldError -> 0x0092 }
+                epson.print.copy.Component.ecopycomponent.ECopyComponent$ICopyResumeRequest$StopReason r13 = epson.print.copy.Component.ecopycomponent.ECopyComponent.ICopyResumeRequest.StopReason.ScannerOtherError     // Catch:{ NoSuchFieldError -> 0x0092 }
+                int r13 = r13.ordinal()     // Catch:{ NoSuchFieldError -> 0x0092 }
+                r12[r13] = r11     // Catch:{ NoSuchFieldError -> 0x0092 }
+            L_0x0092:
+                epson.print.copy.Component.ecopycomponent.ECopyComponent$ICopyResumeRequest$ResumeState[] r12 = epson.print.copy.Component.ecopycomponent.ECopyComponent.ICopyResumeRequest.ResumeState.values()
+                int r12 = r12.length
+                int[] r12 = new int[r12]
+                f372x17ee3246 = r12
+                int[] r12 = f372x17ee3246     // Catch:{ NoSuchFieldError -> 0x00a5 }
+                epson.print.copy.Component.ecopycomponent.ECopyComponent$ICopyResumeRequest$ResumeState r13 = epson.print.copy.Component.ecopycomponent.ECopyComponent.ICopyResumeRequest.ResumeState.ClearError     // Catch:{ NoSuchFieldError -> 0x00a5 }
+                int r13 = r13.ordinal()     // Catch:{ NoSuchFieldError -> 0x00a5 }
+                r12[r13] = r0     // Catch:{ NoSuchFieldError -> 0x00a5 }
+            L_0x00a5:
+                int[] r12 = f372x17ee3246     // Catch:{ NoSuchFieldError -> 0x00af }
+                epson.print.copy.Component.ecopycomponent.ECopyComponent$ICopyResumeRequest$ResumeState r13 = epson.print.copy.Component.ecopycomponent.ECopyComponent.ICopyResumeRequest.ResumeState.Cancel     // Catch:{ NoSuchFieldError -> 0x00af }
+                int r13 = r13.ordinal()     // Catch:{ NoSuchFieldError -> 0x00af }
+                r12[r13] = r1     // Catch:{ NoSuchFieldError -> 0x00af }
+            L_0x00af:
+                epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam[] r12 = epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.values()
+                int r12 = r12.length
+                int[] r12 = new int[r12]
+                f374xed9088c4 = r12
+                int[] r12 = f374xed9088c4     // Catch:{ NoSuchFieldError -> 0x00c2 }
+                epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam r13 = epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.none     // Catch:{ NoSuchFieldError -> 0x00c2 }
+                int r13 = r13.ordinal()     // Catch:{ NoSuchFieldError -> 0x00c2 }
+                r12[r13] = r0     // Catch:{ NoSuchFieldError -> 0x00c2 }
+            L_0x00c2:
+                int[] r0 = f374xed9088c4     // Catch:{ NoSuchFieldError -> 0x00cc }
+                epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam r12 = epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.success     // Catch:{ NoSuchFieldError -> 0x00cc }
+                int r12 = r12.ordinal()     // Catch:{ NoSuchFieldError -> 0x00cc }
+                r0[r12] = r1     // Catch:{ NoSuchFieldError -> 0x00cc }
+            L_0x00cc:
+                int[] r0 = f374xed9088c4     // Catch:{ NoSuchFieldError -> 0x00d6 }
+                epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam r1 = epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.canceled     // Catch:{ NoSuchFieldError -> 0x00d6 }
+                int r1 = r1.ordinal()     // Catch:{ NoSuchFieldError -> 0x00d6 }
+                r0[r1] = r2     // Catch:{ NoSuchFieldError -> 0x00d6 }
+            L_0x00d6:
+                int[] r0 = f374xed9088c4     // Catch:{ NoSuchFieldError -> 0x00e0 }
+                epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam r1 = epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.busy     // Catch:{ NoSuchFieldError -> 0x00e0 }
+                int r1 = r1.ordinal()     // Catch:{ NoSuchFieldError -> 0x00e0 }
+                r0[r1] = r3     // Catch:{ NoSuchFieldError -> 0x00e0 }
+            L_0x00e0:
+                int[] r0 = f374xed9088c4     // Catch:{ NoSuchFieldError -> 0x00ea }
+                epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam r1 = epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.document_error     // Catch:{ NoSuchFieldError -> 0x00ea }
+                int r1 = r1.ordinal()     // Catch:{ NoSuchFieldError -> 0x00ea }
+                r0[r1] = r4     // Catch:{ NoSuchFieldError -> 0x00ea }
+            L_0x00ea:
+                int[] r0 = f374xed9088c4     // Catch:{ NoSuchFieldError -> 0x00f4 }
+                epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam r1 = epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_failed_communication     // Catch:{ NoSuchFieldError -> 0x00f4 }
+                int r1 = r1.ordinal()     // Catch:{ NoSuchFieldError -> 0x00f4 }
+                r0[r1] = r5     // Catch:{ NoSuchFieldError -> 0x00f4 }
+            L_0x00f4:
+                int[] r0 = f374xed9088c4     // Catch:{ NoSuchFieldError -> 0x00fe }
+                epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam r1 = epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.unknown_token     // Catch:{ NoSuchFieldError -> 0x00fe }
+                int r1 = r1.ordinal()     // Catch:{ NoSuchFieldError -> 0x00fe }
+                r0[r1] = r6     // Catch:{ NoSuchFieldError -> 0x00fe }
+            L_0x00fe:
+                int[] r0 = f374xed9088c4     // Catch:{ NoSuchFieldError -> 0x0108 }
+                epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam r1 = epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.x_invalid_photo_setting     // Catch:{ NoSuchFieldError -> 0x0108 }
+                int r1 = r1.ordinal()     // Catch:{ NoSuchFieldError -> 0x0108 }
+                r0[r1] = r7     // Catch:{ NoSuchFieldError -> 0x0108 }
+            L_0x0108:
+                int[] r0 = f374xed9088c4     // Catch:{ NoSuchFieldError -> 0x0112 }
+                epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam r1 = epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.scanning     // Catch:{ NoSuchFieldError -> 0x0112 }
+                int r1 = r1.ordinal()     // Catch:{ NoSuchFieldError -> 0x0112 }
+                r0[r1] = r8     // Catch:{ NoSuchFieldError -> 0x0112 }
+            L_0x0112:
+                int[] r0 = f374xed9088c4     // Catch:{ NoSuchFieldError -> 0x011c }
+                epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam r1 = epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.copying     // Catch:{ NoSuchFieldError -> 0x011c }
+                int r1 = r1.ordinal()     // Catch:{ NoSuchFieldError -> 0x011c }
+                r0[r1] = r9     // Catch:{ NoSuchFieldError -> 0x011c }
+            L_0x011c:
+                int[] r0 = f374xed9088c4     // Catch:{ NoSuchFieldError -> 0x0126 }
+                epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam r1 = epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.canceling     // Catch:{ NoSuchFieldError -> 0x0126 }
+                int r1 = r1.ordinal()     // Catch:{ NoSuchFieldError -> 0x0126 }
+                r0[r1] = r10     // Catch:{ NoSuchFieldError -> 0x0126 }
+            L_0x0126:
+                int[] r0 = f374xed9088c4     // Catch:{ NoSuchFieldError -> 0x0130 }
+                epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam r1 = epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.finished     // Catch:{ NoSuchFieldError -> 0x0130 }
+                int r1 = r1.ordinal()     // Catch:{ NoSuchFieldError -> 0x0130 }
+                r0[r1] = r11     // Catch:{ NoSuchFieldError -> 0x0130 }
+            L_0x0130:
+                int[] r0 = f374xed9088c4     // Catch:{ NoSuchFieldError -> 0x013c }
+                epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam r1 = epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.idle     // Catch:{ NoSuchFieldError -> 0x013c }
+                int r1 = r1.ordinal()     // Catch:{ NoSuchFieldError -> 0x013c }
+                r2 = 13
+                r0[r1] = r2     // Catch:{ NoSuchFieldError -> 0x013c }
+            L_0x013c:
+                int[] r0 = f374xed9088c4     // Catch:{ NoSuchFieldError -> 0x0148 }
+                epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam r1 = epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.processing     // Catch:{ NoSuchFieldError -> 0x0148 }
+                int r1 = r1.ordinal()     // Catch:{ NoSuchFieldError -> 0x0148 }
+                r2 = 14
+                r0[r1] = r2     // Catch:{ NoSuchFieldError -> 0x0148 }
+            L_0x0148:
+                int[] r0 = f374xed9088c4     // Catch:{ NoSuchFieldError -> 0x0154 }
+                epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteParam r1 = epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteParam.stopped     // Catch:{ NoSuchFieldError -> 0x0154 }
+                int r1 = r1.ordinal()     // Catch:{ NoSuchFieldError -> 0x0154 }
+                r2 = 15
+                r0[r1] = r2     // Catch:{ NoSuchFieldError -> 0x0154 }
+            L_0x0154:
+                return
+            */
+            throw new UnsupportedOperationException("Method not decompiled: epson.print.copy.Component.ecopycomponent.RemoteCopyPhotoTask.C21897.<clinit>():void");
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPostExecute(Result result) {
+        this.statusListener.onFinished(ECopyComponent.ICopyStatusListener.CopyTaskType.Copy, result.taskResult);
+    }
+}

+ 339 - 0
app/src/main/java/epson/print/copy/Component/ecopycomponent/RemoteCopySetOptionTask.java

@@ -0,0 +1,339 @@
+package epson.print.copy.Component.ecopycomponent;
+
+import android.os.AsyncTask;
+import epson.print.copy.Component.ecopycomponent.ECopyComponent;
+import epson.print.copy.Component.ecopycomponent.ECopyOptionItem;
+import epson.print.copy.Component.eremoteoperation.ERemoteCopy;
+import epson.print.copy.Component.eremoteoperation.ERemoteOperation;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+class RemoteCopySetOptionTask extends AsyncTask<Void, Void, Result> implements ECopyComponent.ITask {
+    public static int XScale_2L_to_A4_Value = 165;
+    public static int XScale_2L_to_A4_ValueEx = 173;
+    public static int XScale_2L_to_KG_Value = 77;
+    public static int XScale_2L_to_Letter_Value = 157;
+    public static int XScale_2L_to_Postcard_Value = 76;
+    public static int XScale_2L_to_Postcard_ValueEx = 89;
+    public static int XScale_8x10_to_2L_Value = 61;
+    public static int XScale_A4_to_2L_Value = 59;
+    public static int XScale_A4_to_A3_Value = 141;
+    public static int XScale_A4_to_A5_Value = 69;
+    public static int XScale_A4_to_B5_Value = 85;
+    public static int XScale_A4_to_KG_Value = 47;
+    public static int XScale_A4_to_Postcard_Value = 46;
+    public static int XScale_A4_to_Postcard_ValueEx = 53;
+    public static int XScale_A5_to_A4_Value = 141;
+    public static int XScale_Autofit_Value = ECopyOptionItem.CopyMagnificationAutofitValue;
+    public static int XScale_B5_to_A4_Value = 114;
+    public static int XScale_B5_to_A4_ValueEx = 120;
+    public static int XScale_Custom_Value = 0;
+    public static int XScale_FullSize_Value = 100;
+    public static int XScale_KG_to_2L_Value = 115;
+    public static int XScale_KG_to_8x10_Value = 166;
+    public static int XScale_KG_to_A4_Value = 195;
+    public static int XScale_KG_to_Letter_Value = 183;
+    public static int XScale_L_to_2L_Value = 139;
+    public static int XScale_L_to_2L_ValueEx = 151;
+    public static int XScale_L_to_A4_Value = 235;
+    public static int XScale_L_to_A4_ValueEx = 246;
+    public static int XScale_L_to_Postcard_Value = 110;
+    public static int XScale_L_to_Postcard_ValueEx = 125;
+    public static int XScale_Legal_to_Letter_Value = 78;
+    public static int XScale_Letter_to_11x17_Value = 129;
+    public static int XScale_Letter_to_2L_Value = 57;
+    public static int XScale_Letter_to_KG_Value = 45;
+    public static int XScale_Postcard_to_A4_Value = 201;
+    public static int XScale_Postcard_to_A4_ValueEx = 219;
+    ArrayList<ERemoteOperation.ERemoteParam> changableParams;
+    String clientID;
+    HashMap<Integer, ECopyOptionItem.ECopyOptionItemChoice> copyScaleMap;
+    ERemoteCopy operation = new ERemoteCopy();
+    ECopyComponent.ICopyOptionListener optionChangedListener;
+    ECopyOptionContext optionContext;
+    ECopyOptionItem replacedItem;
+    ECopyOptionItem selectedItem;
+    ECopyComponent.ICopySystemSettings systemSettings;
+    HashMap<ECopyOptionItem.ECopyOptionItemChoice, Integer> xscaleMap;
+
+    static HashMap<ECopyOptionItem.ECopyOptionItemChoice, Integer> getXScaleMap(ECopyComponent.ECopyType eCopyType) {
+        HashMap<ECopyOptionItem.ECopyOptionItemChoice, Integer> hashMap = new HashMap<>();
+        if (eCopyType == ECopyComponent.ECopyType.Borderless) {
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_FullSize, new Integer(XScale_FullSize_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_A4_to_Postcard, new Integer(XScale_A4_to_Postcard_ValueEx));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_2L_to_Postcard, new Integer(XScale_2L_to_Postcard_ValueEx));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_L_to_Postcard, new Integer(XScale_L_to_Postcard_ValueEx));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_L_to_2L, new Integer(XScale_L_to_2L_ValueEx));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_2L_to_A4, new Integer(XScale_2L_to_A4_ValueEx));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_Postcard_to_A4, new Integer(XScale_Postcard_to_A4_ValueEx));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_L_to_A4, new Integer(XScale_L_to_A4_ValueEx));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_B5_to_A4, new Integer(XScale_B5_to_A4_ValueEx));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_Custom, new Integer(XScale_Custom_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_Autofit, new Integer(XScale_Autofit_Value));
+        } else if (eCopyType == ECopyComponent.ECopyType.Mirror) {
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_FullSize, new Integer(XScale_FullSize_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_Custom, new Integer(XScale_Custom_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_Autofit, new Integer(XScale_Autofit_Value));
+        } else if (eCopyType == ECopyComponent.ECopyType.Standard) {
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_FullSize, new Integer(XScale_FullSize_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_Custom, new Integer(XScale_Custom_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_Autofit, new Integer(XScale_Autofit_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_Letter_to_KG, new Integer(XScale_Letter_to_KG_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_KG_to_Letter, new Integer(XScale_KG_to_Letter_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_Letter_to_2L, new Integer(XScale_Letter_to_2L_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_2L_to_Letter, new Integer(XScale_2L_to_Letter_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_KG_to_A4, new Integer(XScale_KG_to_A4_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_A4_to_KG, new Integer(XScale_A4_to_KG_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_2L_to_A4, new Integer(XScale_2L_to_A4_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_A4_to_2L, new Integer(XScale_A4_to_2L_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_KG_to_8x10, new Integer(XScale_KG_to_8x10_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_8x10_to_2L, new Integer(XScale_8x10_to_2L_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_Legal_to_Letter, new Integer(XScale_Legal_to_Letter_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_A4_to_Postcard, new Integer(XScale_A4_to_Postcard_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_2L_to_Postcard, new Integer(XScale_2L_to_Postcard_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_L_to_Postcard, new Integer(XScale_L_to_Postcard_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_L_to_2L, new Integer(XScale_L_to_2L_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_Postcard_to_A4, new Integer(XScale_Postcard_to_A4_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_L_to_A4, new Integer(XScale_L_to_A4_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_A4_to_B5, new Integer(XScale_A4_to_B5_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_B5_to_A4, new Integer(XScale_B5_to_A4_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_2L_to_KG, new Integer(XScale_2L_to_KG_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_KG_to_2L, new Integer(XScale_KG_to_2L_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_A5_to_A4, new Integer(XScale_A5_to_A4_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_A4_to_A5, new Integer(XScale_A4_to_A5_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_A4_to_A3, new Integer(XScale_A4_to_A3_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_Letter_to_11x17, new Integer(XScale_Letter_to_11x17_Value));
+        } else {
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_FullSize, new Integer(XScale_FullSize_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_A4_to_Postcard, new Integer(XScale_A4_to_Postcard_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_2L_to_Postcard, new Integer(XScale_2L_to_Postcard_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_L_to_Postcard, new Integer(XScale_L_to_Postcard_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_L_to_2L, new Integer(XScale_L_to_2L_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_2L_to_A4, new Integer(XScale_2L_to_A4_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_Postcard_to_A4, new Integer(XScale_Postcard_to_A4_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_L_to_A4, new Integer(XScale_L_to_A4_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_A4_to_B5, new Integer(XScale_A4_to_B5_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_B5_to_A4, new Integer(XScale_B5_to_A4_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_Custom, new Integer(XScale_Custom_Value));
+            hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XScale_Autofit, new Integer(XScale_Autofit_Value));
+        }
+        return hashMap;
+    }
+
+    static HashMap<Integer, ECopyOptionItem.ECopyOptionItemChoice> getCopyMagnificationMap(HashMap<ECopyOptionItem.ECopyOptionItemChoice, Integer> hashMap) {
+        HashMap<Integer, ECopyOptionItem.ECopyOptionItemChoice> hashMap2 = new HashMap<>();
+        for (ECopyOptionItem.ECopyOptionItemChoice next : hashMap.keySet()) {
+            hashMap2.put(Integer.valueOf(hashMap.get(next).intValue()), next);
+        }
+        return hashMap2;
+    }
+
+    public static ECopyOptionItem.ECopyOptionItemChoice getScaleChoice(ECopyComponent.ECopyType eCopyType, int i) {
+        ECopyOptionItem.ECopyOptionItemChoice eCopyOptionItemChoice = getCopyMagnificationMap(getXScaleMap(eCopyType)).get(Integer.valueOf(i));
+        return eCopyOptionItemChoice != null ? eCopyOptionItemChoice : ECopyOptionItem.ECopyOptionItemChoice.XScale_Custom;
+    }
+
+    public static int getcopyMagnification(ECopyComponent.ECopyType eCopyType, ECopyOptionItem.ECopyOptionItemChoice eCopyOptionItemChoice) {
+        int intValue = getXScaleMap(eCopyType).get(eCopyOptionItemChoice).intValue();
+        if (intValue != 0) {
+            return intValue;
+        }
+        return 0;
+    }
+
+    class Result {
+        ArrayList<ECopyOptionItem> changedItems;
+        ECopyComponent.ICopyOptionListener.CopyOptionChangedError error;
+        ECopyOptionItem selectedItem;
+
+        Result() {
+        }
+    }
+
+    public RemoteCopySetOptionTask(ECopyOptionItem eCopyOptionItem, ECopyComponent.ICopyOptionListener iCopyOptionListener) {
+        this.selectedItem = eCopyOptionItem;
+        this.optionChangedListener = iCopyOptionListener;
+    }
+
+    public static int scaleValue(ECopyOptionItem.ECopyOptionItemChoice eCopyOptionItemChoice) {
+        return getXScaleMap(ECopyComponent.ECopyType.Standard).get(eCopyOptionItemChoice).intValue();
+    }
+
+    public ECopyComponent.ICopyCancelRequest start() {
+        super.execute(new Void[0]);
+        return null;
+    }
+
+    public void setSystemSettings(ECopyComponent.ICopySystemSettings iCopySystemSettings) {
+        this.systemSettings = iCopySystemSettings;
+    }
+
+    public void setRequestConnectionTimeout(int i) {
+        this.operation.setRequestConnectionTimeout(i);
+    }
+
+    public void setClientID(String str) {
+        this.clientID = str;
+    }
+
+    public void setOptionContext(ECopyOptionContext eCopyOptionContext) {
+        this.optionContext = eCopyOptionContext;
+        this.replacedItem = this.optionContext.replace(new ECopyOptionItem(this.selectedItem));
+        this.changableParams = new ArrayList<>();
+        this.changableParams.add(ERemoteOperation.ERemoteParam.print_media_size);
+        this.changableParams.add(ERemoteOperation.ERemoteParam.print_media_type);
+        this.changableParams.add(ERemoteOperation.ERemoteParam.scan_content_type);
+        this.changableParams.add(ERemoteOperation.ERemoteParam.print_media_source);
+        this.changableParams.add(ERemoteOperation.ERemoteParam.print_quality);
+        this.xscaleMap = getXScaleMap(eCopyOptionContext.copyType);
+        this.copyScaleMap = getCopyMagnificationMap(this.xscaleMap);
+    }
+
+    public Result getResultLocalOptions() {
+        Result result = new Result();
+        result.selectedItem = this.selectedItem;
+        result.changedItems = new ArrayList<>();
+        ECopyOptionItem.ECopyOptionItemKey key = this.selectedItem.getKey();
+        if (key == ECopyOptionItem.ECopyOptionItemKey.CopyMagnification) {
+            result.changedItems.add(this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.XScale));
+        } else if (key == ECopyOptionItem.ECopyOptionItemKey.XScale) {
+            ECopyOptionItem copyOptionItemOf = this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.CopyMagnification);
+            int intValue = this.xscaleMap.get(this.selectedItem.getSelectedChoice()).intValue();
+            if (intValue != XScale_Custom_Value) {
+                copyOptionItemOf.selectValue(intValue);
+            }
+            if (intValue != ECopyOptionItem.CopyMagnificationAutofitValue) {
+                copyOptionItemOf.enabled = true;
+            } else {
+                copyOptionItemOf.enabled = false;
+            }
+            result.changedItems.add(copyOptionItemOf);
+        } else {
+            result.changedItems = null;
+        }
+        return result;
+    }
+
+    /* access modifiers changed from: protected */
+    public Result doInBackground(Void... voidArr) {
+        this.operation.setHostIP(this.systemSettings.getPrinterIPAddress());
+        if (this.selectedItem.isLocalOption) {
+            return getResultLocalOptions();
+        }
+        ERemoteCopy.ERemoteCopyOptionsResult options = this.operation.getOptions(new ERemoteCopy.IRemoteCopyOptionsParameter() {
+            public boolean default_as_fixed() {
+                return true;
+            }
+
+            public String client_id() {
+                return RemoteCopySetOptionTask.this.clientID;
+            }
+
+            public ERemoteOperation.ERemoteParam layout() {
+                return ECopyOptionItem.layoutOf(RemoteCopySetOptionTask.this.optionContext.getCopyType());
+            }
+
+            public ERemoteOperation.ERemoteParam scan_sides() {
+                return RemoteCopySetOptionTask.this.optionContext.getCopyOptionsResult().parameter_default(ERemoteOperation.ERemoteParam.scan_sides);
+            }
+
+            public ERemoteOperation.ERemoteParam print_sides() {
+                return RemoteCopySetOptionTask.this.optionContext.getCopyOptionsResult().parameter_default(ERemoteOperation.ERemoteParam.print_sides);
+            }
+
+            public ERemoteOperation.ERemoteParam scan_media_size() {
+                return RemoteCopySetOptionTask.this.optionContext.getCopyOptionsResult().parameter_default(ERemoteOperation.ERemoteParam.scan_media_size);
+            }
+
+            public ERemoteOperation.ERemoteParam scan_content_type() {
+                return RemoteCopySetOptionTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.ScanContentType).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam print_media_type() {
+                return RemoteCopySetOptionTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.PrintMediaType).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam print_media_size() {
+                return RemoteCopySetOptionTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.PrintMediaSize).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam print_media_source() {
+                return RemoteCopySetOptionTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.PrintMediaSource).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam print_quality() {
+                return RemoteCopySetOptionTask.this.optionContext.getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.PrintQuality).getSelectedChoice().param;
+            }
+
+            public ERemoteOperation.ERemoteParam print_sheet_collate() {
+                return RemoteCopySetOptionTask.this.optionContext.getCopyOptionsResult().parameter_default(ERemoteOperation.ERemoteParam.print_sheet_collate);
+            }
+
+            public ArrayList<ERemoteOperation.ERemoteParam> fixed_parameters() {
+                return new ArrayList<>();
+            }
+
+            public ArrayList<ERemoteOperation.ERemoteParam> preferred_parameters() {
+                ArrayList<ERemoteOperation.ERemoteParam> arrayList = new ArrayList<>();
+                arrayList.add(ERemoteOperation.ERemoteParam.print_sheet_collate);
+                arrayList.add(ERemoteOperation.ERemoteParam.scan_sides);
+                arrayList.add(ERemoteOperation.ERemoteParam.layout);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_sides);
+                arrayList.add(ERemoteOperation.ERemoteParam.scan_media_size);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_media_size);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_media_type);
+                arrayList.add(ERemoteOperation.ERemoteParam.scan_content_type);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_quality);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_media_source);
+                return arrayList;
+            }
+
+            public ArrayList<ERemoteOperation.ERemoteParam> priority_order() {
+                ArrayList<ERemoteOperation.ERemoteParam> arrayList = new ArrayList<>();
+                arrayList.add(ERemoteOperation.ERemoteParam.print_sheet_collate);
+                arrayList.add(ERemoteOperation.ERemoteParam.scan_sides);
+                arrayList.add(ERemoteOperation.ERemoteParam.layout);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_sides);
+                arrayList.add(ERemoteOperation.ERemoteParam.scan_media_size);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_media_size);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_media_type);
+                arrayList.add(ERemoteOperation.ERemoteParam.scan_content_type);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_quality);
+                arrayList.add(ERemoteOperation.ERemoteParam.print_media_source);
+                return arrayList;
+            }
+        });
+        Result result = new Result();
+        result.selectedItem = this.selectedItem;
+        if (options.success()) {
+            this.optionContext.setCopyOptionsResult(options);
+            result.changedItems = new ArrayList<>();
+            Iterator<ERemoteOperation.ERemoteParam> it = this.changableParams.iterator();
+            while (it.hasNext()) {
+                ECopyOptionItem createOptionItem = ECopyOptionItem.createOptionItem(it.next(), options);
+                if (this.optionContext.isChanged(createOptionItem)) {
+                    result.changedItems.add(createOptionItem);
+                    this.optionContext.replace(createOptionItem);
+                }
+            }
+            if (result.changedItems.size() == 0) {
+                result.changedItems = null;
+            }
+        } else {
+            if (options.isNull(ERemoteOperation.ERemoteParam.success)) {
+                result.error = ECopyComponent.ICopyOptionListener.CopyOptionChangedError.ErrorCommunication;
+            } else {
+                result.error = ECopyComponent.ICopyOptionListener.CopyOptionChangedError.Error;
+            }
+            result.selectedItem = new ECopyOptionItem(this.replacedItem);
+            this.optionContext.replace(this.replacedItem);
+        }
+        return result;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPostExecute(Result result) {
+        this.optionChangedListener.onCopyOptionChanged(result.selectedItem, result.changedItems, result.error);
+    }
+}

+ 574 - 0
app/src/main/java/epson/print/copy/Component/ecopycomponent/RemoteCopyTask.java

@@ -0,0 +1,574 @@
+package epson.print.copy.Component.ecopycomponent;
+
+import android.content.Context;
+import android.os.AsyncTask;
+import android.support.annotation.NonNull;
+import com.epson.iprint.prtlogger.Analytics;
+import com.epson.iprint.prtlogger.CommonLog;
+import com.epson.iprint.prtlogger.PrintLog;
+import epson.print.copy.Component.ecopycomponent.ECopyComponent;
+import epson.print.copy.Component.eremoteoperation.ERemoteCopy;
+import epson.print.copy.Component.eremoteoperation.ERemoteOperation;
+import epson.print.copy.Component.eremoteoperation.ERemotePrinter;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+class RemoteCopyTask extends AsyncTask<Void, Progress, Result> implements ECopyComponent.ITask {
+    ERemoteCopy.IRemoteCancelParameter cancelParameter;
+    boolean cancelRequested;
+    String clientID;
+    CopyMode copyMode;
+    String jobToken;
+    private Context mContext;
+    private CopyParams mCopyParams;
+    ERemoteCopy operation;
+    ECopyOptionContext optionContext;
+    Progress progress;
+    String recoverJobToken;
+    ECopyComponent.ICopyStatusListener statusListener;
+    ERemoteCopy.IRemoteCopyStatusParameter statusParameter;
+    ECopyComponent.ICopySystemSettings systemSettings;
+
+    public enum CopyMode {
+        Copy,
+        Recover
+    }
+
+    class Progress {
+        int currentPages;
+        ECopyComponent.ICopyInvalidateResumeRequest resumeRequest;
+        ECopyComponent.ICopyResumeRequest.ResumeState resumeState;
+        ECopyComponent.ICopyStatusListener.CopyTaskProgress taskProgress;
+        int totalPages;
+
+        Progress() {
+        }
+    }
+
+    class Result {
+        ECopyComponent.ICopyStatusListener.CopyTaskResult taskResult;
+
+        /* access modifiers changed from: package-private */
+        public void setResult(ERemoteOperation.ERemoteParam eRemoteParam) {
+            switch (eRemoteParam) {
+                case none:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.Succeed;
+                    return;
+                case success:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.Succeed;
+                    return;
+                case canceled:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.Canceled;
+                    return;
+                case busy:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.Busy;
+                    return;
+                case illegal_combination:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.ErrorOther;
+                    return;
+                case memory_full:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.ErrorOther;
+                    return;
+                case remove_adf_paper:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.RemoveAdfPaper;
+                    return;
+                case set_adf_paper:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.ErrorOther;
+                    return;
+                case document_error:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.ErrorOther;
+                    return;
+                case x_failed_communication:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.ErrorCommunication;
+                    return;
+                case unknown_token:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.ErrorOther;
+                    return;
+                default:
+                    this.taskResult = ECopyComponent.ICopyStatusListener.CopyTaskResult.ErrorOther;
+                    return;
+            }
+        }
+
+        public Result(ERemoteOperation.ERemoteParam eRemoteParam) {
+            setResult(eRemoteParam);
+        }
+
+        public Result(ERemoteOperation.ERemoteReasonResult eRemoteReasonResult) {
+            if (eRemoteReasonResult.isNull(ERemoteOperation.ERemoteParam.success)) {
+                setResult(ERemoteOperation.ERemoteParam.x_failed_communication);
+            } else {
+                setResult(eRemoteReasonResult.reason());
+            }
+        }
+    }
+
+    static ECopyComponent.ICopyResumeRequest.StopReason getPrinterStopReason(ArrayList<ERemoteOperation.ERemoteParam> arrayList) {
+        ECopyComponent.ICopyResumeRequest.StopReason stopReason = ECopyComponent.ICopyResumeRequest.StopReason.None;
+        stopReason.string = ERemoteOperation.ERemoteParam.none.string;
+        Iterator<ERemoteOperation.ERemoteParam> it = arrayList.iterator();
+        while (it.hasNext()) {
+            ERemoteOperation.ERemoteParam next = it.next();
+            boolean z = true;
+            switch (next) {
+                case marker_supply_empty_error:
+                    stopReason = ECopyComponent.ICopyResumeRequest.StopReason.PrinterMarkerSupplyEmptyError;
+                    break;
+                case marker_waste_full_error:
+                    stopReason = ECopyComponent.ICopyResumeRequest.StopReason.PrinterMarkerWasteFullError;
+                    break;
+                case media_jam_error:
+                    stopReason = ECopyComponent.ICopyResumeRequest.StopReason.PrinterMediaJamError;
+                    break;
+                case media_empty_error:
+                    stopReason = ECopyComponent.ICopyResumeRequest.StopReason.PrinterMediaEmptyError;
+                    break;
+                case input_tray_missing_error:
+                    stopReason = ECopyComponent.ICopyResumeRequest.StopReason.PrinterOtherError;
+                    break;
+                case cover_open_error:
+                    stopReason = ECopyComponent.ICopyResumeRequest.StopReason.PrinterCoverOpenError;
+                    break;
+                case output_area_full_error:
+                    stopReason = ECopyComponent.ICopyResumeRequest.StopReason.PrinterOutputAreaFullError;
+                    break;
+                case other_error:
+                    stopReason = ECopyComponent.ICopyResumeRequest.StopReason.PrinterOtherError;
+                    break;
+                default:
+                    z = false;
+                    break;
+            }
+            if (z) {
+                stopReason.string = next.string;
+            }
+        }
+        return stopReason;
+    }
+
+    static ECopyComponent.ICopyResumeRequest.StopReason getScannerStopReason(ArrayList<ERemoteOperation.ERemoteParam> arrayList) {
+        ECopyComponent.ICopyResumeRequest.StopReason stopReason = ECopyComponent.ICopyResumeRequest.StopReason.None;
+        stopReason.string = ERemoteOperation.ERemoteParam.none.string;
+        Iterator<ERemoteOperation.ERemoteParam> it = arrayList.iterator();
+        while (it.hasNext()) {
+            ERemoteOperation.ERemoteParam next = it.next();
+            switch (next) {
+                case media_jam_error:
+                    stopReason = ECopyComponent.ICopyResumeRequest.StopReason.ScannerOtherError;
+                    break;
+                case media_empty_error:
+                    stopReason = ECopyComponent.ICopyResumeRequest.StopReason.ScannerOtherError;
+                    break;
+                case other_error:
+                    stopReason = ECopyComponent.ICopyResumeRequest.StopReason.ScannerOtherError;
+                    break;
+                case media_size_missmatch_error:
+                    stopReason = ECopyComponent.ICopyResumeRequest.StopReason.ScannerOtherError;
+                    break;
+            }
+            stopReason.string = next.string;
+        }
+        return stopReason;
+    }
+
+    public RemoteCopyTask(CopyMode copyMode2, String str, ECopyComponent.ICopyStatusListener iCopyStatusListener, Context context) {
+        this.operation = new ERemoteCopy();
+        this.progress = new Progress();
+        this.statusListener = iCopyStatusListener;
+        this.copyMode = copyMode2;
+        this.recoverJobToken = str;
+        this.mContext = context;
+    }
+
+    public RemoteCopyTask(CopyMode copyMode2, ECopyComponent.ICopyStatusListener iCopyStatusListener, Context context) {
+        this(copyMode2, "", iCopyStatusListener, context);
+    }
+
+    public ECopyComponent.ICopyCancelRequest start() {
+        super.execute(new Void[0]);
+        return new ECopyComponent.ICopyCancelRequest() {
+            public void cancel() {
+                synchronized (this) {
+                    RemoteCopyTask.this.cancelRequested = true;
+                }
+            }
+        };
+    }
+
+    public void setSystemSettings(ECopyComponent.ICopySystemSettings iCopySystemSettings) {
+        this.systemSettings = iCopySystemSettings;
+    }
+
+    public void setRequestConnectionTimeout(int i) {
+        this.operation.setRequestConnectionTimeout(i);
+    }
+
+    public void setClientID(String str) {
+        this.clientID = str;
+    }
+
+    public void setOptionContext(ECopyOptionContext eCopyOptionContext) {
+        this.optionContext = eCopyOptionContext;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPreExecute() {
+        this.cancelParameter = new ERemoteCopy.IRemoteCancelParameter() {
+            public String client_id() {
+                return RemoteCopyTask.this.clientID;
+            }
+
+            public String job_token() {
+                return RemoteCopyTask.this.jobToken;
+            }
+        };
+        this.statusParameter = new ERemoteCopy.IRemoteCopyStatusParameter() {
+            public String client_id() {
+                return RemoteCopyTask.this.clientID;
+            }
+
+            public String job_token() {
+                return RemoteCopyTask.this.jobToken;
+            }
+
+            public ArrayList<ERemoteOperation.ERemoteParam> keys() {
+                ArrayList<ERemoteOperation.ERemoteParam> arrayList = new ArrayList<>();
+                arrayList.add(ERemoteOperation.ERemoteParam.job_state);
+                arrayList.add(ERemoteOperation.ERemoteParam.job_result);
+                arrayList.add(ERemoteOperation.ERemoteParam.job_tokens);
+                arrayList.add(ERemoteOperation.ERemoteParam.printer_state);
+                arrayList.add(ERemoteOperation.ERemoteParam.printer_state_reasons);
+                arrayList.add(ERemoteOperation.ERemoteParam.scanner_state);
+                arrayList.add(ERemoteOperation.ERemoteParam.scanner_state_reasons);
+                arrayList.add(ERemoteOperation.ERemoteParam.job_print_total_pages);
+                arrayList.add(ERemoteOperation.ERemoteParam.job_print_current_pages);
+                return arrayList;
+            }
+        };
+        this.statusListener.onStarted(ECopyComponent.ICopyStatusListener.CopyTaskType.Copy);
+    }
+
+    /* access modifiers changed from: protected */
+    public void onProgressUpdate(Progress... progressArr) {
+        Progress progress2 = progressArr[0];
+        this.statusListener.onProcessed(ECopyComponent.ICopyStatusListener.CopyTaskType.Copy, progress2.totalPages, progress2.currentPages, progress2.taskProgress, progress2.resumeRequest);
+    }
+
+    /* access modifiers changed from: package-private */
+    public void resumeNotify(ECopyComponent.ICopyResumeRequest.ResumeState resumeState) {
+        synchronized (this.progress) {
+            this.progress.resumeState = resumeState;
+            this.progress.notify();
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public void resumeExecute() {
+        ERemoteCopy.ERemoteCopyStatusResult status;
+        if (this.progress.resumeRequest != null) {
+            synchronized (this.progress) {
+                while (true) {
+                    try {
+                        if (this.progress.resumeState == null) {
+                            this.progress.wait(1000);
+                            switch (this.operation.getStatus(this.statusParameter).printer_state()) {
+                                case idle:
+                                    this.progress.taskProgress = ECopyComponent.ICopyStatusListener.CopyTaskProgress.Processing;
+                                    publishProgress(new Progress[]{this.progress});
+                                    resumeNotify(ECopyComponent.ICopyResumeRequest.ResumeState.Cancel);
+                                    continue;
+                                case processing:
+                                    this.progress.taskProgress = ECopyComponent.ICopyStatusListener.CopyTaskProgress.Processing;
+                                    publishProgress(new Progress[]{this.progress});
+                                    resumeNotify(ECopyComponent.ICopyResumeRequest.ResumeState.ClearError);
+                                    continue;
+                                case stopped:
+                                    if (this.progress.resumeRequest.getStopReason().equals(getPrinterStopReason(status.printer_state_reasons()))) {
+                                        continue;
+                                    } else {
+                                        return;
+                                    }
+                                default:
+                                    continue;
+                            }
+                        }
+                    } catch (InterruptedException e) {
+                        e.printStackTrace();
+                        switch (this.progress.resumeState) {
+                            case ClearError:
+                                ERemotePrinter eRemotePrinter = new ERemotePrinter();
+                                eRemotePrinter.setHostIP(this.operation.getHostIP());
+                                eRemotePrinter.setRequestConnectionTimeout(this.operation.getRequestConnectionTimeout());
+                                eRemotePrinter.clearError(new ERemoteOperation.IRemoteOperationParameter() {
+                                    public String client_id() {
+                                        return RemoteCopyTask.this.clientID;
+                                    }
+                                });
+                                for (int i = 0; i < 6 && !this.operation.getStatus(this.statusParameter).printer_state().equals(ERemoteOperation.ERemoteParam.processing); i++) {
+                                    try {
+                                        Thread.sleep(5000);
+                                    } catch (InterruptedException e2) {
+                                        e2.printStackTrace();
+                                    }
+                                }
+                                break;
+                            case Cancel:
+                                this.cancelRequested = true;
+                                break;
+                            case NextPageReady:
+                            case NextPageNotExist:
+                                boolean success = this.operation.documentChanged(new ERemoteCopy.IRemoteCopyDocumentChangedParameter() {
+                                    public String client_id() {
+                                        return RemoteCopyTask.this.clientID;
+                                    }
+
+                                    public String job_token() {
+                                        return RemoteCopyTask.this.jobToken;
+                                    }
+
+                                    public boolean next_document() {
+                                        return RemoteCopyTask.this.progress.resumeState == ECopyComponent.ICopyResumeRequest.ResumeState.NextPageReady;
+                                    }
+                                }).success();
+                                break;
+                        }
+                        Progress progress2 = this.progress;
+                        progress2.resumeState = null;
+                        progress2.resumeRequest = null;
+                        return;
+                    }
+                }
+            }
+        }
+    }
+
+    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r0v1, resolved type: epson.print.copy.Component.eremoteoperation.ERemoteCopy$ERemoteCopyStatusResult} */
+    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r0v5, resolved type: epson.print.copy.Component.eremoteoperation.ERemoteCopy$ERemoteCopyResult} */
+    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r0v6, resolved type: epson.print.copy.Component.eremoteoperation.ERemoteCopy$ERemoteCopyStatusResult} */
+    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r0v7, resolved type: epson.print.copy.Component.eremoteoperation.ERemoteCopy$ERemoteCopyStatusResult} */
+    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r0v8, resolved type: epson.print.copy.Component.eremoteoperation.ERemoteCopy$ERemoteCopyStatusResult} */
+    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r0v9, resolved type: epson.print.copy.Component.eremoteoperation.ERemoteCopy$ERemoteCopyStatusResult} */
+    /* access modifiers changed from: package-private */
+    /* JADX WARNING: Multi-variable type inference failed */
+    /* Code decompiled incorrectly, please refer to instructions dump. */
+    public epson.print.copy.Component.eremoteoperation.ERemoteOperation.ERemoteReasonResult startCopy() {
+        /*
+            r4 = this;
+            epson.print.copy.Component.ecopycomponent.RemoteCopyTask$CopyMode r0 = r4.copyMode
+            epson.print.copy.Component.ecopycomponent.RemoteCopyTask$CopyMode r1 = epson.print.copy.Component.ecopycomponent.RemoteCopyTask.CopyMode.Copy
+            if (r0 != r1) goto L_0x0024
+            epson.print.copy.Component.ecopycomponent.RemoteCopyTask$6 r0 = new epson.print.copy.Component.ecopycomponent.RemoteCopyTask$6
+            r0.<init>()
+            epson.print.copy.Component.ecopycomponent.CopyParams r1 = r4.getCopyParams(r0)
+            r4.mCopyParams = r1
+            epson.print.copy.Component.eremoteoperation.ERemoteCopy r1 = r4.operation
+            epson.print.copy.Component.eremoteoperation.ERemoteCopy$ERemoteCopyResult r0 = r1.copy(r0)
+            boolean r1 = r0.success()
+            if (r1 == 0) goto L_0x0054
+            java.lang.String r1 = r0.job_token()
+            r4.jobToken = r1
+            goto L_0x0054
+        L_0x0024:
+            epson.print.copy.Component.eremoteoperation.ERemoteCopy r0 = r4.operation
+            epson.print.copy.Component.ecopycomponent.RemoteCopyTask$7 r1 = new epson.print.copy.Component.ecopycomponent.RemoteCopyTask$7
+            r1.<init>()
+            epson.print.copy.Component.eremoteoperation.ERemoteCopy$ERemoteCopyStatusResult r0 = r0.getStatus(r1)
+            boolean r1 = r0.success()
+            if (r1 == 0) goto L_0x0054
+            java.util.ArrayList r1 = r0.job_tokens()
+            java.util.Iterator r1 = r1.iterator()
+        L_0x003d:
+            boolean r2 = r1.hasNext()
+            if (r2 == 0) goto L_0x0054
+            java.lang.Object r2 = r1.next()
+            java.lang.String r2 = (java.lang.String) r2
+            java.lang.String r3 = r4.recoverJobToken
+            boolean r3 = r2.equals(r3)
+            if (r3 == 0) goto L_0x003d
+            r4.jobToken = r2
+            goto L_0x003d
+        L_0x0054:
+            return r0
+        */
+        throw new UnsupportedOperationException("Method not decompiled: epson.print.copy.Component.ecopycomponent.RemoteCopyTask.startCopy():epson.print.copy.Component.eremoteoperation.ERemoteOperation$ERemoteReasonResult");
+    }
+
+    private CopyParams getCopyParams(@NonNull ERemoteCopy.IRemoteCopyParameter iRemoteCopyParameter) {
+        String str;
+        try {
+            CopyParams copyParams = new CopyParams();
+            copyParams.colorMode = iRemoteCopyParameter.color_effects_type().toString();
+            copyParams.density = Integer.toString(iRemoteCopyParameter.x_density());
+            int copy_magnification = iRemoteCopyParameter.copy_magnification();
+            if (copy_magnification == 0) {
+                str = "-999";
+            } else {
+                str = Integer.toString(copy_magnification);
+            }
+            copyParams.magnification = str;
+            copyParams.paperSize = iRemoteCopyParameter.print_media_size().toString();
+            copyParams.paperType = iRemoteCopyParameter.print_media_type().toString();
+            copyParams.printDevice = iRemoteCopyParameter.print_media_source().toString();
+            copyParams.copyType = iRemoteCopyParameter.scan_content_type().toString();
+            copyParams.copyQuality = iRemoteCopyParameter.print_quality().toString();
+            return copyParams;
+        } catch (Throwable unused) {
+            return null;
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public Result doInBackground(Void... voidArr) {
+        this.operation.setHostIP(this.systemSettings.getPrinterIPAddress());
+        ERemoteOperation.ERemoteReasonResult startCopy = startCopy();
+        if (!startCopy.success()) {
+            return new Result(startCopy);
+        }
+        Result result = null;
+        boolean z = false;
+        boolean z2 = false;
+        while (!z) {
+            if (this.cancelRequested && !z2) {
+                if (!this.operation.cancel(this.cancelParameter).success()) {
+                    return new Result(ERemoteOperation.ERemoteParam.canceled);
+                }
+                z2 = true;
+            }
+            final ERemoteCopy.ERemoteCopyStatusResult status = this.operation.getStatus(this.statusParameter);
+            if (!status.success()) {
+                sendLog(this.progress.currentPages);
+                return new Result((ERemoteOperation.ERemoteReasonResult) status);
+            }
+            Result result2 = new Result(status.job_result());
+            this.progress.totalPages = status.job_print_total_pages();
+            this.progress.currentPages = status.job_print_current_pages();
+            if (this.progress.currentPages < 1) {
+                this.progress.currentPages = 1;
+            }
+            ERemoteOperation.ERemoteParam job_state = status.job_state();
+            switch (job_state) {
+                case scanning:
+                    this.progress.taskProgress = ECopyComponent.ICopyStatusListener.CopyTaskProgress.Scanning;
+                    break;
+                case copying:
+                    this.progress.taskProgress = ECopyComponent.ICopyStatusListener.CopyTaskProgress.Copying;
+                    break;
+                case canceling:
+                    this.progress.taskProgress = ECopyComponent.ICopyStatusListener.CopyTaskProgress.Canceling;
+                    break;
+                case nextpaper:
+                    Progress progress2 = this.progress;
+                    progress2.resumeState = null;
+                    progress2.taskProgress = ECopyComponent.ICopyStatusListener.CopyTaskProgress.Waiting2ndPage;
+                    this.progress.resumeRequest = new ECopyComponent.ICopyInvalidateResumeRequest() {
+                        public void invalidate() {
+                        }
+
+                        public boolean isPossibleClearError() {
+                            return false;
+                        }
+
+                        public ECopyComponent.ICopyResumeRequest.StopReason getStopReason() {
+                            return ECopyComponent.ICopyResumeRequest.StopReason.ChangePage;
+                        }
+
+                        public void resume(ECopyComponent.ICopyResumeRequest.ResumeState resumeState) {
+                            RemoteCopyTask.this.resumeNotify(resumeState);
+                        }
+                    };
+                    break;
+                case finished:
+                    sendLog(this.progress.currentPages);
+                    result = result2;
+                    z = true;
+                    continue;
+            }
+            switch (status.printer_state()) {
+                case stopped:
+                    if (job_state == ERemoteOperation.ERemoteParam.copying || job_state == ERemoteOperation.ERemoteParam.scanning) {
+                        Progress progress3 = this.progress;
+                        progress3.resumeState = null;
+                        progress3.taskProgress = ECopyComponent.ICopyStatusListener.CopyTaskProgress.Stopped;
+                        this.progress.resumeRequest = new ECopyComponent.ICopyInvalidateResumeRequest() {
+                            public void invalidate() {
+                            }
+
+                            public ECopyComponent.ICopyResumeRequest.StopReason getStopReason() {
+                                ECopyComponent.ICopyResumeRequest.StopReason printerStopReason = RemoteCopyTask.getPrinterStopReason(status.printer_state_reasons());
+                                return printerStopReason == ECopyComponent.ICopyResumeRequest.StopReason.None ? RemoteCopyTask.getScannerStopReason(status.scanner_state_reasons()) : printerStopReason;
+                            }
+
+                            public boolean isPossibleClearError() {
+                                switch (RemoteCopyTask.getPrinterStopReason(status.printer_state_reasons())) {
+                                    case PrinterMarkerSupplyEmptyError:
+                                        return false;
+                                    case PrinterMarkerWasteFullError:
+                                        return false;
+                                    case PrinterMediaJamError:
+                                        return true;
+                                    case PrinterMediaEmptyError:
+                                        return true;
+                                    case PrinterInputTrayMissingError:
+                                        return true;
+                                    case PrinterCoverOpenError:
+                                        return false;
+                                    case PrinterOutputAreaFullError:
+                                        return true;
+                                    case PrinterOtherError:
+                                        return false;
+                                    default:
+                                        switch (RemoteCopyTask.getScannerStopReason(status.scanner_state_reasons())) {
+                                            case ScannerMediaEmptyError:
+                                                return true;
+                                            case ScannerMediaJamError:
+                                                return true;
+                                            case ScannerMediaSizeMissmatchError:
+                                                return true;
+                                            case ScannerOtherError:
+                                                return true;
+                                            default:
+                                                return false;
+                                        }
+                                }
+                            }
+
+                            public void resume(ECopyComponent.ICopyResumeRequest.ResumeState resumeState) {
+                                RemoteCopyTask.this.progress.taskProgress = ECopyComponent.ICopyStatusListener.CopyTaskProgress.Processing;
+                                RemoteCopyTask remoteCopyTask = RemoteCopyTask.this;
+                                remoteCopyTask.publishProgress(new Progress[]{remoteCopyTask.progress});
+                                RemoteCopyTask.this.resumeNotify(resumeState);
+                            }
+                        };
+                        break;
+                    }
+            }
+            publishProgress(new Progress[]{this.progress});
+            resumeExecute();
+            try {
+                Thread.sleep((long) 1000);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            result = result2;
+        }
+        return result;
+    }
+
+    private void sendLog(int i) {
+        CopyParams copyParams = this.mCopyParams;
+        Context context = this.mContext;
+        if (context != null && copyParams != null) {
+            CommonLog commonLog = new CommonLog();
+            commonLog.setConnectionType(context);
+            commonLog.setPrinterName(context);
+            commonLog.action = PrintLog.ACTION_COPY;
+            commonLog.numberOfSheet = i;
+            Analytics.sendCopyLog(context, copyParams, commonLog);
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPostExecute(Result result) {
+        this.statusListener.onFinished(ECopyComponent.ICopyStatusListener.CopyTaskType.Copy, result.taskResult);
+    }
+}

+ 240 - 0
app/src/main/java/epson/print/copy/Component/ecopycomponent/RemoteDeviceTask.java

@@ -0,0 +1,240 @@
+package epson.print.copy.Component.ecopycomponent;
+
+import android.os.AsyncTask;
+import epson.print.copy.Component.ecopycomponent.ECopyComponent;
+import epson.print.copy.Component.eremoteoperation.ERemoteCopy;
+import epson.print.copy.Component.eremoteoperation.ERemoteDevice;
+import epson.print.copy.Component.eremoteoperation.ERemoteOperation;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+class RemoteDeviceTask extends AsyncTask<Void, Void, Result> implements ECopyComponent.ITask {
+    String clientID;
+    ERemoteDevice operation = new ERemoteDevice();
+    ECopyOptionContext optionContext;
+    ECopyComponent.ICopyDeviceStatusListener statusListener;
+    ECopyComponent.ICopySystemSettings systemSettings;
+
+    class Result {
+        ECopyComponent.ICopyDeviceStatusListener.Connection connetion;
+        ArrayList<String> jobTokens;
+        ECopyComponent.ICopyDeviceStatusListener.DeviceState printer;
+        ArrayList<ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason> printerReasons;
+        ECopyComponent.ICopyDeviceStatusListener.DeviceState scanner;
+        ArrayList<ECopyComponent.ICopyDeviceStatusListener.ScannerStateReason> scannerReasons;
+
+        Result() {
+        }
+    }
+
+    public RemoteDeviceTask(ECopyComponent.ICopyDeviceStatusListener iCopyDeviceStatusListener) {
+        this.statusListener = iCopyDeviceStatusListener;
+    }
+
+    public ECopyComponent.ICopyCancelRequest start() {
+        super.execute(new Void[0]);
+        return null;
+    }
+
+    public void setSystemSettings(ECopyComponent.ICopySystemSettings iCopySystemSettings) {
+        this.systemSettings = iCopySystemSettings;
+    }
+
+    public void setRequestConnectionTimeout(int i) {
+        this.operation.setRequestConnectionTimeout(i);
+    }
+
+    public void setClientID(String str) {
+        this.clientID = str;
+    }
+
+    public void setOptionContext(ECopyOptionContext eCopyOptionContext) {
+        this.optionContext = eCopyOptionContext;
+    }
+
+    /* access modifiers changed from: package-private */
+    public ECopyComponent.ICopyDeviceStatusListener.DeviceState getDeviceState(ERemoteOperation.ERemoteParam eRemoteParam) {
+        ECopyComponent.ICopyDeviceStatusListener.DeviceState deviceState = ECopyComponent.ICopyDeviceStatusListener.DeviceState.Stopped;
+        switch (eRemoteParam) {
+            case idle:
+                return ECopyComponent.ICopyDeviceStatusListener.DeviceState.Idle;
+            case processing:
+                return ECopyComponent.ICopyDeviceStatusListener.DeviceState.Processing;
+            case stopped:
+                return ECopyComponent.ICopyDeviceStatusListener.DeviceState.Stopped;
+            default:
+                return deviceState;
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public ArrayList<ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason> getPrinterErrorReasons() {
+        ArrayList<ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason> arrayList = new ArrayList<>();
+        ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason printerStateReason = ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason.OtherError;
+        printerStateReason.string = ERemoteOperation.ERemoteParam.other_error.string;
+        arrayList.add(printerStateReason);
+        return arrayList;
+    }
+
+    /* access modifiers changed from: package-private */
+    public ArrayList<ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason> getPrinterReasons(ArrayList<ERemoteOperation.ERemoteParam> arrayList) {
+        ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason printerStateReason;
+        ArrayList<ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason> arrayList2 = new ArrayList<>();
+        Iterator<ERemoteOperation.ERemoteParam> it = arrayList.iterator();
+        while (it.hasNext()) {
+            ERemoteOperation.ERemoteParam next = it.next();
+            ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason printerStateReason2 = ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason.None;
+            switch (next) {
+                case none:
+                    printerStateReason = ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason.None;
+                    break;
+                case marker_supply_empty_error:
+                    printerStateReason = ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason.MarkerSupplyEmptyError;
+                    break;
+                case marker_waste_full_error:
+                    printerStateReason = ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason.MarkerWasteFullError;
+                    break;
+                case media_jam_error:
+                    printerStateReason = ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason.MediaJamError;
+                    break;
+                case media_empty_error:
+                    printerStateReason = ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason.MediaEmptyError;
+                    break;
+                case input_tray_missing_error:
+                    printerStateReason = ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason.InputTrayMissingError;
+                    break;
+                case cover_open_error:
+                    printerStateReason = ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason.CoverOpenError;
+                    break;
+                case output_area_full_error:
+                    printerStateReason = ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason.OutputAreaFullError;
+                    break;
+                case other_error:
+                    printerStateReason = ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason.OtherError;
+                    break;
+                case marker_supply_low_warning:
+                    printerStateReason = ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason.MarkerSupplyLowWarning;
+                    break;
+                case cover_open:
+                    printerStateReason = ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason.CoverOpen;
+                    break;
+                default:
+                    printerStateReason = ECopyComponent.ICopyDeviceStatusListener.PrinterStateReason.OtherError;
+                    break;
+            }
+            printerStateReason.string = next.string;
+            arrayList2.add(printerStateReason);
+        }
+        return arrayList2;
+    }
+
+    /* access modifiers changed from: package-private */
+    public ArrayList<ECopyComponent.ICopyDeviceStatusListener.ScannerStateReason> getScannerErrorReasons() {
+        ArrayList<ECopyComponent.ICopyDeviceStatusListener.ScannerStateReason> arrayList = new ArrayList<>();
+        ECopyComponent.ICopyDeviceStatusListener.ScannerStateReason scannerStateReason = ECopyComponent.ICopyDeviceStatusListener.ScannerStateReason.OtherError;
+        scannerStateReason.string = ERemoteOperation.ERemoteParam.other_error.string;
+        arrayList.add(scannerStateReason);
+        return arrayList;
+    }
+
+    /* access modifiers changed from: package-private */
+    public ArrayList<ECopyComponent.ICopyDeviceStatusListener.ScannerStateReason> getScannerReasons(ArrayList<ERemoteOperation.ERemoteParam> arrayList) {
+        ECopyComponent.ICopyDeviceStatusListener.ScannerStateReason scannerStateReason;
+        ArrayList<ECopyComponent.ICopyDeviceStatusListener.ScannerStateReason> arrayList2 = new ArrayList<>();
+        Iterator<ERemoteOperation.ERemoteParam> it = arrayList.iterator();
+        while (it.hasNext()) {
+            ERemoteOperation.ERemoteParam next = it.next();
+            ECopyComponent.ICopyDeviceStatusListener.ScannerStateReason scannerStateReason2 = ECopyComponent.ICopyDeviceStatusListener.ScannerStateReason.None;
+            int i = C22033.f378xed9088c4[next.ordinal()];
+            if (i == 4) {
+                scannerStateReason = ECopyComponent.ICopyDeviceStatusListener.ScannerStateReason.None;
+            } else if (i == 12) {
+                scannerStateReason = ECopyComponent.ICopyDeviceStatusListener.ScannerStateReason.OtherError;
+            } else if (i != 15) {
+                switch (i) {
+                    case 7:
+                        scannerStateReason = ECopyComponent.ICopyDeviceStatusListener.ScannerStateReason.MediaJamError;
+                        break;
+                    case 8:
+                        scannerStateReason = ECopyComponent.ICopyDeviceStatusListener.ScannerStateReason.MediaEmptyError;
+                        break;
+                    default:
+                        scannerStateReason = ECopyComponent.ICopyDeviceStatusListener.ScannerStateReason.OtherError;
+                        break;
+                }
+            } else {
+                scannerStateReason = ECopyComponent.ICopyDeviceStatusListener.ScannerStateReason.MediaSizeMissmatchError;
+            }
+            scannerStateReason.string = next.string;
+            arrayList2.add(scannerStateReason);
+        }
+        return arrayList2;
+    }
+
+    /* access modifiers changed from: package-private */
+    public ArrayList<String> getJobTokens() {
+        ERemoteCopy eRemoteCopy = new ERemoteCopy();
+        eRemoteCopy.setHostIP(this.operation.getHostIP());
+        eRemoteCopy.setRequestConnectionTimeout(this.operation.getRequestConnectionTimeout());
+        ERemoteCopy.ERemoteCopyStatusResult status = eRemoteCopy.getStatus(new ERemoteCopy.IRemoteCopyStatusParameter() {
+            public String job_token() {
+                return "";
+            }
+
+            public String client_id() {
+                return RemoteDeviceTask.this.clientID;
+            }
+
+            public ArrayList<ERemoteOperation.ERemoteParam> keys() {
+                ArrayList<ERemoteOperation.ERemoteParam> arrayList = new ArrayList<>();
+                arrayList.add(ERemoteOperation.ERemoteParam.job_tokens);
+                return arrayList;
+            }
+        });
+        if (status.success()) {
+            return status.job_tokens();
+        }
+        return new ArrayList<>();
+    }
+
+    /* access modifiers changed from: protected */
+    public Result doInBackground(Void... voidArr) {
+        this.operation.setHostIP(this.systemSettings.getPrinterIPAddress());
+        ERemoteDevice.ERemoteDeviceStatusResult status = this.operation.getStatus(new ERemoteOperation.IRemoteStatusParameter() {
+            public String client_id() {
+                return RemoteDeviceTask.this.clientID;
+            }
+
+            public ArrayList<ERemoteOperation.ERemoteParam> keys() {
+                ArrayList<ERemoteOperation.ERemoteParam> arrayList = new ArrayList<>();
+                arrayList.add(ERemoteOperation.ERemoteParam.printer_state);
+                arrayList.add(ERemoteOperation.ERemoteParam.printer_state_reasons);
+                arrayList.add(ERemoteOperation.ERemoteParam.scanner_state);
+                arrayList.add(ERemoteOperation.ERemoteParam.scanner_state_reasons);
+                return arrayList;
+            }
+        });
+        Result result = new Result();
+        if (status.success()) {
+            result.connetion = ECopyComponent.ICopyDeviceStatusListener.Connection.Succeed;
+            result.printer = getDeviceState(status.printer_state());
+            result.scanner = getDeviceState(status.scanner_state());
+            result.printerReasons = getPrinterReasons(status.printer_state_reasons());
+            result.scannerReasons = getScannerReasons(status.scanner_state_reasons());
+            result.jobTokens = getJobTokens();
+        } else {
+            result.connetion = ECopyComponent.ICopyDeviceStatusListener.Connection.Failed;
+            result.printer = ECopyComponent.ICopyDeviceStatusListener.DeviceState.Stopped;
+            result.scanner = ECopyComponent.ICopyDeviceStatusListener.DeviceState.Stopped;
+            result.printerReasons = getPrinterErrorReasons();
+            result.scannerReasons = getScannerErrorReasons();
+            result.jobTokens = new ArrayList<>();
+        }
+        return result;
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPostExecute(Result result) {
+        this.statusListener.onDeviceStatus(result.connetion, result.printer, result.scanner, result.printerReasons, result.scannerReasons, result.jobTokens);
+    }
+}

+ 190 - 0
app/src/main/java/epson/print/copy/Component/eremoteoperation/ERemoteCombo.java

@@ -0,0 +1,190 @@
+package epson.print.copy.Component.eremoteoperation;
+
+import epson.print.copy.Component.eremoteoperation.ERemoteOperation;
+import java.util.ArrayList;
+import org.json.JSONObject;
+
+public class ERemoteCombo extends ERemoteOperation {
+
+    public interface IRemoteComboOptionsParameter extends ERemoteOperation.IRemoteOperationParameter {
+        boolean default_as_fixed();
+
+        ArrayList<ERemoteOperation.ERemoteParam> fixed_parameters();
+
+        ERemoteOperation.ERemoteParam frame();
+
+        ERemoteOperation.ERemoteParam layout();
+
+        ArrayList<ERemoteOperation.ERemoteParam> preferred_parameters();
+
+        ERemoteOperation.ERemoteParam print_media_size();
+
+        ERemoteOperation.ERemoteParam print_media_type();
+
+        ArrayList<ERemoteOperation.ERemoteParam> priority_order();
+    }
+
+    public interface IRemoteComboPrintTemplateParameter extends ERemoteOperation.IRemoteOperationParameter {
+        ERemoteOperation.ERemoteParam frame();
+
+        ERemoteOperation.ERemoteParam layout();
+
+        ERemoteOperation.ERemoteParam print_media_size();
+
+        ERemoteOperation.ERemoteParam print_media_type();
+    }
+
+    public interface IRemoteComboStatusParameter extends ERemoteOperation.IRemoteOperationParameter {
+        ERemoteOperation.ERemoteParam job_token();
+
+        ArrayList<ERemoteOperation.ERemoteParam> keys();
+    }
+
+    public interface IRemoteComboWaitTemplateParameter extends ERemoteOperation.IRemoteOperationParameter {
+    }
+
+    public class ERemoteComboOptionsResult extends ERemoteOperation.ERemoteReasonResult {
+        public ERemoteComboOptionsResult(JSONObject jSONObject) {
+            super(jSONObject);
+        }
+
+        public ArrayList<ERemoteOperation.ERemoteParam> parameter_options(ERemoteOperation.ERemoteParam eRemoteParam) {
+            return getOptionsValueOf(eRemoteParam);
+        }
+
+        public ERemoteOperation.ERemoteParam parameter_default(ERemoteOperation.ERemoteParam eRemoteParam) {
+            return getDefaultValueOf(eRemoteParam);
+        }
+    }
+
+    public class ERemoteComboPrintTemplateResult extends ERemoteOperation.ERemoteReasonResult {
+        public ERemoteComboPrintTemplateResult(JSONObject jSONObject) {
+            super(jSONObject);
+        }
+    }
+
+    public class ERemoteComboWaitTemplateResult extends ERemoteOperation.ERemoteReasonResult {
+        public ERemoteComboWaitTemplateResult(JSONObject jSONObject) {
+            super(jSONObject);
+        }
+    }
+
+    public class ERemoteComboStatusResult extends ERemoteOperation.ERemoteReasonResult {
+        public ERemoteComboStatusResult(JSONObject jSONObject) {
+            super(jSONObject);
+        }
+
+        public ERemoteOperation.ERemoteParam print_x_disc_tray_state() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.print_x_disc_tray_state);
+        }
+
+        public ERemoteOperation.ERemoteParam printer_state() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.printer_state);
+        }
+
+        public ERemoteOperation.ERemoteParam printer_state_reasons() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.printer_state_reasons);
+        }
+
+        public boolean document_on_adf() {
+            return getBooleanValueOf(ERemoteOperation.ERemoteParam.document_on_adf);
+        }
+
+        public ERemoteOperation.ERemoteParam scanner_state() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.scanner_state);
+        }
+
+        public ERemoteOperation.ERemoteParam scanner_state_reasons() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.scanner_state_reasons);
+        }
+
+        public ERemoteOperation.ERemoteParam job_state() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.job_state);
+        }
+
+        public ERemoteOperation.ERemoteParam job_result() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.job_result);
+        }
+
+        public ArrayList<String> job_tokens() {
+            return getStringsValueOf(ERemoteOperation.ERemoteParam.job_tokens);
+        }
+
+        public int job_print_total_pages() {
+            return getIntValueOf(ERemoteOperation.ERemoteParam.job_print_total_pages);
+        }
+
+        public int job_print_current_pages() {
+            return getIntValueOf(ERemoteOperation.ERemoteParam.job_print_current_pages);
+        }
+
+        public int job_image_post_url() {
+            return getIntValueOf(ERemoteOperation.ERemoteParam.job_image_post_url);
+        }
+    }
+
+    public ERemoteComboOptionsResult getOptions(IRemoteComboOptionsParameter iRemoteComboOptionsParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestCombo = ERemoteOperation.ERemoteRequestBuilder.requestCombo(this.hostIP, ERemoteOperation.RequestParam.get_options, getRequestConnectionTimeout());
+        requestCombo.add(ERemoteOperation.ERemoteParam.client_id, iRemoteComboOptionsParameter.client_id());
+        requestCombo.add(ERemoteOperation.ERemoteParam.layout, iRemoteComboOptionsParameter.layout());
+        requestCombo.add(ERemoteOperation.ERemoteParam.print_media_type, iRemoteComboOptionsParameter.print_media_type());
+        requestCombo.add(ERemoteOperation.ERemoteParam.print_media_size, iRemoteComboOptionsParameter.print_media_size());
+        requestCombo.add(ERemoteOperation.ERemoteParam.frame, iRemoteComboOptionsParameter.frame());
+        requestCombo.add(ERemoteOperation.ERemoteParam.fixed_parameters, iRemoteComboOptionsParameter.fixed_parameters());
+        requestCombo.add(ERemoteOperation.ERemoteParam.priority_order, iRemoteComboOptionsParameter.priority_order());
+        requestCombo.add(ERemoteOperation.ERemoteParam.default_as_fixed, iRemoteComboOptionsParameter.default_as_fixed());
+        ERemoteComboOptionsResult eRemoteComboOptionsResult = new ERemoteComboOptionsResult(requestCombo.getRemoteRequest().execute());
+        eRemoteComboOptionsResult.setRemoteRequestBuilder(requestCombo);
+        return eRemoteComboOptionsResult;
+    }
+
+    public ERemoteComboOptionsResult getSelectableOptions() {
+        ArrayList arrayList = new ArrayList();
+        arrayList.add(ERemoteOperation.ERemoteParam.layout);
+        arrayList.add(ERemoteOperation.ERemoteParam.print_media_size);
+        arrayList.add(ERemoteOperation.ERemoteParam.print_media_type);
+        arrayList.add(ERemoteOperation.ERemoteParam.frame);
+        ERemoteOperation.ERemoteRequestBuilder requestCombo = ERemoteOperation.ERemoteRequestBuilder.requestCombo(this.hostIP, ERemoteOperation.RequestParam.get_options, getRequestConnectionTimeout());
+        requestCombo.add(ERemoteOperation.ERemoteParam.client_id, ERemoteOperation.ERemoteParam.x_null.string);
+        requestCombo.add(ERemoteOperation.ERemoteParam.layout, ERemoteOperation.ERemoteParam.x_null);
+        requestCombo.add(ERemoteOperation.ERemoteParam.print_media_type, ERemoteOperation.ERemoteParam.x_null);
+        requestCombo.add(ERemoteOperation.ERemoteParam.print_media_size, ERemoteOperation.ERemoteParam.x_null);
+        requestCombo.add(ERemoteOperation.ERemoteParam.frame, ERemoteOperation.ERemoteParam.x_null);
+        requestCombo.add(ERemoteOperation.ERemoteParam.fixed_parameters, (ArrayList<ERemoteOperation.ERemoteParam>) new ArrayList());
+        requestCombo.add(ERemoteOperation.ERemoteParam.priority_order, (ArrayList<ERemoteOperation.ERemoteParam>) arrayList);
+        requestCombo.add(ERemoteOperation.ERemoteParam.default_as_fixed, false);
+        ERemoteComboOptionsResult eRemoteComboOptionsResult = new ERemoteComboOptionsResult(requestCombo.getRemoteRequest().execute());
+        eRemoteComboOptionsResult.setRemoteRequestBuilder(requestCombo);
+        return eRemoteComboOptionsResult;
+    }
+
+    public ERemoteComboPrintTemplateResult printTemplate(IRemoteComboPrintTemplateParameter iRemoteComboPrintTemplateParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestCombo = ERemoteOperation.ERemoteRequestBuilder.requestCombo(this.hostIP, ERemoteOperation.RequestParam.get_options, getRequestConnectionTimeout());
+        requestCombo.add(ERemoteOperation.ERemoteParam.client_id, iRemoteComboPrintTemplateParameter.client_id());
+        requestCombo.add(ERemoteOperation.ERemoteParam.layout, iRemoteComboPrintTemplateParameter.layout());
+        requestCombo.add(ERemoteOperation.ERemoteParam.print_media_type, iRemoteComboPrintTemplateParameter.print_media_type());
+        requestCombo.add(ERemoteOperation.ERemoteParam.print_media_size, iRemoteComboPrintTemplateParameter.print_media_size());
+        requestCombo.add(ERemoteOperation.ERemoteParam.frame, iRemoteComboPrintTemplateParameter.frame());
+        ERemoteComboPrintTemplateResult eRemoteComboPrintTemplateResult = new ERemoteComboPrintTemplateResult(requestCombo.getRemoteRequest().execute());
+        eRemoteComboPrintTemplateResult.setRemoteRequestBuilder(requestCombo);
+        return eRemoteComboPrintTemplateResult;
+    }
+
+    public ERemoteComboWaitTemplateResult waitTemplate(IRemoteComboWaitTemplateParameter iRemoteComboWaitTemplateParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestCombo = ERemoteOperation.ERemoteRequestBuilder.requestCombo(this.hostIP, ERemoteOperation.RequestParam.get_options, getRequestConnectionTimeout());
+        requestCombo.add(ERemoteOperation.ERemoteParam.client_id, iRemoteComboWaitTemplateParameter.client_id());
+        ERemoteComboWaitTemplateResult eRemoteComboWaitTemplateResult = new ERemoteComboWaitTemplateResult(requestCombo.getRemoteRequest().execute());
+        eRemoteComboWaitTemplateResult.setRemoteRequestBuilder(requestCombo);
+        return eRemoteComboWaitTemplateResult;
+    }
+
+    public ERemoteComboStatusResult getStatus(IRemoteComboStatusParameter iRemoteComboStatusParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestCombo = ERemoteOperation.ERemoteRequestBuilder.requestCombo(this.hostIP, ERemoteOperation.RequestParam.get_options, getRequestConnectionTimeout());
+        requestCombo.add(ERemoteOperation.ERemoteParam.client_id, iRemoteComboStatusParameter.client_id());
+        requestCombo.add(ERemoteOperation.ERemoteParam.keys, iRemoteComboStatusParameter.keys());
+        requestCombo.add(ERemoteOperation.ERemoteParam.job_token, iRemoteComboStatusParameter.job_token());
+        ERemoteComboStatusResult eRemoteComboStatusResult = new ERemoteComboStatusResult(requestCombo.getRemoteRequest().execute());
+        eRemoteComboStatusResult.setRemoteRequestBuilder(requestCombo);
+        return eRemoteComboStatusResult;
+    }
+}

+ 356 - 0
app/src/main/java/epson/print/copy/Component/eremoteoperation/ERemoteCopy.java

@@ -0,0 +1,356 @@
+package epson.print.copy.Component.eremoteoperation;
+
+import epson.print.copy.Component.eremoteoperation.ERemoteOperation;
+import java.util.ArrayList;
+import org.json.JSONObject;
+
+public class ERemoteCopy extends ERemoteOperation {
+
+    public interface IRemoteCancelParameter extends ERemoteOperation.IRemoteOperationParameter {
+        String job_token();
+    }
+
+    public interface IRemoteCopyDocumentChangedParameter extends ERemoteOperation.IRemoteOperationParameter {
+        String job_token();
+
+        boolean next_document();
+    }
+
+    public interface IRemoteCopyOptionsParameter extends ERemoteOperation.IRemoteOperationParameter {
+        boolean default_as_fixed();
+
+        ArrayList<ERemoteOperation.ERemoteParam> fixed_parameters();
+
+        ERemoteOperation.ERemoteParam layout();
+
+        ArrayList<ERemoteOperation.ERemoteParam> preferred_parameters();
+
+        ERemoteOperation.ERemoteParam print_media_size();
+
+        ERemoteOperation.ERemoteParam print_media_source();
+
+        ERemoteOperation.ERemoteParam print_media_type();
+
+        ERemoteOperation.ERemoteParam print_quality();
+
+        ERemoteOperation.ERemoteParam print_sheet_collate();
+
+        ERemoteOperation.ERemoteParam print_sides();
+
+        ArrayList<ERemoteOperation.ERemoteParam> priority_order();
+
+        ERemoteOperation.ERemoteParam scan_content_type();
+
+        ERemoteOperation.ERemoteParam scan_media_size();
+
+        ERemoteOperation.ERemoteParam scan_sides();
+    }
+
+    public interface IRemoteCopyParameter extends ERemoteOperation.IRemoteOperationParameter {
+        ERemoteOperation.ERemoteParam color_effects_type();
+
+        int copies();
+
+        int copy_magnification();
+
+        ERemoteOperation.ERemoteParam layout();
+
+        ERemoteOperation.ERemoteParam orientation();
+
+        ERemoteOperation.ERemoteParam print_media_size();
+
+        ERemoteOperation.ERemoteParam print_media_source();
+
+        ERemoteOperation.ERemoteParam print_media_type();
+
+        ERemoteOperation.ERemoteParam print_quality();
+
+        ERemoteOperation.ERemoteParam print_sheet_collate();
+
+        ERemoteOperation.ERemoteParam print_sides();
+
+        ERemoteOperation.ERemoteParam print_x_auto_pg();
+
+        ERemoteOperation.ERemoteParam print_x_bleed();
+
+        ERemoteOperation.ERemoteParam print_x_dry_time();
+
+        ERemoteOperation.ERemoteParam scan_content_type();
+
+        ERemoteOperation.ERemoteParam scan_media_size();
+
+        ERemoteOperation.ERemoteParam scan_sides();
+
+        int x_density();
+    }
+
+    public interface IRemoteCopyStatusParameter extends ERemoteOperation.IRemoteStatusParameter {
+        String job_token();
+    }
+
+    public class ERemoteCopyOptionsResult extends ERemoteOperation.ERemoteReasonResult {
+        public ERemoteCopyOptionsResult(JSONObject jSONObject) {
+            super(jSONObject);
+        }
+
+        public ArrayList<ERemoteOperation.ERemoteParam> parameter_options(ERemoteOperation.ERemoteParam eRemoteParam) {
+            return getOptionsValueOf(eRemoteParam);
+        }
+
+        public ERemoteOperation.ERemoteParam parameter_default(ERemoteOperation.ERemoteParam eRemoteParam) {
+            return getDefaultValueOf(eRemoteParam);
+        }
+
+        public ArrayList<ERemoteOperation.ERemoteParam> local_options(ERemoteOperation.ERemoteParam eRemoteParam) {
+            ArrayList<ERemoteOperation.ERemoteParam> arrayList = new ArrayList<>();
+            if (eRemoteParam == ERemoteOperation.ERemoteParam.color_effects_type) {
+                arrayList.add(ERemoteOperation.ERemoteParam.color);
+                arrayList.add(ERemoteOperation.ERemoteParam.monochrome_grayscale);
+                return arrayList;
+            } else if (eRemoteParam != ERemoteOperation.ERemoteParam.print_x_bleed) {
+                return arrayList;
+            } else {
+                ERemoteOperation.ERemoteParam eRemoteParam2 = (ERemoteOperation.ERemoteParam) this.request.remoteParam.get(ERemoteOperation.ERemoteParam.print_media_size);
+                arrayList.add(ERemoteOperation.ERemoteParam.standard);
+                arrayList.add(ERemoteOperation.ERemoteParam.midium);
+                arrayList.add(ERemoteOperation.ERemoteParam.minimum);
+                return arrayList;
+            }
+        }
+
+        public ERemoteOperation.ERemoteParam local_default(ERemoteOperation.ERemoteParam eRemoteParam) {
+            if (eRemoteParam == ERemoteOperation.ERemoteParam.color_effects_type) {
+                return ERemoteOperation.ERemoteParam.color;
+            }
+            if (eRemoteParam == ERemoteOperation.ERemoteParam.print_x_bleed) {
+                return ERemoteOperation.ERemoteParam.standard;
+            }
+            if (eRemoteParam == ERemoteOperation.ERemoteParam.x_scale) {
+                return ERemoteOperation.ERemoteParam.x_scale_autofit;
+            }
+            return ERemoteOperation.ERemoteParam.x_null;
+        }
+
+        public class ScaleOptions {
+            ArrayList<ERemoteOperation.ERemoteParam> mediaSizeList;
+            ArrayList<ERemoteOperation.ERemoteParam> scalePresets;
+
+            public ScaleOptions(ArrayList<ERemoteOperation.ERemoteParam> arrayList) {
+                this.mediaSizeList = arrayList;
+            }
+
+            public ArrayList<ERemoteOperation.ERemoteParam> scale_options() {
+                this.scalePresets = new ArrayList<>();
+                this.scalePresets.add(ERemoteOperation.ERemoteParam.x_scale_autofit);
+                this.scalePresets.add(ERemoteOperation.ERemoteParam.x_scale_fullsize);
+                this.scalePresets.add(ERemoteOperation.ERemoteParam.x_scale_custom);
+                checkPaperSize(ERemoteOperation.ERemoteParam.na_letter_8_5x11in, ERemoteOperation.ERemoteParam.na_index_4x6_4x6in, ERemoteOperation.ERemoteParam.x_scale_letter_to_kg);
+                checkPaperSize(ERemoteOperation.ERemoteParam.na_index_4x6_4x6in, ERemoteOperation.ERemoteParam.na_letter_8_5x11in, ERemoteOperation.ERemoteParam.x_scale_kg_to_letter);
+                checkPaperSize(ERemoteOperation.ERemoteParam.na_letter_8_5x11in, ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.x_scale_letter_to_2l);
+                checkPaperSize(ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.na_letter_8_5x11in, ERemoteOperation.ERemoteParam.x_scale_2l_to_letter);
+                checkPaperSize(ERemoteOperation.ERemoteParam.na_index_4x6_4x6in, ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.x_scale_kg_to_a4);
+                checkPaperSize(ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.na_index_4x6_4x6in, ERemoteOperation.ERemoteParam.x_scale_a4_to_kg);
+                checkPaperSize(ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.x_scale_2l_to_a4);
+                checkPaperSize(ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.x_scale_a4_to_2l);
+                checkPaperSize(ERemoteOperation.ERemoteParam.na_index_4x6_4x6in, ERemoteOperation.ERemoteParam.na_govt_letter_8x10in, ERemoteOperation.ERemoteParam.x_scale_kg_to_8x10);
+                checkPaperSize(ERemoteOperation.ERemoteParam.na_govt_letter_8x10in, ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.x_scale_8x10_to_2l);
+                checkPaperSize(ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.jpn_hagaki_100x148mm, ERemoteOperation.ERemoteParam.x_scale_a4_to_postcard);
+                checkPaperSize(ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.jpn_hagaki_100x148mm, ERemoteOperation.ERemoteParam.x_scale_2l_to_postcard);
+                checkPaperSize(ERemoteOperation.ERemoteParam.oe_photo_l_3_5x5in, ERemoteOperation.ERemoteParam.jpn_hagaki_100x148mm, ERemoteOperation.ERemoteParam.x_scale_l_to_postcard);
+                checkPaperSize(ERemoteOperation.ERemoteParam.oe_photo_l_3_5x5in, ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.x_scale_l_to_2l);
+                checkPaperSize(ERemoteOperation.ERemoteParam.jpn_hagaki_100x148mm, ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.x_scale_postcard_to_a4);
+                checkPaperSize(ERemoteOperation.ERemoteParam.oe_photo_l_3_5x5in, ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.x_scale_l_to_a4);
+                checkPaperSize(ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.jis_b5_182x257mm, ERemoteOperation.ERemoteParam.x_scale_a4_to_b5);
+                checkPaperSize(ERemoteOperation.ERemoteParam.jis_b5_182x257mm, ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.x_scale_b5_to_a4);
+                checkPaperSize(ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.na_index_4x6_4x6in, ERemoteOperation.ERemoteParam.x_scale_2l_to_kg);
+                checkPaperSize(ERemoteOperation.ERemoteParam.na_index_4x6_4x6in, ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.x_scale_kg_to_2l);
+                checkPaperSize(ERemoteOperation.ERemoteParam.iso_a5_148x210mm, ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.x_scale_a5_to_a4);
+                checkPaperSize(ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.iso_a5_148x210mm, ERemoteOperation.ERemoteParam.x_scale_a4_to_a5);
+                checkPaperSize(ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.iso_a3_297x420mm, ERemoteOperation.ERemoteParam.x_scale_a4_to_a3);
+                checkPaperSize(ERemoteOperation.ERemoteParam.na_letter_8_5x11in, ERemoteOperation.ERemoteParam.na_ledger_11x17in, ERemoteOperation.ERemoteParam.x_scale_letter_to_11x17);
+                return this.scalePresets;
+            }
+
+            private void checkPaperSize(ERemoteOperation.ERemoteParam eRemoteParam, ERemoteOperation.ERemoteParam eRemoteParam2, ERemoteOperation.ERemoteParam eRemoteParam3) {
+                if (this.mediaSizeList.contains(eRemoteParam) && this.mediaSizeList.contains(eRemoteParam2)) {
+                    this.scalePresets.add(eRemoteParam3);
+                }
+            }
+        }
+    }
+
+    public class ERemoteCopyResult extends ERemoteOperation.ERemoteReasonResult {
+        public ERemoteCopyResult(JSONObject jSONObject) {
+            super(jSONObject);
+        }
+
+        public String job_token() {
+            return getStringValueOf(ERemoteOperation.ERemoteParam.job_token);
+        }
+    }
+
+    public class ERemoteCopyStatusResult extends ERemoteOperation.ERemoteReasonResult {
+        public ERemoteCopyStatusResult(JSONObject jSONObject) {
+            super(jSONObject);
+        }
+
+        public ERemoteOperation.ERemoteParam print_x_disc_tray_state() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.print_x_disc_tray_state);
+        }
+
+        public ERemoteOperation.ERemoteParam printer_state() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.printer_state);
+        }
+
+        public ArrayList<ERemoteOperation.ERemoteParam> printer_state_reasons() {
+            return getParamsValueOf(ERemoteOperation.ERemoteParam.printer_state_reasons);
+        }
+
+        public boolean document_on_adf() {
+            return getBooleanValueOf(ERemoteOperation.ERemoteParam.document_on_adf);
+        }
+
+        public ERemoteOperation.ERemoteParam scanner_state() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.scanner_state);
+        }
+
+        public ArrayList<ERemoteOperation.ERemoteParam> scanner_state_reasons() {
+            return getParamsValueOf(ERemoteOperation.ERemoteParam.scanner_state_reasons);
+        }
+
+        public ERemoteOperation.ERemoteParam job_state() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.job_state);
+        }
+
+        public ERemoteOperation.ERemoteParam job_result() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.job_result);
+        }
+
+        public ArrayList<String> job_tokens() {
+            return getStringsValueOf(ERemoteOperation.ERemoteParam.job_tokens);
+        }
+
+        public int job_print_total_pages() {
+            return getIntValueOf(ERemoteOperation.ERemoteParam.job_print_total_pages);
+        }
+
+        public int job_print_current_pages() {
+            return getIntValueOf(ERemoteOperation.ERemoteParam.job_print_current_pages);
+        }
+    }
+
+    public ERemoteCopyResult copy(IRemoteCopyParameter iRemoteCopyParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestCopy = ERemoteOperation.ERemoteRequestBuilder.requestCopy(this.hostIP, ERemoteOperation.RequestParam.copy, getRequestConnectionTimeout());
+        requestCopy.add(ERemoteOperation.ERemoteParam.client_id, iRemoteCopyParameter.client_id());
+        requestCopy.add(ERemoteOperation.ERemoteParam.layout, iRemoteCopyParameter.layout());
+        requestCopy.add(ERemoteOperation.ERemoteParam.scan_sides, iRemoteCopyParameter.scan_sides());
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_sides, iRemoteCopyParameter.print_sides());
+        requestCopy.add(ERemoteOperation.ERemoteParam.scan_media_size, iRemoteCopyParameter.scan_media_size());
+        requestCopy.add(ERemoteOperation.ERemoteParam.scan_content_type, iRemoteCopyParameter.scan_content_type());
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_type, iRemoteCopyParameter.print_media_type());
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_size, iRemoteCopyParameter.print_media_size());
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_source, iRemoteCopyParameter.print_media_source());
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_quality, iRemoteCopyParameter.print_quality());
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_sheet_collate, iRemoteCopyParameter.print_sheet_collate());
+        requestCopy.add(ERemoteOperation.ERemoteParam.copies, iRemoteCopyParameter.copies());
+        requestCopy.add(ERemoteOperation.ERemoteParam.color_effects_type, iRemoteCopyParameter.color_effects_type());
+        requestCopy.add(ERemoteOperation.ERemoteParam.copy_magnification, iRemoteCopyParameter.copy_magnification(), new ERemoteOperation.ERemoteRequestBuilder.VariantValueConverter() {
+            public ERemoteOperation.ERemoteParam convertValue(int i) {
+                if (i == 0) {
+                    return ERemoteOperation.ERemoteParam.auto;
+                }
+                return null;
+            }
+        });
+        requestCopy.add(ERemoteOperation.ERemoteParam.x_density, iRemoteCopyParameter.x_density());
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_x_bleed, iRemoteCopyParameter.print_x_bleed());
+        requestCopy.add(ERemoteOperation.ERemoteParam.orientation, iRemoteCopyParameter.orientation());
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_x_dry_time, iRemoteCopyParameter.print_x_dry_time());
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_x_auto_pg, iRemoteCopyParameter.print_x_auto_pg());
+        return new ERemoteCopyResult(requestCopy.getRemoteRequest().execute());
+    }
+
+    public ERemoteCopyOptionsResult getOptions(IRemoteCopyOptionsParameter iRemoteCopyOptionsParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestCopy = ERemoteOperation.ERemoteRequestBuilder.requestCopy(this.hostIP, ERemoteOperation.RequestParam.get_options, getRequestConnectionTimeout());
+        requestCopy.add(ERemoteOperation.ERemoteParam.client_id, iRemoteCopyOptionsParameter.client_id());
+        requestCopy.add(ERemoteOperation.ERemoteParam.layout, iRemoteCopyOptionsParameter.layout());
+        requestCopy.add(ERemoteOperation.ERemoteParam.scan_sides, iRemoteCopyOptionsParameter.scan_sides());
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_sides, iRemoteCopyOptionsParameter.print_sides());
+        requestCopy.add(ERemoteOperation.ERemoteParam.scan_media_size, iRemoteCopyOptionsParameter.scan_media_size());
+        requestCopy.add(ERemoteOperation.ERemoteParam.scan_content_type, iRemoteCopyOptionsParameter.scan_content_type());
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_type, iRemoteCopyOptionsParameter.print_media_type());
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_size, iRemoteCopyOptionsParameter.print_media_size());
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_source, iRemoteCopyOptionsParameter.print_media_source());
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_quality, iRemoteCopyOptionsParameter.print_quality());
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_sheet_collate, iRemoteCopyOptionsParameter.print_sheet_collate());
+        requestCopy.add(ERemoteOperation.ERemoteParam.fixed_parameters, iRemoteCopyOptionsParameter.fixed_parameters());
+        requestCopy.add(ERemoteOperation.ERemoteParam.preferred_parameters, iRemoteCopyOptionsParameter.preferred_parameters());
+        requestCopy.add(ERemoteOperation.ERemoteParam.priority_order, iRemoteCopyOptionsParameter.priority_order());
+        requestCopy.add(ERemoteOperation.ERemoteParam.default_as_fixed, iRemoteCopyOptionsParameter.default_as_fixed());
+        ERemoteCopyOptionsResult eRemoteCopyOptionsResult = new ERemoteCopyOptionsResult(requestCopy.getRemoteRequest().execute());
+        eRemoteCopyOptionsResult.setRemoteRequestBuilder(requestCopy);
+        return eRemoteCopyOptionsResult;
+    }
+
+    public ERemoteCopyOptionsResult getSelectableOptions() {
+        ArrayList arrayList = new ArrayList();
+        arrayList.add(ERemoteOperation.ERemoteParam.print_sheet_collate);
+        arrayList.add(ERemoteOperation.ERemoteParam.scan_sides);
+        arrayList.add(ERemoteOperation.ERemoteParam.layout);
+        arrayList.add(ERemoteOperation.ERemoteParam.print_sides);
+        arrayList.add(ERemoteOperation.ERemoteParam.scan_media_size);
+        arrayList.add(ERemoteOperation.ERemoteParam.print_media_size);
+        arrayList.add(ERemoteOperation.ERemoteParam.print_media_type);
+        arrayList.add(ERemoteOperation.ERemoteParam.scan_content_type);
+        arrayList.add(ERemoteOperation.ERemoteParam.print_quality);
+        arrayList.add(ERemoteOperation.ERemoteParam.print_media_source);
+        ERemoteOperation.ERemoteRequestBuilder requestCopy = ERemoteOperation.ERemoteRequestBuilder.requestCopy(this.hostIP, ERemoteOperation.RequestParam.get_options, getRequestConnectionTimeout());
+        requestCopy.add(ERemoteOperation.ERemoteParam.client_id, ERemoteOperation.ERemoteParam.x_null.string);
+        requestCopy.add(ERemoteOperation.ERemoteParam.layout, ERemoteOperation.ERemoteParam.x_null);
+        requestCopy.add(ERemoteOperation.ERemoteParam.scan_sides, ERemoteOperation.ERemoteParam.x_null);
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_sides, ERemoteOperation.ERemoteParam.x_null);
+        requestCopy.add(ERemoteOperation.ERemoteParam.scan_media_size, ERemoteOperation.ERemoteParam.x_null);
+        requestCopy.add(ERemoteOperation.ERemoteParam.scan_content_type, ERemoteOperation.ERemoteParam.x_null);
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_type, ERemoteOperation.ERemoteParam.x_null);
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_size, ERemoteOperation.ERemoteParam.x_null);
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_source, ERemoteOperation.ERemoteParam.x_null);
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_quality, ERemoteOperation.ERemoteParam.x_null);
+        requestCopy.add(ERemoteOperation.ERemoteParam.print_sheet_collate, ERemoteOperation.ERemoteParam.x_null);
+        requestCopy.add(ERemoteOperation.ERemoteParam.fixed_parameters, (ArrayList<ERemoteOperation.ERemoteParam>) new ArrayList());
+        requestCopy.add(ERemoteOperation.ERemoteParam.preferred_parameters, (ArrayList<ERemoteOperation.ERemoteParam>) new ArrayList());
+        requestCopy.add(ERemoteOperation.ERemoteParam.priority_order, (ArrayList<ERemoteOperation.ERemoteParam>) arrayList);
+        requestCopy.add(ERemoteOperation.ERemoteParam.default_as_fixed, false);
+        ERemoteCopyOptionsResult eRemoteCopyOptionsResult = new ERemoteCopyOptionsResult(requestCopy.getRemoteRequest().execute());
+        eRemoteCopyOptionsResult.setRemoteRequestBuilder(requestCopy);
+        return eRemoteCopyOptionsResult;
+    }
+
+    public ERemoteCopyStatusResult getStatus(IRemoteCopyStatusParameter iRemoteCopyStatusParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestCopy = ERemoteOperation.ERemoteRequestBuilder.requestCopy(this.hostIP, ERemoteOperation.RequestParam.get_status, getRequestConnectionTimeout());
+        requestCopy.add(ERemoteOperation.ERemoteParam.client_id, iRemoteCopyStatusParameter.client_id());
+        requestCopy.add(ERemoteOperation.ERemoteParam.keys, iRemoteCopyStatusParameter.keys());
+        requestCopy.add(ERemoteOperation.ERemoteParam.job_token, iRemoteCopyStatusParameter.job_token());
+        ERemoteCopyStatusResult eRemoteCopyStatusResult = new ERemoteCopyStatusResult(requestCopy.getRemoteRequest().execute());
+        eRemoteCopyStatusResult.setRemoteRequestBuilder(requestCopy);
+        return eRemoteCopyStatusResult;
+    }
+
+    public ERemoteOperation.ERemoteReasonResult cancel(IRemoteCancelParameter iRemoteCancelParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestCopy = ERemoteOperation.ERemoteRequestBuilder.requestCopy(this.hostIP, ERemoteOperation.RequestParam.cancel, getRequestConnectionTimeout());
+        requestCopy.add(ERemoteOperation.ERemoteParam.client_id, iRemoteCancelParameter.client_id());
+        requestCopy.add(ERemoteOperation.ERemoteParam.job_token, iRemoteCancelParameter.job_token());
+        ERemoteOperation.ERemoteReasonResult eRemoteReasonResult = new ERemoteOperation.ERemoteReasonResult(requestCopy.getRemoteRequest().execute());
+        eRemoteReasonResult.setRemoteRequestBuilder(requestCopy);
+        return eRemoteReasonResult;
+    }
+
+    public ERemoteOperation.ERemoteReasonResult documentChanged(IRemoteCopyDocumentChangedParameter iRemoteCopyDocumentChangedParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestCopy = ERemoteOperation.ERemoteRequestBuilder.requestCopy(this.hostIP, ERemoteOperation.RequestParam.document_changed, getRequestConnectionTimeout());
+        requestCopy.add(ERemoteOperation.ERemoteParam.client_id, iRemoteCopyDocumentChangedParameter.client_id());
+        requestCopy.add(ERemoteOperation.ERemoteParam.job_token, iRemoteCopyDocumentChangedParameter.job_token());
+        requestCopy.add(ERemoteOperation.ERemoteParam.next_document, iRemoteCopyDocumentChangedParameter.next_document());
+        ERemoteOperation.ERemoteReasonResult eRemoteReasonResult = new ERemoteOperation.ERemoteReasonResult(requestCopy.getRemoteRequest().execute());
+        eRemoteReasonResult.setRemoteRequestBuilder(requestCopy);
+        return eRemoteReasonResult;
+    }
+}

+ 200 - 0
app/src/main/java/epson/print/copy/Component/eremoteoperation/ERemoteCopyPhoto.java

@@ -0,0 +1,200 @@
+package epson.print.copy.Component.eremoteoperation;
+
+import epson.print.copy.Component.eremoteoperation.ERemoteCopy;
+import epson.print.copy.Component.eremoteoperation.ERemoteOperation;
+import java.util.ArrayList;
+import java.util.List;
+import org.json.JSONObject;
+
+public class ERemoteCopyPhoto extends ERemoteCopy {
+
+    public interface IRemoteCopyPhotoOptionsParameter extends ERemoteOperation.IRemoteOperationParameter {
+        boolean default_as_fixed();
+
+        ArrayList<ERemoteOperation.ERemoteParam> fixed_parameters();
+
+        ERemoteOperation.ERemoteParam layout();
+
+        ArrayList<ERemoteOperation.ERemoteParam> preferred_parameters();
+
+        ERemoteOperation.ERemoteParam print_media_size();
+
+        ERemoteOperation.ERemoteParam print_media_source();
+
+        ERemoteOperation.ERemoteParam print_media_type();
+
+        ERemoteOperation.ERemoteParam print_quality();
+
+        ArrayList<ERemoteOperation.ERemoteParam> priority_order();
+
+        ERemoteOperation.ERemoteParam x_apf();
+    }
+
+    public interface IRemoteCopyPhotoParameter extends ERemoteOperation.IRemoteOperationParameter {
+        ERemoteOperation.ERemoteParam color_effects_type();
+
+        ArrayList<String> copies();
+
+        ERemoteOperation.ERemoteParam layout();
+
+        ERemoteOperation.ERemoteParam print_media_size();
+
+        ERemoteOperation.ERemoteParam print_media_source();
+
+        ERemoteOperation.ERemoteParam print_media_type();
+
+        ERemoteOperation.ERemoteParam print_quality();
+
+        ERemoteOperation.ERemoteParam print_x_auto_pg();
+
+        ERemoteOperation.ERemoteParam print_x_bleed();
+
+        ArrayList<String> scan_area_height();
+
+        ArrayList<String> scan_area_resolution();
+
+        ArrayList<String> scan_area_width();
+
+        ArrayList<String> scan_area_x();
+
+        ArrayList<String> scan_area_y();
+
+        int scan_count();
+
+        ERemoteOperation.ERemoteParam x_apf();
+
+        ERemoteOperation.ERemoteParam x_color_restoration();
+
+        ArrayList<String> x_fit_gamma();
+
+        ArrayList<String> x_fit_matrix();
+    }
+
+    public class ERemoteCopyPhotoOptionResult extends ERemoteCopy.ERemoteCopyOptionsResult {
+        public ERemoteCopyPhotoOptionResult(JSONObject jSONObject) {
+            super(jSONObject);
+        }
+
+        public ArrayList<ERemoteOperation.ERemoteParam> local_options(ERemoteOperation.ERemoteParam eRemoteParam) {
+            ArrayList<ERemoteOperation.ERemoteParam> arrayList = new ArrayList<>();
+            if (eRemoteParam == ERemoteOperation.ERemoteParam.color_effects_type) {
+                arrayList.add(ERemoteOperation.ERemoteParam.color);
+                arrayList.add(ERemoteOperation.ERemoteParam.monochrome_grayscale);
+                return arrayList;
+            } else if (eRemoteParam == ERemoteOperation.ERemoteParam.print_x_bleed) {
+                arrayList.add(ERemoteOperation.ERemoteParam.standard);
+                arrayList.add(ERemoteOperation.ERemoteParam.midium);
+                arrayList.add(ERemoteOperation.ERemoteParam.minimum);
+                return arrayList;
+            } else if (eRemoteParam != ERemoteOperation.ERemoteParam.x_color_restoration) {
+                return arrayList;
+            } else {
+                arrayList.add(ERemoteOperation.ERemoteParam.on);
+                arrayList.add(ERemoteOperation.ERemoteParam.off);
+                return arrayList;
+            }
+        }
+
+        public ERemoteOperation.ERemoteParam local_default(ERemoteOperation.ERemoteParam eRemoteParam) {
+            if (eRemoteParam == ERemoteOperation.ERemoteParam.color_effects_type) {
+                return ERemoteOperation.ERemoteParam.color;
+            }
+            if (eRemoteParam == ERemoteOperation.ERemoteParam.print_x_bleed) {
+                return ERemoteOperation.ERemoteParam.standard;
+            }
+            if (eRemoteParam == ERemoteOperation.ERemoteParam.x_color_restoration) {
+                return ERemoteOperation.ERemoteParam.off;
+            }
+            return ERemoteOperation.ERemoteParam.x_null;
+        }
+    }
+
+    public ERemoteCopy.ERemoteCopyResult copy(IRemoteCopyPhotoParameter iRemoteCopyPhotoParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestCopyPhoto = ERemoteOperation.ERemoteRequestBuilder.requestCopyPhoto(this.hostIP, ERemoteOperation.RequestParam.copy, getRequestConnectionTimeout());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.client_id, iRemoteCopyPhotoParameter.client_id());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.layout, iRemoteCopyPhotoParameter.layout());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.print_media_type, iRemoteCopyPhotoParameter.print_media_type());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.print_media_size, iRemoteCopyPhotoParameter.print_media_size());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.print_quality, iRemoteCopyPhotoParameter.print_quality());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.print_media_source, iRemoteCopyPhotoParameter.print_media_source());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.x_apf, iRemoteCopyPhotoParameter.x_apf());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.x_color_restoration, iRemoteCopyPhotoParameter.x_color_restoration());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.color_effects_type, iRemoteCopyPhotoParameter.color_effects_type());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.scan_count, iRemoteCopyPhotoParameter.scan_count());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.copies, (List<String>) iRemoteCopyPhotoParameter.copies());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.scan_area_x, (List<String>) iRemoteCopyPhotoParameter.scan_area_x());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.scan_area_y, (List<String>) iRemoteCopyPhotoParameter.scan_area_y());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.scan_area_width, (List<String>) iRemoteCopyPhotoParameter.scan_area_width());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.scan_area_height, (List<String>) iRemoteCopyPhotoParameter.scan_area_height());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.scan_area_resolution, (List<String>) iRemoteCopyPhotoParameter.scan_area_resolution());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.print_x_bleed, iRemoteCopyPhotoParameter.print_x_bleed());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.print_x_auto_pg, iRemoteCopyPhotoParameter.print_x_auto_pg());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.x_fit_gamma, (List<String>) iRemoteCopyPhotoParameter.x_fit_gamma());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.x_fit_matrix, (List<String>) iRemoteCopyPhotoParameter.x_fit_matrix());
+        ERemoteCopy.ERemoteCopyResult eRemoteCopyResult = new ERemoteCopy.ERemoteCopyResult(requestCopyPhoto.getRemoteRequest().execute());
+        eRemoteCopyResult.setRemoteRequestBuilder(requestCopyPhoto);
+        return eRemoteCopyResult;
+    }
+
+    public ERemoteCopyPhotoOptionResult getOptions(IRemoteCopyPhotoOptionsParameter iRemoteCopyPhotoOptionsParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestCopyPhoto = ERemoteOperation.ERemoteRequestBuilder.requestCopyPhoto(this.hostIP, ERemoteOperation.RequestParam.get_options, getRequestConnectionTimeout());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.client_id, iRemoteCopyPhotoOptionsParameter.client_id());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.layout, iRemoteCopyPhotoOptionsParameter.layout());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.print_media_type, iRemoteCopyPhotoOptionsParameter.print_media_type());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.print_media_size, iRemoteCopyPhotoOptionsParameter.print_media_size());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.print_quality, iRemoteCopyPhotoOptionsParameter.print_quality());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.print_media_source, iRemoteCopyPhotoOptionsParameter.print_media_source());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.x_apf, iRemoteCopyPhotoOptionsParameter.x_apf());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.fixed_parameters, iRemoteCopyPhotoOptionsParameter.fixed_parameters());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.preferred_parameters, iRemoteCopyPhotoOptionsParameter.preferred_parameters());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.priority_order, iRemoteCopyPhotoOptionsParameter.priority_order());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.default_as_fixed, iRemoteCopyPhotoOptionsParameter.default_as_fixed());
+        ERemoteCopyPhotoOptionResult eRemoteCopyPhotoOptionResult = new ERemoteCopyPhotoOptionResult(requestCopyPhoto.getRemoteRequest().execute());
+        eRemoteCopyPhotoOptionResult.setRemoteRequestBuilder(requestCopyPhoto);
+        return eRemoteCopyPhotoOptionResult;
+    }
+
+    public ERemoteCopyPhotoOptionResult getSelectableOptions() {
+        ArrayList arrayList = new ArrayList();
+        arrayList.add(ERemoteOperation.ERemoteParam.layout);
+        arrayList.add(ERemoteOperation.ERemoteParam.print_media_size);
+        arrayList.add(ERemoteOperation.ERemoteParam.print_media_type);
+        arrayList.add(ERemoteOperation.ERemoteParam.x_apf);
+        arrayList.add(ERemoteOperation.ERemoteParam.print_quality);
+        arrayList.add(ERemoteOperation.ERemoteParam.print_media_source);
+        ERemoteOperation.ERemoteRequestBuilder requestCopyPhoto = ERemoteOperation.ERemoteRequestBuilder.requestCopyPhoto(this.hostIP, ERemoteOperation.RequestParam.get_options, getRequestConnectionTimeout());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.client_id, ERemoteOperation.ERemoteParam.x_null.string);
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.layout, ERemoteOperation.ERemoteParam.x_null);
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.print_media_type, ERemoteOperation.ERemoteParam.x_null);
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.print_media_size, ERemoteOperation.ERemoteParam.x_null);
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.print_quality, ERemoteOperation.ERemoteParam.x_null);
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.print_media_source, ERemoteOperation.ERemoteParam.x_null);
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.x_apf, ERemoteOperation.ERemoteParam.x_null);
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.fixed_parameters, (ArrayList<ERemoteOperation.ERemoteParam>) new ArrayList());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.preferred_parameters, (ArrayList<ERemoteOperation.ERemoteParam>) new ArrayList());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.priority_order, (ArrayList<ERemoteOperation.ERemoteParam>) arrayList);
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.default_as_fixed, false);
+        ERemoteCopyPhotoOptionResult eRemoteCopyPhotoOptionResult = new ERemoteCopyPhotoOptionResult(requestCopyPhoto.getRemoteRequest().execute());
+        eRemoteCopyPhotoOptionResult.setRemoteRequestBuilder(requestCopyPhoto);
+        return eRemoteCopyPhotoOptionResult;
+    }
+
+    public ERemoteCopy.ERemoteCopyStatusResult getStatus(ERemoteCopy.IRemoteCopyStatusParameter iRemoteCopyStatusParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestCopyPhoto = ERemoteOperation.ERemoteRequestBuilder.requestCopyPhoto(this.hostIP, ERemoteOperation.RequestParam.get_status, getRequestConnectionTimeout());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.client_id, iRemoteCopyStatusParameter.client_id());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.keys, iRemoteCopyStatusParameter.keys());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.job_token, iRemoteCopyStatusParameter.job_token());
+        ERemoteCopy.ERemoteCopyStatusResult eRemoteCopyStatusResult = new ERemoteCopy.ERemoteCopyStatusResult(requestCopyPhoto.getRemoteRequest().execute());
+        eRemoteCopyStatusResult.setRemoteRequestBuilder(requestCopyPhoto);
+        return eRemoteCopyStatusResult;
+    }
+
+    public ERemoteOperation.ERemoteReasonResult cancel(ERemoteCopy.IRemoteCancelParameter iRemoteCancelParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestCopyPhoto = ERemoteOperation.ERemoteRequestBuilder.requestCopyPhoto(this.hostIP, ERemoteOperation.RequestParam.cancel, getRequestConnectionTimeout());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.client_id, iRemoteCancelParameter.client_id());
+        requestCopyPhoto.add(ERemoteOperation.ERemoteParam.job_token, iRemoteCancelParameter.job_token());
+        ERemoteOperation.ERemoteReasonResult eRemoteReasonResult = new ERemoteOperation.ERemoteReasonResult(requestCopyPhoto.getRemoteRequest().execute());
+        eRemoteReasonResult.setRemoteRequestBuilder(requestCopyPhoto);
+        return eRemoteReasonResult;
+    }
+}

+ 73 - 0
app/src/main/java/epson/print/copy/Component/eremoteoperation/ERemoteDevice.java

@@ -0,0 +1,73 @@
+package epson.print.copy.Component.eremoteoperation;
+
+import epson.print.copy.Component.eremoteoperation.ERemoteOperation;
+import java.util.ArrayList;
+import org.json.JSONObject;
+
+public class ERemoteDevice extends ERemoteOperation {
+
+    public class ERemoteDeviceFunctionsResult extends ERemoteOperation.ERemoteOperationResult {
+        public ERemoteDeviceFunctionsResult(JSONObject jSONObject) {
+            super(jSONObject);
+        }
+
+        public ArrayList<ERemoteOperation.ERemoteParam> functions() {
+            return getParamsValueOf(ERemoteOperation.ERemoteParam.functions);
+        }
+    }
+
+    public class ERemoteDeviceStatusResult extends ERemoteOperation.ERemoteOperationResult {
+        public ERemoteDeviceStatusResult(JSONObject jSONObject) {
+            super(jSONObject);
+        }
+
+        public ERemoteOperation.ERemoteParam print_x_disc_tray_state() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.print_x_disc_tray_state);
+        }
+
+        public ERemoteOperation.ERemoteParam printer_state() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.printer_state);
+        }
+
+        public ArrayList<ERemoteOperation.ERemoteParam> printer_state_reasons() {
+            return getParamsValueOf(ERemoteOperation.ERemoteParam.printer_state_reasons);
+        }
+
+        public boolean document_on_adf() {
+            return getBooleanValueOf(ERemoteOperation.ERemoteParam.document_on_adf);
+        }
+
+        public ERemoteOperation.ERemoteParam scanner_state() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.scanner_state);
+        }
+
+        public ArrayList<ERemoteOperation.ERemoteParam> scanner_state_reasons() {
+            return getParamsValueOf(ERemoteOperation.ERemoteParam.scanner_state_reasons);
+        }
+    }
+
+    public ERemoteDeviceFunctionsResult getFunctions(ERemoteOperation.IRemoteOperationParameter iRemoteOperationParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestDevice = ERemoteOperation.ERemoteRequestBuilder.requestDevice(this.hostIP, ERemoteOperation.RequestParam.get_functions, getRequestConnectionTimeout());
+        requestDevice.add(ERemoteOperation.ERemoteParam.client_id, iRemoteOperationParameter.client_id());
+        ERemoteDeviceFunctionsResult eRemoteDeviceFunctionsResult = new ERemoteDeviceFunctionsResult(requestDevice.getRemoteRequest().execute());
+        eRemoteDeviceFunctionsResult.setRemoteRequestBuilder(requestDevice);
+        return eRemoteDeviceFunctionsResult;
+    }
+
+    public ERemoteDeviceStatusResult getStatus(ERemoteOperation.IRemoteStatusParameter iRemoteStatusParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestDevice = ERemoteOperation.ERemoteRequestBuilder.requestDevice(this.hostIP, ERemoteOperation.RequestParam.get_status, getRequestConnectionTimeout());
+        requestDevice.add(ERemoteOperation.ERemoteParam.client_id, iRemoteStatusParameter.client_id());
+        requestDevice.add(ERemoteOperation.ERemoteParam.keys, iRemoteStatusParameter.keys());
+        ERemoteDeviceStatusResult eRemoteDeviceStatusResult = new ERemoteDeviceStatusResult(requestDevice.getRemoteRequest().execute());
+        eRemoteDeviceStatusResult.setRemoteRequestBuilder(requestDevice);
+        return eRemoteDeviceStatusResult;
+    }
+
+    public ERemoteDeviceFunctionsResult executeGetFunctionsCommand(final String str) {
+        return getFunctions(new ERemoteOperation.IRemoteOperationParameter() {
+            public String client_id() {
+                return str;
+            }
+        });
+    }
+}

+ 655 - 0
app/src/main/java/epson/print/copy/Component/eremoteoperation/ERemoteOperation.java

@@ -0,0 +1,655 @@
+package epson.print.copy.Component.eremoteoperation;
+
+import android.util.Log;
+import com.epson.iprint.prtlogger.Analytics;
+import com.epson.mobilephone.common.wifidirect.ActivityControlWiFi;
+import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
+import epson.common.IPAddressUtils;
+import epson.common.httpclient.BasicNameValuePair;
+import epson.common.httpclient.IAHttpClient;
+import epson.print.CommonDefine;
+import java.io.ByteArrayOutputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.commons.lang.CharEncoding;
+import org.json.JSONObject;
+
+public class ERemoteOperation {
+    String hostIP;
+    int requestConnectionTimeout = ActivityControlWiFi.SCANNING_TIMEOUT;
+
+    public interface IRemoteOperationParameter {
+        String client_id();
+    }
+
+    public interface IRemoteStatusParameter extends IRemoteOperationParameter {
+        ArrayList<ERemoteParam> keys();
+    }
+
+    public void setHostIP(String str) {
+        this.hostIP = new String(str);
+    }
+
+    public String getHostIP() {
+        return this.hostIP;
+    }
+
+    public void setRequestConnectionTimeout(int i) {
+        this.requestConnectionTimeout = i;
+    }
+
+    public int getRequestConnectionTimeout() {
+        return this.requestConnectionTimeout;
+    }
+
+    public enum ERemoteParam {
+        client_id("client-id"),
+        success("success"),
+        reason("reason"),
+        illegal_combination("illegal_combination"),
+        illegal_state("illegal_state"),
+        already_finished("already_finished"),
+        unknown_token("unknown_token"),
+        busy("busy"),
+        job_token("job-token"),
+        next_document("next-document"),
+        functions("functions"),
+        keys("keys"),
+        device("device"),
+        printer(WiFiDirectManager.DEVICE_TYPE_PRINTER),
+        scanner(WiFiDirectManager.DEVICE_TYPE_SCANNER),
+        copy("copy"),
+        copy_photo("copy_photo"),
+        repeat_copy("repeat_copy"),
+        print_x_disc_tray_state("print-x-disc-tray-state"),
+        media_empty("media-empty"),
+        tray_set("tray-set"),
+        tray_missing("tray-missing"),
+        printer_state("printer-state"),
+        scanner_state("scanner-state"),
+        idle("idle"),
+        processing("processing"),
+        stopped("stopped"),
+        printer_state_reasons("printer-state-reasons"),
+        none("none"),
+        marker_supply_empty_error("marker-supply-empty-error"),
+        marker_waste_full_error("marker-waste-full-error"),
+        media_jam_error("media-jam-error"),
+        media_empty_error("media-empty-error"),
+        input_tray_missing_error("input-tray-missing-error"),
+        cover_open_error("cover-open-error"),
+        output_area_full_error("output-area-full-error"),
+        other_error("other-error"),
+        marker_supply_low_warning("marker-supply-low-warning"),
+        cover_open("cover-open"),
+        scanner_state_reasons("scanner-state-reasons"),
+        media_size_missmatch_error("media-size-missmatch-error"),
+        document_on_adf("document-on-adf"),
+        components("components"),
+        disc_tray("disc-tray"),
+        adf("adf"),
+        layout("layout"),
+        standard("standard"),
+        borderless("borderless"),
+        two_up("2-up"),
+        two_up_book("2-up-book"),
+        book_two_sided("book-two-sided"),
+        mirror("mirror"),
+        upper_half("upper-half"),
+        lower_half("lower_half"),
+        _3_up("3-up"),
+        _4_up("4-up"),
+        _9_up("9-up"),
+        _16_up("16-up"),
+        scan_sides("scan-sides"),
+        print_sides("print-sides"),
+        one_sided("one-sided"),
+        two_sided_short_edge("two-sided-short-edge"),
+        two_sided_long_edge("two-sided-long-edge"),
+        x_two_sided("x-two-sided"),
+        scan_media_size("scan-media-size"),
+        unused("unused"),
+        iso_a4_210x297mm("iso_a4_210x297mm"),
+        jis_b4_257x364mm("jis_b4_257x364mm"),
+        jis_b5_182x257mm("jis_b5_182x257mm"),
+        print_media_type("print-media-type"),
+        stationery("stationery"),
+        photographic_high_gloss("photographic-high-gloss"),
+        photographic("photographic"),
+        photographic_semi_gloss("photographic-semi-gloss"),
+        photographic_glossy("photographic-glossy"),
+        custom_media_type_epson_44("custom-media-type-epson-44"),
+        photographic_matte("photographic-matte"),
+        stationery_coated("stationery-coated"),
+        custom_media_type_epson_2a("custom-media-type-epson-2a"),
+        stationery_inkjet("stationery-inkjet"),
+        custom_media_type_epson_1b("custom-media-type-epson-1b"),
+        custom_media_type_epson_02("custom-media-type-epson-02"),
+        custom_media_type_epson_19("custom-media-type-epson-19"),
+        custom_media_type_epson_22("custom-media-type_epson-22"),
+        labels("labels"),
+        envelope("envelope"),
+        custom_media_type_epson_47("custom-media-type-epson-47"),
+        custom_media_type_epson_20("custom-media-type-epson-20"),
+        custom_media_type_epson_39("custom-media-type-epson-39"),
+        custom_media_type_epson_46("custom-media-type-epson-46"),
+        stationery_heavyweight("stationery-heavyweight"),
+        stationery_letterhead("stationery-letterhead"),
+        print_media_size("print-media-size"),
+        oe_photo_l_3_5x5in("oe_photo-l_3.5x5in"),
+        na_5x7_5x7in("na_5x7_5x7in"),
+        jpn_hagaki_100x148mm("jpn_hagaki_100x148mm"),
+        na_index_4x6_4x6in("na_index-4x6_4x6in"),
+        na_govt_letter_8x10in("na_govt-letter_8x10in"),
+        na_letter_8_5x11in("na_letter_8.5x11in"),
+        na_legal_8_5x14in("na_legal_8.5x14in"),
+        iso_a5_148x210mm("iso_a5_148x210mm"),
+        custom_4psize_254x305mm("custom_4psize_254x305mm"),
+        iso_a3_297x420mm("iso_a3_297x420mm"),
+        na_ledger_11x17in("na_ledger_11x17in"),
+        iso_a6_105x148mm("iso_a6_105x148mm"),
+        jpn_chou3_120x235mm("jpn_chou3_120x235mm"),
+        jpn_chou4_90x205mm("jpn_chou4_90x205mm"),
+        custom_epson_18_120x176mm("custom_epson-18_120x176mm"),
+        custom_epson_1A_98x148mm("custom_epson-1A_98x148mm"),
+        jpn_you4_105x235mm("jpn_you4_105x235mm"),
+        iso_c6_114x162mm("iso_c6_114x162mm"),
+        jpn_kaku2_240x332mm("jpn_kaku2_240x332mm"),
+        iso_c4_229x324mm("iso_c4_229x324mm"),
+        custom_cardsize_55x91mm("custom_cardsize_55x91mm"),
+        custom_creditcardsize_54x86mm("custom_creditcardsize_54x86mm"),
+        custom_hivision_101_6x180_6mm("custom_hivision_101.6x180.6mm"),
+        iso_dl_110x220mm("iso_dl_110x220mm"),
+        jis_b6_128x182mm("jis_b6_128x182mm"),
+        na_executive_7_25x10_5in("na_executive_7.25x10.5in"),
+        na_foolscap_8_5x13in("na_foolscap_8.5x13in"),
+        na_edp_11x14in("na_edp_11x14in"),
+        na_number_10_4_125x9_5in("na_number-10_4.125x9.5in"),
+        om_8k_270x390mm("om_8k_270x390mm"),
+        om_16k_195x270mm("om_16k_195x270mm"),
+        na_invoice_5_5x8_5in("na_invoice_5.5x8.5in"),
+        custom_epson_indianlegal_215x345mm("custom_epson-indianlegal_215x345mm"),
+        na_oficio_8_5x13_4in("na_oficio_8.5x13.4in"),
+        om_folio_sp_215x315mm("om_folio-sp_215x315mm"),
+        scan_content_type("scan-content-type"),
+        text("text"),
+        mixed("mixed"),
+        print_media_source("print-media-source"),
+        top("top"),
+        bottom("bottom"),
+        manual("manual"),
+        rear("rear"),
+        print_quality("print-quality"),
+        draft("draft"),
+        normal("normal"),
+        high("high"),
+        best("x-best"),
+        print_sheet_collate("print-sheet-collate"),
+        collated("collated"),
+        uncollated("uncollated"),
+        fixed_parameters("fixed-parameters"),
+        preferred_parameters("preferred-parameters"),
+        priority_order("priority-order"),
+        default_as_fixed("default-as-fixed"),
+        frame("frame"),
+        oval("oval"),
+        oval_soft_edge("oval-soft-edge"),
+        copies("copies"),
+        color_effects_type("color-effects-type"),
+        color("color"),
+        monochrome_grayscale("monochrome-grayscale"),
+        copy_magnification("copy-magnification"),
+        auto("auto"),
+        x_density("x-density"),
+        print_x_bleed("print-x-bleed"),
+        midium("midium"),
+        minimum("minimum"),
+        orientation("orientation"),
+        portrait("portrait"),
+        landscape("landscape"),
+        print_x_dry_time("print-x-dry-time"),
+        Long("long"),
+        longer("longer"),
+        print_x_auto_pg("print-x-auto-pg"),
+        on("on"),
+        off("off"),
+        job_state("job-state"),
+        nextpaper("nextpaper"),
+        scanning("scanning"),
+        printing("printing"),
+        copying("copying"),
+        canceling("canceling"),
+        finished("finished"),
+        pending("pending"),
+        pending_for_template("pending-for-template"),
+        waiting_image_for_template("waiting-image-for-template"),
+        printing_template("printing-template"),
+        waiting_image("waiting-image"),
+        waiting_template("waiting-template"),
+        job_result("job-result"),
+        canceled("canceled"),
+        memory_full("memory_full"),
+        remove_adf_paper("remove_adf_paper"),
+        set_adf_paper("set_adf_paper"),
+        document_error("document_error"),
+        image_too_large("image-too-large"),
+        communication_error("communication-error"),
+        job_tokens("job-tokens"),
+        job_print_total_pages("job-print-total-pages"),
+        job_print_current_pages("job-print-current-pages"),
+        job_image_post_url("job-image-post-url"),
+        x_apf("x-apf"),
+        x_color_restoration("x-color-restoration"),
+        scan_count("scan-count"),
+        scan_area_x("scan-area-x"),
+        scan_area_y("scan-area-y"),
+        scan_area_width("scan-area-width"),
+        scan_area_height("scan-area-height"),
+        scan_area_resolution("scan-area-resolution"),
+        x_fit_gamma("x-fit-gamma"),
+        x_fit_matrix("x-fit-matrix"),
+        x_scale("x-scale"),
+        x_scale_fullsize("x-scale-fullsize"),
+        x_scale_custom("x-scale-custom"),
+        x_scale_autofit("x-scale-autofit"),
+        x_scale_a4_to_postcard("x-scale-a4-to-postcard"),
+        x_scale_2l_to_postcard("x-scale-2l-to-postcard"),
+        x_scale_l_to_postcard("x-scale-l-to-postcard"),
+        x_scale_l_to_2l("x-scale-l-to-2l"),
+        x_scale_2l_to_a4("x-scale-2l-to-a4"),
+        x_scale_postcard_to_a4("x-scale-postcard-to-a4"),
+        x_scale_l_to_a4("x-scale-l-to-a4"),
+        x_scale_a4_to_b5("x-scale-a4-to-b5"),
+        x_scale_b5_to_a4("x-scale-b5-to-a4"),
+        x_scale_letter_to_kg("x-scale-letter-to-kg"),
+        x_scale_kg_to_letter("x-scale-kg-to-letter"),
+        x_scale_letter_to_2l("x-scale-letter-to-2l"),
+        x_scale_2l_to_letter("x-scale-2l-to-letter"),
+        x_scale_kg_to_a4("x-scale-kg-to-a4"),
+        x_scale_a4_to_kg("x-scale-a4-to-kg"),
+        x_scale_a4_to_2l("x-scale-a4-to-2l"),
+        x_scale_kg_to_8x10("x-scale-kg-to-8x10"),
+        x_scale_8x10_to_2l("x-scale-8x10-to-2l"),
+        x_scale_legal_to_letter("x-scale-legal-to-letter"),
+        x_scale_2l_to_kg("x-scale-2l-to-kg"),
+        x_scale_kg_to_2l("x-scale-kg-to-2l"),
+        x_scale_a5_to_a4("x-scale-a5-to-a4"),
+        x_scale_a4_to_a5("x-scale-a4-to-a5"),
+        x_scale_a4_to_a3("x-scale-a4-to-a3"),
+        x_scale_letter_to_11x17("x-scale-letter-to-11x17"),
+        x_borderless("layout"),
+        x_null(""),
+        x_failed_communication("x-failed-communication"),
+        x_unknown("x-unknown"),
+        x_invalid_photo_setting("x-invalid-photo-setting");
+        
+        public String string;
+
+        private ERemoteParam(String str) {
+            this.string = str;
+        }
+
+        public static ERemoteParam stringOf(String str) {
+            for (ERemoteParam eRemoteParam : values()) {
+                if (eRemoteParam.string.compareTo(str) == 0) {
+                    return eRemoteParam;
+                }
+            }
+            return x_null;
+        }
+
+        public String toString() {
+            return this.string;
+        }
+    }
+
+    enum RequestParam {
+        remote_operation("remote_operation"),
+        v1("v1"),
+        HTTP(Analytics.EXTENSION_STRING_WEB),
+        Content_Type("application/x-www-form-urlencoded"),
+        User_Agent("Mozilla/5.0"),
+        device("device"),
+        printer(WiFiDirectManager.DEVICE_TYPE_PRINTER),
+        scanner(WiFiDirectManager.DEVICE_TYPE_SCANNER),
+        copy("copy"),
+        copy_photo("copy_photo"),
+        combo("combo"),
+        get_functions("get_functions"),
+        get_status("get_status"),
+        get_components("get_components"),
+        get_options("get_options"),
+        clear_error("clear_error"),
+        cancel("cancel"),
+        document_changed("document_changed");
+        
+        public String string;
+
+        private RequestParam(String str) {
+            this.string = str;
+        }
+    }
+
+    public static class ERemoteOperationResult {
+        JSONObject json;
+        ERemoteRequestBuilder request;
+
+        static JSONObject parseResponse(IAHttpClient.HttpResponse httpResponse) {
+            JSONObject jSONObject = new JSONObject();
+            try {
+                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+                httpResponse.getEntity().writeTo(byteArrayOutputStream);
+                Log.d("ERequest C", byteArrayOutputStream.toString());
+                return new JSONObject(byteArrayOutputStream.toString());
+            } catch (Exception e) {
+                e.printStackTrace();
+                return jSONObject;
+            }
+        }
+
+        public ERemoteOperationResult(JSONObject jSONObject) {
+            this.json = jSONObject;
+        }
+
+        public String toString() {
+            return this.json.toString();
+        }
+
+        public boolean isNull(ERemoteParam eRemoteParam) {
+            return this.json.isNull(eRemoteParam.string);
+        }
+
+        public void setRemoteRequestBuilder(ERemoteRequestBuilder eRemoteRequestBuilder) {
+            this.request = eRemoteRequestBuilder;
+        }
+
+        public boolean success() {
+            try {
+                return this.json.getBoolean(ERemoteParam.success.string);
+            } catch (Exception e) {
+                e.printStackTrace();
+                return false;
+            }
+        }
+
+        /* access modifiers changed from: package-private */
+        public boolean getBooleanValueOf(ERemoteParam eRemoteParam) {
+            try {
+                return this.json.getBoolean(eRemoteParam.string);
+            } catch (Exception e) {
+                e.printStackTrace();
+                return false;
+            }
+        }
+
+        /* access modifiers changed from: package-private */
+        public int getIntValueOf(ERemoteParam eRemoteParam) {
+            try {
+                return this.json.getInt(eRemoteParam.string);
+            } catch (Exception e) {
+                e.printStackTrace();
+                return 0;
+            }
+        }
+
+        /* access modifiers changed from: package-private */
+        public String getStringValueOf(ERemoteParam eRemoteParam) {
+            try {
+                return this.json.getString(eRemoteParam.string);
+            } catch (Exception e) {
+                e.printStackTrace();
+                return "";
+            }
+        }
+
+        /* access modifiers changed from: package-private */
+        public ArrayList<String> getStringsValueOf(ERemoteParam eRemoteParam) {
+            ArrayList<String> arrayList = new ArrayList<>();
+            try {
+                for (String trim : this.json.getString(eRemoteParam.string).split(PreferencesConstants.COOKIE_DELIMITER)) {
+                    arrayList.add(trim.trim());
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            return arrayList;
+        }
+
+        /* access modifiers changed from: package-private */
+        public ERemoteParam getParamValueOf(ERemoteParam eRemoteParam) {
+            ERemoteParam eRemoteParam2 = ERemoteParam.x_null;
+            try {
+                return ERemoteParam.stringOf(this.json.getString(eRemoteParam.string));
+            } catch (Exception e) {
+                e.printStackTrace();
+                return eRemoteParam2;
+            }
+        }
+
+        /* access modifiers changed from: package-private */
+        public ERemoteParam getDefaultValueOf(ERemoteParam eRemoteParam) {
+            ERemoteParam eRemoteParam2 = ERemoteParam.x_null;
+            try {
+                JSONObject jSONObject = this.json;
+                return ERemoteParam.stringOf(jSONObject.getString(eRemoteParam.string + "-default"));
+            } catch (Exception e) {
+                e.printStackTrace();
+                return eRemoteParam2;
+            }
+        }
+
+        /* access modifiers changed from: package-private */
+        public ArrayList<ERemoteParam> getOptionsValueOf(ERemoteParam eRemoteParam) {
+            ArrayList<ERemoteParam> arrayList = new ArrayList<>();
+            try {
+                for (String trim : this.json.getString(eRemoteParam.string + "-options").split(PreferencesConstants.COOKIE_DELIMITER)) {
+                    ERemoteParam stringOf = ERemoteParam.stringOf(trim.trim());
+                    if (stringOf != ERemoteParam.x_null) {
+                        arrayList.add(stringOf);
+                    }
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            return arrayList;
+        }
+
+        /* access modifiers changed from: package-private */
+        public ArrayList<ERemoteParam> getParamsValueOf(ERemoteParam eRemoteParam) {
+            ArrayList<ERemoteParam> arrayList = new ArrayList<>();
+            try {
+                for (String trim : getStringValueOf(eRemoteParam).split(PreferencesConstants.COOKIE_DELIMITER)) {
+                    arrayList.add(ERemoteParam.stringOf(trim.trim()));
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            return arrayList;
+        }
+    }
+
+    public class ERemoteReasonResult extends ERemoteOperationResult {
+        public ERemoteReasonResult(JSONObject jSONObject) {
+            super(jSONObject);
+        }
+
+        public ERemoteParam reason() {
+            return getParamValueOf(ERemoteParam.reason);
+        }
+    }
+
+    class ERemoteRequest {
+        IAHttpClient.HttpPost request;
+        int timeout;
+
+        public ERemoteRequest(String str, ArrayList<BasicNameValuePair> arrayList, int i) {
+            try {
+                this.request = new IAHttpClient.HttpPost(str);
+                this.request.setContentEncoding(CharEncoding.UTF_8);
+                this.request.setContentType(RequestParam.Content_Type.string);
+                this.request.setEntity(IAHttpClient.HttpPost.getUrlEncodedFormEntity(arrayList, CharEncoding.UTF_8));
+                this.timeout = i;
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+            }
+        }
+
+        public JSONObject execute() {
+            try {
+                Log.d("ERequest A", this.request.getURI().toString());
+                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+                this.request.getEntity().writeTo(byteArrayOutputStream);
+                Log.d("ERequest B", byteArrayOutputStream.toString());
+                IAHttpClient iAHttpClient = new IAHttpClient();
+                iAHttpClient.setConnectionTimeout(this.timeout);
+                iAHttpClient.setSoTimeout(this.timeout);
+                return ERemoteOperationResult.parseResponse(iAHttpClient.execute(this.request));
+            } catch (Exception e) {
+                e.printStackTrace();
+                return new JSONObject();
+            }
+        }
+    }
+
+    static class ERemoteRequestBuilder extends ERemoteOperation {
+        RequestParam command;
+        ArrayList<BasicNameValuePair> messageBody = new ArrayList<>();
+        RequestParam operation;
+        HashMap<ERemoteParam, Object> remoteParam;
+        StringBuffer requestURI;
+        int timeout;
+        RequestParam version;
+
+        public interface VariantValueConverter {
+            ERemoteParam convertValue(int i);
+        }
+
+        ERemoteRequestBuilder(String str, RequestParam requestParam, RequestParam requestParam2, RequestParam requestParam3, int i) {
+            this.operation = requestParam;
+            this.version = requestParam2;
+            this.command = requestParam3;
+            this.timeout = i;
+            StringBuffer stringBuffer = new StringBuffer();
+            stringBuffer.append(CommonDefine.SLASH);
+            stringBuffer.append(RequestParam.remote_operation.string);
+            stringBuffer.append(CommonDefine.SLASH);
+            stringBuffer.append(requestParam2.string);
+            stringBuffer.append(CommonDefine.SLASH);
+            stringBuffer.append(requestParam.string);
+            stringBuffer.append(CommonDefine.SLASH);
+            stringBuffer.append(requestParam3.string);
+            this.requestURI = new StringBuffer(IPAddressUtils.buildURL(RequestParam.HTTP.string, str, stringBuffer.toString()));
+            this.remoteParam = new HashMap<>();
+        }
+
+        /* access modifiers changed from: package-private */
+        public void deleteLastCharIf(StringBuffer stringBuffer, char c) {
+            if (stringBuffer.length() > 0) {
+                int length = stringBuffer.length() - 1;
+                if (stringBuffer.charAt(length) == c) {
+                    stringBuffer.deleteCharAt(length);
+                }
+            }
+        }
+
+        public static ERemoteRequestBuilder requestDevice(String str, RequestParam requestParam, int i) {
+            return new ERemoteRequestBuilder(str, RequestParam.device, RequestParam.v1, requestParam, i);
+        }
+
+        public static ERemoteRequestBuilder requestPrinter(String str, RequestParam requestParam, int i) {
+            return new ERemoteRequestBuilder(str, RequestParam.printer, RequestParam.v1, requestParam, i);
+        }
+
+        public static ERemoteRequestBuilder requestScanner(String str, RequestParam requestParam, int i) {
+            return new ERemoteRequestBuilder(str, RequestParam.scanner, RequestParam.v1, requestParam, i);
+        }
+
+        public static ERemoteRequestBuilder requestCopy(String str, RequestParam requestParam, int i) {
+            return new ERemoteRequestBuilder(str, RequestParam.copy, RequestParam.v1, requestParam, i);
+        }
+
+        public static ERemoteRequestBuilder requestCopyPhoto(String str, RequestParam requestParam, int i) {
+            return new ERemoteRequestBuilder(str, RequestParam.copy_photo, RequestParam.v1, requestParam, i);
+        }
+
+        public static ERemoteRequestBuilder requestCombo(String str, RequestParam requestParam, int i) {
+            return new ERemoteRequestBuilder(str, RequestParam.combo, RequestParam.v1, requestParam, i);
+        }
+
+        public void add(ERemoteParam eRemoteParam, boolean z) {
+            this.remoteParam.put(eRemoteParam, new Boolean(z));
+            this.messageBody.add(new BasicNameValuePair(eRemoteParam.string, String.valueOf(z)));
+        }
+
+        public void add(ERemoteParam eRemoteParam, int i) {
+            this.remoteParam.put(eRemoteParam, new Integer(i));
+            this.messageBody.add(new BasicNameValuePair(eRemoteParam.string, String.valueOf(i)));
+        }
+
+        public void add(ERemoteParam eRemoteParam, int[] iArr) {
+            this.remoteParam.put(eRemoteParam, Arrays.asList(new int[][]{iArr}));
+            StringBuffer stringBuffer = new StringBuffer();
+            for (int append : iArr) {
+                stringBuffer.append(append);
+                stringBuffer.append(PreferencesConstants.COOKIE_DELIMITER);
+            }
+            deleteLastCharIf(stringBuffer, ',');
+            this.messageBody.add(new BasicNameValuePair(eRemoteParam.string, String.valueOf(stringBuffer)));
+        }
+
+        public void add(ERemoteParam eRemoteParam, String str) {
+            if (!str.equals(ERemoteParam.x_null.string)) {
+                this.remoteParam.put(eRemoteParam, str);
+                this.messageBody.add(new BasicNameValuePair(eRemoteParam.string, str));
+            }
+        }
+
+        public void add(ERemoteParam eRemoteParam, int i, VariantValueConverter variantValueConverter) {
+            String valueOf = String.valueOf(i);
+            ERemoteParam convertValue = variantValueConverter.convertValue(i);
+            if (convertValue != null) {
+                valueOf = convertValue.string;
+            }
+            this.remoteParam.put(eRemoteParam, valueOf);
+            this.messageBody.add(new BasicNameValuePair(eRemoteParam.string, valueOf));
+        }
+
+        public void add(ERemoteParam eRemoteParam, ERemoteParam eRemoteParam2) {
+            if (eRemoteParam2 != ERemoteParam.x_null) {
+                this.remoteParam.put(eRemoteParam, eRemoteParam2);
+                this.messageBody.add(new BasicNameValuePair(eRemoteParam.string, eRemoteParam2.string));
+            }
+        }
+
+        public void add(ERemoteParam eRemoteParam, ArrayList<ERemoteParam> arrayList) {
+            this.remoteParam.put(eRemoteParam, arrayList);
+            StringBuffer stringBuffer = new StringBuffer();
+            Iterator<ERemoteParam> it = arrayList.iterator();
+            while (it.hasNext()) {
+                stringBuffer.append(it.next().string);
+                stringBuffer.append(PreferencesConstants.COOKIE_DELIMITER);
+            }
+            deleteLastCharIf(stringBuffer, ',');
+            this.messageBody.add(new BasicNameValuePair(eRemoteParam.string, String.valueOf(stringBuffer)));
+        }
+
+        public void add(ERemoteParam eRemoteParam, List<String> list) {
+            this.remoteParam.put(eRemoteParam, list);
+            StringBuffer stringBuffer = new StringBuffer();
+            for (String append : list) {
+                stringBuffer.append(append);
+                stringBuffer.append(PreferencesConstants.COOKIE_DELIMITER);
+            }
+            deleteLastCharIf(stringBuffer, ',');
+            this.messageBody.add(new BasicNameValuePair(eRemoteParam.string, String.valueOf(stringBuffer)));
+        }
+
+        public ERemoteRequest getRemoteRequest() {
+            return new ERemoteRequest(this.requestURI.toString(), this.messageBody, this.timeout);
+        }
+    }
+}

+ 59 - 0
app/src/main/java/epson/print/copy/Component/eremoteoperation/ERemotePrinter.java

@@ -0,0 +1,59 @@
+package epson.print.copy.Component.eremoteoperation;
+
+import epson.print.copy.Component.eremoteoperation.ERemoteOperation;
+import java.util.ArrayList;
+import org.json.JSONObject;
+
+public class ERemotePrinter extends ERemoteOperation {
+
+    public class ERemotePrinterComponentsResult extends ERemoteOperation.ERemoteOperationResult {
+        public ERemotePrinterComponentsResult(JSONObject jSONObject) {
+            super(jSONObject);
+        }
+
+        public ArrayList<ERemoteOperation.ERemoteParam> components() {
+            return getParamsValueOf(ERemoteOperation.ERemoteParam.components);
+        }
+    }
+
+    public class ERemotePrinterStatusResult extends ERemoteOperation.ERemoteOperationResult {
+        public ERemotePrinterStatusResult(JSONObject jSONObject) {
+            super(jSONObject);
+        }
+
+        public ERemoteOperation.ERemoteParam print_x_disc_try_state() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.print_x_disc_tray_state);
+        }
+
+        public ERemoteOperation.ERemoteParam printer_state() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.printer_state);
+        }
+
+        public ArrayList<ERemoteOperation.ERemoteParam> printer_state_reasons() {
+            return getParamsValueOf(ERemoteOperation.ERemoteParam.printer_state_reasons);
+        }
+    }
+
+    public ERemotePrinterComponentsResult getComponents(ERemoteOperation.IRemoteOperationParameter iRemoteOperationParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestPrinter = ERemoteOperation.ERemoteRequestBuilder.requestPrinter(this.hostIP, ERemoteOperation.RequestParam.get_components, getRequestConnectionTimeout());
+        requestPrinter.add(ERemoteOperation.ERemoteParam.client_id, iRemoteOperationParameter.client_id());
+        return new ERemotePrinterComponentsResult(requestPrinter.getRemoteRequest().execute());
+    }
+
+    public ERemotePrinterStatusResult getStatus(ERemoteOperation.IRemoteStatusParameter iRemoteStatusParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestPrinter = ERemoteOperation.ERemoteRequestBuilder.requestPrinter(this.hostIP, ERemoteOperation.RequestParam.get_status, getRequestConnectionTimeout());
+        requestPrinter.add(ERemoteOperation.ERemoteParam.client_id, iRemoteStatusParameter.client_id());
+        requestPrinter.add(ERemoteOperation.ERemoteParam.keys, iRemoteStatusParameter.keys());
+        ERemotePrinterStatusResult eRemotePrinterStatusResult = new ERemotePrinterStatusResult(requestPrinter.getRemoteRequest().execute());
+        eRemotePrinterStatusResult.setRemoteRequestBuilder(requestPrinter);
+        return eRemotePrinterStatusResult;
+    }
+
+    public ERemoteOperation.ERemoteOperationResult clearError(ERemoteOperation.IRemoteOperationParameter iRemoteOperationParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestPrinter = ERemoteOperation.ERemoteRequestBuilder.requestPrinter(this.hostIP, ERemoteOperation.RequestParam.clear_error, getRequestConnectionTimeout());
+        requestPrinter.add(ERemoteOperation.ERemoteParam.client_id, iRemoteOperationParameter.client_id());
+        ERemotePrinterStatusResult eRemotePrinterStatusResult = new ERemotePrinterStatusResult(requestPrinter.getRemoteRequest().execute());
+        eRemotePrinterStatusResult.setRemoteRequestBuilder(requestPrinter);
+        return eRemotePrinterStatusResult;
+    }
+}

+ 60 - 0
app/src/main/java/epson/print/copy/Component/eremoteoperation/ERemoteScanner.java

@@ -0,0 +1,60 @@
+package epson.print.copy.Component.eremoteoperation;
+
+import epson.print.copy.Component.eremoteoperation.ERemoteOperation;
+import java.util.ArrayList;
+import org.json.JSONObject;
+
+public class ERemoteScanner extends ERemoteOperation {
+
+    public class ERemoteScannerComponentsResult extends ERemoteOperation.ERemoteOperationResult {
+        public ERemoteScannerComponentsResult(JSONObject jSONObject) {
+            super(jSONObject);
+        }
+
+        public ArrayList<ERemoteOperation.ERemoteParam> components() {
+            return getParamsValueOf(ERemoteOperation.ERemoteParam.components);
+        }
+    }
+
+    public class ERemoteScannerStatusResult extends ERemoteOperation.ERemoteOperationResult {
+        public ERemoteScannerStatusResult(JSONObject jSONObject) {
+            super(jSONObject);
+        }
+
+        public boolean document_on_adf() {
+            return getBooleanValueOf(ERemoteOperation.ERemoteParam.document_on_adf);
+        }
+
+        public ERemoteOperation.ERemoteParam scanner_state() {
+            return getParamValueOf(ERemoteOperation.ERemoteParam.scanner_state);
+        }
+
+        public ArrayList<ERemoteOperation.ERemoteParam> scanner_state_reasons() {
+            return getParamsValueOf(ERemoteOperation.ERemoteParam.scanner_state_reasons);
+        }
+    }
+
+    public ERemoteScannerComponentsResult getComponents(ERemoteOperation.IRemoteOperationParameter iRemoteOperationParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestScanner = ERemoteOperation.ERemoteRequestBuilder.requestScanner(this.hostIP, ERemoteOperation.RequestParam.get_components, getRequestConnectionTimeout());
+        requestScanner.add(ERemoteOperation.ERemoteParam.client_id, iRemoteOperationParameter.client_id());
+        ERemoteScannerComponentsResult eRemoteScannerComponentsResult = new ERemoteScannerComponentsResult(requestScanner.getRemoteRequest().execute());
+        eRemoteScannerComponentsResult.setRemoteRequestBuilder(requestScanner);
+        return eRemoteScannerComponentsResult;
+    }
+
+    public ERemoteScannerStatusResult getStatus(ERemoteOperation.IRemoteStatusParameter iRemoteStatusParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestScanner = ERemoteOperation.ERemoteRequestBuilder.requestScanner(this.hostIP, ERemoteOperation.RequestParam.get_status, getRequestConnectionTimeout());
+        requestScanner.add(ERemoteOperation.ERemoteParam.keys, iRemoteStatusParameter.keys());
+        ERemoteScannerStatusResult eRemoteScannerStatusResult = new ERemoteScannerStatusResult(requestScanner.getRemoteRequest().execute());
+        eRemoteScannerStatusResult.setRemoteRequestBuilder(requestScanner);
+        return eRemoteScannerStatusResult;
+    }
+
+    public ERemoteOperation.ERemoteOperationResult clearError(ERemoteOperation.IRemoteOperationParameter iRemoteOperationParameter) {
+        ERemoteOperation.ERemoteRequestBuilder requestScanner = ERemoteOperation.ERemoteRequestBuilder.requestScanner(this.hostIP, ERemoteOperation.RequestParam.clear_error, getRequestConnectionTimeout());
+        requestScanner.add(ERemoteOperation.ERemoteParam.client_id, iRemoteOperationParameter.client_id());
+        ERemoteOperation.ERemoteOperationResult eRemoteOperationResult = new ERemoteOperation.ERemoteOperationResult(requestScanner.getRemoteRequest().execute());
+        eRemoteOperationResult.setRemoteRequestBuilder(requestScanner);
+        return eRemoteOperationResult;
+    }
+}

+ 10 - 0
app/src/main/java/epson/print/copy/Component/escandevice/EScanDevice.java

@@ -0,0 +1,10 @@
+package epson.print.copy.Component.escandevice;
+
+public class EScanDevice {
+    public static native int nativeStartScan(IScanController iScanController);
+
+    static {
+        System.loadLibrary("scandocdtct");
+        System.loadLibrary("escandevice");
+    }
+}

+ 47 - 0
app/src/main/java/epson/print/copy/Component/escandevice/IScanController.java

@@ -0,0 +1,47 @@
+package epson.print.copy.Component.escandevice;
+
+public interface IScanController {
+    public static final int CPPREV_KEY_SCANNER_IP = 4;
+    public static final int CPPREV_KEY_SCAN_COLORTYPE = 1;
+    public static final int CPPREV_KEY_SCAN_COPYFRAME = 3;
+    public static final int CPPREV_KEY_SCAN_RESO = 2;
+    public static final int CPPREV_STATUS_ERROR_CANCELED = 1;
+    public static final int CPPREV_STATUS_ERROR_DOCDTCT = 5;
+    public static final int CPPREV_STATUS_ERROR_IMGCRCT = 6;
+    public static final int CPPREV_STATUS_ERROR_NONE = 0;
+    public static final int CPPREV_STATUS_ERROR_SCANNER_BUSY = 3;
+    public static final int CPPREV_STATUS_ERROR_SCANNER_COMMUNICATION = 7;
+    public static final int CPPREV_STATUS_ERROR_SCANNER_GENERAL = 2;
+    public static final int CPPREV_STATUS_ERROR_SCANNER_OTHERS = 4;
+    public static final int CPPREV_STATUS_PAGE_ENDED = 4;
+    public static final int CPPREV_STATUS_PAGE_STARTED = 3;
+    public static final int CPPREV_STATUS_SCAN_FINISHED = 2;
+    public static final int CPPREV_STATUS_SCAN_STARTED = 1;
+    public static final int CPPREV_VALUE_SCAN_COLORTYPE_COLOR = 65536;
+    public static final int CPPREV_VALUE_SCAN_COLORTYPE_GRAYSCALE = 65537;
+    public static final int CPPREV_VALUE_SCAN_COPYFRAME_2L = 196612;
+    public static final int CPPREV_VALUE_SCAN_COPYFRAME_6GIRI = 196615;
+    public static final int CPPREV_VALUE_SCAN_COPYFRAME_A4 = 196609;
+    public static final int CPPREV_VALUE_SCAN_COPYFRAME_AUTOFIT = 196608;
+    public static final int CPPREV_VALUE_SCAN_COPYFRAME_B5 = 196610;
+    public static final int CPPREV_VALUE_SCAN_COPYFRAME_CD = 196616;
+    public static final int CPPREV_VALUE_SCAN_COPYFRAME_HAGAKI = 196613;
+    public static final int CPPREV_VALUE_SCAN_COPYFRAME_KG = 196614;
+    public static final int CPPREV_VALUE_SCAN_COPYFRAME_L = 196611;
+    public static final int CPPREV_VALUE_SCAN_RESO_PREVIEW = 131073;
+    public static final int CPPREV_VALUE_SCAN_RESO_PREVIEW_LOW = 131072;
+
+    int getIntegerValue(int i);
+
+    String getStringValue(int i);
+
+    boolean isCancelRequested();
+
+    void setCopyFrameSize(int i, int i2, int i3, int i4);
+
+    void setScanImageBlockReceived(int[] iArr, int i, int i2, int i3, int i4);
+
+    void setScanImageSize(int i, int i2);
+
+    void setScanStatusChanged(int i, int i2);
+}

+ 642 - 0
app/src/main/java/epson/print/copy/CopyActivity.java

@@ -0,0 +1,642 @@
+package epson.print.copy;
+
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.content.res.TypedArray;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.os.SystemClock;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.CompoundButton;
+import android.widget.ImageView;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
+import android.widget.TextView;
+import com.epson.mobilephone.common.maintain2.MaintainPrinter2;
+import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
+import epson.common.Utils;
+import epson.print.R;
+import epson.print.MyPrinter;
+import epson.print.Util.EPLog;
+import epson.print.copy.ActivityBase;
+import epson.print.copy.Component.ecopycomponent.ECopyComponent;
+import epson.print.copy.Component.ecopycomponent.ECopyOptionContext;
+import epson.print.copy.Component.ecopycomponent.ECopyOptionItem;
+import epson.print.copy.Component.eremoteoperation.ERemoteDevice;
+import epson.print.copy.Component.eremoteoperation.ERemoteOperation;
+import epson.print.widgets.LongTapRepeatAdapter;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Locale;
+
+public class CopyActivity extends ActivityBase implements View.OnClickListener {
+    private static final int CONNECTION_TIMEOUT = 30000;
+    private static final int EPS_COMM_BID = 2;
+    private static final int REQUEST_CODE_REPEAT_COPY = 12;
+    private final int COMM_ERROR = 1;
+    private final int PROBE_PRINTER = 0;
+    /* access modifiers changed from: private */
+    public String TAG = "CopyActivty";
+    private final int UPDATE_SETTING = 2;
+    boolean bProbedPrinter = false;
+    /* access modifiers changed from: private */
+    public int clearindex = 0;
+    CopyProcess copyProcess;
+    /* access modifiers changed from: private */
+    public boolean doClear = false;
+    /* access modifiers changed from: private */
+    public ActivityBase.errorDialog errordialog;
+    /* access modifiers changed from: private */
+    public String ipAdress;
+    private RadioGroup mCopyTypeGroup;
+    Handler mHandler = new Handler(new Handler.Callback() {
+        public boolean handleMessage(Message message) {
+            EPLog.m313i(CopyActivity.this.TAG, "HandlerCallback");
+            switch (message.what) {
+                case 0:
+                    EPLog.m313i(CopyActivity.this.TAG, "PROBE_PRINTER");
+                    CopyActivity copyActivity = CopyActivity.this;
+                    ProbePrinter unused = copyActivity.task = new ProbePrinter();
+                    CopyActivity.this.task.execute(new Void[0]);
+                    return true;
+                case 1:
+                    EPLog.m313i(CopyActivity.this.TAG, "COMM_ERROR");
+                    CopyActivity copyActivity2 = CopyActivity.this;
+                    ActivityBase.errorDialog unused2 = copyActivity2.errordialog = new ActivityBase.errorDialog(copyActivity2);
+                    CopyActivity.this.errordialog.showErrorDialog(CopyActivity.this.getString(R.string.EPS_PRNERR_COMM_TITLE), CopyActivity.this.getString(R.string.EPS_PRNERR_COMM5), ActivityBase.DialogButtons.Ok, new ActivityBase.IClose() {
+                        public void onClose(ActivityBase.ClickButton clickButton) {
+                            CopyActivity.this.finish();
+                        }
+                    });
+                    return true;
+                case 2:
+                    EPLog.m313i(CopyActivity.this.TAG, "UPDATE_SETTING");
+                    if (CopyActivity.this.optionContext == null) {
+                        CopyActivity.this.fetchCopyOptionContext();
+                        return true;
+                    }
+                    CopyActivity copyActivity3 = CopyActivity.this;
+                    copyActivity3.optionContext = copyActivity3.copyComponent.getBindedCopyOptionContext();
+                    CopyActivity.this.copyComponent.bindCopyOptionContext(CopyActivity.this.optionContext, CopyActivity.this.optionListener);
+                    CopyActivity copyActivity4 = CopyActivity.this;
+                    copyActivity4.buildCopyOptions(copyActivity4.copyComponent.getCopyOptionItems());
+                    return true;
+                default:
+                    return true;
+            }
+        }
+    });
+    private ViewGroup mLayout;
+    private RadioButton mNormalCopyButton;
+    /* access modifiers changed from: private */
+    public MaintainPrinter2 mPrinter;
+    private RadioButton mRepeatCopyButton;
+    ECopyComponent.ICopyOptionListener optionListener;
+    ActivityBase.OptionItemChangedListener optionValueChangedListener;
+    /* access modifiers changed from: private */
+    public ActivityBase.settingPreference presettings = new ActivityBase.settingPreference();
+    /* access modifiers changed from: private */
+    public int printerLocation;
+    ECopyComponent.ICopySystemSettings systemSettings;
+    /* access modifiers changed from: private */
+    public ProbePrinter task;
+
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        this.copyComponent.getRemoteOperationUUID(this);
+        this.optionContext = null;
+        this.mLayout = (ViewGroup) getLayoutInflater().inflate(R.layout.copy, (ViewGroup) null);
+        setContentView((View) this.mLayout);
+        setupUi();
+        setActionBar((int) R.string.FunctionName_iPrint_Copy, true);
+        if (this.mPrinter == null) {
+            this.mPrinter = MaintainPrinter2.getInstance();
+        }
+        this.optionValueChangedListener = new ActivityBase.OptionItemChangedListener() {
+            public void onOptionItemChanged(ECopyOptionItem eCopyOptionItem) {
+                CopyActivity.this.copyComponent.setCopyOptionItem(eCopyOptionItem);
+            }
+        };
+        this.optionListener = new ECopyComponent.ICopyOptionListener() {
+            public void onCopyOptionChanged(ECopyOptionItem eCopyOptionItem, ArrayList<ECopyOptionItem> arrayList, ECopyComponent.ICopyOptionListener.CopyOptionChangedError copyOptionChangedError) {
+                if (copyOptionChangedError != null) {
+                    CopyActivity.this.loading.dismiss();
+                    CopyActivity copyActivity = CopyActivity.this;
+                    ActivityBase.errorDialog errordialog = new ActivityBase.errorDialog(copyActivity);
+                    String[] reasonText = errordialog.getReasonText(copyOptionChangedError);
+                    errordialog.showErrorDialog(reasonText[0], reasonText[1]);
+                    return;
+                }
+                ArrayList arrayList2 = new ArrayList();
+                if (CopyActivity.this.doClear) {
+                    if (CopyActivity.this.clearindex != CopyActivity.this.copyComponent.getCopyOptionItems().size()) {
+                        CopyActivity.this.allClear();
+                        return;
+                    }
+                    boolean unused = CopyActivity.this.doClear = false;
+                    int unused2 = CopyActivity.this.clearindex = 0;
+                    arrayList2.addAll(CopyActivity.this.copyComponent.getCopyOptionItems());
+                }
+                arrayList2.add(eCopyOptionItem);
+                if (arrayList != null) {
+                    arrayList2.addAll(arrayList);
+                }
+                CopyActivity.this.buildCopyOptions(arrayList2);
+            }
+        };
+    }
+
+    public void onResume() {
+        EPLog.m316v(this.TAG, "onResume()");
+        super.onResume();
+        this.isKeepSimpleAPConnection = false;
+        getPrinterInfo();
+        CopyProcess copyProcess2 = this.copyProcess;
+        if (copyProcess2 == null || !copyProcess2.isProccessing()) {
+            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.isKeepSimpleAPConnection = true;
+                    this.bProbedPrinter = false;
+                    return;
+                }
+            }
+            this.loading.show();
+            if (!this.bProbedPrinter) {
+                this.mHandler.sendEmptyMessage(0);
+            } else {
+                this.mHandler.sendEmptyMessage(2);
+            }
+        } else {
+            this.copyProcess.setDisconnectWifi(false);
+        }
+    }
+
+    public void onPause() {
+        EPLog.m316v(this.TAG, "onPause()");
+        super.onPause();
+        int i = this.printerLocation;
+        if (i == 1 || i == 3) {
+            ProbePrinter probePrinter = this.task;
+            if (probePrinter != null) {
+                probePrinter.cancel(true);
+            }
+            CopyProcess copyProcess2 = this.copyProcess;
+            if (copyProcess2 != null && copyProcess2.isProccessing()) {
+                this.copyProcess.setDisconnectWifi(true);
+            } else if (!this.isKeepSimpleAPConnection) {
+                WiFiDirectManager.disconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, ActivityBase.printerIp);
+            }
+        }
+        if (isFinishing()) {
+            deleteLongTapMessage();
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onDestroy() {
+        super.onDestroy();
+    }
+
+    /* access modifiers changed from: protected */
+    public void onActivityResult(int i, int i2, Intent intent) {
+        if (i == 12) {
+            if (i2 == -1) {
+                finish();
+            } else {
+                this.mNormalCopyButton.setChecked(true);
+            }
+        }
+    }
+
+    private void setupUi() {
+        findViewById(R.id.color).setOnClickListener(this);
+        findViewById(R.id.scale).setOnClickListener(this);
+        findViewById(R.id.paper_size).setOnClickListener(this);
+        findViewById(R.id.paper_type).setOnClickListener(this);
+        findViewById(R.id.paper_source).setOnClickListener(this);
+        findViewById(R.id.document_type).setOnClickListener(this);
+        findViewById(R.id.quality).setOnClickListener(this);
+        findViewById(R.id.copy_setting_clear_all).setOnClickListener(this);
+        findViewById(R.id.copy_button).setOnClickListener(this);
+        LongTapRepeatAdapter.bless(findViewById(R.id.SettingButonCopiesCountUp));
+        LongTapRepeatAdapter.bless(findViewById(R.id.SettingButonCopiesCountDown));
+        LongTapRepeatAdapter.bless(findViewById(R.id.SettingButonXDensityCountUp));
+        LongTapRepeatAdapter.bless(findViewById(R.id.SettingButonXDensityCountDown));
+        this.mCopyTypeGroup = (RadioGroup) findViewById(R.id.copy_type_group);
+        this.mNormalCopyButton = (RadioButton) findViewById(R.id.normal_copy_tab);
+        this.mNormalCopyButton.setChecked(true);
+        this.mNormalCopyButton.setEnabled(false);
+        this.mNormalCopyButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
+            }
+        });
+        this.mRepeatCopyButton = (RadioButton) findViewById(R.id.repeat_copy_tab);
+        this.mRepeatCopyButton.setChecked(false);
+        this.mNormalCopyButton.setEnabled(false);
+        this.mRepeatCopyButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
+                if (z) {
+                    CopyActivity.this.switchToRepeatCopy();
+                }
+            }
+        });
+    }
+
+    /* access modifiers changed from: private */
+    public void switchToRepeatCopy() {
+        this.isKeepSimpleAPConnection = true;
+        startActivityForResult(new Intent(this, epson.print.rpcopy.CopyActivity.class), 12);
+    }
+
+    public void onClick(View view) {
+        Intent intent = new Intent();
+        switch (view.getId()) {
+            case R.id.color /*2131230930*/:
+                intent.setClass(getBaseContext(), CopySettingActivity.class);
+                intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.ColorEffectsType.name());
+                startActivityAndKeepSimpleAp(intent);
+                return;
+            case R.id.copy_button /*2131230948*/:
+                String str = this.TAG;
+                EPLog.m313i(str, "NOW_PRINTER:" + printerId);
+                this.presettings.saveCopyOptions(this.copyComponent.getCopyOptionItems());
+                this.copyProcess = new CopyProcess(this);
+                this.copyProcess.startCopy(getApplicationContext());
+                return;
+            case R.id.copy_setting_clear_all /*2131230967*/:
+                allClear();
+                return;
+            case R.id.document_type /*2131231000*/:
+                intent.setClass(getBaseContext(), CopySettingActivity.class);
+                intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.ScanContentType.name());
+                startActivityAndKeepSimpleAp(intent);
+                return;
+            case R.id.paper_size /*2131231306*/:
+                intent.setClass(getBaseContext(), CopySettingActivity.class);
+                intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.PrintMediaSize.name());
+                startActivityAndKeepSimpleAp(intent);
+                return;
+            case R.id.paper_source /*2131231311*/:
+                intent.setClass(getBaseContext(), CopySettingActivity.class);
+                intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.PrintMediaSource.name());
+                startActivityAndKeepSimpleAp(intent);
+                return;
+            case R.id.paper_type /*2131231314*/:
+                intent.setClass(getBaseContext(), CopySettingActivity.class);
+                intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.PrintMediaType.name());
+                startActivityAndKeepSimpleAp(intent);
+                return;
+            case R.id.quality /*2131231392*/:
+                intent.setClass(getBaseContext(), CopySettingActivity.class);
+                intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.PrintQuality.name());
+                startActivityAndKeepSimpleAp(intent);
+                return;
+            case R.id.scale /*2131231441*/:
+                intent.setClass(getBaseContext(), CopyScaleActivity.class);
+                intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.XScale.name());
+                startActivityAndKeepSimpleAp(intent);
+                return;
+            default:
+                return;
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public void startActivityAndKeepSimpleAp(Intent intent) {
+        this.isKeepSimpleAPConnection = true;
+        startActivity(intent);
+    }
+
+    /* access modifiers changed from: package-private */
+    public void allClear() {
+        this.doClear = true;
+        this.loading.show();
+        ArrayList<ECopyOptionItem> copyOptionItems = this.copyComponent.getCopyOptionItems();
+        int i = this.clearindex;
+        this.clearindex = i + 1;
+        ECopyOptionItem eCopyOptionItem = copyOptionItems.get(i);
+        switch (eCopyOptionItem.getKey()) {
+            case ColorEffectsType:
+                eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.ColorEffectsType_Color);
+                break;
+            case ScanContentType:
+                eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.ScanContentType_Mixed);
+                break;
+            case PrintMediaType:
+                eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaType_Stationery);
+                break;
+            case PrintMediaSize:
+                if (Locale.getDefault().getLanguage().equalsIgnoreCase(Locale.US.getLanguage()) && eCopyOptionItem.getSelectableChoices().contains(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_Letter)) {
+                    eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_Letter);
+                    break;
+                } else {
+                    eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_A4);
+                    break;
+                }
+                break;
+            case PrintMediaSource:
+                eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSource_Bottom);
+                break;
+            case PrintQuality:
+                eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintQuality_Normal);
+                break;
+            case XScale:
+                eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.XScale_Autofit);
+                break;
+            case XDensity:
+            case CopyMagnification:
+            case Copies:
+                eCopyOptionItem.selectValue(eCopyOptionItem.getDefaultValue());
+                break;
+        }
+        this.copyComponent.setCopyOptionItem(eCopyOptionItem);
+    }
+
+    /* access modifiers changed from: package-private */
+    public void fetchCopyOptionContext() {
+        this.copyComponent.createCopyOptionContext(this.copyType, new ECopyComponent.ICopyOptionContextListener() {
+            public void onCopyOptionContextCreated(ECopyComponent.ECopyType eCopyType, ECopyOptionContext eCopyOptionContext, ECopyComponent.ICopyOptionContextListener.ContextCreationError contextCreationError) {
+                CopyActivity copyActivity = CopyActivity.this;
+                copyActivity.optionContext = eCopyOptionContext;
+                if (contextCreationError == null) {
+                    copyActivity.copyComponent.bindCopyOptionContext(CopyActivity.this.optionContext, CopyActivity.this.optionListener);
+                    ArrayList<ECopyOptionItem> copyOptionItems = CopyActivity.this.copyComponent.getCopyOptionItems();
+                    if (ActivityBase.printerId.equalsIgnoreCase(CopyActivity.this.presettings.loadPrePrinter())) {
+                        CopyActivity.this.presettings.setCopyOptions(copyOptionItems);
+                    } else {
+                        CopyActivity.this.buildCopyOptions(copyOptionItems);
+                    }
+                } else {
+                    ActivityBase.errorDialog unused = copyActivity.errordialog = new ActivityBase.errorDialog(copyActivity);
+                    String[] reasonText = CopyActivity.this.errordialog.getReasonText(contextCreationError);
+                    CopyActivity.this.errordialog.showErrorDialog(reasonText[0], reasonText[1], ActivityBase.DialogButtons.Ok, new ActivityBase.IClose() {
+                        public void onClose(ActivityBase.ClickButton clickButton) {
+                            CopyActivity.this.finish();
+                        }
+                    });
+                }
+            }
+        });
+    }
+
+    /* access modifiers changed from: package-private */
+    public void buildCopyOptions(ArrayList<ECopyOptionItem> arrayList) {
+        Iterator<ECopyOptionItem> it = arrayList.iterator();
+        while (it.hasNext()) {
+            ECopyOptionItem next = it.next();
+            ECopyOptionItem.ECopyOptionItemKey key = next.getKey();
+            switch (key) {
+                case ColorEffectsType:
+                    String str = this.TAG;
+                    EPLog.m313i(str, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
+                    updateSetting(R.id.copy_color_info, next);
+                    break;
+                case ScanContentType:
+                    String str2 = this.TAG;
+                    EPLog.m313i(str2, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
+                    updateSetting(R.id.copy_document_type_info, next);
+                    break;
+                case PrintMediaType:
+                    String str3 = this.TAG;
+                    EPLog.m313i(str3, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
+                    updateSetting(R.id.copy_paper_type_info, next);
+                    break;
+                case PrintMediaSize:
+                    String str4 = this.TAG;
+                    EPLog.m313i(str4, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
+                    updateSetting(R.id.copy_paper_size_info, next);
+                    break;
+                case PrintMediaSource:
+                    String str5 = this.TAG;
+                    EPLog.m313i(str5, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
+                    updateSetting(R.id.copy_paper_source_info, next);
+                    break;
+                case PrintQuality:
+                    String str6 = this.TAG;
+                    EPLog.m313i(str6, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
+                    updateSetting(R.id.copy_quality_info, next);
+                    break;
+                case XScale:
+                    String str7 = this.TAG;
+                    EPLog.m313i(str7, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
+                    updateSetting(R.id.copy_scale_info, next);
+                    break;
+                case XDensity:
+                    this.optionValueMap.put(key, new XDensityValue(next));
+                    break;
+                case CopyMagnification:
+                    this.optionValueMap.put(key, new ActivityBase.CopyMagnificationValue(next));
+                    break;
+                case Copies:
+                    this.optionValueMap.put(key, new CopiesValue(next));
+                    break;
+            }
+            this.loading.dismiss();
+        }
+    }
+
+    /* access modifiers changed from: package-private */
+    public void updateSetting(int i, ECopyOptionItem eCopyOptionItem) {
+        TextView textView = (TextView) this.mLayout.findViewById(i);
+        if (eCopyOptionItem.getSelectedChoice() == ECopyOptionItem.ECopyOptionItemChoice.XScale_Custom) {
+            textView.setText(getString(R.string.XScale_CustomSetting) + String.valueOf(((ActivityBase.NumberOptionValue) this.optionValueMap.get(ECopyOptionItem.ECopyOptionItemKey.CopyMagnification)).value) + " %");
+            return;
+        }
+        textView.setText(string(eCopyOptionItem.getSelectedChoice().name()));
+    }
+
+    class CopiesValue extends ActivityBase.NumberOptionValue {
+        public CopiesValue(ECopyOptionItem eCopyOptionItem) {
+            super();
+            bindOption(R.id.SettingEditCopies, eCopyOptionItem);
+            bindCountUp(R.id.SettingButonCopiesCountUp);
+            bindCountDown(R.id.SettingButonCopiesCountDown);
+            setOptionValueChangedListener(CopyActivity.this.optionValueChangedListener);
+        }
+    }
+
+    class XDensityValue extends ActivityBase.NumberOptionValue {
+        ImageView image;
+        TypedArray images = CopyActivity.this.getResources().obtainTypedArray(R.array.density_images);
+
+        public XDensityValue(ECopyOptionItem eCopyOptionItem) {
+            super();
+            bindOption(R.id.density_image, eCopyOptionItem);
+            bindCountUp(R.id.SettingButonXDensityCountUp);
+            bindCountDown(R.id.SettingButonXDensityCountDown);
+            setOptionValueChangedListener(CopyActivity.this.optionValueChangedListener);
+        }
+
+        /* access modifiers changed from: package-private */
+        public void bindOption(int i, ECopyOptionItem eCopyOptionItem) {
+            this.optionItem = eCopyOptionItem;
+            this.value = eCopyOptionItem.getSelectedValue();
+            this.image = (ImageView) CopyActivity.this.findViewById(i);
+            this.image.setImageDrawable(this.images.getDrawable(this.value + 4));
+            this.image.setEnabled(eCopyOptionItem.isEnabled());
+        }
+
+        /* access modifiers changed from: package-private */
+        public void bindCountUp(int i) {
+            this.countUp = (Button) CopyActivity.this.findViewById(i);
+            this.countUp.setOnClickListener(new CounterImage(1));
+            if (this.value == this.optionItem.getMaximumValue()) {
+                this.countUp.setEnabled(false);
+            } else {
+                this.countUp.setEnabled(true);
+            }
+        }
+
+        /* access modifiers changed from: package-private */
+        public void bindCountDown(int i) {
+            this.countDown = (Button) CopyActivity.this.findViewById(i);
+            this.countDown.setOnClickListener(new CounterImage(-1));
+            if (this.value == this.optionItem.getMinimumValue()) {
+                this.countDown.setEnabled(false);
+            } else {
+                this.countDown.setEnabled(true);
+            }
+        }
+
+        class CounterImage extends ActivityBase.NumberOptionValue.Counter implements View.OnClickListener {
+            public CounterImage(int i) {
+                super(i);
+            }
+
+            /* access modifiers changed from: package-private */
+            public void updateImage(int i) {
+                XDensityValue.this.value += i;
+                XDensityValue.this.optionItem.selectValue(XDensityValue.this.value);
+                if (XDensityValue.this.changedListener != null) {
+                    XDensityValue.this.changedListener.onOptionItemChanged(XDensityValue.this.optionItem);
+                }
+            }
+
+            public void onClick(View view) {
+                updateImage(this.amount);
+            }
+        }
+    }
+
+    private void getPrinterInfo() {
+        MyPrinter curPrinter = MyPrinter.getCurPrinter(this);
+        printerId = curPrinter.getPrinterId();
+        printerIp = curPrinter.getIp();
+        this.printerLocation = curPrinter.getLocation();
+    }
+
+    private class ProbePrinter extends AsyncTask<Void, Void, Boolean> {
+        private volatile boolean mRepeatCopyAvailable;
+
+        /* access modifiers changed from: protected */
+        public void onPreExecute() {
+        }
+
+        private ProbePrinter() {
+        }
+
+        /* access modifiers changed from: protected */
+        public Boolean doInBackground(Void... voidArr) {
+            EPLog.m313i(CopyActivity.this.TAG, "ProbePrinter doInBackground");
+            this.mRepeatCopyAvailable = false;
+            if ((CopyActivity.this.printerLocation != 1 && CopyActivity.this.printerLocation != 3) || ActivityBase.printerId == null) {
+                return false;
+            }
+            CopyActivity.this.mPrinter.doInitDriver(CopyActivity.this, 2);
+            if (CopyActivity.this.mPrinter.doProbePrinter(60, ActivityBase.printerId, ActivityBase.printerIp, CopyActivity.this.printerLocation) != 0) {
+                return false;
+            }
+            int doSetPrinter = CopyActivity.this.mPrinter.doSetPrinter();
+            String access$200 = CopyActivity.this.TAG;
+            EPLog.m313i(access$200, "Set Printer result: " + doSetPrinter);
+            if (doSetPrinter != 0) {
+                return false;
+            }
+            CopyActivity copyActivity = CopyActivity.this;
+            String unused = copyActivity.ipAdress = copyActivity.mPrinter.doGetIp();
+            String access$2002 = CopyActivity.this.TAG;
+            EPLog.m313i(access$2002, "IPAdress : " + CopyActivity.this.ipAdress);
+            CopyActivity copyActivity2 = CopyActivity.this;
+            copyActivity2.bProbedPrinter = true;
+            copyActivity2.systemSettings = new ECopyComponent.ICopySystemSettings() {
+                public int getThickPaper() {
+                    return 0;
+                }
+
+                public String getPrinterIPAddress() {
+                    String access$200 = CopyActivity.this.TAG;
+                    EPLog.m313i(access$200, "getPrinterIPAddress : " + CopyActivity.this.ipAdress);
+                    return CopyActivity.this.ipAdress;
+                }
+            };
+            ECopyComponent sharedComponent = ECopyComponent.sharedComponent();
+            sharedComponent.setSystemSettings(CopyActivity.this.systemSettings);
+            sharedComponent.setProperty(ECopyComponent.Property.RequestConnectionTimeout, CopyActivity.CONNECTION_TIMEOUT);
+            this.mRepeatCopyAvailable = CopyActivity.this.checkRepeatCopyFunction();
+            return true;
+        }
+
+        /* access modifiers changed from: protected */
+        public void onCancelled() {
+            EPLog.m313i(CopyActivity.this.TAG, "ProbePrinter onCancelled");
+            super.onCancelled();
+            CopyActivity.this.mPrinter.doCancelFindPrinter();
+        }
+
+        /* access modifiers changed from: protected */
+        public void onPostExecute(Boolean bool) {
+            EPLog.m313i(CopyActivity.this.TAG, "ProbePrinter onPostExecute");
+            CopyActivity.this.changeRepeatCopyButtonState(this.mRepeatCopyAvailable);
+            if (bool.booleanValue()) {
+                CopyActivity.this.mHandler.sendEmptyMessage(2);
+            } else {
+                CopyActivity.this.mHandler.sendEmptyMessage(1);
+            }
+        }
+    }
+
+    /* access modifiers changed from: private */
+    public boolean checkRepeatCopyFunction() {
+        ERemoteDevice eRemoteDevice = new ERemoteDevice();
+        eRemoteDevice.setHostIP(this.ipAdress);
+        eRemoteDevice.setRequestConnectionTimeout(CONNECTION_TIMEOUT);
+        ERemoteDevice.ERemoteDeviceFunctionsResult executeGetFunctionsCommand = eRemoteDevice.executeGetFunctionsCommand(Utils.getRemoteOperationUUID(getApplicationContext()));
+        return executeGetFunctionsCommand.success() && executeGetFunctionsCommand.functions().contains(ERemoteOperation.ERemoteParam.repeat_copy);
+    }
+
+    /* access modifiers changed from: private */
+    public void changeRepeatCopyButtonState(boolean z) {
+        int i;
+        boolean z2 = false;
+        if (z) {
+            i = 0;
+            z2 = true;
+        } else {
+            i = 8;
+        }
+        this.mCopyTypeGroup.setVisibility(i);
+        this.mRepeatCopyButton.setEnabled(z2);
+    }
+
+    /* access modifiers changed from: protected */
+    public void deleteLongTapMessage() {
+        MotionEvent obtain = MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis() + 10, 1, 0.0f, 0.0f, 0);
+        findViewById(R.id.SettingButonCopiesCountUp).dispatchTouchEvent(obtain);
+        findViewById(R.id.SettingButonCopiesCountDown).dispatchTouchEvent(obtain);
+        findViewById(R.id.SettingButonXDensityCountUp).dispatchTouchEvent(obtain);
+        findViewById(R.id.SettingButonXDensityCountDown).dispatchTouchEvent(obtain);
+    }
+
+    public void onConfigurationChanged(Configuration configuration) {
+        super.onConfigurationChanged(configuration);
+        deleteLongTapMessage();
+    }
+}

+ 139 - 0
app/src/main/java/epson/print/copy/CopyProcess.java

@@ -0,0 +1,139 @@
+package epson.print.copy;
+
+import android.content.Context;
+import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
+import epson.print.R;
+import epson.print.CommonDefine;
+import epson.print.copy.ActivityBase;
+import epson.print.copy.Component.ecopycomponent.ECopyComponent;
+import epson.print.copy.Component.ecopycomponent.ECopyOptionItem;
+import java.util.Iterator;
+
+public class CopyProcess implements ECopyComponent.ICopyStatusListener {
+    ActivityBase activityBase;
+    ECopyComponent.ICopyCancelRequest cancelRequest;
+    ECopyComponent copyComponent;
+    boolean disconnectWifi;
+    String jobToken;
+    ActivityBase.errorDialog printererror;
+    ActivityBase.WheelDialog wheel;
+
+    public CopyProcess(ActivityBase activityBase2) {
+        this(activityBase2, (String) null);
+    }
+
+    public CopyProcess(ActivityBase activityBase2, String str) {
+        this.copyComponent = ECopyComponent.sharedComponent();
+        this.disconnectWifi = false;
+        this.activityBase = activityBase2;
+        this.jobToken = str;
+        ActivityBase activityBase3 = this.activityBase;
+        activityBase3.getClass();
+        this.wheel = new ActivityBase.WheelDialog(this.activityBase);
+    }
+
+    public void startCopy(Context context) {
+        String str = this.jobToken;
+        this.cancelRequest = str == null ? this.copyComponent.startCopy(this, context) : this.copyComponent.recoverCopy(str, this);
+    }
+
+    public void startCopyPhoto(String str) {
+        this.cancelRequest = this.copyComponent.startCopyPhoto(str, this);
+    }
+
+    public void onStarted(ECopyComponent.ICopyStatusListener.CopyTaskType copyTaskType) {
+        this.wheel.show(this.activityBase.getString(R.string.CopyTaskProgressCopying), new ActivityBase.CancelRequestCallback() {
+            public void onCancelRequest() {
+                CopyProcess.this.cancelRequest.cancel();
+            }
+        });
+    }
+
+    public void onProcessed(ECopyComponent.ICopyStatusListener.CopyTaskType copyTaskType, int i, int i2, ECopyComponent.ICopyStatusListener.CopyTaskProgress copyTaskProgress, final ECopyComponent.ICopyResumeRequest iCopyResumeRequest) {
+        ActivityBase.errorDialog errordialog = this.printererror;
+        if (errordialog != null) {
+            errordialog.Cancel();
+        }
+        if (copyTaskProgress.equals(ECopyComponent.ICopyStatusListener.CopyTaskProgress.Copying) || copyTaskProgress.equals(ECopyComponent.ICopyStatusListener.CopyTaskProgress.Processing)) {
+            ActivityBase.WheelDialog wheelDialog = this.wheel;
+            wheelDialog.setText(this.activityBase.getString(R.string.CopyTaskProgressCopying) + " " + i2 + CommonDefine.SLASH + i);
+        } else {
+            this.wheel.setText("");
+        }
+        switch (copyTaskProgress) {
+            case Stopped:
+                ActivityBase activityBase2 = this.activityBase;
+                activityBase2.getClass();
+                this.printererror = new ActivityBase.errorDialog(this.activityBase);
+                ECopyComponent.ICopyResumeRequest.StopReason stopReason = iCopyResumeRequest.getStopReason();
+                if (stopReason.equals(ECopyComponent.ICopyResumeRequest.StopReason.PrinterMediaEmptyError)) {
+                    Iterator<ECopyOptionItem> it = this.copyComponent.getCopyOptionItems().iterator();
+                    while (it.hasNext()) {
+                        ECopyOptionItem next = it.next();
+                        if (next.getKey().equals(ECopyOptionItem.ECopyOptionItemKey.PrintMediaSource) && next.getSelectedChoice().equals(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSource_Manual)) {
+                            stopReason = ECopyComponent.ICopyResumeRequest.StopReason.ManualfeedGuide;
+                        }
+                    }
+                }
+                String[] reasonText = this.printererror.getReasonText(stopReason);
+                this.printererror.showErrorDialog(reasonText[0], reasonText[1], iCopyResumeRequest.isPossibleClearError() ? ActivityBase.DialogButtons.ClearErrorCancel : ActivityBase.DialogButtons.Cancel, new ActivityBase.IClose() {
+                    public void onClose(ActivityBase.ClickButton clickButton) {
+                        iCopyResumeRequest.resume(clickButton == ActivityBase.ClickButton.ClearError ? ECopyComponent.ICopyResumeRequest.ResumeState.ClearError : ECopyComponent.ICopyResumeRequest.ResumeState.Cancel);
+                    }
+                });
+                return;
+            case Waiting2ndPage:
+                this.activityBase.showNextPageDialog(new ActivityBase.INextPageClose() {
+                    public void onClose(ECopyComponent.ICopyResumeRequest.ResumeState resumeState) {
+                        iCopyResumeRequest.resume(resumeState);
+                    }
+                });
+                return;
+            case Canceling:
+                this.wheel.hideCancelButton();
+                return;
+            default:
+                return;
+        }
+    }
+
+    public void onFinished(ECopyComponent.ICopyStatusListener.CopyTaskType copyTaskType, ECopyComponent.ICopyStatusListener.CopyTaskResult copyTaskResult) {
+        this.wheel.dismiss();
+        switch (copyTaskResult) {
+            case Succeed:
+                Iterator<ECopyOptionItem> it = this.copyComponent.getCopyOptionItems().iterator();
+                while (it.hasNext()) {
+                    ECopyOptionItem next = it.next();
+                    if (next.getKey().equals(ECopyOptionItem.ECopyOptionItemKey.Copies)) {
+                        next.selectValue(next.getDefaultValue());
+                        this.copyComponent.setCopyOptionItem(next);
+                    }
+                }
+                break;
+            case Busy:
+            case ErrorCommunication:
+            case RemoveAdfPaper:
+            case ErrorOther:
+                ActivityBase activityBase2 = this.activityBase;
+                activityBase2.getClass();
+                this.printererror = new ActivityBase.errorDialog(this.activityBase);
+                String[] reasonText = this.printererror.getReasonText(copyTaskResult);
+                this.printererror.showErrorDialog(reasonText[0], reasonText[1], ActivityBase.DialogButtons.Ok, new ActivityBase.IClose() {
+                    public void onClose(ActivityBase.ClickButton clickButton) {
+                    }
+                });
+                break;
+        }
+        if (this.disconnectWifi) {
+            WiFiDirectManager.disconnect(this.activityBase, WiFiDirectManager.DEVICE_TYPE_PRINTER, ActivityBase.printerIp);
+        }
+    }
+
+    public boolean isProccessing() {
+        return this.wheel.isShowing();
+    }
+
+    public void setDisconnectWifi(boolean z) {
+        this.disconnectWifi = z;
+    }
+}

+ 340 - 0
app/src/main/java/epson/print/copy/CopyScaleActivity.java

@@ -0,0 +1,340 @@
+package epson.print.copy;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.SystemClock;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.ListView;
+import android.widget.TextView;
+import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
+import epson.print.R;
+import epson.print.Util.EPLog;
+import epson.print.copy.ActivityBase;
+import epson.print.copy.Component.ecopycomponent.ECopyComponent;
+import epson.print.copy.Component.ecopycomponent.ECopyOptionItem;
+import epson.print.widgets.LongTapRepeatAdapter;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class CopyScaleActivity extends ActivityBase {
+    private String TAG = "CppyScaleActivity";
+    ActivityBase.OptionItemChangedListener optionValueChangedListener;
+    String settingItemKey;
+
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        EPLog.m313i(this.TAG, "onCreate");
+        setContentView((int) R.layout.copy_scale);
+        Intent intent = getIntent();
+        if (intent != null) {
+            this.settingItemKey = intent.getStringExtra("Key");
+            setActionBar(string(this.settingItemKey), true);
+        }
+        this.optionValueChangedListener = new ActivityBase.OptionItemChangedListener() {
+            public void onOptionItemChanged(ECopyOptionItem eCopyOptionItem) {
+                ArrayList arrayList = new ArrayList();
+                CopyScaleActivity.this.copyComponent.setCopyOptionItem(eCopyOptionItem);
+                if (eCopyOptionItem.getKey() == ECopyOptionItem.ECopyOptionItemKey.CopyMagnification) {
+                    arrayList.add(eCopyOptionItem);
+                    CopyScaleActivity.this.buildCopyOptions(arrayList);
+                }
+            }
+        };
+        buildCopyOptions(this.copyComponent.getCopyOptionItems());
+    }
+
+    /* access modifiers changed from: package-private */
+    public void buildCopyOptions(ArrayList<ECopyOptionItem> arrayList) {
+        EPLog.m313i(this.TAG, "buildCopyOptions");
+        Iterator<ECopyOptionItem> it = arrayList.iterator();
+        while (it.hasNext()) {
+            ECopyOptionItem next = it.next();
+            ECopyOptionItem.ECopyOptionItemKey key = next.getKey();
+            if (key == ECopyOptionItem.ECopyOptionItemKey.CopyMagnification) {
+                this.optionValueMap.put(key, new CopyMagnificationValue(next));
+            }
+            if (key.name().equalsIgnoreCase(this.settingItemKey)) {
+                this.optionValueMap.put(key, new XScaleValue(next));
+            }
+        }
+    }
+
+    class XScaleValue extends ActivityBase.ListOptionValue {
+        final int AUTOFIT = 0;
+        final int CUSTOM = 2;
+        final int FULLSIZE = 1;
+        ArrayList<ScaleInfo> presetArray = new ArrayList<>();
+        int selectedItemPos;
+
+        XScaleValue(ECopyOptionItem eCopyOptionItem) {
+            super();
+            bindOption(eCopyOptionItem);
+            capabilitySetting(eCopyOptionItem, CopyScaleActivity.this);
+            setOptionValueChangedListener(CopyScaleActivity.this.optionValueChangedListener);
+        }
+
+        /* access modifiers changed from: package-private */
+        public ScaleAdapter getArrayAdapter(XScaleValue xScaleValue, Context context) {
+            for (int i = 3; i < xScaleValue.getKeyArray().length; i++) {
+                this.presetArray.add(new ScaleInfo(CopyScaleActivity.this.copyType, (ECopyOptionItem.ECopyOptionItemChoice) xScaleValue.choices.get(i)));
+            }
+            return new ScaleAdapter(context, R.layout.setting_item, this.presetArray);
+        }
+
+        /* access modifiers changed from: package-private */
+        public void capabilitySetting(ECopyOptionItem eCopyOptionItem, Context context) {
+            int i = 0;
+            while (true) {
+                if (i >= this.choices.size()) {
+                    break;
+                } else if (this.selected == this.choices.get(i)) {
+                    this.selectedItemPos = i;
+                    break;
+                } else {
+                    i++;
+                }
+            }
+            LinearLayout linearLayout = (LinearLayout) CopyScaleActivity.this.findViewById(R.id.auto_fit);
+            if (this.selectedItemPos == 0) {
+                ((ImageView) CopyScaleActivity.this.findViewById(R.id.auto_select_icon)).setVisibility(0);
+            } else {
+                ((ImageView) CopyScaleActivity.this.findViewById(R.id.auto_select_icon)).setVisibility(8);
+            }
+            linearLayout.setOnClickListener(new View.OnClickListener() {
+                public void onClick(View view) {
+                    XScaleValue xScaleValue = XScaleValue.this;
+                    xScaleValue.selected = (ECopyOptionItem.ECopyOptionItemChoice) xScaleValue.choices.get(0);
+                    XScaleValue.this.optionItem.selectChoice(XScaleValue.this.selected);
+                    if (XScaleValue.this.changedListener != null) {
+                        XScaleValue.this.changedListener.onOptionItemChanged(XScaleValue.this.optionItem);
+                    }
+                    CopyScaleActivity.this.isKeepSimpleAPConnection = true;
+                    CopyScaleActivity.this.finish();
+                }
+            });
+            LinearLayout linearLayout2 = (LinearLayout) CopyScaleActivity.this.findViewById(R.id.full_size);
+            if (this.selectedItemPos == 1) {
+                ((ImageView) CopyScaleActivity.this.findViewById(R.id.full_select_icon)).setVisibility(0);
+            } else {
+                ((ImageView) CopyScaleActivity.this.findViewById(R.id.full_select_icon)).setVisibility(8);
+            }
+            linearLayout2.setOnClickListener(new View.OnClickListener() {
+                public void onClick(View view) {
+                    XScaleValue xScaleValue = XScaleValue.this;
+                    xScaleValue.selected = (ECopyOptionItem.ECopyOptionItemChoice) xScaleValue.choices.get(1);
+                    XScaleValue.this.optionItem.selectChoice(XScaleValue.this.selected);
+                    if (XScaleValue.this.changedListener != null) {
+                        XScaleValue.this.changedListener.onOptionItemChanged(XScaleValue.this.optionItem);
+                    }
+                    CopyScaleActivity.this.isKeepSimpleAPConnection = true;
+                    CopyScaleActivity.this.finish();
+                }
+            });
+            if (this.selectedItemPos == 2) {
+                ((ImageView) CopyScaleActivity.this.findViewById(R.id.custom_select_icon)).setVisibility(0);
+            } else {
+                ((ImageView) CopyScaleActivity.this.findViewById(R.id.custom_select_icon)).setVisibility(8);
+            }
+            ListView listView = (ListView) CopyScaleActivity.this.findViewById(R.id.scale_list);
+            listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+                public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
+                    XScaleValue xScaleValue = XScaleValue.this;
+                    xScaleValue.selected = (ECopyOptionItem.ECopyOptionItemChoice) xScaleValue.choices.get(i + 3);
+                    XScaleValue.this.optionItem.selectChoice(XScaleValue.this.selected);
+                    if (XScaleValue.this.changedListener != null) {
+                        XScaleValue.this.changedListener.onOptionItemChanged(XScaleValue.this.optionItem);
+                    }
+                    CopyScaleActivity.this.isKeepSimpleAPConnection = true;
+                    CopyScaleActivity.this.finish();
+                }
+            });
+            listView.setAdapter(getArrayAdapter(this, context));
+        }
+
+        private class ScaleAdapter extends ArrayAdapter<ScaleInfo> {
+            private LayoutInflater inflater;
+            private ArrayList<ScaleInfo> items;
+
+            public ScaleAdapter(Context context, int i, ArrayList<ScaleInfo> arrayList) {
+                super(context, i, arrayList);
+                this.items = arrayList;
+                this.inflater = (LayoutInflater) context.getSystemService("layout_inflater");
+            }
+
+            public View getView(int i, View view, ViewGroup viewGroup) {
+                if (view == null) {
+                    view = this.inflater.inflate(R.layout.setting_item, (ViewGroup) null);
+                }
+                ((TextView) view.findViewById(R.id.setting_name)).setText(this.items.get(i).scalePresetName);
+                int i2 = this.items.get(i).scaleNum;
+                ((TextView) view.findViewById(R.id.setting_value)).setText(String.valueOf(i2) + " %");
+                if (i == XScaleValue.this.selectedItemPos - 3) {
+                    ((ImageView) view.findViewById(R.id.setting_active_icon)).setVisibility(0);
+                } else {
+                    ((ImageView) view.findViewById(R.id.setting_active_icon)).setVisibility(8);
+                }
+                return view;
+            }
+        }
+
+        private class ScaleInfo {
+            int scaleNum;
+            String scalePresetName;
+
+            ScaleInfo(ECopyComponent.ECopyType eCopyType, ECopyOptionItem.ECopyOptionItemChoice eCopyOptionItemChoice) {
+                this.scalePresetName = CopyScaleActivity.this.string(eCopyOptionItemChoice.name());
+                this.scaleNum = CopyScaleActivity.this.copyComponent.getCopyValue(eCopyType, eCopyOptionItemChoice);
+            }
+        }
+    }
+
+    class CopyMagnificationValue extends ActivityBase.NumberOptionValue {
+        CopyMagnificationValue(ECopyOptionItem eCopyOptionItem) {
+            super();
+            bindOption(R.id.CopyMagnification, eCopyOptionItem);
+            clickCustomScale();
+            setOptionValueChangedListener(CopyScaleActivity.this.optionValueChangedListener);
+        }
+
+        /* access modifiers changed from: package-private */
+        public void bindOption(int i, ECopyOptionItem eCopyOptionItem) {
+            this.optionItem = eCopyOptionItem;
+            this.editText = (TextView) CopyScaleActivity.this.findViewById(i);
+            this.value = eCopyOptionItem.getSelectedValue();
+            if (this.value == ECopyOptionItem.CopyMagnificationAutofitValue) {
+                this.editText.setText("---");
+            } else {
+                this.editText.setText(String.valueOf(this.value));
+            }
+            this.editText.setEnabled(eCopyOptionItem.isEnabled());
+        }
+
+        /* access modifiers changed from: package-private */
+        public void clickCustomScale() {
+            ((LinearLayout) CopyScaleActivity.this.findViewById(R.id.copy_scale_custom)).setOnClickListener(new View.OnClickListener() {
+                public void onClick(View view) {
+                    View inflate = LayoutInflater.from(CopyScaleActivity.this).inflate(R.layout.copy_custom_scale, (ViewGroup) null);
+                    CopyMagnificationValue.this.editText = (TextView) inflate.findViewById(R.id.SettingCopyMagnification);
+                    CopyMagnificationValue copyMagnificationValue = CopyMagnificationValue.this;
+                    copyMagnificationValue.value = copyMagnificationValue.optionItem.getSelectedValue();
+                    if (CopyMagnificationValue.this.value == ECopyOptionItem.CopyMagnificationAutofitValue) {
+                        CopyMagnificationValue.this.value = 100;
+                    }
+                    CopyMagnificationValue.this.editText.setText(String.valueOf(CopyMagnificationValue.this.value));
+                    CopyMagnificationValue.this.countUp = (Button) inflate.findViewById(R.id.SettingButonCopyMagnificationCountUp);
+                    CopyMagnificationValue.this.countUp.setOnClickListener(new CountCustomScale(1));
+                    if (CopyMagnificationValue.this.value == CopyMagnificationValue.this.optionItem.getMaximumValue()) {
+                        CopyMagnificationValue.this.countUp.setEnabled(false);
+                    } else {
+                        CopyMagnificationValue.this.countUp.setEnabled(true);
+                    }
+                    LongTapRepeatAdapter.bless(CopyMagnificationValue.this.countUp);
+                    CopyMagnificationValue.this.countDown = (Button) inflate.findViewById(R.id.SettingButonCopyMagnificationCountDown);
+                    CopyMagnificationValue.this.countDown.setOnClickListener(new CountCustomScale(-1));
+                    if (CopyMagnificationValue.this.value == CopyMagnificationValue.this.optionItem.getMinimumValue()) {
+                        CopyMagnificationValue.this.countDown.setEnabled(false);
+                    } else {
+                        CopyMagnificationValue.this.countDown.setEnabled(true);
+                    }
+                    LongTapRepeatAdapter.bless(CopyMagnificationValue.this.countDown);
+                    AlertDialog.Builder builder = new AlertDialog.Builder(CopyScaleActivity.this);
+                    builder.setTitle(R.string.XScale_Custom);
+                    builder.setView(inflate);
+                    builder.setPositiveButton(CopyScaleActivity.this.getString(R.string.str_ok), new DialogInterface.OnClickListener() {
+                        public void onClick(DialogInterface dialogInterface, int i) {
+                            ActivityBase.ListOptionValue listOptionValue = (ActivityBase.ListOptionValue) CopyScaleActivity.this.optionValueMap.get(ECopyOptionItem.ECopyOptionItemKey.XScale);
+                            listOptionValue.optionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.XScale_Custom);
+                            if (CopyMagnificationValue.this.changedListener != null) {
+                                CopyMagnificationValue.this.changedListener.onOptionItemChanged(listOptionValue.optionItem);
+                            }
+                            CopyMagnificationValue.this.optionItem.selectValue(Integer.parseInt(CopyMagnificationValue.this.editText.getText().toString()));
+                            if (CopyMagnificationValue.this.changedListener != null) {
+                                CopyMagnificationValue.this.changedListener.onOptionItemChanged(CopyMagnificationValue.this.optionItem);
+                            }
+                            CopyScaleActivity.this.isKeepSimpleAPConnection = true;
+                            CopyMagnificationValue.this.onDismissDialog();
+                            CopyScaleActivity.this.finish();
+                        }
+                    });
+                    builder.setNegativeButton(CopyScaleActivity.this.getString(R.string.str_cancel), new DialogInterface.OnClickListener() {
+                        public void onClick(DialogInterface dialogInterface, int i) {
+                            CopyMagnificationValue.this.onDismissDialog();
+                        }
+                    });
+                    builder.show();
+                    CopyMagnificationValue copyMagnificationValue2 = CopyMagnificationValue.this;
+                    copyMagnificationValue2.setOptionValueChangedListener(CopyScaleActivity.this.optionValueChangedListener);
+                }
+            });
+        }
+
+        /* access modifiers changed from: package-private */
+        public void onDismissDialog() {
+            MotionEvent obtain = MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis() + 10, 1, 0.0f, 0.0f, 0);
+            this.countDown.dispatchTouchEvent(obtain);
+            this.countUp.dispatchTouchEvent(obtain);
+        }
+
+        class CountCustomScale extends ActivityBase.NumberOptionValue.Counter {
+            public CountCustomScale(int i) {
+                super(i);
+            }
+
+            public void onClick(View view) {
+                try {
+                    CopyMagnificationValue.this.value = Integer.valueOf(CopyMagnificationValue.this.editText.getText().toString()).intValue();
+                    CopyMagnificationValue.this.value = Math.min(Math.max(CopyMagnificationValue.this.optionItem.getMinimumValue(), CopyMagnificationValue.this.value + this.amount), CopyMagnificationValue.this.optionItem.getMaximumValue());
+                } catch (NumberFormatException unused) {
+                }
+                CopyMagnificationValue.this.editText.setText(String.valueOf(CopyMagnificationValue.this.value));
+                if (CopyMagnificationValue.this.value >= CopyMagnificationValue.this.optionItem.getMaximumValue()) {
+                    CopyMagnificationValue.this.countUp.setEnabled(false);
+                } else {
+                    CopyMagnificationValue.this.countUp.setEnabled(true);
+                }
+                if (CopyMagnificationValue.this.value <= CopyMagnificationValue.this.optionItem.getMinimumValue()) {
+                    CopyMagnificationValue.this.countDown.setEnabled(false);
+                } else {
+                    CopyMagnificationValue.this.countDown.setEnabled(true);
+                }
+            }
+        }
+    }
+
+    public void onBackPressed() {
+        this.isKeepSimpleAPConnection = true;
+        finish();
+    }
+
+    /* 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.isKeepSimpleAPConnection = true;
+            }
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPause() {
+        super.onPause();
+        if (!this.isKeepSimpleAPConnection) {
+            WiFiDirectManager.disconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, ActivityBase.printerIp);
+        }
+    }
+}

+ 161 - 0
app/src/main/java/epson/print/copy/CopySettingActivity.java

@@ -0,0 +1,161 @@
+package epson.print.copy;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.TextView;
+import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
+import epson.print.R;
+import epson.print.Util.EPLog;
+import epson.print.copy.ActivityBase;
+import epson.print.copy.Component.ecopycomponent.ECopyComponent;
+import epson.print.copy.Component.ecopycomponent.ECopyOptionItem;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class CopySettingActivity extends ActivityBase {
+    private String TAG = "CopySettingActivity";
+    ECopyComponent.ICopyOptionListener optionListener;
+    ActivityBase.OptionItemChangedListener optionValueChangedListener;
+    String settingItemKey;
+
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        EPLog.m313i(this.TAG, "onCreate");
+        setContentView((int) R.layout.copy_setting);
+        Intent intent = getIntent();
+        if (intent != null) {
+            this.settingItemKey = intent.getStringExtra("Key");
+            setActionBar(string(this.settingItemKey), true);
+        }
+        this.optionValueChangedListener = new ActivityBase.OptionItemChangedListener() {
+            public void onOptionItemChanged(ECopyOptionItem eCopyOptionItem) {
+                CopySettingActivity.this.copyComponent.setCopyOptionItem(eCopyOptionItem);
+            }
+        };
+        this.optionListener = new ECopyComponent.ICopyOptionListener() {
+            public void onCopyOptionChanged(ECopyOptionItem eCopyOptionItem, ArrayList<ECopyOptionItem> arrayList, ECopyComponent.ICopyOptionListener.CopyOptionChangedError copyOptionChangedError) {
+                CopySettingActivity.this.loading.dismiss();
+                if (copyOptionChangedError != null) {
+                    CopySettingActivity copySettingActivity = CopySettingActivity.this;
+                    ActivityBase.errorDialog errordialog = new ActivityBase.errorDialog(copySettingActivity);
+                    String[] reasonText = errordialog.getReasonText(copyOptionChangedError);
+                    errordialog.showErrorDialog(reasonText[0], reasonText[1]);
+                    return;
+                }
+                CopySettingActivity.this.finish();
+            }
+        };
+        this.optionContext = this.copyComponent.getBindedCopyOptionContext();
+        this.copyComponent.bindCopyOptionContext(this.optionContext, this.optionListener);
+        buildCopyOptions(this.copyComponent.getCopyOptionItems());
+    }
+
+    /* access modifiers changed from: package-private */
+    public void buildCopyOptions(ArrayList<ECopyOptionItem> arrayList) {
+        EPLog.m313i(this.TAG, "buildCopyOptions");
+        Iterator<ECopyOptionItem> it = arrayList.iterator();
+        while (it.hasNext()) {
+            ECopyOptionItem next = it.next();
+            ECopyOptionItem.ECopyOptionItemKey key = next.getKey();
+            if (key.name().equalsIgnoreCase(this.settingItemKey)) {
+                this.optionValueMap.put(key, new OthersettingValue(next));
+            }
+        }
+    }
+
+    class OthersettingValue extends ActivityBase.ListOptionValue {
+        int selectedItemPos;
+
+        OthersettingValue(ECopyOptionItem eCopyOptionItem) {
+            super();
+            bindOption(eCopyOptionItem);
+            capabilitySetting(eCopyOptionItem, CopySettingActivity.this);
+            setOptionValueChangedListener(CopySettingActivity.this.optionValueChangedListener);
+        }
+
+        /* access modifiers changed from: package-private */
+        public SettingAdapter getArrayAdapter(OthersettingValue othersettingValue, Context context) {
+            return new SettingAdapter(context, R.layout.setting_item, othersettingValue.getKeyArray());
+        }
+
+        /* access modifiers changed from: package-private */
+        public void capabilitySetting(ECopyOptionItem eCopyOptionItem, Context context) {
+            ListView listView = (ListView) CopySettingActivity.this.findViewById(R.id.copy_setting_list);
+            listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+                public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
+                    CopySettingActivity.this.loading.show();
+                    OthersettingValue.this.optionItem.selectChoice((ECopyOptionItem.ECopyOptionItemChoice) OthersettingValue.this.choices.get(i));
+                    if (OthersettingValue.this.changedListener != null) {
+                        OthersettingValue.this.changedListener.onOptionItemChanged(OthersettingValue.this.optionItem);
+                    }
+                    CopySettingActivity.this.isKeepSimpleAPConnection = true;
+                }
+            });
+            listView.setAdapter(getArrayAdapter(this, context));
+            for (int i = 0; i < this.choices.size(); i++) {
+                if (this.selected == this.choices.get(i)) {
+                    this.selectedItemPos = i;
+                    return;
+                }
+            }
+        }
+
+        private class SettingAdapter extends ArrayAdapter<String> {
+            private LayoutInflater inflater;
+            private String[] items;
+
+            public SettingAdapter(Context context, int i, String[] strArr) {
+                super(context, i, strArr);
+                this.items = strArr;
+                this.inflater = (LayoutInflater) context.getSystemService("layout_inflater");
+            }
+
+            public View getView(int i, View view, ViewGroup viewGroup) {
+                if (view == null) {
+                    view = this.inflater.inflate(R.layout.setting_item, (ViewGroup) null);
+                }
+                ((TextView) view.findViewById(R.id.setting_name)).setText(this.items[i]);
+                if (i == OthersettingValue.this.selectedItemPos) {
+                    ((ImageView) view.findViewById(R.id.setting_active_icon)).setVisibility(0);
+                } else {
+                    ((ImageView) view.findViewById(R.id.setting_active_icon)).setVisibility(8);
+                }
+                return view;
+            }
+        }
+    }
+
+    public void onBackPressed() {
+        this.isKeepSimpleAPConnection = true;
+        finish();
+    }
+
+    /* 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.isKeepSimpleAPConnection = true;
+            }
+        }
+    }
+
+    /* access modifiers changed from: protected */
+    public void onPause() {
+        super.onPause();
+        if (!this.isKeepSimpleAPConnection) {
+            WiFiDirectManager.disconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, ActivityBase.printerIp);
+        }
+    }
+}

+ 159 - 0
app/src/main/java/epson/print/copy/DisplayUtil.java

@@ -0,0 +1,159 @@
+package epson.print.copy;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.support.annotation.StringRes;
+import epson.print.R;
+import epson.print.copy.Component.ecopycomponent.ECopyOptionItem;
+import epson.print.rpcopy.Component.ecopycomponent.ECopyOptionItem;
+import java.util.HashMap;
+
+public class DisplayUtil {
+    public static void setMap(Context context, HashMap<String, String> hashMap) {
+        hashMap.put("ColorEffectsType", context.getString(R.string.color));
+        hashMap.put("ColorEffectsType_Color", context.getString(R.string.EPS_CM_COLOR));
+        hashMap.put("ColorEffectsType_MonochromeGrayscale", context.getString(R.string.EPS_CM_MONOCHROME));
+        hashMap.put("ScanContentType", context.getString(R.string.document_type));
+        hashMap.put("ScanContentType_Text", context.getString(R.string.ScanContentType_Text));
+        hashMap.put("ScanContentType_Mixed", context.getString(R.string.ScanContentType_Mixed));
+        hashMap.put("ScanContentType_Photographic", context.getString(R.string.ScanContentType_Photographic));
+        hashMap.put("PrintMediaSource", context.getString(R.string.paper_source));
+        hashMap.put("PrintMediaSource_Top", context.getString(R.string.CopySourceUp));
+        hashMap.put("PrintMediaSource_Bottom", context.getString(R.string.CopySourceDown));
+        hashMap.put("PrintMediaSource_Rear", context.getString(R.string.EPS_MPID_REAR));
+        hashMap.put("PrintMediaSource_Manual", context.getString(R.string.EPS_MPID_REARMANUAL));
+        hashMap.put("PrintMediaType", context.getString(R.string.paper_type));
+        hashMap.put("PrintMediaType_Stationery", context.getString(R.string.EPS_MTID_PLAIN));
+        hashMap.put("PrintMediaType_PhotographicHighGloss", context.getString(R.string.EPS_MTID_PLATINA));
+        hashMap.put("PrintMediaType_Photographic", context.getString(R.string.EPS_MTID_PGPHOTO));
+        hashMap.put("PrintMediaType_PhotographicSemiGloss", context.getString(R.string.EPS_MTID_PSPHOTO));
+        hashMap.put("PrintMediaType_PhotographicGlossy", context.getString(R.string.EPS_MTID_LCPP));
+        hashMap.put("PrintMediaType_CustomMediaTypeEpson44", context.getString(R.string.EPS_MTID_GLOSSYCAST));
+        hashMap.put("PrintMediaType_PhotographicMatte", context.getString(R.string.EPS_MTID_MATTE));
+        hashMap.put("PrintMediaType_StationeryCoated", context.getString(R.string.EPS_MTID_PHOTOINKJET2));
+        hashMap.put("PrintMediaType_CustomMediaTypeEpson2A", context.getString(R.string.EPS_MTID_GLOSSYHAGAKI));
+        hashMap.put("PrintMediaType_StationeryInkjet", context.getString(R.string.EPS_MTID_HAGAKIINKJET));
+        hashMap.put("PrintMediaType_CustomMediaTypeEpson1B", context.getString(R.string.EPS_MTID_HAGAKIRECL));
+        hashMap.put("PrintMediaType_CustomMediaTypeEpson02", context.getString(R.string.EPS_MTID_IRON));
+        hashMap.put("PrintMediaType_CustomMediaTypeEpson19", context.getString(R.string.EPS_MTID_VELVETFINEART));
+        hashMap.put("PrintMediaType_Lebals", context.getString(R.string.EPS_MTID_MINIPHOTO));
+        hashMap.put("PrintMediaType_Envelope", context.getString(R.string.EPS_MTID_ENVELOPE));
+        hashMap.put("PrintMediaType_DBLMEISHI_HALFGROSSY", context.getString(R.string.EPS_MTID_BS_HALFGLOSSY_DS));
+        hashMap.put("PrintMediaType_HagakiAtena", context.getString(R.string.EPS_MTID_HAGAKIATENA));
+        hashMap.put("PrintMediaType_BussnessPlain", context.getString(R.string.EPS_MTID_BUSINESS_PLAIN));
+        for (EnumAndDisplayStringId addHashMap : new EnumAndDisplayStringId[]{new EnumAndDisplayStringId(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaType_StationeryHeavyweight, R.string.EPS_MTID_THICKPAPER), new EnumAndDisplayStringId(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaType_StationeryLetterhead, R.string.EPS_MTID_LETTERHEAD), new EnumAndDisplayStringId(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaType_BrightColorPlain, R.string.EPS_MTID_HIGH_QUALITY_PLAIN)}) {
+            addHashMap.addHashMap(context, hashMap);
+        }
+        hashMap.put("PrintMediaSize", context.getString(R.string.paper_size));
+        hashMap.put("PrintMediaSize_A4", context.getString(R.string.EPS_MSID_A4));
+        hashMap.put("PrintMediaSize_B4", context.getString(R.string.EPS_MSID_B4));
+        hashMap.put("PrintMediaSize_B5", context.getString(R.string.EPS_MSID_B5));
+        hashMap.put("PrintMediaSize_L", context.getString(R.string.EPS_MSID_L));
+        hashMap.put("PrintMediaSize_2L", context.getString(R.string.EPS_MSID_2L));
+        hashMap.put("PrintMediaSize_Postcard", context.getString(R.string.EPS_MSID_POSTCARD));
+        hashMap.put("PrintMediaSize_KG", context.getString(R.string.EPS_MSID_TRIM_4X6));
+        hashMap.put("PrintMediaSize_8x10in", context.getString(R.string.EPS_MSID_8X10));
+        hashMap.put("PrintMediaSize_Letter", context.getString(R.string.EPS_MSID_LETTER));
+        hashMap.put("PrintMediaSize_Legal", context.getString(R.string.EPS_MSID_LEGAL));
+        hashMap.put("PrintMediaSize_A5", context.getString(R.string.EPS_MSID_A5));
+        hashMap.put("PrintMediaSize_254x305mm", context.getString(R.string.EPS_MSID_10X12));
+        hashMap.put("PrintMediaSize_A3", context.getString(R.string.EPS_MSID_A3));
+        hashMap.put("PrintMediaSize_US_B", context.getString(R.string.EPS_MSID_USB));
+        hashMap.put("PrintMediaSize_A6", context.getString(R.string.EPS_MSID_A6));
+        hashMap.put("PrintMediaSize_CHOU3", context.getString(R.string.EPS_MSID_CHOKEI_3));
+        hashMap.put("PrintMediaSize_CHOU4", context.getString(R.string.EPS_MSID_CHOKEI_4));
+        hashMap.put("PrintMediaSize_YOU1", context.getString(R.string.EPS_MSID_YOKEI_1));
+        hashMap.put("PrintMediaSize_YOU3", context.getString(R.string.EPS_MSID_YOKEI_3));
+        hashMap.put("PrintMediaSize_YOU4", context.getString(R.string.EPS_MSID_YOKEI_4));
+        hashMap.put("PrintMediaSize_YOU2", context.getString(R.string.EPS_MSID_YOKEI_2));
+        hashMap.put("PrintMediaSize_KAKU2", context.getString(R.string.EPS_MSID_KAKU_2));
+        hashMap.put("PrintMediaSize_KAKU20", context.getString(R.string.EPS_MSID_KAKU_20));
+        hashMap.put("PrintMediaSize_MEISHI", context.getString(R.string.EPS_MSID_MEISHI));
+        hashMap.put("PrintMediaSize_CARD", context.getString(R.string.EPS_MSID_CARD_54X86));
+        hashMap.put("PrintMediaSize_Hivision", context.getString(R.string.EPS_MSID_HIVISION));
+        hashMap.put("PrintMediaSize_EnvelopeDL", context.getString(R.string.EPS_MSID_ENV_DL_P));
+        hashMap.put("PrintMediaSize_B6", context.getString(R.string.EPS_MSID_B6));
+        hashMap.put("PrintMediaSize_Executive", context.getString(R.string.EPS_MSID_EXECUTIVE));
+        hashMap.put("PrintMediaSize_8d5x13in", context.getString(R.string.EPS_MSID_8_5X13));
+        hashMap.put("PrintMediaSize_11x14in", context.getString(R.string.EPS_MSID_11X14));
+        hashMap.put("PrintMediaSize_EnvelopeNumber10", context.getString(R.string.EPS_MSID_ENV_10_P));
+        hashMap.put("PrintMediaSize_8K", context.getString(R.string.EPS_MSID_8K));
+        hashMap.put("PrintMediaSize_16K", context.getString(R.string.EPS_MSID_16K));
+        hashMap.put("PrintMediaSize_HalfLetter", context.getString(R.string.EPS_MSID_HALFLETTER));
+        hashMap.put("PrintMediaSize_IndianLegal215x345mm", context.getString(R.string.EPS_MSID_INDIAN_LEGAL));
+        hashMap.put("PrintMediaSize_MexicoOficio8d5x13d4in", context.getString(R.string.EPS_MSID_MEXICO_OFICIO));
+        hashMap.put("PrintMediaSize_Oficio9_8d46x12d4in", context.getString(R.string.EPS_MSID_OFICIO9));
+        hashMap.put("PrintQuality", context.getString(R.string.quality));
+        hashMap.put("PrintQuality_Economy", context.getString(R.string.CopyQualityDraft));
+        hashMap.put("PrintQuality_Normal", context.getString(R.string.CopyQualityStandard));
+        hashMap.put("PrintQuality_High", context.getString(R.string.CopyQualityBest));
+        hashMap.put("PrintQuality_Best", context.getString(R.string.CopyQualityXBest));
+        hashMap.put("XScale", context.getString(R.string.copy_scale));
+        hashMap.put("XScale_FullSize", context.getString(R.string.XScale_FullSize));
+        hashMap.put("XScale_Custom", context.getString(R.string.XScale_Custom));
+        hashMap.put("XScale_Autofit", context.getString(R.string.XScale_Autofit));
+        hashMap.put("XScale_Letter_to_KG", context.getString(R.string.XScale_Letter_to_KG));
+        hashMap.put("XScale_KG_to_Letter", context.getString(R.string.XScale_KG_to_Letter));
+        hashMap.put("XScale_Letter_to_2L", context.getString(R.string.XScale_Letter_to_2L));
+        hashMap.put("XScale_2L_to_Letter", context.getString(R.string.XScale_2L_to_Letter));
+        hashMap.put("XScale_KG_to_A4", context.getString(R.string.XScale_KG_to_A4));
+        hashMap.put("XScale_A4_to_KG", context.getString(R.string.XScale_A4_to_KG));
+        hashMap.put("XScale_2L_to_A4", context.getString(R.string.XScale_2L_to_A4));
+        hashMap.put("XScale_A4_to_2L", context.getString(R.string.XScale_A4_to_2L));
+        hashMap.put("XScale_KG_to_8x10", context.getString(R.string.XScale_KG_to_8x10));
+        hashMap.put("XScale_8x10_to_2L", context.getString(R.string.XScale_8x10_to_2L));
+        hashMap.put("XScale_Legal_to_Letter", context.getString(R.string.XScale_Legal_to_Letter));
+        hashMap.put("XScale_A4_to_Postcard", context.getString(R.string.XScale_A4_to_Postcard));
+        hashMap.put("XScale_2L_to_Postcard", context.getString(R.string.XScale_2L_to_Postcard));
+        hashMap.put("XScale_L_to_Postcard", context.getString(R.string.XScale_L_to_Postcard));
+        hashMap.put("XScale_L_to_2L", context.getString(R.string.XScale_L_to_2L));
+        hashMap.put("XScale_Postcard_to_A4", context.getString(R.string.XScale_Postcard_to_A4));
+        hashMap.put("XScale_L_to_A4", context.getString(R.string.XScale_L_to_A4));
+        hashMap.put("XScale_A4_to_B5", context.getString(R.string.XScale_A4_to_B5));
+        hashMap.put("XScale_B5_to_A4", context.getString(R.string.XScale_B5_to_A4));
+        hashMap.put("XScale_2L_to_KG", context.getString(R.string.XScale_2L_to_KG));
+        hashMap.put("XScale_KG_to_2L", context.getString(R.string.XScale_KG_to_2L));
+        hashMap.put("XScale_A5_to_A4", context.getString(R.string.XScale_A5_to_A4));
+        hashMap.put("XScale_A4_to_A5", context.getString(R.string.XScale_A4_to_A5));
+        hashMap.put("XScale_A4_to_A3", context.getString(R.string.XScale_A4_to_A3));
+        hashMap.put("XScale_Letter_to_11x17", context.getString(R.string.XScale_Letter_to_USB));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemKey.RepeatLayout.name(), context.getString(R.string.ECopyOptionItemKeyLayout));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.RepeatLayout_twoRepeat.name(), context.getString(R.string.ECopyOptionItemChoiceLayout_2Repeat));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.RepeatLayout_fourRepeat.name(), context.getString(R.string.ECopyOptionItemChoiceLayout_4Repeat));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.RepeatLayout_autoRepeat.name(), context.getString(R.string.ECopyOptionItemChoiceLayout_AutoRepeat));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemKey.RemoveBackground.name(), context.getString(R.string.ECopyOptionItemKeyXRemoveBackground));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XRemoveBackground_On.name(), context.getString(R.string.ECopyOptionItemChoiceXRemoveBackground_On));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XRemoveBackground_Off.name(), context.getString(R.string.ECopyOptionItemChoiceXRemoveBackground_Off));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemKey.XCutLine.name(), context.getString(R.string.ECopy_print_a_cut_line_option_key));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XCutLine_Dash.name(), context.getString(R.string.ECopyOptionItemChoiceXPrintCutLine_Dash));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XCutLine_On.name(), context.getString(R.string.ECopy_print_a_cut_line_option_key_on_item));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XCutLine_Off.name(), context.getString(R.string.ECopy_print_a_cut_line_option_key_off_item));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemKey.XCutLineStyle.name(), context.getString(R.string.ECopy_line_style_option_key));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XCutLineStyle_Dash.name(), context.getString(R.string.ECopyOptionItemChoiceXPrintCutLineStyle_Dash));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XCutLineStyle_Dot.name(), context.getString(R.string.ECopy_line_style_option_key_dotted_line_item));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XCutLineStyle_Continuous.name(), context.getString(R.string.ECopy_line_style_option_key_solidline_item));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemKey.XCutLineWeight.name(), context.getString(R.string.ECopy_line_width_option_key));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XCutLineWidth_Dash.name(), context.getString(R.string.ECopyOptionItemChoiceXPrintCutLineWeight_Dash));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XCutLineWidth_Thin.name(), context.getString(R.string.ECopy_line_width_option_key_thin_item));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XCutLineWidth_Medium.name(), context.getString(R.string.ECopy_line_width_option_key_standard_item));
+        hashMap.put(ECopyOptionItem.ECopyOptionItemChoice.XCutLineWidth_Thick.name(), context.getString(R.string.ECopy_line_width_option_key_thick_item));
+    }
+
+    static class EnumAndDisplayStringId {
+        final ECopyOptionItem.ECopyOptionItemChoice copyParamEnum;
+        @StringRes
+
+        /* renamed from: id */
+        final int f384id;
+
+        EnumAndDisplayStringId(@NonNull ECopyOptionItem.ECopyOptionItemChoice eCopyOptionItemChoice, @StringRes int i) {
+            this.copyParamEnum = eCopyOptionItemChoice;
+            this.f384id = i;
+        }
+
+        /* access modifiers changed from: package-private */
+        public void addHashMap(@NonNull Context context, @NonNull HashMap<String, String> hashMap) {
+            hashMap.put(this.copyParamEnum.name(), context.getString(this.f384id));
+        }
+    }
+}

+ 9 - 0
app/src/main/java/epson/print/ecclient/DebugDisplay.java

@@ -0,0 +1,9 @@
+package epson.print.ecclient;
+
+import android.content.Intent;
+
+public interface DebugDisplay {
+    void addResText(String str);
+
+    void startActivity(Intent intent);
+}

+ 124 - 0
app/src/main/java/epson/print/ecclient/EcClientLib.java

@@ -0,0 +1,124 @@
+package epson.print.ecclient;
+
+public class EcClientLib {
+    public static final int ECC_CM_COLOR = 1;
+    public static final int ECC_CM_MONOCHROME = 2;
+    public static final int ECC_RENDER_ABORTED = 4;
+    public static final int ECC_RENDER_CANCELED = 3;
+    public static final int ECC_RENDER_COMPLETED = 2;
+    public static final int ECC_RENDER_PROCESSING = 1;
+    public static final int ECC_RENDER_UNKNOWN = 0;
+    public static final int ECC_SOURCE_UNK = 0;
+    public static final int ECC_SRC_DOCFILE = 1;
+    public static final int ECC_SRC_IMAGES = 2;
+    public static final int ECC_SRC_WEB = 3;
+    public static final int ECT_CAPABILITY = 3;
+    public static final int ECT_CLIENT_INFO = 2;
+    public static final int ECT_JOB_INFO = 7;
+    public static final int ECT_PRINTER_SUPPORT = 1;
+    public static final int ECT_PRINT_SETTING = 4;
+    public static final int ECT_RENDER_STAT = 6;
+    public static final int ECT_URI = 5;
+    public String mClientId;
+    public int mColorModeAtLocal;
+    public int mColorModeAtPhoto;
+    public int mColorModeAtRemote;
+    public int mCompletePage;
+    public EccJobInfo mEccJobInfo;
+    public String mEpsonDeviceId;
+    HttpAccess mHttpAcess;
+    public EpsJobAttrib mJobAttrib;
+    public String mLogUri;
+    public EpsSupportedMedia mMediaAtLocal;
+    public EpsSupportedMedia mMediaAtPhoto;
+    public EpsSupportedMedia mMediaAtRemote;
+    long mNativeInscance = 0;
+    public String mPrinterName;
+    public String mPrinterName2;
+    public int mRenderStatus;
+    public String mSerialNumber;
+    public int mType;
+
+    public static native int GetPid();
+
+    public native int ChangePrintSetting(EpsJobAttrib epsJobAttrib, String str, String str2, boolean z);
+
+    public native int CreateJob(int i, String str, int i2, EpsJobAttrib epsJobAttrib, int i3, int i4);
+
+    public native void DebugPrintPid();
+
+    public native int DownloadPreview(int i, String str);
+
+    public native int EndJob();
+
+    public native int GetCapability();
+
+    public native int GetDefaultSetting();
+
+    public native int GetPrintLogUri(String str, String str2, String str3, String str4);
+
+    public native int GetPrinterInfo();
+
+    public native int GetRenderingStatus();
+
+    public native int Login(String str, String str2, String str3);
+
+    public native int Logout();
+
+    public native boolean NativeInitialize();
+
+    public native int RegPrinter(String str, String str2, String str3);
+
+    public native int StartPrint(int i, int i2);
+
+    public native void Terminate();
+
+    public native int UploadFile(String str, int i, int i2);
+
+    static {
+        System.loadLibrary("ecclient");
+    }
+
+    public boolean Initialize() {
+        SetHttpAccess(new HttpApache());
+        return NativeInitialize();
+    }
+
+    /* access modifiers changed from: package-private */
+    public void SetHttpAccess(HttpAccess httpAccess) {
+        this.mHttpAcess = httpAccess;
+    }
+
+    public void cancel() {
+        this.mHttpAcess.cancel();
+    }
+
+    public void resetCancel() {
+        this.mHttpAcess.resetCancel();
+    }
+
+    /* access modifiers changed from: protected */
+    public void finalize() throws Throwable {
+        Terminate();
+    }
+
+    public String printerName2() {
+        return this.mPrinterName2;
+    }
+
+    public String serialNumber() {
+        return this.mSerialNumber;
+    }
+
+    public String deviceId() {
+        return this.mEpsonDeviceId;
+    }
+
+    public String printerName() {
+        return this.mPrinterName;
+    }
+
+    public String clientId() {
+        return this.mClientId;
+    }
+}

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