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 1cde4c21cf..7ae76ba6e8 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 @@ -9,6 +9,7 @@ import com.mogo.utils.NetworkUtils import com.zhidao.auto.carcorder.callback.TakePhotoCallback import com.zhidao.auto.carcorder.callback.TakeVideoCallback import com.zhidao.auto.carcorder.controller.ZdCarCoderController +import com.zhidao.roadcondition.BuildConfig import com.zhidao.roadcondition.constant.* import com.zhidao.roadcondition.event.GetImageSuccessEvent import com.zhidao.roadcondition.event.LatLngStickyEventBus @@ -282,8 +283,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { ) val entity = CustomStatusHandler.pollVideoStatus() - if (!entity?.isCustom) { - trackNormalEvent(CarNet_auto_upload_video, null) + + entity?.let { + if (!entity.isCustom) { + trackNormalEvent(CarNet_auto_upload_video, null) + } } if (isSuccess) { @@ -297,25 +301,27 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { ) var speed = LocationUtil.getInstance().getSpeed() - if (entity?.isCustom) { - compressVideo(videoPath, thumbnailPath, entity) - } else { - Log.d( - TAG, - "onTakeVideoSuccess maxSpeedVideo = $maxSpeedVideo --->speed= $speed + minSpeedVideo = $minSpeedVideo" - ) - if (maxSpeedVideo == -1) { - Log.d(TAG, "onTakeVideoSuccess 111 abs =" + (Math.abs(minSpeedVideo) / 3.6f)) - if (speed >= (Math.abs(minSpeedVideo) / 3.6f)) { - //获取视频以及缩略图成功,开始上报 - compressVideo(videoPath, thumbnailPath, entity) + entity?.let { + if (entity.isCustom) { + compressVideo(videoPath, thumbnailPath, entity) + } else { + Log.d( + TAG, + "onTakeVideoSuccess maxSpeedVideo = $maxSpeedVideo --->speed= $speed + minSpeedVideo = $minSpeedVideo" + ) + if (maxSpeedVideo == -1) { + Log.d(TAG, "onTakeVideoSuccess 111 abs =" + (Math.abs(minSpeedVideo) / 3.6f)) + if (speed >= (Math.abs(minSpeedVideo) / 3.6f)) { + //获取视频以及缩略图成功,开始上报 + compressVideo(videoPath, thumbnailPath, entity) + } } - } - if (minSpeedVideo > 0 && maxSpeedVideo > 0) { - Log.d(TAG, "onTakeVideoSuccess minSpeedVideo > 0 -- speed = $speed") - if ((speed >= (minSpeedVideo / 3.6f)) && speed <= (maxSpeedVideo / 3.6f)) { - compressVideo(videoPath, thumbnailPath, entity) + if (minSpeedVideo > 0 && maxSpeedVideo > 0) { + Log.d(TAG, "onTakeVideoSuccess minSpeedVideo > 0 -- speed = $speed") + if ((speed >= (minSpeedVideo / 3.6f)) && speed <= (maxSpeedVideo / 3.6f)) { + compressVideo(videoPath, thumbnailPath, entity) + } } } } @@ -332,10 +338,13 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { Log.e(TAG, "getVideo onTakeVideoFail") getVideoFailed?.invoke() val entity = CustomStatusHandler.pollVideoStatus() - InformationUploadController.release(entity?.id) - Log.e(TAG, "getVideo onTakeVideoFail entity?.isCustom =" + entity?.isCustom) - if (entity?.isCustom) { + + entity?.let { + InformationUploadController.release(entity.id) + Log.e(TAG, "getVideo onTakeVideoFail entity?.isCustom =" + entity?.isCustom) + if (entity?.isCustom) { // sendGetInfoFailedReceiver(mType) + } } //失败了,传空地址,发起请求 diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CosStatusController.kt b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CosStatusController.kt index 8502395eb3..c792152060 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CosStatusController.kt +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CosStatusController.kt @@ -195,17 +195,18 @@ class CosStatusController : CosStatusCallback { type: Int, map: Map, poiType: String, - entity: TakeEntity, + entity: TakeEntity?, mainInfoId: Long, longitude: Double, latitude: Double ) { Log.d(TAG, "sendInformationDirectly isCustomSend = ${entity?.isCustom}") Log.d(TAG, "sendInformationDirectly poiType= $poiType ---- mainInfoId= $mainInfoId") - mainServiceHttpModel.sendInformationMessage( + entity?.isCustom?.let { + mainServiceHttpModel.sendInformationMessage( type = type, url = map, - isCustom = entity?.isCustom, + isCustom = it, poiType = poiType, mainInfoId = mainInfoId, longitude = longitude, @@ -216,6 +217,7 @@ class CosStatusController : CosStatusCallback { CosCallbackMapController.mainService?.sendCustomResult(success) } } + } } override fun onProgress(localPath: String?, progress: Float) { diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CustomStatusHandler.kt b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CustomStatusHandler.kt index bb31cb71f3..bd0d63ba14 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CustomStatusHandler.kt +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CustomStatusHandler.kt @@ -23,7 +23,7 @@ object CustomStatusHandler { takeVideoStatusQueue.offer(entity) } - fun pollVideoStatus(): TakeEntity = takeVideoStatusQueue.poll() + fun pollVideoStatus(): TakeEntity? = takeVideoStatusQueue.poll() } class TakeEntity(