Skip to content

Commit

Permalink
feat(search): transition when rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
hoc081098 committed Jan 30, 2022
1 parent 2faae5d commit c7ccdf0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit c7ccdf0

Please sign in to comment.