Skip to content

Commit 1c84d03

Browse files
committed
Display all decompilers in list even if unavailable
1 parent 26e6103 commit 1c84d03

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

app/src/main/kotlin/com/njlabs/showjava/activities/decompiler/DecompilerActivity.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import android.text.style.StyleSpan
3232
import android.view.LayoutInflater
3333
import android.view.View
3434
import android.widget.Toast
35+
import androidx.appcompat.app.AlertDialog
3536
import com.google.firebase.analytics.FirebaseAnalytics
3637
import com.njlabs.showjava.Constants
3738
import com.njlabs.showjava.R
@@ -91,9 +92,6 @@ class DecompilerActivity : BaseActivity() {
9192
val decompilerDescriptions = resources.getStringArray(R.array.decompilerDescriptions)
9293

9394
decompilersValues.forEachIndexed { index, decompiler ->
94-
if (!isAvailable(decompiler)) {
95-
return@forEachIndexed
96-
}
9795
val view = LayoutInflater.from(pickerList.context)
9896
.inflate(R.layout.layout_pick_decompiler_list_item, pickerList, false)
9997
view.decompilerName.text = decompilers[index]
@@ -184,6 +182,16 @@ class DecompilerActivity : BaseActivity() {
184182

185183
private fun startProcess(view: View, decompiler: String, decompilerIndex: Int) {
186184

185+
if (!isAvailable(decompiler)) {
186+
AlertDialog.Builder(context)
187+
.setTitle(getString(R.string.decompilerUnavailable))
188+
.setMessage(getString(R.string.decompilerUnavailableExplanation))
189+
.setIcon(R.drawable.ic_error_outline_black)
190+
.setNegativeButton(android.R.string.ok, null)
191+
.show()
192+
return
193+
}
194+
187195
val inputMap = hashMapOf(
188196
"shouldIgnoreLibs" to userPreferences.ignoreLibraries,
189197
"maxAttempts" to userPreferences.maxAttempts,

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@
111111
<string name="startingDexToJar">Starting DEX to JAR Conversion</string>
112112
<string name="shareSource">Share source</string>
113113
<string name="deleteSource">Delete source</string>
114+
<string name="decompilerUnavailable">Decompiler Unavailable</string>
115+
<string name="decompilerUnavailableExplanation">JaDX and Fernflower use newer Java features such as some types of lambda\'s which are not available on pre-N versions of Android.\n\nPlease use CFR instead.</string>
114116
<string name="deleteSourceHistory">Delete source history</string>
115117
<string name="deleteSourceConfirm">Are you sure you want to delete the decompiled source ?</string>
116118
<string name="deleteSourceHistoryConfirm">Are you sure you want to delete source history ?</string>

0 commit comments

Comments
 (0)