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

fix clear module button always enabled

This commit is contained in:
TrianguloY 2023-03-23 23:18:22 +01:00
parent f91825d666
commit c00ae74588
2 changed files with 8 additions and 3 deletions

View File

@ -69,7 +69,7 @@ public class MainDialog extends Activity {
public void onNewUrl(UrlData newUrlData) {
// mark as next if nothing else yet
if (updating != 0) {
AndroidUtils.assertError("Don't call onNewUrl while updating, use the onModifyUrl return value");
AndroidUtils.assertError("Don't call onNewUrl while updating, use the onModifyUrl 'setNewUrl' callback");
return;
}
urlData = newUrlData;

View File

@ -109,6 +109,7 @@ class ClearUrlDialog extends AModuleDialog {
private final List<Pair<String, JSONObject>> rules;
private TextView info;
private Button fix;
private String cleared = null;
private Data data = null;
@ -130,7 +131,7 @@ class ClearUrlDialog extends AModuleDialog {
@Override
public void onInitialize(View views) {
info = views.findViewById(R.id.text);
var fix = views.<Button>findViewById(R.id.button);
fix = views.findViewById(R.id.button);
fix.setText(R.string.mClear_clear);
fix.setOnClickListener(v -> clear());
}
@ -297,15 +298,19 @@ class ClearUrlDialog extends AModuleDialog {
@Override
public void onDisplayUrl(UrlData urlData) {
// update button
fix.setEnabled(data.enabled);
// update text
if (data.info.isEmpty()) {
// nothing found
info.setText(R.string.mClear_noRules);
setVisibility(false);
} else {
// something found
info.setText(data.info);
setVisibility(true);
}
if (data.color != 0) AndroidUtils.setRoundedColor(data.color, info);
else AndroidUtils.clearRoundedColor(info);
}