From 0016f3e0b03de31d71bd6574feb84326382c10b8 Mon Sep 17 00:00:00 2001 From: threethan Date: Sat, 18 Nov 2023 08:12:23 -0500 Subject: [PATCH 1/3] Upgrade AGP for latest android studio --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 2737bba..18f9b67 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.4.0-beta03' + classpath 'com.android.tools.build:gradle:7.4.2' } } From a303a76229adcb7c296790f1a17c3657a4216b5c Mon Sep 17 00:00:00 2001 From: threethan Date: Sun, 19 Nov 2023 22:07:19 -0500 Subject: [PATCH 2/3] Fix a bug where icon and text-two would be hidden when updating a setting --- app/src/main/java/com/apk/editor/adapters/SettingsAdapter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/com/apk/editor/adapters/SettingsAdapter.java b/app/src/main/java/com/apk/editor/adapters/SettingsAdapter.java index e230429..b5f034f 100644 --- a/app/src/main/java/com/apk/editor/adapters/SettingsAdapter.java +++ b/app/src/main/java/com/apk/editor/adapters/SettingsAdapter.java @@ -45,6 +45,7 @@ public void onBindViewHolder(@NonNull SettingsAdapter.ViewHolder holder, int pos holder.Title.setText(data.get(position).getTextOne()); if (data.get(position).getTextTwo() != null) { holder.Description.setText(data.get(position).getTextTwo()); + holder.Description.setVisibility(View.VISIBLE); } else { holder.Description.setVisibility(View.GONE); } @@ -54,6 +55,7 @@ public void onBindViewHolder(@NonNull SettingsAdapter.ViewHolder holder, int pos holder.mIcon.setColorFilter(sThemeUtils.isDarkTheme(holder.Title.getContext()) ? Color.WHITE : Color.BLACK); if (data.get(position).getIcon() != null) { holder.mIcon.setImageDrawable(data.get(position).getIcon()); + holder.Description.setVisibility(View.VISIBLE); } else { holder.mIcon.setVisibility(View.GONE); } From 0ad83046925bcd88c7a3b0c30b9fbb4065732e4f Mon Sep 17 00:00:00 2001 From: threethan Date: Sun, 19 Nov 2023 22:10:10 -0500 Subject: [PATCH 3/3] Add option to disable dex-to-smali decompilation --- .../editor/activities/SettingsActivity.java | 15 ++++++++---- .../com/apk/editor/utils/AppSettings.java | 8 +++++++ .../apk/editor/utils/tasks/ExploreAPK.java | 23 +++++++++++-------- app/src/main/res/values/strings.xml | 3 +++ 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/apk/editor/activities/SettingsActivity.java b/app/src/main/java/com/apk/editor/activities/SettingsActivity.java index 1404924..727f1ac 100644 --- a/app/src/main/java/com/apk/editor/activities/SettingsActivity.java +++ b/app/src/main/java/com/apk/editor/activities/SettingsActivity.java @@ -53,6 +53,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { mData.add(new sSerializableItems(sCommonUtils.getDrawable(R.drawable.ic_theme, this), getString(R.string.app_theme), sThemeUtils.getAppTheme(this), null)); mData.add(new sSerializableItems(sCommonUtils.getDrawable(R.drawable.ic_translate, this), getString(R.string.language), AppSettings.getLanguage(this), null)); mData.add(new sSerializableItems(null, getString(R.string.settings_general), null, null)); + mData.add(new sSerializableItems(sCommonUtils.getDrawable(R.drawable.ic_explore, this), getString(R.string.decompile_setting), AppSettings.getDecompileSettingString(this), null)); mData.add(new sSerializableItems(sCommonUtils.getDrawable(R.drawable.ic_projects, this), getString(R.string.project_exist_action), AppSettings.getProjectExistAction(this), null)); mData.add(new sSerializableItems(sCommonUtils.getDrawable(R.drawable.ic_export, this), getString(R.string.export_path_apks), AppSettings.getExportAPKsPath(this), null)); mData.add(new sSerializableItems(sCommonUtils.getDrawable(R.drawable.ic_export, this), getString(R.string.export_path_resources), AppSettings.getExportPath(this), null)); @@ -72,6 +73,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { } else if (position == 2) { AppSettings.setLanguage(this); } else if (position == 4) { + sCommonUtils.saveBoolean("decompileSetting", !AppSettings.getDecompileSetting(this), this); + mData.set(position, new sSerializableItems(sCommonUtils.getDrawable(R.drawable.ic_explore, this), getString(R.string.decompile_setting), AppSettings.getDecompileSettingString(this), null)); + mRecycleViewAdapter.notifyItemChanged(position); + } else if (position == 5) { new sSingleChoiceDialog(R.drawable.ic_projects, getString(R.string.project_exist_action), AppSettings.getProjectExitingMenu(this), AppSettings.getProjectExitingMenuPosition(this), this) { @@ -92,7 +97,7 @@ public void onItemSelected(int itemPosition) { } } }.show(); - } else if (position == 5) { + } else if (position == 6) { if (Build.VERSION.SDK_INT < 29 && sPermissionUtils.isPermissionDenied(android.Manifest.permission.WRITE_EXTERNAL_STORAGE, this)) { sPermissionUtils.requestPermission( new String[] { @@ -124,7 +129,7 @@ public void onItemSelected(int itemPosition) { }.show(); } } - } else if (position == 6) { + } else if (position == 7) { if (Build.VERSION.SDK_INT < 29 && sPermissionUtils.isPermissionDenied(android.Manifest.permission.WRITE_EXTERNAL_STORAGE, this)) { sPermissionUtils.requestPermission( new String[] { @@ -160,7 +165,7 @@ public void onItemSelected(int itemPosition) { }.show(); } } - } else if (APKEditorUtils.isFullVersion(this) && position == 8) { + } else if (APKEditorUtils.isFullVersion(this) && position == 9) { new sSingleChoiceDialog(R.drawable.ic_android, getString(R.string.export_options), AppSettings.getExportingAPKMenu(this), AppSettings.getExportingAPKsPosition(this), this) { @@ -187,7 +192,7 @@ public void onItemSelected(int itemPosition) { } } }.show(); - } else if (APKEditorUtils.isFullVersion(this) && position == 9) { + } else if (APKEditorUtils.isFullVersion(this) && position == 10) { new sSingleChoiceDialog(R.drawable.ic_installer, getString(R.string.installer_action), AppSettings.getInstallerMenu(this), AppSettings.getInstallerMenuPosition(this), this) { @@ -214,7 +219,7 @@ public void onItemSelected(int itemPosition) { } } }.show(); - } else if (APKEditorUtils.isFullVersion(this) && position == 10) { + } else if (APKEditorUtils.isFullVersion(this) && position == 11) { new sSingleChoiceDialog(R.drawable.ic_key, getString(R.string.sign_apk_with), new String[] { getString(R.string.sign_apk_default), diff --git a/app/src/main/java/com/apk/editor/utils/AppSettings.java b/app/src/main/java/com/apk/editor/utils/AppSettings.java index 8095f63..f0d59ff 100644 --- a/app/src/main/java/com/apk/editor/utils/AppSettings.java +++ b/app/src/main/java/com/apk/editor/utils/AppSettings.java @@ -198,6 +198,14 @@ public static String getAPKs(Context context) { } } + public static String getDecompileSettingString(Context context) { + return context.getString(getDecompileSetting(context) ? + R.string.decompile_on : R.string.decompile_off); + } + public static Boolean getDecompileSetting(Context context) { + return sCommonUtils.getBoolean("decompileSetting", true, context); + } + public static String getProjectExistAction(Context context) { if (sCommonUtils.getString("projectAction", null, context) != null) { return sCommonUtils.getString("projectAction", null, context); diff --git a/app/src/main/java/com/apk/editor/utils/tasks/ExploreAPK.java b/app/src/main/java/com/apk/editor/utils/tasks/ExploreAPK.java index 2affdb6..1b09848 100644 --- a/app/src/main/java/com/apk/editor/utils/tasks/ExploreAPK.java +++ b/app/src/main/java/com/apk/editor/utils/tasks/ExploreAPK.java @@ -14,6 +14,7 @@ import com.apk.editor.activities.APKTasksActivity; import com.apk.editor.utils.APKEditorUtils; import com.apk.editor.utils.APKExplorer; +import com.apk.editor.utils.AppSettings; import com.apk.editor.utils.Common; import com.apk.editor.utils.DexToSmali; @@ -107,16 +108,18 @@ public void doInBackground() { } APKEditorUtils.unzip(mPackageName != null ? sPackageUtils.getSourceDir(mPackageName, mContext) : mAPKFile.getAbsolutePath(), mExplorePath.getAbsolutePath()); // Decompile dex file(s) - for (File files : Objects.requireNonNull(mExplorePath.listFiles())) { - if (files.getName().startsWith("classes") && files.getName().endsWith(".dex") && !Common.isCancelled()) { - sFileUtils.mkdir(mBackUpPath); - sFileUtils.copy(files, new File(mBackUpPath, files.getName())); - sFileUtils.delete(files); - File mDexExtractPath = new File(mExplorePath, files.getName()); - sFileUtils.mkdir(mDexExtractPath); - Common.setStatus(mContext.getString(R.string.decompiling, files.getName())); - new DexToSmali(false, mPackageName != null ? new File(sPackageUtils.getSourceDir(mPackageName, mContext)) - : mAPKFile, mDexExtractPath, 0, files.getName()).execute(); + if (AppSettings.getDecompileSetting(mContext)) { + for (File files : Objects.requireNonNull(mExplorePath.listFiles())) { + if (files.getName().startsWith("classes") && files.getName().endsWith(".dex") && !Common.isCancelled()) { + sFileUtils.mkdir(mBackUpPath); + sFileUtils.copy(files, new File(mBackUpPath, files.getName())); + sFileUtils.delete(files); + File mDexExtractPath = new File(mExplorePath, files.getName()); + sFileUtils.mkdir(mDexExtractPath); + Common.setStatus(mContext.getString(R.string.decompiling, files.getName())); + new DexToSmali(false, mPackageName != null ? new File(sPackageUtils.getSourceDir(mPackageName, mContext)) + : mAPKFile, mDexExtractPath, 0, files.getName()).execute(); + } } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4271b61..662d906 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -24,6 +24,9 @@ Clearing Cache… Copying \'%s\'… Decompiling \'%s\'… + Code Decompilation + Decompile code to smali + Don\'t decompile code (faster) Delete Delete %s? Delete folder