...
 
Commits (2)
......@@ -168,6 +168,8 @@ public class ASiSTApplication extends Application {
.build();
WorkManager.getInstance().enqueueUniquePeriodicWork("module_data_update", ExistingPeriodicWorkPolicy.KEEP, moduleDataUpdateWorkRequest);
this.startASiST(this.getApplicationContext());
}
......
package de.bps.asist.core.manager;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import de.bps.asist.module.AbstractAsistModule;
......@@ -9,7 +11,7 @@ public class ASiSTModuleManager {
private static final ASiSTModuleManager INSTANCE = new ASiSTModuleManager();
private List<AbstractAsistModule> modules = new ArrayList<>();
private Map<Class<? extends AbstractAsistModule>, AbstractAsistModule> modules = new LinkedHashMap<>();
private ASiSTModuleManager(){
}
......@@ -19,22 +21,19 @@ public class ASiSTModuleManager {
}
public void resetModuleList(){
modules = new ArrayList<>();
this.modules.clear();
}
public void register(AbstractAsistModule module){
modules.add(module);
this.modules.put(module.getClass(), module);
}
public <T extends AbstractAsistModule> T getModule( Class<T> moduleClass, T defaultValue ) {
T resultModule = defaultValue;
for ( AbstractAsistModule registeredModule: this.modules ) {
if( moduleClass.isInstance( registeredModule ) ) {
defaultValue = (T)registeredModule;
break;
}
public <T extends AbstractAsistModule> T getModule(Class<T> moduleClass, T defaultValue ) {
T module = (T)this.modules.get(moduleClass);
if(module == null) {
module = defaultValue;
}
return resultModule;
return module;
}
public <T extends AbstractAsistModule> T getModule( Class<T> moduleClass) {
......@@ -42,7 +41,6 @@ public class ASiSTModuleManager {
}
public List<AbstractAsistModule> getModules() {
return modules;
return new ArrayList<>(modules.values());
}
}
}
\ No newline at end of file
......@@ -27,7 +27,6 @@ import androidx.fragment.app.FragmentManager;
import androidx.legacy.app.ActionBarDrawerToggle;
import de.bps.asist.AbstractAsistActivity;
import de.bps.asist.R;
import de.bps.asist.core.ASiSTApplication;
import de.bps.asist.core.manager.ASiSTModuleManager;
import de.bps.asist.core.manager.preferences.ASiSTPreferenceManager;
import de.bps.asist.gui.AbstractASiSTFragment;
......@@ -70,8 +69,6 @@ public class AsistStartActivity extends AbstractAsistActivity implements ActionB
super.onCreate(savedInstanceState);
ASiSTApplication.startASiST(this);
mTitle = mDrawerTitle = getTitle();
setContentView(R.layout.menu_layout);
......