Fix / Shared element transition overlap

Shared element was overlapping top system bars
This commit is contained in:
Valere 2019-08-01 14:16:05 +02:00
parent d47c0f5ebc
commit 8076eab4b5
3 changed files with 36 additions and 27 deletions

View file

@ -35,6 +35,7 @@ import androidx.annotation.DrawableRes
import androidx.appcompat.app.AlertDialog
import androidx.core.app.ActivityOptionsCompat
import androidx.core.content.ContextCompat
import androidx.core.util.Pair
import androidx.core.view.ViewCompat
import androidx.core.view.forEach
import androidx.lifecycle.ViewModelProviders
@ -708,9 +709,15 @@ class RoomDetailFragment :
// TODO Use navigator
val intent = ImageMediaViewerActivity.newIntent(vectorBaseActivity, mediaData, ViewCompat.getTransitionName(view))
val pairs = ArrayList<Pair<View, String>>()
requireActivity().window.decorView.findViewById<View>(android.R.id.statusBarBackground)?.let {
pairs.add(Pair(it, Window.STATUS_BAR_BACKGROUND_TRANSITION_NAME))
}
pairs.add(Pair(view, ViewCompat.getTransitionName(view) ?: ""))
pairs.add(Pair(roomToolbar, ViewCompat.getTransitionName(roomToolbar) ?: ""))
val bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
requireActivity(), view, ViewCompat.getTransitionName(view)
?: "").toBundle()
requireActivity(), *pairs.toTypedArray()).toBundle()
startActivity(intent, bundle)
}

View file

@ -10,6 +10,7 @@
android:id="@+id/imageMediaViewerToolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:transitionName="toolbar"
android:elevation="4dp" />

View file

@ -11,6 +11,7 @@
style="@style/VectorToolbarStyle"
android:layout_width="0dp"
android:layout_height="?actionBarSize"
android:transitionName="toolbar"
android:elevation="4dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"