fix: 修改导航偏航提示
This commit is contained in:
commit
862e828c46
@ -12,8 +12,8 @@ android {
|
||||
applicationId "com.navinfo.outdoor"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 32
|
||||
versionCode 39
|
||||
versionName "8.221214"
|
||||
versionCode 40
|
||||
versionName "8.221219"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
lintOptions {
|
||||
|
@ -87,6 +87,7 @@ import com.navinfo.outdoor.util.MyTecentLocationSource;
|
||||
import com.navinfo.outdoor.util.NaviUtils;
|
||||
import com.navinfo.outdoor.util.PreserveUtils;
|
||||
import com.navinfo.outdoor.util.SystemTTS;
|
||||
import com.navinfo.outdoor.util.TencentLocationObtain;
|
||||
import com.navinfo.outdoor.util.TencentMarkerUtils;
|
||||
import com.navinfo.outdoor.util.TimestampUtil;
|
||||
import com.navinfo.outdoor.util.ToastUtils;
|
||||
@ -495,7 +496,7 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
|
||||
@Override
|
||||
public void onMapClick(LatLng latLng) {
|
||||
Message msg = handler.obtainMessage(0x105);
|
||||
msg.obj = obtainTecentLocation(latLng);
|
||||
msg.obj = TencentLocationObtain.obtainTecentLocation(latLng);
|
||||
handler.sendMessage(msg);
|
||||
}
|
||||
});
|
||||
@ -631,7 +632,7 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
|
||||
}
|
||||
if (LocationLifeCycle.getInstance().getMainLocation() != null) { //筛选从服务器获取到的数据
|
||||
// 注意,此处只获取道路数据
|
||||
tencentMarkerUtils.initNetMarkerList(AutoTakePictureActivity.this, LocationLifeCycle.getInstance().getMainLocation(), tencentMap, removables,
|
||||
tencentMarkerUtils.initNetMarkerList(AutoTakePictureActivity.this, LocationLifeCycle.getInstance().getTencentLocation(), tencentMap, removables,
|
||||
"4"/*只获取道路数据*/,"0"/*只获取未领取的数据*/, removableHashMap, 50, new TencentMarkerUtils.MarkerInitCallback<JobSearchBean.BodyBean.ListBean>() {
|
||||
|
||||
@Override
|
||||
@ -1784,204 +1785,6 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
|
||||
// window.setAttributes(lp);
|
||||
}
|
||||
|
||||
private TencentLocation obtainTecentLocation(LatLng latLng) {
|
||||
return new TencentLocation() {
|
||||
@Override
|
||||
public String getProvider() {
|
||||
return "NetWork";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFusionProvider() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSourceProvider() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLatitude() {
|
||||
return latLng.getLatitude();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLongitude() {
|
||||
return latLng.getLongitude();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAltitude() {
|
||||
return latLng.getAltitude();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAccuracy() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAddress() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNation() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProvince() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCity() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDistrict() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTown() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVillage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStreet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStreetNo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getAreaStat() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TencentPoi> getPoiList() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBearing() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSpeed() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTime() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getElapsedRealtime() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGPSRssi() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInOutStatus() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIndoorBuildingId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIndoorBuildingFloor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndoorLocationType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDirection() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCityCode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCityPhoneCode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TencentMotion getMotion() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGpsQuality() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDeltaAngle() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDeltaSpeed() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCoordinateType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeReason() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isMockGps() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bundle getExtra() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Handler handler = new Handler(new Handler.Callback() {
|
||||
@Override
|
||||
|
@ -114,9 +114,6 @@ public class HomeActivity extends BaseActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
|
||||
DialogSettings.init();
|
||||
LocationLifeCycle.getInstance().init(HomeActivity.this);
|
||||
// 注册位置更新的lifeCycle
|
||||
getLifecycle().addObserver(LocationLifeCycle.getInstance());
|
||||
if (Constant.USHERED != null) {
|
||||
Constant.initRootFolder(Constant.USHERED);
|
||||
// 检测用户是否为虚拟定位
|
||||
@ -126,7 +123,7 @@ public class HomeActivity extends BaseActivity {
|
||||
LogConfiguration logConfiguration = new LogConfiguration.Builder()
|
||||
// .enableStackTrace(5)
|
||||
.enableBorder()
|
||||
.tag("OutDoor").build();
|
||||
.tag("XLog").build();
|
||||
Printer androidPrinter = new AndroidPrinter(true); // 通过 android.util.Log 打印日志的打印器
|
||||
Printer consolePrinter = new ConsolePrinter(); // 通过 System.out 打印日志到控制台的打印器
|
||||
Printer filePrinter = new FilePrinter // 打印日志到文件的打印器
|
||||
@ -562,7 +559,5 @@ public class HomeActivity extends BaseActivity {
|
||||
PoiDatabase.destroy();
|
||||
// 清空登录信息
|
||||
Constant.clearLoginInfo();
|
||||
// 注册位置更新的lifeCycle
|
||||
getLifecycle().removeObserver(LocationLifeCycle.getInstance());
|
||||
}
|
||||
}
|
@ -1,19 +1,29 @@
|
||||
package com.navinfo.outdoor.activity;
|
||||
import androidx.lifecycle.LifecycleObserver;
|
||||
|
||||
import com.elvishew.xlog.XLog;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseActivity;
|
||||
import com.navinfo.outdoor.base.NaviLifeCycle;
|
||||
import com.navinfo.outdoor.util.NaviUtils;
|
||||
import com.navinfo.outdoor.util.TencentLocationObtain;
|
||||
import com.tencent.map.fusionlocation.model.TencentGeoLocation;
|
||||
import com.tencent.map.geolocation.TencentLocation;
|
||||
import com.tencent.map.location.api.GeoLocationObserver;
|
||||
import com.tencent.map.location.core.FusionGeoLocationAdapter;
|
||||
import com.tencent.map.navi.TencentNaviManager;
|
||||
import com.tencent.map.navi.car.CarNaviView;
|
||||
import com.tencent.map.navi.data.NaviPoi;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
public class NaviCarActivity extends BaseActivity {
|
||||
private CarNaviView carNaviView;
|
||||
private LifecycleObserver lifecycleObserver;
|
||||
private FusionGeoLocationAdapter geoAdapter;
|
||||
private GeoLocationObserver geoLocationObserver;
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
return R.layout.activity_navi_car;
|
||||
@ -34,6 +44,27 @@ public class NaviCarActivity extends BaseActivity {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// geoAdapter = FusionGeoLocationAdapter.getInstance(this);
|
||||
// // 添加定位监听
|
||||
// geoLocationObserver = new GeoLocationObserver() {
|
||||
//
|
||||
// @Override
|
||||
// public void onGeoLocationChanged(TencentGeoLocation tencentGeoLocation) {
|
||||
// // 定位数据回调
|
||||
// XLog.d("用户点击地图,模拟当前位置为"+tencentGeoLocation.toString());
|
||||
// }
|
||||
// };
|
||||
// geoAdapter.addLocationObserver(geoLocationObserver, 1000); // 定位回调频率,推荐1s
|
||||
|
||||
// // 用户点击获取位置信息
|
||||
// carNaviView.getMap().setOnMapClickListener(new TencentMap.OnMapClickListener() {
|
||||
// @Override
|
||||
// public void onMapClick(LatLng latLng) {
|
||||
// TencentLocation tencentLocation = TencentLocationObtain.obtainTecentLocation(latLng);
|
||||
// geoLocationObserver.onGeoLocationChanged(new TencentGeoLocation(tencentLocation, 0, "ok", System.currentTimeMillis()));
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -42,5 +73,7 @@ public class NaviCarActivity extends BaseActivity {
|
||||
getLifecycle().removeObserver(lifecycleObserver);
|
||||
// 如果当前正在导航,自动停止
|
||||
NaviUtils.getInstance().stopNavi();
|
||||
|
||||
// geoAdapter.removeLocationObserver(geoLocationObserver);
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ public class NaviRideActivity extends BaseActivity {
|
||||
private LifecycleObserver lifecycleObserver;
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
return R.layout.activity_navi_car;
|
||||
return R.layout.activity_navi_ride;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -29,8 +29,8 @@ public class NaviRideActivity extends BaseActivity {
|
||||
getLifecycle().addObserver(lifecycleObserver);
|
||||
TencentNaviManager naviManager = NaviUtils.getInstance().obitainnaviManager(this, Constant.currentNaviType, rideNaviView);
|
||||
// 获取起终点
|
||||
LatLng startLatlng = (LatLng) getIntent().getSerializableExtra("start");
|
||||
LatLng endLatlng = (LatLng) getIntent().getSerializableExtra("end");
|
||||
LatLng startLatlng = (LatLng) getIntent().getExtras().get("start");
|
||||
LatLng endLatlng = (LatLng) getIntent().getExtras().get("end");
|
||||
try {
|
||||
NaviUtils.getInstance().searchRoute(Constant.currentNaviType, naviManager, new NaviPoi(startLatlng.latitude, startLatlng.longitude), new NaviPoi(endLatlng.latitude, endLatlng.longitude));
|
||||
} catch (Exception e) {
|
||||
|
@ -18,7 +18,7 @@ public class NaviWalkActivity extends BaseActivity {
|
||||
private LifecycleObserver lifecycleObserver;
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
return R.layout.activity_navi_car;
|
||||
return R.layout.activity_navi_walk;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -29,8 +29,8 @@ public class NaviWalkActivity extends BaseActivity {
|
||||
getLifecycle().addObserver(lifecycleObserver);
|
||||
TencentNaviManager naviManager = NaviUtils.getInstance().obitainnaviManager(this, Constant.currentNaviType, walkNaviView);
|
||||
// 获取起终点
|
||||
LatLng startLatlng = (LatLng) getIntent().getSerializableExtra("start");
|
||||
LatLng endLatlng = (LatLng) getIntent().getSerializableExtra("end");
|
||||
LatLng startLatlng = (LatLng) getIntent().getExtras().get("start");
|
||||
LatLng endLatlng = (LatLng) getIntent().getExtras().get("end");
|
||||
try {
|
||||
NaviUtils.getInstance().searchRoute(Constant.currentNaviType, naviManager, new NaviPoi(startLatlng.latitude, startLatlng.longitude), new NaviPoi(endLatlng.latitude, endLatlng.longitude));
|
||||
} catch (Exception e) {
|
||||
|
@ -7,6 +7,9 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.StrictMode;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.ProcessLifecycleOwner;
|
||||
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.cache.CacheEntity;
|
||||
import com.lzy.okgo.cache.CacheMode;
|
||||
@ -63,6 +66,10 @@ public class UserApplication extends Application {
|
||||
config.setDeviceId(deviceID);
|
||||
// 或者设置开发者自己的的设备号config.setDeviceId(xxxxxxxx);
|
||||
TencentNavi.init(this, config);
|
||||
|
||||
LocationLifeCycle.getInstance().init(UserApplication.this);
|
||||
// 注册位置更新的lifeCycle
|
||||
ProcessLifecycleOwner.get().getLifecycle().addObserver(LocationLifeCycle.getInstance());
|
||||
}
|
||||
|
||||
public static UserApplication getUserApplication() {
|
||||
|
@ -7,6 +7,7 @@ import android.content.pm.ActivityInfo;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.provider.Settings;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
@ -30,7 +31,11 @@ import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.navinfo.outdoor.util.NetWorkUtils;
|
||||
import com.umeng.message.PushAgent;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
@ -54,6 +59,9 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
initView();
|
||||
initData();
|
||||
initListener();
|
||||
if (!EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
}
|
||||
|
||||
private static void setCustomDensity(Application application, Activity activity) {
|
||||
@ -143,6 +151,9 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
super.onDestroy();
|
||||
dismissLoadingDialog();
|
||||
Collector.removeActivity(this);
|
||||
if (EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -157,4 +168,13 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(sticky = true)
|
||||
public void onEventMainThrean(Map<String, String> data) {
|
||||
if (data.get("code") == "101") {
|
||||
// 返回开启GPS导航设置界面
|
||||
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1301,7 +1301,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("auditId", chargingPileEntity.getBodyId());
|
||||
Response execute = OkGoBuilder.getInstance()
|
||||
.time(0)
|
||||
.time(600)
|
||||
.url(HttpInterface.CS_TASK_UP_LOAD_PIC)
|
||||
.params(httpParams)
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
@ -1345,7 +1345,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("auditId", poiEntity.getBodyId());
|
||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||
.time(0)
|
||||
.time(600)
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.C_TASK_UP_LOAD_PIC)
|
||||
.cls(PoiUploadBean.class)
|
||||
|
@ -1001,7 +1001,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("auditId", body);
|
||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||
.time(0)
|
||||
.time(600)
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.POI_TASK_UPLOAD_PIC)
|
||||
.cls(OtherUploadPicBean.class)
|
||||
|
@ -274,11 +274,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
tencentMap.addOnMapLoadedCallback(new TencentMap.OnMapLoadedCallback() {
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
if (LocationLifeCycle.getInstance().getMainLocation() != null) {
|
||||
if (LocationLifeCycle.getInstance().getTencentLocation() != null) {
|
||||
// 地图中心点位置设置为当前用户所在位置
|
||||
CameraUpdate cameraSigma =
|
||||
CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude()), //中心点坐标,地图目标经纬度
|
||||
new LatLng(LocationLifeCycle.getInstance().getTencentLocation().getLatitude(), LocationLifeCycle.getInstance().getTencentLocation().getLongitude()), //中心点坐标,地图目标经纬度
|
||||
17, //目标缩放级别
|
||||
0, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
|
||||
0)); //目标旋转角 0~360° (正北方为0)
|
||||
@ -384,6 +384,20 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
});
|
||||
|
||||
ivNaviDistance.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
NaviUtils.getInstance().selectNaviType((AppCompatActivity) getActivity(), new NaviUtils.SelectNaviTypeListener() {
|
||||
@Override
|
||||
public void selectNaviType(Constant.NAV_TYPE nav_type) {
|
||||
// 显示导航类型选择的对话框
|
||||
Constant.currentNaviType = nav_type;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// 内部测试功能
|
||||
ImageView imgViewSettingHook = findViewById(R.id.image_view);
|
||||
imgViewSettingHook.setOnClickListener(new View.OnClickListener() {
|
||||
@ -419,6 +433,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
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);
|
||||
spnRefrenceLocation.setSelection(1);
|
||||
spnBaseLocation.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
@ -566,8 +581,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
});
|
||||
}
|
||||
if (LocationLifeCycle.getInstance().getMainLocation() != null) { //筛选从服务器获取到的数据
|
||||
tencentMarkerUtils.initNetMarkerList(getActivity(), LocationLifeCycle.getInstance().getMainLocation(), tencentMap, removables,null, null, removableHashMap, 200, new TencentMarkerUtils.MarkerInitCallback<JobSearchBean.BodyBean.ListBean>() {
|
||||
if (LocationLifeCycle.getInstance().getTencentLocation() != null) { //筛选从服务器获取到的数据
|
||||
tencentMarkerUtils.initNetMarkerList(getActivity(), LocationLifeCycle.getInstance().getTencentLocation(), tencentMap, removables,null, null, removableHashMap, 200, new TencentMarkerUtils.MarkerInitCallback<JobSearchBean.BodyBean.ListBean>() {
|
||||
|
||||
@Override
|
||||
public void onMarkerInit(Map<String, List<Marker>> removableHashMap, List<Integer> uploadByNet, List<JobSearchBean.BodyBean.ListBean> listData) {
|
||||
@ -675,7 +690,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
|
||||
/* 得到电话区号,电话位数*/
|
||||
private void initPhone() {
|
||||
String encode = Geohash.getInstance().encode(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude());
|
||||
String encode = Geohash.getInstance().encode(LocationLifeCycle.getInstance().getTencentLocation().getLatitude(), LocationLifeCycle.getInstance().getTencentLocation().getLongitude());
|
||||
if (encode == null) {
|
||||
ToastUtils.Message(getActivity(), "没有确定经纬度");
|
||||
return;
|
||||
@ -749,7 +764,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
|
||||
/*上传用户位置*/
|
||||
private void iniUserLocation() {
|
||||
String encode = Geohash.getInstance().encode(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude());
|
||||
String encode = Geohash.getInstance().encode(LocationLifeCycle.getInstance().getTencentLocation().getLatitude(), LocationLifeCycle.getInstance().getTencentLocation().getLongitude());
|
||||
HttpParams httpParams = new HttpParams();
|
||||
if (encode != null) {
|
||||
httpParams.put("geom", encode);
|
||||
@ -1353,9 +1368,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
break;
|
||||
case R.id.iv_location://定位:
|
||||
treasureBuilder.append(TimestampUtil.time()).append(",").append("点击了定位的按钮,");
|
||||
if (LocationLifeCycle.getInstance().getMainLocation() != null) {
|
||||
if (LocationLifeCycle.getInstance().getTencentLocation() != null) {
|
||||
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude()),//中心点坐标,地图目标经纬度
|
||||
new LatLng(LocationLifeCycle.getInstance().getTencentLocation().getLatitude(), LocationLifeCycle.getInstance().getTencentLocation().getLongitude()),//中心点坐标,地图目标经纬度
|
||||
17,//目标缩放级别
|
||||
0,//目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
|
||||
0));//目标旋转角 0~360° (正北方为0)
|
||||
@ -1431,11 +1446,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
Bundle bundle = new Bundle();
|
||||
PoiEntity poiEntity = new PoiEntity();
|
||||
// 上报时以当前用户位置为准
|
||||
if (LocationLifeCycle.getInstance().getMainLocation() == null) {
|
||||
if (LocationLifeCycle.getInstance().getTencentLocation() == null) {
|
||||
ToastUtils.Message(getActivity(), "无法获取当前位置,请检查GPS是否打开!");
|
||||
return;
|
||||
}
|
||||
LatLng newPoiLatLng = new LatLng(LocationLifeCycle.getInstance().getMainLocation().getLatitude(), LocationLifeCycle.getInstance().getMainLocation().getLongitude());
|
||||
LatLng newPoiLatLng = new LatLng(LocationLifeCycle.getInstance().getTencentLocation().getLatitude(), LocationLifeCycle.getInstance().getTencentLocation().getLongitude());
|
||||
poiEntity.setX(String.valueOf(newPoiLatLng.getLongitude()));
|
||||
poiEntity.setY(String.valueOf(newPoiLatLng.getLatitude()));
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
|
@ -3,8 +3,8 @@ package com.navinfo.outdoor.http;
|
||||
public class HttpInterface {
|
||||
// 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 IP1 = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试接口-外网
|
||||
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
|
||||
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试接口-外网
|
||||
public static final String IP1 = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
|
||||
public static final String USER_PATH = "/user/";//我的
|
||||
public static final String MSG_LIST_PATH = "/msgList/";//发现
|
||||
public static final String USER_LOGIN_PATH = "/userlogin/";//登录
|
||||
|
@ -28,9 +28,11 @@ import com.navinfo.outdoor.api.Constant;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
@ -42,29 +44,29 @@ public class GPSUtils {
|
||||
|
||||
private Location mLocation = null;
|
||||
|
||||
private Activity mContext;
|
||||
private Context mContext;
|
||||
|
||||
private static GPSUtils instance;
|
||||
|
||||
private int sateliteCount; // 卫星颗数
|
||||
|
||||
public static GPSUtils getInstance(Activity mContext) {
|
||||
public static GPSUtils getInstance(Context mContext) {
|
||||
if (instance == null) {
|
||||
instance = new GPSUtils(mContext);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private GPSUtils(Activity context) {
|
||||
private GPSUtils(Context context) {
|
||||
this.mContext = context;
|
||||
mLocationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
|
||||
// 判断GPS是否正常启动
|
||||
if (!mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
|
||||
ToastUtils.Message(context,"请开启GPS导航...");
|
||||
// 返回开启GPS导航设置界面
|
||||
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
|
||||
context.startActivityForResult(intent, 0);
|
||||
com.github.lazylibrary.util.ToastUtils.showToast(context, "请开启GPS导航...");
|
||||
Map<String, String> mapData = new HashMap<>();
|
||||
mapData.put("code", "101");
|
||||
EventBus.getDefault().post(mapData);
|
||||
return;
|
||||
}
|
||||
// 为获取地理位置信息时设置查询条件
|
||||
@ -158,6 +160,9 @@ public class GPSUtils {
|
||||
mLocationManager.removeUpdates(this);
|
||||
return;
|
||||
}
|
||||
double[] gpsLatLng = Gps.toGCJ02Point(location.getLatitude(), location.getLongitude());
|
||||
location.setLatitude(gpsLatLng[0]);
|
||||
location.setLongitude(gpsLatLng[1]);
|
||||
mLocation = location;
|
||||
Log.i(TAG, "时间:" + location.getTime());
|
||||
Log.i(TAG, "经度:" + location.getLongitude());
|
||||
|
@ -10,7 +10,10 @@ import androidx.lifecycle.DefaultLifecycleObserver;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.tencent.map.fusionlocation.model.TencentGeoLocation;
|
||||
import com.tencent.map.geolocation.TencentLocation;
|
||||
import com.tencent.map.location.api.GeoLocationObserver;
|
||||
import com.tencent.map.location.core.FusionGeoLocationAdapter;
|
||||
import com.tencent.tencentmap.mapsdk.maps.LocationSource;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@ -21,7 +24,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LocationLifeCycle implements DefaultLifecycleObserver {
|
||||
private Activity mContext;
|
||||
private Context mContext;
|
||||
private LOCATION_FROM mainLocationFrom = LOCATION_FROM.ORIGIN/*主要位置源*/, referenceLocationFrom = LOCATION_FROM.TENCENT/*参考位置源*/;
|
||||
private TencentLocation tencentLocation; // 腾讯定位获取到的最新位置信息
|
||||
private Location gpsLocation; // 原生系统获取到的最新位置
|
||||
@ -35,7 +38,7 @@ public class LocationLifeCycle implements DefaultLifecycleObserver {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void init(Activity mContext) {
|
||||
public void init(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
@ -84,6 +87,11 @@ public class LocationLifeCycle implements DefaultLifecycleObserver {
|
||||
//设置经纬度以及精度
|
||||
location.setLatitude(tencentLocation.getLatitude());
|
||||
location.setLongitude(tencentLocation.getLongitude());
|
||||
if (tencentLocation.getBearing()!=0) {
|
||||
location.setBearing(tencentLocation.getBearing());
|
||||
} else {
|
||||
location.setBearing((float) tencentLocation.getDirection());
|
||||
}
|
||||
location.setAccuracy(tencentLocation.getAccuracy());
|
||||
if (locationChangedListenerList!=null) {
|
||||
for (LocationSource.OnLocationChangedListener locationChangedListener:locationChangedListenerList) {
|
||||
@ -156,7 +164,7 @@ public class LocationLifeCycle implements DefaultLifecycleObserver {
|
||||
}
|
||||
|
||||
public enum LOCATION_FROM {
|
||||
ORIGIN, TENCENT, BAIDU, AMAP
|
||||
ORIGIN, TENCENT, SIMULATOR/*模拟定位*/, BAIDU, AMAP
|
||||
}
|
||||
|
||||
public TencentLocation getTencentLocation() {
|
||||
|
@ -12,6 +12,7 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.elvishew.xlog.XLog;
|
||||
import com.kongzue.dialog.v3.CustomDialog;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.NaviCarActivity;
|
||||
@ -60,6 +61,7 @@ public class NaviUtils {
|
||||
private Context mContext;
|
||||
private TencentMap tencentMap;
|
||||
private TencentNaviManager naviManager = null;
|
||||
private NaviTts naviTts = new NaviTts();
|
||||
public static NaviUtils getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new NaviUtils();
|
||||
@ -143,19 +145,29 @@ public class NaviUtils {
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
NaviTts naviTts = new NaviTts();
|
||||
naviTts.setText("结束导航");
|
||||
mContext.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOffRoute() {
|
||||
|
||||
// 请求重新规划路径
|
||||
XLog.d("Car已偏航");
|
||||
naviTts.setText("您已偏航,重新计算路径信息");
|
||||
// com.github.lazylibrary.util.ToastUtils.showToast(mContext, "您已偏航,重新规划路线!");
|
||||
// try {
|
||||
// NaviUtils.getInstance().reSearchRoute(naviManager, new NaviPoi(LocationLifeCycle.getInstance().getTencentLocation().getLatitude(), LocationLifeCycle.getInstance().getTencentLocation().getLongitude()));
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// com.github.lazylibrary.util.ToastUtils.showToast(mContext, "出现异常:"+e.getMessage());
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecalculateRouteSuccess(int i, ArrayList<RouteData> arrayList) {
|
||||
|
||||
XLog.d("Car重新计算路径信息", "currentLocDistance:"+LocationLifeCycle.getInstance().getTencentLocation()+","+arrayList.get(0).getRoutePoints().get(0));
|
||||
currentRouteLine = addRoutes(arrayList.get(0), tencentMap);
|
||||
zoomToRoute(mContext, arrayList.get(0), tencentMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -170,22 +182,22 @@ public class NaviUtils {
|
||||
|
||||
@Override
|
||||
public void onRecalculateSuccess(CalcRouteResult calcRouteResult) {
|
||||
|
||||
XLog.d("Car重新计算路径信息成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecalculateFailure(CalcRouteResult calcRouteResult) {
|
||||
|
||||
XLog.d("Car重新计算路径信息失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecalculateRouteStarted(int i) {
|
||||
|
||||
XLog.d("Car开始重新计算路径信息");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecalculateRouteCanceled() {
|
||||
|
||||
XLog.d("Car取消重新计算路径信息");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -240,7 +252,9 @@ public class NaviUtils {
|
||||
((TencentRideNaviManager) naviManager).addTencentNaviListener(new TencentRideNaviListener() {
|
||||
@Override
|
||||
public void onRecalculateRouteSuccess(ArrayList<RouteData> arrayList) {
|
||||
|
||||
currentRouteLine = addRoutes(arrayList.get(0), tencentMap);
|
||||
zoomToRoute(mContext, arrayList.get(0), tencentMap);
|
||||
XLog.d("RIDE重新计算路径信息", "currentLocDistance:"+LocationLifeCycle.getInstance().getTencentLocation()+","+arrayList.get(0).getRoutePoints().get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -255,14 +269,21 @@ public class NaviUtils {
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
NaviTts naviTts = new NaviTts();
|
||||
naviTts.setText("结束导航");
|
||||
mContext.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOffRoute() {
|
||||
|
||||
XLog.d("RIDE已偏航");
|
||||
naviTts.setText("您已偏航,重新计算路径信息");
|
||||
// com.github.lazylibrary.util.ToastUtils.showToast(mContext, "您已偏航,重新规划路线!");
|
||||
// try {
|
||||
// NaviUtils.getInstance().reSearchRoute(naviManager, new NaviPoi(LocationLifeCycle.getInstance().getTencentLocation().getLatitude(), LocationLifeCycle.getInstance().getTencentLocation().getLongitude()));
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// com.github.lazylibrary.util.ToastUtils.showToast(mContext, "出现异常:"+e.getMessage());
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -317,7 +338,7 @@ public class NaviUtils {
|
||||
});
|
||||
} else {
|
||||
WalkNaviView walkNaviView = (WalkNaviView) naviView;
|
||||
naviManager = new TencentRideNaviManager(mContext);
|
||||
naviManager = new TencentWalkNaviManager(mContext);
|
||||
walkNaviView.setVisibility(View.VISIBLE);
|
||||
((TencentWalkNaviManager)naviManager).addTencentNaviListener(walkNaviView);
|
||||
CarNaviInfoPanel carNaviInfoPanel = walkNaviView.showNaviInfoPanel();
|
||||
@ -332,7 +353,10 @@ public class NaviUtils {
|
||||
((TencentWalkNaviManager) naviManager).addTencentNaviListener(new TencentWalkNaviListener() {
|
||||
@Override
|
||||
public void onRecalculateRouteSuccess(ArrayList<RouteData> arrayList) {
|
||||
|
||||
XLog.d("重新计算路径信息");
|
||||
currentRouteLine = addRoutes(arrayList.get(0), tencentMap);
|
||||
zoomToRoute(mContext, arrayList.get(0), tencentMap);
|
||||
XLog.d("WALK重新计算路径信息", "currentLocDistance:"+LocationLifeCycle.getInstance().getTencentLocation()+","+arrayList.get(0).getRoutePoints().get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -347,14 +371,21 @@ public class NaviUtils {
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
NaviTts naviTts = new NaviTts();
|
||||
naviTts.setText("结束导航");
|
||||
mContext.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOffRoute() {
|
||||
|
||||
XLog.d("Walk已偏航");
|
||||
naviTts.setText("您已偏航,重新计算路径信息");
|
||||
// com.github.lazylibrary.util.ToastUtils.showToast(mContext, "您已偏航,重新规划路线!");
|
||||
// try {
|
||||
// NaviUtils.getInstance().reSearchRoute(naviManager, new NaviPoi(LocationLifeCycle.getInstance().getTencentLocation().getLatitude(), LocationLifeCycle.getInstance().getTencentLocation().getLongitude()));
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// com.github.lazylibrary.util.ToastUtils.showToast(mContext, "出现异常:"+e.getMessage());
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -379,6 +410,7 @@ public class NaviUtils {
|
||||
|
||||
@Override
|
||||
public void onUpdateNavigationData(NavigationData navigationData) {
|
||||
XLog.d("Walk更新导航信息");
|
||||
|
||||
}
|
||||
|
||||
@ -399,7 +431,7 @@ public class NaviUtils {
|
||||
|
||||
@Override
|
||||
public void onUpdateCurrentRoute(RouteData routeData) {
|
||||
|
||||
XLog.d("Walk更新当前route信息", "currentLocDistance:"+LocationLifeCycle.getInstance().getTencentLocation()+","+routeData.getRoutePoints().get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -425,22 +457,46 @@ public class NaviUtils {
|
||||
/**
|
||||
* 获取路径规划
|
||||
* */
|
||||
// private NaviPoi currentStart, currentEnd;
|
||||
// private Constant.NAV_TYPE currentNaviType;
|
||||
public void searchRoute(Constant.NAV_TYPE nav_type, TencentNaviManager naviManager,
|
||||
NaviPoi start, NaviPoi end) throws Exception {
|
||||
// currentStart = start;
|
||||
// currentEnd = end;
|
||||
// currentNaviType = nav_type;
|
||||
if (nav_type == Constant.NAV_TYPE.CAR) { // 驾车模式
|
||||
TencentCarNaviManager carNaviManager = (TencentCarNaviManager)naviManager;
|
||||
CarRouteSearchOptions options = CarRouteSearchOptions.create();
|
||||
carNaviManager.searchRoute(start, end, new ArrayList<>(), options, routeSearchCallback);
|
||||
NaviPoi newStart = new NaviPoi(start.getLatitude()-0.04, start.getLongitude());
|
||||
carNaviManager.searchRoute(newStart, end, new ArrayList<>(), options, routeSearchCallback);
|
||||
} else if (nav_type == Constant.NAV_TYPE.RIDE) { // 骑行模式
|
||||
TencentRideNaviManager rideNaviManager = (TencentRideNaviManager)naviManager;
|
||||
RideRouteSearchOptions options = RideRouteSearchOptions.create();
|
||||
rideNaviManager.searchRoute(start, end, options, routeSearchCallback);
|
||||
} else { // 步行模式
|
||||
TencentWalkNaviManager walkNaviManager = (TencentWalkNaviManager) naviManager;
|
||||
walkNaviManager.searchRoute(start, end, routeSearchCallback);
|
||||
NaviPoi newStart = new NaviPoi(start.getLatitude()-0.04, start.getLongitude());
|
||||
walkNaviManager.searchRoute(newStart, end, routeSearchCallback);
|
||||
}
|
||||
}
|
||||
|
||||
// public void reSearchRoute(TencentNaviManager naviManager,
|
||||
// NaviPoi start) throws Exception {
|
||||
// currentStart = start;
|
||||
// if (currentNaviType == Constant.NAV_TYPE.CAR) { // 驾车模式
|
||||
// TencentCarNaviManager carNaviManager = (TencentCarNaviManager)naviManager;
|
||||
// CarRouteSearchOptions options = CarRouteSearchOptions.create();
|
||||
// carNaviManager.searchRoute(start, currentEnd, new ArrayList<>(), options, routeSearchCallback);
|
||||
// } else if (currentNaviType == Constant.NAV_TYPE.RIDE) { // 骑行模式
|
||||
// TencentRideNaviManager rideNaviManager = (TencentRideNaviManager)naviManager;
|
||||
// RideRouteSearchOptions options = RideRouteSearchOptions.create();
|
||||
// rideNaviManager.searchRoute(start, currentEnd, options, routeSearchCallback);
|
||||
// } else { // 步行模式
|
||||
// TencentWalkNaviManager walkNaviManager = (TencentWalkNaviManager) naviManager;
|
||||
// walkNaviManager.searchRoute(start, currentEnd, routeSearchCallback);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 仅进行路径规划,无需导航
|
||||
* */
|
||||
@ -464,6 +520,7 @@ public class NaviUtils {
|
||||
/**
|
||||
* 算路回调
|
||||
*/
|
||||
private Polyline currentRouteLine; // 当前绘制的道路线
|
||||
private TencentRouteSearchCallback routeSearchCallback = new TencentRouteSearchCallback() {
|
||||
@Override
|
||||
public void onRouteSearchFailure(int i, String s) {
|
||||
@ -474,7 +531,7 @@ public class NaviUtils {
|
||||
@Override
|
||||
public void onRouteSearchSuccess(ArrayList<RouteData> arrayList) {
|
||||
// 添加道路Route到地图,默认选取第一条
|
||||
addRoutes(arrayList.get(0), tencentMap);
|
||||
currentRouteLine = addRoutes(arrayList.get(0), tencentMap);
|
||||
zoomToRoute(mContext, arrayList.get(0), tencentMap);
|
||||
try {
|
||||
// 自动开始导航
|
||||
@ -537,6 +594,10 @@ public class NaviUtils {
|
||||
}
|
||||
|
||||
public Polyline addRoutes(RouteData routeData, TencentMap map) {
|
||||
if (currentRouteLine!=null&&!currentRouteLine.isRemoved()) {
|
||||
currentRouteLine.remove();
|
||||
currentRouteLine = null;
|
||||
}
|
||||
ArrayList<TrafficItem> traffics = getTrafficItemsFromList(routeData.getTrafficIndexList());
|
||||
List<LatLng> mRoutePoints = routeData.getRoutePoints();
|
||||
// 点的个数
|
||||
|
@ -110,14 +110,12 @@ public class PoiSaveUtils {
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setWork_type(0);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
sendUploadMessage(poiEntityList.size(), anInt, bInt);
|
||||
}
|
||||
}else {
|
||||
bInt++;
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setWork_type(0);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
sendUploadMessage(poiEntityList.size(), anInt, bInt);
|
||||
}
|
||||
} else {
|
||||
bInt++;
|
||||
@ -125,10 +123,10 @@ public class PoiSaveUtils {
|
||||
poiEntity.setWork_type(0);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
Constant.submitIdSet.remove(poiEntity.getId());
|
||||
sendUploadMessage(poiEntityList.size(), anInt, bInt);
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
.onErrorResumeNext(Observable.empty());
|
||||
// 处理普通数据
|
||||
Observable otherObserable = Observable.fromIterable(otherPoiEntityList)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@ -143,10 +141,10 @@ public class PoiSaveUtils {
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setWork_type(0);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
sendUploadMessage(poiEntityList.size(), anInt, bInt);
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
.onErrorResumeNext(Observable.empty());
|
||||
// 处理需要分包上传数据的POI录像和道路数据
|
||||
Observable spliteFileObserable = Observable.fromIterable(spliteFilePoiEntityList)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@ -169,7 +167,6 @@ public class PoiSaveUtils {
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setWork_type(0);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
sendUploadMessage(poiEntityList.size(), anInt, bInt);
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -177,6 +174,10 @@ public class PoiSaveUtils {
|
||||
@Override
|
||||
public ObservableSource<?> apply(PoiEntity poiEntity) throws Exception {
|
||||
List<File> photoFileList = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
|
||||
if (photoFileList == null||photoFileList.isEmpty()) {
|
||||
bInt++;
|
||||
return Observable.empty();
|
||||
}
|
||||
return DataSaveUtils.getInstance().getUploadSpliteFilesObservble(mContext, poiEntity, photoFileList)
|
||||
.toObservable();
|
||||
}
|
||||
@ -192,11 +193,13 @@ public class PoiSaveUtils {
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
bInt++;
|
||||
}
|
||||
});
|
||||
})
|
||||
.onErrorResumeNext(Observable.empty());
|
||||
Observable.concat(
|
||||
otherObserable, spliteFileObserable, chargePoiObserable
|
||||
).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.onErrorResumeNext(Observable.empty())
|
||||
.subscribe(new Observer() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
@ -530,7 +533,7 @@ public class PoiSaveUtils {
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("auditId", poiEntity.getBodyId());
|
||||
Response execute = OkGoBuilder.getInstance()
|
||||
.time(0)
|
||||
.time(600)
|
||||
.Builder(mContext)
|
||||
.url(url)
|
||||
.params(httpParams)
|
||||
@ -718,7 +721,7 @@ public class PoiSaveUtils {
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("auditId", chargingPileEntity.getBodyId());
|
||||
Response execute = OkGoBuilder.getInstance()
|
||||
.time(0)
|
||||
.time(600)
|
||||
.Builder(mContext)
|
||||
.url(HttpInterface.CS_TASK_UP_LOAD_PIC)
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
|
@ -0,0 +1,211 @@
|
||||
package com.navinfo.outdoor.util;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.tencent.map.geolocation.TencentLocation;
|
||||
import com.tencent.map.geolocation.TencentMotion;
|
||||
import com.tencent.map.geolocation.TencentPoi;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TencentLocationObtain {
|
||||
public static TencentLocation obtainTecentLocation(LatLng latLng) {
|
||||
return new TencentLocation() {
|
||||
@Override
|
||||
public String getProvider() {
|
||||
return "NetWork";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFusionProvider() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSourceProvider() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLatitude() {
|
||||
return latLng.getLatitude();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLongitude() {
|
||||
return latLng.getLongitude();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAltitude() {
|
||||
return latLng.getAltitude();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAccuracy() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAddress() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNation() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProvince() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCity() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDistrict() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTown() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVillage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStreet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStreetNo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getAreaStat() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TencentPoi> getPoiList() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBearing() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSpeed() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTime() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getElapsedRealtime() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGPSRssi() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInOutStatus() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIndoorBuildingId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIndoorBuildingFloor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndoorLocationType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDirection() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCityCode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCityPhoneCode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TencentMotion getMotion() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGpsQuality() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDeltaAngle() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDeltaSpeed() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCoordinateType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeReason() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isMockGps() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bundle getExtra() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -53,7 +53,7 @@ public class TencentMarkerUtils {
|
||||
*
|
||||
* @param tencentLocation location 用户当前位置
|
||||
*/
|
||||
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) {
|
||||
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) {
|
||||
int task_type = Constant.TASK_TYPE;
|
||||
if (taskTypeStr != null) {
|
||||
task_type = Integer.parseInt(taskTypeStr);
|
||||
|
@ -525,7 +525,7 @@ public class UploadUtils {
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("auditId", chargingPileEntity.getBodyId());
|
||||
Response execute = OkGoBuilder.getInstance()
|
||||
.time(0)
|
||||
.time(600)
|
||||
.url(HttpInterface.CS_TASK_UP_LOAD_PIC)
|
||||
.params(httpParams)
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
|
@ -166,7 +166,6 @@
|
||||
android:src="@drawable/selector_navi_distance"
|
||||
android:background="@drawable/selector_round_bg"
|
||||
android:text="按距离自动导航"
|
||||
android:visibility="gone"
|
||||
android:padding="@dimen/default_widget_padding"
|
||||
android:layout_margin="@dimen/default_widget_padding"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
|
@ -23,7 +23,6 @@
|
||||
android:textSize="@dimen/pickerview_topbar_title_textsize"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:padding="@dimen/default_widget_padding"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/selector_red_bg"
|
||||
app:layout_constraintRight_toLeftOf="@id/btn_delete"
|
||||
app:layout_constraintBaseline_toBaselineOf="@id/btn_delete"
|
||||
|
@ -117,7 +117,6 @@
|
||||
android:id="@+id/img_navi_distance"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/selector_navi_distance"
|
||||
android:background="@drawable/selector_round_bg"
|
||||
android:text="按距离自动导航"
|
||||
@ -132,7 +131,6 @@
|
||||
android:src="@mipmap/auto_camera"
|
||||
android:background="@drawable/selector_round_bg"
|
||||
android:text="道路自动匹配"
|
||||
android:visibility="gone"
|
||||
android:padding="8dp"
|
||||
android:layout_marginTop="15dp"
|
||||
app:layout_constraintLeft_toLeftOf="@id/img_navi_distance"
|
||||
|
Loading…
x
Reference in New Issue
Block a user