[6.7.0] fix cherry pick 6.6.2
This commit is contained in:
@@ -25,6 +25,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.map.MogoData
|
||||
@@ -118,14 +119,15 @@ class CarInfoTabView @JvmOverloads constructor(
|
||||
if (isHDCached) { // 已缓存
|
||||
ToastUtils.showShort(resources.getString(R.string.offline_had_downloaded))
|
||||
} else {// 未缓存
|
||||
if(!NetworkUtils.isConnected(context)){
|
||||
ToastUtils.showShort(resources.getString(R.string.offline_update_tip))
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (CallerMapUIServiceManager.getCityCode().isNullOrEmpty()) {// 未拿到高德的cityCode
|
||||
if ((CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude <= 0.0 && CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude <= 0.0)) {// 未拿到高精的经纬度
|
||||
ToastUtils.showShort(resources.getString(R.string.location_try_again))
|
||||
} else { // 拿到了高精的经纬度
|
||||
val dialog = OfflineMapDialog(context)
|
||||
dialog.location =
|
||||
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||
dialog.show()
|
||||
OfflineMapDialog(context).show()
|
||||
}
|
||||
} else {// 拿到高德的cityCode
|
||||
OfflineMapDialog(context).show()
|
||||
|
||||
@@ -269,6 +269,7 @@ import kotlinx.android.synthetic.main.view_debug_setting.view.tvCurEnv
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvDriverServerStartupStatus
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvGearInfo
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvGitBranchInfo
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvHDCityCode
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvIPCMac
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvIdentifyInfo
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvIdentifyInfoCopy
|
||||
@@ -2254,6 +2255,11 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}"
|
||||
)
|
||||
|
||||
val cityCode = mogoMapData.get()?.getCityCode()
|
||||
cityCode?.let {
|
||||
tvHDCityCode.text = "$it"
|
||||
}
|
||||
|
||||
tvObuConnectStatus.text = Html.fromHtml(
|
||||
"OBU连接状态:${
|
||||
if (AppConfigInfo.isConnectObu) {
|
||||
|
||||
@@ -2,24 +2,19 @@ package com.mogo.eagle.core.function.hmi.ui.tools
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.RectF
|
||||
import android.graphics.drawable.ClipDrawable
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.utils.HmiActionLog.Companion.hmiAction
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.map.MogoData.Companion.mogoMapData
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
@@ -29,7 +24,7 @@ import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
*/
|
||||
class OfflineMapDialog(context: Context) : BaseFloatDialog(context) {
|
||||
|
||||
companion object{
|
||||
companion object {
|
||||
private const val TAG = "OfflineMapDialog"
|
||||
}
|
||||
|
||||
@@ -44,11 +39,14 @@ class OfflineMapDialog(context: Context) : BaseFloatDialog(context) {
|
||||
private var downloadPercentView: TextView? = null
|
||||
private var downloadResultImg: ImageView? = null
|
||||
|
||||
@Volatile
|
||||
private var isLoading = false
|
||||
private var isConfirm = true
|
||||
private var isRetry = false
|
||||
|
||||
var location: MogoLocation? = null
|
||||
@Volatile
|
||||
private var isConfirm = true
|
||||
|
||||
@Volatile
|
||||
private var isRetry = false
|
||||
|
||||
init {
|
||||
setContentView(R.layout.dialog_offline_map)
|
||||
@@ -73,6 +71,7 @@ class OfflineMapDialog(context: Context) : BaseFloatDialog(context) {
|
||||
showNewContent(isLoading = true, false)
|
||||
cacheHDOfflineData()
|
||||
}
|
||||
|
||||
else -> {
|
||||
dismiss()
|
||||
}
|
||||
@@ -85,6 +84,7 @@ class OfflineMapDialog(context: Context) : BaseFloatDialog(context) {
|
||||
showNewContent(isLoading = true, false)
|
||||
cacheHDOfflineData()
|
||||
}
|
||||
|
||||
else -> {
|
||||
dismiss()
|
||||
}
|
||||
@@ -100,21 +100,31 @@ class OfflineMapDialog(context: Context) : BaseFloatDialog(context) {
|
||||
}
|
||||
|
||||
private fun cacheHDDataByCityByLonLat() {
|
||||
mogoMapData.get()?.cacheHDDataByCityByLonLat(location!!, { _, progress ->
|
||||
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||
hmiAction(
|
||||
"$M_HMI$TAG",
|
||||
mapOf("click" to "cacheHDOfflineData", "hasLoc" to loc)
|
||||
)
|
||||
if (loc.longitude > 0 && loc.latitude > 0) {
|
||||
mogoMapData.get()?.cacheHDDataByCityByLonLat(loc, { _, progress ->
|
||||
updateProgress(progress.toInt())
|
||||
}, { _, state ->
|
||||
if (state == 0) {// 失败
|
||||
showNewContent(isLoading = false, false)
|
||||
}
|
||||
})
|
||||
}, { _, state ->
|
||||
if (state == 0) {// 失败
|
||||
showNewContent(isLoading = false, false)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
showNewContent(isLoading = false, false)
|
||||
}
|
||||
}
|
||||
|
||||
private fun cacheHDOfflineData() {
|
||||
hmiAction(
|
||||
"$M_HMI$TAG",
|
||||
mapOf("click" to "cacheHDOfflineData","hasLoc" to (location != null))
|
||||
)
|
||||
if (location == null) {// 拿到了高德地图的cityCode
|
||||
val cityCode = mogoMapData.get()?.getCityCode()
|
||||
if (cityCode != null) {// 拿到了高德地图的cityCode
|
||||
hmiAction(
|
||||
"$M_HMI$TAG",
|
||||
mapOf("click" to "cacheHDOfflineData", "hasCityCode" to cityCode)
|
||||
)
|
||||
mogoMapData.get()?.cacheHDDataByCity({ _, progress ->
|
||||
updateProgress(progress.toInt())
|
||||
}, { _, state ->
|
||||
@@ -125,6 +135,7 @@ class OfflineMapDialog(context: Context) : BaseFloatDialog(context) {
|
||||
} else {// 只拿到了高精的经纬度
|
||||
cacheHDDataByCityByLonLat()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +145,10 @@ class OfflineMapDialog(context: Context) : BaseFloatDialog(context) {
|
||||
progressBar?.let {
|
||||
if (it.visibility == View.VISIBLE) {
|
||||
it.progress = if (progress in 1..5) 5 else progress
|
||||
val p = AutoSizeUtils.dp2px(context, 770f) * (it.progress / 100.0) - AutoSizeUtils.dp2px(context, 30f)
|
||||
val p = AutoSizeUtils.dp2px(
|
||||
context,
|
||||
770f
|
||||
) * (it.progress / 100.0) - AutoSizeUtils.dp2px(context, 30f)
|
||||
CallerLogger.i("$M_HMI$TAG", "updateProgress: $p , pro:${it.progress}")
|
||||
downloadPercentView?.translationX = p.toFloat()
|
||||
downloadPercentView?.text = "${it.progress}%"
|
||||
@@ -160,50 +174,54 @@ class OfflineMapDialog(context: Context) : BaseFloatDialog(context) {
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
private fun showNewContent(isLoading: Boolean, isSuccess: Boolean) {
|
||||
this.isLoading = isLoading
|
||||
change2NewStyle()
|
||||
when {
|
||||
isLoading -> {
|
||||
downloadResultImg?.visibility = View.GONE
|
||||
offlineTitleView?.visibility = View.GONE
|
||||
downloadingTip?.visibility = View.VISIBLE
|
||||
okView?.text = context.resources.getString(R.string.cancel)
|
||||
}
|
||||
else -> {
|
||||
when {
|
||||
isSuccess -> {
|
||||
okView?.visibility = View.VISIBLE
|
||||
okView?.text = context.resources.getString(R.string.ok_tip)
|
||||
offlineTitleView?.visibility = View.VISIBLE
|
||||
offlineTitleView?.text =
|
||||
context.resources.getString(R.string.offline_download_success)
|
||||
progressBar?.visibility = View.GONE
|
||||
downloadPercentView?.visibility = View.GONE
|
||||
downloadingTip?.visibility = View.GONE
|
||||
downloadResultImg?.visibility = View.VISIBLE
|
||||
downloadResultImg?.setImageDrawable(context.resources.getDrawable(R.drawable.icon_map_cache_success))
|
||||
hmiAction("$M_HMI$TAG", mapOf("cacheMap" to true))
|
||||
}
|
||||
else -> {
|
||||
isRetry = true
|
||||
isConfirm = false
|
||||
offlineTitleView?.visibility = View.VISIBLE
|
||||
offlineTitleView?.text =
|
||||
context.resources.getString(R.string.offline_download_failure)
|
||||
okView?.visibility = View.GONE
|
||||
progressBar?.visibility = View.GONE
|
||||
downloadPercentView?.visibility = View.GONE
|
||||
downloadingTip?.visibility = View.GONE
|
||||
leftView?.visibility = View.VISIBLE
|
||||
leftView?.text = context.resources.getString(R.string.ok_tip)
|
||||
rightView?.visibility = View.VISIBLE
|
||||
rightView?.text = context.resources.getString(R.string.retry)
|
||||
downloadResultImg?.visibility = View.VISIBLE
|
||||
downloadResultImg?.setImageDrawable(context.resources.getDrawable(R.drawable.icon_map_cache_failed))
|
||||
hmiAction("$M_HMI$TAG", mapOf("cacheMap" to false))
|
||||
UiThreadHandler.post({
|
||||
this.isLoading = isLoading
|
||||
change2NewStyle()
|
||||
when {
|
||||
isLoading -> {
|
||||
downloadResultImg?.visibility = View.GONE
|
||||
offlineTitleView?.visibility = View.GONE
|
||||
downloadingTip?.visibility = View.VISIBLE
|
||||
okView?.text = context.resources.getString(R.string.cancel)
|
||||
}
|
||||
|
||||
else -> {
|
||||
when {
|
||||
isSuccess -> {
|
||||
okView?.visibility = View.VISIBLE
|
||||
okView?.text = context.resources.getString(R.string.ok_tip)
|
||||
offlineTitleView?.visibility = View.VISIBLE
|
||||
offlineTitleView?.text =
|
||||
context.resources.getString(R.string.offline_download_success)
|
||||
progressBar?.visibility = View.GONE
|
||||
downloadPercentView?.visibility = View.GONE
|
||||
downloadingTip?.visibility = View.GONE
|
||||
downloadResultImg?.visibility = View.VISIBLE
|
||||
downloadResultImg?.setImageDrawable(context.resources.getDrawable(R.drawable.icon_map_cache_success))
|
||||
hmiAction("$M_HMI$TAG", mapOf("cacheMap" to true))
|
||||
}
|
||||
|
||||
else -> {
|
||||
isRetry = true
|
||||
isConfirm = false
|
||||
offlineTitleView?.visibility = View.VISIBLE
|
||||
offlineTitleView?.text =
|
||||
context.resources.getString(R.string.offline_download_failure)
|
||||
okView?.visibility = View.GONE
|
||||
progressBar?.visibility = View.GONE
|
||||
downloadPercentView?.visibility = View.GONE
|
||||
downloadingTip?.visibility = View.GONE
|
||||
leftView?.visibility = View.VISIBLE
|
||||
leftView?.text = context.resources.getString(R.string.ok_tip)
|
||||
rightView?.visibility = View.VISIBLE
|
||||
rightView?.text = context.resources.getString(R.string.retry)
|
||||
downloadResultImg?.visibility = View.VISIBLE
|
||||
downloadResultImg?.setImageDrawable(context.resources.getDrawable(R.drawable.icon_map_cache_failed))
|
||||
hmiAction("$M_HMI$TAG", mapOf("cacheMap" to false))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
@@ -145,13 +145,15 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
if (isHDCached) {// 已缓存
|
||||
ToastUtils.showShort(resources.getString(R.string.offline_had_downloaded))
|
||||
} else {// 未缓存
|
||||
if(!NetworkUtils.isConnected(context)){
|
||||
ToastUtils.showShort(resources.getString(R.string.offline_update_tip))
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (CallerMapUIServiceManager.getCityCode().isNullOrEmpty()) {// 未拿到高德的cityCode
|
||||
if ((getChassisLocationWGS84().longitude <= 0.0 && getChassisLocationWGS84().latitude <= 0.0)) {// 未拿到高精的经纬度
|
||||
ToastUtils.showShort(resources.getString(R.string.location_try_again))
|
||||
} else {// 拿到了高精的经纬度
|
||||
val dialog = OfflineMapDialog(context)
|
||||
dialog.location = getChassisLocationWGS84()
|
||||
dialog.show()
|
||||
OfflineMapDialog(context).show()
|
||||
}
|
||||
} else {// 拿到高德的cityCode
|
||||
OfflineMapDialog(context).show()
|
||||
|
||||
@@ -618,6 +618,17 @@
|
||||
android:layout_height="1dp"
|
||||
android:background="#F0F0F0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvHDCityCode"
|
||||
style="@style/DebugSettingText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#F0F0F0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvObuConnectStatus"
|
||||
style="@style/DebugSettingText"
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
<string name="offline_download_success">离线地图下载成功</string>
|
||||
<string name="offline_download_failure">离线地图下载失败</string>
|
||||
<string name="offline_had_downloaded">当前已为最新版本</string>
|
||||
<string name="offline_update_tip">请检查网络连接是否正常</string>
|
||||
<string name="location_try_again">请检查定位是否正常</string>
|
||||
<string name="ok_tip">确定</string>
|
||||
<string name="retry">重试</string>
|
||||
|
||||
Reference in New Issue
Block a user