summaryrefslogtreecommitdiff
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/com/macaroon/piztor/ActMgr.java5
-rw-r--r--client/src/com/macaroon/piztor/AppMgr.java2
-rw-r--r--client/src/com/macaroon/piztor/Setting.java21
3 files changed, 21 insertions, 7 deletions
diff --git a/client/src/com/macaroon/piztor/ActMgr.java b/client/src/com/macaroon/piztor/ActMgr.java
index 4df6bae..f5ff994 100644
--- a/client/src/com/macaroon/piztor/ActMgr.java
+++ b/client/src/com/macaroon/piztor/ActMgr.java
@@ -6,6 +6,7 @@ import android.annotation.SuppressLint;
@SuppressLint("UseSparseArrays")
public class ActMgr {
+ final static int Create = -1;
// event
PiztorAct act;
ActStatus nowStatus;
@@ -14,6 +15,7 @@ public class ActMgr {
ActMgr(PiztorAct act, ActStatus nowStatus, ActStatus[] r) {
this.act = act;
this.nowStatus = nowStatus;
+ nowStatus.enter(Create);
mp = new HashMap<ActStatus, HashMap<Integer, ActStatus>>();
for (int i = 0; i < r.length; i++) {
mp.put(r[i], new HashMap<Integer, ActStatus>());
@@ -28,6 +30,9 @@ public class ActMgr {
nowStatus.enter(event);
} else if (AppMgr.mp.get(act.getClass()).containsKey(event)) {
AppMgr.trigger(event);
+ } else {
+ System.out.println("can not trigger the event at " + act.id + " : "
+ + event);
}
}
diff --git a/client/src/com/macaroon/piztor/AppMgr.java b/client/src/com/macaroon/piztor/AppMgr.java
index 2e5e2b3..10e8e1a 100644
--- a/client/src/com/macaroon/piztor/AppMgr.java
+++ b/client/src/com/macaroon/piztor/AppMgr.java
@@ -71,7 +71,7 @@ public class AppMgr {
static void init() {
mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
+ transam = new Transam(Infomation.ip, Infomation.port, fromTransam);
fromGPS = new Handler();
tracker = new Tracker(nowAct.getApplicationContext(), fromGPS);
tTransam = new Thread(transam);
diff --git a/client/src/com/macaroon/piztor/Setting.java b/client/src/com/macaroon/piztor/Setting.java
index 610333f..2a2d2fa 100644
--- a/client/src/com/macaroon/piztor/Setting.java
+++ b/client/src/com/macaroon/piztor/Setting.java
@@ -1,21 +1,30 @@
package com.macaroon.piztor;
import android.os.Bundle;
-import android.app.Activity;
import android.view.Menu;
-public class Setting extends Activity {
-
+public class InitAct extends PiztorAct {
@Override
protected void onCreate(Bundle savedInstanceState) {
+ id = "initAct";
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_setting);
+ AppMgr.init();
+ setContentView(R.layout.activity_init);
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ if (Infomation.token == -1)
+ AppMgr.trigger(AppMgr.noToken);
+ else {
+ //TODO jump to main
+ }
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.setting, menu);
+ getMenuInflater().inflate(R.menu.init, menu);
return true;
}