diff options
Diffstat (limited to 'client/Piztor/src/com/macaroon/piztor/AppMgr.java')
-rw-r--r-- | client/Piztor/src/com/macaroon/piztor/AppMgr.java | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/client/Piztor/src/com/macaroon/piztor/AppMgr.java b/client/Piztor/src/com/macaroon/piztor/AppMgr.java index e86bf3e..99171cc 100644 --- a/client/Piztor/src/com/macaroon/piztor/AppMgr.java +++ b/client/Piztor/src/com/macaroon/piztor/AppMgr.java @@ -1,6 +1,7 @@ package com.macaroon.piztor; import java.util.HashMap; +import java.util.HashSet; import android.annotation.SuppressLint; import android.content.Intent; @@ -21,12 +22,33 @@ public class AppMgr { static Tracker tracker = null; static Thread tTransam, tGPS; // Event - final static int noToken = 101; final static int loginSuccess = 102; final static int errorToken = 103; final static int hasToken = 104; + final static int toSettings = 105; + static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp; + static HashSet<PiztorAct> acts; + + static void addAct(PiztorAct act) { + if (acts == null) + acts = new HashSet<PiztorAct>(); + acts.add(act); + } + + static void removeAct(PiztorAct act) { + if (acts.contains(act)) + acts.remove(act); + else + System.out.println("Piztor has a bug!!!!"); + } + + static void exit() { + for (PiztorAct act : acts) { + act.finish(); + } + } static void setStatus(ActivityStatus st) { status = st; @@ -85,12 +107,14 @@ public class AppMgr { addStatus(InitAct.class); addStatus(Login.class); addStatus(Main.class); + addStatus(Settings.class); addTransition(InitAct.class, noToken, Login.class); addTransition(Login.class, loginSuccess, Main.class); addTransition(Main.class, errorToken, Login.class); addTransition(Settings.class, errorToken, Login.class); addTransition(InitAct.class, hasToken, Main.class); addTransition(InitAct.class, errorToken, Login.class); + addTransition(Main.class, toSettings, Settings.class); } } |