code style : reduce build compile time about 5s
This commit is contained in:
@@ -19,6 +19,7 @@ import com.zhidao.roadcondition.util.StrategyPreferenceUtil.Companion.getStrateg
|
||||
import com.zhidao.roadcondition.util.StrategyPreferenceUtil.Companion.getStrategyMinSpeed
|
||||
import com.zhidao.roadcondition.util.StrategyPreferenceUtil.Companion.getStrategyType
|
||||
import java.io.File
|
||||
import kotlin.math.abs
|
||||
|
||||
/**
|
||||
* @description 记录仪相关操作
|
||||
@@ -169,16 +170,16 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
// TANLU_ROAD_WORK
|
||||
// )
|
||||
// ) {
|
||||
taskAsync(1_500) {
|
||||
try {
|
||||
// taskAsync(1_500) {
|
||||
// try {
|
||||
// VoiceController.speakVoice("上报失败")
|
||||
// if (isCustom) {
|
||||
// sendGetInfoFailedReceiver(mType)
|
||||
// }
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
// } catch (e: java.lang.Exception) {
|
||||
// e.printStackTrace()
|
||||
// }
|
||||
// }
|
||||
|
||||
//获取图片失败也上报,图片不打点
|
||||
if (isCustom) {
|
||||
@@ -215,19 +216,19 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
return
|
||||
}
|
||||
|
||||
var minSpeedPic =
|
||||
val minSpeedPic =
|
||||
getStrategyMinSpeed(
|
||||
AbsMogoApplication.getApp().applicationContext,
|
||||
"pic",
|
||||
getStrategyType("pic")
|
||||
)
|
||||
var maxSpeedPic =
|
||||
val maxSpeedPic =
|
||||
getStrategyMaxSpeed(
|
||||
AbsMogoApplication.getApp().applicationContext,
|
||||
"pic",
|
||||
getStrategyType("pic")
|
||||
)
|
||||
var speed = LocationUtil.getInstance().getSpeed()
|
||||
val speed = LocationUtil.getInstance().getSpeed()
|
||||
|
||||
if (!TextUtils.isEmpty(mType)) {
|
||||
Log.d(TAG, "onTakePhotoSuccess mType != null")
|
||||
@@ -240,8 +241,8 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
"onTakePhotoSuccess maxSpeedPic = $maxSpeedPic ---> speed = $speed ---->minSpeedPic= $minSpeedPic"
|
||||
)
|
||||
if (maxSpeedPic == -1) {
|
||||
if (speed >= (Math.abs(minSpeedPic) / 3.6f)) {
|
||||
Log.d(TAG, "onTakePhotoSuccess abs =" + (Math.abs(minSpeedPic) / 3.6f))
|
||||
if (speed >= (abs(minSpeedPic) / 3.6f)) {
|
||||
Log.d(TAG, "onTakePhotoSuccess abs =" + (abs(minSpeedPic) / 3.6f))
|
||||
CosStatusController().uploadFile(
|
||||
mutableListOf(photoPath as String),
|
||||
entity,
|
||||
@@ -274,9 +275,9 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
|
||||
//获取视频成功
|
||||
override fun onTakeVideoSuccess(camera: Int, videoPath: String?) {
|
||||
var thumbnailPath =
|
||||
val thumbnailPath =
|
||||
AbsMogoApplication.getApp().applicationContext.filesDir.parent + File.separator + "Thumbnail${System.currentTimeMillis()}.jpg"
|
||||
var isSuccess = getVideoThumbnail(videoPath!!, thumbnailPath)
|
||||
val isSuccess = getVideoThumbnail(videoPath!!, thumbnailPath)
|
||||
Log.d(
|
||||
TAG,
|
||||
"getVideo onTakeVideoSuccess===$videoPath -----> isSuccess= $isSuccess ----> mType = $mType --- mainInfoId = $mainInfoId"
|
||||
@@ -291,39 +292,39 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
}
|
||||
|
||||
if (isSuccess) {
|
||||
var minSpeedVideo = getStrategyMinSpeed(
|
||||
val minSpeedVideo = getStrategyMinSpeed(
|
||||
AbsMogoApplication.getApp().applicationContext, "video",
|
||||
getStrategyType("video")
|
||||
)
|
||||
var maxSpeedVideo = getStrategyMaxSpeed(
|
||||
val maxSpeedVideo = getStrategyMaxSpeed(
|
||||
AbsMogoApplication.getApp().applicationContext, "video",
|
||||
getStrategyType("video")
|
||||
)
|
||||
var speed = LocationUtil.getInstance().getSpeed()
|
||||
val speed = LocationUtil.getInstance().getSpeed()
|
||||
|
||||
entity?.let {
|
||||
if (entity.isCustom) {
|
||||
compressVideo(videoPath, thumbnailPath, entity)
|
||||
if (it.isCustom) {
|
||||
compressVideo(videoPath, thumbnailPath, it)
|
||||
}else if (entity.fromType in STRATEGY_UPLOAD_TYPE_ARRAY) {
|
||||
// 属于策略上报
|
||||
compressVideo(videoPath, thumbnailPath, entity)
|
||||
compressVideo(videoPath, thumbnailPath, it)
|
||||
} 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)) {
|
||||
Log.d(TAG, "onTakeVideoSuccess 111 abs =" + (abs(minSpeedVideo) / 3.6f))
|
||||
if (speed >= (abs(minSpeedVideo) / 3.6f)) {
|
||||
//获取视频以及缩略图成功,开始上报
|
||||
compressVideo(videoPath, thumbnailPath, entity)
|
||||
compressVideo(videoPath, thumbnailPath, it)
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
compressVideo(videoPath, thumbnailPath, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -333,7 +334,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
}
|
||||
}
|
||||
|
||||
var videoAndThumbMap: MutableMap<String, String> = mutableMapOf()
|
||||
private var videoAndThumbMap: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
//获取视频失败
|
||||
override fun onTakeVideoFail(camera: Int) {
|
||||
@@ -377,12 +378,12 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
/**
|
||||
* 压缩视频并且上传
|
||||
*/
|
||||
fun compressVideo(videoPath: String, thumbnailPath: String, entity: TakeEntity) {
|
||||
private fun compressVideo(videoPath: String, thumbnailPath: String, entity: TakeEntity) {
|
||||
Log.d(
|
||||
TAG,
|
||||
"outputVideoPath = " + outputVideoPath + ">> videoPath=" + videoPath + " isCustom = ${entity?.isCustom}"
|
||||
"outputVideoPath = " + outputVideoPath + ">> videoPath=" + videoPath + " isCustom = ${entity.isCustom}"
|
||||
)
|
||||
var startTime = System.currentTimeMillis()
|
||||
val startTime = System.currentTimeMillis()
|
||||
Thread(Runnable {
|
||||
try {
|
||||
VideoProcessor.processor(AbsMogoApplication.getApp().applicationContext)
|
||||
|
||||
@@ -44,7 +44,7 @@ object InformationUploadController {
|
||||
it.cosParameter = cosParameter
|
||||
it.isCustomSend = isCustomSend
|
||||
it.callback = callback
|
||||
tryUploadInformation(it)
|
||||
// tryUploadInformation(it)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ object InformationUploadController {
|
||||
it.informationType = informationType
|
||||
it.newsType = newsType
|
||||
it.operType = operType
|
||||
tryUploadInformation(it)
|
||||
// tryUploadInformation(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ class GuideFragment : MvpFragment<GuideConstract.View, GuidePresenter>(), GuideC
|
||||
adapter = GuideAdapter(this)
|
||||
moduleGuideViewPager.adapter = adapter
|
||||
(moduleGuideViewPager.getChildAt(0) as RecyclerView).layoutManager!!.isItemPrefetchEnabled = false
|
||||
@Suppress("DEPRECATION")
|
||||
moduleGuideIndicator.setSliderColor(context!!.resources.getColor(R.color.module_guide_indicator_dark), context!!.resources.getColor(R.color.module_guide_indicator_white))
|
||||
.setSliderWidth(context!!.resources.getDimension(R.dimen.dp_22))
|
||||
.setSlideMode(IndicatorSlideMode.NORMAL)
|
||||
|
||||
@@ -30,6 +30,7 @@ class GuideStageFiveFragment : MvpFragment<IView, Presenter<IView>> {
|
||||
|
||||
override fun initViews() {
|
||||
if(!DebugConfig.isLauncher()){
|
||||
@Suppress("DEPRECATION")
|
||||
moduleGuidePageFive.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_five)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ class GuideStageFourFragment : MvpFragment<IView, Presenter<IView>> {
|
||||
|
||||
override fun initViews() {
|
||||
if(!DebugConfig.isLauncher()){
|
||||
@Suppress("DEPRECATION")
|
||||
moduleGuidePageFour.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_four)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ class GuideStageOneFragment : MvpFragment<IView, Presenter<IView>> {
|
||||
override fun initViews() {
|
||||
containerFragment?.visibleRight()
|
||||
if(!DebugConfig.isLauncher()){
|
||||
@Suppress("DEPRECATION")
|
||||
moduleGuidePageOne.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_one)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ class GuideStageThreeFragment : MvpFragment<IView, Presenter<IView>> {
|
||||
|
||||
override fun initViews() {
|
||||
if(!DebugConfig.isLauncher()){
|
||||
@Suppress("DEPRECATION")
|
||||
moduleGuidePageThree.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_three)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ class GuideStageTwoFragment : MvpFragment<IView, Presenter<IView>> {
|
||||
|
||||
override fun initViews() {
|
||||
if(!DebugConfig.isLauncher()){
|
||||
@Suppress("DEPRECATION")
|
||||
moduleGuidePageTwo.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_two)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.zhidao.mogo.module.left.panel
|
||||
|
||||
import android.content.Context
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.mogo.module.push.utils
|
||||
|
||||
import android.util.ArrayMap
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.module.push.view
|
||||
|
||||
import android.animation.Animator
|
||||
import android.animation.ObjectAnimator
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.PixelFormat
|
||||
import android.os.Build
|
||||
@@ -87,7 +88,7 @@ class FloatView constructor(
|
||||
}
|
||||
|
||||
private fun turnNextMessage() {
|
||||
pushViewModel?.pushBean?.apply {
|
||||
pushViewModel.pushBean?.apply {
|
||||
showTimeout = 0
|
||||
updateTimer()
|
||||
}
|
||||
@@ -123,17 +124,17 @@ class FloatView constructor(
|
||||
pushTimer.text = if (bean.showTimeout > 99) "" else "${bean.showTimeout}s"
|
||||
|
||||
// image
|
||||
if (bean.imageUrl.isNullOrEmpty() && bean.QRCode.isNullOrEmpty()) {
|
||||
if (bean.imageUrl.isEmpty() && bean.QRCode.isEmpty()) {
|
||||
pushImage.gone()
|
||||
} else if (!bean.imageUrl.isNullOrEmpty()) {
|
||||
var params = pushImage.layoutParams
|
||||
} else if (bean.imageUrl.isNotEmpty()) {
|
||||
val params = pushImage.layoutParams
|
||||
params.width = getImgWidth()
|
||||
params.height = getImgHeight()
|
||||
pushImage.layoutParams = params
|
||||
pushImage.visible()
|
||||
GlideApp.with(this).load(bean.imageUrl).into(pushImage)
|
||||
} else if (!bean.QRCode.isNullOrEmpty()) {
|
||||
var params = pushImage.layoutParams
|
||||
} else if (bean.QRCode.isNotEmpty()) {
|
||||
val params = pushImage.layoutParams
|
||||
params.width = getQrImgWidth()
|
||||
params.height = getQrImgHeight()
|
||||
pushImage.layoutParams = params
|
||||
@@ -167,7 +168,7 @@ class FloatView constructor(
|
||||
}
|
||||
|
||||
// content
|
||||
if (bean.content.isNullOrEmpty()) {
|
||||
if (bean.content.isEmpty()) {
|
||||
pushContent.gone()
|
||||
} else {
|
||||
pushContent.text = bean.content
|
||||
@@ -175,7 +176,7 @@ class FloatView constructor(
|
||||
}
|
||||
|
||||
// tts
|
||||
if (!bean?.tts?.isNullOrEmpty()) {
|
||||
if (bean.tts.isNotEmpty()) {
|
||||
AIAssist.getInstance(context).speakTTSVoice(bean.tts)
|
||||
}
|
||||
}
|
||||
@@ -185,6 +186,7 @@ class FloatView constructor(
|
||||
abstract fun getQrImgWidth(): Int
|
||||
abstract fun getQrImgHeight(): Int
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun timer(time: Int) {
|
||||
Logger.d(TAG, "time = $time")
|
||||
pushTimer.text = "${time}s"
|
||||
@@ -211,7 +213,7 @@ class FloatView constructor(
|
||||
private var topViewStatusListener = object : IMogoTopViewStatusListener {
|
||||
override fun onViewRemoved(view: View?) {
|
||||
isAddWindow = false
|
||||
if (pushViewModel?.pushBean?.showTimeout ?: 0 > 0) {
|
||||
if (pushViewModel.pushBean?.showTimeout ?: 0 > 0) {
|
||||
if (getApis(context).statusManagerApi.isV2XShow) {
|
||||
// 被中断的消息,需要再次被显示一次
|
||||
uiHandler.removeCallbacks(delayClosePush)
|
||||
@@ -332,7 +334,7 @@ class FloatView constructor(
|
||||
|
||||
override fun setBean(bean: PushBean) {
|
||||
super.setBean(bean)
|
||||
var paddingBottom: Int = 0
|
||||
var paddingBottom = 0
|
||||
if (pushButton.isVisible) {
|
||||
paddingBottom =
|
||||
context.resources.getDimensionPixelSize(R.dimen.module_push_content_paddingBottom_vertical)
|
||||
@@ -467,7 +469,7 @@ class FloatView constructor(
|
||||
|
||||
private fun updateTimer() {
|
||||
uiHandler.removeCallbacks(delayClosePush)
|
||||
var time = pushViewModel.pushBean?.showTimeout ?: 0
|
||||
val time = pushViewModel.pushBean?.showTimeout ?: 0
|
||||
if (time > 0) {
|
||||
pushViewModel.pushBean!!.showTimeout--
|
||||
pushViewController?.timer(time)
|
||||
|
||||
@@ -81,7 +81,7 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
}
|
||||
|
||||
override fun onCalculateSuccess() {
|
||||
var calculatedStrategies = SearchApisHolder.getNaviApis().calculatedStrategies
|
||||
val calculatedStrategies = SearchApisHolder.getNaviApis().calculatedStrategies
|
||||
if (calculatedStrategies != null && calculatedStrategies.size > 0) {
|
||||
mAdapter.setDatas(calculatedStrategies)
|
||||
mAdapter.selectTag = calculatedStrategies[0].tagId
|
||||
@@ -143,14 +143,14 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
return R.layout.fragment_search_category
|
||||
}
|
||||
|
||||
var mogoTip: MogoLatLng? = null
|
||||
private var mogoTip: MogoLatLng? = null
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
mogoTip = arguments?.getParcelable<MogoLatLng>(AMapConstants.KEY_PARCELABLE)
|
||||
mogoTip = arguments?.getParcelable(AMapConstants.KEY_PARCELABLE)
|
||||
}
|
||||
|
||||
// 是否开启导航
|
||||
var isStartedNavi = false
|
||||
private var isStartedNavi = false
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
||||
@@ -167,7 +167,7 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
|
||||
SearchApisHolder.getRegisterCenterApis().registerMogoNaviListener(AMapConstants.PATH_FRAGMENT_CHOOSE_PATH, this)
|
||||
|
||||
var arrayList = ArrayList<MogoCalculatePath>()
|
||||
val arrayList = ArrayList<MogoCalculatePath>()
|
||||
mAdapter = CalculatePathAdapter(activity, arrayList)
|
||||
rv_search_result.layoutManager = LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false)
|
||||
|
||||
@@ -185,7 +185,7 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
}
|
||||
|
||||
mAdapter.setOnClickListener {
|
||||
var item = it.getTag(R.id.tag_item) as MogoCalculatePath
|
||||
val item = it.getTag(R.id.tag_item) as MogoCalculatePath
|
||||
selectPath(item)
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
}
|
||||
|
||||
private fun registerRetryVoice() {
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand("retry", arrayOf<String>("重试"), this)
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand("retry", arrayOf("重试"), this)
|
||||
}
|
||||
|
||||
private fun unregisterRetryVoice() {
|
||||
@@ -229,7 +229,7 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
|
||||
private fun selectPath(item: MogoCalculatePath?) {
|
||||
item?.let {
|
||||
mAdapter.setSelectTag(item.tagId)
|
||||
mAdapter.selectTag = item.tagId
|
||||
if (SearchApisHolder.getNaviApis().itemClickInteraction != null) {
|
||||
SearchApisHolder.getNaviApis().itemClickInteraction.onItemClicked(item.tagId)
|
||||
}
|
||||
@@ -265,11 +265,10 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
}
|
||||
|
||||
private fun choosePath(intent: Intent?) {
|
||||
var dataJsonStr = intent?.getStringExtra("data") ?: ""
|
||||
val dataJsonStr = intent?.getStringExtra("data") ?: ""
|
||||
try {
|
||||
var jsonObj = JSONObject(dataJsonStr)
|
||||
var routePlan = jsonObj.optString("route_choice", " ")
|
||||
when (routePlan) {
|
||||
val jsonObj = JSONObject(dataJsonStr)
|
||||
when (jsonObj.optString("route_choice", " ")) {
|
||||
"fastest" -> {
|
||||
// 时间最短
|
||||
selectItem(mTimeShortestPosition)
|
||||
@@ -282,19 +281,18 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmField
|
||||
val TAG: String = "ChoosePathFragment"
|
||||
const val TAG: String = "ChoosePathFragment"
|
||||
|
||||
fun newInstance(searchPoi: MogoLatLng): Fragment {
|
||||
var bundle = Bundle()
|
||||
val bundle = Bundle()
|
||||
bundle.putParcelable(AMapConstants.KEY_PARCELABLE, searchPoi)
|
||||
var choosePathFragment = ChoosePathFragment()
|
||||
val choosePathFragment = ChoosePathFragment()
|
||||
choosePathFragment.arguments = bundle
|
||||
return choosePathFragment
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.mogo.module.share
|
||||
|
||||
import android.content.Context
|
||||
|
||||
@@ -59,6 +59,7 @@ object UploadHelper {
|
||||
} else {
|
||||
// 没网就直接提示失败
|
||||
AIAssist.getInstance(context).speakTTSVoice("分享失败,请检查网络")
|
||||
@Suppress("DEPRECATION")
|
||||
TipToast.tip("分享失败,请检查网络", TipDrawable(context.resources.getDrawable(R.drawable.module_share_upload_fail)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.zhidao.mogo.module.splash
|
||||
|
||||
import android.content.Context
|
||||
|
||||
Reference in New Issue
Block a user