diff options
author | goblin911 <[email protected]> | 2013-08-25 07:52:49 +0800 |
---|---|---|
committer | goblin911 <[email protected]> | 2013-08-25 07:52:49 +0800 |
commit | 1c89054353cc6b1ff8e5849561d548b9648946d1 (patch) | |
tree | 8459f2269079f7065524f3f057c231d68791b874 | |
parent | 0f3318eba61d5c2975ed844659995e8f1ec2b1a9 (diff) |
new project!
106 files changed, 254 insertions, 931 deletions
diff --git a/client/activity-demo/Piztor/.classpath b/client/Piztor/.classpath index 5176974..7bc01d9 100644 --- a/client/activity-demo/Piztor/.classpath +++ b/client/Piztor/.classpath @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="src" path="gen"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="gen"/> <classpathentry kind="output" path="bin/classes"/> </classpath> diff --git a/client/activity-demo/Piztor/.project b/client/Piztor/.project index 97100ec..97100ec 100644 --- a/client/activity-demo/Piztor/.project +++ b/client/Piztor/.project diff --git a/client/activity-demo/Piztor/.settings/org.eclipse.jdt.core.prefs b/client/Piztor/.settings/org.eclipse.jdt.core.prefs index b080d2d..b080d2d 100644 --- a/client/activity-demo/Piztor/.settings/org.eclipse.jdt.core.prefs +++ b/client/Piztor/.settings/org.eclipse.jdt.core.prefs diff --git a/client/activity-demo/Piztor/AndroidManifest.xml b/client/Piztor/AndroidManifest.xml index 10e170f..63cb8ff 100644 --- a/client/activity-demo/Piztor/AndroidManifest.xml +++ b/client/Piztor/AndroidManifest.xml @@ -1,17 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.piztor" + package="com.macaroon.piztor" android:versionCode="1" android:versionName="1.0" > - - <uses-permission android:name="android.permission.INTERNET" /> - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> - <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> - <uses-permission android:name="android.permission.WAKE_LOCK"/> - <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/> <uses-sdk - android:minSdkVersion="9" + android:minSdkVersion="8" android:targetSdkVersion="17" /> <application @@ -20,7 +14,7 @@ android:label="@string/app_name" android:theme="@style/AppTheme" > <activity - android:name="com.example.piztor.MainActivity" + android:name="com.macaroon.piztor.Main" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> @@ -29,8 +23,13 @@ </intent-filter> </activity> <activity - android:name="com.example.piztor.Running" - android:label="@string/title_activity_running" > + 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> </activity> </application> diff --git a/client/activity-demo/Piztor/bin/AndroidManifest.xml b/client/Piztor/bin/AndroidManifest.xml index 10e170f..63cb8ff 100644 --- a/client/activity-demo/Piztor/bin/AndroidManifest.xml +++ b/client/Piztor/bin/AndroidManifest.xml @@ -1,17 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.piztor" + package="com.macaroon.piztor" android:versionCode="1" android:versionName="1.0" > - - <uses-permission android:name="android.permission.INTERNET" /> - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> - <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> - <uses-permission android:name="android.permission.WAKE_LOCK"/> - <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/> <uses-sdk - android:minSdkVersion="9" + android:minSdkVersion="8" android:targetSdkVersion="17" /> <application @@ -20,7 +14,7 @@ android:label="@string/app_name" android:theme="@style/AppTheme" > <activity - android:name="com.example.piztor.MainActivity" + android:name="com.macaroon.piztor.Main" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> @@ -29,8 +23,13 @@ </intent-filter> </activity> <activity - android:name="com.example.piztor.Running" - android:label="@string/title_activity_running" > + 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> </activity> </application> diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/ActMgr.class b/client/Piztor/bin/classes/com/macaroon/piztor/ActMgr.class Binary files differnew file mode 100644 index 0000000..1b1c693 --- /dev/null +++ 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 differnew file mode 100644 index 0000000..1f3df48 --- /dev/null +++ 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 differnew file mode 100644 index 0000000..496344b --- /dev/null +++ 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 differnew file mode 100644 index 0000000..107bcad --- /dev/null +++ b/client/Piztor/bin/classes/com/macaroon/piztor/AppMgr.class diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/BuildConfig.class b/client/Piztor/bin/classes/com/macaroon/piztor/BuildConfig.class Binary files differnew file mode 100644 index 0000000..566eb01 --- /dev/null +++ b/client/Piztor/bin/classes/com/macaroon/piztor/BuildConfig.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 differnew file mode 100644 index 0000000..c656689 --- /dev/null +++ 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 differnew file mode 100644 index 0000000..6a8e04d --- /dev/null +++ b/client/Piztor/bin/classes/com/macaroon/piztor/InitAct.class diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/PiztorAct.class b/client/Piztor/bin/classes/com/macaroon/piztor/PiztorAct.class Binary files differnew file mode 100644 index 0000000..4a3fc81 --- /dev/null +++ b/client/Piztor/bin/classes/com/macaroon/piztor/PiztorAct.class diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R$attr.class b/client/Piztor/bin/classes/com/macaroon/piztor/R$attr.class Binary files differnew file mode 100644 index 0000000..a95e1ab --- /dev/null +++ b/client/Piztor/bin/classes/com/macaroon/piztor/R$attr.class diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R$dimen.class b/client/Piztor/bin/classes/com/macaroon/piztor/R$dimen.class Binary files differnew file mode 100644 index 0000000..4bc657f --- /dev/null +++ b/client/Piztor/bin/classes/com/macaroon/piztor/R$dimen.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 differnew file mode 100644 index 0000000..5444d98 --- /dev/null +++ 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 differnew file mode 100644 index 0000000..8577179 --- /dev/null +++ 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 differnew file mode 100644 index 0000000..fab7556 --- /dev/null +++ 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 differnew file mode 100644 index 0000000..cec6e5a --- /dev/null +++ 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 differnew file mode 100644 index 0000000..a78c834 --- /dev/null +++ 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 differnew file mode 100644 index 0000000..42ddcce --- /dev/null +++ b/client/Piztor/bin/classes/com/macaroon/piztor/R$style.class diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R.class b/client/Piztor/bin/classes/com/macaroon/piztor/R.class Binary files differnew file mode 100644 index 0000000..d173856 --- /dev/null +++ b/client/Piztor/bin/classes/com/macaroon/piztor/R.class diff --git a/client/activity-demo/Piztor/gen/com/example/piztor/BuildConfig.java b/client/Piztor/gen/com/macaroon/piztor/BuildConfig.java index e2a8a2d..833e650 100644 --- a/client/activity-demo/Piztor/gen/com/example/piztor/BuildConfig.java +++ b/client/Piztor/gen/com/macaroon/piztor/BuildConfig.java @@ -1,5 +1,5 @@ /** Automatically generated file. DO NOT MODIFY */ -package com.example.piztor; +package com.macaroon.piztor; public final class BuildConfig { public final static boolean DEBUG = true; diff --git a/client/activity-demo/Piztor/gen/com/example/piztor/R.java b/client/Piztor/gen/com/macaroon/piztor/R.java index 6e48ffd..9821c7f 100644 --- a/client/activity-demo/Piztor/gen/com/example/piztor/R.java +++ b/client/Piztor/gen/com/macaroon/piztor/R.java @@ -5,7 +5,7 @@ * should not be modified by hand. */ -package com.example.piztor; +package com.macaroon.piztor; public final class R { public static final class attr { @@ -21,31 +21,23 @@ public final class R { public static final int activity_vertical_margin=0x7f040001; } public static final class drawable { - public static final int data=0x7f020000; - public static final int ic_launcher=0x7f020001; + public static final int ic_launcher=0x7f020000; } public static final class id { - public static final int action_settings=0x7f080006; - public static final int ip=0x7f080003; - public static final int login=0x7f080002; - public static final int password=0x7f080001; - public static final int port=0x7f080004; - public static final int username=0x7f080000; - public static final int view=0x7f080005; + public static final int action_settings=0x7f080000; } public static final class layout { - public static final int activity_main=0x7f030000; - public static final int activity_running=0x7f030001; + public static final int activity_init=0x7f030000; } public static final class menu { - public static final int main=0x7f070000; - public static final int running=0x7f070001; + public static final int init=0x7f070000; + public static final int main=0x7f070001; } public static final class string { public static final int action_settings=0x7f050001; public static final int app_name=0x7f050000; public static final int hello_world=0x7f050002; - public static final int title_activity_running=0x7f050003; + public static final int title_activity_init=0x7f050003; } public static final class style { /** diff --git a/client/activity-demo/Piztor/ic_launcher-web.png b/client/Piztor/ic_launcher-web.png Binary files differindex a18cbb4..a18cbb4 100644 --- a/client/activity-demo/Piztor/ic_launcher-web.png +++ b/client/Piztor/ic_launcher-web.png diff --git a/client/activity-demo/Piztor/libs/android-support-v4.jar b/client/Piztor/libs/android-support-v4.jar Binary files differindex cf12d28..cf12d28 100644 --- a/client/activity-demo/Piztor/libs/android-support-v4.jar +++ b/client/Piztor/libs/android-support-v4.jar diff --git a/client/activity-demo/Piztor/proguard-project.txt b/client/Piztor/proguard-project.txt index f2fe155..f2fe155 100644 --- a/client/activity-demo/Piztor/proguard-project.txt +++ b/client/Piztor/proguard-project.txt diff --git a/client/activity-demo/Piztor/project.properties b/client/Piztor/project.properties index ce39f2d..ce39f2d 100644 --- a/client/activity-demo/Piztor/project.properties +++ b/client/Piztor/project.properties diff --git a/client/activity-demo/Piztor/res/drawable-hdpi/ic_launcher.png b/client/Piztor/res/drawable-hdpi/ic_launcher.png Binary files differindex 288b665..288b665 100644 --- a/client/activity-demo/Piztor/res/drawable-hdpi/ic_launcher.png +++ b/client/Piztor/res/drawable-hdpi/ic_launcher.png diff --git a/client/activity-demo/Piztor/res/drawable-mdpi/ic_launcher.png b/client/Piztor/res/drawable-mdpi/ic_launcher.png Binary files differindex 6ae570b..6ae570b 100644 --- a/client/activity-demo/Piztor/res/drawable-mdpi/ic_launcher.png +++ b/client/Piztor/res/drawable-mdpi/ic_launcher.png diff --git a/client/activity-demo/Piztor/res/drawable-xhdpi/ic_launcher.png b/client/Piztor/res/drawable-xhdpi/ic_launcher.png Binary files differindex d4fb7cd..d4fb7cd 100644 --- a/client/activity-demo/Piztor/res/drawable-xhdpi/ic_launcher.png +++ b/client/Piztor/res/drawable-xhdpi/ic_launcher.png diff --git a/client/activity-demo/Piztor/res/drawable-xxhdpi/ic_launcher.png b/client/Piztor/res/drawable-xxhdpi/ic_launcher.png Binary files differindex 85a6081..85a6081 100644 --- a/client/activity-demo/Piztor/res/drawable-xxhdpi/ic_launcher.png +++ b/client/Piztor/res/drawable-xxhdpi/ic_launcher.png diff --git a/client/Piztor/res/layout/activity_init.xml b/client/Piztor/res/layout/activity_init.xml new file mode 100644 index 0000000..43e6253 --- /dev/null +++ b/client/Piztor/res/layout/activity_init.xml @@ -0,0 +1,16 @@ +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:paddingBottom="@dimen/activity_vertical_margin" + android:paddingLeft="@dimen/activity_horizontal_margin" + android:paddingRight="@dimen/activity_horizontal_margin" + android:paddingTop="@dimen/activity_vertical_margin" + tools:context=".InitAct" > + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/hello_world" /> + +</RelativeLayout> diff --git a/client/activity-demo/Piztor/res/menu/main.xml b/client/Piztor/res/menu/init.xml index c002028..c002028 100644 --- a/client/activity-demo/Piztor/res/menu/main.xml +++ b/client/Piztor/res/menu/init.xml diff --git a/client/activity-demo/Piztor/res/menu/running.xml b/client/Piztor/res/menu/main.xml index c002028..c002028 100644 --- a/client/activity-demo/Piztor/res/menu/running.xml +++ b/client/Piztor/res/menu/main.xml diff --git a/client/activity-demo/Piztor/res/values-sw600dp/dimens.xml b/client/Piztor/res/values-sw600dp/dimens.xml index 44f01db..44f01db 100644 --- a/client/activity-demo/Piztor/res/values-sw600dp/dimens.xml +++ b/client/Piztor/res/values-sw600dp/dimens.xml diff --git a/client/activity-demo/Piztor/res/values-sw720dp-land/dimens.xml b/client/Piztor/res/values-sw720dp-land/dimens.xml index 61e3fa8..61e3fa8 100644 --- a/client/activity-demo/Piztor/res/values-sw720dp-land/dimens.xml +++ b/client/Piztor/res/values-sw720dp-land/dimens.xml diff --git a/client/activity-demo/Piztor/res/values-v11/styles.xml b/client/Piztor/res/values-v11/styles.xml index 3c02242..3c02242 100644 --- a/client/activity-demo/Piztor/res/values-v11/styles.xml +++ b/client/Piztor/res/values-v11/styles.xml diff --git a/client/activity-demo/Piztor/res/values-v14/styles.xml b/client/Piztor/res/values-v14/styles.xml index a91fd03..a91fd03 100644 --- a/client/activity-demo/Piztor/res/values-v14/styles.xml +++ b/client/Piztor/res/values-v14/styles.xml diff --git a/client/activity-demo/Piztor/res/values/dimens.xml b/client/Piztor/res/values/dimens.xml index 55c1e59..55c1e59 100644 --- a/client/activity-demo/Piztor/res/values/dimens.xml +++ b/client/Piztor/res/values/dimens.xml diff --git a/client/activity-demo/Piztor/res/values/strings.xml b/client/Piztor/res/values/strings.xml index e837025..8e76dc0 100644 --- a/client/activity-demo/Piztor/res/values/strings.xml +++ b/client/Piztor/res/values/strings.xml @@ -4,6 +4,6 @@ <string name="app_name">Piztor</string> <string name="action_settings">Settings</string> <string name="hello_world">Hello world!</string> - <string name="title_activity_running">Running</string> + <string name="title_activity_init">InitAct</string> </resources> diff --git a/client/activity-demo/Piztor/res/values/styles.xml b/client/Piztor/res/values/styles.xml index 6ce89c7..6ce89c7 100644 --- a/client/activity-demo/Piztor/res/values/styles.xml +++ b/client/Piztor/res/values/styles.xml diff --git a/client/Piztor/src/com/macaroon/piztor/ActMgr.java b/client/Piztor/src/com/macaroon/piztor/ActMgr.java new file mode 100644 index 0000000..81fa6f2 --- /dev/null +++ b/client/Piztor/src/com/macaroon/piztor/ActMgr.java @@ -0,0 +1,63 @@ +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/client/Piztor/src/com/macaroon/piztor/AppMgr.java b/client/Piztor/src/com/macaroon/piztor/AppMgr.java new file mode 100644 index 0000000..9259786 --- /dev/null +++ b/client/Piztor/src/com/macaroon/piztor/AppMgr.java @@ -0,0 +1,62 @@ +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/client/Piztor/src/com/macaroon/piztor/InitAct.java b/client/Piztor/src/com/macaroon/piztor/InitAct.java new file mode 100644 index 0000000..1ce492c --- /dev/null +++ b/client/Piztor/src/com/macaroon/piztor/InitAct.java @@ -0,0 +1,22 @@ +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 new file mode 100644 index 0000000..ad12b17 --- /dev/null +++ b/client/Piztor/src/com/macaroon/piztor/PiztorAct.java @@ -0,0 +1,60 @@ +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); + } + +} diff --git a/client/activity-demo/Piztor.rar b/client/activity-demo/Piztor.rar Binary files differdeleted file mode 100644 index 5ebf80c..0000000 --- a/client/activity-demo/Piztor.rar +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/Piztor.apk b/client/activity-demo/Piztor/bin/Piztor.apk Binary files differdeleted file mode 100644 index dbb2bb2..0000000 --- a/client/activity-demo/Piztor/bin/Piztor.apk +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes.dex b/client/activity-demo/Piztor/bin/classes.dex Binary files differdeleted file mode 100644 index d6bef19..0000000 --- a/client/activity-demo/Piztor/bin/classes.dex +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/BuildConfig.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/BuildConfig.class Binary files differdeleted file mode 100644 index 05d2e99..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/BuildConfig.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Controller.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Controller.class Binary files differdeleted file mode 100644 index e9b16d2..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Controller.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/GPSTracker$1.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/GPSTracker$1.class Binary files differdeleted file mode 100644 index 997b8f5..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/GPSTracker$1.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/GPSTracker$2.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/GPSTracker$2.class Binary files differdeleted file mode 100644 index a01d5ea..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/GPSTracker$2.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/GPSTracker.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/GPSTracker.class Binary files differdeleted file mode 100644 index ae89879..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/GPSTracker.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Login.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Login.class Binary files differdeleted file mode 100644 index dd08b6f..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Login.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/MainActivity$1.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/MainActivity$1.class Binary files differdeleted file mode 100644 index f3e6088..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/MainActivity$1.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/MainActivity.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/MainActivity.class Binary files differdeleted file mode 100644 index e390cf2..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/MainActivity.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/MyView.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/MyView.class Binary files differdeleted file mode 100644 index 441b92c..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/MyView.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Myrequest.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Myrequest.class Binary files differdeleted file mode 100644 index 80893f6..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Myrequest.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Myrespond.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Myrespond.class Binary files differdeleted file mode 100644 index a475cee..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Myrespond.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$attr.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$attr.class Binary files differdeleted file mode 100644 index bf7ee98..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$attr.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$dimen.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$dimen.class Binary files differdeleted file mode 100644 index a0d6549..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$dimen.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$drawable.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$drawable.class Binary files differdeleted file mode 100644 index 0438e22..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$drawable.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$id.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$id.class Binary files differdeleted file mode 100644 index 9139bf3..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$id.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$layout.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$layout.class Binary files differdeleted file mode 100644 index 6be2329..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$layout.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$menu.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$menu.class Binary files differdeleted file mode 100644 index 714190a..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$menu.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$string.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$string.class Binary files differdeleted file mode 100644 index d2df448..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$string.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$style.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$style.class Binary files differdeleted file mode 100644 index 07085b3..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$style.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R.class Binary files differdeleted file mode 100644 index 178a999..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/R.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Rmsg.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Rmsg.class Binary files differdeleted file mode 100644 index 9bcd917..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Rmsg.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Running.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Running.class Binary files differdeleted file mode 100644 index 4ed4b3d..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Running.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/SocketClient.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/SocketClient.class Binary files differdeleted file mode 100644 index 339dde4..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/SocketClient.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Tracker$GPSTask.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Tracker$GPSTask.class Binary files differdeleted file mode 100644 index 493b9e2..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Tracker$GPSTask.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Tracker.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Tracker.class Binary files differdeleted file mode 100644 index c3d6f0c..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Tracker.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Transam$1.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Transam$1.class Binary files differdeleted file mode 100644 index 91cf629..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Transam$1.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Transam$Timertk.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Transam$Timertk.class Binary files differdeleted file mode 100644 index 34edfdf..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Transam$Timertk.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Transam$thd.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Transam$thd.class Binary files differdeleted file mode 100644 index a40ea07..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Transam$thd.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Transam.class b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Transam.class Binary files differdeleted file mode 100644 index a94e978..0000000 --- a/client/activity-demo/Piztor/bin/classes/com/example/piztor/Transam.class +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/dexedLibs/android-support-v4-47342e257aecfcb7fb303475c203fee3.jar b/client/activity-demo/Piztor/bin/dexedLibs/android-support-v4-47342e257aecfcb7fb303475c203fee3.jar Binary files differdeleted file mode 100644 index b263924..0000000 --- a/client/activity-demo/Piztor/bin/dexedLibs/android-support-v4-47342e257aecfcb7fb303475c203fee3.jar +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/dexedLibs/android-support-v4-6b57c516e4d1603db1d416c633a3e0a1.jar b/client/activity-demo/Piztor/bin/dexedLibs/android-support-v4-6b57c516e4d1603db1d416c633a3e0a1.jar Binary files differdeleted file mode 100644 index 08c0c4b..0000000 --- a/client/activity-demo/Piztor/bin/dexedLibs/android-support-v4-6b57c516e4d1603db1d416c633a3e0a1.jar +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/jarlist.cache b/client/activity-demo/Piztor/bin/jarlist.cache deleted file mode 100644 index 0565465..0000000 --- a/client/activity-demo/Piztor/bin/jarlist.cache +++ /dev/null @@ -1,3 +0,0 @@ -# cache for current jar dependency. DO NOT EDIT. -# format is <lastModified> <length> <SHA-1> <path> -# Encoding is UTF-8 diff --git a/client/activity-demo/Piztor/bin/res/drawable-hdpi/ic_launcher.png b/client/activity-demo/Piztor/bin/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index efa7c5f..0000000 --- a/client/activity-demo/Piztor/bin/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/res/drawable-mdpi/ic_launcher.png b/client/activity-demo/Piztor/bin/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index ec27f2e..0000000 --- a/client/activity-demo/Piztor/bin/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/res/drawable-xhdpi/ic_launcher.png b/client/activity-demo/Piztor/bin/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 92fc57d..0000000 --- a/client/activity-demo/Piztor/bin/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/res/drawable-xxhdpi/ic_launcher.png b/client/activity-demo/Piztor/bin/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index b6f8f4e..0000000 --- a/client/activity-demo/Piztor/bin/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/client/activity-demo/Piztor/bin/resources.ap_ b/client/activity-demo/Piztor/bin/resources.ap_ Binary files differdeleted file mode 100644 index f0851cf..0000000 --- a/client/activity-demo/Piztor/bin/resources.ap_ +++ /dev/null diff --git a/client/activity-demo/Piztor/data.jpg b/client/activity-demo/Piztor/data.jpg Binary files differdeleted file mode 100644 index f549ec7..0000000 --- a/client/activity-demo/Piztor/data.jpg +++ /dev/null diff --git a/client/activity-demo/Piztor/res/drawable-hdpi/data.jpg b/client/activity-demo/Piztor/res/drawable-hdpi/data.jpg Binary files differdeleted file mode 100644 index f549ec7..0000000 --- a/client/activity-demo/Piztor/res/drawable-hdpi/data.jpg +++ /dev/null diff --git a/client/activity-demo/Piztor/res/drawable-ldpi/data.jpg b/client/activity-demo/Piztor/res/drawable-ldpi/data.jpg Binary files differdeleted file mode 100644 index f549ec7..0000000 --- a/client/activity-demo/Piztor/res/drawable-ldpi/data.jpg +++ /dev/null diff --git a/client/activity-demo/Piztor/res/drawable-mdpi/data.jpg b/client/activity-demo/Piztor/res/drawable-mdpi/data.jpg Binary files differdeleted file mode 100644 index f549ec7..0000000 --- a/client/activity-demo/Piztor/res/drawable-mdpi/data.jpg +++ /dev/null diff --git a/client/activity-demo/Piztor/res/drawable-xhdpi/data.jpg b/client/activity-demo/Piztor/res/drawable-xhdpi/data.jpg Binary files differdeleted file mode 100644 index f549ec7..0000000 --- a/client/activity-demo/Piztor/res/drawable-xhdpi/data.jpg +++ /dev/null diff --git a/client/activity-demo/Piztor/res/drawable-xxhdpi/data.jpg b/client/activity-demo/Piztor/res/drawable-xxhdpi/data.jpg Binary files differdeleted file mode 100644 index f549ec7..0000000 --- a/client/activity-demo/Piztor/res/drawable-xxhdpi/data.jpg +++ /dev/null diff --git a/client/activity-demo/Piztor/res/layout/activity_main.xml b/client/activity-demo/Piztor/res/layout/activity_main.xml deleted file mode 100644 index 075a1f6..0000000 --- a/client/activity-demo/Piztor/res/layout/activity_main.xml +++ /dev/null @@ -1,44 +0,0 @@ -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - - android:orientation="vertical" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - > - - <EditText - android:id="@+id/username" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:ems="10" - android:inputType="textPersonName" > - - <requestFocus /> - </EditText> - - <EditText - android:id="@+id/password" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:ems="10" - android:inputType="textPassword" /> - - <Button - android:id="@+id/login" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="login" /> - - <EditText - android:id="@+id/ip" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:ems="10" /> - - <EditText - android:id="@+id/port" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:ems="10" /> - -</LinearLayout> diff --git a/client/activity-demo/Piztor/res/layout/activity_running.xml b/client/activity-demo/Piztor/res/layout/activity_running.xml deleted file mode 100644 index f52531a..0000000 --- a/client/activity-demo/Piztor/res/layout/activity_running.xml +++ /dev/null @@ -1,14 +0,0 @@ -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - - android:orientation="vertical" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - > - - <com.example.piztor.MyView - android:id="@+id/view" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> - -</LinearLayout>
\ No newline at end of file diff --git a/client/activity-demo/Piztor/src/com/example/piztor/Controller.java b/client/activity-demo/Piztor/src/com/example/piztor/Controller.java deleted file mode 100644 index d6e75d7..0000000 --- a/client/activity-demo/Piztor/src/com/example/piztor/Controller.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.example.piztor; - - -public class Controller { - String userToken; - Running run; - - Controller() { - run = null; - userToken = null; - } - - void setRun(Running run) { - this.run = run; - } - - void recieveInfo(Myrespond r) { - if (r.wrong != null) { - System.out.println(r.wrong); - } else { - System.out.println("yeal!"); - } - } - - void recieveLocation(double x, double y) { - System.out.println(x + " xxxx " + y); - run.v.changMyLocation(x, y); - } -} diff --git a/client/activity-demo/Piztor/src/com/example/piztor/GPSTracker.java b/client/activity-demo/Piztor/src/com/example/piztor/GPSTracker.java deleted file mode 100644 index 13cb868..0000000 --- a/client/activity-demo/Piztor/src/com/example/piztor/GPSTracker.java +++ /dev/null @@ -1,206 +0,0 @@ -package com.example.piztor;
-
-import android.app.AlertDialog;
-import android.app.Service;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.provider.Settings;
-import android.util.Log;
-
-public class GPSTracker extends Service implements LocationListener {
-
- private final Context mContext;
-
- // flag for GPS status
- boolean isGPSEnabled = false;
-
- // flag for network status
- boolean isNetworkEnabled = false;
-
- // flag for GPS status
- boolean canGetLocation = false;
-
- Location location; // location
- double latitude; // latitude
- double longitude; // longitude
-
- // The minimum distance to change Updates in meters
- private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
-
- // The minimum time between updates in milliseconds
- private static final long MIN_TIME_BW_UPDATES = 1000 * 10; // 10 seconds
-
- // Declaring a Location Manager
- protected LocationManager locationManager;
-
- public GPSTracker(Context context) {
- this.mContext = context;
- getLocation();
- }
-
- public Location getLocation() {
- try {
- locationManager = (LocationManager) mContext
- .getSystemService(LOCATION_SERVICE);
-
- // getting GPS status
- isGPSEnabled = locationManager
- .isProviderEnabled(LocationManager.GPS_PROVIDER);
-
- // getting network status
- isNetworkEnabled = locationManager
- .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
-
- if (!isGPSEnabled) {
- // no network provider is enabled
- } else {
- this.canGetLocation = true;
- if (isNetworkEnabled) {
- locationManager.requestLocationUpdates(
- LocationManager.NETWORK_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("Network", "Network");
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
- }
- }
- }
- // if GPS Enabled get lat/long using GPS Services
- if (isGPSEnabled) {
- if (location == null) {
- locationManager.requestLocationUpdates(
- LocationManager.GPS_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("GPS Enabled", "GPS Enabled");
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.GPS_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
- }
- }
- }
- }
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- return location;
- }
-
- /**
- * Stop using GPS listener Calling this function will stop using GPS in your
- * app
- * */
- public void stopUsingGPS() {
- if (locationManager != null) {
- locationManager.removeUpdates(GPSTracker.this);
- }
- }
-
- /**
- * Function to get latitude
- * */
- public double getLatitude() {
- if (location != null) {
- latitude = location.getLatitude();
- }
-
- // return latitude
- return latitude;
- }
-
- /**
- * Function to get longitude
- * */
- public double getLongitude() {
- if (location != null) {
- longitude = location.getLongitude();
- }
-
- // return longitude
- return longitude;
- }
-
- /**
- * Function to check GPS/wifi enabled
- *
- * @return boolean
- * */
- public boolean canGetLocation() {
- return this.canGetLocation;
- }
-
- /**
- * Function to show settings alert dialog On pressing Settings button will
- * lauch Settings Options
- * */
- public void showSettingsAlert() {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
-
- // Setting Dialog Title
- alertDialog.setTitle("GPS is settings");
-
- // Setting Dialog Message
- alertDialog
- .setMessage("GPS is not enabled. Do you want to go to settings menu?");
-
- // On pressing Settings button
- alertDialog.setPositiveButton("Settings",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(
- Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- mContext.startActivity(intent);
- }
- });
-
- // on pressing cancel button
- alertDialog.setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
-
- // Showing Alert Message
- alertDialog.show();
- }
-
- @Override
- public void onLocationChanged(Location location) {
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- }
-
- @Override
- public void onProviderEnabled(String provider) {
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- }
-
- @Override
- public IBinder onBind(Intent arg0) {
- return null;
- }
-
-}
diff --git a/client/activity-demo/Piztor/src/com/example/piztor/Login.java b/client/activity-demo/Piztor/src/com/example/piztor/Login.java deleted file mode 100644 index de5cded..0000000 --- a/client/activity-demo/Piztor/src/com/example/piztor/Login.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.example.piztor; - -public class Login { - MainActivity main; - int tk; - - Login(MainActivity main) { - this.main = main; - } - - void success(int token) { - //main.start(); - tk = token; - System.out.println("token!"); - } - - void failed() { - System.out.println("fuck!!"); - } -} diff --git a/client/activity-demo/Piztor/src/com/example/piztor/MainActivity.java b/client/activity-demo/Piztor/src/com/example/piztor/MainActivity.java deleted file mode 100644 index 38c6938..0000000 --- a/client/activity-demo/Piztor/src/com/example/piztor/MainActivity.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.example.piztor; - -import java.io.PrintStream; -import java.util.Vector; - -import android.app.Activity; -import android.content.Intent; -import android.os.Bundle; -import android.view.Menu; -import android.view.View; -import android.widget.Button; -import android.widget.EditText; - -public class MainActivity extends Activity { - PrintStream cout = System.out; - Button b; - EditText username, password, ip, port; - Login login; - Controller c; - boolean flag = false; - public final static String SER_KEY = "CONTROL"; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - login = new Login(this); - c = new Controller(); - b = (Button) findViewById(R.id.login); - - b.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - if(flag==false){ - Vector<Object> r = new Vector<Object>(); - r.add(0); - r.add(username.getText().toString()); - r.add(password.getText().toString()); - Transam t = new Transam(ip.getText().toString(), Integer - .parseInt(port.getText().toString()), new Myrequest(r), - login); - new Thread(t).run(); - flag = true; - } - else{ - Vector<Object> r = new Vector<Object>(); - r.add(3); - r.add(login.tk); - r.add(1); - Transam t = new Transam(ip.getText().toString(), Integer - .parseInt(port.getText().toString()), new Myrequest(r), - c); - new Thread(t).run(); - } - } - }); - username = (EditText) findViewById(R.id.username); - password = (EditText) findViewById(R.id.password); - ip = (EditText) findViewById(R.id.ip); - port = (EditText) findViewById(R.id.port); - cout.println("onCreate!"); - } - - void start() { - Intent i = new Intent(); - i.setClass(MainActivity.this, Running.class); - startActivity(i); - } - - @Override - protected void onStart() { - super.onStart(); - ip.setText("69.85.86.42"); - port.setText("9990"); - username.setText("hello"); - password.setText("world"); - cout.println("onStart!"); - } - - @Override - protected void onRestart() { - super.onRestart(); - cout.println("onRestart!"); - } - - @Override - protected void onResume() { - super.onResume(); - // cout.println("onResume!"); - // v.drawString("!!!!!"); - } - - @Override - protected void onPause() { - super.onPause(); - cout.println("onPause!"); - } - - @Override - protected void onStop() { - super.onStop(); - cout.println("onStop!"); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - cout.println("onDestroy!"); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.main, menu); - return true; - } - -} diff --git a/client/activity-demo/Piztor/src/com/example/piztor/MyView.java b/client/activity-demo/Piztor/src/com/example/piztor/MyView.java deleted file mode 100644 index a213013..0000000 --- a/client/activity-demo/Piztor/src/com/example/piztor/MyView.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.example.piztor; - -import java.io.PrintStream; -import java.util.Vector; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.graphics.Paint.Style; -import android.graphics.Point; -import android.util.AttributeSet; -import android.view.MotionEvent; -import android.view.View; - -public class MyView extends View { - static PrintStream cout = System.out; - private Paint mPaint, oPaint; - public Canvas c = null; - public Bitmap b = null; - public double scale = 1; - public double centerX, centerY; - - - Point myLocation; - Vector<Point> Location; - - void setup(Canvas c, Bitmap b, double x, double y) { - this.c = c; - this.b = b; - centerX = x; - centerY = y; - myLocation = new Point(10, 10); - Location = new Vector<Point>(); - Location.add(myLocation); - } - - public MyView(Context context) { - super(context); - // v = new Vector<PointF>(); - mPaint = new Paint(); - mPaint.setColor(Color.RED); - mPaint.setStyle(Style.FILL); - oPaint = new Paint(); - oPaint.setColor(Color.BLUE); - oPaint.setStyle(Style.FILL); - } - - public MyView(Context context, AttributeSet attr) { - super(context, attr); - // v = new Vector<PointF>(); - mPaint = new Paint(); - mPaint.setColor(Color.RED); - mPaint.setStyle(Style.FILL); - } - - @Override - protected void onDraw(Canvas canvas) { - super.onDraw(canvas); - cout.println(myLocation.x + " -- " + myLocation.y); - canvas.drawCircle(myLocation.x, myLocation.y, 5, mPaint); - //canvas.drawBitmap(b, 0, 0, mPaint); - /*for (int i = 1; i < Location.size(); i++) { - canvas.drawCircle(Location.get(i).x, Location.get(i).y, 2, oPaint); - }*/ - // canvas.restore(); - } - - @Override - public boolean onTouchEvent(MotionEvent e) { - // v.add(new PointF(e.getX(), e.getY())); - c.drawRect(e.getX() - 1, e.getY() + 1, e.getX() + 1, e.getY() - 1, - mPaint); - - invalidate(); - return true; - } - - void changMyLocation(double x, double y) { - if (centerX < 0) { - centerX = x; - centerY = y; - } - int x1 = (int) (getWidth() / 2 + (x - centerX) * scale); - int y1 = (int) (getHeight() / 2 + (y - centerY) * scale); - myLocation.x = x1; - myLocation.y = y1; - cout.println(x + " " + y); - invalidate(); - } - - void drawString(String s) { - mPaint.setTextSize(15); - c.drawText(s, 0, getHeight() / 2, mPaint); - invalidate(); - } - -}
\ No newline at end of file diff --git a/client/activity-demo/Piztor/src/com/example/piztor/Myrequest.java b/client/activity-demo/Piztor/src/com/example/piztor/Myrequest.java deleted file mode 100644 index 9397e0c..0000000 --- a/client/activity-demo/Piztor/src/com/example/piztor/Myrequest.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.example.piztor; - -import java.util.Vector; - -public class Myrequest{ - public Vector<Object> contain; - Myrequest(Vector<Object> info){ - contain = info; - } -}
\ No newline at end of file diff --git a/client/activity-demo/Piztor/src/com/example/piztor/Myrespond.java b/client/activity-demo/Piztor/src/com/example/piztor/Myrespond.java deleted file mode 100644 index 2398f2b..0000000 --- a/client/activity-demo/Piztor/src/com/example/piztor/Myrespond.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.example.piztor; - -import java.util.Vector; - -public class Myrespond{ - public Vector<Object> contain; - public String wrong; - Myrespond(){ - wrong = null; - contain = new Vector<Object>(); - } -}
\ No newline at end of file diff --git a/client/activity-demo/Piztor/src/com/example/piztor/Rmsg.java b/client/activity-demo/Piztor/src/com/example/piztor/Rmsg.java deleted file mode 100644 index 8f4f587..0000000 --- a/client/activity-demo/Piztor/src/com/example/piztor/Rmsg.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.example.piztor; - -public class Rmsg{ - int id; - double lat; - double lot; - Rmsg(int i,double l,double ll){ - id = i; - lat = l; - lot = ll; - } -}
\ No newline at end of file diff --git a/client/activity-demo/Piztor/src/com/example/piztor/Running.java b/client/activity-demo/Piztor/src/com/example/piztor/Running.java deleted file mode 100644 index f4b6135..0000000 --- a/client/activity-demo/Piztor/src/com/example/piztor/Running.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.example.piztor; - -import java.io.PrintStream; - -import android.os.Bundle; -import android.app.Activity; -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.view.Menu; - -public class Running extends Activity { - PrintStream cout = System.out; - MyView v; - Bitmap b; - Canvas c; - Controller controller; - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - b = Bitmap.createBitmap(720, 1280, Bitmap.Config.ARGB_8888); - c = new Canvas(b); - controller = new Controller(); - controller.setRun(this); - setContentView(R.layout.activity_running); - cout.println("running is created!!!"); - } - - @Override - protected void onStart() { - super.onStart(); - v = (MyView) findViewById(R.id.view); - v.setup(c, b, -1, -1); - Tracker tr = new Tracker(controller, Running.this); - new Thread(tr).run(); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.running, menu); - return true; - } - -} diff --git a/client/activity-demo/Piztor/src/com/example/piztor/SocketClient.java b/client/activity-demo/Piztor/src/com/example/piztor/SocketClient.java deleted file mode 100644 index 472da0d..0000000 --- a/client/activity-demo/Piztor/src/com/example/piztor/SocketClient.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.example.piztor; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.net.Socket; -import java.net.UnknownHostException; - -public class SocketClient { - static PrintStream cout = System.out; - static Socket client; - - public SocketClient(String site, int port) throws UnknownHostException, - IOException { - try { - cout.println(site + " " + port); - client = new Socket(site, port); - cout.println("connected successfully!!!"); - } catch (UnknownHostException e) { - cout.println("unknownhostexception!!"); - throw e; - } catch (IOException e) { - cout.println("IOException!!"); - throw e; - } - } - - public Myrespond sendMsg(Myrequest req) throws IOException { - try { - DataOutputStream out = new DataOutputStream( - client.getOutputStream()); - int tmp = (Integer) req.contain.get(0); - out.writeByte(tmp); - switch (tmp) { - case 0: - String id = (String) req.contain.get(1); - String pass = (String) req.contain.get(2); - out.writeBytes(id + "\0" + pass); - break; - case 1: - int tk1 = (Integer) req.contain.get(1); - int acc = (Integer) req.contain.get(2); - String mess = (String) req.contain.get(3); - out.writeInt(tk1); - out.writeInt(acc); - out.writeBytes(mess); - break; - case 2: - int tk2 = (Integer) req.contain.get(1); - double slot = (Double) req.contain.get(2); - double slat = (Double) req.contain.get(3); - out.writeInt(tk2); - out.writeDouble(slot); - out.writeDouble(slat); - break; - case 3: - int tk3 = (Integer) req.contain.get(1); - int gid = (Integer) req.contain.get(2); - out.writeInt(tk3); - out.writeInt(gid); - break; - } - out.flush(); - client.shutdownOutput(); - DataInputStream in = new DataInputStream(client.getInputStream()); - int type = in.readUnsignedByte(); - Myrespond r = new Myrespond(); - switch (type) { - case 0: - int id = in.readInt(); - int status = in.readUnsignedByte(); - r.contain.add(0); - r.contain.add(id); - r.contain.add(status); - System.out.println(id); - break; - case 1: - r.contain.add(1); - // reserved - break; - case 2: - r.contain.add(2); - // reserved - break; - case 3: - int n = in.readInt(); - r.contain.add(3); - r.contain.add(n); - for (int i = 1; i <= n; i++) { - int tid = in.readInt(); - double lat = in.readDouble(); - double lot = in.readDouble(); - Rmsg a = new Rmsg(tid,lat,lot); - r.contain.add(a); - } - break; - } - return r; - } catch (IOException e) { - throw e; - } - } - - public void closeSocket() { - try { - client.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - -} diff --git a/client/activity-demo/Piztor/src/com/example/piztor/Tracker.java b/client/activity-demo/Piztor/src/com/example/piztor/Tracker.java deleted file mode 100644 index 0222325..0000000 --- a/client/activity-demo/Piztor/src/com/example/piztor/Tracker.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.example.piztor; -import java.util.Timer; -import java.util.TimerTask; - -import android.content.Context; - -public class Tracker implements Runnable { - - private static final long TIME_DELTA = 1000 * 10; // 10 seconds - public Timer timer; - private final Context mContext; - Controller controller; - - public Tracker(Controller newController, Context context) { - timer = new Timer(); - mContext = context; - controller = newController; - } - - public void run() { - GPSTask t = new GPSTask(); - t.run(); - //timer.s -// timer.schedule(new GPSTask(), 0, TIME_DELTA); - } - - class GPSTask extends TimerTask { - @Override - public void run() { - GPSTracker tracker; - tracker = new GPSTracker(mContext); - System.out.println("can get location?"); - if(tracker.canGetLocation()) { - double latitude = tracker.getLatitude(); - double longitude = tracker.getLongitude(); - System.out.println("yes!"); - controller.recieveLocation(latitude, longitude); - } - } - } -} diff --git a/client/activity-demo/Piztor/src/com/example/piztor/Transam.java b/client/activity-demo/Piztor/src/com/example/piztor/Transam.java deleted file mode 100644 index 50b4186..0000000 --- a/client/activity-demo/Piztor/src/com/example/piztor/Transam.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.example.piztor; -import java.io.IOException; -import java.net.UnknownHostException; -import java.util.Timer; -import java.util.TimerTask; - -import android.annotation.SuppressLint; -import android.os.Handler; -import android.os.Message; - -public class Transam implements Runnable { - public Timer timer; - public boolean flag = true; - public boolean reqlog = false; - public int cnt = 2; - public int port; - public String ip; - Thread thread; - Myrequest req; - Myrespond res; - Controller core; - Login log; - - - Transam(String i,int p,Myrequest r,Login l){ - port = p; - ip = i; - req = r; - log = l; - reqlog = true; - } - - Transam(String i,int p,Myrequest r,Controller c){ - port = p; - ip = i; - req = r; - core = c; - } - - public void run() { - final thd t = new thd(); - flag = false; - thread = new Thread(t); - cnt = 4; - thread.start(); - timer = new Timer(); - TimerTask task = new Timertk(); - timer.schedule(task,5000,5000); - } - - class thd implements Runnable { - @Override - public void run() { - try{ - SocketClient client = new SocketClient(ip,port); - res = client.sendMsg(req); - if(!reqlog){ - core.recieveInfo(res); - } - else{ - if((Integer) res.contain.get(2)==0){ - int t = (Integer) res.contain.get(1); - log.success(t); - } - else{ - log.failed(); - } - } - Message msg = new Message(); - msg.what = 1; - handler.sendMessage(msg); - client.closeSocket(); - }catch (UnknownHostException e){ - e.printStackTrace(); - }catch (IOException e){ - e.printStackTrace(); - } - - } - } - - @SuppressLint("HandlerLeak") - Handler handler = new Handler(){ - public void handleMessage(Message msg) { - switch (msg.what) { - case 1: - flag = true; - break; - case 2: - if(!reqlog){ - res = new Myrespond(); - res.wrong = msg.obj.toString(); - core.recieveInfo(res); - } - else{ - log.failed(); - } - break; - case 3: - final thd t = new thd(); - thread = new Thread(t); - thread.start(); - break; - } - super.handleMessage(msg); - } - }; - - class Timertk extends TimerTask { - public void run() { - if(flag==false&&cnt>0){ - cnt--; - } - else if(cnt==0) { - Message msg = new Message(); - msg.obj = "connecting failed"; - msg.what = 2; - handler.sendMessage(msg); - timer.cancel(); - } - else if(flag==true){ - timer.cancel(); - } - } - }; -}
\ No newline at end of file |