From 3d01e0ef59b73039b14f3f8919f8ea7c7f24de76 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Tue, 23 Feb 2021 16:10:17 +0800 Subject: [PATCH] fixed conflict --- .../service/CarCorderController.kt | 23 +++- .../roadcondition/service/MainService.kt | 15 ++- .../com/mogo/module/share/TanluManager.java | 107 ++++++++++-------- .../module/share/callback/RoadInfoCallback.kt | 2 + 4 files changed, 96 insertions(+), 51 deletions(-) diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CarCorderController.kt b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CarCorderController.kt index 717902edcf..159f420e5c 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CarCorderController.kt +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CarCorderController.kt @@ -77,6 +77,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { zdCarCoderController.init() } + fun takePhoto( photoType: Int, cameraId: Int, @@ -87,7 +88,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { fromType: String, longitude: Double, latitude: Double, - speed: Float + speed: Float, + address: String, + direction: Float, + areaCode: String, + cityCode: String ) { Log.d(TAG, "takePhoto ---------- type = $type --- mType = $mType ---fromType = $fromType") this.mType = type @@ -96,6 +101,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { this.mLongitude = longitude this.mLatitude = latitude this.mSpeed = speed + this.mAddress = address + this.mDirection = direction + this.mAreaCode = areaCode + this.mCityCode = cityCode + CustomStatusHandler.offerPhotoStatus(isCustom) zdCarCoderController.takePhoto(photoType, cameraId, haveVoice) trackGetPhoto(1) @@ -115,7 +125,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { fromType: String, longitude: Double, latitude: Double, - speed: Float + speed: Float, + address: String, + direction: Float, + areaCode: String, + cityCode: String ) { Log.d(TAG, "takeVideo -------- isCustom = $isCustom ---mFromType = $mFromType ---type = $type ---speed = $speed") this.mType = type @@ -124,6 +138,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { this.mLongitude = longitude this.mLatitude = latitude this.mSpeed = speed + this.mAddress = address + this.mDirection = direction + this.mAreaCode = areaCode + this.mCityCode = cityCode + if (DebugConfig.getCarMachineType() == 0) { //自研车机 outputVideoPath = getCompressVideoPath() CustomStatusHandler.offerVideoStatus(TakeEntity(isCustom, id, fromType)) diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/MainService.kt b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/MainService.kt index 7ebddece68..46bc7c564d 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/MainService.kt +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/MainService.kt @@ -76,6 +76,12 @@ class MainService : Service() { private var mLatitude: Double = 0.0 private lateinit var serviceApis: IMogoServiceApis + private var mAddress: String = "" + private var mDirection: Float = 0f + private var mAreaCode: String = "" + private var mCityCode: String = "" + + override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { //清理多媒体资源和sp策略数据 clearStrategyType(this) @@ -95,6 +101,11 @@ class MainService : Service() { mainInfoId = it.parentId mLongitude = it.lon mLatitude = it.lat + mAddress = it.addr + mDirection = it.direction + mAreaCode = it.areaCode + mCityCode = it.cityCode + Log.d(TAG, "onStartCommand shareType = $shareType --fromType = $fromType --mainInfoId = $mainInfoId -- mLongitude = $mLongitude --mLatitude = $mLatitude --it.duration = ${it.duration} ") if (fromType == UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO || fromType == UPLOAD_FROM_STRATEGY_BLOCK_AUTO) { // 如果是策略上报,isCustom = false @@ -274,7 +285,7 @@ class MainService : Service() { Observable.intervalRange(0, 1, 0, 2_000, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .subscribe { - CarCorderController.takePhoto(1, 1, false, isCustom, TANLU_ROAD_CURRENT, mainInfoId, fromType, mLongitude, mLatitude, speed) + CarCorderController.takePhoto(1, 1, false, isCustom, TANLU_ROAD_CURRENT, mainInfoId, fromType, mLongitude, mLatitude, speed, mAddress, mDirection, mAreaCode, mCityCode) } // } @@ -292,7 +303,7 @@ class MainService : Service() { ) { Log.d("MainService", "takeVideo --------1----> fromType = $fromType --isCustom = $isCustom") // if (isAuthorization(BaseApplication.getAppContext())) { - CarCorderController.takeVideo(1, duration, isCustom, id, shareType, mainInfoId, fromType, mLongitude, mLatitude, speed) + CarCorderController.takeVideo(1, duration, isCustom, id, shareType, mainInfoId, fromType, mLongitude, mLatitude, speed, mAddress, mDirection, mAreaCode, mCityCode) // } postVideoAlarmTask(isInterval) diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java index e1d222d0a1..ada9bed5b4 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java @@ -12,6 +12,8 @@ import android.view.animation.AccelerateInterpolator; import android.view.animation.Interpolator; import android.view.animation.LinearInterpolator; +import com.mogo.cloud.tanlu.bean.MarkerExploreWay; +import com.mogo.cloud.tanlu.bean.location.MarkerLocation; import com.mogo.commons.voice.AIAssist; import com.mogo.map.MogoLatLng; import com.mogo.map.location.MogoLocation; @@ -31,8 +33,7 @@ import com.mogo.map.search.poisearch.IMogoPoiSearchListener; import com.mogo.map.search.poisearch.MogoPoiResult; import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery; import com.mogo.map.uicontroller.IMogoMapUIController; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerLocation; +//import com.mogo.module.common.entity.MarkerExploreWay; import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.share.bean.VoiceCmdData; import com.mogo.module.share.bean.event.MarkerInfo; @@ -287,45 +288,45 @@ public class TanluManager implements IMogoMarkerClickListener, } if (voiceData != null) { -// mTanluModelData.queryRodeInfo(mContext, mKeywords, voiceData, new RoadInfoCallback() { -// @Override -// public void onQueryRoadInfoSuccess(@NotNull List roadInfoList) { -// if (roadInfoList == null || (roadInfoList != null && roadInfoList.size() <= 0)) { -// if ( TextUtils.equals(mKeywords,"附近")) { -// speakFailVoice("未发现附近的特殊路况"); -// } else { -// speakFailVoice("未发现" + mKeywords + "附近的特殊路况"); -// } -// moveToMarcker(currentLat, currentLon); -// return; -// } -// Logger.d(TAG, "onQueryRoadInfoSuccess roadInfoList.size() = " + roadInfoList.size() -// + " >>currentLat = " + currentLat + " -->currentLon = " + currentLon); -// MogoLocation location = TanluServiceManager.getLocationClient().getLastKnowLocation(); -// if (location != null) { -// mCity = location.getCityName(); -// } -// addMarkersAction((List) roadInfoList, currentLat, currentLon); -// } -// -// @Override -// public void onQueryRoadInfoFail(@NotNull String msg, int code) { -// Logger.e(TAG, "onQueryRoadInfoFail ----- msg = " + msg); -//// speakFailVoice(searchfaileVoiceStrings[1]); -// if (TextUtils.equals(mKeywords,"附近")) { -// speakFailVoice("未发现附近的特殊路况"); -// } else { -// speakFailVoice("未发现" + mKeywords + "附近的特殊路况"); -// } -// moveToMarcker(currentLat, currentLon); -// } -// -// @Override -// public void onLocatSuccess(double lat, double lon) { -// currentLat = lat; -// currentLon = lon; -// } -// }); + mTanluModelData.queryRodeInfo(mContext, mKeywords, voiceData, new RoadInfoCallback() { + @Override + public void onQueryRoadInfoSuccess(@NotNull List roadInfoList) { + if (roadInfoList == null || (roadInfoList != null && roadInfoList.size() <= 0)) { + if (TextUtils.equals(mKeywords, "附近")) { + speakFailVoice("未发现附近的特殊路况"); + } else { + speakFailVoice("未发现" + mKeywords + "附近的特殊路况"); + } + moveToMarcker(currentLat, currentLon); + return; + } + Logger.d(TAG, "onQueryRoadInfoSuccess roadInfoList.size() = " + roadInfoList.size() + + " >>currentLat = " + currentLat + " -->currentLon = " + currentLon); + MogoLocation location = TanluServiceManager.getLocationClient().getLastKnowLocation(); + if (location != null) { + mCity = location.getCityName(); + } + addMarkersAction((List) roadInfoList, currentLat, currentLon); + } + + @Override + public void onQueryRoadInfoFail(@NotNull String msg, int code) { + Logger.e(TAG, "onQueryRoadInfoFail ----- msg = " + msg); +// speakFailVoice(searchfaileVoiceStrings[1]); + if (TextUtils.equals(mKeywords, "附近")) { + speakFailVoice("未发现附近的特殊路况"); + } else { + speakFailVoice("未发现" + mKeywords + "附近的特殊路况"); + } + moveToMarcker(currentLat, currentLon); + } + + @Override + public void onLocatSuccess(double lat, double lon) { + currentLat = lat; + currentLon = lon; + } + }); } } @@ -362,7 +363,8 @@ public class TanluManager implements IMogoMarkerClickListener, MarkerShowEntity markerShowEntity = new MarkerShowEntity(); markerShowEntity.setBindObj(markerExploreWayList.get(i)); markerShowEntity.setTextContent(list.get(i).getAddr()); - markerShowEntity.setMarkerLocation(markerExploreWayList.get(i).getLocation()); + + markerShowEntity.setMarkerLocation(getLocation(markerExploreWayList.get(i).getLocation())); markerShowEntity.setMarkerType(ShareConstants.MODEL_NAME); TanluServiceManager.getServiceApis().getMarkerService().drawMarker(markerShowEntity); @@ -381,6 +383,16 @@ public class TanluManager implements IMogoMarkerClickListener, //直接使用当前数据list,作为切换的数据源,切换左侧列表到最新的数据 } + private com.mogo.module.common.entity.MarkerLocation getLocation(MarkerLocation location) { + com.mogo.module.common.entity.MarkerLocation markerLocation = new com.mogo.module.common.entity.MarkerLocation(); + markerLocation.setLat(location.getLat()); + markerLocation.setLon(location.getLon()); + markerLocation.setAddress(location.getAddress()); + markerLocation.setAngle(location.getAngle()); + + return markerLocation; + + } /** * marker动画 @@ -458,7 +470,7 @@ public class TanluManager implements IMogoMarkerClickListener, MogoLatLng latLon = poi.getPoint(); Double longit; //经度 Double lat; //维度 - if (TextUtils.equals(mKeywords,"附近")) { + if (TextUtils.equals(mKeywords, "附近")) { Logger.d(TAG, "附近 -onPoiSearched---1---"); longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude(); lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude(); @@ -473,7 +485,7 @@ public class TanluManager implements IMogoMarkerClickListener, Logger.e(TAG, "poi == null"); Double longit; //经度 Double lat; //维度 - if (TextUtils.equals(mKeywords,"附近")) { + if (TextUtils.equals(mKeywords, "附近")) { Logger.d(TAG, "附近 -onPoiSearched---2---"); longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude(); lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude(); @@ -533,7 +545,7 @@ public class TanluManager implements IMogoMarkerClickListener, markerExploreWay.setCityName(cityName); markerExploreWay.setPoiType(poiType); - MarkerLocation markerLocation = new MarkerLocation(); + com.mogo.module.common.entity.MarkerLocation markerLocation = new com.mogo.module.common.entity.MarkerLocation(); markerLocation.setLat(lat); markerLocation.setLon(lon); markerLocation.setAddress(address); @@ -542,6 +554,7 @@ public class TanluManager implements IMogoMarkerClickListener, markerShowEntity.setBindObj(markerExploreWay); markerShowEntity.setTextContent(address); markerShowEntity.setMarkerType(ShareConstants.MODEL_NAME); + markerShowEntity.setMarkerLocation(markerLocation); IMogoMarker mogoMarker = TanluServiceManager.getServiceApis().getMarkerService().drawMarker(markerShowEntity); @@ -572,11 +585,11 @@ public class TanluManager implements IMogoMarkerClickListener, @Override public void onAnimEnd() { - UiThreadHandler.postDelayed( () -> { + UiThreadHandler.postDelayed(() -> { if (mogoAnimationMarker != null) { mogoAnimationMarker.destroy(); } - }, 1_200L ); + }, 1_200L); } }); } diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt index 8a1486b276..5c56223851 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt @@ -1,5 +1,7 @@ package com.mogo.module.share.callback +//import com.mogo.module.common.entity.MarkerExploreWay + import com.mogo.cloud.tanlu.bean.MarkerExploreWay