diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/ParallelDriveView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/ParallelDriveView.kt
index 79b85ef6d7..f8168e2b70 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/ParallelDriveView.kt
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/ParallelDriveView.kt
@@ -60,9 +60,11 @@ class ParallelDriveView @JvmOverloads constructor(
private lateinit var rootLayout: ConstraintLayout
private lateinit var statusIcon: ImageView
+ private lateinit var statusIconOuter: ImageView
private lateinit var statusTitle: TextView
private var listener: ClickEventListener? = null
private var animator: ObjectAnimator? = null
+ private var syncAnimator: ObjectAnimator? = null
init {
LayoutInflater.from(context).inflate(R.layout.view_parallel_drive, this, true)
@@ -79,6 +81,7 @@ class ParallelDriveView @JvmOverloads constructor(
private fun initView() {
rootLayout = findViewById(R.id.parDriveLayout)
statusIcon = findViewById(R.id.ivStatusIcon)
+ statusIconOuter = findViewById(R.id.ivStatusProgress)
statusTitle = findViewById(R.id.tvAutopilotContent)
rootLayout.setOnClickListener {
when (state) {
@@ -211,6 +214,8 @@ class ParallelDriveView @JvmOverloads constructor(
when (state) {
0 -> {
stopRotateAnimation()
+ stopSyncAnimation()
+ statusIconOuter.visibility = GONE
rootLayout.isEnabled = true
rootLayout.alpha = 1f
statusIcon.background =
@@ -222,7 +227,9 @@ class ParallelDriveView @JvmOverloads constructor(
}
APP_REQUESTING -> {
+ stopSyncAnimation()
rootLayout.isEnabled = true
+ statusIconOuter.visibility = GONE
rootLayout.alpha = 1f
statusIcon.background =
resources.getDrawable(R.drawable.icon_para_requesting, null)
@@ -234,7 +241,9 @@ class ParallelDriveView @JvmOverloads constructor(
}
AD_REQUESTING -> {
+ stopSyncAnimation()
rootLayout.isEnabled = false
+ statusIconOuter.visibility = GONE
rootLayout.alpha = 1f
statusIcon.background =
resources.getDrawable(R.drawable.icon_para_requesting, null)
@@ -250,15 +259,19 @@ class ParallelDriveView @JvmOverloads constructor(
rootLayout.isEnabled = false
rootLayout.alpha = 1f
statusIcon.background =
- resources.getDrawable(R.drawable.icon_para_syn, null)
+ resources.getDrawable(R.drawable.icon_para_syn_inner, null)
statusTitle.setTextColor(Color.parseColor("#FFFFFF"))
statusIcon.alpha = 1f
+ statusIconOuter.visibility = VISIBLE
+ startSyncAnimation()
statusTitle.text = context.getString(R.string.parallel_drive_synchronizing)
rootLayout.background = resources.getDrawable(R.drawable.bg_auto_pilot, null)
}
PARALLEL_DRIVING -> {
stopRotateAnimation()
+ stopSyncAnimation()
+ statusIconOuter.visibility = GONE
rootLayout.isEnabled = false
rootLayout.alpha = 1f
statusIcon.background =
@@ -272,6 +285,8 @@ class ParallelDriveView @JvmOverloads constructor(
FAILURE -> {
stopRotateAnimation()
+ stopSyncAnimation()
+ statusIconOuter.visibility = GONE
rootLayout.isEnabled = false
rootLayout.alpha = 1f
rootLayout.postDelayed({
@@ -287,6 +302,8 @@ class ParallelDriveView @JvmOverloads constructor(
ONE_EXCEPTION -> {
stopRotateAnimation()
+ stopSyncAnimation()
+ statusIconOuter.visibility = GONE
rootLayout.isEnabled = false
rootLayout.alpha = 1f
rootLayout.postDelayed({
@@ -302,6 +319,8 @@ class ParallelDriveView @JvmOverloads constructor(
TWO_EXCEPTION -> {
stopRotateAnimation()
+ stopSyncAnimation()
+ statusIconOuter.visibility = GONE
rootLayout.isEnabled = false
rootLayout.alpha = 1f
rootLayout.postDelayed({
@@ -317,7 +336,9 @@ class ParallelDriveView @JvmOverloads constructor(
UNAVAILABLE -> {
stopRotateAnimation()
- rootLayout.isEnabled = false
+ stopSyncAnimation()
+ statusIconOuter.visibility = GONE
+ rootLayout.isEnabled = true
rootLayout.alpha = 0.4f
statusIcon.background =
resources.getDrawable(R.drawable.icon_autopilot_status, null)
@@ -391,6 +412,28 @@ class ParallelDriveView @JvmOverloads constructor(
it.cancel()
}
}
+ statusIcon.rotation = 0f
+ }
+
+ @SuppressLint("Recycle")
+ private fun startSyncAnimation() {
+ if (syncAnimator == null) {
+ syncAnimator = ObjectAnimator.ofFloat(statusIconOuter, "rotation", 0f, 360f).apply {
+ duration = 1500
+ repeatMode = ValueAnimator.RESTART
+ repeatCount = ValueAnimator.INFINITE
+ interpolator = LinearInterpolator()
+ }
+ }
+ syncAnimator?.start()
+ }
+
+ private fun stopSyncAnimation() {
+ syncAnimator?.let {
+ if (it.isRunning) {
+ it.cancel()
+ }
+ }
}
override fun onDetachedFromWindow() {
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_parallel_drive.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_parallel_drive.xml
index e6e9048bba..ac8a28b33e 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_parallel_drive.xml
+++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_parallel_drive.xml
@@ -16,6 +16,18 @@
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="72dp"
android:layout_marginTop="56dp"
+ tools:background="@drawable/icon_para_syn_inner"
+ />
+
+