diff options
-rw-r--r-- | client/Piztor/res/drawable/dialog_cancel.png | bin | 0 -> 1316 bytes | |||
-rw-r--r-- | client/Piztor/res/layout/custom_text_view.xml | 47 | ||||
-rw-r--r-- | client/Piztor/src/com/macaroon/piztor/Main.java | 5 | ||||
-rw-r--r-- | client/Piztor/src/com/macaroon/piztor/MapMaker.java | 50 |
4 files changed, 58 insertions, 44 deletions
diff --git a/client/Piztor/res/drawable/dialog_cancel.png b/client/Piztor/res/drawable/dialog_cancel.png Binary files differnew file mode 100644 index 0000000..d59a5e5 --- /dev/null +++ b/client/Piztor/res/drawable/dialog_cancel.png diff --git a/client/Piztor/res/layout/custom_text_view.xml b/client/Piztor/res/layout/custom_text_view.xml index 5ef1c9f..dac54ce 100644 --- a/client/Piztor/res/layout/custom_text_view.xml +++ b/client/Piztor/res/layout/custom_text_view.xml @@ -13,35 +13,32 @@ android:background="@drawable/popup_side" android:gravity="center" android:textStyle="bold" - android:textColor="#3814ed" - android:text="更新位置" + android:textColor="@android:color/black" android:textSize="12sp" /> - <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" - android:id="@+id/popinfo" - > + 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/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" /> + <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> @@ -52,10 +49,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/popup_side" - android:textColor="#3814ed" + android:textColor="@android:color/black" android:gravity="center" android:textStyle="bold" - android:text="更新marker" - android:textSize="12sp" /> + android:textSize="12sp" + android:text="cancel"/> -</LinearLayout> +</LinearLayout>
\ No newline at end of file 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); |