feat(gui): add button to go to Android Manifest (PR #2296)

* feat: Add button to go to Android Manifest

* fix: Change the text from 'Go to Manifest' to 'Go to AndroidManifest.xml' and replace icon source
This commit is contained in:
xiaojye
2024-10-11 00:11:08 +08:00
committed by GitHub
parent b26abdc851
commit 3ed2df828f
12 changed files with 34 additions and 0 deletions
@@ -1009,6 +1009,20 @@ public class MainWindow extends JFrame {
}
}
public void goToAndroidManifest() {
ResourceFile androidManifest = AndroidManifestParser.getAndroidManifest(getWrapper().getResources());
if (androidManifest == null) {
JOptionPane.showMessageDialog(MainWindow.this,
NLS.str("error_dialog.not_found", "AndroidManifest.xml"),
NLS.str("error_dialog.title"),
JOptionPane.ERROR_MESSAGE);
return;
}
JResource res = new JResource(androidManifest, androidManifest.getDeobfName(), JResource.JResType.FILE);
tabsController.selectTab(res);
}
private void initMenuAndToolbar() {
JadxGuiAction openAction = new JadxGuiAction(ActionModel.OPEN, this::openFileDialog);
JadxGuiAction openProject = new JadxGuiAction(ActionModel.OPEN_PROJECT, this::openProjectDialog);
@@ -1078,6 +1092,7 @@ public class MainWindow extends JFrame {
this::goToMainActivity);
JadxGuiAction goToApplicationAction = new JadxGuiAction(ActionModel.GO_TO_APPLICATION,
this::goToApplication);
JadxGuiAction goToAndroidManifestAction = new JadxGuiAction(ActionModel.GO_TO_ANDROID_MANIFEST, this::goToAndroidManifest);
JadxGuiAction decompileAllAction = new JadxGuiAction(ActionModel.DECOMPILE_ALL, this::requestFullDecompilation);
JadxGuiAction resetCacheAction = new JadxGuiAction(ActionModel.RESET_CACHE, this::resetCodeCache);
JadxGuiAction deobfAction = new JadxGuiAction(ActionModel.DEOBF, this::toggleDeobfuscation);
@@ -1140,6 +1155,7 @@ public class MainWindow extends JFrame {
nav.add(commentSearchAction);
nav.add(goToMainActivityAction);
nav.add(goToApplicationAction);
nav.add(goToAndroidManifestAction);
nav.addSeparator();
nav.add(backAction);
nav.add(forwardAction);
@@ -1209,6 +1225,7 @@ public class MainWindow extends JFrame {
toolbar.add(commentSearchAction);
toolbar.add(goToMainActivityAction);
toolbar.add(goToApplicationAction);
toolbar.add(goToAndroidManifestAction);
toolbar.addSeparator();
toolbar.add(backAction);
toolbar.add(forwardAction);
@@ -1238,6 +1255,7 @@ public class MainWindow extends JFrame {
commentSearchAction.setEnabled(loaded);
goToMainActivityAction.setEnabled(loaded);
goToApplicationAction.setEnabled(loaded);
goToAndroidManifestAction.setEnabled(loaded);
backAction.setEnabled(loaded);
backVariantAction.setEnabled(loaded);
forwardAction.setEnabled(loaded);
@@ -55,6 +55,8 @@ public enum ActionModel {
Shortcut.keyboard(KeyEvent.VK_M, UiUtils.ctrlButton() | KeyEvent.SHIFT_DOWN_MASK)),
GO_TO_APPLICATION(MENU_TOOLBAR, "menu.go_to_application", "menu.go_to_application", "ui/application",
Shortcut.keyboard(KeyEvent.VK_A, UiUtils.ctrlButton() | KeyEvent.SHIFT_DOWN_MASK)),
GO_TO_ANDROID_MANIFEST(MENU_TOOLBAR, "menu.go_to_android_manifest", "menu.go_to_android_manifest", "ui/androidManifest",
Shortcut.none()),
DECOMPILE_ALL(MENU_TOOLBAR, "menu.decompile_all", "menu.decompile_all", "ui/runAll",
Shortcut.none()),
RESET_CACHE(MENU_TOOLBAR, "menu.reset_cache", "menu.reset_cache", "ui/reset",
@@ -17,6 +17,7 @@ menu.class_search=Klassen-Suche
menu.comment_search=Kommentar suchen
#menu.go_to_main_activity=
#menu.go_to_application=Go to Application
#menu.go_to_android_manifest=Go to AndroidManifest.xml
menu.tools=Tools
#menu.plugins=Plugins
#menu.decompile_all=Decompile all classes
@@ -17,6 +17,7 @@ menu.class_search=Class search
menu.comment_search=Comment search
menu.go_to_main_activity=Go to main Activity
menu.go_to_application=Go to Application
menu.go_to_android_manifest=Go to AndroidManifest.xml
menu.tools=Tools
menu.plugins=Plugins
menu.decompile_all=Decompile all classes
@@ -17,6 +17,7 @@ menu.class_search=Buscar clase
#menu.comment_search=Comment search
#menu.go_to_main_activity=
#menu.go_to_application=Go to Application
#menu.go_to_android_manifest=Go to AndroidManifest.xml
menu.tools=Herramientas
#menu.plugins=Plugins
#menu.decompile_all=Decompile all classes
@@ -17,6 +17,7 @@ menu.class_search=Pencarian Kelas
menu.comment_search=Pencarian Komentar
menu.go_to_main_activity=Pergi ke Activitas Utama
#menu.go_to_application=Go to Application
#menu.go_to_android_manifest=Go to AndroidManifest.xml
menu.tools=Alat
menu.plugins=Plugin
menu.decompile_all=Deskompilasi semua kelas
@@ -17,6 +17,7 @@ menu.class_search=클래스 검색
menu.comment_search=주석 검색
#menu.go_to_main_activity=
#menu.go_to_application=Go to Application
#menu.go_to_android_manifest=Go to AndroidManifest.xml
menu.tools=도구
#menu.plugins=Plugins
#menu.decompile_all=Decompile all classes
@@ -17,6 +17,7 @@ menu.class_search=Buscar por classe
menu.comment_search=Busca por comentário
#menu.go_to_main_activity=
#menu.go_to_application=Go to Application
#menu.go_to_android_manifest=Go to AndroidManifest.xml
menu.tools=Ferramentas
#menu.plugins=Plugins
#menu.decompile_all=Decompile all classes
@@ -17,6 +17,7 @@ menu.class_search=Поиск классов
menu.comment_search=Поиск комментариев
menu.go_to_main_activity=Найти главное Activity
#menu.go_to_application=Go to Application
#menu.go_to_android_manifest=Go to AndroidManifest.xml
menu.tools=Инструменты
menu.plugins=Плагины
menu.decompile_all=Декомпилировать все
@@ -17,6 +17,7 @@ menu.class_search=类名搜索
menu.comment_search=注释搜索
menu.go_to_main_activity=前往主 Activity
#menu.go_to_application=Go to Application
menu.go_to_android_manifest=前往 AndroidManifest.xml
menu.tools=工具
menu.plugins=插件
menu.decompile_all=反编译所有类
@@ -17,6 +17,7 @@ menu.class_search=類別搜尋
menu.comment_search=註解搜尋
menu.go_to_main_activity=前往主 Activity
#menu.go_to_application=Go to Application
menu.go_to_android_manifest=前往 AndroidManifest.xml
menu.tools=工具
menu.plugins=外掛程式
menu.decompile_all=反編譯所有類別
@@ -0,0 +1,5 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="2.5" y="2.5" width="11" height="11" rx="1.5" fill="#2F2936" stroke="#B589EC"/>
<path d="M5.64488 11H4.54688V4.70001H5.97338L7.90388 9.24951L8.01188 9.60051L8.11538 9.24951L10.0054 4.70001H11.4499V11H10.3474V6.51801L10.3609 6.27951L8.40338 11H7.57988L5.63138 6.31101L5.64488 6.51801V11Z" fill="#B589EC"/>
</svg>

After

Width:  |  Height:  |  Size: 543 B