summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/Piztor/src/com/macaroon/piztor/AlertMaker.java7
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Main.java11
-rw-r--r--client/Piztor/src/com/macaroon/piztor/MapMaker.java76
-rw-r--r--client/Piztor/src/com/macaroon/piztor/SubscribeSettings.java2
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Transam.java17
-rw-r--r--client/Piztor/src/com/macaroon/piztor/myApp.java4
6 files changed, 48 insertions, 69 deletions
diff --git a/client/Piztor/src/com/macaroon/piztor/AlertMaker.java b/client/Piztor/src/com/macaroon/piztor/AlertMaker.java
index eec01f5..16e15db 100644
--- a/client/Piztor/src/com/macaroon/piztor/AlertMaker.java
+++ b/client/Piztor/src/com/macaroon/piztor/AlertMaker.java
@@ -51,8 +51,9 @@ public class AlertMaker {
private GeoPoint markerPoint;
private MapMaker mapMaker;
private long timestamp;
- int mHour;
- int mMinute;
+ int mHour;
+ int mMinute;
+ myApp app;
public AlertMaker(Context cc, MapMaker mm) {
context =cc;
@@ -192,7 +193,7 @@ public void showRemoveMarkerAlert() {
LayoutInflater infaler = LayoutInflater.from(context);
final LinearLayout layout = (LinearLayout)infaler.inflate(R.layout.checkindialog, null);
checkinDialog.setView(layout);
- checkinDialog.setNeutralButton("取消", new DialogInterface.OnClickListener() {
+ checkinDialog.setNeutralButton("确定", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
InputMethodManager im = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
im.hideSoftInputFromWindow(layout.getWindowToken(), 0);
diff --git a/client/Piztor/src/com/macaroon/piztor/Main.java b/client/Piztor/src/com/macaroon/piztor/Main.java
index 5951db1..98b08a0 100644
--- a/client/Piztor/src/com/macaroon/piztor/Main.java
+++ b/client/Piztor/src/com/macaroon/piztor/Main.java
@@ -129,7 +129,10 @@ public class Main extends PiztorAct {
out.mapMaker.receiveMarker(markerInfo);
break;
case -1:
- out.actMgr.trigger(AppMgr.logout);
+ EException e = (EException) m.obj;
+ if (e.Etype == EException.EPushFailedException)
+ out.receiveMessage("网络不稳定~");
+ else out.actMgr.trigger(AppMgr.logout);
default:
break;
}
@@ -246,6 +249,7 @@ public class Main extends PiztorAct {
LocationClientOption option = new LocationClientOption();
option.setOpenGps(true);
option.setCoorType("bd09ll");
+ option.setPriority(LocationClientOption.GpsFirst);
option.setScanSpan(GPSrefreshrate * 1000);
mLocClient.setLocOption(option);
}
@@ -334,11 +338,11 @@ public class Main extends PiztorAct {
(int) (locData.longitude * 1E6));
double disFromMarker = DistanceUtil.getDistance(curPoint,
mapMaker.getMakerLocation());
- if (disFromMarker < Math.max(Math.min(locData.accuracy, 20.0), (float)checkinRadius) ) {
+ if (disFromMarker < Math.max(locData.accuracy, (float)checkinRadius) ) {
alertMaker.showCheckinAlter();
} else {
Toast toast = Toast.makeText(Main.this,
- String.format("请靠近路标,现在距离%.2f米", disFromMarker), 2000);
+ String.format("请靠近路标,现在距离%.2f米",disFromMarker), 2000);
toast.setGravity(Gravity.TOP, 0, 80);
toast.show();
}
@@ -453,7 +457,6 @@ public class Main extends PiztorAct {
System.out.println("fuck!!");
} else
requestUserInfo();
- // mapMaker.onResume();
flushMap();
super.onResume();
}
diff --git a/client/Piztor/src/com/macaroon/piztor/MapMaker.java b/client/Piztor/src/com/macaroon/piztor/MapMaker.java
index 837df2b..79d2eed 100644
--- a/client/Piztor/src/com/macaroon/piztor/MapMaker.java
+++ b/client/Piztor/src/com/macaroon/piztor/MapMaker.java
@@ -11,6 +11,7 @@ import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.location.LocationManager;
+import android.os.DropBoxManager.Entry;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -21,8 +22,6 @@ import android.widget.Toast;
import com.baidu.mapapi.map.ItemizedOverlay;
import com.baidu.mapapi.map.LocationData;
import com.baidu.mapapi.map.MKOLUpdateElement;
-import com.baidu.mapapi.map.MKOfflineMap;
-import com.baidu.mapapi.map.MKOfflineMapListener;
import com.baidu.mapapi.map.MapController;
import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.map.MyLocationOverlay;
@@ -36,7 +35,6 @@ public class MapMaker {
// MapView controlling component
MapView mMapView = null;
MapController mMapController = null;
- MKOfflineMap mOffline = null;
// Default center
private final static GeoPoint sjtuCenter = new GeoPoint(
@@ -155,42 +153,6 @@ public class MapMaker {
}
/**
- * Initialize offline map
- */
- public void InitOfflineMap() {
-
- mOffline = new MKOfflineMap();
- mOffline.init(mMapController, new MKOfflineMapListener() {
-
- @Override
- public void onGetOfflineMapState(int type, int state) {
- switch (type) {
- case MKOfflineMap.TYPE_DOWNLOAD_UPDATE:
- MKOLUpdateElement update = mOffline.getUpdateInfo(state);
- break;
- case MKOfflineMap.TYPE_NEW_OFFLINE:
- Log.d("offline", String.format("add offline map %d", state));
- break;
- case MKOfflineMap.TYPE_VER_UPDATE:
- Log.d("offline", String.format("new offline map version"));
- break;
- }
- }
- });
- int num = mOffline.scan();
-
- if (num == 0) {
- // msg =
- // "No offline map found. It may have been loaded already or misplaced.";
- } else {
- Toast.makeText(context, String.format("加载了%d个离线地图包", num),
- Toast.LENGTH_SHORT).show();
- }
- Log.d("offline", "inited");
-
- }
-
- /**
* Initialize location layer
*/
public void InitLocationOverlay() {
@@ -267,9 +229,9 @@ public class MapMaker {
InitLocationOverlay();
InitMyOverLay();
InitPopup();
- //InitOfflineMap();
myBM = new Drawable[20];
initMyIcons();
+ preMapInfo = null;
// InitTouchListenr();
}
@@ -314,8 +276,8 @@ public class MapMaker {
boolean isInvalidLocation(GeoPoint point) {
if (point == null) return false;
- if (point.getLatitudeE6() / 1E6 > 180.0 || point.getLatitudeE6() / 1E6 < -180.0
- || point.getLongitudeE6() > 180.0 || point.getLongitudeE6() / 1E6 < -180.0)
+ if (point.getLatitudeE6() / 1E6 > 180 || point.getLatitudeE6() / 1E6 < -180
+ || point.getLongitudeE6() > 180 || point.getLongitudeE6() / 1E6 < -180)
return false;
return true;
}
@@ -331,24 +293,26 @@ public class MapMaker {
return;
}
freshManInfo = new Vector<UserInfo>();
+
// first remove all old users that are not here now
- if (preMapInfo != null) {
- for (UserInfo i : preMapInfo.getVector()) {
- if (i.uid == app.mapInfo.myInfo.uid)
- continue;
- if (mapInfo.getUserInfo(i.uid) == null) {
- mOverlay.removeItem(hash.get(i.uid));
- markerToInt.remove(hash.get(i.uid));
- hash.remove(i.uid);
- }
- if (mapInfo.getUserInfo(i.uid) != null && isInvalidLocation(mapInfo.getUserInfo(i.uid).location)) {
- mOverlay.removeItem(hash.get(i.uid));
- markerToInt.remove(hash.get(i.uid));
- hash.remove(i.uid);
- }
+
+ Vector<Integer> delList = new Vector<Integer>();
+
+ for (java.util.Map.Entry<Integer, OverlayItem> i : hash.entrySet()) {
+ if (mapInfo.getUserInfo(i.getKey()) == null) {
+ delList.add(i.getKey());
}
}
+ for (int i : delList) {
+ mOverlay.removeItem(hash.get(i));
+ markerToInt.remove(hash.get(i));
+ }
+ for (int i : delList) {
+ hash.remove(i);
+ }
+
mMapView.refresh();
+
preMapInfo = mapInfo.copy();
// then update and add items
diff --git a/client/Piztor/src/com/macaroon/piztor/SubscribeSettings.java b/client/Piztor/src/com/macaroon/piztor/SubscribeSettings.java
index 4fdaa8a..ed019dc 100644
--- a/client/Piztor/src/com/macaroon/piztor/SubscribeSettings.java
+++ b/client/Piztor/src/com/macaroon/piztor/SubscribeSettings.java
@@ -221,7 +221,7 @@ public class SubscribeSettings extends PiztorAct {
simpleAdapter.notifyDataSetChanged();
}
for (RGroup i : ((myApp) getApplication()).sublist) {
- if (i.section == 255) continue;
+ if (recSubcribe.contains(i.company)) continue;
//else
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("subscribe_text", i.company + "连 " + i.section + "班");
diff --git a/client/Piztor/src/com/macaroon/piztor/Transam.java b/client/Piztor/src/com/macaroon/piztor/Transam.java
index df2194f..aa16b68 100644
--- a/client/Piztor/src/com/macaroon/piztor/Transam.java
+++ b/client/Piztor/src/com/macaroon/piztor/Transam.java
@@ -311,11 +311,15 @@ public class Transam implements Runnable {
TimerTask task = out.new tmain();
out.timer.schedule(task,out.retime);
} else if (out.tcnt == 0) {
+ out.tcnt = out.cnt;
Message m = new Message();
m.obj = msg.obj;
m.what = Exception;
out.recall.sendMessage(m);
- out.running = false;
+ //out.running = false;
+ out.timer = new Timer();
+ TimerTask task = out.new tmain();
+ out.timer.schedule(task,out.retime);
}
break;
case TimeOut:
@@ -327,11 +331,15 @@ public class Transam implements Runnable {
out.timer.schedule(task,out.retime);
} else if (out.tcnt == 0) {
Message m = new Message();
+ out.tcnt = out.cnt;
EConnectFailedException c = new EConnectFailedException(out.req.type,out.req.time);
m.obj = c;
m.what = Exception;
out.recall.sendMessage(m);
- out.running = false;
+ //out.running = false;
+ out.timer = new Timer();
+ TimerTask task = out.new tmain();
+ out.timer.schedule(task,out.retime);
}
break;
case Reconnect:
@@ -342,13 +350,16 @@ public class Transam implements Runnable {
TimerTask task = out.new pmain();
out.pushtimer.schedule(task,out.retime);
} else if (out.rcnt == 0) {
- out.pushing = false;
Message m = new Message();
EPushFailedException c = new EPushFailedException(5,0);
//m.obj = msg.obj;
m.obj = c;
m.what = Exception;
out.recall.sendMessage(m);
+ out.rcnt = out.cnt;
+ out.pushtimer = new Timer();
+ TimerTask task = out.new pmain();
+ out.pushtimer.schedule(task,out.retime);
}
break;
case StartPush:
diff --git a/client/Piztor/src/com/macaroon/piztor/myApp.java b/client/Piztor/src/com/macaroon/piztor/myApp.java
index ab38efa..10b0118 100644
--- a/client/Piztor/src/com/macaroon/piztor/myApp.java
+++ b/client/Piztor/src/com/macaroon/piztor/myApp.java
@@ -10,13 +10,13 @@ import android.util.Log;
@SuppressLint("UseSparseArrays")
public class myApp extends Application {
- private static final String strKey = "8a0ae50048d103b2b8b12b7066f4ea7d";
+ private static final String strKey = "579bf85175473ea618258a7a3d3ba63b";
BMapManager mBMapManager;
boolean isExiting = false;
boolean isLogout = false;
String ip = "202.120.7.4";
// static String ip = "69.85.86.42";
-// static String ip = "192.168.1.101";
+// static String ip = "192.168.1.171";
int port = 2223;
String token = null;
String username = null;