diff options
author | Teddy <[email protected]> | 2013-08-29 16:30:18 +0800 |
---|---|---|
committer | Teddy <[email protected]> | 2013-08-29 16:30:18 +0800 |
commit | 88894471c3d35bb9d25cf416bee07b08641c3149 (patch) | |
tree | 38d871f5d6448486b8794c55672d8e494e7a29c8 /client/Piztor/src | |
parent | 3528fbd730a6d28e7e0139d00bcf04b36644e8f8 (diff) | |
parent | d29aafc17b633a2fd3598b6283861f7da155bd06 (diff) |
Merge branch 'master' of github.com:Determinant/piztor
Diffstat (limited to 'client/Piztor/src')
-rw-r--r-- | client/Piztor/src/com/macaroon/piztor/Main.java | 5 | ||||
-rw-r--r-- | client/Piztor/src/com/macaroon/piztor/MapMaker.java | 50 |
2 files changed, 36 insertions, 19 deletions
diff --git a/client/Piztor/src/com/macaroon/piztor/Main.java b/client/Piztor/src/com/macaroon/piztor/Main.java index cfa77c5..eeab207 100644 --- a/client/Piztor/src/com/macaroon/piztor/Main.java +++ b/client/Piztor/src/com/macaroon/piztor/Main.java @@ -186,6 +186,7 @@ public class Main extends PiztorAct { locData.accuracy = location.getRadius(); locData.direction = location.getDerect(); + System.out.println("LLLLLLLLLLLLLLLLLLLLLLL " + locData.latitude + " " + locData.longitude); mapMaker.UpdateLocationOverlay(locData, isFirstLocation); isFirstLocation = false; if (Infomation.token != null) { @@ -379,10 +380,6 @@ public class Main extends PiztorAct { InputMethodManager.HIDE_NOT_ALWAYS); } - /* - * public boolean onTap(int index) { OverlayItem item = getItem(index); - * mCurItem = item; if () } - */ @Override protected void onStart() { super.onStart(); diff --git a/client/Piztor/src/com/macaroon/piztor/MapMaker.java b/client/Piztor/src/com/macaroon/piztor/MapMaker.java index d11fe5c..3987cd6 100644 --- a/client/Piztor/src/com/macaroon/piztor/MapMaker.java +++ b/client/Piztor/src/com/macaroon/piztor/MapMaker.java @@ -80,8 +80,11 @@ public class MapMaker extends Activity { // Popup component private PopupOverlay popLay = null; private TextView popupText = null; + private TextView leftText = null; private View viewCache = null; private View popupInfo = null; + private View popupLeft = null; + private View popupRight = null; //misc private Context context; @@ -128,13 +131,24 @@ public class MapMaker extends Activity { @Override public boolean onTap(int index) { - OverlayItem item = getItem(index); - //TODO - ///////////////////////////////////////////////////////// - popupText.setText("^_^"); - Bitmap bitmap = BMapUtil.getBitmapFromView(popupInfo); - popLay.showPopup(bitmap, item.getPoint(),32); - + if (index == 0 && nowMarker != null) { + OverlayItem item = getItem(index); + //TODO + ///////////////////////////////////////////////////////// + popupText.setText("hour"); + leftText.setText("minute"); + Bitmap bitmap [] = { + BMapUtil.getBitmapFromView(popupLeft), + BMapUtil.getBitmapFromView(popupInfo), + BMapUtil.getBitmapFromView(popupRight), + }; + popLay.showPopup(bitmap, item.getPoint(),32); + } else { + OverlayItem item = getItem(index); + popupText.setText("UID"); + Bitmap bitmap = BMapUtil.getBitmapFromView(popupInfo); + popLay.showPopup(bitmap, item.getPoint(), 32); + } return true; } @@ -144,7 +158,6 @@ public class MapMaker extends Activity { if(popLay != null) { popLay.hidePop(); } - return false; } } @@ -181,7 +194,10 @@ public class MapMaker extends Activity { LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); viewCache = inflater.inflate(R.layout.custom_text_view, null); popupInfo = (View)viewCache.findViewById(R.id.popinfo); + popupLeft = (View)viewCache.findViewById(R.id.popleft); + popupRight = (View)viewCache.findViewById(R.id.popright); popupText = (TextView)viewCache.findViewById(R.id.textcache); + leftText = (TextView)viewCache.findViewById(R.id.popleft); PopupClickListener popListener = new PopupClickListener() { @@ -191,8 +207,12 @@ public class MapMaker extends Activity { if (index == 0) { // do nothing } - if (index == 1) { - // this is a marker and remove it + if (index == 2) { + // remove current marker + mOverlay.removeItem(nowMarker); + nowMarker = null; + mMapView.refresh(); + popLay.hidePop(); } } }; @@ -224,7 +244,6 @@ public class MapMaker extends Activity { mLocationOverlay.setData(locationData); mMapView.refresh(); - if (hasAnimation) { mMapController.animateTo(new GeoPoint((int)(locationData.latitude * 1E6) , (int)(locationData.longitude * 1E6))); @@ -245,6 +264,10 @@ public class MapMaker extends Activity { GeoPoint p; Vector<UserInfo> allUsers = mapInfo.getVector(); boolean flag = false; + if (nowMarker != null) { + Log.d("marker", "now marker is not null"); + mOverlay.addItem(nowMarker); + } for (int i =1; i < allUsers.size(); i++) { // it's me! if (allUsers.get(i).uid == Infomation.myInfo.uid) continue; @@ -264,10 +287,7 @@ public class MapMaker extends Activity { mItems = new ArrayList<OverlayItem>(); mItems.addAll(mOverlay.getAllItem()); } - if (nowMarker != null) { - Log.d("marker", "now marker is not null"); - mOverlay.addItem(nowMarker); - } + if (mMapView != null) { if (mMapView.getOverlays() != null) { mMapView.getOverlays().add(mOverlay); |