diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt index d8711b179..06cb69ad9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt @@ -6,7 +6,6 @@ import android.content.Context import android.content.Intent import android.graphics.Bitmap import android.graphics.drawable.BitmapDrawable -import android.os.Build import android.os.Bundle import android.view.LayoutInflater import android.view.Menu @@ -893,7 +892,7 @@ class MangaController : val activity = activity ?: return activity.apply { val intent = ReaderActivity.newIntent(activity, presenter.manga, chapter) - if (sharedElement != null && Build.VERSION.SDK_INT != Build.VERSION_CODES.O) { + if (sharedElement != null) { val activityOptions = ActivityOptions.makeSceneTransitionAnimation( activity, sharedElement, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 4a0560dfc..b341457ca 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -30,6 +30,7 @@ import android.view.animation.AnimationUtils import android.widget.FrameLayout import android.widget.Toast import androidx.core.graphics.ColorUtils +import androidx.core.transition.addListener import androidx.core.view.WindowCompat import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsControllerCompat @@ -609,7 +610,14 @@ class ReaderActivity : BaseRxActivity() val newViewer = ReadingModeType.toViewer(presenter.getMangaReadingMode(), this) updateCropBordersShortcut() - setOrientation(presenter.getMangaOrientationType()) + if (window.sharedElementEnterTransition is MaterialContainerTransform) { + // Wait until transition is complete to avoid crash on API 26 + window.sharedElementEnterTransition.addListener( + onEnd = { setOrientation(presenter.getMangaOrientationType()) } + ) + } else { + setOrientation(presenter.getMangaOrientationType()) + } // Destroy previous viewer if there was one if (prevViewer != null) {