diff options
Diffstat (limited to 'misc/client/Piztor/src/com')
4 files changed, 0 insertions, 207 deletions
diff --git a/misc/client/Piztor/src/com/macaroon/piztor/ActMgr.java b/misc/client/Piztor/src/com/macaroon/piztor/ActMgr.java deleted file mode 100644 index 81fa6f2..0000000 --- a/misc/client/Piztor/src/com/macaroon/piztor/ActMgr.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.macaroon.piztor; - -import java.util.*; - -import android.annotation.SuppressLint; - -@SuppressLint("UseSparseArrays") -public class ActMgr { - // event - PiztorAct act; - ActStatus nowStatus; - HashMap<ActStatus, HashMap<Integer, ActStatus>> mp; - - ActMgr(PiztorAct act, ActStatus nowStatus, ActStatus[] r) { - this.act = act; - this.nowStatus = nowStatus; - mp = new HashMap<ActStatus, HashMap<Integer, ActStatus>>(); - for (int i = 0; i < r.length; i++) { - mp.put(r[i], new HashMap<Integer, ActStatus>()); - } - } - - void trigger(int event) { - for (Integer i : mp.get(nowStatus).keySet()) - System.out.println(i); - if (mp.get(nowStatus).containsKey(event)) { - nowStatus.leave(event); - nowStatus = mp.get(nowStatus).get(event); - nowStatus.enter(event); - } else if (AppMgr.mp.get(act.getClass()).containsKey(event)) { - AppMgr.trigger(event); - } - } - - void add(ActStatus a, int event, ActStatus b) { - if (mp.containsKey(a)) { - HashMap<Integer, ActStatus> h = mp.get(a); - h.put(event, b); - mp.put(a, h); - } else { - HashMap<Integer, ActStatus> h = new HashMap<Integer, ActStatus>(); - h.put(event, b); - mp.put(a, h); - } - } -} - -abstract class ActStatus { - abstract void enter(int e); - - abstract void leave(int e); -} - -class EmptyStatus extends ActStatus { - @Override - void enter(int e) { - } - - @Override - void leave(int e) { - } - -} diff --git a/misc/client/Piztor/src/com/macaroon/piztor/AppMgr.java b/misc/client/Piztor/src/com/macaroon/piztor/AppMgr.java deleted file mode 100644 index 9259786..0000000 --- a/misc/client/Piztor/src/com/macaroon/piztor/AppMgr.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.macaroon.piztor; - -import java.util.HashMap; - -import android.annotation.SuppressLint; -import android.content.Intent; - -@SuppressLint("UseSparseArrays") -public class AppMgr { - // Status - public enum ActivityStatus{ - create, start, resume, restart, stop, pause, destroy - } - static ActivityStatus status; - static PiztorAct nowAct; - - static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp; - - static void setStatus(ActivityStatus st) { - status = st; - } - - static void trigger(int event) { - - Intent i = new Intent(); - i.setClass(nowAct, mp.get(nowAct.getClass()).get(event)); - nowAct.startActivity(i); - } - - static void add(Class<?> a, Integer event, Class<?> b) { - if (mp.containsKey(a)) - mp.get(a).put(event, b); - else { - HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>(); - h.put(event, b); - mp.put(a, h); - } - } - - static void addTransition(Class<?> a, int i, Class<?> b) { - if (mp.containsKey(a)) { - HashMap<Integer, Class<?>> h = mp.get(a); - h.put(i, b); - mp.put(a, h); - } else { - HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>(); - h.put(i, b); - mp.put(a, h); - } - } - - static void addStatus(Class<?> a) { - mp.put(a, new HashMap<Integer, Class<?>>()); - } - - static void init() { - mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>(); - addStatus(InitAct.class); - - } - -} diff --git a/misc/client/Piztor/src/com/macaroon/piztor/InitAct.java b/misc/client/Piztor/src/com/macaroon/piztor/InitAct.java deleted file mode 100644 index 1ce492c..0000000 --- a/misc/client/Piztor/src/com/macaroon/piztor/InitAct.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.macaroon.piztor; - -import android.os.Bundle; -import android.app.Activity; -import android.view.Menu; - -public class InitAct extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_init); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.init, menu); - return true; - } - -} diff --git a/misc/client/Piztor/src/com/macaroon/piztor/PiztorAct.java b/misc/client/Piztor/src/com/macaroon/piztor/PiztorAct.java deleted file mode 100644 index ad12b17..0000000 --- a/misc/client/Piztor/src/com/macaroon/piztor/PiztorAct.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.macaroon.piztor; - -import android.app.Activity; -import android.os.Bundle; - -public class PiztorAct extends Activity { - String id; - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - System.out.println(id + " on create"); - AppMgr.setStatus(AppMgr.ActivityStatus.create); - AppMgr.nowAct = this; - } - - @Override - protected void onStart() { - super.onStart(); - System.out.println(id + " on start"); - AppMgr.setStatus(AppMgr.ActivityStatus.start); - AppMgr.nowAct = this; - } - - @Override - protected void onStop() { - super.onStop(); - System.out.println(id + " on stop"); - AppMgr.setStatus(AppMgr.ActivityStatus.stop); - } - - @Override - protected void onResume() { - super.onResume(); - System.out.println(id + " on resume"); - AppMgr.setStatus(AppMgr.ActivityStatus.resume); - AppMgr.nowAct = this; - } - - @Override - protected void onPause() { - super.onPause(); - System.out.println(id + " on pause"); - AppMgr.setStatus(AppMgr.ActivityStatus.pause); - } - - @Override - protected void onRestart() { - super.onRestart(); - System.out.println(id + " on restart"); - AppMgr.setStatus(AppMgr.ActivityStatus.restart); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - System.out.println(id + " on destroy"); - AppMgr.setStatus(AppMgr.ActivityStatus.destroy); - } - -} |