From 597e719da15aef6b251121b511bc903c203ec075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Hu=CC=88sers?= Date: Fri, 22 Sep 2023 14:23:18 +0200 Subject: [PATCH] chore: Improve animation of data broker mode --- .../testapp/databroker/view/DataBrokerView.kt | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/app/src/main/kotlin/org/eclipse/kuksa/testapp/databroker/view/DataBrokerView.kt b/app/src/main/kotlin/org/eclipse/kuksa/testapp/databroker/view/DataBrokerView.kt index 8323315f..b994ffff 100644 --- a/app/src/main/kotlin/org/eclipse/kuksa/testapp/databroker/view/DataBrokerView.kt +++ b/app/src/main/kotlin/org/eclipse/kuksa/testapp/databroker/view/DataBrokerView.kt @@ -22,8 +22,6 @@ package org.eclipse.kuksa.testapp.databroker.view import android.app.Application import androidx.compose.animation.AnimatedContent import androidx.compose.animation.AnimatedVisibility -import androidx.compose.animation.fadeIn -import androidx.compose.animation.fadeOut import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -130,19 +128,16 @@ fun DataBrokerView( Column { val dataBrokerMode = topAppBarViewModel.dataBrokerMode DataBrokerConnection(connectionViewModel) - AnimatedVisibility( - visible = connectionViewModel.isConnected && dataBrokerMode == DataBrokerMode.MANUAL, - enter = fadeIn(), - exit = fadeOut(), - ) { - DataBrokerProperties(vssPropertiesViewModel) - } - AnimatedVisibility( - visible = connectionViewModel.isConnected && dataBrokerMode == DataBrokerMode.SPECIFICATION, - enter = fadeIn(), - exit = fadeOut(), - ) { - DataBrokerSpecifications(vssSpecificationsViewModel) + if (connectionViewModel.isConnected) { + AnimatedContent( + targetState = dataBrokerMode, + label = "DataBrokerModeAnimation", + ) { mode -> + when (mode) { + DataBrokerMode.MANUAL -> DataBrokerProperties(vssPropertiesViewModel) + DataBrokerMode.SPECIFICATION -> DataBrokerSpecifications(vssSpecificationsViewModel) + } + } } Spacer(modifier = Modifier.padding(top = DefaultElementPadding)) }