...
 
Commits (4)
...@@ -168,6 +168,8 @@ public class ASiSTApplication extends Application { ...@@ -168,6 +168,8 @@ public class ASiSTApplication extends Application {
.build(); .build();
WorkManager.getInstance().enqueueUniquePeriodicWork("module_data_update", ExistingPeriodicWorkPolicy.KEEP, moduleDataUpdateWorkRequest); WorkManager.getInstance().enqueueUniquePeriodicWork("module_data_update", ExistingPeriodicWorkPolicy.KEEP, moduleDataUpdateWorkRequest);
this.startASiST(this.getApplicationContext());
} }
......
package de.bps.asist.core.manager; package de.bps.asist.core.manager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import de.bps.asist.module.AbstractAsistModule; import de.bps.asist.module.AbstractAsistModule;
...@@ -9,7 +11,7 @@ public class ASiSTModuleManager { ...@@ -9,7 +11,7 @@ public class ASiSTModuleManager {
private static final ASiSTModuleManager INSTANCE = new 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(){ private ASiSTModuleManager(){
} }
...@@ -19,22 +21,19 @@ public class ASiSTModuleManager { ...@@ -19,22 +21,19 @@ public class ASiSTModuleManager {
} }
public void resetModuleList(){ public void resetModuleList(){
modules = new ArrayList<>(); this.modules.clear();
} }
public void register(AbstractAsistModule module){ 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 ) { public <T extends AbstractAsistModule> T getModule(Class<T> moduleClass, T defaultValue ) {
T resultModule = defaultValue; T module = (T)this.modules.get(moduleClass);
for ( AbstractAsistModule registeredModule: this.modules ) { if(module == null) {
if( moduleClass.isInstance( registeredModule ) ) { module = defaultValue;
defaultValue = (T)registeredModule;
break;
}
} }
return resultModule; return module;
} }
public <T extends AbstractAsistModule> T getModule( Class<T> moduleClass) { public <T extends AbstractAsistModule> T getModule( Class<T> moduleClass) {
...@@ -42,7 +41,6 @@ public class ASiSTModuleManager { ...@@ -42,7 +41,6 @@ public class ASiSTModuleManager {
} }
public List<AbstractAsistModule> getModules() { 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; ...@@ -8,6 +8,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.util.JsonReader; import android.util.JsonReader;
import android.util.Log; import android.util.Log;
import android.graphics.BitmapFactory;
import com.google.firebase.messaging.FirebaseMessagingService; import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage; import com.google.firebase.messaging.RemoteMessage;
...@@ -147,7 +148,9 @@ public class FirebaseReceiver extends FirebaseMessagingService { ...@@ -147,7 +148,9 @@ public class FirebaseReceiver extends FirebaseMessagingService {
final NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); final NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
final Notification notification = new NotificationCompat.Builder(context) 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) .setContentText(message).setContentTitle(title).setContentIntent(contentIntent)
.build(); .build();
......
...@@ -210,7 +210,9 @@ public class CanteenDatabaseManager { ...@@ -210,7 +210,9 @@ public class CanteenDatabaseManager {
ASiSTTreeItem<FeedItem> root = startTreeConfig.getRootNode(context); ASiSTTreeItem<FeedItem> root = startTreeConfig.getRootNode(context);
String moduleName = context.getString(R.string.module_canteen_name); String moduleName = context.getString(R.string.module_canteen_name);
ASiSTPreferenceManager apm = new ASiSTPreferenceManager(); 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); root.setEnabled(enabled);
AsistStartModule.update(root); AsistStartModule.update(root);
} finally { } finally {
......
...@@ -7,6 +7,7 @@ import android.app.NotificationManager; ...@@ -7,6 +7,7 @@ import android.app.NotificationManager;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.BitmapFactory;
import android.media.AudioAttributes; import android.media.AudioAttributes;
import android.media.RingtoneManager; import android.media.RingtoneManager;
import android.net.Uri; import android.net.Uri;
...@@ -134,7 +135,9 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer ...@@ -134,7 +135,9 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
.setAutoCancel(true) .setAutoCancel(true)
.setDefaults(Notification.DEFAULT_ALL) // für alte Geräte .setDefaults(Notification.DEFAULT_ALL) // für alte Geräte
.setWhen(System.currentTimeMillis()) .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") .setTicker("Hearty365")
.setPriority(NotificationCompat.PRIORITY_MAX) .setPriority(NotificationCompat.PRIORITY_MAX)
.setContentTitle("Notfall in der Mensa") .setContentTitle("Notfall in der Mensa")
......
...@@ -27,7 +27,6 @@ import androidx.fragment.app.FragmentManager; ...@@ -27,7 +27,6 @@ import androidx.fragment.app.FragmentManager;
import androidx.legacy.app.ActionBarDrawerToggle; import androidx.legacy.app.ActionBarDrawerToggle;
import de.bps.asist.AbstractAsistActivity; import de.bps.asist.AbstractAsistActivity;
import de.bps.asist.R; import de.bps.asist.R;
import de.bps.asist.core.ASiSTApplication;
import de.bps.asist.core.manager.ASiSTModuleManager; import de.bps.asist.core.manager.ASiSTModuleManager;
import de.bps.asist.core.manager.preferences.ASiSTPreferenceManager; import de.bps.asist.core.manager.preferences.ASiSTPreferenceManager;
import de.bps.asist.gui.AbstractASiSTFragment; import de.bps.asist.gui.AbstractASiSTFragment;
...@@ -70,8 +69,6 @@ public class AsistStartActivity extends AbstractAsistActivity implements ActionB ...@@ -70,8 +69,6 @@ public class AsistStartActivity extends AbstractAsistActivity implements ActionB
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ASiSTApplication.startASiST(this);
mTitle = mDrawerTitle = getTitle(); mTitle = mDrawerTitle = getTitle();
setContentView(R.layout.menu_layout); setContentView(R.layout.menu_layout);
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<resources> <resources>
<!-- TRANSLATED FROM BPS --> <!-- TRANSLATED FROM BPS -->
<string name="module_alarm_name">Alarms</string>
<string name="dummy_button">Dummy Button</string> <string name="dummy_button">Dummy Button</string>
<string name="dummy_content">DUMMY\nCONTENT</string> <string name="dummy_content">DUMMY\nCONTENT</string>
<string name="txt_image_content_description">Image</string> <string name="txt_image_content_description">Image</string>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="module_alarm_name">Alarmierungen</string>
<string name="dummy_button">Dummy Button</string> <string name="dummy_button">Dummy Button</string>
<string name="dummy_content">DUMMY\nCONTENT</string> <string name="dummy_content">DUMMY\nCONTENT</string>
<string name="txt_image_content_description">Image</string> <string name="txt_image_content_description">Image</string>
......