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);
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;
+ }
+
}