diff options
19 files changed, 191 insertions, 35 deletions
diff --git a/client/Piztor/AndroidManifest.xml b/client/Piztor/AndroidManifest.xml index 63cb8ff..b18d8e2 100644 --- a/client/Piztor/AndroidManifest.xml +++ b/client/Piztor/AndroidManifest.xml @@ -12,9 +12,9 @@ android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" - android:theme="@style/AppTheme" > + android:theme="@android:style/Theme.Black.NoTitleBar" > <activity - android:name="com.macaroon.piztor.Main" + android:name="com.macaroon.piztor.InitAct" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> @@ -23,14 +23,20 @@ </intent-filter> </activity> <activity - android:name="com.macaroon.piztor.InitAct" - android:label="@string/title_activity_init" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> + android:name="com.macaroon.piztor.Login" + android:label="@string/title_activity_login" > + </activity> + <activity + android:name="com.macaroon.piztor.Main" + android:label="@string/title_activity_main" > + </activity> + <activity + android:name="com.macaroon.piztor.Setting" + android:label="@string/title_activity_setting" > </activity> </application> + <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> + </manifest> diff --git a/client/Piztor/bin/AndroidManifest.xml b/client/Piztor/bin/AndroidManifest.xml index 63cb8ff..b18d8e2 100644 --- a/client/Piztor/bin/AndroidManifest.xml +++ b/client/Piztor/bin/AndroidManifest.xml @@ -12,9 +12,9 @@ android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" - android:theme="@style/AppTheme" > + android:theme="@android:style/Theme.Black.NoTitleBar" > <activity - android:name="com.macaroon.piztor.Main" + android:name="com.macaroon.piztor.InitAct" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> @@ -23,14 +23,20 @@ </intent-filter> </activity> <activity - android:name="com.macaroon.piztor.InitAct" - android:label="@string/title_activity_init" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> + android:name="com.macaroon.piztor.Login" + android:label="@string/title_activity_login" > + </activity> + <activity + android:name="com.macaroon.piztor.Main" + android:label="@string/title_activity_main" > + </activity> + <activity + android:name="com.macaroon.piztor.Setting" + android:label="@string/title_activity_setting" > </activity> </application> + <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> + </manifest> diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/ActMgr.class b/client/Piztor/bin/classes/com/macaroon/piztor/ActMgr.class Binary files differindex 1b1c693..a219c2d 100644 --- a/client/Piztor/bin/classes/com/macaroon/piztor/ActMgr.class +++ b/client/Piztor/bin/classes/com/macaroon/piztor/ActMgr.class diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/ActStatus.class b/client/Piztor/bin/classes/com/macaroon/piztor/ActStatus.class Binary files differindex 1f3df48..296a7d5 100644 --- a/client/Piztor/bin/classes/com/macaroon/piztor/ActStatus.class +++ b/client/Piztor/bin/classes/com/macaroon/piztor/ActStatus.class diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/AppMgr$ActivityStatus.class b/client/Piztor/bin/classes/com/macaroon/piztor/AppMgr$ActivityStatus.class Binary files differindex 496344b..f11e546 100644 --- a/client/Piztor/bin/classes/com/macaroon/piztor/AppMgr$ActivityStatus.class +++ b/client/Piztor/bin/classes/com/macaroon/piztor/AppMgr$ActivityStatus.class diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/AppMgr.class b/client/Piztor/bin/classes/com/macaroon/piztor/AppMgr.class Binary files differindex 107bcad..61aa240 100644 --- a/client/Piztor/bin/classes/com/macaroon/piztor/AppMgr.class +++ b/client/Piztor/bin/classes/com/macaroon/piztor/AppMgr.class diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/EmptyStatus.class b/client/Piztor/bin/classes/com/macaroon/piztor/EmptyStatus.class Binary files differindex c656689..8b48ad5 100644 --- a/client/Piztor/bin/classes/com/macaroon/piztor/EmptyStatus.class +++ b/client/Piztor/bin/classes/com/macaroon/piztor/EmptyStatus.class diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/InitAct.class b/client/Piztor/bin/classes/com/macaroon/piztor/InitAct.class Binary files differindex 6a8e04d..d03ee93 100644 --- a/client/Piztor/bin/classes/com/macaroon/piztor/InitAct.class +++ b/client/Piztor/bin/classes/com/macaroon/piztor/InitAct.class diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R$drawable.class b/client/Piztor/bin/classes/com/macaroon/piztor/R$drawable.class Binary files differindex 5444d98..b31a626 100644 --- a/client/Piztor/bin/classes/com/macaroon/piztor/R$drawable.class +++ b/client/Piztor/bin/classes/com/macaroon/piztor/R$drawable.class diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R$id.class b/client/Piztor/bin/classes/com/macaroon/piztor/R$id.class Binary files differindex 8577179..e08c969 100644 --- a/client/Piztor/bin/classes/com/macaroon/piztor/R$id.class +++ b/client/Piztor/bin/classes/com/macaroon/piztor/R$id.class diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R$layout.class b/client/Piztor/bin/classes/com/macaroon/piztor/R$layout.class Binary files differindex fab7556..de25e3c 100644 --- a/client/Piztor/bin/classes/com/macaroon/piztor/R$layout.class +++ b/client/Piztor/bin/classes/com/macaroon/piztor/R$layout.class diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R$menu.class b/client/Piztor/bin/classes/com/macaroon/piztor/R$menu.class Binary files differindex cec6e5a..7f7cacb 100644 --- a/client/Piztor/bin/classes/com/macaroon/piztor/R$menu.class +++ b/client/Piztor/bin/classes/com/macaroon/piztor/R$menu.class diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R$string.class b/client/Piztor/bin/classes/com/macaroon/piztor/R$string.class Binary files differindex a78c834..65d1b80 100644 --- a/client/Piztor/bin/classes/com/macaroon/piztor/R$string.class +++ b/client/Piztor/bin/classes/com/macaroon/piztor/R$string.class diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R$style.class b/client/Piztor/bin/classes/com/macaroon/piztor/R$style.class Binary files differindex 42ddcce..052dd30 100644 --- a/client/Piztor/bin/classes/com/macaroon/piztor/R$style.class +++ b/client/Piztor/bin/classes/com/macaroon/piztor/R$style.class diff --git a/client/Piztor/gen/com/macaroon/piztor/R.java b/client/Piztor/gen/com/macaroon/piztor/R.java index 9821c7f..3d07e1d 100644 --- a/client/Piztor/gen/com/macaroon/piztor/R.java +++ b/client/Piztor/gen/com/macaroon/piztor/R.java @@ -21,23 +21,117 @@ public final class R { public static final int activity_vertical_margin=0x7f040001; } public static final class drawable { - public static final int ic_launcher=0x7f020000; + public static final int bottom_img=0x7f020000; + public static final int footbar_background=0x7f020001; + public static final int footbar_btn_checkin_style=0x7f020002; + public static final int footbar_btn_fetch_style=0x7f020003; + public static final int footbar_btn_focus_style=0x7f020004; + public static final int footbar_btn_search_style=0x7f020005; + public static final int footbar_btn_settings_style=0x7f020006; + public static final int footbar_checkin=0x7f020007; + public static final int footbar_checkin_1=0x7f020008; + public static final int footbar_fetch=0x7f020009; + public static final int footbar_fetch_1=0x7f02000a; + public static final int footbar_marker=0x7f02000b; + public static final int footbar_marker_1=0x7f02000c; + public static final int footbar_search=0x7f02000d; + public static final int footbar_search_1=0x7f02000e; + public static final int footbar_select_bg=0x7f02000f; + public static final int footbar_settings=0x7f020010; + public static final int footbar_settings_1=0x7f020011; + public static final int footbar_unselect_bg=0x7f020012; + public static final int horizontal_line=0x7f020013; + public static final int ic_launcher=0x7f020014; + public static final int navigation_back=0x7f020015; + public static final int navigation_back_1=0x7f020016; + public static final int title_logo=0x7f020017; + public static final int topbar_background=0x7f020018; } public static final class id { - public static final int action_settings=0x7f080000; + public static final int action_settings=0x7f08002c; + public static final int footbar_btn_checkin=0x7f08001f; + public static final int footbar_btn_checkin_layout=0x7f08001e; + public static final int footbar_btn_checkin_text=0x7f080020; + public static final int footbar_btn_fetch=0x7f08001c; + public static final int footbar_btn_fetch_layout=0x7f08001b; + public static final int footbar_btn_fetch_text=0x7f08001d; + public static final int footbar_btn_focus=0x7f080022; + public static final int footbar_btn_focus_layout=0x7f080021; + public static final int footbar_btn_focus_text=0x7f080023; + public static final int footbar_btn_search=0x7f080019; + public static final int footbar_btn_search_layout=0x7f080018; + public static final int footbar_btn_search_text=0x7f08001a; + public static final int footbar_btn_settings=0x7f080025; + public static final int footbar_btn_settings_layout=0x7f080024; + public static final int footbar_btn_settings_text=0x7f080027; + public static final int gather_footbar_layout=0x7f080001; + public static final int gather_timer=0x7f080026; + public static final int gather_timer_layout=0x7f080000; + public static final int headbar_appname=0x7f080029; + public static final int headbar_logo=0x7f080028; + public static final int login_btn_login=0x7f080007; + public static final int main_footbar_layout=0x7f080009; + public static final int main_headbar_img=0x7f080002; + public static final int main_headbar_layout=0x7f080008; + public static final int settings_GPSrefreshrate=0x7f08000c; + public static final int settings_GPSrefreshrate_text=0x7f08000b; + public static final int settings_btn_back=0x7f08002a; + public static final int settings_headbar_layout=0x7f08000a; + public static final int settings_headbar_text=0x7f08002b; + public static final int settings_seperator1=0x7f08000d; + public static final int settings_seperator2=0x7f080012; + public static final int settings_seperator3=0x7f080017; + public static final int settings_sex_layout=0x7f08000e; + public static final int settings_sex_text=0x7f08000f; + public static final int settings_show_female=0x7f080011; + public static final int settings_show_male=0x7f080010; + public static final int settings_team_all=0x7f080016; + public static final int settings_team_layout=0x7f080013; + public static final int settings_team_mine=0x7f080015; + public static final int settings_team_text=0x7f080014; + public static final int user_id=0x7f080004; + public static final int user_id_text=0x7f080003; + public static final int user_pass=0x7f080006; + public static final int user_pass_text=0x7f080005; } public static final class layout { - public static final int activity_init=0x7f030000; + public static final int activity_gather=0x7f030000; + public static final int activity_init=0x7f030001; + public static final int activity_login=0x7f030002; + public static final int activity_main=0x7f030003; + public static final int activity_setting=0x7f030004; + public static final int activity_settings=0x7f030005; + public static final int gather_footbar=0x7f030006; + public static final int gather_timer=0x7f030007; + public static final int login_bottom=0x7f030008; + public static final int main_footbar=0x7f030009; + public static final int main_headbar=0x7f03000a; + public static final int settings_headbar=0x7f03000b; } public static final class menu { public static final int init=0x7f070000; - public static final int main=0x7f070001; + public static final int login=0x7f070001; + public static final int main=0x7f070002; + public static final int setting=0x7f070003; } public static final class string { public static final int action_settings=0x7f050001; + public static final int all=0x7f05000c; public static final int app_name=0x7f050000; + public static final int checkin=0x7f050006; + public static final int female=0x7f05000a; + public static final int fetch=0x7f050005; + public static final int focus=0x7f050007; public static final int hello_world=0x7f050002; - public static final int title_activity_init=0x7f050003; + public static final int male=0x7f050009; + public static final int mine=0x7f05000d; + public static final int search=0x7f050004; + public static final int settings=0x7f050003; + public static final int show_sex=0x7f050008; + public static final int show_team=0x7f05000b; + public static final int title_activity_login=0x7f05000e; + public static final int title_activity_main=0x7f05000f; + public static final int title_activity_setting=0x7f050010; } public static final class style { /** diff --git a/client/Piztor/res/values/strings.xml b/client/Piztor/res/values/strings.xml index 8e76dc0..5a5ccc4 100644 --- a/client/Piztor/res/values/strings.xml +++ b/client/Piztor/res/values/strings.xml @@ -1,9 +1,21 @@ -<?xml version="1.0" encoding="utf-8"?> <resources> - <string name="app_name">Piztor</string> + <string name="app_name">piztor</string> <string name="action_settings">Settings</string> <string name="hello_world">Hello world!</string> - <string name="title_activity_init">InitAct</string> + <string name="settings">Settings</string> + <string name="search">Search</string> + <string name="fetch">Fetch</string> + <string name="checkin">Checkin</string> + <string name="focus">Focus</string> + <string name="show_sex">Show sex: </string> + <string name="male">Male</string> + <string name="female">Female</string> + <string name="show_team">Show team: </string> + <string name="all">All</string> + <string name="mine">Mine</string> + <string name="title_activity_login">Login</string> + <string name="title_activity_main">Main</string> + <string name="title_activity_setting">Setting</string> </resources> diff --git a/client/Piztor/src/com/macaroon/piztor/ActMgr.java b/client/Piztor/src/com/macaroon/piztor/ActMgr.java index 81fa6f2..4df6bae 100644 --- a/client/Piztor/src/com/macaroon/piztor/ActMgr.java +++ b/client/Piztor/src/com/macaroon/piztor/ActMgr.java @@ -21,8 +21,7 @@ public class ActMgr { } void trigger(int event) { - for (Integer i : mp.get(nowStatus).keySet()) - System.out.println(i); + System.out.println(act.id + " : " + event); if (mp.get(nowStatus).containsKey(event)) { nowStatus.leave(event); nowStatus = mp.get(nowStatus).get(event); diff --git a/client/Piztor/src/com/macaroon/piztor/AppMgr.java b/client/Piztor/src/com/macaroon/piztor/AppMgr.java index 9259786..2e5e2b3 100644 --- a/client/Piztor/src/com/macaroon/piztor/AppMgr.java +++ b/client/Piztor/src/com/macaroon/piztor/AppMgr.java @@ -4,6 +4,7 @@ import java.util.HashMap; import android.annotation.SuppressLint; import android.content.Intent; +import android.os.Handler; @SuppressLint("UseSparseArrays") public class AppMgr { @@ -13,7 +14,17 @@ public class AppMgr { } static ActivityStatus status; static PiztorAct nowAct; - + //TODO fix + static Handler fromTransam, fromGPS; + static Transam transam = null; + static Tracker tracker = null; + static Thread tTransam, tGPS; + //Event + + final static int noToken = 101; + final static int loginSuccess = 102; + + static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp; static void setStatus(ActivityStatus st) { @@ -21,8 +32,12 @@ public class AppMgr { } static void trigger(int event) { - Intent i = new Intent(); + System.out.println(nowAct.id + " : " + event); + if (mp.get(nowAct.getClass()) == null) + System.out.println("first"); + else if (mp.get(nowAct.getClass()) == null) + System.out.println("second"); i.setClass(nowAct, mp.get(nowAct.getClass()).get(event)); nowAct.startActivity(i); } @@ -55,8 +70,20 @@ public class AppMgr { static void init() { mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>(); + fromTransam = new Handler(); + transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam); + fromGPS = new Handler(); + tracker = new Tracker(nowAct.getApplicationContext(), fromGPS); + tTransam = new Thread(transam); + tTransam.start(); + tGPS = new Thread(tracker); + tGPS.start(); + System.out.println("!!!!!!"); addStatus(InitAct.class); - + addStatus(Login.class); + addStatus(Main.class); + addTransition(InitAct.class, noToken, Login.class); + addTransition(Login.class, loginSuccess, Main.class); } } diff --git a/client/Piztor/src/com/macaroon/piztor/InitAct.java b/client/Piztor/src/com/macaroon/piztor/InitAct.java index 1ce492c..d5a6059 100644 --- a/client/Piztor/src/com/macaroon/piztor/InitAct.java +++ b/client/Piztor/src/com/macaroon/piztor/InitAct.java @@ -1,20 +1,32 @@ package com.macaroon.piztor; +import android.content.Intent; import android.os.Bundle; -import android.app.Activity; +import android.os.Handler; import android.view.Menu; -public class InitAct extends Activity { - +public class InitAct extends PiztorAct { + @Override protected void onCreate(Bundle savedInstanceState) { + id = "initAct"; super.onCreate(savedInstanceState); + AppMgr.init(); setContentView(R.layout.activity_init); } + + @Override + protected void onStart() { + super.onStart(); + if (UserInfo.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.init, menu); return true; } |