0
0
mirror of https://github.com/TrianguloY/UrlChecker.git synced 2024-09-19 20:02:16 +02:00

require 'save' after' clear' in the log module

avoid clearing the log if pressed by mistake (you need to press save afterwards to really clear it)
This commit is contained in:
TrianguloY 2022-08-29 19:31:43 +02:00
parent eab3a5ddc2
commit 54b85c26e5
2 changed files with 14 additions and 5 deletions

View File

@ -58,7 +58,7 @@ public class JsonEditor {
.show();
// prepare more dialog
// these are configured here to allow auto-closing the dialog when they are pressed
// these are configured here to disable automatic auto-closing when they are pressed
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(v -> {
try {
if (onSave.onSave(new JSONObject(data.getText().toString()))) {

View File

@ -131,12 +131,21 @@ class LogConfig extends AModuleConfig {
.setPositiveButton(R.string.save, (dialog, which) ->
log.set(content.getText().toString())
)
.setNeutralButton(R.string.clear, (dialog, which) ->
log.set("")
);
.setNeutralButton(R.string.clear, null); // set below
}
// show
builder.show();
AlertDialog dialog = builder.show();
// prepare more dialog
// these are configured here to disable automatic auto-closing when they are pressed
if (editable) {
// editable: configure clear button
dialog.getButton(AlertDialog.BUTTON_NEUTRAL).setOnClickListener(v -> {
// clear content
content.setText("");
});
}
}
}