[2.13.0-arch-opt] thread change to main
This commit is contained in:
@@ -51,6 +51,7 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
|
||||
private var clickListener: ClickListener? = null
|
||||
private var keyBoardUtil: KeyBoardUtil? = null
|
||||
@Volatile
|
||||
private var connectStatus = false
|
||||
private var lastTime = 0L
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ class VersionNameView @JvmOverloads constructor(
|
||||
const val TAG = "VersionNameView"
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var dockerVersion: String? = null //工控机版本
|
||||
|
||||
init{
|
||||
|
||||
@@ -293,11 +293,13 @@ open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
val status = autoPilotStatusInfo.ipcConnStatus
|
||||
if (mLastStatus != status) {
|
||||
val statusInfo = autoPilotStatusInfo.clone()
|
||||
rvConnectInfo.post { updateConnectInfoView(statusInfo) }
|
||||
mLastStatus = status
|
||||
UiThreadHandler.post {
|
||||
val status = autoPilotStatusInfo.ipcConnStatus
|
||||
if (mLastStatus != status) {
|
||||
val statusInfo = autoPilotStatusInfo.clone()
|
||||
rvConnectInfo.post { updateConnectInfoView(statusInfo) }
|
||||
mLastStatus = status
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.widget.RelativeLayout
|
||||
@@ -52,6 +51,7 @@ class SmallMapView @JvmOverloads constructor(
|
||||
private var mContext: Context? = null
|
||||
private var mLocation: MogoLocation? = null
|
||||
|
||||
@Volatile
|
||||
private var autoPilotStatus = 0
|
||||
|
||||
companion object {
|
||||
@@ -216,7 +216,7 @@ class SmallMapView @JvmOverloads constructor(
|
||||
uiSettings?.setAllGesturesEnabled(false) // 所有手势
|
||||
uiSettings?.isMyLocationButtonEnabled = false // 显示默认的定位按钮
|
||||
uiSettings?.setLogoBottomMargin(-150) //设置Logo下边界距离屏幕底部的边距,设置为负值即可
|
||||
mAMap?.setOnMapLoadedListener(AMap.OnMapLoadedListener {
|
||||
mAMap?.setOnMapLoadedListener {
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG,
|
||||
"smp---onMapLoaded"
|
||||
@@ -237,7 +237,7 @@ class SmallMapView @JvmOverloads constructor(
|
||||
mAMapNaviView!!.width / 2,
|
||||
mAMapNaviView!!.height / 2
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun coordinateConverterFrom84(mContext: Context?, mogoLatLng: MogoLatLng): LatLng {
|
||||
@@ -283,36 +283,39 @@ class SmallMapView @JvmOverloads constructor(
|
||||
if (mCarMarker == null) {
|
||||
return
|
||||
}
|
||||
val currentLatLng = LatLng(mLocation!!.latitude, mLocation!!.longitude)
|
||||
val bearing = floor(mLocation!!.heading).toFloat()
|
||||
//更新车辆位置
|
||||
mCarMarker!!.position = currentLatLng
|
||||
if (mCoordinatesLatLng.size > 1) {
|
||||
// 结束位置
|
||||
val endLatLng = mCoordinatesLatLng[mCoordinatesLatLng.size - 1]
|
||||
val calculateDistance = CoordinateUtils.calculateLineDistance(
|
||||
endLatLng.latitude, endLatLng.longitude,
|
||||
currentLatLng.latitude, currentLatLng.longitude
|
||||
)
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG,
|
||||
"calculateDistance=$calculateDistance"
|
||||
)
|
||||
if (calculateDistance <= 5) {
|
||||
UiThreadHandler.post {
|
||||
val currentLatLng = LatLng(mLocation!!.latitude, mLocation!!.longitude)
|
||||
val bearing = floor(mLocation!!.heading).toFloat()
|
||||
//更新车辆位置
|
||||
mCarMarker!!.position = currentLatLng
|
||||
if (mCoordinatesLatLng.size > 1) {
|
||||
// 结束位置
|
||||
val endLatLng = mCoordinatesLatLng[mCoordinatesLatLng.size - 1]
|
||||
val calculateDistance = CoordinateUtils.calculateLineDistance(
|
||||
endLatLng.latitude, endLatLng.longitude,
|
||||
currentLatLng.latitude, currentLatLng.longitude
|
||||
)
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG, "onChassisLocationGCJ02 -----> calculateDistance <= 5 ")
|
||||
clearPolyline()
|
||||
mCoordinatesLatLng.clear()
|
||||
SceneConstant.M_MAP + TAG,
|
||||
"calculateDistance=$calculateDistance"
|
||||
)
|
||||
if (calculateDistance <= 5) {
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG, "onChassisLocationGCJ02 -----> calculateDistance <= 5 ")
|
||||
clearPolyline()
|
||||
mCoordinatesLatLng.clear()
|
||||
}
|
||||
}
|
||||
val cameraPosition: CameraPosition =
|
||||
CameraPosition.Builder()
|
||||
.target(mCarMarker!!.position)
|
||||
.tilt(0f)
|
||||
.bearing(bearing)
|
||||
.zoom(zoomLevel.toFloat())
|
||||
.build()
|
||||
mAMap?.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
|
||||
}
|
||||
val cameraPosition: CameraPosition =
|
||||
CameraPosition.Builder()
|
||||
.target(mCarMarker!!.position)
|
||||
.tilt(0f)
|
||||
.bearing(bearing)
|
||||
.zoom(zoomLevel.toFloat())
|
||||
.build()
|
||||
mAMap?.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
|
||||
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
|
||||
Reference in New Issue
Block a user