code style opt, reduce build time : 1m30s

This commit is contained in:
unknown
2020-11-10 16:18:36 +08:00
parent 8b59221f71
commit b2af80dce8
42 changed files with 184 additions and 399 deletions

View File

@@ -44,13 +44,13 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
}
fun registerTakePhotoInterceptor(interceptor: TakePhotoInterceptor) {
interceptor?.apply {
interceptor.apply {
interceptors.add(this)
}
}
fun unregisterTakePhotoInterceptor(interceptor: TakePhotoInterceptor) {
interceptor?.apply {
interceptor.apply {
interceptors.remove(interceptor)
}
}
@@ -146,14 +146,14 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
fun release() {
zdCarCoderController.release()
interceptors?.clear()
interceptors.clear()
}
//拍照失败回调
override fun onTakePhotoFail(photoType: Int, camera: Int) {
trackGetPhoto(3)
interceptors.forEach {
it?.onTakePhotoFail(photoType, camera)
it.onTakePhotoFail(photoType, camera)
}
val isCustom = CustomStatusHandler.pollPhotoStatus()
val entity = TakeEntity(isCustom, 0L)
@@ -184,7 +184,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
if (isCustom) {
CosStatusController().sendInformationDirectly(
INFO_TYPE_IMG,
mutableMapOf("pic" to "" as String),
mutableMapOf("pic" to ""),
mType,
entity,
mainInfoId,
@@ -208,8 +208,8 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
var interceptor = false
interceptors.forEach {
interceptor = it?.intercept()
it?.onTakePhotoSuccess(photoType, camera, photoPath)
interceptor = it.intercept()
it.onTakePhotoSuccess(photoType, camera, photoPath)
}
if (interceptor) {
return
@@ -343,11 +343,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
val entity = CustomStatusHandler.pollVideoStatus()
entity?.let {
InformationUploadController.release(entity.id)
Log.e(TAG, "getVideo onTakeVideoFail entity?.isCustom =" + entity?.isCustom)
if (entity?.isCustom) {
InformationUploadController.release(it.id)
Log.e(TAG, "getVideo onTakeVideoFail entity?.isCustom =" + it.isCustom)
// if (it.isCustom) {
// sendGetInfoFailedReceiver(mType)
}
// }
}
//失败了,传空地址,发起请求

View File

@@ -27,11 +27,11 @@ object CosCallbackMapController : CosStatusCallback {
this.uploadFailed = uploadFailed
}
fun registerCallback(paths: List<String>, callback: CosStatusCallback) {
fun registerCallback(paths: List<String?>?, callback: CosStatusCallback) {
paths?.let { list ->
list.forEach { path ->
path?.let {
map[path] = callback
map[it] = callback
}
}
}

View File

@@ -43,7 +43,7 @@ class CosStatusController : CosStatusCallback {
private var mLatitude: Double = 0.0
//上传文件
fun uploadFile(picPath: MutableList<String>, entity: TakeEntity, type: String, mainInfoId: Long,
fun uploadFile(picPath: MutableList<String?>?, entity: TakeEntity, type: String, mainInfoId: Long,
fromType: String, longitude: Double, latitude: Double) {
CosCallbackMapController.registerCallback(picPath, this)
// CosLogger.setLogStatus(true)
@@ -56,6 +56,9 @@ class CosStatusController : CosStatusCallback {
this.mLatitude = latitude
Log.d(TAG, "uploadFile type===$type ---- mainInfoId =$mainInfoId ----mFromType = $mFromType ---- picPath = $picPath ")
trackUploadCos(3)
if(picPath == null){
return
}
if (picPath.contains("backPic")) return
//参数说明: paths本地文件路径上传的本地路径不要重复config文件上传的优先级
mPicEventId =
@@ -171,7 +174,7 @@ class CosStatusController : CosStatusCallback {
mLatitude
)
}
Log.d(TAG, "delete file: ${localPath!!}")
Log.d(TAG, "delete file: $localPath")
CosCallbackMapController.unregisterCallback(localPath)
deletePicFile(localPath)
}

View File

@@ -195,12 +195,12 @@ class MainService : Service() {
"MainService",
"getImageEvent url = " + getImageSuccessEvent.getImageUrl() + ">>>>type =" + getImageSuccessEvent.getType()
)
sendMarkerInfoReceiver(
info.latitude,
info.longitude,
getImageSuccessEvent.getImageUrl(),
getImageSuccessEvent.getType()
)
// sendMarkerInfoReceiver(
// info.latitude,
// info.longitude,
// getImageSuccessEvent.getImageUrl(),
// getImageSuccessEvent.getType()
// )
}
private fun sendMarkerInfoReceiver(lat: Double, lon: Double, imageUrl: String?, type: String?) {

View File

@@ -270,7 +270,7 @@ class MainServiceController {
) {
Log.d(TAG, " geoLocation -- poiType = $poiType")
LocationUtil.getInstance()
.geoCodeLocation(locationInfo.toLatLngPoint(), { locInfo: LocationInfo ->
.geoCodeLocation(locationInfo.toLatLngPoint(), {
Log.d(TAG, "geoLocation -------start -->")
postInformationMessage(
getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare, poiType,mainInfoId,longitude,latitude),