diff --git a/app/build.gradle b/app/build.gradle index 53e9f7b..51f892e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -228,5 +228,6 @@ dependencies { implementation 'com.github.getActivity:XToast:8.2' implementation project(path: ':mylibrary') + implementation 'com.lk.mapsdk:sdk-full:2.3.7' } \ No newline at end of file diff --git a/app/libs/locationgd-androidx_2.1.0.aar b/app/libs/locationgd-androidx_2.1.0.aar index 205f699..dd5d33e 100644 Binary files a/app/libs/locationgd-androidx_2.1.0.aar and b/app/libs/locationgd-androidx_2.1.0.aar differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3d7e000..2651153 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,6 +2,7 @@ + @@ -14,6 +15,8 @@ + + @@ -66,19 +69,24 @@ android:name="com/alct/mdp" android:required="false" /> + + + + android:screenOrientation="portrait"> + android:screenOrientation="portrait" /> + android:screenOrientation="portrait" /> @@ -93,11 +101,11 @@ android:screenOrientation="portrait" /> + android:screenOrientation="portrait" + android:windowSoftInputMode="adjustPan|stateHidden" /> + android:screenOrientation="portrait" /> @@ -142,13 +150,13 @@ + android:screenOrientation="portrait" /> + android:screenOrientation="portrait" /> + android:screenOrientation="portrait" /> @@ -161,14 +169,14 @@ + android:screenOrientation="portrait" + android:windowSoftInputMode="adjustPan|stateHidden" /> + android:screenOrientation="portrait" /> + android:screenOrientation="portrait" /> + android:screenOrientation="portrait" /> + android:screenOrientation="portrait" /> @@ -203,13 +211,13 @@ + android:screenOrientation="portrait" /> + android:screenOrientation="portrait" /> + android:screenOrientation="portrait" /> + android:windowSoftInputMode="stateAlwaysHidden" /> - + @@ -362,10 +370,11 @@ + android:launchMode="singleTask" + android:screenOrientation="portrait"> + @@ -380,6 +389,12 @@ + + (); + drivingRoutePlanOptions = new DrivingRoutePlanOptions(); + // 设置开始坐标 + LocationsInfo origin = new LocationsInfo(); + origin.setLat(39.90748811582486); + origin.setLon(116.39768397709094); + // 设置结束坐标 + LocationsInfo dest = new LocationsInfo(); + dest.setLat(39.95733416663634); + dest.setLon(116.42347954147459); + locationsInfos.add(origin); + locationsInfos.add(dest); + drivingRoutePlanOptions.setLocations(locationsInfos); + AutoInfo autoInfo = new AutoInfo(); + DrivingCostingOptionsInfo drivingCostingOptionsInfo = new DrivingCostingOptionsInfo(); + drivingCostingOptionsInfo.setAuto(autoInfo); + drivingRoutePlanOptions.setDrivingCostingOptions(drivingCostingOptionsInfo); + // 实例化路线规划结果监听器 + DrivingRoutePlanListener searchListener = new DrivingRoutePlanListener(); + + DrivingRoutePlan routePlan = new DrivingRoutePlan(); + + // 发起路线规划 + routePlan.drivingRoutePlanRequest(drivingRoutePlanOptions, searchListener); + + } + + private class DrivingRoutePlanListener implements OnDrivingRoutePlanListener { + @Override + public void onGetDrivingRoutePlanResult(DrivingRoutePlanResult routePlanResult) { + // 处理检索结果 + addRoutePlanLine(routePlanResult); + addRouteMarker(); + } + } + + private DrivingRoutePlanOptions drivingRoutePlanOptions; + private List locationsInfos; + + private double startLat = 39.90748811582486; + private double startlng = 116.39768397709094; + private double endLat = 39.95733416663634; + private double endLng = 116.42347954147459; + + private List polylines = new ArrayList<>(); + private List markers = new ArrayList<>(); + + private void doSearch() { + DrivingRoutePlan search = new DrivingRoutePlan(); + + drivingRoutePlanOptions = new DrivingRoutePlanOptions(); + locationsInfos = new ArrayList<>(); + // 设置开始坐标 + LocationsInfo origin = new LocationsInfo(); + origin.setLat(startLat); + origin.setLon(startlng); + // 设置结束坐标 + LocationsInfo dest = new LocationsInfo(); + dest.setLat(endLat); + dest.setLon(endLng); + locationsInfos.add(origin); + locationsInfos.add(dest); + drivingRoutePlanOptions.setLocations(locationsInfos); + AutoInfo autoInfo = new AutoInfo(); + DrivingCostingOptionsInfo drivingCostingOptionsInfo = new DrivingCostingOptionsInfo(); + drivingCostingOptionsInfo.setAuto(autoInfo); + drivingRoutePlanOptions.setDrivingCostingOptions(drivingCostingOptionsInfo); + + search.drivingRoutePlanRequest(drivingRoutePlanOptions, new OnDrivingRoutePlanListener() { + + @Override + public void onGetDrivingRoutePlanResult(DrivingRoutePlanResult routePlanResult) { + addRoutePlanLine(routePlanResult); + addRouteMarker(); + } + }); + } + + /** + * 添加线路规划路线 + * + * @param routePlanResult + */ + private void addRoutePlanLine(DrivingRoutePlanResult routePlanResult) { + if (routePlanResult == null) { + Toast.makeText(this, "没有检索到结果", Toast.LENGTH_LONG).show(); + return; + } + + if (routePlanResult.getRouteInfos() == null || routePlanResult.getRouteInfos().isEmpty()) { + Toast.makeText(this, "没有检索到结果", Toast.LENGTH_LONG).show(); + return; + } + + List latLngs = new ArrayList<>(); + List all = new ArrayList<>(); + mLKMap.removeOverlay(polylines); + polylines.clear(); + for (int i = 0;i < routePlanResult.getRouteInfos().size();i ++){ + latLngs.clear(); + latLngs.addAll(routePlanResult.getRouteInfos().get(i).getGeometry()); + PolylineOptions options = new PolylineOptions(); + if(i == routePlanResult.getRouteInfos().size() - 1){ + options.width(8f) + .pattern(BitmapDescriptorFactory.fromResource(R.drawable.icon_roud_type)) + .joinStyle(Property.LINE_JOIN_ROUND) + .points(latLngs); + }else{ + options.width(8f) + .pattern(BitmapDescriptorFactory.fromResource(R.drawable.icon_roud_type)) + .joinStyle(Property.LINE_JOIN_ROUND) + .points(latLngs); + } + all.addAll(latLngs); + polylines.add((Polyline) mLKMap.addOverlay(options)); + } + mLKMap.setMapStatus(MapStatusUpdateFactory.buildUpdateByLatLngBounds(new LatLngBounds(all),100,100,100,100)); + } + + /** + * 添加起始点标记 + */ + private void addRouteMarker() { + mLKMap.removeOverlay(markers); + markers.clear(); + MarkerOptions originOptions = new MarkerOptions() + .position(new LatLng(locationsInfos.get(0).getLat(),locationsInfos.get(0).getLon())) + .icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_loca_load)) + .iconGravity(Property.ICON_ANCHOR_BOTTOM) + .iconScale(0.5f); + markers.add((Marker) mLKMap.addOverlay(originOptions)); + + MarkerOptions destinationOptions = new MarkerOptions() + .position(new LatLng(locationsInfos.get(1).getLat(),locationsInfos.get(1).getLon())) + .icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_loca_unload)) + .iconGravity(Property.ICON_ANCHOR_BOTTOM) + .iconScale(0.5f); + markers.add((Marker) mLKMap.addOverlay(destinationOptions)); + } + + @Override + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { + super.onResume(); + mapView.onResume(); + } + + @Override + protected void onPause() { + super.onPause(); + mapView.onPause(); + } + + @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override + protected void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + mapView.onSaveInstanceState(outState); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mapView.onDestroy(); + } + + @Override + public void onLowMemory() { + super.onLowMemory(); + mapView.onDestroy(); + } +} diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/home/StartYunDanActivity.java b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/home/StartYunDanActivity.java index d7ead1d..342e226 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/home/StartYunDanActivity.java +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/home/StartYunDanActivity.java @@ -17,30 +17,14 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.widget.NestedScrollView; + import com.amap.api.location.AMapLocation; import com.amap.api.location.AMapLocationClient; import com.amap.api.location.AMapLocationClientOption; import com.amap.api.location.AMapLocationListener; -import com.amap.api.maps.AMap; -import com.amap.api.maps.CameraUpdateFactory; import com.amap.api.maps.LocationSource; -import com.amap.api.maps.MapView; -import com.amap.api.maps.model.BitmapDescriptorFactory; -import com.amap.api.maps.model.LatLng; -import com.amap.api.maps.model.LatLngBounds; -import com.amap.api.maps.model.MarkerOptions; -import com.amap.api.maps.model.PolylineOptions; - -import com.amap.api.services.core.AMapException; import com.amap.api.services.core.LatLonPoint; -import com.amap.api.services.route.BusRouteResult; -import com.amap.api.services.route.DrivePath; -import com.amap.api.services.route.DriveRouteResult; -import com.amap.api.services.route.DriveStep; -import com.amap.api.services.route.RideRouteResult; import com.amap.api.services.route.RouteSearch; -import com.amap.api.services.route.WalkRouteResult; -import com.arpa.hndahesudintocctmsdriver.util.alert.ToastUtil; import com.bumptech.glide.Glide; import com.dahe.mylibrary.utils.TimeUtil; import com.dahe.mylibrary.utils.ToastUtils; @@ -67,6 +51,10 @@ import com.arpa.hndahesudintocctmsdriver.util.statusbar.StateStyleUtil; import com.arpa.hndahesudintocctmsdriver.util.view.BaseActivity; import com.arpa.hndahesudintocctmsdriver.util.view.BaseRecyclerView; import com.arpa.hndahesudintocctmsdriver.util.view.ScoreView; +import com.lk.mapsdk.base.mapapi.initializer.InitializerOptions; +import com.lk.mapsdk.base.mapapi.initializer.SDKInitializer; +import com.lk.mapsdk.base.mapapi.model.CoordType; +import com.lk.mapsdk.map.mapapi.map.MapView; import org.jetbrains.annotations.NotNull; @@ -144,7 +132,6 @@ public class StartYunDanActivity extends BaseActivity { } private UserBean ub; - private AMap aMap; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { @@ -163,10 +150,9 @@ public class StartYunDanActivity extends BaseActivity { //mBottomSheetBehavior.set map = findViewById(R.id.map); map.onCreate(savedInstanceState); - if (aMap == null) { - aMap = map.getMap(); - initLoaction(); - } + +// initLoaction(); + initMap(); Log.e("--id--", "" + id); String userdata = SPUtil.getSP(con, "data", "userdata"); if (!userdata.equals("")) { @@ -315,7 +301,7 @@ public class StartYunDanActivity extends BaseActivity { } initZX(upkey, v15, position, o, 1); }); - search(); +// search(); } public void initZX(boolean key, View v, int position, Object o, int type) { @@ -482,200 +468,211 @@ public class StartYunDanActivity extends BaseActivity { AMapLocationClient mlocationClient; AMapLocationClientOption mLocationOption; - public void initLoaction() { - // 设置定位监听 - aMap.setLocationSource(new LocationSource() { - @Override - public void activate(OnLocationChangedListener onLocationChangedListener) { - mListener = onLocationChangedListener; - if (mlocationClient == null) { - //初始化定位 - try { - mlocationClient = new AMapLocationClient(con); - } catch (Exception e) { - e.printStackTrace(); - } - //初始化定位参数 - mLocationOption = new AMapLocationClientOption(); - //设置定位回调监听 - mlocationClient.setLocationListener(new AMapLocationListener() { - @Override - public void onLocationChanged(AMapLocation aMapLocation) { - if (mListener != null && aMapLocation != null) { - if (aMapLocation != null - && aMapLocation.getErrorCode() == 0) { - mListener.onLocationChanged(aMapLocation);// 显示系统小蓝点 - } else { - String errText = "定位失败," + aMapLocation.getErrorCode() + ": " + aMapLocation.getErrorInfo(); - Log.e("AmapErr", errText); - } - } - } - }); - //设置为高精度定位模式 - mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy); - // mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Battery_Saving); - //设置定位模式为AMapLocationMode.Device_Sensors,仅设备模式。 - //mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Device_Sensors); - //获取一次定位结果: - //该方法默认为false。 - mLocationOption.setOnceLocation(true); - //获取最近3s内精度最高的一次定位结果: - //设置setOnceLocationLatest(boolean b)接口为true,启动定位时SDK会返回最近3s内精度最高的一次定位结果。如果设置其为true,setOnceLocation(boolean b)接口也会被设置为true,反之不会,默认为false。 - mLocationOption.setOnceLocationLatest(true); - //设置是否返回地址信息(默认返回地址信息) - mLocationOption.setNeedAddress(true); - //设置是否允许模拟位置,默认为true,允许模拟位置 - mLocationOption.setMockEnable(true); - //单位是毫秒,默认30000毫秒,建议超时时间不要低于8000毫秒。 - mLocationOption.setHttpTimeOut(20000); - //关闭缓存机制 - mLocationOption.setLocationCacheEnable(false); - //设置定位参数 - mlocationClient.setLocationOption(mLocationOption); - // 此方法为每隔固定时间会发起一次定位请求,为了减少电量消耗或网络流量消耗, - // 注意设置合适的定位时间的间隔(最小间隔支持为2000ms),并且在合适时间调用stopLocation()方法来取消定位请求 - // 在定位结束后,在合适的生命周期调用onDestroy()方法 - // 在单次定位情况下,定位无论成功与否,都无需调用stopLocation()方法移除请求,定位sdk内部会移除 - mlocationClient.startLocation();//启动定位 - } - } +// public void initLoaction() { +// // 设置定位监听 +// aMap.setLocationSource(new LocationSource() { +// @Override +// public void activate(OnLocationChangedListener onLocationChangedListener) { +// mListener = onLocationChangedListener; +// if (mlocationClient == null) { +// //初始化定位 +// try { +// mlocationClient = new AMapLocationClient(con); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// //初始化定位参数 +// mLocationOption = new AMapLocationClientOption(); +// //设置定位回调监听 +// mlocationClient.setLocationListener(new AMapLocationListener() { +// @Override +// public void onLocationChanged(AMapLocation aMapLocation) { +// if (mListener != null && aMapLocation != null) { +// if (aMapLocation != null +// && aMapLocation.getErrorCode() == 0) { +// mListener.onLocationChanged(aMapLocation);// 显示系统小蓝点 +// } else { +// String errText = "定位失败," + aMapLocation.getErrorCode() + ": " + aMapLocation.getErrorInfo(); +// Log.e("AmapErr", errText); +// } +// } +// } +// }); +// //设置为高精度定位模式 +// mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy); +// // mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Battery_Saving); +// //设置定位模式为AMapLocationMode.Device_Sensors,仅设备模式。 +// //mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Device_Sensors); +// //获取一次定位结果: +// //该方法默认为false。 +// mLocationOption.setOnceLocation(true); +// //获取最近3s内精度最高的一次定位结果: +// //设置setOnceLocationLatest(boolean b)接口为true,启动定位时SDK会返回最近3s内精度最高的一次定位结果。如果设置其为true,setOnceLocation(boolean b)接口也会被设置为true,反之不会,默认为false。 +// mLocationOption.setOnceLocationLatest(true); +// //设置是否返回地址信息(默认返回地址信息) +// mLocationOption.setNeedAddress(true); +// //设置是否允许模拟位置,默认为true,允许模拟位置 +// mLocationOption.setMockEnable(true); +// //单位是毫秒,默认30000毫秒,建议超时时间不要低于8000毫秒。 +// mLocationOption.setHttpTimeOut(20000); +// //关闭缓存机制 +// mLocationOption.setLocationCacheEnable(false); +// //设置定位参数 +// mlocationClient.setLocationOption(mLocationOption); +// // 此方法为每隔固定时间会发起一次定位请求,为了减少电量消耗或网络流量消耗, +// // 注意设置合适的定位时间的间隔(最小间隔支持为2000ms),并且在合适时间调用stopLocation()方法来取消定位请求 +// // 在定位结束后,在合适的生命周期调用onDestroy()方法 +// // 在单次定位情况下,定位无论成功与否,都无需调用stopLocation()方法移除请求,定位sdk内部会移除 +// mlocationClient.startLocation();//启动定位 +// } +// } +// +// @Override +// public void deactivate() { +// mListener = null; +// if (mlocationClient != null) { +// mlocationClient.stopLocation(); +// mlocationClient.onDestroy(); +// } +// mlocationClient = null; +// } +// }); +// // 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false +//// aMap.setMyLocationEnabled(true); +//// ld=new LocationGDUtil(con,hd); +//// ld.onCreate(); +// } - @Override - public void deactivate() { - mListener = null; - if (mlocationClient != null) { - mlocationClient.stopLocation(); - mlocationClient.onDestroy(); - } - mlocationClient = null; - } - }); - // 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false - aMap.setMyLocationEnabled(true); -// ld=new LocationGDUtil(con,hd); -// ld.onCreate(); + private void initMap(){ + // 通过InitializerOptions指定初始化配置参数 + InitializerOptions options = new InitializerOptions(); + // 设置是否使用Https网络请求,默认使用 +// options.setIsHttpsEnable(true); + // 设置坐标系,默认GCJ02 +// options.setCoorType(CoordType.GCJ02); + + SDKInitializer.initialization(getApplicationContext(),options); } - private RouteSearch mRouteSearch;//路线查询器 - private List lists = new ArrayList<>(); +// private RouteSearch mRouteSearch;//路线查询器 +// private List lists = new ArrayList<>(); - public void search() { -// try { -// AMapLocationClient.updatePrivacyShow(con,true,true); -// AMapLocationClient.updatePrivacyAgree(con,true); - mRouteSearch = new RouteSearch(this); -// } catch (AMapException e) { -// e.printStackTrace(); +// public void search() { +//// try { +//// AMapLocationClient.updatePrivacyShow(con,true,true); +//// AMapLocationClient.updatePrivacyAgree(con,true); +// mRouteSearch = new RouteSearch(this); +//// } catch (AMapException e) { +//// e.printStackTrace(); +//// } +// //设置数据回调监听器 +// mRouteSearch.setRouteSearchListener(new OnRouteSearchListener()); +// //设置开始位置坐标点(注意经纬度不能写反,会报错1800(只能规划到中国区域里的地图路线)) +// LatLonPoint startPoint = new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get(0).getLatitude()), +// Double.parseDouble(sob.getData().getWayChildren().get((0)).getLongitude())); +// //设置目的地坐标点 +// LatLonPoint endPoint = new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLatitude()), +// Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLongitude())); +// //查询信息对象 +// for (int i = 0; i < sob.getData().getWayChildren().size(); i++) { +// if (i != 0 && i != (sob.getData().getWayChildren().size() - 1)) { +// LatLonPoint sp = new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get(i).getLatitude()), +// Double.parseDouble(sob.getData().getWayChildren().get((i)).getLongitude())); +// lists.add(sp); +// } // } - //设置数据回调监听器 - mRouteSearch.setRouteSearchListener(new OnRouteSearchListener()); - //设置开始位置坐标点(注意经纬度不能写反,会报错1800(只能规划到中国区域里的地图路线)) - LatLonPoint startPoint = new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get(0).getLatitude()), - Double.parseDouble(sob.getData().getWayChildren().get((0)).getLongitude())); - //设置目的地坐标点 - LatLonPoint endPoint = new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLatitude()), - Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLongitude())); - //查询信息对象 - for (int i = 0; i < sob.getData().getWayChildren().size(); i++) { - if (i != 0 && i != (sob.getData().getWayChildren().size() - 1)) { - LatLonPoint sp = new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get(i).getLatitude()), - Double.parseDouble(sob.getData().getWayChildren().get((i)).getLongitude())); - lists.add(sp); - } - } - RouteSearch.FromAndTo fromAndTo = new RouteSearch.FromAndTo(startPoint, endPoint); - //设置搜索参数 1.fromAndTo 路径的起点终点 2.路径规划的策略(这里是驾车模式,具体看高德API) 3.途 - //经点,可选 4.避让区域,可选, 5.避让道路 ,可选 - RouteSearch.DriveRouteQuery query = new - RouteSearch.DriveRouteQuery(fromAndTo, RouteSearch.DRIVING_SINGLE_DEFAULT, lists, null, ""); - //开始异步查询 - mRouteSearch.calculateDriveRouteAsyn(query); - } +// RouteSearch.FromAndTo fromAndTo = new RouteSearch.FromAndTo(startPoint, endPoint); +// //设置搜索参数 1.fromAndTo 路径的起点终点 2.路径规划的策略(这里是驾车模式,具体看高德API) 3.途 +// //经点,可选 4.避让区域,可选, 5.避让道路 ,可选 +// RouteSearch.DriveRouteQuery query = new +// RouteSearch.DriveRouteQuery(fromAndTo, RouteSearch.DRIVING_SINGLE_DEFAULT, lists, null, ""); +// //开始异步查询 +// mRouteSearch.calculateDriveRouteAsyn(query); +// } - class OnRouteSearchListener implements RouteSearch.OnRouteSearchListener { - - @Override - public void onBusRouteSearched(BusRouteResult busRouteResult, int i) { - - } - - @Override - public void onDriveRouteSearched(DriveRouteResult driveRouteResult, int rCode) { - if (rCode == 1000) {//获取规划路线成功,获取到的是了,路线坐标点的集合 - List paths = driveRouteResult.getPaths(); - //创建存储坐标点的集合 - List latLngs = new ArrayList<>(); - //遍历获取规划的所有路线坐标点 - for (DrivePath mDrivePath : paths) { - for (DriveStep mDriveStep : mDrivePath.getSteps()) { - for (LatLonPoint mLatLonPoint : mDriveStep.getPolyline()) { - latLngs.add(new - LatLng(mLatLonPoint.getLatitude(), mLatLonPoint.getLongitude())); - } - } - } - //先清除一下,避免重复显示 - aMap.clear(); - //绘制起始位置和目的地marker - aMap.addMarker(new MarkerOptions() - .icon(BitmapDescriptorFactory.fromResource(R.mipmap.qi)) - .position(new LatLng(Double.parseDouble(sob.getData().getWayChildren().get(0).getLatitude()), - Double.parseDouble(sob.getData().getWayChildren().get(0).getLongitude())))); - for (int i = 0; i < sob.getData().getWayChildren().size(); i++) { - if (i != 0 && i != (sob.getData().getWayChildren().size() - 1)) { - StartOrderBean.DataDTO.WayChildrenDTO sdw = sob.getData().getWayChildren().get(i); - int icon = 0; - if (sdw.getType() == 1) { - icon = R.mipmap.z_loc; - } else { - icon = R.mipmap.x_loc; - } - aMap.addMarker(new MarkerOptions() - .icon(BitmapDescriptorFactory.fromResource(icon)) - .position(new LatLng(Double.parseDouble(sdw.getLatitude()), Double.parseDouble(sdw.getLongitude())))); - } - } - aMap.addMarker(new MarkerOptions() - .icon(BitmapDescriptorFactory.fromResource(R.mipmap.zhong)) - .position(new LatLng(Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLatitude()), - Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLongitude())))); - //绘制规划路径路线 - aMap.addPolyline(new PolylineOptions() - //路线坐标点的集合 - .addAll(latLngs) - //线的宽度 - .width(8) - .color(getResources().getColor(R.color.theme_color))); - //设置画线的颜色 - - //显示完整包含所有marker地图路线 - LatLngBounds.Builder builder = LatLngBounds.builder(); - for (int i = 0; i < latLngs.size(); i++) { - builder.include(latLngs.get(i)); - } - //显示全部marker,第二个参数是四周留空宽度 - aMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 200)); - LatLng latLng = new LatLng(Double.parseDouble(sob.getData().getWayChildren().get(0).getLatitude()), - Double.parseDouble(sob.getData().getWayChildren().get((0)).getLongitude()));//构造一个位置 - aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 6)); - } - } - - @Override - public void onWalkRouteSearched(WalkRouteResult walkRouteResult, int i) { - - } - - @Override - public void onRideRouteSearched(RideRouteResult rideRouteResult, int i) { - - } - - } +// class OnRouteSearchListener implements RouteSearch.OnRouteSearchListener { +// +// @Override +// public void onBusRouteSearched(BusRouteResult busRouteResult, int i) { +// +// } +// +// @Override +// public void onDriveRouteSearched(DriveRouteResult driveRouteResult, int rCode) { +// if (rCode == 1000) {//获取规划路线成功,获取到的是了,路线坐标点的集合 +// List paths = driveRouteResult.getPaths(); +// //创建存储坐标点的集合 +// List latLngs = new ArrayList<>(); +// //遍历获取规划的所有路线坐标点 +// for (DrivePath mDrivePath : paths) { +// for (DriveStep mDriveStep : mDrivePath.getSteps()) { +// for (LatLonPoint mLatLonPoint : mDriveStep.getPolyline()) { +// latLngs.add(new +// LatLng(mLatLonPoint.getLatitude(), mLatLonPoint.getLongitude())); +// } +// } +// } +// //先清除一下,避免重复显示 +// aMap.clear(); +// //绘制起始位置和目的地marker +// aMap.addMarker(new MarkerOptions() +// .icon(BitmapDescriptorFactory.fromResource(R.mipmap.qi)) +// .position(new LatLng(Double.parseDouble(sob.getData().getWayChildren().get(0).getLatitude()), +// Double.parseDouble(sob.getData().getWayChildren().get(0).getLongitude())))); +// for (int i = 0; i < sob.getData().getWayChildren().size(); i++) { +// if (i != 0 && i != (sob.getData().getWayChildren().size() - 1)) { +// StartOrderBean.DataDTO.WayChildrenDTO sdw = sob.getData().getWayChildren().get(i); +// int icon = 0; +// if (sdw.getType() == 1) { +// icon = R.mipmap.z_loc; +// } else { +// icon = R.mipmap.x_loc; +// } +// aMap.addMarker(new MarkerOptions() +// .icon(BitmapDescriptorFactory.fromResource(icon)) +// .position(new LatLng(Double.parseDouble(sdw.getLatitude()), Double.parseDouble(sdw.getLongitude())))); +// } +// } +// aMap.addMarker(new MarkerOptions() +// .icon(BitmapDescriptorFactory.fromResource(R.mipmap.zhong)) +// .position(new LatLng(Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLatitude()), +// Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLongitude())))); +// //绘制规划路径路线 +// aMap.addPolyline(new PolylineOptions() +// //路线坐标点的集合 +// .addAll(latLngs) +// //线的宽度 +// .width(8) +// .color(getResources().getColor(R.color.theme_color))); +// //设置画线的颜色 +// +// //显示完整包含所有marker地图路线 +// LatLngBounds.Builder builder = LatLngBounds.builder(); +// for (int i = 0; i < latLngs.size(); i++) { +// builder.include(latLngs.get(i)); +// } +// //显示全部marker,第二个参数是四周留空宽度 +// aMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 200)); +// LatLng latLng = new LatLng(Double.parseDouble(sob.getData().getWayChildren().get(0).getLatitude()), +// Double.parseDouble(sob.getData().getWayChildren().get((0)).getLongitude()));//构造一个位置 +// aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 6)); +// } +// } +// +// @Override +// public void onWalkRouteSearched(WalkRouteResult walkRouteResult, int i) { +// +// } +// +// @Override +// public void onRideRouteSearched(RideRouteResult rideRouteResult, int i) { +// +// } +// +// } public void up_traffic() { // ShippingNoteInfo[] snis=new ShippingNoteInfo[1]; diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/my/MyFragment.java b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/my/MyFragment.java index 5e3390b..3bdde26 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/my/MyFragment.java +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/my/MyFragment.java @@ -17,6 +17,7 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.arpa.hndahesudintocctmsdriver.TextMapActivity; import com.arpa.hndahesudintocctmsdriver.event.PersonEvent; import com.arpa.hndahesudintocctmsdriver.event.RefreshCarListEvent; import com.arpa.hndahesudintocctmsdriver.event.VehicleEvent; @@ -24,6 +25,7 @@ import com.arpa.hndahesudintocctmsdriver.parts.ConfigParts; import com.arpa.hndahesudintocctmsdriver.parts.StartOrderParts; import com.arpa.hndahesudintocctmsdriver.parts.UserParts; import com.arpa.hndahesudintocctmsdriver.ui.business.BusinessActivity; +import com.arpa.hndahesudintocctmsdriver.ui.home.StartYunDanActivity; import com.arpa.hndahesudintocctmsdriver.util.PicturlUtil; import com.bumptech.glide.Glide; import com.google.gson.Gson; @@ -235,24 +237,28 @@ public class MyFragment extends BaseFragment { }); //联系我们 onContact.setOnClickListener(v -> { - String serviceMobile = ""; - if (ConfigParts.getConfigParts(con) != null) { - serviceMobile = ConfigParts.getConfigParts(con).getData().getServiceMobile(); - serviceMobile = StringUtil.isNull(serviceMobile, ""); - } - String[] title = {"平台客服:" + serviceMobile}; - String[] value = {serviceMobile}; - new XPopup.Builder(con) - .isDarkTheme(false) - .isDestroyOnDismiss(true) //对于只使用一次的弹窗,推荐设置这个 - .asCenterList("请选择", title, - (position1, text) -> { - Intent intent = new Intent(Intent.ACTION_DIAL); - Uri data = Uri.parse("tel:" + value[position1]); - intent.setData(data); - startActivity(intent); - }) - .show(); + + Intent in=new Intent(con, TextMapActivity.class); + startActivity(in); + +// String serviceMobile = ""; +// if (ConfigParts.getConfigParts(con) != null) { +// serviceMobile = ConfigParts.getConfigParts(con).getData().getServiceMobile(); +// serviceMobile = StringUtil.isNull(serviceMobile, ""); +// } +// String[] title = {"平台客服:" + serviceMobile}; +// String[] value = {serviceMobile}; +// new XPopup.Builder(con) +// .isDarkTheme(false) +// .isDestroyOnDismiss(true) //对于只使用一次的弹窗,推荐设置这个 +// .asCenterList("请选择", title, +// (position1, text) -> { +// Intent intent = new Intent(Intent.ACTION_DIAL); +// Uri data = Uri.parse("tel:" + value[position1]); +// intent.setData(data); +// startActivity(intent); +// }) +// .show(); }); //咨询建议 onOpinion.setOnClickListener(v -> { diff --git a/app/src/main/res/drawable-xxhdpi/icon_loca_load.png b/app/src/main/res/drawable-xxhdpi/icon_loca_load.png new file mode 100644 index 0000000..b2a33ce Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_loca_load.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_loca_unload.png b/app/src/main/res/drawable-xxhdpi/icon_loca_unload.png new file mode 100644 index 0000000..6f0312e Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_loca_unload.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_roud_type.png b/app/src/main/res/drawable-xxhdpi/icon_roud_type.png new file mode 100644 index 0000000..94fbba2 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_roud_type.png differ diff --git a/app/src/main/res/layout/activity_base_map.xml b/app/src/main/res/layout/activity_base_map.xml new file mode 100644 index 0000000..04576df --- /dev/null +++ b/app/src/main/res/layout/activity_base_map.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_yundan_start.xml b/app/src/main/res/layout/activity_yundan_start.xml index 39cdedb..2635a76 100644 --- a/app/src/main/res/layout/activity_yundan_start.xml +++ b/app/src/main/res/layout/activity_yundan_start.xml @@ -4,7 +4,12 @@ android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto"> - + + + + + diff --git a/build.gradle b/build.gradle index 649b35f..f387d84 100644 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,7 @@ buildscript { maven { url 'https://maven.aliyun.com/repository/releases' } + maven { url 'http://lbs-sdk.luokuang.com/repository/maven-releases/' } } dependencies { classpath 'com.android.tools.build:gradle:4.2.2' @@ -31,9 +32,10 @@ allprojects { maven { url 'https://maven.aliyun.com/repository/releases' } + maven { url 'http://lbs-sdk.luokuang.com/repository/maven-releases/' } } } task clean(type: Delete) { delete rootProject.buildDir -} \ No newline at end of file +}