code style opt, reduce build time : 1m30s
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.mogo.module.share
|
||||
|
||||
import android.content.Context
|
||||
|
||||
@@ -46,19 +46,19 @@ class TrafficUploadManager : IMogoTrafficSearchListener {
|
||||
override fun onTrafficSearchInfo(trafficResult: MogoTrafficResult?) {
|
||||
val map = hashMapOf<String, Any>("upload" to 1) //调用高德接口成功
|
||||
MogoApisHandler.getInstance().apis.analyticsApi.track(TRACK_UPLOAD_INVOKE, map)
|
||||
trafficResult?.let { trafficResult ->
|
||||
trafficResult?.let {
|
||||
val uploadTrafficEntity = UploadTrafficEntity()
|
||||
val roadTrafficStatusList: MutableList<RoadTrafficStatus> = ArrayList()
|
||||
val trafficStatusInfoList = trafficResult.trafficStatusInfos
|
||||
trafficStatusInfoList.forEach {
|
||||
val trafficStatusInfoList = it.trafficStatusInfos
|
||||
trafficStatusInfoList.forEach { info ->
|
||||
val roadTrafficStatus = RoadTrafficStatus()
|
||||
roadTrafficStatus.angle = it.angle
|
||||
roadTrafficStatus.direction = it.direction
|
||||
roadTrafficStatus.angle = info.angle
|
||||
roadTrafficStatus.direction = info.direction
|
||||
roadTrafficStatus.isSegment = false
|
||||
roadTrafficStatus.length = 0
|
||||
roadTrafficStatus.roadName = it.name
|
||||
roadTrafficStatus.status = it.status.toInt()
|
||||
roadTrafficStatus.mogoLatLngList = it.mogoLatLngs
|
||||
roadTrafficStatus.roadName = info.name
|
||||
roadTrafficStatus.status = info.status.toInt()
|
||||
roadTrafficStatus.mogoLatLngList = info.mogoLatLngs
|
||||
roadTrafficStatusList.add(roadTrafficStatus)
|
||||
}
|
||||
uploadTrafficEntity.roadTrafficStatuses = roadTrafficStatusList
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.map.MogoLatLng
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum
|
||||
import com.mogo.module.share.R
|
||||
import com.mogo.module.share.TanluManager
|
||||
import com.mogo.module.share.constant.ShareConstants.*
|
||||
import com.mogo.service.share.TanluUploadParams
|
||||
import com.mogo.utils.NetworkUtils
|
||||
@@ -68,10 +67,10 @@ object UploadHelper {
|
||||
|
||||
private fun showVoiceTip(context: Context, type: String) {
|
||||
var shareItemSum = SharedPrefsMgr.getInstance(context).getInt(KEY_CLICK_SHARE_ITEM_BUTTON, 0)
|
||||
var intervalTime = SharedPrefsMgr.getInstance(context).getLong(KEY_CLICK_SHARE_ITEM_TIME, 0)
|
||||
val intervalTime = SharedPrefsMgr.getInstance(context).getLong(KEY_CLICK_SHARE_ITEM_TIME, 0)
|
||||
if (shareItemSum < VOICE_ALERT_COUNT) {
|
||||
Log.d("UploadHelper", "shareItemSum = $shareItemSum --- intervalTime = $intervalTime --type = ${type}")
|
||||
var time = System.currentTimeMillis()
|
||||
Log.d("UploadHelper", "shareItemSum = $shareItemSum --- intervalTime = $intervalTime --type = $type")
|
||||
val time = System.currentTimeMillis()
|
||||
Log.d("UploadHelper", "time = $time ")
|
||||
if (intervalTime == 0.toLong()) {
|
||||
SharedPrefsMgr.getInstance(context).putLong(KEY_CLICK_SHARE_ITEM_TIME, time)
|
||||
@@ -92,8 +91,7 @@ object UploadHelper {
|
||||
|
||||
|
||||
private fun getTypeName(type: String): String? {
|
||||
var typeName = ""
|
||||
typeName = when (type) {
|
||||
return when (type) {
|
||||
MarkerPoiTypeEnum.TRAFFIC_CHECK -> "交通检查"
|
||||
MarkerPoiTypeEnum.ROAD_CLOSED -> "封路"
|
||||
MarkerPoiTypeEnum.FOURS_ROAD_WORK -> "施工"
|
||||
@@ -105,7 +103,6 @@ object UploadHelper {
|
||||
MarkerPoiTypeEnum.FOURS_LIVING -> "实时路况"
|
||||
else -> "实时路况"
|
||||
}
|
||||
return typeName
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,6 +42,6 @@ interface ShareApiService {
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-launcherSnapshot/launcherSnapshot/searchRoadEventsSync")
|
||||
fun queryRoadInfos(@FieldMap params: Map<String, Object>): Observable<BaseDataCompat<RoadInfos>>
|
||||
fun queryRoadInfos(@FieldMap params: Map<String, Any>): Observable<BaseDataCompat<RoadInfos>>
|
||||
|
||||
}
|
||||
@@ -159,7 +159,7 @@ class BlockStrategy(private val context: Context, private val apis: IMogoService
|
||||
val params = ArrayMap<String, Any>()
|
||||
params["speed"] = average.toInt()
|
||||
val body = RequestBody.create(MediaType.parse("Content-type:application/json;charset=UTF-8"), GsonUtil.jsonFromObject(params))
|
||||
val disposable = apis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendAverageSpeedForBlockStrategy(body, Utils.getSn()).subscribeOn(Schedulers.io()).subscribe(object : SubscribeImpl<AverateSpeedResponse>(RequestOptions.create(context)) {
|
||||
apis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendAverageSpeedForBlockStrategy(body, Utils.getSn()).subscribeOn(Schedulers.io()).subscribe(object : SubscribeImpl<AverateSpeedResponse>(RequestOptions.create(context)) {
|
||||
override fun onSuccess(response: AverateSpeedResponse?) {
|
||||
super.onSuccess(response)
|
||||
response?.let {
|
||||
|
||||
Reference in New Issue
Block a user