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

enabled_by_default setting per module

This commit is contained in:
TrianguloY 2020-08-19 23:51:12 +02:00
parent a63208f7e2
commit fcec4fabf8
3 changed files with 13 additions and 5 deletions

View File

@ -15,6 +15,13 @@ public abstract class AModuleData {
*/
public abstract String getName();
/**
* @return whether this module should be enabled by default
*/
public boolean isEnabledByDefault() {
return true;
}
/**
* Returns the dialog fragment of this module
*

View File

@ -32,13 +32,9 @@ public class ModuleManager {
// ------------------- class -------------------
private static final String PREF_SUFFIX = "_en";
/**
* Status of modules by default (true=enabled, false=disabled)
*/
private static final boolean ENABLED_DEFAULT = true;
public static GenericPref.Bool getEnabledPrefOfModule(AModuleData module, Context cntx) {
final GenericPref.Bool enabledPref = new GenericPref.Bool(module.getId() + PREF_SUFFIX, ENABLED_DEFAULT);
final GenericPref.Bool enabledPref = new GenericPref.Bool(module.getId() + PREF_SUFFIX, module.isEnabledByDefault());
enabledPref.init(cntx);
return enabledPref;
}

View File

@ -38,6 +38,11 @@ public class VirusTotalModule extends AModuleData {
return "VirusTotal";
}
@Override
public boolean isEnabledByDefault() {
return false;
}
@Override
public AModuleDialog getDialog(MainDialog cntx) {
return new VirusTotalDialog(cntx);