summaryrefslogtreecommitdiff
path: root/client/Piztor
diff options
context:
space:
mode:
Diffstat (limited to 'client/Piztor')
-rw-r--r--client/Piztor/.classpath2
-rw-r--r--client/Piztor/.directory6
-rw-r--r--client/Piztor/.project33
-rw-r--r--client/Piztor/.settings/org.eclipse.jdt.core.prefs4
-rw-r--r--client/Piztor/AndroidManifest.xml2
-rw-r--r--client/Piztor/ic_launcher-web.pngbin130248 -> 0 bytes
-rw-r--r--client/Piztor/libs/android-support-v4.jarbin0 -> 556198 bytes
-rw-r--r--client/Piztor/libs/armeabi/libBaiduMapSDK_v2_1_3.sobin0 -> 797256 bytes
-rw-r--r--client/Piztor/libs/armeabi/libBaiduMapVOS_v2_1_3.sobin0 -> 201904 bytes
-rw-r--r--client/Piztor/libs/armeabi/liblocSDK4.sobin0 -> 32304 bytes
-rw-r--r--client/Piztor/libs/baidumapapi_v2_1_3.jarbin0 -> 843490 bytes
-rw-r--r--client/Piztor/libs/locSDK_4.0.jarbin0 -> 168001 bytes
-rw-r--r--client/Piztor/proguard-project.txt20
-rw-r--r--client/Piztor/project.properties14
-rw-r--r--client/Piztor/res/drawable/circle_red.pngbin0 -> 690 bytes
-rw-r--r--client/Piztor/res/drawable/footbar_checkin.pngbin468 -> 3251 bytes
-rw-r--r--client/Piztor/res/drawable/footbar_checkin_1.pngbin3371 -> 3249 bytes
-rw-r--r--client/Piztor/res/drawable/footbar_fetch.pngbin2541 -> 4849 bytes
-rw-r--r--client/Piztor/res/drawable/footbar_fetch_1.pngbin3093 -> 3300 bytes
-rw-r--r--client/Piztor/res/drawable/footbar_marker.pngbin1866 -> 3936 bytes
-rw-r--r--client/Piztor/res/drawable/footbar_marker_1.pngbin3288 -> 3113 bytes
-rw-r--r--client/Piztor/res/drawable/footbar_search.pngbin2127 -> 4295 bytes
-rw-r--r--client/Piztor/res/drawable/footbar_search_1.pngbin3589 -> 3219 bytes
-rw-r--r--client/Piztor/res/drawable/footbar_settings.pngbin1372 -> 4340 bytes
-rw-r--r--client/Piztor/res/drawable/footbar_settings_1.pngbin3442 -> 3205 bytes
-rw-r--r--client/Piztor/res/drawable/icon_marka.pngbin0 -> 4129 bytes
-rw-r--r--client/Piztor/res/drawable/marka.pngbin3371 -> 0 bytes
-rw-r--r--client/Piztor/res/drawable/marker1.pngbin0 -> 4318 bytes
-rw-r--r--client/Piztor/res/drawable/marker2.pngbin0 -> 468 bytes
-rw-r--r--client/Piztor/res/drawable/navigation_back.pngbin1324 -> 621 bytes
-rw-r--r--client/Piztor/res/drawable/navigation_back_1.pngbin401 -> 346 bytes
-rw-r--r--client/Piztor/res/drawable/pop.pngbin0 -> 1312 bytes
-rw-r--r--client/Piztor/res/drawable/popup.pngbin0 -> 3296 bytes
-rw-r--r--client/Piztor/res/drawable/popup_down.pngbin0 -> 2998 bytes
-rw-r--r--client/Piztor/res/drawable/popup_left.pngbin0 -> 2902 bytes
-rw-r--r--client/Piztor/res/drawable/popup_middle.pngbin0 -> 3100 bytes
-rw-r--r--client/Piztor/res/drawable/popup_right.pngbin0 -> 2917 bytes
-rw-r--r--client/Piztor/res/drawable/popup_side.pngbin0 -> 3040 bytes
-rw-r--r--client/Piztor/res/layout/activity_login.xml12
-rw-r--r--client/Piztor/res/layout/activity_main.xml2
-rw-r--r--client/Piztor/res/layout/activity_settings.xml5
-rw-r--r--client/Piztor/res/layout/custom_text_view.xml61
-rw-r--r--client/Piztor/res/layout/gather_footbar.xml10
-rw-r--r--client/Piztor/res/layout/main_footbar.xml16
-rw-r--r--client/Piztor/res/layout/settings_headbar.xml4
-rw-r--r--client/Piztor/res/menu/init.xml1
-rw-r--r--client/Piztor/res/menu/login.xml1
-rw-r--r--client/Piztor/res/menu/main.xml1
-rw-r--r--client/Piztor/res/menu/setting.xml1
-rw-r--r--client/Piztor/res/values-v11/styles.xml2
-rw-r--r--client/Piztor/res/values-v14/styles.xml2
-rw-r--r--client/Piztor/res/values/strings.xml7
-rw-r--r--client/Piztor/src/com/macaroon/piztor/AppMgr.java7
-rw-r--r--client/Piztor/src/com/macaroon/piztor/BMapUtil.java17
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Main.java34
-rw-r--r--client/Piztor/src/com/macaroon/piztor/MapMaker.java132
-rw-r--r--client/Piztor/src/com/macaroon/piztor/MultiTouchListener.java98
57 files changed, 256 insertions, 238 deletions
diff --git a/client/Piztor/.classpath b/client/Piztor/.classpath
index 8499b03..1c0c6e1 100644
--- a/client/Piztor/.classpath
+++ b/client/Piztor/.classpath
@@ -5,7 +5,7 @@
<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="lib" path="/home/goblin/piztor/client/Piztor/libs/locSDK_3.1.jar"/>
<classpathentry kind="lib" path="/home/goblin/piztor/client/Piztor/libs/baidumapapi_v2_1_3.jar"/>
+ <classpathentry kind="lib" path="/home/goblin/piztor/client/Piztor/libs/locSDK_4.0.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
diff --git a/client/Piztor/.directory b/client/Piztor/.directory
new file mode 100644
index 0000000..2e1894b
--- /dev/null
+++ b/client/Piztor/.directory
@@ -0,0 +1,6 @@
+[Dolphin]
+Timestamp=2013,8,28,16,5,42
+Version=3
+
+[Settings]
+HiddenFilesShown=true
diff --git a/client/Piztor/.project b/client/Piztor/.project
deleted file mode 100644
index 97100ec..0000000
--- a/client/Piztor/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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/Piztor/.settings/org.eclipse.jdt.core.prefs b/client/Piztor/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index b080d2d..0000000
--- a/client/Piztor/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-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/Piztor/AndroidManifest.xml b/client/Piztor/AndroidManifest.xml
index ece39f1..c026975 100644
--- a/client/Piztor/AndroidManifest.xml
+++ b/client/Piztor/AndroidManifest.xml
@@ -23,8 +23,6 @@
<!-- 获取设置信息和详情页直接拨打电话需要以下权限 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE">
</uses-permission>
-<uses-permission android:name="android.permission.CALL_PHONE">
-</uses-permission>
<!-- 使用定位功能所需权限,demo已集成百度定位SDK,不使用定位功能可去掉以下6项 -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION">
</uses-permission>
diff --git a/client/Piztor/ic_launcher-web.png b/client/Piztor/ic_launcher-web.png
deleted file mode 100644
index 3cd0ac2..0000000
--- a/client/Piztor/ic_launcher-web.png
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/libs/android-support-v4.jar b/client/Piztor/libs/android-support-v4.jar
new file mode 100644
index 0000000..cf12d28
--- /dev/null
+++ b/client/Piztor/libs/android-support-v4.jar
Binary files differ
diff --git a/client/Piztor/libs/armeabi/libBaiduMapSDK_v2_1_3.so b/client/Piztor/libs/armeabi/libBaiduMapSDK_v2_1_3.so
new file mode 100644
index 0000000..54f4c05
--- /dev/null
+++ b/client/Piztor/libs/armeabi/libBaiduMapSDK_v2_1_3.so
Binary files differ
diff --git a/client/Piztor/libs/armeabi/libBaiduMapVOS_v2_1_3.so b/client/Piztor/libs/armeabi/libBaiduMapVOS_v2_1_3.so
new file mode 100644
index 0000000..93ece3d
--- /dev/null
+++ b/client/Piztor/libs/armeabi/libBaiduMapVOS_v2_1_3.so
Binary files differ
diff --git a/client/Piztor/libs/armeabi/liblocSDK4.so b/client/Piztor/libs/armeabi/liblocSDK4.so
new file mode 100644
index 0000000..051896a
--- /dev/null
+++ b/client/Piztor/libs/armeabi/liblocSDK4.so
Binary files differ
diff --git a/client/Piztor/libs/baidumapapi_v2_1_3.jar b/client/Piztor/libs/baidumapapi_v2_1_3.jar
new file mode 100644
index 0000000..c4d1a3f
--- /dev/null
+++ b/client/Piztor/libs/baidumapapi_v2_1_3.jar
Binary files differ
diff --git a/client/Piztor/libs/locSDK_4.0.jar b/client/Piztor/libs/locSDK_4.0.jar
new file mode 100644
index 0000000..e6058dd
--- /dev/null
+++ b/client/Piztor/libs/locSDK_4.0.jar
Binary files differ
diff --git a/client/Piztor/proguard-project.txt b/client/Piztor/proguard-project.txt
deleted file mode 100644
index f2fe155..0000000
--- a/client/Piztor/proguard-project.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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/Piztor/project.properties b/client/Piztor/project.properties
deleted file mode 100644
index ce39f2d..0000000
--- a/client/Piztor/project.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-# 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/Piztor/res/drawable/circle_red.png b/client/Piztor/res/drawable/circle_red.png
new file mode 100644
index 0000000..034cea8
--- /dev/null
+++ b/client/Piztor/res/drawable/circle_red.png
Binary files differ
diff --git a/client/Piztor/res/drawable/footbar_checkin.png b/client/Piztor/res/drawable/footbar_checkin.png
index 90afba7..0a4b148 100644
--- a/client/Piztor/res/drawable/footbar_checkin.png
+++ b/client/Piztor/res/drawable/footbar_checkin.png
Binary files differ
diff --git a/client/Piztor/res/drawable/footbar_checkin_1.png b/client/Piztor/res/drawable/footbar_checkin_1.png
index a478d36..6fb89ac 100644
--- a/client/Piztor/res/drawable/footbar_checkin_1.png
+++ b/client/Piztor/res/drawable/footbar_checkin_1.png
Binary files differ
diff --git a/client/Piztor/res/drawable/footbar_fetch.png b/client/Piztor/res/drawable/footbar_fetch.png
index 32d24d2..138ef6a 100644
--- a/client/Piztor/res/drawable/footbar_fetch.png
+++ b/client/Piztor/res/drawable/footbar_fetch.png
Binary files differ
diff --git a/client/Piztor/res/drawable/footbar_fetch_1.png b/client/Piztor/res/drawable/footbar_fetch_1.png
index 208094f..0d098ab 100644
--- a/client/Piztor/res/drawable/footbar_fetch_1.png
+++ b/client/Piztor/res/drawable/footbar_fetch_1.png
Binary files differ
diff --git a/client/Piztor/res/drawable/footbar_marker.png b/client/Piztor/res/drawable/footbar_marker.png
index 3de909f..e84bffa 100644
--- a/client/Piztor/res/drawable/footbar_marker.png
+++ b/client/Piztor/res/drawable/footbar_marker.png
Binary files differ
diff --git a/client/Piztor/res/drawable/footbar_marker_1.png b/client/Piztor/res/drawable/footbar_marker_1.png
index 08c8715..75005a4 100644
--- a/client/Piztor/res/drawable/footbar_marker_1.png
+++ b/client/Piztor/res/drawable/footbar_marker_1.png
Binary files differ
diff --git a/client/Piztor/res/drawable/footbar_search.png b/client/Piztor/res/drawable/footbar_search.png
index 3549f84..8d3681f 100644
--- a/client/Piztor/res/drawable/footbar_search.png
+++ b/client/Piztor/res/drawable/footbar_search.png
Binary files differ
diff --git a/client/Piztor/res/drawable/footbar_search_1.png b/client/Piztor/res/drawable/footbar_search_1.png
index 1e6ac28..ab52656 100644
--- a/client/Piztor/res/drawable/footbar_search_1.png
+++ b/client/Piztor/res/drawable/footbar_search_1.png
Binary files differ
diff --git a/client/Piztor/res/drawable/footbar_settings.png b/client/Piztor/res/drawable/footbar_settings.png
index 455bd0b..a6987f8 100644
--- a/client/Piztor/res/drawable/footbar_settings.png
+++ b/client/Piztor/res/drawable/footbar_settings.png
Binary files differ
diff --git a/client/Piztor/res/drawable/footbar_settings_1.png b/client/Piztor/res/drawable/footbar_settings_1.png
index 6b0a2ab..8b61042 100644
--- a/client/Piztor/res/drawable/footbar_settings_1.png
+++ b/client/Piztor/res/drawable/footbar_settings_1.png
Binary files differ
diff --git a/client/Piztor/res/drawable/icon_marka.png b/client/Piztor/res/drawable/icon_marka.png
new file mode 100644
index 0000000..144f3db
--- /dev/null
+++ b/client/Piztor/res/drawable/icon_marka.png
Binary files differ
diff --git a/client/Piztor/res/drawable/marka.png b/client/Piztor/res/drawable/marka.png
deleted file mode 100644
index a478d36..0000000
--- a/client/Piztor/res/drawable/marka.png
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/res/drawable/marker1.png b/client/Piztor/res/drawable/marker1.png
new file mode 100644
index 0000000..3ba8760
--- /dev/null
+++ b/client/Piztor/res/drawable/marker1.png
Binary files differ
diff --git a/client/Piztor/res/drawable/marker2.png b/client/Piztor/res/drawable/marker2.png
new file mode 100644
index 0000000..90afba7
--- /dev/null
+++ b/client/Piztor/res/drawable/marker2.png
Binary files differ
diff --git a/client/Piztor/res/drawable/navigation_back.png b/client/Piztor/res/drawable/navigation_back.png
index 3bdda98..348dc3d 100644
--- a/client/Piztor/res/drawable/navigation_back.png
+++ b/client/Piztor/res/drawable/navigation_back.png
Binary files differ
diff --git a/client/Piztor/res/drawable/navigation_back_1.png b/client/Piztor/res/drawable/navigation_back_1.png
index a20b4ef..07578fb 100644
--- a/client/Piztor/res/drawable/navigation_back_1.png
+++ b/client/Piztor/res/drawable/navigation_back_1.png
Binary files differ
diff --git a/client/Piztor/res/drawable/pop.png b/client/Piztor/res/drawable/pop.png
new file mode 100644
index 0000000..07e897a
--- /dev/null
+++ b/client/Piztor/res/drawable/pop.png
Binary files differ
diff --git a/client/Piztor/res/drawable/popup.png b/client/Piztor/res/drawable/popup.png
new file mode 100644
index 0000000..3dd9e51
--- /dev/null
+++ b/client/Piztor/res/drawable/popup.png
Binary files differ
diff --git a/client/Piztor/res/drawable/popup_down.png b/client/Piztor/res/drawable/popup_down.png
new file mode 100644
index 0000000..8dad382
--- /dev/null
+++ b/client/Piztor/res/drawable/popup_down.png
Binary files differ
diff --git a/client/Piztor/res/drawable/popup_left.png b/client/Piztor/res/drawable/popup_left.png
new file mode 100644
index 0000000..98c81b6
--- /dev/null
+++ b/client/Piztor/res/drawable/popup_left.png
Binary files differ
diff --git a/client/Piztor/res/drawable/popup_middle.png b/client/Piztor/res/drawable/popup_middle.png
new file mode 100644
index 0000000..750b455
--- /dev/null
+++ b/client/Piztor/res/drawable/popup_middle.png
Binary files differ
diff --git a/client/Piztor/res/drawable/popup_right.png b/client/Piztor/res/drawable/popup_right.png
new file mode 100644
index 0000000..84745ff
--- /dev/null
+++ b/client/Piztor/res/drawable/popup_right.png
Binary files differ
diff --git a/client/Piztor/res/drawable/popup_side.png b/client/Piztor/res/drawable/popup_side.png
new file mode 100644
index 0000000..49135ca
--- /dev/null
+++ b/client/Piztor/res/drawable/popup_side.png
Binary files differ
diff --git a/client/Piztor/res/layout/activity_login.xml b/client/Piztor/res/layout/activity_login.xml
index b1f2f5b..670a3dc 100644
--- a/client/Piztor/res/layout/activity_login.xml
+++ b/client/Piztor/res/layout/activity_login.xml
@@ -17,7 +17,7 @@
<ImageView
android:id="@+id/main_headbar_img"
android:layout_width="180dp"
- android:layout_height="240dp"
+ android:layout_height="190dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/title_logo" />
</LinearLayout>
@@ -27,7 +27,7 @@
android:id="@+id/user_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="220.0dip"
+ android:layout_marginTop="200.0dip"
android:layout_marginLeft="28.0dip"
android:layout_marginRight="28.0dip">
<EditText
@@ -39,7 +39,7 @@
android:paddingLeft="12.0dip"
android:layout_width="fill_parent"
android:layout_height="44.0dip"
- android:hint="account" android:maxLines="1"
+ android:hint="@string/username" android:maxLines="1"
android:maxLength="16"/>
<View
android:background="#ffc0c3c4"
@@ -57,7 +57,7 @@
android:paddingLeft="12.0dip"
android:layout_width="fill_parent"
android:layout_height="44.0dip"
- android:hint="password"
+ android:hint="@string/password"
android:maxLines="1"
android:maxLength="16"
android:inputType="textPassword" />
@@ -72,9 +72,9 @@
android:paddingTop="5.0dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_marginLeft="28.0dip"
+ android:layout_marginLeft="70.0dip"
+ android:layout_marginRight="70.0dip"
android:layout_marginTop="12.0dip"
- android:layout_marginRight="28.0dip"
android:text="login"
android:layout_below="@id/user_layout" />
diff --git a/client/Piztor/res/layout/activity_main.xml b/client/Piztor/res/layout/activity_main.xml
index f72ac62..49ff03c 100644
--- a/client/Piztor/res/layout/activity_main.xml
+++ b/client/Piztor/res/layout/activity_main.xml
@@ -31,4 +31,4 @@
android:layout_below="@+id/main_headbar_layout"
android:clickable="true" />
-</RelativeLayout>
+</RelativeLayout> \ No newline at end of file
diff --git a/client/Piztor/res/layout/activity_settings.xml b/client/Piztor/res/layout/activity_settings.xml
index c386ae2..3080be0 100644
--- a/client/Piztor/res/layout/activity_settings.xml
+++ b/client/Piztor/res/layout/activity_settings.xml
@@ -80,7 +80,8 @@
android:id="@+id/settings_sex_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="10dip" >
+ android:layout_marginTop="50dip"
+ >
<TextView
android:id="@+id/settings_sex_text"
@@ -117,7 +118,7 @@
android:id="@+id/settings_team_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="10dip" >
+ android:layout_marginTop="50dip" >
<TextView
android:id="@+id/settings_team_text"
diff --git a/client/Piztor/res/layout/custom_text_view.xml b/client/Piztor/res/layout/custom_text_view.xml
new file mode 100644
index 0000000..5ef1c9f
--- /dev/null
+++ b/client/Piztor/res/layout/custom_text_view.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ >
+
+ <TextView
+ android:id="@+id/popleft"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/popup_side"
+ android:gravity="center"
+ android:textStyle="bold"
+ android:textColor="#3814ed"
+ android:text="更新位置"
+ android:textSize="12sp" />
+
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:id="@+id/popinfo"
+ >
+
+ <TextView
+ android:id="@+id/textcache"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/popup_middle"
+ android:gravity="center"
+ android:textStyle="bold"
+ android:textColor="@android:color/black"
+ android:textSize="12sp" />
+
+ <TextView
+ android:id="@+id/popdown"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/popup_down"
+ android:textColor="@android:color/black"
+ android:textSize="12sp" />
+
+
+ </LinearLayout>
+
+
+ <TextView
+ android:id="@+id/popright"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/popup_side"
+ android:textColor="#3814ed"
+ android:gravity="center"
+ android:textStyle="bold"
+ android:text="更新marker"
+ android:textSize="12sp" />
+
+</LinearLayout>
diff --git a/client/Piztor/res/layout/gather_footbar.xml b/client/Piztor/res/layout/gather_footbar.xml
index e573032..2dfb6b6 100644
--- a/client/Piztor/res/layout/gather_footbar.xml
+++ b/client/Piztor/res/layout/gather_footbar.xml
@@ -15,7 +15,7 @@
android:layout_weight="1">
<ImageButton
android:id="@+id/footbar_btn_search"
- android:layout_width="30dip"
+ android:layout_width="61dip"
android:layout_height="30dip"
android:layout_gravity="center"
android:background="@drawable/footbar_btn_search_style"/>
@@ -40,7 +40,7 @@
android:layout_weight="1">
<ImageButton
android:id="@+id/footbar_btn_fetch"
- android:layout_width="30dip"
+ android:layout_width="61dip"
android:layout_height="30dip"
android:layout_gravity="center"
android:background="@drawable/footbar_btn_fetch_style"/>
@@ -65,7 +65,7 @@
android:orientation="vertical">
<ImageButton
android:id="@+id/footbar_btn_checkin"
- android:layout_width="30dip"
+ android:layout_width="61dip"
android:layout_height="30dip"
android:layout_gravity="center"
android:background="@drawable/footbar_btn_checkin_style"
@@ -91,7 +91,7 @@
android:layout_weight="1">
<ImageButton
android:id="@+id/footbar_btn_focus"
- android:layout_width="30dip"
+ android:layout_width="61dip"
android:layout_height="30dip"
android:layout_gravity="center"
android:background="@drawable/footbar_btn_focus_style"/>
@@ -116,7 +116,7 @@
android:layout_weight="1">
<ImageButton
android:id="@+id/footbar_btn_settings"
- android:layout_width="30dip"
+ android:layout_width="61dip"
android:layout_height="30dip"
android:layout_gravity="center"
android:background="@drawable/footbar_btn_settings_style"/>
diff --git a/client/Piztor/res/layout/main_footbar.xml b/client/Piztor/res/layout/main_footbar.xml
index 69760c0..b4659ff 100644
--- a/client/Piztor/res/layout/main_footbar.xml
+++ b/client/Piztor/res/layout/main_footbar.xml
@@ -3,7 +3,7 @@
android:layout_width="fill_parent"
android:layout_height="48dip"
android:orientation="horizontal"
- android:background="@drawable/footbar_background" >
+ android:background="@drawable/footbar_background" android:baselineAligned="false">
<LinearLayout
android:id="@+id/footbar_btn_search_layout"
@@ -15,12 +15,13 @@
android:layout_weight="1">
<ImageButton
android:id="@+id/footbar_btn_search"
- android:layout_width="30dip"
+ android:layout_width="90dip"
android:layout_height="30dip"
android:layout_gravity="center"
+ android:contentDescription="@string/desc"
android:background="@drawable/footbar_btn_search_style"/>
<TextView
- android:id="@+id/footbar_btn_search"
+ android:id="@+id/footbar_btn_search_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
@@ -40,9 +41,10 @@
android:layout_weight="1">
<ImageButton
android:id="@+id/footbar_btn_fetch"
- android:layout_width="30dip"
+ android:layout_width="90dip"
android:layout_height="30dip"
android:layout_gravity="center"
+ android:contentDescription="@string/desc"
android:background="@drawable/footbar_btn_fetch_style"/>
<TextView
android:id="@+id/footbar_btn_fetch_text"
@@ -65,9 +67,10 @@
android:layout_weight="1">
<ImageButton
android:id="@+id/footbar_btn_focus"
- android:layout_width="30dip"
+ android:layout_width="90dip"
android:layout_height="30dip"
android:layout_gravity="center"
+ android:contentDescription="@string/desc"
android:background="@drawable/footbar_btn_focus_style"/>
<TextView
android:id="@+id/footbar_btn_focus_text"
@@ -90,9 +93,10 @@
android:layout_weight="1">
<ImageButton
android:id="@+id/footbar_btn_settings"
- android:layout_width="30dip"
+ android:layout_width="90dip"
android:layout_height="30dip"
android:layout_gravity="center"
+ android:contentDescription="@string/desc"
android:background="@drawable/footbar_btn_settings_style"/>
<TextView
android:id="@+id/footbar_btn_settings_text"
diff --git a/client/Piztor/res/layout/settings_headbar.xml b/client/Piztor/res/layout/settings_headbar.xml
index 9065bdb..606c172 100644
--- a/client/Piztor/res/layout/settings_headbar.xml
+++ b/client/Piztor/res/layout/settings_headbar.xml
@@ -7,9 +7,9 @@
<ImageButton
android:id="@+id/settings_btn_back"
- android:layout_width="40dip"
+ android:layout_width="110dip"
android:layout_height="40dip"
- android:layout_marginLeft="5dip"
+ android:layout_marginLeft="0dip"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="@drawable/navigation_back"/>
diff --git a/client/Piztor/res/menu/init.xml b/client/Piztor/res/menu/init.xml
index c002028..5e4b11a 100644
--- a/client/Piztor/res/menu/init.xml
+++ b/client/Piztor/res/menu/init.xml
@@ -3,7 +3,6 @@
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
- android:showAsAction="never"
android:title="@string/action_settings"/>
</menu>
diff --git a/client/Piztor/res/menu/login.xml b/client/Piztor/res/menu/login.xml
index c002028..5e4b11a 100644
--- a/client/Piztor/res/menu/login.xml
+++ b/client/Piztor/res/menu/login.xml
@@ -3,7 +3,6 @@
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
- android:showAsAction="never"
android:title="@string/action_settings"/>
</menu>
diff --git a/client/Piztor/res/menu/main.xml b/client/Piztor/res/menu/main.xml
index c002028..5e4b11a 100644
--- a/client/Piztor/res/menu/main.xml
+++ b/client/Piztor/res/menu/main.xml
@@ -3,7 +3,6 @@
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
- android:showAsAction="never"
android:title="@string/action_settings"/>
</menu>
diff --git a/client/Piztor/res/menu/setting.xml b/client/Piztor/res/menu/setting.xml
index c002028..5e4b11a 100644
--- a/client/Piztor/res/menu/setting.xml
+++ b/client/Piztor/res/menu/setting.xml
@@ -3,7 +3,6 @@
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
- android:showAsAction="never"
android:title="@string/action_settings"/>
</menu>
diff --git a/client/Piztor/res/values-v11/styles.xml b/client/Piztor/res/values-v11/styles.xml
index 3c02242..aeeae24 100644
--- a/client/Piztor/res/values-v11/styles.xml
+++ b/client/Piztor/res/values-v11/styles.xml
@@ -4,7 +4,7 @@
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">
+ <style name="AppBaseTheme" parent="android:Theme.Light">
<!-- API 11 theme customizations can go here. -->
</style>
diff --git a/client/Piztor/res/values-v14/styles.xml b/client/Piztor/res/values-v14/styles.xml
index a91fd03..afb7b31 100644
--- a/client/Piztor/res/values-v14/styles.xml
+++ b/client/Piztor/res/values-v14/styles.xml
@@ -5,7 +5,7 @@
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">
+ <style name="AppBaseTheme" parent="android:Theme.Light">
<!-- API 14 theme customizations can go here. -->
</style>
diff --git a/client/Piztor/res/values/strings.xml b/client/Piztor/res/values/strings.xml
index 5500982..192d392 100644
--- a/client/Piztor/res/values/strings.xml
+++ b/client/Piztor/res/values/strings.xml
@@ -1,6 +1,6 @@
<resources>
- <string name="app_name">piztor</string>
+ <string name="app_name">Piztor</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string name="settings">Settings</string>
@@ -17,6 +17,9 @@
<string name="title_activity_login">Login</string>
<string name="title_activity_main">Main</string>
<string name="title_activity_settings">Settings</string>
- <string name="title_activity_mapmaker">MapMaker</string>
+ <string name="password">password</string>
+ <string name="username">username</string>
+ <string name="login">login</string>
+ <string name="desc">desc</string>
</resources>
diff --git a/client/Piztor/src/com/macaroon/piztor/AppMgr.java b/client/Piztor/src/com/macaroon/piztor/AppMgr.java
index 8e82384..aed8ca6 100644
--- a/client/Piztor/src/com/macaroon/piztor/AppMgr.java
+++ b/client/Piztor/src/com/macaroon/piztor/AppMgr.java
@@ -15,10 +15,8 @@ import com.baidu.mapapi.MKGeneralListener;
@SuppressLint("UseSparseArrays")
public class AppMgr {
- private static final String strKey = "5ba8abf7b4694ad49706b8b7538c9d6a";
+ private static final String strKey = "8a0ae50048d103b2b8b12b7066f4ea7d";
static BMapManager mBMapManager = null;
- static Context context;
-
// Status
public enum ActivityStatus {
@@ -83,6 +81,8 @@ public class AppMgr {
i.putExtra("status", true);
else i.putExtra("status", false);
}
+ if (event == loginSuccess) mBMapManager.start();
+ if (event == logout) mBMapManager.stop();
nowAct.startActivity(i);
}
@@ -127,7 +127,6 @@ public class AppMgr {
}
});
}
- AppMgr.context = context;
mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
handler = new Handler();
transam = new Transam(Infomation.ip, Infomation.port, handler);
diff --git a/client/Piztor/src/com/macaroon/piztor/BMapUtil.java b/client/Piztor/src/com/macaroon/piztor/BMapUtil.java
new file mode 100644
index 0000000..38d9f7d
--- /dev/null
+++ b/client/Piztor/src/com/macaroon/piztor/BMapUtil.java
@@ -0,0 +1,17 @@
+package com.macaroon.piztor;
+
+import android.graphics.Bitmap;
+import android.view.View;
+
+public class BMapUtil {
+
+ public static Bitmap getBitmapFromView(View view) {
+ view.destroyDrawingCache();
+ view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
+ View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
+ view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
+ view.setDrawingCacheEnabled(true);
+ Bitmap bitmap = view.getDrawingCache(true);
+ return bitmap;
+ }
+}
diff --git a/client/Piztor/src/com/macaroon/piztor/Main.java b/client/Piztor/src/com/macaroon/piztor/Main.java
index 2820090..5aa767d 100644
--- a/client/Piztor/src/com/macaroon/piztor/Main.java
+++ b/client/Piztor/src/com/macaroon/piztor/Main.java
@@ -4,6 +4,8 @@ import java.util.Timer;
import java.util.TimerTask;
import android.annotation.SuppressLint;
+import android.graphics.Bitmap;
+import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -12,14 +14,22 @@ import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;
import android.widget.ImageButton;
+import android.widget.TextView;
import android.widget.Toast;
import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
+import com.baidu.mapapi.map.ItemizedOverlay;
import com.baidu.mapapi.map.LocationData;
import com.baidu.mapapi.map.MapView;
+import com.baidu.mapapi.map.OverlayItem;
+import com.baidu.mapapi.map.PopupClickListener;
+import com.baidu.mapapi.map.PopupOverlay;
+import com.baidu.platform.comapi.basestruct.GeoPoint;
+
+import com.macaroon.piztor.BMapUtil;
public class Main extends PiztorAct {
final static int SearchButtonPress = 1;
@@ -40,7 +50,7 @@ public class Main extends PiztorAct {
public MyLocationListener myListener = new MyLocationListener();
ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
+ //Timer autodate;
MapInfo mapInfo;
/*
* @SuppressLint("HandlerLeak") Handler fromGPS = new Handler() {
@@ -91,7 +101,7 @@ public class Main extends PiztorAct {
if (r.uid == Infomation.myInfo.uid) {
Infomation.myInfo.gid = r.gid;
try {
- autodate.schedule(new AutoUpdate(), 0, 5000);
+ //autodate.schedule(new AutoUpdate(), 0, 5000);
} catch (Exception e) {
e.printStackTrace();
}
@@ -138,7 +148,8 @@ public class Main extends PiztorAct {
// TODO flush map view
void flushMap() {
-
+ if (mapMaker != null)
+ mapMaker.UpdateMap(AppMgr.mapInfo);
}
public class MyLocationListener implements BDLocationListener {
@@ -155,7 +166,8 @@ public class Main extends PiztorAct {
locData.direction = location.getDerect();
mapMaker.UpdateLocationOverlay(locData, false);
-
+ if (Infomation.token != null)
+ AppMgr.transam.send(new ReqUpdate(Infomation.token, Infomation.username, locData.latitude, locData.longitude, System.currentTimeMillis(), 2000));
}
@Override
@@ -224,10 +236,12 @@ public class Main extends PiztorAct {
requesLocation(Infomation.myInfo.gid);
break;
case FocuseButtonPress:
- // TODO setFocus
+ if( locData != null) {
+ mapMaker.UpdateLocationOverlay(locData, true);
+ } else mapMaker.InitMap();
break;
case SuccessFetch:
- requesLocation(Infomation.myInfo.gid);
+ flushMap();
break;
default:
break;
@@ -279,16 +293,16 @@ public class Main extends PiztorAct {
actMgr.add(focusStatus, mapViewtouched, startStatus);
actMgr.add(focusStatus, SuccessFetch, focusStatus);
actMgr.add(focusStatus, Fetch, focusStatus);
- autodate = new Timer();
+ //autodate = new Timer();
flushMap();
- // ImageView view = (ImageView) findViewById(R.id.main_mapview);
- // view.setOnTouchListener(new MultiTouchListener());
setContentView(R.layout.activity_main);
mMapView = (MapView) findViewById(R.id.bmapView);
mapMaker = new MapMaker(mMapView, getApplicationContext());
mapMaker.InitMap();
mLocClient = new LocationClient(this);
locData = new LocationData();
+ locData.latitude = 31.032247;
+ locData.longitude = 121.445937;
mLocClient.registerLocationListener(myListener);
LocationClientOption option = new LocationClientOption();
option.setOpenGps(true);
@@ -342,7 +356,7 @@ public class Main extends PiztorAct {
@Override
public void onStop() {
super.onStop();
- autodate.cancel();
+ //autodate.cancel();
}
@Override
diff --git a/client/Piztor/src/com/macaroon/piztor/MapMaker.java b/client/Piztor/src/com/macaroon/piztor/MapMaker.java
index bdc3554..895d409 100644
--- a/client/Piztor/src/com/macaroon/piztor/MapMaker.java
+++ b/client/Piztor/src/com/macaroon/piztor/MapMaker.java
@@ -12,14 +12,17 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.KeyEvent;
+import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
+import android.widget.TextView;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
+import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.widget.FrameLayout;
import android.widget.Toast;
@@ -36,12 +39,14 @@ import com.baidu.mapapi.map.LocationData;
import com.baidu.mapapi.BMapManager;
import com.baidu.mapapi.MKGeneralListener;
import com.baidu.mapapi.map.ItemizedOverlay;
+import com.baidu.mapapi.map.MKMapTouchListener;
import com.baidu.mapapi.map.MKMapViewListener;
import com.baidu.mapapi.map.MapController;
import com.baidu.mapapi.map.MapPoi;
import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.map.MyLocationOverlay;
import com.baidu.mapapi.map.OverlayItem;
+import com.baidu.mapapi.map.PopupClickListener;
import com.baidu.mapapi.map.PopupOverlay;
import com.baidu.platform.comapi.basestruct.GeoPoint;
@@ -51,11 +56,20 @@ public class MapMaker extends Activity{
private MapController mMapController = null;
private static GeoPoint sjtuCenter = new GeoPoint((int)(31.032247 * 1E6), (int)(121.445937 * 1E6));
private MyOverlay mOverlay = null;
- private MapView.LayoutParams layoutParam = null;
private OverlayItem curItem = null;
private ArrayList<OverlayItem> mItems = null;
private LocationOverlay mLocationOverlay;
private Context context;
+ private MKMapTouchListener mapTouchListener;
+ boolean isFirstLoc = true;
+
+ /**
+ * popups
+ */
+ private PopupOverlay popLay = null;
+ private TextView popupText = null;
+ private View viewCache = null;
+ private View popupInfo = null;
public MapMaker(MapView mapView, Context c) {
mMapView = mapView;
@@ -75,11 +89,31 @@ public class MapMaker extends Activity{
}
}
- public class MyOverlay extends ItemizedOverlay {
+ public class MyOverlay extends ItemizedOverlay{
public MyOverlay(Drawable defaultMarker, MapView mapView) {
super(defaultMarker, mapView);
}
- }
+
+ @Override
+ public boolean onTap(int index){
+ Log.d("123", "Marker tap");
+ OverlayItem item = getItem(index);
+ popupText.setText("^ _ ^");
+ Bitmap bitmap = BMapUtil.getBitmapFromView(popupInfo);
+ popLay.showPopup(bitmap,item.getPoint(),32);
+ return true;
+ }
+
+ @Override
+ public boolean onTap(GeoPoint pt, MapView mMapView){
+ Log.d("123", "Marker tap disappear");
+
+ if (popLay != null){
+ popLay.hidePop();
+ }
+ return false;
+ }
+ }
public void UpdateLocationOverlay(LocationData locationData, boolean hasAnimation) {
/**
@@ -87,12 +121,16 @@ public class MapMaker extends Activity{
*/
mLocationOverlay.setData(locationData);
mMapView.refresh();
- if (hasAnimation) {
+ if (hasAnimation || isFirstLoc) {
mMapController.animateTo(new GeoPoint((int)(locationData.latitude * 1E6), (int)(locationData.longitude * 1E6)));
}
+ isFirstLoc = true;
}
public void InitMap() {
+ /**
+ * Initialize LocationOverlay
+ */
Log.d("GPS", "init");
mLocationOverlay = new LocationOverlay(mMapView);
//mLocationOverlay.setMarker(context.getResources().getDrawable(R.drawable.marker1));
@@ -101,38 +139,88 @@ public class MapMaker extends Activity{
mMapView.getOverlays().add(mLocationOverlay);
mLocationOverlay.enableCompass();
mMapView.refresh();
- }
-
- public void UpdateMap(MapInfo mapInfo) {
+ mOverlay = new MyOverlay(context.getResources().getDrawable(R.drawable.circle_red), mMapView);
+ Log.d("123", "MapView initialized");
+
/**
- * Update Location Overlay
+ * Initialize pop up
*/
- GeoPoint location = mapInfo.getMyInfo().getLocation();
- LocationData locationData = new LocationData();
- locationData.latitude = location.getLatitudeE6() / 1e6;
- locationData.longitude = location.getLongitudeE6() / 1e6;
- mLocationOverlay.setData(locationData);
- mMapView.refresh();
+ LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
+ Log.d("123", "OK 0");
+ viewCache = inflater.inflate(R.layout.custom_text_view, null);
+ Log.d("123", "OK 1");
+ popupInfo = (View) viewCache.findViewById(R.id.popinfo);
+ Log.d("123", "OK 2");
+ popupText = (TextView) viewCache.findViewById(R.id.textcache);
+ Log.d("123", "OK 3");
+ Log.d("123", "Popup initialized");
+
+ PopupClickListener popListener = new PopupClickListener() {
+ @Override
+ public void onClickedPopup(int index) {
+ //
+ }
+ };
+ popLay = new PopupOverlay(mMapView, popListener);
+
+ /**
+ * Initialize touch listener
+ */
+ /**
+ * TODO
+ */
+ mapTouchListener = new MKMapTouchListener() {
+ @Override
+ public void onMapClick(GeoPoint point) {
+ System.out.println("++++++++++++++++++++++++++++++++ SingleClick "
+ + point.getLatitudeE6() * 1E-6 + " " + point.getLongitudeE6() * 1E-6);
+ }
+
+ @Override
+ public void onMapDoubleClick(GeoPoint point) {
+ System.out.println("++++++++++++++++++++++++++++++++ DoubleClick "
+ + point.getLatitudeE6() * 1E-6 + " " + point.getLongitudeE6() * 1E-6);
+ }
+
+ @Override
+ public void onMapLongClick(GeoPoint point) {
+ System.out.println("++++++++++++++++++++++++++++++++ LongClick "
+ + point.getLatitudeE6() * 1E-6 + " " + point.getLongitudeE6() * 1E-6);
+ }
+ };
+ mMapView.regMapTouchListner(mapTouchListener);
+
+ }
+
+ public void UpdateMap(MapInfo mapInfo) {
/**
* Update location of others
*/
- mOverlay.removeAll();
+ if (mOverlay != null && mOverlay.getAllItem().size() != 0) {
+ clearOverlay(mMapView);
+ }
+ mOverlay = new MyOverlay(context.getResources().getDrawable(R.drawable.circle_red), mMapView);
//mMapView.refresh();
GeoPoint p;
Vector<UserInfo> allUsers = mapInfo.getVector();
-
+ System.out.println("SSSSSSSSSSSSSSSSize "+allUsers.size());
for(int i = 0; i < allUsers.size(); i++) {
+ if (allUsers.get(i).uid == Infomation.myInfo.uid) continue;
p = new GeoPoint((int)(allUsers.get(i).getLatitude() * 1E6)
,(int)(allUsers.get(i).getLongitude() * 1E6));
curItem = new OverlayItem(p, "^_^", "");
- curItem.setMarker(context.getResources().getDrawable(R.drawable.marka));
+ curItem.setMarker(context.getResources().getDrawable(R.drawable.circle_red));
mOverlay.addItem(curItem);
}
mItems = new ArrayList<OverlayItem>();
mItems.addAll(mOverlay.getAllItem());
- mMapView.getOverlays().add(mOverlay);
- mMapView.refresh();
+ if (mMapView != null) {
+ if (mMapView.getOverlays() != null) {
+ mMapView.getOverlays().add(mOverlay);
+ mMapView.refresh();
+ }
+ }
}
@@ -146,17 +234,17 @@ public class MapMaker extends Activity{
mOverlay.addItem(mItems);
mMapView.refresh();
}
-
+
@Override
protected void onPause() {
mMapView.onPause();
}
-
+
@Override
protected void onResume() {
mMapView.onResume();
}
-
+
@Override
protected void onDestroy() {
mMapView.destroy();
diff --git a/client/Piztor/src/com/macaroon/piztor/MultiTouchListener.java b/client/Piztor/src/com/macaroon/piztor/MultiTouchListener.java
deleted file mode 100644
index cf4911b..0000000
--- a/client/Piztor/src/com/macaroon/piztor/MultiTouchListener.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.graphics.Matrix;
-import android.graphics.PointF;
-import android.util.FloatMath;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.View.OnTouchListener;
-import android.widget.ImageView;
-
-@SuppressLint("FloatMath")
-public class MultiTouchListener implements OnTouchListener {
-
- private Matrix matrix = new Matrix();
- private Matrix preMatrix = new Matrix();
-
- private static final int NONE = 0;
- private static final int DRAG = 1;
- private static final int ZOOM = 2;
- private int mode = NONE;
-
- private PointF start = new PointF();
- private PointF mid = new PointF();
- private float preDis = 1f;
- /*private float d = 0f;
- private float newRot = 0f;
- private float[] values;*/
-
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- float[] values = new float[9];
- matrix.getValues(values);
- //System.out.println("1111111"+values[1]);
- //Log.d("Touch", "onTouch.......");
- ImageView view = (ImageView) v;
- switch (event.getAction() & MotionEvent.ACTION_MASK) {
- case MotionEvent.ACTION_DOWN:
- //Log.d("Touch", "ACTION_DOWN");
- preMatrix.set(matrix);
- start.set(event.getX(), event.getY());
- mode = DRAG;
- break;
- case MotionEvent.ACTION_POINTER_DOWN:
- //Log.d("Touch", "ACTION_POINTER_DOWN");
- preDis = spacing(event);
- if(preDis > 10f) {
- preMatrix.set(matrix);
- midPoint(mid, event);
- mode = ZOOM;
- }
- break;
- case MotionEvent.ACTION_UP:
- //Log.d("Touch", "ACTION_UP");
- case MotionEvent.ACTION_POINTER_UP:
- //Log.d("Touch", "ACTION_POINTER_UP");
- mode = NONE;
- break;
- case MotionEvent.ACTION_MOVE:
- //Log.d("Touch", "ACTION_MOVE");
- if(mode == DRAG) {
- //Log.d("Touch", "Draging");
- matrix.set(preMatrix);
- float dx = event.getX() - start.x;
- float dy = event.getY() - start.y;
- matrix.postTranslate(dx, dy);
- } else if (mode == ZOOM) {
- //Log.d("Touch","Zooming");
- float newDis = spacing(event);
- if (newDis > 10f) {
- matrix.set(preMatrix);
- float scale = (newDis / preDis);
- matrix.postScale(scale,scale,mid.x,mid.y);
- //System.out.println("ssssssssssssssssss" + scale);
- }
- }
- break;
- }
- matrix.getValues(values);
- //System.out.println("222222"+values[1]);
- view.setImageMatrix(matrix);
- matrix.getValues(values);
- //System.out.println("333333"+values[1]);
- return true;
- }
-
- private float spacing(MotionEvent event) {
- float x = event.getX(0) - event.getX(1);
- float y = event.getY(0) - event.getY(1);
- return FloatMath.sqrt(x * x + y * y);
- }
-
- private void midPoint(PointF point, MotionEvent event) {
- float x = event.getX(0) + event.getY(1);
- float y = event.getY(0) + event.getY(1);
- point.set(x / 2, y / 2);
- }
-}