[6.0.0] roam change
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.text.Html
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.function.api.map.roma.IMoGoRomaListener
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRomaListener
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import kotlinx.android.synthetic.main.view_roma_distance.view.*
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
class RomaDistanceView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr) , IMoGoRomaListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "RomaDistanceView"
|
||||
}
|
||||
|
||||
private var disChangeColor = false
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_roma_distance, this, true)
|
||||
val a = context.obtainStyledAttributes(
|
||||
attrs,
|
||||
R.styleable.RomaDistanceView,
|
||||
defStyleAttr,
|
||||
0
|
||||
)
|
||||
// val distanceBg = a.getResourceId(R.styleable.RomaDistanceView_roma_distance_bg,0)
|
||||
// if(distanceBg != 0){
|
||||
// romaDistanceBg.background = resources.getDrawable(distanceBg)
|
||||
// }
|
||||
val txtSize = a.getInteger(R.styleable.RomaDistanceView_roma_txt_size,35)
|
||||
romaDistanceMeter.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
AutoSizeUtils.dp2px(getContext(),txtSize.toFloat()).toFloat())
|
||||
val txtDisColor = a.getBoolean(R.styleable.RomaDistanceView_roma_change_dis_color,false)
|
||||
disChangeColor = txtDisColor
|
||||
a.recycle()
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerMapRomaListener.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun romaStatus(status: Boolean) {
|
||||
super.romaStatus(status)
|
||||
if (status) {
|
||||
romaDistanceBg.visibility = View.VISIBLE
|
||||
} else {
|
||||
romaDistanceBg.visibility = View.GONE
|
||||
romaDistanceMeter.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
override fun romaDistance(distance: String) {
|
||||
super.romaDistance(distance)
|
||||
val dis = distance.toDouble().toInt()
|
||||
Log.i(TAG, "romaDistance:$distance")
|
||||
if(disChangeColor){
|
||||
romaDistanceMeter.text = Html.fromHtml("漫游距离<font color='#0752C3'>${dis}米</font>")
|
||||
}else{
|
||||
romaDistanceMeter.text = "漫游距离${dis}米"
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerMapRomaListener.removeListener(TAG)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:drawable="@drawable/roma_distance_bg"
|
||||
android:width="@dimen/dp_334"
|
||||
android:height="@dimen/dp_120"/>
|
||||
</layer-list >
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/romaDistanceBg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/romaDistanceMeter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:textStyle="bold"
|
||||
android:textSize="@dimen/dp_35"
|
||||
android:textColor="@android:color/white"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -102,4 +102,10 @@
|
||||
<attr name="roma_close_bg" format="reference"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="RomaDistanceView">
|
||||
<attr name="roma_distance_bg" format="reference"/>
|
||||
<attr name="roma_txt_size" format="reference"/>
|
||||
<attr name="roma_change_dis_color" format="boolean"/>
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
@@ -54,7 +54,7 @@ class AiCloudIdentifyDataManager : IMoGoPlanningRottingListener,
|
||||
private const val H_ERROR_MAP = 2
|
||||
private const val H_DELAY_TIME = 3_000L
|
||||
|
||||
var START_METRE = 3
|
||||
var START_METRE = 200
|
||||
var END_METRE = 2000
|
||||
|
||||
@JvmStatic
|
||||
@@ -163,12 +163,14 @@ class AiCloudIdentifyDataManager : IMoGoPlanningRottingListener,
|
||||
}
|
||||
|
||||
private fun openRoma() {
|
||||
CallerMapUIServiceManager.getMapUIController()?.visualAngleLock(true)
|
||||
updateLongSightLevel(true)
|
||||
requestRangeOfIdentify(true)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
private fun closeRoma(manual: Boolean = true) {
|
||||
CallerMapUIServiceManager.getMapUIController()?.visualAngleLock(false)
|
||||
updateLongSightLevel(false)
|
||||
requestRangeOfIdentify(false)
|
||||
MapIdentifySubscriber.instance.clearAiCloudRoma()
|
||||
@@ -258,11 +260,14 @@ class AiCloudIdentifyDataManager : IMoGoPlanningRottingListener,
|
||||
mutableMapOf("romaStart" to "地图漫游动画结束,开始漫游")
|
||||
)
|
||||
showAiCloud.set(true)
|
||||
FunctionBuildConfig.isDrawIdentifyData = false
|
||||
// FunctionBuildConfig.isDrawIdentifyData = false
|
||||
CallerMapRomaListener.invokeMapRoma(true)
|
||||
// 5秒没有触发 则预警日志写入
|
||||
handler.sendEmptyMessageDelayed(H_ERROR_CLOUD, H_DELAY_TIME)
|
||||
}
|
||||
5 -> {
|
||||
CallerMapRomaListener.invokeRomaDistance(msg)
|
||||
}
|
||||
1 -> {
|
||||
val m = Message.obtain()
|
||||
m.what = H_ERROR_MAP
|
||||
@@ -294,7 +299,7 @@ class AiCloudIdentifyDataManager : IMoGoPlanningRottingListener,
|
||||
showAiCloud.set(false)
|
||||
aiCloudDataChange.set(false)
|
||||
MapIdentifySubscriber.instance.clearAiCloudRoma()
|
||||
FunctionBuildConfig.isDrawIdentifyData = true
|
||||
// FunctionBuildConfig.isDrawIdentifyData = true
|
||||
CallerMapRomaListener.invokeMapRoma(false)
|
||||
if (invokeCloud) {
|
||||
closeRoma(false)
|
||||
|
||||
Reference in New Issue
Block a user