APK Export Cleanup

This commit is contained in:
Konloch 2021-06-27 14:23:23 -07:00
parent b13c957fcc
commit 6031154319

View file

@ -33,7 +33,6 @@ public class APKExport implements Exporter
return; return;
} }
//if theres only one file in the container don't bother asking
List<FileContainer> containers = BytecodeViewer.getFiles(); List<FileContainer> containers = BytecodeViewer.getFiles();
List<FileContainer> validContainers = new ArrayList<>(); List<FileContainer> validContainers = new ArrayList<>();
List<String> validContainersNames = new ArrayList<>(); List<String> validContainersNames = new ArrayList<>();
@ -52,26 +51,18 @@ public class APKExport implements Exporter
{ {
container = validContainers.get(0); container = validContainers.get(0);
//if theres only one file in the container don't bother asking
if (validContainers.size() >= 2) if (validContainers.size() >= 2)
{ {
JOptionPane pane = new JOptionPane("Which file would you like to export as an APK?"); MultipleChoiceDialogue dialogue = new MultipleChoiceDialogue("Bytecode Viewer - Select APK",
Object[] options = validContainersNames.toArray(new String[0]); "Which file would you like to export as an APK?",
validContainersNames.toArray(new String[0]));
pane.setOptions(options); container = containers.get(dialogue.promptChoice());
JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Select APK");
dialog.setVisible(true);
Object obj = pane.getValue();
int result = -1;
for (int k = 0; k < options.length; k++)
if (options[k].equals(obj))
result = k;
container = containers.get(result);
} }
} else { } else {
BytecodeViewer.showMessage("You can only export as APK from a valid APK file. Make sure " BytecodeViewer.showMessage("You can only export as APK from a valid APK file. Make sure Settings>Decode Resources is ticked on." +
+ "Settings>Decode Resources is ticked on.\n\nTip: Try exporting as DEX, it doesn't rely on " "\n\nTip: Try exporting as DEX, it doesn't rely on decoded APK resources");
+ "decoded APK resources");
return; return;
} }