...
 
Commits (4)
......@@ -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
......@@ -8,6 +8,7 @@ import android.content.Context;
import android.content.Intent;
import android.util.JsonReader;
import android.util.Log;
import android.graphics.BitmapFactory;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
......@@ -147,7 +148,9 @@ public class FirebaseReceiver extends FirebaseMessagingService {
final NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
final Notification notification = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_logo)
.setSmallIcon(R.drawable.ic_menu_alarm)
.setLargeIcon(BitmapFactory.decodeResource(this.getResources(),
R.drawable.ic_logo))
.setContentText(message).setContentTitle(title).setContentIntent(contentIntent)
.build();
......
......@@ -210,7 +210,9 @@ public class CanteenDatabaseManager {
ASiSTTreeItem<FeedItem> root = startTreeConfig.getRootNode(context);
String moduleName = context.getString(R.string.module_canteen_name);
ASiSTPreferenceManager apm = new ASiSTPreferenceManager();
boolean enabled = apm.getSetting(context, AsistStartActivity.START_VIEW_TREE + moduleName);
//TODO: unsauber: Mensa soll nicht auf der Startseite angezeigt werden
boolean enabled = false;
//boolean enabled = apm.getSetting(context, AsistStartActivity.START_VIEW_TREE + moduleName);
root.setEnabled(enabled);
AsistStartModule.update(root);
} finally {
......
......@@ -7,6 +7,7 @@ import android.app.NotificationManager;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.BitmapFactory;
import android.media.AudioAttributes;
import android.media.RingtoneManager;
import android.net.Uri;
......@@ -134,7 +135,9 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
.setAutoCancel(true)
.setDefaults(Notification.DEFAULT_ALL) // für alte Geräte
.setWhen(System.currentTimeMillis())
.setSmallIcon(R.drawable.ic_launcher)
.setSmallIcon(R.drawable.ic_menu_alarm)
.setLargeIcon(BitmapFactory.decodeResource(this.getContext().getResources(),
R.drawable.ic_logo))
.setTicker("Hearty365")
.setPriority(NotificationCompat.PRIORITY_MAX)
.setContentTitle("Notfall in der Mensa")
......
......@@ -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);
......
......@@ -2,6 +2,7 @@
<resources>
<!-- TRANSLATED FROM BPS -->
<string name="module_alarm_name">Alarms</string>
<string name="dummy_button">Dummy Button</string>
<string name="dummy_content">DUMMY\nCONTENT</string>
<string name="txt_image_content_description">Image</string>
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="module_alarm_name">Alarmierungen</string>
<string name="dummy_button">Dummy Button</string>
<string name="dummy_content">DUMMY\nCONTENT</string>
<string name="txt_image_content_description">Image</string>
......