+/* 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;
};
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) {
}
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)
}
transaction.add(iFragmentContainerId, fragment);
}
- if (history)
+ if (history) // Hinzufügen zur App History (Zurück Button)
transaction.addToBackStack(null);
oCurrentPage = page;
}
public boolean closeDialog() {
+ // Popup schließen
if(oCurrentPage != null && oCurrentPage.fragmentType == 3) {
PopupFragment fragment = (PopupFragment) oCurrentFragment;
boolean wasAdded = false;