From 2b8f45bb10fa420379a99e825da303089c29637f Mon Sep 17 00:00:00 2001 From: renwj Date: Wed, 16 Feb 2022 16:55:59 +0800 Subject: [PATCH] =?UTF-8?q?[BadCase]=E6=B7=BB=E5=8A=A0=E5=85=A5=E5=8F=A3?= =?UTF-8?q?=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/function/hmi/ui/MoGoHmiFragment.kt | 37 ++++++++++++++----- .../src/main/res/layout/fragment_hmi.xml | 4 +- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index 30b4e0e0d0..878899b6a8 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -10,6 +10,7 @@ import android.view.animation.OvershootInterpolator import androidx.lifecycle.Lifecycle.Event.ON_DESTROY import androidx.lifecycle.LifecycleEventObserver import androidx.lifecycle.lifecycleScope +import androidx.transition.* import com.alibaba.android.arouter.facade.annotation.Route import com.mogo.cloud.passport.MoGoAiCloudClientConfig import com.mogo.commons.mvp.MvpFragment @@ -159,8 +160,13 @@ class MoGoHmiFragment : MvpFragment showBadCaseEntrance(it) } } else { - entrance.takeIf { it.visibility != View.VISIBLE }?.also { - it.visibility = View.VISIBLE + withContext(Dispatchers.Main) { + entrance.takeIf { it.visibility != View.VISIBLE }?.also { + (entrance.parent as? ViewGroup)?.let { g -> + TransitionManager.beginDelayedTransition(g, AutoTransition()) + } + it.visibility = View.VISIBLE + } } Log.d("QQQ", "record: [$old] hasn't been consumed~~~~" ) } @@ -174,7 +180,7 @@ class MoGoHmiFragment : MvpFragment } private val handler by lazy { - Handler(Handler.Callback { + Handler(Handler.Callback { it -> if (it.what == MSG_WHAT_DISMISS_BAD_CASE_ENTRY) { val entrance = autoPilotBadCaseEntrance if (entrance != null && entrance.visibility == View.VISIBLE) { @@ -191,8 +197,13 @@ class MoGoHmiFragment : MvpFragment } } dismissBadCaseFloatView() - entrance.visibility = View.GONE - onBadCaseHide?.invoke() + if (entrance.visibility != View.GONE) { + (entrance.parent as? ViewGroup)?.let { g -> + TransitionManager.beginDelayedTransition(g, AutoTransition()) + } + entrance.visibility = View.GONE + onBadCaseHide?.invoke() + } } return@Callback true } @@ -279,8 +290,8 @@ class MoGoHmiFragment : MvpFragment Log.d("QQQ", "showBadCaseEntrance:$record") lifecycleScope.launch { if (HmiBuildConfig.isShowBadCaseView) { - if (vs_bad_case_entrance?.parent != null) { - val inflateView = vs_bad_case_entrance.inflate() + if (vsBadCaseToolsView?.parent != null) { + val inflateView = vsBadCaseToolsView.inflate() autoPilotBadCaseEntrance = inflateView } } @@ -288,13 +299,21 @@ class MoGoHmiFragment : MvpFragment Log.d("QQQ", "show --- 1 ----") if (entrance != null) { if (entrance.visibility != View.VISIBLE) { + (entrance.parent as? ViewGroup)?.let { g -> + TransitionManager.beginDelayedTransition(g, AutoTransition()) + } entrance.visibility = View.VISIBLE } entrance.setTag(R.id.autopilot_badcase_record, record) entrance.onClick { showBadCasesFloat { - it.visibility = View.GONE - onBadCaseHide?.invoke() + if (it.visibility != View.GONE) { + (entrance.parent as? ViewGroup)?.let { g -> + TransitionManager.beginDelayedTransition(g, AutoTransition()) + } + it.visibility = View.GONE + onBadCaseHide?.invoke() + } } } dismissBadCaseEntryAfterSomeTime() diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml index 1e207d28c8..38032c1436 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml @@ -99,8 +99,8 @@ app:layout_goneMarginStart="50px" />