From ac7633d8149a28af288ac0b850850cef9b13c151 Mon Sep 17 00:00:00 2001 From: sjtufs Date: Sun, 25 Aug 2013 15:45:55 +0800 Subject: This is alpha --- client/Piztor/src/com/macaroon/piztor/ActMgr.java | 63 ---------------------- client/Piztor/src/com/macaroon/piztor/AppMgr.java | 62 --------------------- client/Piztor/src/com/macaroon/piztor/InitAct.java | 22 -------- .../Piztor/src/com/macaroon/piztor/PiztorAct.java | 60 --------------------- 4 files changed, 207 deletions(-) delete mode 100644 client/Piztor/src/com/macaroon/piztor/ActMgr.java delete mode 100644 client/Piztor/src/com/macaroon/piztor/AppMgr.java delete mode 100644 client/Piztor/src/com/macaroon/piztor/InitAct.java delete mode 100644 client/Piztor/src/com/macaroon/piztor/PiztorAct.java (limited to 'client/Piztor/src') diff --git a/client/Piztor/src/com/macaroon/piztor/ActMgr.java b/client/Piztor/src/com/macaroon/piztor/ActMgr.java deleted file mode 100644 index 81fa6f2..0000000 --- a/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> mp; - - ActMgr(PiztorAct act, ActStatus nowStatus, ActStatus[] r) { - this.act = act; - this.nowStatus = nowStatus; - mp = new HashMap>(); - for (int i = 0; i < r.length; i++) { - mp.put(r[i], new HashMap()); - } - } - - 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 h = mp.get(a); - h.put(event, b); - mp.put(a, h); - } else { - HashMap h = new HashMap(); - 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/client/Piztor/src/com/macaroon/piztor/AppMgr.java b/client/Piztor/src/com/macaroon/piztor/AppMgr.java deleted file mode 100644 index 9259786..0000000 --- a/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, HashMap>> 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> h = new HashMap>(); - h.put(event, b); - mp.put(a, h); - } - } - - static void addTransition(Class a, int i, Class b) { - if (mp.containsKey(a)) { - HashMap> h = mp.get(a); - h.put(i, b); - mp.put(a, h); - } else { - HashMap> h = new HashMap>(); - h.put(i, b); - mp.put(a, h); - } - } - - static void addStatus(Class a) { - mp.put(a, new HashMap>()); - } - - static void init() { - mp = new HashMap, HashMap>>(); - addStatus(InitAct.class); - - } - -} diff --git a/client/Piztor/src/com/macaroon/piztor/InitAct.java b/client/Piztor/src/com/macaroon/piztor/InitAct.java deleted file mode 100644 index 1ce492c..0000000 --- a/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/client/Piztor/src/com/macaroon/piztor/PiztorAct.java b/client/Piztor/src/com/macaroon/piztor/PiztorAct.java deleted file mode 100644 index ad12b17..0000000 --- a/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); - } - -} -- cgit v1.2.3-70-g09d2