summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorsjtufs <[email protected]>2013-08-28 17:32:17 +0800
committersjtufs <[email protected]>2013-08-28 17:32:17 +0800
commit6d2cbdae51c0cc2a1e2c898dcfc73df49e87682c (patch)
treefb4aad81ddb7a6879528702ba6f1ee0d5a133f2a /client
parentf2786f75014ddbe3ab0c73892feb216ef95a59e5 (diff)
Markers (Other Users) are now "touchable"
Diffstat (limited to 'client')
-rw-r--r--client/Piztor/.project33
-rw-r--r--client/Piztor/.settings/org.eclipse.jdt.core.prefs4
-rw-r--r--client/Piztor/ic_launcher-web.pngbin130248 -> 0 bytes
-rw-r--r--client/Piztor/proguard-project.txt20
-rw-r--r--client/Piztor/project.properties14
-rw-r--r--client/Piztor/res/drawable/pop.pngbin0 -> 1312 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/custom_text_view.xml61
-rw-r--r--client/Piztor/src/com/macaroon/piztor/BMapUtil.java5
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Main.java32
-rw-r--r--client/Piztor/src/com/macaroon/piztor/MapMaker.java60
-rw-r--r--client/README.rst1
16 files changed, 125 insertions, 105 deletions
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/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/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/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_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/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/src/com/macaroon/piztor/BMapUtil.java b/client/Piztor/src/com/macaroon/piztor/BMapUtil.java
index 04e2e71..38d9f7d 100644
--- a/client/Piztor/src/com/macaroon/piztor/BMapUtil.java
+++ b/client/Piztor/src/com/macaroon/piztor/BMapUtil.java
@@ -5,11 +5,6 @@ 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),
diff --git a/client/Piztor/src/com/macaroon/piztor/Main.java b/client/Piztor/src/com/macaroon/piztor/Main.java
index c3f6047..952b7f2 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;
@@ -19,10 +21,15 @@ 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;
@@ -32,19 +39,6 @@ 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;
@@ -156,7 +150,6 @@ public class Main extends PiztorAct {
void flushMap() {
if (mapMaker != null)
mapMaker.UpdateMap(AppMgr.mapInfo);
- else System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
}
public class MyLocationListener implements BDLocationListener {
@@ -300,8 +293,6 @@ public class Main extends PiztorAct {
actMgr.add(focusStatus, Fetch, focusStatus);
//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());
@@ -316,15 +307,8 @@ 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();
diff --git a/client/Piztor/src/com/macaroon/piztor/MapMaker.java b/client/Piztor/src/com/macaroon/piztor/MapMaker.java
index 89f29fc..0c1a7d0 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;
@@ -42,6 +45,7 @@ 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;
@@ -56,6 +60,13 @@ public class MapMaker extends Activity{
private ArrayList<OverlayItem> mItems = null;
private LocationOverlay mLocationOverlay;
private Context context;
+ /**
+ * 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 +86,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) {
/**
@@ -102,6 +133,29 @@ public class MapMaker extends Activity{
mLocationOverlay.enableCompass();
mMapView.refresh();
mOverlay = new MyOverlay(context.getResources().getDrawable(R.drawable.circle_red), mMapView);
+ Log.d("123", "MapView initialized");
+
+ /**
+ * Initialize pop up
+ */
+ 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);
}
public void UpdateMap(MapInfo mapInfo) {
@@ -109,9 +163,7 @@ public class MapMaker extends Activity{
* Update location of others
*/
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();
diff --git a/client/README.rst b/client/README.rst
deleted file mode 100644
index 0527e6b..0000000
--- a/client/README.rst
+++ /dev/null
@@ -1 +0,0 @@
-This is a test