fix: 修改依赖项

This commit is contained in:
xiaoyan-5800X 2022-12-16 15:32:43 +08:00
commit 2ec9f49272
29 changed files with 302 additions and 175 deletions

View File

@ -56,5 +56,30 @@
<option name="name" value="maven5" /> <option name="name" value="maven5" />
<option name="url" value="https://maven.google.com/" /> <option name="url" value="https://maven.google.com/" />
</remote-repository> </remote-repository>
<remote-repository>
<option name="id" value="maven4" />
<option name="name" value="maven4" />
<option name="url" value="https://maven.aliyun.com/repository/jcenter" />
</remote-repository>
<remote-repository>
<option name="id" value="maven3" />
<option name="name" value="maven3" />
<option name="url" value="https://maven.aliyun.com/repository/public" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://maven.aliyun.com/repository/google" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://maven.aliyun.com/repository/gradle-plugin" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://repo.spring.io/libs-release/" />
</remote-repository>
</component> </component>
</project> </project>

View File

@ -4,16 +4,16 @@ apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android-extensions'
android { android {
compileSdkVersion 30 compileSdkVersion 32
buildToolsVersion '29.0.2' buildToolsVersion '29.0.2'
//ndkVersion '23.0.7123448' //ndkVersion '23.0.7123448'
defaultConfig { defaultConfig {
applicationId "com.navinfo.outdoor" applicationId "com.navinfo.outdoor"
minSdkVersion 24 minSdkVersion 24
targetSdkVersion 30 targetSdkVersion 32
versionCode 38 versionCode 39
versionName "8.221207" versionName "8.221214"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
lintOptions { lintOptions {
@ -66,8 +66,8 @@ android {
//} //}
dependencies { dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"]) implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0' implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.1.0' implementation 'androidx.navigation:navigation-fragment:2.1.0'
@ -160,8 +160,8 @@ dependencies {
implementation 'cn.jzvd:jiaozivideoplayer:7.4.2' implementation 'cn.jzvd:jiaozivideoplayer:7.4.2'
// https://github.com/Hu12037102/ImageCompress // https://github.com/Hu12037102/ImageCompress
implementation 'com.github.Hu12037102:ImageCompress:2.3.0' implementation 'com.github.Hu12037102:ImageCompress:2.3.0'
//webp // //webp
implementation 'com.wanghong.webpnative:webpnative:0.1.0' // implementation 'com.wanghong.webpnative:webpnative:0.1.0'
// https://github.com/teprinciple/MailSender // https://github.com/teprinciple/MailSender
implementation 'com.teprinciple:mailsender:1.2.0' implementation 'com.teprinciple:mailsender:1.2.0'
// // https://github.com/JiongBull/jlog/blob/master/README_ZH.md // // https://github.com/JiongBull/jlog/blob/master/README_ZH.md

Binary file not shown.

View File

@ -58,27 +58,32 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.WhiteScreen" android:theme="@style/Theme.WhiteScreen"
tools:targetApi="n"> tools:targetApi="n">
<activity <!-- <activity-->
android:name=".NaviActivity" <!-- android:name=".NaviActivity"-->
android:exported="false"> <!-- android:exported="true">-->
<meta-data <!-- <meta-data-->
android:name="android.app.lib_name" <!-- android:name="android.app.lib_name"-->
android:value="" /> <!-- android:value="" />-->
</activity> <!-- </activity>-->
<activity android:name=".activity.RegardMapActivity" /> <activity android:name=".activity.RegardMapActivity"
<activity android:name=".activity.StatementActivity" /> android:exported="true"/>
<activity android:name=".activity.StatementActivity"
android:exported="true"/>
<activity <activity
android:name=".activity.PicturesActivity" android:name=".activity.PicturesActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation"
android:launchMode="singleTop" /> android:launchMode="singleTop"
android:exported="true"/>
<activity <activity
android:name=".activity.PictureActivity" android:name=".activity.PictureActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation"
android:launchMode="singleTop" /> android:launchMode="singleTop"
android:exported="true"/>
<activity <activity
android:name=".activity.PhotographActivity" android:name=".activity.PhotographActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation"
android:launchMode="singleTop" /> android:launchMode="singleTop"
android:exported="true"/>
<meta-data <meta-data
android:name="android.webkit.WebView.EnableSafeBrowsing" android:name="android.webkit.WebView.EnableSafeBrowsing"
@ -97,7 +102,8 @@
<activity <activity
android:name=".activity.MainActivity" android:name=".activity.MainActivity"
android:screenOrientation="portrait"> android:screenOrientation="portrait"
android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View File

@ -81,6 +81,8 @@ import com.navinfo.outdoor.util.GPSUtils;
import com.navinfo.outdoor.util.Geohash; import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools; import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.Gps; import com.navinfo.outdoor.util.Gps;
import com.navinfo.outdoor.util.LocationLifeCycle;
import com.navinfo.outdoor.util.MyLocation;
import com.navinfo.outdoor.util.MyTecentLocationSource; import com.navinfo.outdoor.util.MyTecentLocationSource;
import com.navinfo.outdoor.util.NaviUtils; import com.navinfo.outdoor.util.NaviUtils;
import com.navinfo.outdoor.util.PreserveUtils; import com.navinfo.outdoor.util.PreserveUtils;
@ -574,20 +576,18 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
// 在数据库中记录照片轨迹位置以及卫星颗数 // 在数据库中记录照片轨迹位置以及卫星颗数
LocationRecorder recorder = new LocationRecorder(); LocationRecorder recorder = new LocationRecorder();
recorder.setTime(Long.parseLong(file.getName())); recorder.setTime(Long.parseLong(file.getName()));
recorder.setTencentLocationX(Constant.currentLocation.getLongitude()); // 记录主定位方式
recorder.setTencentLocationY(Constant.currentLocation.getLatitude()); recorder.setTencentLocationX(LocationLifeCycle.getInstance().getMainLocation().getLongitude());
gpsLocation = GPSUtils.getInstance(AutoTakePictureActivity.this).getLocation(); recorder.setTencentLocationY(LocationLifeCycle.getInstance().getMainLocation().getLatitude());
// 记录辅助定位方式
MyLocation gpsLocation = LocationLifeCycle.getInstance().getReferenceLocation();
if (gpsLocation!=null) { if (gpsLocation!=null) {
recorder.setGpsLocationX(gpsLocation.getLongitude()); recorder.setGpsLocationX(gpsLocation.getLongitude());
recorder.setGpsLocationY(gpsLocation.getLatitude()); recorder.setGpsLocationY(gpsLocation.getLatitude());
} }
if (Constant.currentLocation.getBearing() != 0) { recorder.setBearing(LocationLifeCycle.getInstance().getMainLocation().getBearing());
recorder.setBearing(Constant.currentLocation.getBearing());
} else {
recorder.setBearing(Constant.currentLocation.getDirection());
}
recorder.setImgFileName(file.getAbsolutePath()); recorder.setImgFileName(file.getAbsolutePath());
recorder.setRssi(Constant.currentLocation.getGPSRssi()); recorder.setRssi(GPSUtils.getInstance(AutoTakePictureActivity.this).getSateliteCount());
recorder.setSatelliteCount(GPSUtils.getInstance(AutoTakePictureActivity.this).getSateliteCount()); recorder.setSatelliteCount(GPSUtils.getInstance(AutoTakePictureActivity.this).getSateliteCount());
Observable.just(recorder).observeOn(Schedulers.io()) Observable.just(recorder).observeOn(Schedulers.io())
.filter(roadMatchEntity -> roadMatchEntity!=null) .filter(roadMatchEntity -> roadMatchEntity!=null)
@ -629,9 +629,9 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
} }
}); });
} }
if (Constant.currentLocation != null) { //筛选从服务器获取到的数据 if (LocationLifeCycle.getInstance().getMainLocation() != null) { //筛选从服务器获取到的数据
// 注意此处只获取道路数据 // 注意此处只获取道路数据
tencentMarkerUtils.initNetMarkerList(AutoTakePictureActivity.this, Constant.currentLocation, tencentMap, removables, tencentMarkerUtils.initNetMarkerList(AutoTakePictureActivity.this, LocationLifeCycle.getInstance().getMainLocation(), tencentMap, removables,
"4"/*只获取道路数据*/,"0"/*只获取未领取的数据*/, removableHashMap, 50, new TencentMarkerUtils.MarkerInitCallback<JobSearchBean.BodyBean.ListBean>() { "4"/*只获取道路数据*/,"0"/*只获取未领取的数据*/, removableHashMap, 50, new TencentMarkerUtils.MarkerInitCallback<JobSearchBean.BodyBean.ListBean>() {
@Override @Override
@ -934,7 +934,7 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
return; return;
} }
// RxJava处理子线程中做后台计算路径规划 // RxJava处理子线程中做后台计算路径规划
Geometry currentGeometry = GeometryTools.createGeometry(new double[]{Constant.currentLocation.getLongitude(), Constant.currentLocation.getLatitude()}); Geometry currentGeometry = GeometryTools.createGeometry(new double[]{LocationLifeCycle.getInstance().getMainLocation().getLongitude(), LocationLifeCycle.getInstance().getMainLocation().getLatitude()});
Observable.create( Observable.create(
new ObservableOnSubscribe<RoadMatchEntity>() { new ObservableOnSubscribe<RoadMatchEntity>() {
@Override @Override
@ -983,7 +983,7 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
// 显示导航类型选择的对话框 // 显示导航类型选择的对话框
Constant.currentNaviType = nav_type; Constant.currentNaviType = nav_type;
try { try {
tencentNaviManager = NaviUtils.getInstance().searchRouteOnly(AutoTakePictureActivity.this, Constant.currentNaviType, new NaviPoi(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), new NaviPoi(endPoint.getY(), endPoint.getX()), routeSearchCallback); tencentNaviManager = NaviUtils.getInstance().searchRouteOnly(AutoTakePictureActivity.this, Constant.currentNaviType, new NaviPoi(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude()), new NaviPoi(endPoint.getY(), endPoint.getX()), routeSearchCallback);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
com.github.lazylibrary.util.ToastUtils.showToast(AutoTakePictureActivity.this, e.getMessage()); com.github.lazylibrary.util.ToastUtils.showToast(AutoTakePictureActivity.this, e.getMessage());
@ -992,7 +992,7 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
}); });
} else { } else {
// 已选择导航方式 // 已选择导航方式
tencentNaviManager = NaviUtils.getInstance().searchRouteOnly(AutoTakePictureActivity.this, Constant.currentNaviType, new NaviPoi(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), new NaviPoi(endPoint.getY(), endPoint.getX()), routeSearchCallback); tencentNaviManager = NaviUtils.getInstance().searchRouteOnly(AutoTakePictureActivity.this, Constant.currentNaviType, new NaviPoi(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude()), new NaviPoi(endPoint.getY(), endPoint.getX()), routeSearchCallback);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -1422,7 +1422,10 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
* 开始记录位置信息 * 开始记录位置信息
* */ * */
private void startRecordLocation() { private void startRecordLocation() {
handler.sendEmptyMessage(0x101); // 只有以前不记录照片此刻才需要发送新的消息开始拍摄
if (!handler.hasMessages(0x101)) {
handler.sendEmptyMessage(0x101);
}
} }
/** /**
* 停止记录位置信息 * 停止记录位置信息
@ -1451,9 +1454,9 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
setLocMarkerStyle(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER); setLocMarkerStyle(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
break; break;
case R.id.iv_location://定位: case R.id.iv_location://定位:
if (Constant.currentLocation != null) { if (LocationLifeCycle.getInstance().getMainLocation() != null) {
CameraUpdate cameraSigma = CameraUpdateFactory CameraUpdate cameraSigma = CameraUpdateFactory
.newCameraPosition(new CameraPosition(new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标地图目标经纬度 .newCameraPosition(new CameraPosition(new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude()), //中心点坐标地图目标经纬度
17, //目标缩放级别 17, //目标缩放级别
0, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0) 0, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
0)); //目标旋转角 0~360° (正北方为0) 0)); //目标旋转角 0~360° (正北方为0)
@ -1654,9 +1657,6 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
editor.putString("match-data", gson.toJson(roadMatchEntityList)); editor.putString("match-data", gson.toJson(roadMatchEntityList));
editor.commit(); editor.commit();
} }
if (gpsUtils!=null) {
gpsUtils.unRegisterAllListener();
}
if (mediaPlayer!=null) { if (mediaPlayer!=null) {
mediaPlayer.release(); mediaPlayer.release();
} }
@ -1757,16 +1757,17 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
*/ */
public void addTrackMarker() { public void addTrackMarker() {
LatLng latLng = null; LatLng latLng = null;
if (Constant.currentLocation.getGPSRssi() != 0) { latLng = new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude());
latLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()); // if (GPSUtils.getInstance(AutoTakePictureActivity.this).getSateliteCount() != 0) {
} else { // latLng = new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude());
if (gpsLocation == null) { // } else {
latLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()); // if (gpsLocation == null) {
} else { // latLng = new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude());
double[] doubles = Gps.toGCJ02Point(gpsLocation.getLatitude(), gpsLocation.getLongitude()); // } else {
latLng = new LatLng(doubles[0],doubles[1]); // double[] doubles = Gps.toGCJ02Point(gpsLocation.getLatitude(), gpsLocation.getLongitude());
} // latLng = new LatLng(doubles[0],doubles[1]);
} // }
// }
Marker marker = tencentMap.addMarker(new MarkerOptions(latLng) Marker marker = tencentMap.addMarker(new MarkerOptions(latLng)
.icon(pileDescriptor) .icon(pileDescriptor)
.alpha(0.9f) .alpha(0.9f)
@ -2069,7 +2070,7 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
bearing = getBearing(oldCurrentLocation.getX(), currentPoint.getX(), oldCurrentLocation.getY(), currentPoint.getY()); bearing = getBearing(oldCurrentLocation.getX(), currentPoint.getX(), oldCurrentLocation.getY(), currentPoint.getY());
} }
float speed = Constant.currentLocation.getSpeed();/// float speed = LocationLifeCycle.getInstance().getMainLocation().getSpeed();///
if (speed != 0) { if (speed != 0) {
speed = (speed * 3600 / 1000);//km/h speed = (speed * 3600 / 1000);//km/h
} else { } else {

View File

@ -37,7 +37,6 @@ import com.navinfo.outdoor.util.APKVersionCodeUtils;
import com.navinfo.outdoor.util.Base64; import com.navinfo.outdoor.util.Base64;
import com.navinfo.outdoor.util.Md5Util; import com.navinfo.outdoor.util.Md5Util;
import com.navinfo.outdoor.util.TimestampUtil; import com.navinfo.outdoor.util.TimestampUtil;
import com.navinfo.outdoor.util.ToastUtil;
import com.navinfo.outdoor.util.ToastUtils; import com.navinfo.outdoor.util.ToastUtils;
import com.umeng.umcrash.UMCrash; import com.umeng.umcrash.UMCrash;

View File

@ -41,9 +41,6 @@ import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder; import com.navinfo.outdoor.http.OkGoBuilder;
import com.navinfo.outdoor.http.UploadCallBack; import com.navinfo.outdoor.http.UploadCallBack;
import com.navinfo.outdoor.util.APKVersionCodeUtils; import com.navinfo.outdoor.util.APKVersionCodeUtils;
import com.navinfo.outdoor.util.Base64;
import com.navinfo.outdoor.util.Md5Util;
import com.navinfo.outdoor.util.ToastUtil;
import com.navinfo.outdoor.util.ToastUtils; import com.navinfo.outdoor.util.ToastUtils;

View File

@ -33,6 +33,7 @@ import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.AWMp4ParserHelper; import com.navinfo.outdoor.util.AWMp4ParserHelper;
import com.navinfo.outdoor.util.Geohash; import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools; import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.LocationLifeCycle;
import com.navinfo.outdoor.util.MyTecentLocationSource; import com.navinfo.outdoor.util.MyTecentLocationSource;
import com.navinfo.outdoor.util.ToastUtils; import com.navinfo.outdoor.util.ToastUtils;
import com.otaliastudios.cameraview.CameraException; import com.otaliastudios.cameraview.CameraException;
@ -476,10 +477,10 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
tencentMap.animateCamera(cameraUpdateOut); tencentMap.animateCamera(cameraUpdateOut);
break; break;
case R.id.iv_location://定位: case R.id.iv_location://定位:
if (Constant.currentLocation != null) { if (LocationLifeCycle.getInstance().getMainLocation() != null) {
CameraUpdate cameraSigma = CameraUpdate cameraSigma =
CameraUpdateFactory.newCameraPosition(new CameraPosition( CameraUpdateFactory.newCameraPosition(new CameraPosition(
new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标地图目标经纬度 new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude()), //中心点坐标地图目标经纬度
tencentMap.getCameraPosition().zoom, //目标缩放级别 tencentMap.getCameraPosition().zoom, //目标缩放级别
0, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0) 0, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
0)); //目标旋转角 0~360° (正北方为0) 0)); //目标旋转角 0~360° (正北方为0)
@ -722,17 +723,17 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
sb.append(","); sb.append(",");
sb.append(currentVideoTime);// 记录视频时间 sb.append(currentVideoTime);// 记录视频时间
sb.append(","); sb.append(",");
sb.append(Constant.currentLocation.getLatitude()); sb.append(LocationLifeCycle.getInstance().getMainLocation().getLatitude());
sb.append(","); sb.append(",");
sb.append(Constant.currentLocation.getLongitude()); sb.append(LocationLifeCycle.getInstance().getMainLocation().getLongitude());
sb.append(","); sb.append(",");
if (Constant.currentLocation.getBearing() != 0) { if (LocationLifeCycle.getInstance().getTencentLocation().getBearing() != 0) {
sb.append(Constant.currentLocation.getBearing()); sb.append(LocationLifeCycle.getInstance().getMainLocation().getBearing());
} else { } else {
sb.append(Constant.currentLocation.getDirection()); sb.append(LocationLifeCycle.getInstance().getTencentLocation().getDirection());
} }
sb.append("\r\n"); sb.append("\r\n");
LatLng latLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()); LatLng latLng = new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude());
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.circle); BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.circle);
Marker marker = tencentMap.addMarker(new MarkerOptions(latLng) Marker marker = tencentMap.addMarker(new MarkerOptions(latLng)
.icon(pileDescriptor) .icon(pileDescriptor)

View File

@ -50,6 +50,8 @@ import com.navinfo.outdoor.util.GPSUtils;
import com.navinfo.outdoor.util.Geohash; import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools; import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.Gps; import com.navinfo.outdoor.util.Gps;
import com.navinfo.outdoor.util.LocationLifeCycle;
import com.navinfo.outdoor.util.MyLocation;
import com.navinfo.outdoor.util.MyTecentLocationSource; import com.navinfo.outdoor.util.MyTecentLocationSource;
import com.navinfo.outdoor.util.SystemTTS; import com.navinfo.outdoor.util.SystemTTS;
import com.navinfo.outdoor.util.TimestampUtil; import com.navinfo.outdoor.util.TimestampUtil;
@ -137,14 +139,13 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
private CheckBox capturePicture; //拍照 private CheckBox capturePicture; //拍照
private File paperFile, logFile; private File paperFile, logFile;
private ImageView ivZoomAdd, ivZoomDel, ivLocation, ivPicRoadImage, ivPicVideoImage, imageView; private ImageView ivZoomAdd, ivZoomDel, ivLocation, ivPicRoadImage, ivPicVideoImage, imageView;
private TencentLocation oldCurrentLocation = null; private MyLocation oldCurrentLocation = null;
private Timer timer; private Timer timer;
private TimerTask timerTask; private TimerTask timerTask;
private SystemTTS systemTTS; private SystemTTS systemTTS;
private StringBuilder picturesBuilder; private StringBuilder picturesBuilder;
private LatLng startLatLine, endLatLine; private LatLng startLatLine, endLatLine;
private TextView tvTitle, tvConvert/*照片已转换为webp的张数*/; private TextView tvTitle, tvConvert/*照片已转换为webp的张数*/;
private Location gpsLocation;
private boolean isMapSlide = false; private boolean isMapSlide = false;
private boolean isOration = true; // 当前是否为自动拍照模式 private boolean isOration = true; // 当前是否为自动拍照模式
private boolean isTerminus = false; private boolean isTerminus = false;
@ -685,9 +686,9 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
break; break;
case R.id.iv_location://定位: case R.id.iv_location://定位:
picturesBuilder.append(TimestampUtil.time()).append(",").append("onClick 点击了定位 ,"); picturesBuilder.append(TimestampUtil.time()).append(",").append("onClick 点击了定位 ,");
if (Constant.currentLocation != null) { if (LocationLifeCycle.getInstance().getMainLocation() != null) {
CameraUpdate cameraSigma = CameraUpdateFactory CameraUpdate cameraSigma = CameraUpdateFactory
.newCameraPosition(new CameraPosition(new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标地图目标经纬度 .newCameraPosition(new CameraPosition(new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude()), //中心点坐标地图目标经纬度
17, //目标缩放级别 17, //目标缩放级别
0, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0) 0, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
0)); //目标旋转角 0~360° (正北方为0) 0)); //目标旋转角 0~360° (正北方为0)
@ -932,33 +933,29 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
sb.append(index == -1 ? 0 : index);//個數 sb.append(index == -1 ? 0 : index);//個數
startVideoIndex = index == -1 ? 0 : index; startVideoIndex = index == -1 ? 0 : index;
sb.append(","); sb.append(",");
sb.append(Constant.currentLocation.getLatitude()); sb.append(LocationLifeCycle.getInstance().getMainLocation().getLatitude());
sb.append(","); sb.append(",");
sb.append(Constant.currentLocation.getLongitude()); sb.append(LocationLifeCycle.getInstance().getMainLocation().getLongitude());
sb.append(","); sb.append(",");
if (Constant.currentLocation.getBearing() != 0) { sb.append(LocationLifeCycle.getInstance().getMainLocation().getBearing());
sb.append(Constant.currentLocation.getBearing());
} else {
sb.append(Constant.currentLocation.getDirection());
}
sb.append(","); sb.append(",");
int gpsRssi = Constant.currentLocation.getGPSRssi(); int gpsRssi = GPSUtils.getInstance(PicturesActivity.this).getSateliteCount();
if (gpsRssi == 0) { if (gpsRssi == 0) {
sb.append("无信号"); sb.append("无信号");
sb.append(","); sb.append(",");
} else if (gpsRssi == 1) { } else if (gpsRssi <= 3) {
sb.append(""); sb.append("");
sb.append(","); sb.append(",");
} else if (gpsRssi == 2) { } else if (gpsRssi <= 8) {
sb.append(""); sb.append("");
sb.append(","); sb.append(",");
} else if (gpsRssi == 3) { } else {
sb.append(""); sb.append("");
sb.append(","); sb.append(",");
} }
sb.append(GPSUtils.getInstance(PicturesActivity.this).getSateliteCount()); sb.append(GPSUtils.getInstance(PicturesActivity.this).getSateliteCount());
sb.append(","); sb.append(",");
gpsLocation = GPSUtils.getInstance(PicturesActivity.this).getLocation(); MyLocation gpsLocation = LocationLifeCycle.getInstance().getReferenceLocation();
if (gpsLocation != null) { if (gpsLocation != null) {
// double[] doubles = Gps.toGCJ02Point(gpsLocation.getLatitude(), gpsLocation.getLongitude()); // double[] doubles = Gps.toGCJ02Point(gpsLocation.getLatitude(), gpsLocation.getLongitude());
sb.append(gpsLocation.getLatitude()); sb.append(gpsLocation.getLatitude());
@ -983,9 +980,9 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
} }
private void initTerminus() { private void initTerminus() {
if (Constant.currentLocation != null) { if (LocationLifeCycle.getInstance().getMainLocation() != null) {
if (endLatLine != null && startLatLine != null) { if (endLatLine != null && startLatLine != null) {
LatLng newLatLine = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()); LatLng newLatLine = new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude());
double startDistance = GeometryTools.distanceToDouble(newLatLine, startLatLine); double startDistance = GeometryTools.distanceToDouble(newLatLine, startLatLine);
double endDistance = GeometryTools.distanceToDouble(newLatLine, endLatLine); double endDistance = GeometryTools.distanceToDouble(newLatLine, endLatLine);
if (startDistance > endDistance) { //endDistance: 起点 startDistance:终点 if (startDistance > endDistance) { //endDistance: 起点 startDistance:终点
@ -1008,7 +1005,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
if (isSpeedLimitTips == true) { if (isSpeedLimitTips == true) {
return; return;
} }
float speed = Constant.currentLocation.getSpeed();/// float speed = LocationLifeCycle.getInstance().getMainLocation().getSpeed();///
if (speed != 0) { if (speed != 0) {
float a = (speed * 3600 / 1000);//km/h float a = (speed * 3600 / 1000);//km/h
if (type == 3) { if (type == 3) {
@ -1027,7 +1024,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
} else { } else {
if (oldCurrentLocation != null) { if (oldCurrentLocation != null) {
LatLng startLatLng = new LatLng(oldCurrentLocation.getLatitude(), oldCurrentLocation.getLongitude());//旧的坐标 LatLng startLatLng = new LatLng(oldCurrentLocation.getLatitude(), oldCurrentLocation.getLongitude());//旧的坐标
LatLng endLatLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude());//新的坐标 LatLng endLatLng = new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude());//新的坐标
double geometry = GeometryTools.distanceToDouble(startLatLng, endLatLng);// double geometry = GeometryTools.distanceToDouble(startLatLng, endLatLng);//
if (type == 3) { if (type == 3) {
if (radioPicture == 2) { if (radioPicture == 2) {
@ -1063,7 +1060,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
} }
} }
} }
oldCurrentLocation = Constant.currentLocation; oldCurrentLocation = LocationLifeCycle.getInstance().getMainLocation();
} }
} }
@ -1134,16 +1131,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
*/ */
public void initMarker(boolean isOration) { public void initMarker(boolean isOration) {
LatLng latLng = null; LatLng latLng = null;
if (isOration) { latLng = new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude());
latLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude());
} else {
if (gpsLocation == null) {
latLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude());
} else {
double[] doubles = Gps.toGCJ02Point(gpsLocation.getLatitude(), gpsLocation.getLongitude());
latLng = new LatLng(doubles[0],doubles[1]);
}
}
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory BitmapDescriptor pileDescriptor = BitmapDescriptorFactory
.fromResource(R.drawable.circle); .fromResource(R.drawable.circle);
Marker marker = tencentMap.addMarker(new MarkerOptions(latLng) Marker marker = tencentMap.addMarker(new MarkerOptions(latLng)

View File

@ -231,14 +231,13 @@ public class Constant {
public static String getRssiDesStr(int rssi) { public static String getRssiDesStr(int rssi) {
if (rssi == 0) { if (rssi == 0) {
return "无信号"; return "无信号";
} else if (rssi == 1) { } else if (rssi <= 3) {
return ""; return "";
} else if (rssi == 2) { } else if (rssi <= 8) {
return ""; return "";
} else if (rssi == 3) { } else {
return ""; return "";
} }
return "无信号"; // 默认为无信号
} }
public static Set<String> submitIdSet = new HashSet<>(); public static Set<String> submitIdSet = new HashSet<>();

View File

@ -13,6 +13,7 @@ import androidx.annotation.NonNull;
import com.navinfo.outdoor.api.Constant; import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.room.ChargingPileEntity; import com.navinfo.outdoor.room.ChargingPileEntity;
import com.navinfo.outdoor.room.PoiEntity; import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.LocationLifeCycle;
import com.navinfo.outdoor.util.MapManager; import com.navinfo.outdoor.util.MapManager;
import com.sothree.slidinguppanel.SlidingUpPanelLayout; import com.sothree.slidinguppanel.SlidingUpPanelLayout;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate; import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
@ -36,9 +37,9 @@ public abstract class BaseDrawerFragment extends BaseFragment {
protected void initData() { protected void initData() {
tencentMap = MapManager.getInstance().getTencentMap(); tencentMap = MapManager.getInstance().getTencentMap();
super.initData(); super.initData();
if (Constant.currentLocation!=null){ if (LocationLifeCycle.getInstance().getTencentLocation()!=null){
int mockGps = Constant.currentLocation.isMockGps(); int mockGps = LocationLifeCycle.getInstance().getTencentLocation().isMockGps();
int gpsRssi = Constant.currentLocation.getGPSRssi();//无信号信号弱信号中信号强 int gpsRssi = LocationLifeCycle.getInstance().getTencentLocation().getGPSRssi();//无信号信号弱信号中信号强
//1为是0为否-1为无法判断 //1为是0为否-1为无法判断
if (mockGps == 1) { if (mockGps == 1) {
onBackPressed(); onBackPressed();

View File

@ -61,6 +61,7 @@ import com.navinfo.outdoor.util.DataSaveUtils;
import com.navinfo.outdoor.util.FlushTokenUtil; import com.navinfo.outdoor.util.FlushTokenUtil;
import com.navinfo.outdoor.util.Geohash; import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools; import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.LocationLifeCycle;
import com.navinfo.outdoor.util.PoiSaveUtils; import com.navinfo.outdoor.util.PoiSaveUtils;
import com.navinfo.outdoor.util.PreserveUtils; import com.navinfo.outdoor.util.PreserveUtils;
import com.navinfo.outdoor.util.TimestampUtil; import com.navinfo.outdoor.util.TimestampUtil;
@ -518,8 +519,8 @@ public class AreaHubFragment extends BaseDrawerFragment implements View.OnClickL
public void onClick(View v) { public void onClick(View v) {
if (spnRoadName.getTag()!=null) { // 用户已经设置楼层信息 if (spnRoadName.getTag()!=null) { // 用户已经设置楼层信息
poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了拍摄的按钮 ,"); poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了拍摄的按钮 ,");
double latitude = Constant.currentLocation.getLatitude(); double latitude = LocationLifeCycle.getInstance().getMainLocation().getLatitude();
double longitude = Constant.currentLocation.getLongitude(); double longitude = LocationLifeCycle.getInstance().getMainLocation().getLongitude();
LatLng startLatLng = new LatLng(latitude, longitude);// 用户当前位置 LatLng startLatLng = new LatLng(latitude, longitude);// 用户当前位置
double geometry = GeometryTools.distanceToDouble(startLatLng, latLng);// 起點 于用戶的距離 double geometry = GeometryTools.distanceToDouble(startLatLng, latLng);// 起點 于用戶的距離
double rearGeometry = GeometryTools.distanceToDouble(startLatLng, rearLatLng);// 終點于用戶的距離 double rearGeometry = GeometryTools.distanceToDouble(startLatLng, rearLatLng);// 終點于用戶的距離
@ -540,7 +541,7 @@ public class AreaHubFragment extends BaseDrawerFragment implements View.OnClickL
intents.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType()); intents.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType());
intents.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt()); intents.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt());
intents.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail()); intents.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail());
int gpsRssi = Constant.currentLocation.getGPSRssi(); int gpsRssi = LocationLifeCycle.getInstance().getTencentLocation().getGPSRssi();
if (gpsRssi == 0) { if (gpsRssi == 0) {
intents.putExtra(Constant.INTENT_BOOLEAN, false); intents.putExtra(Constant.INTENT_BOOLEAN, false);
} else { } else {
@ -553,7 +554,7 @@ public class AreaHubFragment extends BaseDrawerFragment implements View.OnClickL
break; break;
case R.id.tv_combo://自动连拍: case R.id.tv_combo://自动连拍:
poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了自动连拍的按钮 ,"); poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了自动连拍的按钮 ,");
LatLng startLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()); //用户当前位置 LatLng startLng = new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude()); //用户当前位置
double geom = GeometryTools.distanceToDouble(startLng, latLng); double geom = GeometryTools.distanceToDouble(startLng, latLng);
double rearGeom = GeometryTools.distanceToDouble(startLng, rearLatLng); double rearGeom = GeometryTools.distanceToDouble(startLng, rearLatLng);
if (geom > rearGeom) {//用戶在终点开始作业 if (geom > rearGeom) {//用戶在终点开始作业
@ -573,7 +574,7 @@ public class AreaHubFragment extends BaseDrawerFragment implements View.OnClickL
intent.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType()); intent.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType());
intent.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt()); intent.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt());
intent.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail()); intent.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail());
int gpsRss = Constant.currentLocation.getGPSRssi(); int gpsRss = LocationLifeCycle.getInstance().getTencentLocation().getGPSRssi();
if (gpsRss == 0) { if (gpsRss == 0) {
intent.putExtra(Constant.INTENT_BOOLEAN, false); intent.putExtra(Constant.INTENT_BOOLEAN, false);
} else { } else {

View File

@ -56,6 +56,7 @@ import com.navinfo.outdoor.util.DataSaveUtils;
import com.navinfo.outdoor.util.FlushTokenUtil; import com.navinfo.outdoor.util.FlushTokenUtil;
import com.navinfo.outdoor.util.Geohash; import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools; import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.LocationLifeCycle;
import com.navinfo.outdoor.util.PoiSaveUtils; import com.navinfo.outdoor.util.PoiSaveUtils;
import com.navinfo.outdoor.util.PreserveUtils; import com.navinfo.outdoor.util.PreserveUtils;
import com.navinfo.outdoor.util.TimestampUtil; import com.navinfo.outdoor.util.TimestampUtil;
@ -451,8 +452,8 @@ public class BuildingInsideFragment extends BaseDrawerFragment implements View.O
break; break;
case R.id.tv_short://点击拍摄 case R.id.tv_short://点击拍摄
poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了拍摄的按钮 ,"); poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了拍摄的按钮 ,");
double latitude = Constant.currentLocation.getLatitude(); double latitude = LocationLifeCycle.getInstance().getMainLocation().getLatitude();
double longitude = Constant.currentLocation.getLongitude(); double longitude = LocationLifeCycle.getInstance().getMainLocation().getLongitude();
LatLng startLatLng = new LatLng(latitude, longitude);// 用户当前位置 LatLng startLatLng = new LatLng(latitude, longitude);// 用户当前位置
double geometry = GeometryTools.distanceToDouble(startLatLng, latLng);// 起點 于用戶的距離 double geometry = GeometryTools.distanceToDouble(startLatLng, latLng);// 起點 于用戶的距離
double rearGeometry = GeometryTools.distanceToDouble(startLatLng, rearLatLng);// 終點于用戶的距離 double rearGeometry = GeometryTools.distanceToDouble(startLatLng, rearLatLng);// 終點于用戶的距離
@ -473,7 +474,7 @@ public class BuildingInsideFragment extends BaseDrawerFragment implements View.O
intents.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType()); intents.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType());
intents.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt()); intents.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt());
intents.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail()); intents.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail());
int gpsRssi = Constant.currentLocation.getGPSRssi(); int gpsRssi = LocationLifeCycle.getInstance().getTencentLocation().getGPSRssi();
if (gpsRssi == 0) { if (gpsRssi == 0) {
intents.putExtra(Constant.INTENT_BOOLEAN, false); intents.putExtra(Constant.INTENT_BOOLEAN, false);
} else { } else {
@ -483,7 +484,7 @@ public class BuildingInsideFragment extends BaseDrawerFragment implements View.O
break; break;
case R.id.tv_combo://自动连拍: case R.id.tv_combo://自动连拍:
poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了自动连拍的按钮 ,"); poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了自动连拍的按钮 ,");
LatLng startLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()); //用户当前位置 LatLng startLng = new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude()); //用户当前位置
double geom = GeometryTools.distanceToDouble(startLng, latLng); double geom = GeometryTools.distanceToDouble(startLng, latLng);
double rearGeom = GeometryTools.distanceToDouble(startLng, rearLatLng); double rearGeom = GeometryTools.distanceToDouble(startLng, rearLatLng);
if (geom > rearGeom) {//用戶在终点开始作业 if (geom > rearGeom) {//用戶在终点开始作业
@ -503,7 +504,7 @@ public class BuildingInsideFragment extends BaseDrawerFragment implements View.O
intent.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType()); intent.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType());
intent.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt()); intent.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt());
intent.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail()); intent.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail());
int gpsRss = Constant.currentLocation.getGPSRssi(); int gpsRss = LocationLifeCycle.getInstance().getTencentLocation().getGPSRssi();
if (gpsRss == 0) { if (gpsRss == 0) {
intent.putExtra(Constant.INTENT_BOOLEAN, false); intent.putExtra(Constant.INTENT_BOOLEAN, false);
} else { } else {

View File

@ -52,7 +52,6 @@ import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools; import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.PhotoUtils; import com.navinfo.outdoor.util.PhotoUtils;
import com.navinfo.outdoor.util.TimestampUtil; import com.navinfo.outdoor.util.TimestampUtil;
import com.navinfo.outdoor.util.ToastUtil;
import com.navinfo.outdoor.util.ToastUtils; import com.navinfo.outdoor.util.ToastUtils;
import com.tencent.tencentmap.mapsdk.maps.TencentMap; import com.tencent.tencentmap.mapsdk.maps.TencentMap;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor; import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;

View File

@ -44,6 +44,7 @@ import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.FlushTokenUtil; import com.navinfo.outdoor.util.FlushTokenUtil;
import com.navinfo.outdoor.util.Geohash; import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools; import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.LocationLifeCycle;
import com.navinfo.outdoor.util.NaviUtils; import com.navinfo.outdoor.util.NaviUtils;
import com.navinfo.outdoor.util.TimestampUtil; import com.navinfo.outdoor.util.TimestampUtil;
import com.navinfo.outdoor.util.ToastUtils; import com.navinfo.outdoor.util.ToastUtils;
@ -204,12 +205,12 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
public void selectNaviType(Constant.NAV_TYPE nav_type) { public void selectNaviType(Constant.NAV_TYPE nav_type) {
// 显示导航类型选择的对话框 // 显示导航类型选择的对话框
Constant.currentNaviType = nav_type; Constant.currentNaviType = nav_type;
NaviUtils.getInstance().startNav(getActivity(), new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), new LatLng(Double.parseDouble(poiEntity.getY()), Double.parseDouble(poiEntity.getX()))); NaviUtils.getInstance().startNav(getActivity(), new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude()), new LatLng(Double.parseDouble(poiEntity.getY()), Double.parseDouble(poiEntity.getX())));
} }
}); });
} else { } else {
// 已选择导航方式 // 已选择导航方式
NaviUtils.getInstance().startNav(getActivity(), new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), new LatLng(Double.parseDouble(poiEntity.getY()), Double.parseDouble(poiEntity.getX()))); NaviUtils.getInstance().startNav(getActivity(), new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude()), new LatLng(Double.parseDouble(poiEntity.getY()), Double.parseDouble(poiEntity.getX())));
} }
} }
}); });
@ -311,8 +312,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
case R.id.btn_gather://立即采集 case R.id.btn_gather://立即采集
gatherGetBuilder.append(TimestampUtil.time()).append(",").append("点击了立即采集的按钮 ,"); gatherGetBuilder.append(TimestampUtil.time()).append(",").append("点击了立即采集的按钮 ,");
if (poiEntity.getTaskStatus() < 2) { if (poiEntity.getTaskStatus() < 2) {
double latitude = Constant.currentLocation.getLatitude(); double latitude = LocationLifeCycle.getInstance().getMainLocation().getLatitude();
double longitude = Constant.currentLocation.getLongitude(); double longitude = LocationLifeCycle.getInstance().getMainLocation().getLongitude();
LatLng startLatLng = new LatLng(latitude, longitude); //用户当前位置 LatLng startLatLng = new LatLng(latitude, longitude); //用户当前位置
LatLng endLatLng = new LatLng(Double.parseDouble(poiEntity.getY()), Double.parseDouble(poiEntity.getX())); LatLng endLatLng = new LatLng(Double.parseDouble(poiEntity.getY()), Double.parseDouble(poiEntity.getX()));
double geometry = GeometryTools.distanceToDouble(startLatLng, endLatLng); double geometry = GeometryTools.distanceToDouble(startLatLng, endLatLng);

View File

@ -34,7 +34,6 @@ import com.navinfo.outdoor.http.OkGoBuilder;
import com.navinfo.outdoor.room.PoiDatabase; import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.util.FlushTokenUtil; import com.navinfo.outdoor.util.FlushTokenUtil;
import com.navinfo.outdoor.util.TimestampUtil; import com.navinfo.outdoor.util.TimestampUtil;
import com.navinfo.outdoor.util.ToastUtil;
import com.navinfo.outdoor.util.ToastUtils; import com.navinfo.outdoor.util.ToastUtils;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;

View File

@ -31,6 +31,7 @@ import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.HttpInterface; import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder; import com.navinfo.outdoor.http.OkGoBuilder;
import com.navinfo.outdoor.util.FlushTokenUtil; import com.navinfo.outdoor.util.FlushTokenUtil;
import com.navinfo.outdoor.util.LocationLifeCycle;
import com.navinfo.outdoor.util.TimestampUtil; import com.navinfo.outdoor.util.TimestampUtil;
import com.navinfo.outdoor.util.ToastUtils; import com.navinfo.outdoor.util.ToastUtils;
import com.umeng.commonsdk.debug.D; import com.umeng.commonsdk.debug.D;
@ -139,7 +140,7 @@ public class PoiTaskFragment extends BaseFragment implements View.OnClickListene
assert getArguments() != null; assert getArguments() != null;
type = getArguments().getInt("type", 0); type = getArguments().getInt("type", 0);
listBeans = new ArrayList<>(); listBeans = new ArrayList<>();
if (Constant.currentLocation != null) { if (LocationLifeCycle.getInstance().getMainLocation() != null) {
if (Constant.USHERED != null) { if (Constant.USHERED != null) {
initWork(type, true); initWork(type, true);
} }

View File

@ -56,6 +56,7 @@ import com.navinfo.outdoor.util.DataSaveUtils;
import com.navinfo.outdoor.util.FlushTokenUtil; import com.navinfo.outdoor.util.FlushTokenUtil;
import com.navinfo.outdoor.util.Geohash; import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools; import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.LocationLifeCycle;
import com.navinfo.outdoor.util.PoiSaveUtils; import com.navinfo.outdoor.util.PoiSaveUtils;
import com.navinfo.outdoor.util.PreserveUtils; import com.navinfo.outdoor.util.PreserveUtils;
import com.navinfo.outdoor.util.TimestampUtil; import com.navinfo.outdoor.util.TimestampUtil;
@ -438,8 +439,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
break; break;
case R.id.tv_short://点击拍摄 case R.id.tv_short://点击拍摄
poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了拍摄的按钮 ,"); poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了拍摄的按钮 ,");
double latitude = Constant.currentLocation.getLatitude(); double latitude = LocationLifeCycle.getInstance().getMainLocation().getLatitude();
double longitude = Constant.currentLocation.getLongitude(); double longitude = LocationLifeCycle.getInstance().getMainLocation().getLongitude();
LatLng startLatLng = new LatLng(latitude, longitude);// 用户当前位置 LatLng startLatLng = new LatLng(latitude, longitude);// 用户当前位置
double geometry = GeometryTools.distanceToDouble(startLatLng, latLng);// 起點 于用戶的距離 double geometry = GeometryTools.distanceToDouble(startLatLng, latLng);// 起點 于用戶的距離
double rearGeometry = GeometryTools.distanceToDouble(startLatLng, rearLatLng);// 終點于用戶的距離 double rearGeometry = GeometryTools.distanceToDouble(startLatLng, rearLatLng);// 終點于用戶的距離
@ -460,7 +461,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
intents.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType()); intents.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType());
intents.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt()); intents.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt());
intents.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail()); intents.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail());
int gpsRssi = Constant.currentLocation.getGPSRssi(); int gpsRssi = LocationLifeCycle.getInstance().getTencentLocation().getGPSRssi();
if (gpsRssi == 0) { if (gpsRssi == 0) {
intents.putExtra(Constant.INTENT_BOOLEAN, false); intents.putExtra(Constant.INTENT_BOOLEAN, false);
} else { } else {
@ -470,7 +471,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
break; break;
case R.id.tv_combo://自动连拍: case R.id.tv_combo://自动连拍:
poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了自动连拍的按钮 ,"); poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了自动连拍的按钮 ,");
LatLng startLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()); //用户当前位置 LatLng startLng = new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude()); //用户当前位置
double geom = GeometryTools.distanceToDouble(startLng, latLng); double geom = GeometryTools.distanceToDouble(startLng, latLng);
double rearGeom = GeometryTools.distanceToDouble(startLng, rearLatLng); double rearGeom = GeometryTools.distanceToDouble(startLng, rearLatLng);
if (geom > rearGeom) {//用戶在终点开始作业 if (geom > rearGeom) {//用戶在终点开始作业
@ -490,7 +491,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
intent.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType()); intent.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType());
intent.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt()); intent.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt());
intent.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail()); intent.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail());
int gpsRss = Constant.currentLocation.getGPSRssi(); int gpsRss = LocationLifeCycle.getInstance().getTencentLocation().getGPSRssi();
if (gpsRss == 0) { if (gpsRss == 0) {
intent.putExtra(Constant.INTENT_BOOLEAN, false); intent.putExtra(Constant.INTENT_BOOLEAN, false);
} else { } else {
@ -837,8 +838,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
Calendar calendars = Calendar.getInstance(); Calendar calendars = Calendar.getInstance();
calendars.setTimeInMillis(System.currentTimeMillis()); calendars.setTimeInMillis(System.currentTimeMillis());
String formats = formatter.format(calendars.getTime()); String formats = formatter.format(calendars.getTime());
String city = Constant.currentLocation.getCity();//返回当前位置的城市. String city = LocationLifeCycle.getInstance().getTencentLocation().getCity();//返回当前位置的城市.
String district = Constant.currentLocation.getDistrict();//返回当前位置的区县. String district = LocationLifeCycle.getInstance().getTencentLocation().getDistrict();//返回当前位置的区县.
StringBuilder sb = new StringBuilder("poi录像上报"); StringBuilder sb = new StringBuilder("poi录像上报");
if (city != null && !"".equals(city)) { if (city != null && !"".equals(city)) {
sb.append("-"); sb.append("-");

View File

@ -46,6 +46,7 @@ import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment; import com.navinfo.outdoor.base.BaseDrawerFragment;
import com.navinfo.outdoor.util.DataSaveUtils; import com.navinfo.outdoor.util.DataSaveUtils;
import com.navinfo.outdoor.util.FlushTokenUtil; import com.navinfo.outdoor.util.FlushTokenUtil;
import com.navinfo.outdoor.util.LocationLifeCycle;
import com.navinfo.outdoor.util.PoiSaveUtils; import com.navinfo.outdoor.util.PoiSaveUtils;
import com.navinfo.outdoor.util.PreserveUtils; import com.navinfo.outdoor.util.PreserveUtils;
import com.navinfo.outdoor.util.TimestampUtil; import com.navinfo.outdoor.util.TimestampUtil;
@ -511,8 +512,8 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
break; break;
case R.id.tv_pictures: case R.id.tv_pictures:
roadBuilder.append(TimestampUtil.time()).append(",").append("点击了自动拍照的按钮 ,"); roadBuilder.append(TimestampUtil.time()).append(",").append("点击了自动拍照的按钮 ,");
double latitude = Constant.currentLocation.getLatitude(); double latitude = LocationLifeCycle.getInstance().getMainLocation().getLatitude();
double longitude = Constant.currentLocation.getLongitude(); double longitude = LocationLifeCycle.getInstance().getMainLocation().getLongitude();
LatLng startLatLng = new LatLng(latitude, longitude);//用户当前位置 LatLng startLatLng = new LatLng(latitude, longitude);//用户当前位置
double geometry = GeometryTools.distanceToDouble(startLatLng, latLng); double geometry = GeometryTools.distanceToDouble(startLatLng, latLng);
double rearGeometry = GeometryTools.distanceToDouble(startLatLng, rearLatLng); double rearGeometry = GeometryTools.distanceToDouble(startLatLng, rearLatLng);
@ -563,7 +564,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
// intent.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType()); // intent.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType());
// intent.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt()); // intent.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt());
// intent.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail()); // intent.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail());
// int gpsRssi = Constant.currentLocation.getGPSRssi(); // int gpsRssi = LocationLifeCycle.getInstance().getMainLocation().getGPSRssi();
// if (gpsRssi == 0) { // if (gpsRssi == 0) {
// intent.putExtra(Constant.INTENT_BOOLEAN, false); // intent.putExtra(Constant.INTENT_BOOLEAN, false);
// } else { // } else {
@ -581,7 +582,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
intent.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType()); intent.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType());
intent.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt()); intent.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt());
intent.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail()); intent.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail());
int gpsRssi = Constant.currentLocation.getGPSRssi(); int gpsRssi = LocationLifeCycle.getInstance().getTencentLocation().getGPSRssi();
if (gpsRssi == 0) { if (gpsRssi == 0) {
intent.putExtra(Constant.INTENT_BOOLEAN, false); intent.putExtra(Constant.INTENT_BOOLEAN, false);
} else { } else {
@ -935,8 +936,8 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
Calendar calendars = Calendar.getInstance(); Calendar calendars = Calendar.getInstance();
calendars.setTimeInMillis(System.currentTimeMillis()); calendars.setTimeInMillis(System.currentTimeMillis());
String formats = formatter.format(calendars.getTime()); String formats = formatter.format(calendars.getTime());
String city = Constant.currentLocation.getCity();//返回当前位置的城市. String city = LocationLifeCycle.getInstance().getTencentLocation().getCity();//返回当前位置的城市.
String district = Constant.currentLocation.getDistrict();//返回当前位置的区县. String district = LocationLifeCycle.getInstance().getTencentLocation().getDistrict();//返回当前位置的区县.
StringBuffer sb = new StringBuffer("道路录像上报"); StringBuffer sb = new StringBuffer("道路录像上报");
if (city != null && !"".equals(city)) { if (city != null && !"".equals(city)) {
sb.append("-"); sb.append("-");

View File

@ -40,6 +40,7 @@ import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase; import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity; import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.FlushTokenUtil; import com.navinfo.outdoor.util.FlushTokenUtil;
import com.navinfo.outdoor.util.LocationLifeCycle;
import com.navinfo.outdoor.util.PoiEntityDeleteUtil; import com.navinfo.outdoor.util.PoiEntityDeleteUtil;
import com.navinfo.outdoor.util.PoiSaveUtils; import com.navinfo.outdoor.util.PoiSaveUtils;
import com.navinfo.outdoor.util.TimestampUtil; import com.navinfo.outdoor.util.TimestampUtil;
@ -141,7 +142,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if (Constant.currentLocation != null) { if (LocationLifeCycle.getInstance().getMainLocation() != null) {
if (Constant.USHERED != null) { if (Constant.USHERED != null) {
cbSelect.setChecked(false); cbSelect.setChecked(false);
refreshData(); refreshData();
@ -180,7 +181,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
public void onEvent(Message data) { public void onEvent(Message data) {
if (data.what == Constant.STAY_SUBMIT_ITEM) { if (data.what == Constant.STAY_SUBMIT_ITEM) {
if ((boolean) data.obj) { if ((boolean) data.obj) {
if (Constant.currentLocation != null) { if (LocationLifeCycle.getInstance().getMainLocation() != null) {
if (Constant.USHERED != null) { if (Constant.USHERED != null) {
if (cbSelect != null) { if (cbSelect != null) {
cbSelect.setChecked(false); cbSelect.setChecked(false);

View File

@ -56,6 +56,7 @@ import com.navinfo.outdoor.util.DataSaveUtils;
import com.navinfo.outdoor.util.FlushTokenUtil; import com.navinfo.outdoor.util.FlushTokenUtil;
import com.navinfo.outdoor.util.Geohash; import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools; import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.LocationLifeCycle;
import com.navinfo.outdoor.util.PoiSaveUtils; import com.navinfo.outdoor.util.PoiSaveUtils;
import com.navinfo.outdoor.util.PreserveUtils; import com.navinfo.outdoor.util.PreserveUtils;
import com.navinfo.outdoor.util.TimestampUtil; import com.navinfo.outdoor.util.TimestampUtil;
@ -451,8 +452,8 @@ public class TrafficHubFragment extends BaseDrawerFragment implements View.OnCli
break; break;
case R.id.tv_short://点击拍摄 case R.id.tv_short://点击拍摄
poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了拍摄的按钮 ,"); poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了拍摄的按钮 ,");
double latitude = Constant.currentLocation.getLatitude(); double latitude = LocationLifeCycle.getInstance().getMainLocation().getLatitude();
double longitude = Constant.currentLocation.getLongitude(); double longitude = LocationLifeCycle.getInstance().getMainLocation().getLongitude();
LatLng startLatLng = new LatLng(latitude, longitude);// 用户当前位置 LatLng startLatLng = new LatLng(latitude, longitude);// 用户当前位置
double geometry = GeometryTools.distanceToDouble(startLatLng, latLng);// 起點 于用戶的距離 double geometry = GeometryTools.distanceToDouble(startLatLng, latLng);// 起點 于用戶的距離
double rearGeometry = GeometryTools.distanceToDouble(startLatLng, rearLatLng);// 終點于用戶的距離 double rearGeometry = GeometryTools.distanceToDouble(startLatLng, rearLatLng);// 終點于用戶的距離
@ -473,7 +474,7 @@ public class TrafficHubFragment extends BaseDrawerFragment implements View.OnCli
intents.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType()); intents.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType());
intents.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt()); intents.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt());
intents.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail()); intents.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail());
int gpsRssi = Constant.currentLocation.getGPSRssi(); int gpsRssi = LocationLifeCycle.getInstance().getTencentLocation().getGPSRssi();
if (gpsRssi == 0) { if (gpsRssi == 0) {
intents.putExtra(Constant.INTENT_BOOLEAN, false); intents.putExtra(Constant.INTENT_BOOLEAN, false);
} else { } else {
@ -483,7 +484,7 @@ public class TrafficHubFragment extends BaseDrawerFragment implements View.OnCli
break; break;
case R.id.tv_combo://自动连拍: case R.id.tv_combo://自动连拍:
poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了自动连拍的按钮 ,"); poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了自动连拍的按钮 ,");
LatLng startLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()); //用户当前位置 LatLng startLng = new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude()); //用户当前位置
double geom = GeometryTools.distanceToDouble(startLng, latLng); double geom = GeometryTools.distanceToDouble(startLng, latLng);
double rearGeom = GeometryTools.distanceToDouble(startLng, rearLatLng); double rearGeom = GeometryTools.distanceToDouble(startLng, rearLatLng);
if (geom > rearGeom) {//用戶在终点开始作业 if (geom > rearGeom) {//用戶在终点开始作业
@ -503,7 +504,7 @@ public class TrafficHubFragment extends BaseDrawerFragment implements View.OnCli
intent.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType()); intent.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType());
intent.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt()); intent.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt());
intent.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail()); intent.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail());
int gpsRss = Constant.currentLocation.getGPSRssi(); int gpsRss = LocationLifeCycle.getInstance().getTencentLocation().getGPSRssi();
if (gpsRss == 0) { if (gpsRss == 0) {
intent.putExtra(Constant.INTENT_BOOLEAN, false); intent.putExtra(Constant.INTENT_BOOLEAN, false);
} else { } else {

View File

@ -20,12 +20,15 @@ import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.EditText; import android.widget.EditText;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -81,6 +84,7 @@ import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.FlushTokenUtil; import com.navinfo.outdoor.util.FlushTokenUtil;
import com.navinfo.outdoor.util.Geohash; import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools; import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.LocationLifeCycle;
import com.navinfo.outdoor.util.MapManager; import com.navinfo.outdoor.util.MapManager;
import com.navinfo.outdoor.util.MyTecentLocationSource; import com.navinfo.outdoor.util.MyTecentLocationSource;
import com.navinfo.outdoor.util.NaviUtils; import com.navinfo.outdoor.util.NaviUtils;
@ -169,6 +173,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
private File logFile; private File logFile;
private StringBuilder treasureBuilder; private StringBuilder treasureBuilder;
private Marker gatherMarker; private Marker gatherMarker;
private long lastClickTime = 0;
private int settingHookClickCount = 1;
private Handler handler = new Handler(new Handler.Callback() { private Handler handler = new Handler(new Handler.Callback() {
@Override @Override
public boolean handleMessage(@NonNull Message msg) { public boolean handleMessage(@NonNull Message msg) {
@ -268,11 +274,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
tencentMap.addOnMapLoadedCallback(new TencentMap.OnMapLoadedCallback() { tencentMap.addOnMapLoadedCallback(new TencentMap.OnMapLoadedCallback() {
@Override @Override
public void onMapLoaded() { public void onMapLoaded() {
if (Constant.currentLocation != null) { if (LocationLifeCycle.getInstance().getMainLocation() != null) {
// 地图中心点位置设置为当前用户所在位置 // 地图中心点位置设置为当前用户所在位置
CameraUpdate cameraSigma = CameraUpdate cameraSigma =
CameraUpdateFactory.newCameraPosition(new CameraPosition( CameraUpdateFactory.newCameraPosition(new CameraPosition(
new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标地图目标经纬度 new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude()), //中心点坐标地图目标经纬度
17, //目标缩放级别 17, //目标缩放级别
0, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0) 0, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
0)); //目标旋转角 0~360° (正北方为0) 0)); //目标旋转角 0~360° (正北方为0)
@ -301,7 +307,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
dismissLoadingDialog(); dismissLoadingDialog();
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent); startActivity(intent);
ToastUtils.Message(getActivity(), "请先开启位置信息,重新打开程序"); ToastUtils.Message(getActivity(), "请先开启位置信息,重新打开程序");
getActivity().finish(); getActivity().finish();
} }
Constant.markerClickListener = markerClickListener; Constant.markerClickListener = markerClickListener;
@ -377,6 +383,73 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} }
} }
}); });
// 内部测试功能
ImageView imgViewSettingHook = findViewById(R.id.image_view);
imgViewSettingHook.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
View layer = findViewById(R.id.layer_visiable_setting);
if (layer.isShown()) {
return;
}
settingHookClickCount++;
if(lastClickTime > 0){
long secondClickTime = System.currentTimeMillis();//距离上次开机时间
long dtime = secondClickTime - lastClickTime;
if(dtime <800){
if (settingHookClickCount>8) {
Toast.makeText(getContext(), "打开设置功能", Toast.LENGTH_SHORT).show();
layer.setVisibility(View.VISIBLE);
} else {
if (settingHookClickCount>3) {
Toast.makeText(getContext(), "再点击"+(9-settingHookClickCount)+"下打开设置功能", Toast.LENGTH_SHORT).show();
}
}
} else{
lastClickTime = 0;
settingHookClickCount = 1;
}
}
lastClickTime = System.currentTimeMillis();
}
});
Spinner spnBaseLocation = findViewById(R.id.spn_main_location);
Spinner spnRefrenceLocation = findViewById(R.id.spn_reference_location);
ArrayAdapter arrayAdapter = new ArrayAdapter(getActivity(), android.R.layout.simple_spinner_dropdown_item, android.R.id.text1, new String[]{"GPS", "腾讯"});
spnBaseLocation.setAdapter(arrayAdapter);
spnRefrenceLocation.setAdapter(arrayAdapter);
spnBaseLocation.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
if (i == 0) {
LocationLifeCycle.getInstance().setMainLocationFrom(LocationLifeCycle.LOCATION_FROM.ORIGIN);
} else if (i==1) {
LocationLifeCycle.getInstance().setMainLocationFrom(LocationLifeCycle.LOCATION_FROM.TENCENT);
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
spnRefrenceLocation.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
if (i == 0) {
LocationLifeCycle.getInstance().setReferenceLocationFrom(LocationLifeCycle.LOCATION_FROM.ORIGIN);
} else if (i==1) {
LocationLifeCycle.getInstance().setReferenceLocationFrom(LocationLifeCycle.LOCATION_FROM.TENCENT);
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
} }
/** /**
@ -389,7 +462,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
ivNaviDistance.setSelected(false); ivNaviDistance.setSelected(false);
return; return;
} }
Geometry currentGeometry = GeometryTools.createGeometry(new double[]{Constant.currentLocation.getLongitude(), Constant.currentLocation.getLatitude()}); Geometry currentGeometry = GeometryTools.createGeometry(new double[]{LocationLifeCycle.getInstance().getMainLocation().getLongitude(), LocationLifeCycle.getInstance().getMainLocation().getLatitude()});
Removable minRemoveable = removables.stream().filter(new Predicate<Removable>() { Removable minRemoveable = removables.stream().filter(new Predicate<Removable>() {
@Override @Override
public boolean test(Removable removable) { public boolean test(Removable removable) {
@ -424,12 +497,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
public void selectNaviType(Constant.NAV_TYPE nav_type) { public void selectNaviType(Constant.NAV_TYPE nav_type) {
// 显示导航类型选择的对话框 // 显示导航类型选择的对话框
Constant.currentNaviType = nav_type; Constant.currentNaviType = nav_type;
NaviUtils.getInstance().startNav(getActivity(), new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), new LatLng(endPoint.getY(), endPoint.getX())); NaviUtils.getInstance().startNav(getActivity(), new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude()), new LatLng(endPoint.getY(), endPoint.getX()));
} }
}); });
} else { } else {
// 已选择导航方式 // 已选择导航方式
NaviUtils.getInstance().startNav(getActivity(), new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), new LatLng(endPoint.getY(), endPoint.getX())); NaviUtils.getInstance().startNav(getActivity(), new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude()), new LatLng(endPoint.getY(), endPoint.getX()));
} }
} }
@ -493,8 +566,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} }
}); });
} }
if (Constant.currentLocation != null) { //筛选从服务器获取到的数据 if (LocationLifeCycle.getInstance().getMainLocation() != null) { //筛选从服务器获取到的数据
tencentMarkerUtils.initNetMarkerList(getActivity(), Constant.currentLocation, tencentMap, removables,null, null, removableHashMap, 200, new TencentMarkerUtils.MarkerInitCallback<JobSearchBean.BodyBean.ListBean>() { tencentMarkerUtils.initNetMarkerList(getActivity(), LocationLifeCycle.getInstance().getMainLocation(), tencentMap, removables,null, null, removableHashMap, 200, new TencentMarkerUtils.MarkerInitCallback<JobSearchBean.BodyBean.ListBean>() {
@Override @Override
public void onMarkerInit(Map<String, List<Marker>> removableHashMap, List<Integer> uploadByNet, List<JobSearchBean.BodyBean.ListBean> listData) { public void onMarkerInit(Map<String, List<Marker>> removableHashMap, List<Integer> uploadByNet, List<JobSearchBean.BodyBean.ListBean> listData) {
@ -602,7 +675,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
/* 得到电话区号,电话位数*/ /* 得到电话区号,电话位数*/
private void initPhone() { private void initPhone() {
String encode = Geohash.getInstance().encode(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()); String encode = Geohash.getInstance().encode(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude());
if (encode == null) { if (encode == null) {
ToastUtils.Message(getActivity(), "没有确定经纬度"); ToastUtils.Message(getActivity(), "没有确定经纬度");
return; return;
@ -676,7 +749,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
/*上传用户位置*/ /*上传用户位置*/
private void iniUserLocation() { private void iniUserLocation() {
String encode = Geohash.getInstance().encode(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()); String encode = Geohash.getInstance().encode(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude());
HttpParams httpParams = new HttpParams(); HttpParams httpParams = new HttpParams();
if (encode != null) { if (encode != null) {
httpParams.put("geom", encode); httpParams.put("geom", encode);
@ -1280,9 +1353,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break; break;
case R.id.iv_location://定位: case R.id.iv_location://定位:
treasureBuilder.append(TimestampUtil.time()).append(",").append("点击了定位的按钮,"); treasureBuilder.append(TimestampUtil.time()).append(",").append("点击了定位的按钮,");
if (Constant.currentLocation != null) { if (LocationLifeCycle.getInstance().getMainLocation() != null) {
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition( CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()),//中心点坐标地图目标经纬度 new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude()),//中心点坐标地图目标经纬度
17,//目标缩放级别 17,//目标缩放级别
0,//目标倾斜角[0.0 ~ 45.0] (垂直地图时为0) 0,//目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
0));//目标旋转角 0~360° (正北方为0) 0));//目标旋转角 0~360° (正北方为0)
@ -1358,11 +1431,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
PoiEntity poiEntity = new PoiEntity(); PoiEntity poiEntity = new PoiEntity();
// 上报时以当前用户位置为准 // 上报时以当前用户位置为准
if (Constant.currentLocation == null) { if (LocationLifeCycle.getInstance().getMainLocation() == null) {
ToastUtils.Message(getActivity(), "无法获取当前位置请检查GPS是否打开"); ToastUtils.Message(getActivity(), "无法获取当前位置请检查GPS是否打开");
return; return;
} }
LatLng newPoiLatLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()); LatLng newPoiLatLng = new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude());
poiEntity.setX(String.valueOf(newPoiLatLng.getLongitude())); poiEntity.setX(String.valueOf(newPoiLatLng.getLongitude()));
poiEntity.setY(String.valueOf(newPoiLatLng.getLatitude())); poiEntity.setY(String.valueOf(newPoiLatLng.getLatitude()));
bundle.putSerializable("poiEntity", poiEntity); bundle.putSerializable("poiEntity", poiEntity);

View File

@ -3,8 +3,8 @@ package com.navinfo.outdoor.http;
public class HttpInterface { public class HttpInterface {
// public static final String IP = "http://172.23.138.133:9999/m4";//测试接口-IP // public static final String IP = "http://172.23.138.133:9999/m4";//测试接口-IP
public static final String IPm = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发接口-外网 public static final String IPm = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发接口-外网
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试接口-外网 public static final String IP1 = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试接口-外网
public static final String IP1 = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口 public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
public static final String USER_PATH = "/user/";//我的 public static final String USER_PATH = "/user/";//我的
public static final String MSG_LIST_PATH = "/msgList/";//发现 public static final String MSG_LIST_PATH = "/msgList/";//发现
public static final String USER_LOGIN_PATH = "/userlogin/";//登录 public static final String USER_LOGIN_PATH = "/userlogin/";//登录

View File

@ -159,6 +159,10 @@ public class LocationLifeCycle implements DefaultLifecycleObserver {
ORIGIN, TENCENT, BAIDU, AMAP ORIGIN, TENCENT, BAIDU, AMAP
} }
public TencentLocation getTencentLocation() {
return tencentLocation;
}
private boolean checkInit() throws Exception { private boolean checkInit() throws Exception {
if (this.mContext == null) { if (this.mContext == null) {
throw new Exception("LocationLifeCycle 没有初始化!"); throw new Exception("LocationLifeCycle 没有初始化!");

View File

@ -654,7 +654,7 @@ public class NaviUtils {
* 开始路径规划 * 开始路径规划
* */ * */
public void startNav(Activity mContext, LatLng startLatlng, LatLng endLatlng) { public void startNav(Activity mContext, LatLng startLatlng, LatLng endLatlng) {
if (Constant.currentLocation == null) { if (LocationLifeCycle.getInstance().getMainLocation() == null) {
ToastUtils.Message(mContext, "无法获取当前位置,请检查是否授权应用获取位置权限!"); ToastUtils.Message(mContext, "无法获取当前位置,请检查是否授权应用获取位置权限!");
return; return;
} }

View File

@ -3,6 +3,7 @@ package com.navinfo.outdoor.util;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.location.Location;
import android.os.Message; import android.os.Message;
import android.util.Log; import android.util.Log;
@ -52,7 +53,7 @@ public class TencentMarkerUtils {
* *
* @param tencentLocation location 用户当前位置 * @param tencentLocation location 用户当前位置
*/ */
public void initNetMarkerList(Activity mContext, TencentLocation tencentLocation, TencentMap tencentMap, List<Removable> removables, String taskTypeStr, String taskStatusStr, Map<String, List<Marker>> removableHashMap, int pageSize, MarkerInitCallback callback) { public void initNetMarkerList(Activity mContext, Location tencentLocation, TencentMap tencentMap, List<Removable> removables, String taskTypeStr, String taskStatusStr, Map<String, List<Marker>> removableHashMap, int pageSize, MarkerInitCallback callback) {
int task_type = Constant.TASK_TYPE; int task_type = Constant.TASK_TYPE;
if (taskTypeStr != null) { if (taskTypeStr != null) {
task_type = Integer.parseInt(taskTypeStr); task_type = Integer.parseInt(taskTypeStr);

View File

@ -175,6 +175,35 @@
android:src="@mipmap/mine_location" android:src="@mipmap/mine_location"
app:layout_constraintLeft_toLeftOf="@id/iv_refrish" app:layout_constraintLeft_toLeftOf="@id/iv_refrish"
app:layout_constraintTop_toBottomOf="@id/iv_refrish" /> app:layout_constraintTop_toBottomOf="@id/iv_refrish" />
<ImageView
android:id="@+id/image_view"
android:layout_width="60dp"
android:layout_height="50dp"
android:background="@android:color/transparent"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.4"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintWidth_default="percent"
app:layout_constraintWidth_percent="0.4" />
<LinearLayout
android:id="@+id/layer_visiable_setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintRight_toRightOf="@id/cb_map_type"
app:layout_constraintBottom_toTopOf="@id/cb_map_type">
<Spinner
android:id="@+id/spn_main_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Spinner>
<Spinner
android:id="@+id/spn_reference_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Spinner>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout> </FrameLayout>

View File

@ -3,10 +3,15 @@ buildscript {
ext.anko_version = '0.10.1'// ext.anko_version = '0.10.1'//
ext.kotlin_version = '1.5.10' ext.kotlin_version = '1.5.10'
repositories { repositories {
maven { url "https://jitpack.io" }
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
// bug // bug
maven { url 'https://repo1.maven.org/maven2/' } maven { url 'https://repo1.maven.org/maven2/' }
maven{ url 'https://maven.aliyun.com/repository/google'}
maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
maven{ url 'https://maven.aliyun.com/repository/public'}
maven{ url 'https://maven.aliyun.com/repository/jcenter'}
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
maven { url "https://jitpack.io" }
maven { url "https://repo.spring.io/libs-release/" }
// //
maven{ maven{
url "https://oss.sonatype.org/content/groups/public" url "https://oss.sonatype.org/content/groups/public"
@ -30,10 +35,15 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
maven { url "https://jitpack.io" }
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
// bug // bug
maven { url 'https://repo1.maven.org/maven2/' } maven { url 'https://repo1.maven.org/maven2/' }
maven{ url 'https://maven.aliyun.com/repository/google'}
maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
maven{ url 'https://maven.aliyun.com/repository/public'}
maven{ url 'https://maven.aliyun.com/repository/jcenter'}
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
maven { url "https://jitpack.io" }
maven { url "https://repo.spring.io/libs-release/" }
// //
maven{ maven{
url "https://oss.sonatype.org/content/groups/public" url "https://oss.sonatype.org/content/groups/public"

View File

@ -1,13 +0,0 @@
package com.jcodecraeer.xrecyclerview;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}