Skip to content

Commit e0e8bfa

Browse files
committed
Add Option to disable Resource Reload Confimation
1 parent dc5945a commit e0e8bfa

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/main/java/the/bytecode/club/bytecodeviewer/SettingsSerializer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ else if (BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.view
207207
save(Configuration.python3Extra);
208208
save(BytecodeViewer.viewer.getMinSdkVersion());
209209
save(BytecodeViewer.viewer.printLineNumbers.isSelected());
210+
save(BytecodeViewer.viewer.disableReloadConfirmation.isSelected());
210211
}
211212
catch (Exception e)
212213
{
@@ -415,6 +416,7 @@ public static void loadSettings()
415416
Configuration.python3Extra = asBoolean(140);
416417
BytecodeViewer.viewer.minSdkVersionSpinner.setValue(asInt(141));
417418
BytecodeViewer.viewer.printLineNumbers.setSelected(asBoolean(142));
419+
BytecodeViewer.viewer.disableReloadConfirmation.setSelected(asBoolean(143));
418420
}
419421
catch (IndexOutOfBoundsException e)
420422
{

src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ public class MainViewerGUI extends JFrame
166166
public final JCheckBoxMenuItem decodeAPKResources = new TranslatedJCheckBoxMenuItem("Decode APK Resources", TranslatedComponents.DECODE_APK_RESOURCES);
167167
public final JCheckBoxMenuItem synchronizedViewing = new TranslatedJCheckBoxMenuItem("Synchronized Viewing", TranslatedComponents.SYNCHRONIZED_VIEWING);
168168
public final JCheckBoxMenuItem showClassMethods = new TranslatedJCheckBoxMenuItem("Show Class Methods", TranslatedComponents.SHOW_CLASS_METHODS);
169+
public final JCheckBoxMenuItem disableReloadConfirmation = new TranslatedJCheckBoxMenuItem("Disable Reload Confirmation", TranslatedComponents.DISABLE_RELOAD_CONFIRMATION);
169170

170171
//apk conversion settings
171172
public final JMenu apkConversionSecondaryMenu = new TranslatedJMenu("APK Conversion/Decoding", TranslatedComponents.APK_CONVERSION_DECODING);
@@ -405,6 +406,7 @@ public void buildSettingsMenu()
405406
settingsMainMenu.add(compileOnSave);
406407
settingsMainMenu.add(autoCompileOnRefresh);
407408
settingsMainMenu.add(refreshOnChange);
409+
settingsMainMenu.add(disableReloadConfirmation);
408410

409411
settingsMainMenu.add(new JSeparator());
410412
settingsMainMenu.add(updateCheck);
@@ -747,6 +749,7 @@ public void defaultSettings()
747749
{
748750
compileOnSave.setSelected(false);
749751
autoCompileOnRefresh.setSelected(true);
752+
disableReloadConfirmation.setSelected(false);
750753
decodeAPKResources.setSelected(true);
751754
updateCheck.setSelected(true);
752755
forcePureAsciiAsText.setSelected(true);
@@ -908,9 +911,14 @@ public void runResources()
908911

909912
public void reloadResources()
910913
{
911-
MultipleChoiceDialog dialog = new MultipleChoiceDialog(TranslatedStrings.RELOAD_RESOURCES_TITLE.toString(), TranslatedStrings.RELOAD_RESOURCES_CONFIRM.toString(), new String[]{TranslatedStrings.YES.toString(), TranslatedStrings.NO.toString()});
914+
boolean doRefresh = disableReloadConfirmation.isSelected();
915+
if (!doRefresh)
916+
{
917+
MultipleChoiceDialog dialog = new MultipleChoiceDialog(TranslatedStrings.RELOAD_RESOURCES_TITLE.toString(), TranslatedStrings.RELOAD_RESOURCES_CONFIRM.toString(), new String[]{TranslatedStrings.YES.toString(), TranslatedStrings.NO.toString()});
918+
doRefresh = dialog.promptChoice() == 0;
919+
}
912920

913-
if (dialog.promptChoice() == 0)
921+
if (doRefresh)
914922
{
915923
LazyNameUtil.reset();
916924
List<File> reopen = new ArrayList<>();

src/main/java/the/bytecode/club/bytecodeviewer/translation/TranslatedComponents.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public enum TranslatedComponents
100100
COMPILE_ON_SAVE,
101101
COMPILE_ON_REFRESH,
102102
REFRESH_ON_VIEW_CHANGE,
103+
DISABLE_RELOAD_CONFIRMATION,
103104
DECODE_APK_RESOURCES,
104105
APK_CONVERSION,
105106
APK_CONVERSION_DECODING,

0 commit comments

Comments
 (0)