Added README.txt and GPL Header to Source Files
[DHBWCampusApp.git] / app / src / main / java / de / dhbwloe / campusapp / CampusAppContext.java
index 4fddc35accd381ca52f50add127c7b278b265d15..cb37e26787687c14a5139c49363bf16aaa481bb7 100644 (file)
@@ -1,3 +1,18 @@
+/* CampusAppContext.java
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
 package de.dhbwloe.campusapp;
 
 import android.app.Activity;
 package de.dhbwloe.campusapp;
 
 import android.app.Activity;
@@ -49,7 +64,7 @@ public class CampusAppContext {
     }
 
     public static final String APPVERSION = "0.1.1 (beta)";
     }
 
     public static final String APPVERSION = "0.1.1 (beta)";
-    private final AppPage[] PAGES = {
+    private final AppPage[] PAGES = { // Hier müssen alle Fragmente, die auf der Activity angezeigt werden sollen eingetragen werden.
             new AppPage("SplashScreen", SplashScreen.class),
             new AppPage("Dashboard", Dashboard.class),
             new AppPage("AppSearch", AppSearch.class),
             new AppPage("SplashScreen", SplashScreen.class),
             new AppPage("Dashboard", Dashboard.class),
             new AppPage("AppSearch", AppSearch.class),
@@ -86,6 +101,7 @@ public class CampusAppContext {
         oDatabaseManager = new DatabaseManager(this);
         oNfcCardListener = new NfcCardListener(this);
 
         oDatabaseManager = new DatabaseManager(this);
         oNfcCardListener = new NfcCardListener(this);
 
+        // Alle Fragmente "registrieren"
         for(int i = 0; i < PAGES.length; i++)
             oNavigationManager.registerPage(PAGES[i].name, PAGES[i].fragment, PAGES[i].fragementType);
 
         for(int i = 0; i < PAGES.length; i++)
             oNavigationManager.registerPage(PAGES[i].name, PAGES[i].fragment, PAGES[i].fragementType);
 
@@ -115,6 +131,7 @@ public class CampusAppContext {
     }
 
     public void setTitle(String title) {
     }
 
     public void setTitle(String title) {
+        // Ändern des Titels (Im App Header angezeigt)
         PopupFragment popup = oNavigationManager.getDialog();
         if(popup != null) {
             if(popup.getDialog() != null)
         PopupFragment popup = oNavigationManager.getDialog();
         if(popup != null) {
             if(popup.getDialog() != null)
@@ -130,6 +147,7 @@ public class CampusAppContext {
     }
 
     public void addDefaultSearchIndexes() {
     }
 
     public void addDefaultSearchIndexes() {
+        // Alle Search Indices der eigetragenen Seiten beziehen und in der Datenbank speichern
         for(int i = 0; i < PAGES.length; i++) {
             try {
                 Method m = PAGES[i].fragment.getMethod("GetSearchIndices");
         for(int i = 0; i < PAGES.length; i++) {
             try {
                 Method m = PAGES[i].fragment.getMethod("GetSearchIndices");
@@ -150,6 +168,7 @@ public class CampusAppContext {
     }
 
     private void onNfcCardDataReceived(NfcCardData data) {
     }
 
     private void onNfcCardDataReceived(NfcCardData data) {
+        // NFC Daten erhalten
         Bundle bundle = new Bundle();
         double cardBalance = data.getBalance() / 100.0;
         bundle.putDouble("balance", cardBalance);
         Bundle bundle = new Bundle();
         double cardBalance = data.getBalance() / 100.0;
         bundle.putDouble("balance", cardBalance);
@@ -159,6 +178,7 @@ public class CampusAppContext {
         oContextVariables.putDouble("nfcCardBalance", cardBalance);
 
         String pagename = oNavigationManager.getCurrentPageName();
         oContextVariables.putDouble("nfcCardBalance", cardBalance);
 
         String pagename = oNavigationManager.getCurrentPageName();
+        // Update angezeigtes Guthaben lediglich, wenn das Fragment bereits angezeigt wird
         if(pagename != null && pagename.equalsIgnoreCase("MensaCard")) {
             MensaCard fragment = (MensaCard) oNavigationManager.getCurrentFragment();
             fragment.showNfcCardData(bundle);
         if(pagename != null && pagename.equalsIgnoreCase("MensaCard")) {
             MensaCard fragment = (MensaCard) oNavigationManager.getCurrentFragment();
             fragment.showNfcCardData(bundle);
@@ -171,6 +191,7 @@ public class CampusAppContext {
     }
 
     public String getResString(int id, Object... arguments) {
     }
 
     public String getResString(int id, Object... arguments) {
+        // printf like resource strings
         String format = getResString(id);
         String res = String.format(format, arguments);
         return res;
         String format = getResString(id);
         String res = String.format(format, arguments);
         return res;