Utils.java 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713
  1. package epson.common;
  2. import android.annotation.TargetApi;
  3. import android.app.Activity;
  4. import android.app.AlertDialog;
  5. import android.content.Context;
  6. import android.content.DialogInterface;
  7. import android.content.SharedPreferences;
  8. import android.graphics.Bitmap;
  9. import android.graphics.BitmapFactory;
  10. import android.graphics.Rect;
  11. import android.graphics.drawable.Drawable;
  12. import android.net.ConnectivityManager;
  13. import android.net.NetworkInfo;
  14. import android.net.wifi.WifiManager;
  15. import android.os.Build;
  16. import android.os.Environment;
  17. import android.view.KeyEvent;
  18. import android.widget.TextView;
  19. import epson.print.CommonDefine;
  20. import epson.print.Util.EPLog;
  21. import epson.print.widgets.CustomTitleAlertDialogBuilder;
  22. import java.io.File;
  23. import java.io.FileInputStream;
  24. import java.io.FileNotFoundException;
  25. import java.io.IOException;
  26. import java.util.Locale;
  27. import java.util.UUID;
  28. public class Utils {
  29. private static String TAG = "epson.common.Utils";
  30. private Utils() {
  31. }
  32. public static void savePref(Context context, String str, String str2, int i) {
  33. SharedPreferences.Editor edit = context.getSharedPreferences(str, 0).edit();
  34. edit.putInt(str2, i);
  35. edit.commit();
  36. }
  37. public static void savePref(Context context, String str, String str2, String str3) {
  38. SharedPreferences.Editor edit = context.getSharedPreferences(str, 0).edit();
  39. edit.putString(str2, str3);
  40. edit.commit();
  41. }
  42. public static void savePref(Context context, String str, String str2, boolean z) {
  43. SharedPreferences.Editor edit = context.getSharedPreferences(str, 0).edit();
  44. edit.putBoolean(str2, z);
  45. edit.commit();
  46. }
  47. public static String getPrefString(Context context, String str, String str2) {
  48. return context.getSharedPreferences(str, 0).getString(str2, "");
  49. }
  50. public static int getPrefInt(Context context, String str, String str2) {
  51. return context.getSharedPreferences(str, 0).getInt(str2, 0);
  52. }
  53. public static boolean getPrefBoolean(Context context, String str, String str2) {
  54. return context.getSharedPreferences(str, 0).getBoolean(str2, false);
  55. }
  56. public static Bitmap decodeFile(File file, int i, boolean z) throws FileNotFoundException, OutOfMemoryError, IOException {
  57. return decodeFile(file, i);
  58. }
  59. /* JADX WARNING: Removed duplicated region for block: B:22:0x0041 */
  60. /* JADX WARNING: Removed duplicated region for block: B:24:0x0046 */
  61. /* Code decompiled incorrectly, please refer to instructions dump. */
  62. public static void copyFile(java.io.File r9, java.io.File r10) throws java.io.IOException {
  63. /*
  64. boolean r0 = r10.exists()
  65. if (r0 != 0) goto L_0x0009
  66. r10.createNewFile()
  67. L_0x0009:
  68. r0 = 0
  69. java.io.FileInputStream r1 = new java.io.FileInputStream // Catch:{ all -> 0x003d }
  70. r1.<init>(r9) // Catch:{ all -> 0x003d }
  71. java.nio.channels.FileChannel r9 = r1.getChannel() // Catch:{ all -> 0x003d }
  72. java.io.FileOutputStream r1 = new java.io.FileOutputStream // Catch:{ all -> 0x0037 }
  73. r1.<init>(r10) // Catch:{ all -> 0x0037 }
  74. java.nio.channels.FileChannel r10 = r1.getChannel() // Catch:{ all -> 0x0037 }
  75. r4 = 0
  76. long r6 = r9.size() // Catch:{ all -> 0x0032 }
  77. r2 = r10
  78. r3 = r9
  79. r2.transferFrom(r3, r4, r6) // Catch:{ all -> 0x0032 }
  80. if (r9 == 0) goto L_0x002c
  81. r9.close()
  82. L_0x002c:
  83. if (r10 == 0) goto L_0x0031
  84. r10.close()
  85. L_0x0031:
  86. return
  87. L_0x0032:
  88. r0 = move-exception
  89. r8 = r0
  90. r0 = r9
  91. r9 = r8
  92. goto L_0x003f
  93. L_0x0037:
  94. r10 = move-exception
  95. r8 = r0
  96. r0 = r9
  97. r9 = r10
  98. r10 = r8
  99. goto L_0x003f
  100. L_0x003d:
  101. r9 = move-exception
  102. r10 = r0
  103. L_0x003f:
  104. if (r0 == 0) goto L_0x0044
  105. r0.close()
  106. L_0x0044:
  107. if (r10 == 0) goto L_0x0049
  108. r10.close()
  109. L_0x0049:
  110. throw r9
  111. */
  112. throw new UnsupportedOperationException("Method not decompiled: epson.common.Utils.copyFile(java.io.File, java.io.File):void");
  113. }
  114. public static Bitmap decodeFile(File file, int i) throws FileNotFoundException, OutOfMemoryError {
  115. BitmapFactory.Options options = new BitmapFactory.Options();
  116. options.inJustDecodeBounds = true;
  117. BitmapFactory.decodeFile(file.getAbsolutePath(), options);
  118. int max = Math.max((options.outWidth / i) + 1, (options.outHeight / i) + 1);
  119. if (max < 1) {
  120. max = 1;
  121. }
  122. options.inJustDecodeBounds = false;
  123. options.inSampleSize = max;
  124. return BitmapFactory.decodeFile(file.getAbsolutePath(), options);
  125. }
  126. public static Bitmap decodeFileByScale(File file, int i) throws FileNotFoundException, OutOfMemoryError {
  127. BitmapFactory.Options options = new BitmapFactory.Options();
  128. options.inSampleSize = i;
  129. return BitmapFactory.decodeStream(new FileInputStream(file), (Rect) null, options);
  130. }
  131. public static Bitmap decodeFileBySample(File file, BitmapFactory.Options options) throws FileNotFoundException, OutOfMemoryError {
  132. return BitmapFactory.decodeStream(new FileInputStream(file), (Rect) null, options);
  133. }
  134. public static void deleteTempFile(String str) {
  135. File file = new File(str);
  136. if (file.exists() && file.isFile()) {
  137. file.delete();
  138. }
  139. }
  140. public static boolean isOnline(Context context) {
  141. NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
  142. return activeNetworkInfo != null && activeNetworkInfo.isConnected();
  143. }
  144. public static boolean isConnecting(@NonNull Context context) {
  145. NetworkInfo activeNetworkInfo;
  146. ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
  147. if (connectivityManager == null || (activeNetworkInfo = connectivityManager.getActiveNetworkInfo()) == null) {
  148. return false;
  149. }
  150. return activeNetworkInfo.isConnectedOrConnecting();
  151. }
  152. public static boolean isConnectedWifi(Context context) {
  153. NetworkInfo networkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getNetworkInfo(1);
  154. if (networkInfo == null || networkInfo.getType() != 1 || !networkInfo.isConnected()) {
  155. return false;
  156. }
  157. return true;
  158. }
  159. public static boolean isEnableMobileData(Context context) {
  160. ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
  161. NetworkInfo networkInfo = connectivityManager.getNetworkInfo(0);
  162. boolean isAvailable = networkInfo != null ? networkInfo.isAvailable() : false;
  163. if (isAvailable) {
  164. try {
  165. isAvailable = Boolean.TRUE.equals(connectivityManager.getClass().getMethod("getMobileDataEnabled", new Class[0]).invoke(connectivityManager, new Object[0]));
  166. String str = TAG;
  167. EPLog.m313i(str, "getMobileDataEnabled :" + Boolean.valueOf(isAvailable).toString());
  168. } catch (Exception unused) {
  169. EPLog.m307e(TAG, "getMobileDataEnabled : Error");
  170. }
  171. }
  172. String str2 = TAG;
  173. EPLog.m313i(str2, "isEnableMobileData :" + Boolean.valueOf(isAvailable).toString());
  174. return isAvailable;
  175. }
  176. public static String getSSID(Context context) {
  177. try {
  178. return ((WifiManager) context.getSystemService(Service.WIFI_SERVICE)).getConnectionInfo().getSSID();
  179. } catch (SecurityException e) {
  180. e.printStackTrace();
  181. return null;
  182. }
  183. }
  184. public static AlertDialog makeMessageBox(Context context, String str, String str2) {
  185. AlertDialog.Builder makeMassageBoxInternal = makeMassageBoxInternal(context, str2);
  186. makeMassageBoxInternal.setTitle((CharSequence) null);
  187. makeMassageBoxInternal.setMessage(str);
  188. return makeMassageBoxInternal.create();
  189. }
  190. public static AlertDialog makeMessageBox(Context context, String str, String str2, String str3) {
  191. AlertDialog.Builder makeMassageBoxInternal = makeMassageBoxInternal(context, str3);
  192. makeMassageBoxInternal.setTitle(str);
  193. makeMassageBoxInternal.setMessage(str2);
  194. return makeMassageBoxInternal.create();
  195. }
  196. private static AlertDialog.Builder makeMassageBoxInternal(Context context, String str) {
  197. CustomTitleAlertDialogBuilder customTitleAlertDialogBuilder = new CustomTitleAlertDialogBuilder(context);
  198. customTitleAlertDialogBuilder.setCancelable(false);
  199. customTitleAlertDialogBuilder.setOnKeyListener(new DialogInterface.OnKeyListener() {
  200. public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
  201. return keyEvent.getKeyCode() == 84;
  202. }
  203. });
  204. customTitleAlertDialogBuilder.setPositiveButton(str, new DialogInterface.OnClickListener() {
  205. public void onClick(DialogInterface dialogInterface, int i) {
  206. dialogInterface.dismiss();
  207. }
  208. });
  209. return customTitleAlertDialogBuilder;
  210. }
  211. public static CustomTitleAlertDialogBuilder getCustomTitleDialogBuilder(Context context) {
  212. CustomTitleAlertDialogBuilder customTitleAlertDialogBuilder = new CustomTitleAlertDialogBuilder(context);
  213. customTitleAlertDialogBuilder.setCancelable(false);
  214. customTitleAlertDialogBuilder.setOnKeyListener(new DialogInterface.OnKeyListener() {
  215. public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
  216. return keyEvent.getKeyCode() == 84;
  217. }
  218. });
  219. return customTitleAlertDialogBuilder;
  220. }
  221. public void deleteTempFoler(String str) {
  222. File file = new File(str);
  223. File[] listFiles = file.listFiles();
  224. if (listFiles != null) {
  225. for (int i = 0; i < listFiles.length; i++) {
  226. if (listFiles[i].isFile()) {
  227. listFiles[i].delete();
  228. } else if (listFiles[i].isDirectory()) {
  229. deleteTempFoler(listFiles[i].toString());
  230. }
  231. }
  232. }
  233. if (file.exists() && file.isFile()) {
  234. file.delete();
  235. }
  236. }
  237. public static String getPreffix(String str) {
  238. if (str == null) {
  239. return null;
  240. }
  241. int lastIndexOf = str.lastIndexOf(CommonDefine.DOT);
  242. return (lastIndexOf == -1 || lastIndexOf == 0) ? str : str.substring(0, lastIndexOf);
  243. }
  244. public static String getSuffix(String str) {
  245. int lastIndexOf;
  246. if (str == null || (lastIndexOf = str.lastIndexOf(CommonDefine.DOT)) == -1 || lastIndexOf == 0) {
  247. return null;
  248. }
  249. return str.substring(lastIndexOf + 1);
  250. }
  251. @Nullable
  252. public static String getMimeType(@Nullable String str) {
  253. if (str == null) {
  254. return null;
  255. }
  256. return getExtType(getExtention(new File(str).getName()));
  257. }
  258. public static String getExtention(String str) {
  259. String suffix = getSuffix(str);
  260. if (suffix == null) {
  261. return null;
  262. }
  263. return CommonDefine.DOT + suffix;
  264. }
  265. public static String getMimeExt(String str) {
  266. if (str == null) {
  267. return null;
  268. }
  269. switch (MimeType.toMimeType(str)) {
  270. case PDF_TYPE:
  271. return CommonDefine.FileType_PDF;
  272. case DOC_TYPE_1:
  273. return CommonDefine.FileType_WORD_1;
  274. case DOCX_TYPE_2:
  275. return CommonDefine.FileType_WORD_2;
  276. case EXCEL_TYPE_1:
  277. return CommonDefine.FileType_EXCEL_1;
  278. case EXCEL_TYPE_2:
  279. return CommonDefine.FileType_EXCEL_2;
  280. case POWERPOINT_TYPE_1:
  281. return CommonDefine.FileType_POWERPOINT_1;
  282. case POWERPOINT_TYPE_2:
  283. return CommonDefine.FileType_POWERPOINT_2;
  284. case TEXT_TYPE:
  285. return CommonDefine.FileType_TXT;
  286. case RTF_TYPE:
  287. return CommonDefine.FileType_RTF;
  288. case CSV_TYPE:
  289. return CommonDefine.FileType_CSV;
  290. case HTML_TYPE:
  291. return CommonDefine.FileType_HTML_1;
  292. case IMAGE_TYPE:
  293. return ".jpg";
  294. case IMAGE_TYPE_PNG:
  295. return ".png";
  296. case IMAGE_TYPE_BMP:
  297. return ".bmp";
  298. case IMAGE_TYPE_HEIF:
  299. return CommonDefine.FileType_HEIF;
  300. default:
  301. char c = 65535;
  302. if (str.hashCode() == -1004747228 && str.equals(CommonDefine.CSV_TYPE)) {
  303. c = 0;
  304. }
  305. if (c != 0) {
  306. return null;
  307. }
  308. return CommonDefine.FileType_CSV;
  309. }
  310. }
  311. public static String getExtType(String str) {
  312. if (str == null) {
  313. return null;
  314. }
  315. String lowerCase = str.toLowerCase(Locale.ENGLISH);
  316. switch (ExtType.toExtType(lowerCase)) {
  317. case FileType_PDF:
  318. return "application/pdf";
  319. case FileType_WORD_1:
  320. return CommonDefine.DOC_TYPE_1;
  321. case FileType_WORD_2:
  322. return CommonDefine.DOCX_TYPE_2;
  323. case FileType_EXCEL_1:
  324. return CommonDefine.EXCEL_TYPE_1;
  325. case FileType_EXCEL_2:
  326. return CommonDefine.EXCEL_TYPE_2;
  327. case FileType_POWERPOINT_1:
  328. return CommonDefine.POWERPOINT_TYPE_1;
  329. case FileType_POWERPOINT_2:
  330. return CommonDefine.POWERPOINT_TYPE_2;
  331. case FileType_TXT:
  332. return CommonDefine.TEXT_TYPE;
  333. case FileType_RTF:
  334. return CommonDefine.RTF_TYPE;
  335. case FileType_CSV:
  336. return CommonDefine.CSV_TYPE;
  337. case FileType_HTML_1:
  338. return CommonDefine.HTML_TYPE;
  339. case FileType_HTML_2:
  340. return CommonDefine.HTML_TYPE;
  341. case FileType_JPG:
  342. case FileType_JPEG:
  343. return "image/jpeg";
  344. case FileType_PNG:
  345. return "image/png";
  346. case FileType_BMP:
  347. return CommonDefine.IMAGE_TYPE_BMP;
  348. case FileType_HEIF:
  349. return CommonDefine.IMAGE_TYPE_HEIF;
  350. default:
  351. return null;
  352. }
  353. }
  354. public static boolean isGConvertFile(String str) {
  355. String extention;
  356. if (str == null || (extention = getExtention(str)) == null) {
  357. return false;
  358. }
  359. String lowerCase = extention.toLowerCase(Locale.ENGLISH);
  360. switch (ExtType.toExtType(lowerCase)) {
  361. case FileType_WORD_1:
  362. case FileType_WORD_2:
  363. case FileType_EXCEL_1:
  364. case FileType_EXCEL_2:
  365. case FileType_POWERPOINT_1:
  366. case FileType_POWERPOINT_2:
  367. case FileType_TXT:
  368. case FileType_RTF:
  369. case FileType_CSV:
  370. case FileType_HTML_1:
  371. case FileType_HTML_2:
  372. return true;
  373. default:
  374. return false;
  375. }
  376. }
  377. public static boolean isPhotoFile(String str) {
  378. String extention;
  379. if (str == null || (extention = getExtention(str)) == null || getExtType(extention) == null) {
  380. return false;
  381. }
  382. switch (MimeType.toMimeType(r3)) {
  383. case IMAGE_TYPE:
  384. case IMAGE_TYPE_PNG:
  385. case IMAGE_TYPE_BMP:
  386. return true;
  387. case IMAGE_TYPE_HEIF:
  388. if (Build.VERSION.SDK_INT >= 28) {
  389. return true;
  390. }
  391. return false;
  392. default:
  393. return false;
  394. }
  395. }
  396. public static String makeTempFileName(String str) throws FileNotFoundException {
  397. String valueOf = String.valueOf(System.currentTimeMillis());
  398. String mimeExt = getMimeExt(str);
  399. if (mimeExt != null) {
  400. return valueOf + mimeExt;
  401. }
  402. throw new FileNotFoundException();
  403. }
  404. public static boolean isECConvertFile(String str) {
  405. String extention;
  406. if (str == null || (extention = getExtention(str)) == null) {
  407. return false;
  408. }
  409. String lowerCase = extention.toLowerCase(Locale.ENGLISH);
  410. switch (ExtType.toExtType(lowerCase)) {
  411. case FileType_WORD_1:
  412. case FileType_WORD_2:
  413. case FileType_EXCEL_1:
  414. case FileType_EXCEL_2:
  415. case FileType_POWERPOINT_1:
  416. case FileType_POWERPOINT_2:
  417. return true;
  418. default:
  419. return false;
  420. }
  421. }
  422. public static boolean checkMimeType(String str, String str2) {
  423. return str2 != null && str2.equalsIgnoreCase(getExtType(getExtention(str)));
  424. }
  425. public static String getRealMimeType(String str) {
  426. BitmapFactory.Options options = new BitmapFactory.Options();
  427. options.inJustDecodeBounds = true;
  428. BitmapFactory.decodeFile(str, options);
  429. return options.outMimeType;
  430. }
  431. public static String getRemoteOperationUUID(Context context) {
  432. String prefString = getPrefString(context, CommonDefine.DEVICE_INFO, CommonDefine.REMOTE_OPERATION_UUID);
  433. if (!"".equals(prefString)) {
  434. return prefString;
  435. }
  436. String str = "urn:uuid:" + UUID.randomUUID().toString();
  437. savePref(context, CommonDefine.DEVICE_INFO, CommonDefine.REMOTE_OPERATION_UUID, str);
  438. return str;
  439. }
  440. public static boolean isMediaMounted() {
  441. return "mounted".equals(Environment.getExternalStorageState());
  442. }
  443. @TargetApi(11)
  444. public static void setFInishOnTOuchOutside(Activity activity, boolean z) {
  445. if (Build.VERSION.SDK_INT >= 11) {
  446. activity.setFinishOnTouchOutside(z);
  447. }
  448. }
  449. public static void setDrawble2TextView(Context context, TextView textView, int i) {
  450. Drawable drawable = context.getResources().getDrawable(i);
  451. int textSize = (textView.getTextSize() * 1.5f);
  452. drawable.setBounds(0, 0, textSize, textSize);
  453. textView.setCompoundDrawables(drawable, (Drawable) null, (Drawable) null, (Drawable) null);
  454. }
  455. /* JADX WARNING: Code restructure failed: missing block: B:11:0x002e, code lost:
  456. if (r4 == null) goto L_0x004f;
  457. */
  458. /* JADX WARNING: Code restructure failed: missing block: B:14:?, code lost:
  459. r4.close();
  460. */
  461. /* JADX WARNING: Code restructure failed: missing block: B:29:0x004c, code lost:
  462. if (r4 == null) goto L_0x004f;
  463. */
  464. /* JADX WARNING: Removed duplicated region for block: B:27:0x0049 A[SYNTHETIC, Splitter:B:27:0x0049] */
  465. /* JADX WARNING: Removed duplicated region for block: B:36:0x0057 A[SYNTHETIC, Splitter:B:36:0x0057] */
  466. /* JADX WARNING: Removed duplicated region for block: B:40:0x005c A[SYNTHETIC, Splitter:B:40:0x005c] */
  467. /* Code decompiled incorrectly, please refer to instructions dump. */
  468. public static java.lang.String getAssetsFileContents(android.content.Context r4, java.lang.String r5) {
  469. /*
  470. java.lang.StringBuffer r0 = new java.lang.StringBuffer
  471. r0.<init>()
  472. r1 = 255(0xff, float:3.57E-43)
  473. byte[] r1 = new byte[r1]
  474. r1 = 0
  475. android.content.res.AssetManager r4 = r4.getAssets() // Catch:{ IOException -> 0x0041, all -> 0x003e }
  476. java.io.InputStream r4 = r4.open(r5) // Catch:{ IOException -> 0x0041, all -> 0x003e }
  477. java.io.BufferedReader r5 = new java.io.BufferedReader // Catch:{ IOException -> 0x003c }
  478. java.io.InputStreamReader r2 = new java.io.InputStreamReader // Catch:{ IOException -> 0x003c }
  479. r2.<init>(r4) // Catch:{ IOException -> 0x003c }
  480. r5.<init>(r2) // Catch:{ IOException -> 0x003c }
  481. L_0x001c:
  482. java.lang.String r1 = r5.readLine() // Catch:{ IOException -> 0x0037, all -> 0x0034 }
  483. if (r1 == 0) goto L_0x002b
  484. r0.append(r1) // Catch:{ IOException -> 0x0037, all -> 0x0034 }
  485. java.lang.String r1 = "\n"
  486. r0.append(r1) // Catch:{ IOException -> 0x0037, all -> 0x0034 }
  487. goto L_0x001c
  488. L_0x002b:
  489. r5.close() // Catch:{ IOException -> 0x002e }
  490. L_0x002e:
  491. if (r4 == 0) goto L_0x004f
  492. L_0x0030:
  493. r4.close() // Catch:{ IOException -> 0x004f }
  494. goto L_0x004f
  495. L_0x0034:
  496. r0 = move-exception
  497. r1 = r5
  498. goto L_0x0055
  499. L_0x0037:
  500. r1 = move-exception
  501. r3 = r1
  502. r1 = r5
  503. r5 = r3
  504. goto L_0x0044
  505. L_0x003c:
  506. r5 = move-exception
  507. goto L_0x0044
  508. L_0x003e:
  509. r0 = move-exception
  510. r4 = r1
  511. goto L_0x0055
  512. L_0x0041:
  513. r4 = move-exception
  514. r5 = r4
  515. r4 = r1
  516. L_0x0044:
  517. r5.printStackTrace() // Catch:{ all -> 0x0054 }
  518. if (r1 == 0) goto L_0x004c
  519. r1.close() // Catch:{ IOException -> 0x004c }
  520. L_0x004c:
  521. if (r4 == 0) goto L_0x004f
  522. goto L_0x0030
  523. L_0x004f:
  524. java.lang.String r4 = r0.toString()
  525. return r4
  526. L_0x0054:
  527. r0 = move-exception
  528. L_0x0055:
  529. if (r1 == 0) goto L_0x005a
  530. r1.close() // Catch:{ IOException -> 0x005a }
  531. L_0x005a:
  532. if (r4 == 0) goto L_0x005f
  533. r4.close() // Catch:{ IOException -> 0x005f }
  534. L_0x005f:
  535. throw r0
  536. */
  537. throw new UnsupportedOperationException("Method not decompiled: epson.common.Utils.getAssetsFileContents(android.content.Context, java.lang.String):java.lang.String");
  538. }
  539. /* JADX WARNING: Removed duplicated region for block: B:19:0x00fc */
  540. /* Code decompiled incorrectly, please refer to instructions dump. */
  541. public static java.lang.String[] replaceMessage(java.lang.Integer[] r5, int r6, android.content.Context r7) {
  542. /*
  543. java.lang.StringBuilder r0 = new java.lang.StringBuilder
  544. r0.<init>()
  545. java.lang.String r1 = " currentError = "
  546. r0.append(r1)
  547. r0.append(r6)
  548. java.lang.String r0 = r0.toString()
  549. com.epson.mobilephone.common.EpLog.m69d(r0)
  550. r0 = 3
  551. java.lang.Integer[] r0 = new java.lang.Integer[r0]
  552. r1 = 0
  553. r2 = r5[r1]
  554. r0[r1] = r2
  555. r2 = 1
  556. r3 = r5[r2]
  557. r0[r2] = r3
  558. r3 = 2
  559. r5 = r5[r3]
  560. r0[r3] = r5
  561. r5 = -11005(0xffffffffffffd503, float:NaN)
  562. if (r6 == r5) goto L_0x00c7
  563. r5 = 59
  564. if (r6 == r5) goto L_0x005b
  565. switch(r6) {
  566. case 6: goto L_0x0047;
  567. case 7: goto L_0x0033;
  568. default: goto L_0x0031;
  569. }
  570. L_0x0031:
  571. goto L_0x00d9
  572. L_0x0033:
  573. r5 = 2131624436(0x7f0e01f4, float:1.8876052E38)
  574. java.lang.Integer r5 = java.lang.Integer.valueOf(r5)
  575. r0[r2] = r5
  576. r5 = 2131624435(0x7f0e01f3, float:1.887605E38)
  577. java.lang.Integer r5 = java.lang.Integer.valueOf(r5)
  578. r0[r1] = r5
  579. goto L_0x00d9
  580. L_0x0047:
  581. r5 = 2131624398(0x7f0e01ce, float:1.8875975E38)
  582. java.lang.Integer r5 = java.lang.Integer.valueOf(r5)
  583. r0[r2] = r5
  584. r5 = 2131624397(0x7f0e01cd, float:1.8875973E38)
  585. java.lang.Integer r5 = java.lang.Integer.valueOf(r5)
  586. r0[r1] = r5
  587. goto L_0x00d9
  588. L_0x005b:
  589. com.epson.mobilephone.common.escpr.EscprLib r5 = com.epson.mobilephone.common.escpr.EscprLib.getInstance()
  590. com.epson.mobilephone.common.escpr.EPS_REDYINKINFO r6 = new com.epson.mobilephone.common.escpr.EPS_REDYINKINFO
  591. r6.<init>()
  592. int r5 = r5.epsGetReadyPrintStatus(r6)
  593. r4 = 2131625264(0x7f0e0530, float:1.8877731E38)
  594. java.lang.Integer r4 = java.lang.Integer.valueOf(r4)
  595. r0[r2] = r4
  596. r4 = 2131625265(0x7f0e0531, float:1.8877733E38)
  597. java.lang.Integer r4 = java.lang.Integer.valueOf(r4)
  598. r0[r1] = r4
  599. if (r5 != 0) goto L_0x00c4
  600. int r5 = r6.subscriptionError
  601. switch(r5) {
  602. case 1: goto L_0x00b1;
  603. case 2: goto L_0x009e;
  604. default: goto L_0x0081;
  605. }
  606. L_0x0081:
  607. java.lang.StringBuilder r5 = new java.lang.StringBuilder
  608. r5.<init>()
  609. java.lang.String r4 = " code = "
  610. r5.append(r4)
  611. int r4 = r6.subscriptionErrorCode
  612. r5.append(r4)
  613. java.lang.String r5 = r5.toString()
  614. com.epson.mobilephone.common.EpLog.m77i(r5)
  615. int r5 = r6.subscriptionErrorCode
  616. java.lang.String r5 = java.lang.String.valueOf(r5)
  617. goto L_0x00da
  618. L_0x009e:
  619. r5 = 2131625262(0x7f0e052e, float:1.8877727E38)
  620. java.lang.Integer r5 = java.lang.Integer.valueOf(r5)
  621. r0[r2] = r5
  622. r5 = 2131625263(0x7f0e052f, float:1.887773E38)
  623. java.lang.Integer r5 = java.lang.Integer.valueOf(r5)
  624. r0[r1] = r5
  625. goto L_0x00d9
  626. L_0x00b1:
  627. r5 = 2131625260(0x7f0e052c, float:1.8877723E38)
  628. java.lang.Integer r5 = java.lang.Integer.valueOf(r5)
  629. r0[r2] = r5
  630. r5 = 2131625261(0x7f0e052d, float:1.8877725E38)
  631. java.lang.Integer r5 = java.lang.Integer.valueOf(r5)
  632. r0[r1] = r5
  633. goto L_0x00d9
  634. L_0x00c4:
  635. java.lang.String r5 = "unknown"
  636. goto L_0x00da
  637. L_0x00c7:
  638. r5 = 2131624364(0x7f0e01ac, float:1.8875906E38)
  639. java.lang.Integer r5 = java.lang.Integer.valueOf(r5)
  640. r0[r2] = r5
  641. r5 = 2131624367(0x7f0e01af, float:1.8875912E38)
  642. java.lang.Integer r5 = java.lang.Integer.valueOf(r5)
  643. r0[r1] = r5
  644. L_0x00d9:
  645. r5 = 0
  646. L_0x00da:
  647. java.lang.String[] r6 = new java.lang.String[r3]
  648. r3 = r0[r1]
  649. int r3 = r3.intValue()
  650. java.lang.String r3 = r7.getString(r3)
  651. r6[r1] = r3
  652. java.lang.StringBuilder r1 = new java.lang.StringBuilder
  653. r1.<init>()
  654. r0 = r0[r2]
  655. int r0 = r0.intValue()
  656. java.lang.String r7 = r7.getString(r0)
  657. r1.append(r7)
  658. if (r5 != 0) goto L_0x00fe
  659. java.lang.String r5 = ""
  660. L_0x00fe:
  661. r1.append(r5)
  662. java.lang.String r5 = r1.toString()
  663. r6[r2] = r5
  664. return r6
  665. */
  666. throw new UnsupportedOperationException("Method not decompiled: epson.common.Utils.replaceMessage(java.lang.Integer[], int, android.content.Context):java.lang.String[]");
  667. }
  668. }