[BadCase]添加入口动画

This commit is contained in:
renwj
2022-02-16 16:55:59 +08:00
parent 8fd0712a03
commit 2b8f45bb10
2 changed files with 30 additions and 11 deletions

View File

@@ -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<MoGoWarningContract.View?, WaringPresenter?>
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<MoGoWarningContract.View?, WaringPresenter?>
}
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<MoGoWarningContract.View?, WaringPresenter?>
}
}
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<MoGoWarningContract.View?, WaringPresenter?>
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<MoGoWarningContract.View?, WaringPresenter?>
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()

View File

@@ -99,8 +99,8 @@
app:layout_goneMarginStart="50px" />
<ViewStub
android:id="@+id/vs_bad_case_entrance"
android:inflatedId="@+id/bad_case_entrance"
android:id="@+id/vsBadCaseToolsView"
android:inflatedId="@+id/badCaseToolsView"
android:layout_width="@dimen/module_hmi_check_size"
android:layout_height="@dimen/module_hmi_check_size"
android:layout_marginStart="25px"