Added README.txt and GPL Header to Source Files
[DHBWCampusApp.git] / app / src / main / java / de / dhbwloe / campusapp / NavigationManager.java
index daa84eabf49d4cf158f53ededd30729b99ccae77..ed339dd8a6b10cad42f64815ebf234ccd8de9f2b 100644 (file)
@@ -1,3 +1,18 @@
+/* NavigationManager.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.os.Bundle;
@@ -27,11 +42,19 @@ public class NavigationManager {
     };
 
     private CampusAppContext AppContext;
+
+    // Derzeitig angezeigtes Fragment
     private NavPage oCurrentPage;
-    private NavPage oParentPage;
     private Fragment oCurrentFragment;
+
+    // Hintergrund Fragment (bei Popups)
+    private NavPage oParentPage;
     private Fragment oParentFragment;
+
+    // Container ID
     private int iFragmentContainerId;
+
+    // Alle registrierte Fragmente mit Name
     private ArrayList<NavPage> lNavigationPages = new ArrayList<NavPage>();
 
     public NavigationManager(CampusAppContext context, int fragmentContainer) {
@@ -79,12 +102,13 @@ public class NavigationManager {
     }
 
     public void navigatePage(String name, Bundle args, boolean history) {
-
+        // Suche Fragment
         NavPage page = getPageByName(name);
         if(page == null)
             return;
         Fragment fragment;
 
+        // Wenn das Fragment als Popup angeziegt werden soll, muss zunächst das Popup Fragment geladen werden.
         if(page.fragmentType == 3) {
             PopupFragment popupFragment = new PopupFragment();
             if(args == null)
@@ -122,7 +146,7 @@ public class NavigationManager {
             }
             transaction.add(iFragmentContainerId, fragment);
         }
-        if (history)
+        if (history) // Hinzufügen zur App History (Zurück Button)
             transaction.addToBackStack(null);
 
         oCurrentPage = page;
@@ -174,6 +198,7 @@ public class NavigationManager {
     }
 
     public boolean closeDialog() {
+        // Popup schließen
         if(oCurrentPage != null && oCurrentPage.fragmentType == 3) {
             PopupFragment fragment = (PopupFragment) oCurrentFragment;
             boolean wasAdded = false;