Skip to content

Commit

Permalink
Hide system UI until the shared element transition completes.
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-signal authored and greyson-signal committed Feb 15, 2023
1 parent a3a29d5 commit 1b49b9b
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,15 @@ class MediaPreviewV2Fragment : LoggingFragment(R.layout.fragment_media_preview_v
private fun initializeFullScreenUi() {
fullscreenHelper.configureToolbarLayout(binding.toolbarCutoutSpacer, binding.toolbar)
fullscreenHelper.showAndHideWithSystemUI(requireActivity().window, binding.toolbarLayout, binding.mediaPreviewDetailsContainer)
fullscreenHelper.hideSystemUI()

lifecycleDisposable += viewModel.state.map {
it.isInSharedAnimation to it.loadState
}.distinctUntilChanged().subscribe { (isInSharedAnimation, loadState) ->
if (!isInSharedAnimation && loadState == MediaPreviewV2State.LoadState.MEDIA_READY) {
fullscreenHelper.showSystemUI()
}
}
}

private fun bindCurrentState(currentState: MediaPreviewV2State) {
Expand Down

0 comments on commit 1b49b9b

Please sign in to comment.