diff options
Diffstat (limited to 'client/activity-demo/Piztor')
80 files changed, 1143 insertions, 0 deletions
diff --git a/client/activity-demo/Piztor/.classpath b/client/activity-demo/Piztor/.classpath new file mode 100644 index 0000000..7bc01d9 --- /dev/null +++ b/client/activity-demo/Piztor/.classpath @@ -0,0 +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="output" path="bin/classes"/> +</classpath> diff --git a/client/activity-demo/Piztor/.project b/client/activity-demo/Piztor/.project new file mode 100644 index 0000000..97100ec --- /dev/null +++ b/client/activity-demo/Piztor/.project @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>Piztor</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.android.ide.eclipse.adt.ApkBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>com.android.ide.eclipse.adt.AndroidNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/client/activity-demo/Piztor/.settings/org.eclipse.jdt.core.prefs b/client/activity-demo/Piztor/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..b080d2d --- /dev/null +++ b/client/activity-demo/Piztor/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/client/activity-demo/Piztor/AndroidManifest.xml b/client/activity-demo/Piztor/AndroidManifest.xml new file mode 100644 index 0000000..9561604 --- /dev/null +++ b/client/activity-demo/Piztor/AndroidManifest.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.example.piztor" + android:versionCode="1" + android:versionName="1.0" > + + <uses-sdk + android:minSdkVersion="9" + android:targetSdkVersion="17" /> + + <application + android:allowBackup="true" + android:icon="@drawable/ic_launcher" + android:label="@string/app_name" + android:theme="@style/AppTheme" > + <activity + android:name="com.example.piztor.MainActivity" + android:label="@string/app_name" > + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity + android:name="com.example.piztor.Running" + android:label="@string/title_activity_running" > + </activity> + </application> + +</manifest> diff --git a/client/activity-demo/Piztor/bin/AndroidManifest.xml b/client/activity-demo/Piztor/bin/AndroidManifest.xml new file mode 100644 index 0000000..9561604 --- /dev/null +++ b/client/activity-demo/Piztor/bin/AndroidManifest.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.example.piztor" + android:versionCode="1" + android:versionName="1.0" > + + <uses-sdk + android:minSdkVersion="9" + android:targetSdkVersion="17" /> + + <application + android:allowBackup="true" + android:icon="@drawable/ic_launcher" + android:label="@string/app_name" + android:theme="@style/AppTheme" > + <activity + android:name="com.example.piztor.MainActivity" + android:label="@string/app_name" > + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity + android:name="com.example.piztor.Running" + android:label="@string/title_activity_running" > + </activity> + </application> + +</manifest> diff --git a/client/activity-demo/Piztor/bin/Piztor.apk b/client/activity-demo/Piztor/bin/Piztor.apk Binary files differnew file mode 100644 index 0000000..fc36012 --- /dev/null +++ b/client/activity-demo/Piztor/bin/Piztor.apk diff --git a/client/activity-demo/Piztor/bin/classes.dex b/client/activity-demo/Piztor/bin/classes.dex Binary files differnew file mode 100644 index 0000000..f8a5442 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes.dex 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 differnew file mode 100644 index 0000000..05d2e99 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/BuildConfig.class 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 differnew file mode 100644 index 0000000..0b98ba7 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Controller.class 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 differnew file mode 100644 index 0000000..ffabec6 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/GPSTracker$1.class 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 differnew file mode 100644 index 0000000..ae2fc52 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/GPSTracker$2.class 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 differnew file mode 100644 index 0000000..ae8c248 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/GPSTracker.class 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 differnew file mode 100644 index 0000000..8145ba5 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Login.class 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 differnew file mode 100644 index 0000000..333a3c3 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/MainActivity$1.class 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 differnew file mode 100644 index 0000000..90f6d2e --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/MainActivity.class 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 differnew file mode 100644 index 0000000..19f49c1 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/MyView.class 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 differnew file mode 100644 index 0000000..80893f6 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Myrequest.class 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 differnew file mode 100644 index 0000000..a475cee --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Myrespond.class 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 differnew file mode 100644 index 0000000..bf7ee98 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$attr.class 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 differnew file mode 100644 index 0000000..a0d6549 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$dimen.class 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 differnew file mode 100644 index 0000000..0438e22 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$drawable.class 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 differnew file mode 100644 index 0000000..9139bf3 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$id.class 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 differnew file mode 100644 index 0000000..6be2329 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$layout.class 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 differnew file mode 100644 index 0000000..714190a --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$menu.class 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 differnew file mode 100644 index 0000000..d2df448 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$string.class 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 differnew file mode 100644 index 0000000..07085b3 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R$style.class 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 differnew file mode 100644 index 0000000..178a999 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/R.class 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 differnew file mode 100644 index 0000000..05f560c --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Running.class 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 differnew file mode 100644 index 0000000..29afa9c --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/SocketClient.class 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 differnew file mode 100644 index 0000000..a72e8f3 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Tracker$GPSTask.class 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 differnew file mode 100644 index 0000000..4cc54cd --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Tracker.class 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 differnew file mode 100644 index 0000000..5999fc1 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Transam$1.class 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 differnew file mode 100644 index 0000000..42f06c9 --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Transam$Timertk.class 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 differnew file mode 100644 index 0000000..e402d5b --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Transam$thd.class 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 differnew file mode 100644 index 0000000..60f93bf --- /dev/null +++ b/client/activity-demo/Piztor/bin/classes/com/example/piztor/Transam.class 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 differnew file mode 100644 index 0000000..08c0c4b --- /dev/null +++ b/client/activity-demo/Piztor/bin/dexedLibs/android-support-v4-6b57c516e4d1603db1d416c633a3e0a1.jar diff --git a/client/activity-demo/Piztor/bin/jarlist.cache b/client/activity-demo/Piztor/bin/jarlist.cache new file mode 100644 index 0000000..0565465 --- /dev/null +++ b/client/activity-demo/Piztor/bin/jarlist.cache @@ -0,0 +1,3 @@ +# 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 differnew file mode 100644 index 0000000..efa7c5f --- /dev/null +++ b/client/activity-demo/Piztor/bin/res/drawable-hdpi/ic_launcher.png 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 differnew file mode 100644 index 0000000..ec27f2e --- /dev/null +++ b/client/activity-demo/Piztor/bin/res/drawable-mdpi/ic_launcher.png 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 differnew file mode 100644 index 0000000..92fc57d --- /dev/null +++ b/client/activity-demo/Piztor/bin/res/drawable-xhdpi/ic_launcher.png 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 differnew file mode 100644 index 0000000..b6f8f4e --- /dev/null +++ b/client/activity-demo/Piztor/bin/res/drawable-xxhdpi/ic_launcher.png diff --git a/client/activity-demo/Piztor/bin/resources.ap_ b/client/activity-demo/Piztor/bin/resources.ap_ Binary files differnew file mode 100644 index 0000000..859ad06 --- /dev/null +++ b/client/activity-demo/Piztor/bin/resources.ap_ diff --git a/client/activity-demo/Piztor/data.jpg b/client/activity-demo/Piztor/data.jpg Binary files differnew file mode 100644 index 0000000..f549ec7 --- /dev/null +++ b/client/activity-demo/Piztor/data.jpg diff --git a/client/activity-demo/Piztor/gen/com/example/piztor/BuildConfig.java b/client/activity-demo/Piztor/gen/com/example/piztor/BuildConfig.java new file mode 100644 index 0000000..e2a8a2d --- /dev/null +++ b/client/activity-demo/Piztor/gen/com/example/piztor/BuildConfig.java @@ -0,0 +1,6 @@ +/** Automatically generated file. DO NOT MODIFY */ +package com.example.piztor; + +public final class BuildConfig { + public final static boolean DEBUG = true; +}
\ No newline at end of file diff --git a/client/activity-demo/Piztor/gen/com/example/piztor/R.java b/client/activity-demo/Piztor/gen/com/example/piztor/R.java new file mode 100644 index 0000000..6e48ffd --- /dev/null +++ b/client/activity-demo/Piztor/gen/com/example/piztor/R.java @@ -0,0 +1,78 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ + +package com.example.piztor; + +public final class R { + public static final class attr { + } + public static final class dimen { + /** Default screen margins, per the Android Design guidelines. + + Customize dimensions originally defined in res/values/dimens.xml (such as + screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. + + */ + public static final int activity_horizontal_margin=0x7f040000; + 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 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 class layout { + public static final int activity_main=0x7f030000; + public static final int activity_running=0x7f030001; + } + public static final class menu { + public static final int main=0x7f070000; + public static final int running=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 class style { + /** + Base application theme, dependent on API level. This theme is replaced + by AppBaseTheme from res/values-vXX/styles.xml on newer devices. + + + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + + + Base application theme for API 11+. This theme completely replaces + AppBaseTheme from res/values/styles.xml on API 11+ devices. + + API 11 theme customizations can go here. + + Base application theme for API 14+. This theme completely replaces + AppBaseTheme from BOTH res/values/styles.xml and + res/values-v11/styles.xml on API 14+ devices. + + API 14 theme customizations can go here. + */ + public static final int AppBaseTheme=0x7f060000; + /** Application theme. + All customizations that are NOT specific to a particular API-level can go here. + */ + public static final int AppTheme=0x7f060001; + } +} diff --git a/client/activity-demo/Piztor/ic_launcher-web.png b/client/activity-demo/Piztor/ic_launcher-web.png Binary files differnew file mode 100644 index 0000000..a18cbb4 --- /dev/null +++ b/client/activity-demo/Piztor/ic_launcher-web.png diff --git a/client/activity-demo/Piztor/libs/android-support-v4.jar b/client/activity-demo/Piztor/libs/android-support-v4.jar Binary files differnew file mode 100644 index 0000000..cf12d28 --- /dev/null +++ b/client/activity-demo/Piztor/libs/android-support-v4.jar diff --git a/client/activity-demo/Piztor/proguard-project.txt b/client/activity-demo/Piztor/proguard-project.txt new file mode 100644 index 0000000..f2fe155 --- /dev/null +++ b/client/activity-demo/Piztor/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/client/activity-demo/Piztor/project.properties b/client/activity-demo/Piztor/project.properties new file mode 100644 index 0000000..ce39f2d --- /dev/null +++ b/client/activity-demo/Piztor/project.properties @@ -0,0 +1,14 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-18 diff --git a/client/activity-demo/Piztor/res/drawable-hdpi/data.jpg b/client/activity-demo/Piztor/res/drawable-hdpi/data.jpg Binary files differnew file mode 100644 index 0000000..f549ec7 --- /dev/null +++ b/client/activity-demo/Piztor/res/drawable-hdpi/data.jpg diff --git a/client/activity-demo/Piztor/res/drawable-hdpi/ic_launcher.png b/client/activity-demo/Piztor/res/drawable-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..288b665 --- /dev/null +++ b/client/activity-demo/Piztor/res/drawable-hdpi/ic_launcher.png diff --git a/client/activity-demo/Piztor/res/drawable-ldpi/data.jpg b/client/activity-demo/Piztor/res/drawable-ldpi/data.jpg Binary files differnew file mode 100644 index 0000000..f549ec7 --- /dev/null +++ b/client/activity-demo/Piztor/res/drawable-ldpi/data.jpg diff --git a/client/activity-demo/Piztor/res/drawable-mdpi/data.jpg b/client/activity-demo/Piztor/res/drawable-mdpi/data.jpg Binary files differnew file mode 100644 index 0000000..f549ec7 --- /dev/null +++ b/client/activity-demo/Piztor/res/drawable-mdpi/data.jpg diff --git a/client/activity-demo/Piztor/res/drawable-mdpi/ic_launcher.png b/client/activity-demo/Piztor/res/drawable-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..6ae570b --- /dev/null +++ b/client/activity-demo/Piztor/res/drawable-mdpi/ic_launcher.png diff --git a/client/activity-demo/Piztor/res/drawable-xhdpi/data.jpg b/client/activity-demo/Piztor/res/drawable-xhdpi/data.jpg Binary files differnew file mode 100644 index 0000000..f549ec7 --- /dev/null +++ b/client/activity-demo/Piztor/res/drawable-xhdpi/data.jpg diff --git a/client/activity-demo/Piztor/res/drawable-xhdpi/ic_launcher.png b/client/activity-demo/Piztor/res/drawable-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..d4fb7cd --- /dev/null +++ b/client/activity-demo/Piztor/res/drawable-xhdpi/ic_launcher.png diff --git a/client/activity-demo/Piztor/res/drawable-xxhdpi/data.jpg b/client/activity-demo/Piztor/res/drawable-xxhdpi/data.jpg Binary files differnew file mode 100644 index 0000000..f549ec7 --- /dev/null +++ b/client/activity-demo/Piztor/res/drawable-xxhdpi/data.jpg diff --git a/client/activity-demo/Piztor/res/drawable-xxhdpi/ic_launcher.png b/client/activity-demo/Piztor/res/drawable-xxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..85a6081 --- /dev/null +++ b/client/activity-demo/Piztor/res/drawable-xxhdpi/ic_launcher.png diff --git a/client/activity-demo/Piztor/res/layout/activity_main.xml b/client/activity-demo/Piztor/res/layout/activity_main.xml new file mode 100644 index 0000000..075a1f6 --- /dev/null +++ b/client/activity-demo/Piztor/res/layout/activity_main.xml @@ -0,0 +1,44 @@ +<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 new file mode 100644 index 0000000..f52531a --- /dev/null +++ b/client/activity-demo/Piztor/res/layout/activity_running.xml @@ -0,0 +1,14 @@ +<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/res/menu/main.xml b/client/activity-demo/Piztor/res/menu/main.xml new file mode 100644 index 0000000..c002028 --- /dev/null +++ b/client/activity-demo/Piztor/res/menu/main.xml @@ -0,0 +1,9 @@ +<menu xmlns:android="http://schemas.android.com/apk/res/android" > + + <item + android:id="@+id/action_settings" + android:orderInCategory="100" + android:showAsAction="never" + android:title="@string/action_settings"/> + +</menu> diff --git a/client/activity-demo/Piztor/res/menu/running.xml b/client/activity-demo/Piztor/res/menu/running.xml new file mode 100644 index 0000000..c002028 --- /dev/null +++ b/client/activity-demo/Piztor/res/menu/running.xml @@ -0,0 +1,9 @@ +<menu xmlns:android="http://schemas.android.com/apk/res/android" > + + <item + android:id="@+id/action_settings" + android:orderInCategory="100" + android:showAsAction="never" + android:title="@string/action_settings"/> + +</menu> diff --git a/client/activity-demo/Piztor/res/values-sw600dp/dimens.xml b/client/activity-demo/Piztor/res/values-sw600dp/dimens.xml new file mode 100644 index 0000000..44f01db --- /dev/null +++ b/client/activity-demo/Piztor/res/values-sw600dp/dimens.xml @@ -0,0 +1,8 @@ +<resources> + + <!-- + Customize dimensions originally defined in res/values/dimens.xml (such as + screen margins) for sw600dp devices (e.g. 7" tablets) here. + --> + +</resources> diff --git a/client/activity-demo/Piztor/res/values-sw720dp-land/dimens.xml b/client/activity-demo/Piztor/res/values-sw720dp-land/dimens.xml new file mode 100644 index 0000000..61e3fa8 --- /dev/null +++ b/client/activity-demo/Piztor/res/values-sw720dp-land/dimens.xml @@ -0,0 +1,9 @@ +<resources> + + <!-- + Customize dimensions originally defined in res/values/dimens.xml (such as + screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. + --> + <dimen name="activity_horizontal_margin">128dp</dimen> + +</resources> diff --git a/client/activity-demo/Piztor/res/values-v11/styles.xml b/client/activity-demo/Piztor/res/values-v11/styles.xml new file mode 100644 index 0000000..3c02242 --- /dev/null +++ b/client/activity-demo/Piztor/res/values-v11/styles.xml @@ -0,0 +1,11 @@ +<resources> + + <!-- + Base application theme for API 11+. This theme completely replaces + AppBaseTheme from res/values/styles.xml on API 11+ devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Holo.Light"> + <!-- API 11 theme customizations can go here. --> + </style> + +</resources> diff --git a/client/activity-demo/Piztor/res/values-v14/styles.xml b/client/activity-demo/Piztor/res/values-v14/styles.xml new file mode 100644 index 0000000..a91fd03 --- /dev/null +++ b/client/activity-demo/Piztor/res/values-v14/styles.xml @@ -0,0 +1,12 @@ +<resources> + + <!-- + Base application theme for API 14+. This theme completely replaces + AppBaseTheme from BOTH res/values/styles.xml and + res/values-v11/styles.xml on API 14+ devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar"> + <!-- API 14 theme customizations can go here. --> + </style> + +</resources> diff --git a/client/activity-demo/Piztor/res/values/dimens.xml b/client/activity-demo/Piztor/res/values/dimens.xml new file mode 100644 index 0000000..55c1e59 --- /dev/null +++ b/client/activity-demo/Piztor/res/values/dimens.xml @@ -0,0 +1,7 @@ +<resources> + + <!-- Default screen margins, per the Android Design guidelines. --> + <dimen name="activity_horizontal_margin">16dp</dimen> + <dimen name="activity_vertical_margin">16dp</dimen> + +</resources> diff --git a/client/activity-demo/Piztor/res/values/strings.xml b/client/activity-demo/Piztor/res/values/strings.xml new file mode 100644 index 0000000..e837025 --- /dev/null +++ b/client/activity-demo/Piztor/res/values/strings.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <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> + +</resources> diff --git a/client/activity-demo/Piztor/res/values/styles.xml b/client/activity-demo/Piztor/res/values/styles.xml new file mode 100644 index 0000000..6ce89c7 --- /dev/null +++ b/client/activity-demo/Piztor/res/values/styles.xml @@ -0,0 +1,20 @@ +<resources> + + <!-- + Base application theme, dependent on API level. This theme is replaced + by AppBaseTheme from res/values-vXX/styles.xml on newer devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Light"> + <!-- + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + --> + </style> + + <!-- Application theme. --> + <style name="AppTheme" parent="AppBaseTheme"> + <!-- All customizations that are NOT specific to a particular API-level can go here. --> + </style> + +</resources> diff --git a/client/activity-demo/Piztor/src/com/example/piztor/Controller.java b/client/activity-demo/Piztor/src/com/example/piztor/Controller.java new file mode 100644 index 0000000..6e55581 --- /dev/null +++ b/client/activity-demo/Piztor/src/com/example/piztor/Controller.java @@ -0,0 +1,30 @@ +package com.example.piztor; + +import java.io.Serializable; +import android.content.Intent; + +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) { + run.v.drawLocation(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 new file mode 100644 index 0000000..e592ba3 --- /dev/null +++ b/client/activity-demo/Piztor/src/com/example/piztor/GPSTracker.java @@ -0,0 +1,199 @@ +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 = 10 * 60 * 1; // 1 minute
+
+ // 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 && !isNetworkEnabled) {
+ // 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 new file mode 100644 index 0000000..e7712c4 --- /dev/null +++ b/client/activity-demo/Piztor/src/com/example/piztor/Login.java @@ -0,0 +1,18 @@ +package com.example.piztor; + +public class Login { + MainActivity main; + + Login(MainActivity main) { + this.main = main; + } + + void success(int token) { + main.start(); + 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 new file mode 100644 index 0000000..333bfd4 --- /dev/null +++ b/client/activity-demo/Piztor/src/com/example/piztor/MainActivity.java @@ -0,0 +1,104 @@ +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; + 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); + b = (Button) findViewById(R.id.login); + b.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + cout.println(username.getText().toString()); + cout.println(password.getText().toString()); + cout.println(ip.getText().toString()); + cout.println(port.getText().toString()); + ip.setText("192.168.1.102"); + port.setText("9990"); + username.setText("hello"); + password.setText("world"); + 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(); + } + }); + 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(); + 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 new file mode 100644 index 0000000..1627e4c --- /dev/null +++ b/client/activity-demo/Piztor/src/com/example/piztor/MyView.java @@ -0,0 +1,75 @@ +package com.example.piztor; + +import java.io.*; +import android.content.*; +import android.graphics.*; +import android.graphics.Paint.Style; +import android.util.*; +import android.view.*; + +public class MyView extends View { + static PrintStream cout = System.out; + private Paint mPaint; + public Canvas c = null; + public Bitmap b = null; + public double scale = 100; + public double centerX, centerY; +// Vector<PointF> v; + + void setup(Canvas c, Bitmap b, double x, double y) { + this.c = c; + this.b = b; + centerX = x; + centerY = y; + } + + public MyView(Context context) { + super(context); +// v = new Vector<PointF>(); + mPaint = new Paint(); + mPaint.setColor(Color.RED); + mPaint.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); + canvas.drawBitmap(b, 0, 0, mPaint); + // 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 drawLocation(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); + c.drawRect(x1 - 1, y1 + 1, x1 + 1, y1 - 1, mPaint); + 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 new file mode 100644 index 0000000..9397e0c --- /dev/null +++ b/client/activity-demo/Piztor/src/com/example/piztor/Myrequest.java @@ -0,0 +1,10 @@ +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 new file mode 100644 index 0000000..2398f2b --- /dev/null +++ b/client/activity-demo/Piztor/src/com/example/piztor/Myrespond.java @@ -0,0 +1,12 @@ +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/Running.java b/client/activity-demo/Piztor/src/com/example/piztor/Running.java new file mode 100644 index 0000000..4ea1526 --- /dev/null +++ b/client/activity-demo/Piztor/src/com/example/piztor/Running.java @@ -0,0 +1,42 @@ +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, 31, 121); + } + + @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 new file mode 100644 index 0000000..e66b5bc --- /dev/null +++ b/client/activity-demo/Piztor/src/com/example/piztor/SocketClient.java @@ -0,0 +1,114 @@ +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.writeUTF(id); + out.writeUTF(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.writeUTF(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); + 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 lot = in.readDouble(); + double lat = in.readDouble(); + r.contain.add(tid); + r.contain.add(lot); + r.contain.add(lat); + } + 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 new file mode 100644 index 0000000..ceda506 --- /dev/null +++ b/client/activity-demo/Piztor/src/com/example/piztor/Tracker.java @@ -0,0 +1,34 @@ +package com.example.piztor; + +import java.util.Timer; +import java.util.TimerTask; + +public class Tracker implements Runnable { + + private static final long TIME_DELTA = 1000 * 60 * 5; + public final Context mContext; + + Controller controller; + + public Tracker(Controller newController) { + controller = newController; + } + + public Timer timer; + public void run() { + TimerTask task = new GPSTask(); + timer.schedule(new GPSTask(), 0, TIME_DELTA); + } + + class GPSTask extends TimerTask { + public void run() { + GPSTracker tracker; + tracker = new GPSTracker(Tracker.this); + + double latitude = tracker.getLatitude(); + double longitude = tracker.getLongitude(); + + 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 new file mode 100644 index 0000000..e39abd5 --- /dev/null +++ b/client/activity-demo/Piztor/src/com/example/piztor/Transam.java @@ -0,0 +1,124 @@ +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 = 4; + 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,2000,2000); + } + + 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){ + }catch (IOException e){ + } + + } + } + + @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 |