From c7ccdf043b347e814a71cb10fd03c4dcbb650b9d Mon Sep 17 00:00:00 2001 From: Petrus Nguyen Thai Hoc Date: Sun, 30 Jan 2022 15:36:01 +0700 Subject: [PATCH] feat(search): transition when rendering --- .../java/com/hoc/flowmvi/data/UserRepositoryImpl.kt | 1 - .../java/com/hoc/flowmvi/ui/search/SearchActivity.kt | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/data/src/main/java/com/hoc/flowmvi/data/UserRepositoryImpl.kt b/data/src/main/java/com/hoc/flowmvi/data/UserRepositoryImpl.kt index 87bb1992..ac7022ae 100644 --- a/data/src/main/java/com/hoc/flowmvi/data/UserRepositoryImpl.kt +++ b/data/src/main/java/com/hoc/flowmvi/data/UserRepositoryImpl.kt @@ -18,7 +18,6 @@ import com.hoc.flowmvi.domain.repository.UserRepository import com.hoc081098.flowext.retryWithExponentialBackoff import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.FlowPreview -import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.asFlow diff --git a/feature-search/src/main/java/com/hoc/flowmvi/ui/search/SearchActivity.kt b/feature-search/src/main/java/com/hoc/flowmvi/ui/search/SearchActivity.kt index a5559176..7579065e 100644 --- a/feature-search/src/main/java/com/hoc/flowmvi/ui/search/SearchActivity.kt +++ b/feature-search/src/main/java/com/hoc/flowmvi/ui/search/SearchActivity.kt @@ -10,6 +10,8 @@ import androidx.core.view.isInvisible import androidx.core.view.isVisible import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.GridLayoutManager +import androidx.transition.AutoTransition +import androidx.transition.TransitionManager import com.hoc.flowmvi.core_ui.SearchViewQueryTextEvent import com.hoc.flowmvi.core_ui.clicks import com.hoc.flowmvi.core_ui.navigator.IntentProviders @@ -58,6 +60,15 @@ class SearchActivity : textQuery.text = "Search results for '${viewState.submittedQuery}'" } + TransitionManager.endTransitions(root) + TransitionManager.beginDelayedTransition( + root, + AutoTransition() + .addTarget(errorGroup) + .addTarget(progressBar) + .setDuration(200) + ) + errorGroup.isVisible = viewState.error !== null if (errorGroup.isVisible) { errorMessageTextView.text = viewState.error?.let {