From 68ed59a88f2409f632c3731c0e5dc246713676a2 Mon Sep 17 00:00:00 2001 From: Goblin911 Date: Wed, 28 Aug 2013 16:32:26 +0800 Subject: Fixed screen-rotation bug --- client/Piztor/.classpath | 2 +- client/Piztor/.directory | 6 ++ client/Piztor/AndroidManifest.xml | 2 - client/Piztor/libs/android-support-v4.jar | Bin 0 -> 556198 bytes .../Piztor/libs/armeabi/libBaiduMapSDK_v2_1_3.so | Bin 0 -> 797256 bytes .../Piztor/libs/armeabi/libBaiduMapVOS_v2_1_3.so | Bin 0 -> 201904 bytes client/Piztor/libs/armeabi/liblocSDK4.so | Bin 0 -> 32304 bytes client/Piztor/libs/baidumapapi_v2_1_3.jar | Bin 0 -> 843490 bytes client/Piztor/libs/locSDK_4.0.jar | Bin 0 -> 168001 bytes client/Piztor/res/drawable/circle_red.png | Bin 0 -> 690 bytes client/Piztor/res/drawable/footbar_checkin.png | Bin 468 -> 3251 bytes client/Piztor/res/drawable/footbar_checkin_1.png | Bin 3371 -> 3249 bytes client/Piztor/res/drawable/footbar_fetch.png | Bin 2541 -> 4849 bytes client/Piztor/res/drawable/footbar_fetch_1.png | Bin 3093 -> 3300 bytes client/Piztor/res/drawable/footbar_marker.png | Bin 1866 -> 3936 bytes client/Piztor/res/drawable/footbar_marker_1.png | Bin 3288 -> 3113 bytes client/Piztor/res/drawable/footbar_search.png | Bin 2127 -> 4295 bytes client/Piztor/res/drawable/footbar_search_1.png | Bin 3589 -> 3219 bytes client/Piztor/res/drawable/footbar_settings.png | Bin 1372 -> 4340 bytes client/Piztor/res/drawable/footbar_settings_1.png | Bin 3442 -> 3205 bytes client/Piztor/res/drawable/icon_marka.png | Bin 0 -> 4129 bytes client/Piztor/res/drawable/marka.png | Bin 3371 -> 0 bytes client/Piztor/res/drawable/marker1.png | Bin 0 -> 4318 bytes client/Piztor/res/drawable/marker2.png | Bin 0 -> 468 bytes client/Piztor/res/drawable/navigation_back.png | Bin 1324 -> 621 bytes client/Piztor/res/drawable/navigation_back_1.png | Bin 401 -> 346 bytes client/Piztor/res/drawable/popup.png | Bin 0 -> 3296 bytes client/Piztor/res/layout/activity_login.xml | 12 +-- client/Piztor/res/layout/activity_main.xml | 2 +- client/Piztor/res/layout/activity_settings.xml | 5 +- client/Piztor/res/layout/gather_footbar.xml | 10 +-- client/Piztor/res/layout/main_footbar.xml | 16 ++-- client/Piztor/res/layout/settings_headbar.xml | 4 +- client/Piztor/res/menu/init.xml | 1 - client/Piztor/res/menu/login.xml | 1 - client/Piztor/res/menu/main.xml | 1 - client/Piztor/res/menu/setting.xml | 1 - client/Piztor/res/values-v11/styles.xml | 2 +- client/Piztor/res/values-v14/styles.xml | 2 +- client/Piztor/res/values/strings.xml | 7 +- client/Piztor/src/com/macaroon/piztor/AppMgr.java | 7 +- .../Piztor/src/com/macaroon/piztor/BMapUtil.java | 22 +++++ client/Piztor/src/com/macaroon/piztor/Main.java | 44 +++++++-- .../Piztor/src/com/macaroon/piztor/MapMaker.java | 31 +++---- .../com/macaroon/piztor/MultiTouchListener.java | 98 --------------------- 45 files changed, 117 insertions(+), 159 deletions(-) create mode 100644 client/Piztor/.directory create mode 100644 client/Piztor/libs/android-support-v4.jar create mode 100644 client/Piztor/libs/armeabi/libBaiduMapSDK_v2_1_3.so create mode 100644 client/Piztor/libs/armeabi/libBaiduMapVOS_v2_1_3.so create mode 100644 client/Piztor/libs/armeabi/liblocSDK4.so create mode 100644 client/Piztor/libs/baidumapapi_v2_1_3.jar create mode 100644 client/Piztor/libs/locSDK_4.0.jar create mode 100644 client/Piztor/res/drawable/circle_red.png create mode 100644 client/Piztor/res/drawable/icon_marka.png delete mode 100644 client/Piztor/res/drawable/marka.png create mode 100644 client/Piztor/res/drawable/marker1.png create mode 100644 client/Piztor/res/drawable/marker2.png create mode 100644 client/Piztor/res/drawable/popup.png create mode 100644 client/Piztor/src/com/macaroon/piztor/BMapUtil.java delete mode 100644 client/Piztor/src/com/macaroon/piztor/MultiTouchListener.java 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 @@ - + 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/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 @@ - - 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 Binary files /dev/null and b/client/Piztor/libs/android-support-v4.jar 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 Binary files /dev/null and b/client/Piztor/libs/armeabi/libBaiduMapSDK_v2_1_3.so 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 Binary files /dev/null and b/client/Piztor/libs/armeabi/libBaiduMapVOS_v2_1_3.so differ diff --git a/client/Piztor/libs/armeabi/liblocSDK4.so b/client/Piztor/libs/armeabi/liblocSDK4.so new file mode 100644 index 0000000..051896a Binary files /dev/null and b/client/Piztor/libs/armeabi/liblocSDK4.so 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 Binary files /dev/null and b/client/Piztor/libs/baidumapapi_v2_1_3.jar 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 Binary files /dev/null and b/client/Piztor/libs/locSDK_4.0.jar differ 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 Binary files /dev/null and b/client/Piztor/res/drawable/circle_red.png differ diff --git a/client/Piztor/res/drawable/footbar_checkin.png b/client/Piztor/res/drawable/footbar_checkin.png index 90afba7..0a4b148 100644 Binary files a/client/Piztor/res/drawable/footbar_checkin.png and b/client/Piztor/res/drawable/footbar_checkin.png 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 Binary files a/client/Piztor/res/drawable/footbar_checkin_1.png and b/client/Piztor/res/drawable/footbar_checkin_1.png differ diff --git a/client/Piztor/res/drawable/footbar_fetch.png b/client/Piztor/res/drawable/footbar_fetch.png index 32d24d2..138ef6a 100644 Binary files a/client/Piztor/res/drawable/footbar_fetch.png and b/client/Piztor/res/drawable/footbar_fetch.png 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 Binary files a/client/Piztor/res/drawable/footbar_fetch_1.png and b/client/Piztor/res/drawable/footbar_fetch_1.png differ diff --git a/client/Piztor/res/drawable/footbar_marker.png b/client/Piztor/res/drawable/footbar_marker.png index 3de909f..e84bffa 100644 Binary files a/client/Piztor/res/drawable/footbar_marker.png and b/client/Piztor/res/drawable/footbar_marker.png 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 Binary files a/client/Piztor/res/drawable/footbar_marker_1.png and b/client/Piztor/res/drawable/footbar_marker_1.png differ diff --git a/client/Piztor/res/drawable/footbar_search.png b/client/Piztor/res/drawable/footbar_search.png index 3549f84..8d3681f 100644 Binary files a/client/Piztor/res/drawable/footbar_search.png and b/client/Piztor/res/drawable/footbar_search.png 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 Binary files a/client/Piztor/res/drawable/footbar_search_1.png and b/client/Piztor/res/drawable/footbar_search_1.png differ diff --git a/client/Piztor/res/drawable/footbar_settings.png b/client/Piztor/res/drawable/footbar_settings.png index 455bd0b..a6987f8 100644 Binary files a/client/Piztor/res/drawable/footbar_settings.png and b/client/Piztor/res/drawable/footbar_settings.png 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 Binary files a/client/Piztor/res/drawable/footbar_settings_1.png and b/client/Piztor/res/drawable/footbar_settings_1.png 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 Binary files /dev/null and b/client/Piztor/res/drawable/icon_marka.png differ diff --git a/client/Piztor/res/drawable/marka.png b/client/Piztor/res/drawable/marka.png deleted file mode 100644 index a478d36..0000000 Binary files a/client/Piztor/res/drawable/marka.png and /dev/null differ diff --git a/client/Piztor/res/drawable/marker1.png b/client/Piztor/res/drawable/marker1.png new file mode 100644 index 0000000..3ba8760 Binary files /dev/null and b/client/Piztor/res/drawable/marker1.png differ diff --git a/client/Piztor/res/drawable/marker2.png b/client/Piztor/res/drawable/marker2.png new file mode 100644 index 0000000..90afba7 Binary files /dev/null and b/client/Piztor/res/drawable/marker2.png differ diff --git a/client/Piztor/res/drawable/navigation_back.png b/client/Piztor/res/drawable/navigation_back.png index 3bdda98..348dc3d 100644 Binary files a/client/Piztor/res/drawable/navigation_back.png and b/client/Piztor/res/drawable/navigation_back.png 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 Binary files a/client/Piztor/res/drawable/navigation_back_1.png and b/client/Piztor/res/drawable/navigation_back_1.png differ diff --git a/client/Piztor/res/drawable/popup.png b/client/Piztor/res/drawable/popup.png new file mode 100644 index 0000000..3dd9e51 Binary files /dev/null and b/client/Piztor/res/drawable/popup.png 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 @@ @@ -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"> @@ -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" /> - + \ 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" + > + android:layout_marginTop="50dip" > @@ -40,7 +40,7 @@ android:layout_weight="1"> @@ -65,7 +65,7 @@ android:orientation="vertical"> @@ -116,7 +116,7 @@ android:layout_weight="1"> 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"> 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 @@ 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 @@ 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 @@ 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 @@ 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. --> - 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. --> - 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 @@ - piztor + Piztor Settings Hello world! Settings @@ -17,6 +17,9 @@ Login Main Settings - MapMaker + password + username + login + desc 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, HashMap>>(); 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..04e2e71 --- /dev/null +++ b/client/Piztor/src/com/macaroon/piztor/BMapUtil.java @@ -0,0 +1,22 @@ +package com.macaroon.piztor; + +import android.graphics.Bitmap; +import android.view.View; + +public class BMapUtil { + + /** + * 从view 得到图片 + * @param view + * @return + */ + 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..c3f6047 100644 --- a/client/Piztor/src/com/macaroon/piztor/Main.java +++ b/client/Piztor/src/com/macaroon/piztor/Main.java @@ -12,6 +12,7 @@ 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; @@ -20,6 +21,8 @@ import com.baidu.location.LocationClient; import com.baidu.location.LocationClientOption; import com.baidu.mapapi.map.LocationData; import com.baidu.mapapi.map.MapView; +import com.baidu.mapapi.map.OverlayItem; +import com.baidu.mapapi.map.PopupOverlay; public class Main extends PiztorAct { final static int SearchButtonPress = 1; @@ -29,6 +32,19 @@ public class Main extends PiztorAct { final static int Fetch = 6; final static int mapViewtouched = 7; + /** + * popups + */ + private PopupOverlay pop = null; + private TextView popupText = null; + private View viewCache = null; + private View popupInfo = null; + private View popupLeft = null; + private View popupRight = null; + private MapView.LayoutParams layoutParam = null; + private OverlayItem mCurItem = null; + + MapMaker mapMaker = null; MapView mMapView; @@ -40,7 +56,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 +107,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 +154,9 @@ public class Main extends PiztorAct { // TODO flush map view void flushMap() { - + if (mapMaker != null) + mapMaker.UpdateMap(AppMgr.mapInfo); + else System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); } public class MyLocationListener implements BDLocationListener { @@ -155,7 +173,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 +243,10 @@ public class Main extends PiztorAct { requesLocation(Infomation.myInfo.gid); break; case FocuseButtonPress: - // TODO setFocus + mapMaker.UpdateLocationOverlay(locData, true); break; case SuccessFetch: - requesLocation(Infomation.myInfo.gid); + flushMap(); break; default: break; @@ -279,7 +298,7 @@ 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()); @@ -297,8 +316,15 @@ public class Main extends PiztorAct { mLocClient.setLocOption(option); mLocClient.start(); mapMaker.UpdateLocationOverlay(locData, false); - } + } + /* + public boolean onTap(int index) { + OverlayItem item = getItem(index); + mCurItem = item; + if () + } + */ @Override protected void onStart() { super.onStart(); @@ -342,7 +368,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..89f29fc 100644 --- a/client/Piztor/src/com/macaroon/piztor/MapMaker.java +++ b/client/Piztor/src/com/macaroon/piztor/MapMaker.java @@ -101,38 +101,39 @@ public class MapMaker extends Activity{ mMapView.getOverlays().add(mLocationOverlay); mLocationOverlay.enableCompass(); mMapView.refresh(); + mOverlay = new MyOverlay(context.getResources().getDrawable(R.drawable.circle_red), mMapView); } public void UpdateMap(MapInfo mapInfo) { - /** - * Update Location Overlay - */ - GeoPoint location = mapInfo.getMyInfo().getLocation(); - LocationData locationData = new LocationData(); - locationData.latitude = location.getLatitudeE6() / 1e6; - locationData.longitude = location.getLongitudeE6() / 1e6; - mLocationOverlay.setData(locationData); - mMapView.refresh(); - /** * Update location of others */ - mOverlay.removeAll(); + if (mOverlay != null && mOverlay.getAllItem().size() != 0) { + System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); + clearOverlay(mMapView); + System.out.println("+++++++++++++++++++++++------------------------------------------"); + } + mOverlay = new MyOverlay(context.getResources().getDrawable(R.drawable.circle_red), mMapView); //mMapView.refresh(); GeoPoint p; Vector 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(); mItems.addAll(mOverlay.getAllItem()); - mMapView.getOverlays().add(mOverlay); - mMapView.refresh(); + if (mMapView != null) { + if (mMapView.getOverlays() != null) { + mMapView.getOverlays().add(mOverlay); + mMapView.refresh(); + } + } } 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); - } -} -- cgit v1.2.3-70-g09d2