import de.dhbwloe.campusapp.fragments.Impressum;
import de.dhbwloe.campusapp.fragments.Mensa;
import de.dhbwloe.campusapp.fragments.MensaCard;
-import de.dhbwloe.campusapp.fragments.MensaWochenplan;
import de.dhbwloe.campusapp.fragments.News;
import de.dhbwloe.campusapp.fragments.PopupFragment;
+import de.dhbwloe.campusapp.fragments.Settings;
import de.dhbwloe.campusapp.fragments.SplashScreen;
import de.dhbwloe.campusapp.fragments.Vorlesungsplan;
import de.dhbwloe.campusapp.fragments.WebBrowser;
new AppPage("News", News.class),
new AppPage("WifiSettings", WifiSettings.class),
new AppPage("FirstRun", FirstRun.class),
+ new AppPage("Settings", Settings.class),
new AppPage("Impressum", Impressum.class),
new AppPage("WebBrowser", WebBrowser.class),
new AppPage("WebBrowserPopup", WebBrowser.class, 3)
private NavigationManager oNavigationManager;
private DatabaseManager oDatabaseManager;
private NfcCardListener oNfcCardListener;
+ private Bundle oContextVariables;
public CampusAppContext(CampusApp mainActivity, int fragmentContainerId) {
final CampusAppContext AppContext = this;
instance = this;
oMainActivity = mainActivity;
+ oContextVariables = new Bundle();
oNavigationManager = new NavigationManager(this, fragmentContainerId);
oDatabaseManager = new DatabaseManager(this);
oNfcCardListener = new NfcCardListener(this);
public void setTitle(String title) {
PopupFragment popup = oNavigationManager.getDialog();
if(popup != null) {
- popup.getDialog().setTitle(title);
+ if(popup.getDialog() != null)
+ popup.getDialog().setTitle(title);
} else {
TextView titleView = (TextView)oMainActivity.findViewById(R.id.title);
titleView.setText(title);
private void onNfcCardDataReceived(NfcCardData data) {
Bundle bundle = new Bundle();
- bundle.putDouble("balance", data.getBalance() / 100.0);
+ double cardBalance = data.getBalance() / 100.0;
+ bundle.putDouble("balance", cardBalance);
bundle.putDouble("transaction", data.getLastTransaction() / 100.0);
+ oContextVariables.putInt("nfcCardUniqueId", data.getUniqueId());
+ oContextVariables.putDouble("nfcCardBalance", cardBalance);
+
String pagename = oNavigationManager.getCurrentPageName();
if(pagename != null && pagename.equalsIgnoreCase("MensaCard")) {
MensaCard fragment = (MensaCard) oNavigationManager.getCurrentFragment();
oNavigationManager.navigatePage("MensaCard", bundle);
}
+ public Bundle getContextVariables() {
+ return oContextVariables;
+ }
+
+ public String getResString(int id, Object... arguments) {
+ String format = getResString(id);
+ String res = String.format(format, arguments);
+ return res;
+ }
+ public String getResString(int id) {
+ String str = oMainActivity.getResources().getString(id);
+ return str;
+ }
+
}