[6.5.0] fix ui problem of anim and remove day night logic in mapview
This commit is contained in:
@@ -9,10 +9,8 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig.accThreshold
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
|
||||
import com.mogo.map.MogoMap
|
||||
@@ -26,7 +24,6 @@ import kotlin.properties.Delegates
|
||||
|
||||
|
||||
class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context, attrs),
|
||||
IMoGoSkinModeChangeListener,
|
||||
IMoGoChassisLocationWGS84Listener, IMoGoChassisLamplightListener, LifecycleObserver {
|
||||
|
||||
companion object {
|
||||
@@ -37,8 +34,7 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
|
||||
super.onCreate(bundle)
|
||||
map?.uiController?.showMyLocation(true)
|
||||
initMapView()
|
||||
CallerSkinModeListenerManager.addListener(TAG, this)
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(TAG, 20,this)
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(TAG, 20, this)
|
||||
CallerChassisLamplightListenerManager.addListener(TAG, this)
|
||||
|
||||
}
|
||||
@@ -68,15 +64,15 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
|
||||
return MogoMap.DEFAULT
|
||||
}
|
||||
|
||||
fun getUI(): IMogoMapUIController? {
|
||||
fun getUI(): IMogoMapUIController? {
|
||||
return map?.uiController
|
||||
}
|
||||
|
||||
fun addLine(options:Polyline.Options): IMapPolylineOverlay? {
|
||||
fun addLine(options: Polyline.Options): IMapPolylineOverlay? {
|
||||
return map?.addLine(options)
|
||||
}
|
||||
|
||||
fun addPoint(options: Point.Options): IMapPointOverlay?{
|
||||
fun addPoint(options: Point.Options): IMapPointOverlay? {
|
||||
return map?.addPoint(options)
|
||||
}
|
||||
|
||||
@@ -92,22 +88,14 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
if (skinMode == 0) {
|
||||
getUI()?.stepInDayMode(false)
|
||||
} else if (skinMode == 1) {
|
||||
getUI()?.stepInDayMode(true)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置车辆灯光状态 true 刹车, false 正常
|
||||
*/
|
||||
private var accLimit : Boolean by Delegates.observable(false){ _, oldV, newV ->
|
||||
if(oldV != newV){
|
||||
if(newV){
|
||||
private var accLimit: Boolean by Delegates.observable(false) { _, oldV, newV ->
|
||||
if (oldV != newV) {
|
||||
if (newV) {
|
||||
turn(4)
|
||||
}else{
|
||||
} else {
|
||||
turn(0)
|
||||
}
|
||||
}
|
||||
@@ -119,7 +107,7 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
|
||||
accLimit = gnssInfo.acceleration < accThreshold
|
||||
}
|
||||
|
||||
private var currentLevel:Int = 0
|
||||
private var currentLevel: Int = 0
|
||||
|
||||
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
|
||||
super.onAutopilotLightSwitchData(lightSwitch)
|
||||
@@ -128,9 +116,11 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
|
||||
Chassis.LightSwitch.LIGHT_LEFT_VALUE -> { //左转灯
|
||||
turn(1)
|
||||
}
|
||||
|
||||
Chassis.LightSwitch.LIGHT_RIGHT_VALUE -> { //右转灯
|
||||
turn(2)
|
||||
}
|
||||
|
||||
Chassis.LightSwitch.LIGHT_NONE_VALUE -> {
|
||||
turn(0)
|
||||
}
|
||||
@@ -147,7 +137,6 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
|
||||
|
||||
override fun onDestroy() {
|
||||
// 先取消注册数据,再onDestroy
|
||||
CallerSkinModeListenerManager.removeListener(TAG)
|
||||
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
|
||||
CallerChassisLamplightListenerManager.removeListener(TAG)
|
||||
super.onDestroy()
|
||||
|
||||
@@ -7,10 +7,8 @@ import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.LifecycleObserver
|
||||
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
|
||||
import com.mogo.map.MogoMap.Companion.MAP_ROAM
|
||||
import com.mogo.map.MogoMapView
|
||||
@@ -19,7 +17,6 @@ import com.mogo.map.uicontroller.VisualAngleMode
|
||||
|
||||
|
||||
class MapRoamView(context: Context?, attrs: AttributeSet?) : MogoMapView(context, attrs),
|
||||
IMoGoSkinModeChangeListener,
|
||||
LifecycleObserver, IMoGoMapRoadListener {
|
||||
|
||||
companion object {
|
||||
@@ -33,7 +30,6 @@ class MapRoamView(context: Context?, attrs: AttributeSet?) : MogoMapView(context
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
initMapView()
|
||||
CallerSkinModeListenerManager.addListener(TAG, this)
|
||||
CallerMapRoadListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
@@ -72,14 +68,6 @@ class MapRoamView(context: Context?, attrs: AttributeSet?) : MogoMapView(context
|
||||
return map?.uiController
|
||||
}
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
if (skinMode == 0) {
|
||||
getUI()?.stepInDayMode(false)
|
||||
} else if (skinMode == 1) {
|
||||
getUI()?.stepInDayMode(true)
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("ObsoleteSdkInt")
|
||||
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
||||
super.onSizeChanged(w, h, oldw, oldh)
|
||||
@@ -111,7 +99,6 @@ class MapRoamView(context: Context?, attrs: AttributeSet?) : MogoMapView(context
|
||||
|
||||
override fun onDestroy() {
|
||||
// 先取消注册数据,再onDestroy
|
||||
CallerSkinModeListenerManager.removeListener(TAG)
|
||||
CallerMapRoadListenerManager.removeListener(TAG)
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.mogo.eagle.core.function.map.R
|
||||
import kotlin.random.Random
|
||||
|
||||
|
||||
class RoadCrossRoamListAdapter(private val mContext: Context) : RecyclerView.Adapter<RoadCrossRoamListAdapter.ViewHolder>() {
|
||||
class RoadCrossRoamListAdapter(private val mContext: Context, private val lightMode: Boolean) : RecyclerView.Adapter<RoadCrossRoamListAdapter.ViewHolder>() {
|
||||
|
||||
private val items: MutableList<String> = mutableListOf()
|
||||
|
||||
@@ -35,6 +35,11 @@ class RoadCrossRoamListAdapter(private val mContext: Context) : RecyclerView.Ad
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val item = items[position]
|
||||
if(lightMode){
|
||||
holder.textView.setTextColor(mContext.getColor(R.color.color_191A1C))
|
||||
}else{
|
||||
holder.textView.setTextColor(mContext.getColor(R.color.white))
|
||||
}
|
||||
holder.textView.text = item
|
||||
// 随机决定是否显示ProgressBar
|
||||
// if (Random.nextBoolean()) { // 50%的几率显示ProgressBar
|
||||
|
||||
@@ -8,6 +8,9 @@ import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.animation.Animation
|
||||
import android.view.animation.AnimationUtils
|
||||
import android.view.animation.LinearInterpolator
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
@@ -21,8 +24,11 @@ import kotlinx.android.synthetic.main.view_road_cross_roam.view.ivCoverRoam
|
||||
import kotlinx.android.synthetic.main.view_road_cross_roam.view.ivRoadRoamClose
|
||||
import kotlinx.android.synthetic.main.view_road_cross_roam.view.lvRoadCrossRoamTip
|
||||
import kotlinx.android.synthetic.main.view_road_cross_roam.view.mapRoamView
|
||||
import kotlinx.android.synthetic.main.view_road_cross_roam_light.view.ivZhiRoadRoamView
|
||||
import kotlinx.android.synthetic.main.view_road_cross_roam_light.view.tvRoadRoamTitle
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
|
||||
class RoadCrossRoamView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
@@ -40,12 +46,13 @@ class RoadCrossRoamView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private var animator: ObjectAnimator? = null
|
||||
private var lightMode = CallerSkinModeListenerManager.getMode() == 1
|
||||
|
||||
init {
|
||||
val res = when (CallerSkinModeListenerManager.getMode()) {
|
||||
0 -> R.layout.view_road_cross_roam
|
||||
1 -> R.layout.view_road_cross_roam_light
|
||||
else -> R.layout.view_road_cross_roam
|
||||
val res = if (lightMode) {
|
||||
R.layout.view_road_cross_roam_light
|
||||
} else {
|
||||
R.layout.view_road_cross_roam
|
||||
}
|
||||
LayoutInflater.from(context).inflate(res, this, true)
|
||||
lvRoadCrossRoamTip.layoutManager = LinearLayoutManager(context)
|
||||
@@ -84,14 +91,15 @@ class RoadCrossRoamView @JvmOverloads constructor(
|
||||
override fun onStopLineInfo(info: StopLine) {
|
||||
super.onStopLineInfo(info)
|
||||
showState = info.distance < 200 && info.distance > 100
|
||||
Log.i("emArrow","showState $showState , distance:${info.distance}")
|
||||
Log.i("emArrow", "showState $showState , distance:${info.distance}")
|
||||
}
|
||||
|
||||
private fun attachView() {
|
||||
this.visibility = View.VISIBLE
|
||||
ivZhiRoadRoamView.visibility = View.VISIBLE
|
||||
mapRoamView.visibility = View.VISIBLE
|
||||
mapRoamView.openRoam()
|
||||
lvRoadCrossRoamTip.adapter = RoadCrossRoamListAdapter(context)
|
||||
lvRoadCrossRoamTip.adapter = RoadCrossRoamListAdapter(context, lightMode)
|
||||
// 创建横向移动的动画
|
||||
if (animator == null) {
|
||||
animator =
|
||||
@@ -106,6 +114,22 @@ class RoadCrossRoamView @JvmOverloads constructor(
|
||||
animator?.repeatCount = ValueAnimator.INFINITE // 设置动画无限重复
|
||||
animator?.repeatMode = ValueAnimator.RESTART // 设置动画来回移动
|
||||
animator?.start()
|
||||
|
||||
if (lightMode) {
|
||||
// val rotateAnimation: Animation = AnimationUtils.loadAnimation(
|
||||
// context, R.anim.anim_road_cross_roam
|
||||
// )
|
||||
// ivZhiRoadRoamView.startAnimation(rotateAnimation)
|
||||
val rotationAnim = ObjectAnimator.ofFloat(ivZhiRoadRoamView, "rotation", 0f, 360f)
|
||||
rotationAnim.repeatCount = ValueAnimator.INFINITE
|
||||
rotationAnim.repeatMode = ValueAnimator.RESTART
|
||||
rotationAnim.duration = 1000
|
||||
rotationAnim.interpolator = LinearInterpolator()
|
||||
rotationAnim.start()
|
||||
tvRoadRoamTitle.setTextColor(context.getColor(R.color.color_131415))
|
||||
} else {
|
||||
tvRoadRoamTitle.setTextColor(context.getColor(R.color.white))
|
||||
}
|
||||
}
|
||||
|
||||
private fun detachView() {
|
||||
@@ -113,12 +137,18 @@ class RoadCrossRoamView @JvmOverloads constructor(
|
||||
mapRoamView.visibility = View.GONE
|
||||
lvRoadCrossRoamTip.adapter = null
|
||||
animator?.cancel()
|
||||
if(lightMode){
|
||||
ivZhiRoadRoamView.clearAnimation()
|
||||
}
|
||||
this.visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
animator?.cancel()
|
||||
if(lightMode){
|
||||
ivZhiRoadRoamView.clearAnimation()
|
||||
}
|
||||
CallerMapRoadListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:drawable="@drawable/anim_road_roam"
|
||||
android:duration="1000"
|
||||
android:fromDegrees="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%"
|
||||
android:repeatCount="infinite"
|
||||
android:repeatMode="restart"
|
||||
android:toDegrees="360" />
|
||||
@@ -8,15 +8,14 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivRoadRoamClose"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:src="@drawable/bg_close_nor_light"
|
||||
android:padding="@dimen/dp_30"
|
||||
android:layout_width="@dimen/dp_60"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
android:scaleType="center"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:src="@drawable/bg_close_nor_light"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
@@ -36,12 +35,13 @@
|
||||
android:layout_height="@dimen/dp_84"
|
||||
android:layout_marginStart="@dimen/dp_24"
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
android:background="@drawable/anim_road_cross_roam"
|
||||
android:background="@drawable/anim_road_roam"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvRoadRoamTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
@@ -57,15 +57,17 @@
|
||||
android:layout_width="@dimen/dp_540"
|
||||
android:layout_height="@dimen/dp_300"
|
||||
android:layout_marginTop="@dimen/dp_160"
|
||||
app:isWeatherEnable="true"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:styleMode="MAP_STYLE_DAY_VR_TAXI" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="@dimen/dp_540"
|
||||
android:layout_height="@dimen/dp_300"
|
||||
android:layout_marginTop="@dimen/dp_160"
|
||||
android:layout_marginStart="@dimen/dp_26"
|
||||
android:layout_marginTop="@dimen/dp_160"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
@@ -73,9 +75,9 @@
|
||||
android:id="@+id/ivCoverRoam"
|
||||
android:layout_width="@dimen/dp_120"
|
||||
android:layout_height="@dimen/dp_300"
|
||||
android:src="@drawable/icon_cover_road_roam"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:src="@drawable/icon_cover_road_roam"
|
||||
tools:ignore="ContentDescription" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -83,8 +85,8 @@
|
||||
android:id="@+id/lvRoadCrossRoamTip"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_200"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:layout_marginLeft="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:layout_marginRight="@dimen/dp_30"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
|
||||
Reference in New Issue
Block a user