summaryrefslogtreecommitdiff
path: root/client/Piztor/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/Piztor/src')
-rw-r--r--client/Piztor/src/com/macaroon/piztor/AlertMaker.java24
-rw-r--r--client/Piztor/src/com/macaroon/piztor/AppMgr.java8
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Convert.java63
-rw-r--r--client/Piztor/src/com/macaroon/piztor/EException.java75
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Infomation.java8
-rw-r--r--client/Piztor/src/com/macaroon/piztor/InitAct.java9
-rw-r--r--client/Piztor/src/com/macaroon/piztor/LogInfo.java12
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Login.java27
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Main.java227
-rw-r--r--client/Piztor/src/com/macaroon/piztor/MapInfo.java9
-rw-r--r--client/Piztor/src/com/macaroon/piztor/MapMaker.java85
-rw-r--r--client/Piztor/src/com/macaroon/piztor/PushClient.java106
-rw-r--r--client/Piztor/src/com/macaroon/piztor/RGroup.java10
-rw-r--r--client/Piztor/src/com/macaroon/piztor/RUserInfo.java22
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Req.java100
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ReqLocation.java16
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ReqLogin.java16
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ReqLogout.java12
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ReqSendMessage.java14
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ReqStartPush.java12
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ReqUpdate.java16
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ReqUserInfo.java15
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ReqUserinfo.java15
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Res.java141
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ResLocation.java18
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ResLogin.java17
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ResLogout.java13
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ResPushLocation.java18
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ResPushMessage.java15
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ResSendMessage.java13
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ResStartPush.java13
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ResUpdate.java13
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ResUserInfo.java22
-rw-r--r--client/Piztor/src/com/macaroon/piztor/ResUserinfo.java20
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Settings.java131
-rw-r--r--client/Piztor/src/com/macaroon/piztor/SocketClient.java373
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Transam.java219
-rw-r--r--client/Piztor/src/com/macaroon/piztor/UpdateInfo.java5
38 files changed, 1012 insertions, 920 deletions
diff --git a/client/Piztor/src/com/macaroon/piztor/AlertMaker.java b/client/Piztor/src/com/macaroon/piztor/AlertMaker.java
index 839813a..cc70e62 100644
--- a/client/Piztor/src/com/macaroon/piztor/AlertMaker.java
+++ b/client/Piztor/src/com/macaroon/piztor/AlertMaker.java
@@ -96,7 +96,7 @@ public class AlertMaker {
mapMaker.DrawMarker(markerPoint);
else {
Toast toast = Toast.makeText(context,
- "Too early!Give me more time!", Toast.LENGTH_LONG);
+ "Too early! Give me at least 2 minutes!", Toast.LENGTH_LONG);
toast.show();
closeBoard(context);
showMarkerAlert(markerPoint);
@@ -108,26 +108,4 @@ public class AlertMaker {
markerDialog.show();
}
- public void showQuitAlert() {
-
- AlertDialog.Builder quitDialog = new AlertDialog.Builder(context);
- closeBoard(context);
- quitDialog.setTitle("Quit");
- quitDialog.setMessage("Do you want to logout and quit?");
- quitDialog.setPositiveButton("Quit",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- AppMgr.exit();
- }
- });
- quitDialog.setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- closeBoard(context);
- }
- });
- quitDialog.show();
- }
-
}
diff --git a/client/Piztor/src/com/macaroon/piztor/AppMgr.java b/client/Piztor/src/com/macaroon/piztor/AppMgr.java
index e322745..933d2db 100644
--- a/client/Piztor/src/com/macaroon/piztor/AppMgr.java
+++ b/client/Piztor/src/com/macaroon/piztor/AppMgr.java
@@ -68,21 +68,15 @@ public class AppMgr {
static void trigger(int event) {
Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
if (event == errorToken)
Infomation.token = null;
if (event == loginSuccess) {
mBMapManager.start();
- transam.startPush(Infomation.token, Infomation.username);
+ mapInfo.clear();
}
if (event == logout) {
mBMapManager.stop();
- transam.stopPush();
}
nowAct.startActivity(i);
}
diff --git a/client/Piztor/src/com/macaroon/piztor/Convert.java b/client/Piztor/src/com/macaroon/piztor/Convert.java
new file mode 100644
index 0000000..af7359c
--- /dev/null
+++ b/client/Piztor/src/com/macaroon/piztor/Convert.java
@@ -0,0 +1,63 @@
+package com.macaroon.piztor;
+
+import android.annotation.SuppressLint;
+
+public class Convert {
+
+ @SuppressLint("DefaultLocale")
+ public static byte[] hexStringToBytes(String hexString) {
+ if (hexString == null || hexString.equals("")) {
+ return null;
+ }
+ hexString = hexString.toUpperCase();
+ int length = hexString.length() / 2;
+ char[] hexChars = hexString.toCharArray();
+ byte[] d = new byte[length];
+ for (int i = 0; i < length; i++) {
+ int pos = i * 2;
+ d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
+ }
+ return d;
+ }
+
+ public static byte charToByte(char c) {
+ return (byte) "0123456789ABCDEF".indexOf(c);
+ }
+
+ public static byte[] intToBytes(int i) {
+ byte[] d = new byte[4];
+ d[0] = (byte)((i >> 24) & 0xFF);
+ d[1] = (byte)((i >> 16) & 0xFF);
+ d[2] = (byte)((i >> 8) & 0xFF);
+ d[3] = (byte)(i & 0xFF);
+ return d;
+ }
+
+ public static byte[] doubleToBytes(double d){
+ byte[] b=new byte[8];
+ long l=Double.doubleToLongBits(d);
+ for(int i=0;i<8;i++){
+ b[i] = (byte)(l >>> 8*(7-i));
+ }
+ return b;
+ }
+
+ public static void write(byte[] s,byte[] w,int l) {
+
+ for(int i=0;i<w.length;i++){
+ s[i+l] = w[i];
+ }
+ }
+
+ public static String byteToHexString(byte[] buffer){
+ String p ="";
+ for (int i = 0; i < buffer.length; i++) {
+ String hex = Integer.toHexString(buffer[i] & 0xFF);
+ if (hex.length() == 1) {
+ hex = '0' + hex;
+ }
+ p += hex;
+ }
+ return p;
+ }
+} \ No newline at end of file
diff --git a/client/Piztor/src/com/macaroon/piztor/EException.java b/client/Piztor/src/com/macaroon/piztor/EException.java
new file mode 100644
index 0000000..5ce1fdb
--- /dev/null
+++ b/client/Piztor/src/com/macaroon/piztor/EException.java
@@ -0,0 +1,75 @@
+package com.macaroon.piztor;
+
+
+
+public class EException extends Exception {
+
+ static final int EConnectedFailedException =101;
+ static final int ETimeOutException =102;
+ static final int EJavaHostException =103;
+ static final int EPushFailedException =104;
+ static final int EIOException =105;
+ static final int EUnknownHostException =106;
+ static final int EStatusFailedException =107;
+
+
+ private static final long serialVersionUID = 100L;
+ int Rtype;
+ int Etype;
+ long time;
+ public EException(int e,int r,long timep) {
+ super();
+ Rtype = r;
+ Etype = e;
+ time = timep;
+ }
+ }
+
+ class EConnectFailedException extends EException{
+ private static final long serialVersionUID = 101L;
+ public EConnectFailedException(int t,long timep) {
+ super(101,t,timep);
+ }
+ }
+
+ class ETimeOutException extends EException{
+ private static final long serialVersionUID = 102L;
+ public ETimeOutException(int t,long timep) {
+ super(102,t,timep);
+ }
+ }
+
+ class EJavaHostException extends EException{
+ private static final long serialVersionUID = 103L;
+ public EJavaHostException(int t,long timep) {
+ super(103,t,timep);
+ }
+ }
+
+ class EPushFailedException extends EException{
+ private static final long serialVersionUID = 104L;
+ public EPushFailedException(int t,long timep) {
+ super(104,t,timep);
+ }
+ }
+
+ class EIOException extends EException{
+ private static final long serialVersionUID = 105L;
+ public EIOException(int t,long timep) {
+ super(105,t,timep);
+ }
+ }
+
+ class EUnknownHostException extends EException{
+ private static final long serialVersionUID = 106L;
+ public EUnknownHostException(int t,long timep) {
+ super(106,t,timep);
+ }
+ }
+
+ class EStatusFailedException extends EException{
+ private static final long serialVersionUID = 107L;
+ public EStatusFailedException(int t,long timep) {
+ super(107,t,timep);
+ }
+ } \ No newline at end of file
diff --git a/client/Piztor/src/com/macaroon/piztor/Infomation.java b/client/Piztor/src/com/macaroon/piztor/Infomation.java
index 603819e..60eb03f 100644
--- a/client/Piztor/src/com/macaroon/piztor/Infomation.java
+++ b/client/Piztor/src/com/macaroon/piztor/Infomation.java
@@ -1,11 +1,15 @@
package com.macaroon.piztor;
+import java.util.Vector;
+
public class Infomation {
- static String ip = "192.168.1.171";
+ static String ip = "202.120.7.4";
+ //static String ip = "192.168.1.171";
// static String ip = "69.85.86.42";
// static String ip = "192.168.1.101";
- static int port = 2222;
+ static int port = 2223;
static String token = null;
static String username = null;
static UserInfo myInfo;
+ static Vector<RGroup> sublist;
}
diff --git a/client/Piztor/src/com/macaroon/piztor/InitAct.java b/client/Piztor/src/com/macaroon/piztor/InitAct.java
index 272afe7..8145935 100644
--- a/client/Piztor/src/com/macaroon/piztor/InitAct.java
+++ b/client/Piztor/src/com/macaroon/piztor/InitAct.java
@@ -2,23 +2,16 @@ package com.macaroon.piztor;
import android.os.Bundle;
import android.view.Menu;
-import android.content.Context;
public class InitAct extends PiztorAct {
- private CopyMap copyMap;
- private String assetDir;
- private String dir;
-
@Override
protected void onCreate(Bundle savedInstanceState) {
id = "initAct";
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_init);
- copyMap = new CopyMap();
- copyMap.testCopy(InitAct.this);
AppMgr.init(getApplicationContext());
AppMgr.transam.setTimeOutTime(5000);
+ setContentView(R.layout.activity_init);
}
@Override
diff --git a/client/Piztor/src/com/macaroon/piztor/LogInfo.java b/client/Piztor/src/com/macaroon/piztor/LogInfo.java
new file mode 100644
index 0000000..2fd93ac
--- /dev/null
+++ b/client/Piztor/src/com/macaroon/piztor/LogInfo.java
@@ -0,0 +1,12 @@
+package com.macaroon.piztor;
+
+public class LogInfo {
+ static String login = "login";
+ static String logout = "logout";
+ static String update = "update";
+ static String resquest = "resquest";
+ static String push = "push";
+ static String exception = "exception";
+ static String s = "successfull";
+ static String f = "failed";
+}
diff --git a/client/Piztor/src/com/macaroon/piztor/Login.java b/client/Piztor/src/com/macaroon/piztor/Login.java
index a1a6d0d..533eeac 100644
--- a/client/Piztor/src/com/macaroon/piztor/Login.java
+++ b/client/Piztor/src/com/macaroon/piztor/Login.java
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
+import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;
@@ -30,20 +31,19 @@ public class Login extends PiztorAct {
}
if (m.what == 0) {
ResLogin res = (ResLogin) m.obj;
- if (res.status == 1) {
- actMgr.trigger(loginFailed);
- return;
- }
+ Log.d(LogInfo.login, LogInfo.s);
Infomation.token = res.t;
- Infomation.myInfo.uid = res.uid;
- Infomation.username = edtUser.getText().toString();
- System.out.println(res.status + " :!!! " + res.type);
+ Infomation.sublist = res.sublist;
+ Infomation.username = res.uinfo.username;
+ Infomation.myInfo = new UserInfo(res.uinfo.uid);
+ Infomation.myInfo.setInfo(res.uinfo.gid.company,
+ res.uinfo.gid.section, res.uinfo.sex,
+ res.uinfo.nickname);
+ System.out.println("login !!!!" + res.sublist.size());
actMgr.trigger(AppMgr.loginSuccess);
- System.out.println("............");
} else {
- System.out.println("reveive other info ~~~~~~~~~~~~~~" + m.what);
-// System.out.println("login de " + m.what);
-// actMgr.trigger(loginFailed);
+ System.out.println("login handler reveive other info : "
+ + m.what);
}
}
};
@@ -113,7 +113,10 @@ public class Login extends PiztorAct {
@Override
protected void onResume() {
super.onResume();
- AppMgr.transam.setHandler(handler);
+ if (AppMgr.transam == null)
+ Log.d(LogInfo.exception, "transam = null");
+ AppMgr.transam.setHandler(handler);
+
}
@Override
diff --git a/client/Piztor/src/com/macaroon/piztor/Main.java b/client/Piztor/src/com/macaroon/piztor/Main.java
index 1e46003..623595b 100644
--- a/client/Piztor/src/com/macaroon/piztor/Main.java
+++ b/client/Piztor/src/com/macaroon/piztor/Main.java
@@ -1,8 +1,6 @@
package com.macaroon.piztor;
import java.util.Calendar;
-import java.util.Timer;
-import java.util.TimerTask;
import java.util.Vector;
import android.annotation.SuppressLint;
@@ -39,14 +37,13 @@ public class Main extends PiztorAct {
final static int FailedFetch = 5;
final static int mapViewtouched = 7;
-
MapMaker mapMaker = null;
MapView mMapView;
AlertMaker alertMaker;
private Calendar calendar;
GeoPoint markerPoint = null;
private MKMapTouchListener mapTouchListener;
-
+
/**
* Locating component
*/
@@ -56,100 +53,67 @@ public class Main extends PiztorAct {
LocationData locData = null;
public MyLocationListener myListener = new MyLocationListener();
boolean isFirstLocation = true;
+ public static int GPSrefreshrate = 5;
ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
MapInfo mapInfo;
+ Transam transam;
@SuppressLint("HandlerLeak")
Handler handler = new Handler() {
@Override
public void handleMessage(Message m) {
switch (m.what) {
- case 1:// 上传自己信息成功or失败
- ResUpdate update = (ResUpdate) m.obj;
- if (update.status == 0)
- System.out.println("update success");
- else {
- System.out.println("update failed");
- actMgr.trigger(AppMgr.errorToken);
- }
+ case Res.Login:// 上传自己信息成功or失败
+ Log.d("update location", "successfull");
break;
- case 2:// 得到别人的信息
- ResLocation location = (ResLocation) m.obj;
- if (location.status == 0) {
- mapInfo.clear();
- for (RLocation i : location.l) {
- System.out.println(i.id + " : " + i.latitude + " "
- + i.longitude);
- UserInfo info = new UserInfo(i.id);
- info.setLocation(i.latitude, i.longitude);
- mapInfo.addUserInfo(info);
- }
-// actMgr.trigger(SuccessFetch);
- flushMap();
- } else {
- System.out.println("resquest for location failed!");
- actMgr.trigger(AppMgr.errorToken);
- }
- break;
- case 3:// 得到用户信息
- ResUserInfo r = (ResUserInfo) m.obj;
- if (r.status == 0) {
- System.out.println("id : " + r.uid + " sex : " + r.sex
- + " group : " + r.section);
- if (r.uid == Infomation.myInfo.uid) {
- System.out.println("flush myself info!!!");
- Infomation.myInfo.section = r.section;
- Infomation.myInfo.company = r.company;
- Infomation.myInfo.sex = r.sex;
+ case Res.UserInfo:// 得到用户信息
+ ResUserInfo userInfo = (ResUserInfo) m.obj;
+ System.out.println("revieve ........" + userInfo.uinfo.size());
+ Vector<RUserInfo> uinfo = userInfo.uinfo;
+ for (RUserInfo info : uinfo) {
+ System.out.println(info.latitude + " "
+ + info.longitude);
+ UserInfo r = mapInfo.getUserInfo(info.uid);
+ if (r != null) {
+ r.setInfo(info.gid.company, info.gid.section, info.sex,
+ info.nickname);
+ r.setLocation(info.latitude, info.longitude);
} else {
- UserInfo user = mapInfo.getUserInfo(r.uid);
- if (user != null)
- user.setInfo(r.company, r.section, r.sex);
- else
- System.out.println("fuck!!!!");
+ r = new UserInfo(info.uid);
+ r.setInfo(info.gid.company, info.gid.section, info.sex,
+ info.nickname);
+ r.setLocation(info.latitude, info.longitude);
+ mapInfo.addUserInfo(r);
}
- flushMap();
- } else {
- System.out.println("reqest for userInfo must be wrong!!!");
- actMgr.trigger(AppMgr.errorToken);
- }
- break;
- case 4:// 登出
- ResLogout logout = (ResLogout) m.obj;
- if (logout.status == 0) {
- actMgr.trigger(AppMgr.logout);
- } else {
- Toast toast = Toast.makeText(getApplicationContext(),
- "logout failed", Toast.LENGTH_LONG);
- toast.show();
}
+ System.out.println("now has info number : " + mapInfo.allUsers.size());
+ flushMap();
break;
- case Transam.StartPush:
- ResStartPush startpush = (ResStartPush) m.obj;
- if (startpush.status == 1) {
- System.out.println("!!!!!!!!!!!!!jian gui le!!!!!!!!!!!!!");
- }
+ case Res.Logout:// 登出
+ actMgr.trigger(AppMgr.logout);
break;
- case Transam.PushMessage:
+ case Res.PushMessage:
ResPushMessage pushMessage = (ResPushMessage) m.obj;
receiveMessage(pushMessage.message);
break;
- case Transam.SendMessage:
- ResSendMessage resMessage = (ResSendMessage) m.obj;
- System.out.println("res message " + resMessage.status);
+ case Res.SendMessage:
+ Log.d(LogInfo.resquest, "send message successfully");
break;
- case Transam.PushLocation:
+ case Res.PushLocation:
ResPushLocation pushLocation = (ResPushLocation) m.obj;
- upDateInfo(pushLocation.l);
+ upMapInfo(pushLocation.l);
+ flushMap();
break;
+ case -1:
+ actMgr.trigger(AppMgr.logout);
default:
break;
}
}
- void upDateInfo(Vector<RLocation> l) {
- // TODO
+ void upMapInfo(Vector<RLocation> l) {
+ System.out.println("hahaha" + " " + l.size());
for (RLocation i : l) {
UserInfo info = AppMgr.mapInfo.getUserInfo(i.id);
if (info != null) {
@@ -184,18 +148,16 @@ public class Main extends PiztorAct {
if (mapMaker != null)
mapMaker.UpdateMap(AppMgr.mapInfo);
else
- System.out
- .println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+ Log.d("exception", "!!!");
}
-
+
void receiveMessage(String msg) {
System.out.println("receiveed push message!!!!!");
System.out.println(msg);
- Toast toast = Toast.makeText(getApplicationContext(),
- msg, Toast.LENGTH_LONG);
+ Toast toast = Toast.makeText(getApplicationContext(), msg,
+ Toast.LENGTH_LONG);
toast.show();
}
-
public class MyLocationListener implements BDLocationListener {
int cnt = 0;
@@ -229,7 +191,17 @@ public class Main extends PiztorAct {
hasAnimation = true;
isFirstLocation = false;
}
+ int TMP = location.getLocType();
+ if (TMP == 61) Toast.makeText(Main.this, "Piztor : Update from GPS result (" + GPSrefreshrate + "s)", 3000).show();
+ if (TMP == 161) Toast.makeText(Main.this, "Piztor : Update from Network (" + GPSrefreshrate + "s)" , 3000).show();
+ if (TMP == 65) Toast.makeText(Main.this, "Piztor : Update from Cache (" + GPSrefreshrate + "s)", 3000).show();
mapMaker.UpdateLocationOverlay(locData, hasAnimation);
+
+ LocationClientOption option = new LocationClientOption();
+ option.setOpenGps(true);
+ option.setCoorType("bd09ll");
+ option.setScanSpan(GPSrefreshrate * 1000);
+ mLocClient.setLocOption(option);
}
@Override
@@ -248,9 +220,6 @@ public class Main extends PiztorAct {
if (e == ActMgr.Create) {
System.out.println(Infomation.token + " "
+ Infomation.username + " " + Infomation.myInfo.uid);
- AppMgr.transam.send(new ReqUserInfo(Infomation.token,
- Infomation.username, Infomation.myInfo.uid, System
- .currentTimeMillis(), 5000));
}
if (e == SuccessFetch)
flushMap();
@@ -263,74 +232,76 @@ public class Main extends PiztorAct {
}
-
- void requesLocation(int company, int section) {
- ReqLocation r = new ReqLocation(Infomation.token, Infomation.username,
- company, section, System.currentTimeMillis(), 2000);
- AppMgr.transam
- .send(new ReqSendMessage(Infomation.token, Infomation.username,
- "hahaha", System.currentTimeMillis(), 5000));
+ void requestUserInfo() {
+ for (RGroup i : Infomation.sublist) {
+ ReqUserInfo r = new ReqUserInfo(Infomation.token,
+ Infomation.username, i, System.currentTimeMillis(), 2000);
+ transam.send(r);
+ }
System.out.println("get others infomation!!!");
- AppMgr.transam.send(r);
}
void focusOn() {
mapMaker.mMapController.animateTo(Infomation.myInfo.location);
}
-
+
public void InitTouchListenr() {
mapTouchListener = new MKMapTouchListener() {
-
+
@Override
public void onMapLongClick(GeoPoint arg0) {
closeBoard(Main.this);
alertMaker.showMarkerAlert(arg0);
}
-
+
@Override
public void onMapDoubleClick(GeoPoint arg0) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void onMapClick(GeoPoint arg0) {
// TODO Auto-generated method stub
-
+
}
};
mMapView.regMapTouchListner(mapTouchListener);
}
-
+
@Override
protected void onCreate(Bundle savedInstanceState) {
id = "Main";
super.onCreate(savedInstanceState);
-
- locationManager = (LocationManager)this.getSystemService(LOCATION_SERVICE);
- isGPSEnabled = locationManager.isProviderEnabled(locationManager.GPS_PROVIDER);
-
+
+ locationManager = (LocationManager) this
+ .getSystemService(LOCATION_SERVICE);
+ isGPSEnabled = locationManager
+ .isProviderEnabled(locationManager.GPS_PROVIDER);
+ transam = AppMgr.transam;
mapInfo = AppMgr.mapInfo;
ActStatus[] r = new ActStatus[1];
ActStatus startStatus = r[0] = new StartStatus();
-// ActStatus fetchStatus = r[1] = new FetchStatus();
-// ActStatus focusStatus = r[2] = new FocusStatus();
- AppMgr.transam.setHandler(handler);
+ // ActStatus fetchStatus = r[1] = new FetchStatus();
+ // ActStatus focusStatus = r[2] = new FocusStatus();
+ if (transam == null)
+ Log.d(LogInfo.exception, "transam = null");
+ transam.setHandler(handler);
actMgr = new ActMgr(this, startStatus, r);
-// actMgr.add(startStatus, FocuseButtonPress, focusStatus);
-// actMgr.add(startStatus, Fetch, fetchStatus);
-// actMgr.add(startStatus, SuccessFetch, startStatus);
-// actMgr.add(startStatus, Fetch, startStatus);
-// actMgr.add(fetchStatus, Fetch, startStatus);
-// actMgr.add(fetchStatus, FailedFetch, startStatus);
-// actMgr.add(fetchStatus, SuccessFetch, startStatus);
-// actMgr.add(focusStatus, FocuseButtonPress, startStatus);
-// actMgr.add(focusStatus, mapViewtouched, startStatus);
-// actMgr.add(focusStatus, SuccessFetch, focusStatus);
-// actMgr.add(focusStatus, Fetch, focusStatus);
+ // actMgr.add(startStatus, FocuseButtonPress, focusStatus);
+ // actMgr.add(startStatus, Fetch, fetchStatus);
+ // actMgr.add(startStatus, SuccessFetch, startStatus);
+ // actMgr.add(startStatus, Fetch, startStatus);
+ // actMgr.add(fetchStatus, Fetch, startStatus);
+ // actMgr.add(fetchStatus, FailedFetch, startStatus);
+ // actMgr.add(fetchStatus, SuccessFetch, startStatus);
+ // actMgr.add(focusStatus, FocuseButtonPress, startStatus);
+ // actMgr.add(focusStatus, mapViewtouched, startStatus);
+ // actMgr.add(focusStatus, SuccessFetch, focusStatus);
+ // actMgr.add(focusStatus, Fetch, focusStatus);
setContentView(R.layout.activity_main);
-
+
mMapView = (MapView) findViewById(R.id.bmapView);
mapMaker = new MapMaker(mMapView, getApplicationContext());
alertMaker = new AlertMaker(Main.this, mapMaker);
@@ -345,7 +316,7 @@ public class Main extends PiztorAct {
LocationClientOption option = new LocationClientOption();
option.setOpenGps(true);
option.setCoorType("bd09ll");
- option.setScanSpan(5000);
+ option.setScanSpan(GPSrefreshrate * 1000);
mLocClient.setLocOption(option);
mLocClient.start();
mapMaker.UpdateLocationOverlay(locData, false);
@@ -354,11 +325,11 @@ public class Main extends PiztorAct {
public static void closeBoard(Context cc) {
InputMethodManager imm = (InputMethodManager) cc
.getSystemService(Context.INPUT_METHOD_SERVICE);
- if (imm.isActive())
- imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT,
- InputMethodManager.HIDE_NOT_ALWAYS);
- }
-
+ if (imm.isActive())
+ imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT,
+ InputMethodManager.HIDE_NOT_ALWAYS);
+ }
+
/*
* public boolean onTap(int index) { OverlayItem item = getItem(index);
* mCurItem = item; if () }
@@ -373,17 +344,17 @@ public class Main extends PiztorAct {
btnFetch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
- requesLocation(Infomation.myInfo.company, Infomation.myInfo.section);
+