mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-01 20:35:18 -05:00
ReaderActivity: Fix transition crash on Android 8 (#6542)
This commit is contained in:
parent
19fe689969
commit
b6553bdc34
2 changed files with 10 additions and 3 deletions
|
@ -6,7 +6,6 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.graphics.drawable.BitmapDrawable
|
import android.graphics.drawable.BitmapDrawable
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
|
@ -893,7 +892,7 @@ class MangaController :
|
||||||
val activity = activity ?: return
|
val activity = activity ?: return
|
||||||
activity.apply {
|
activity.apply {
|
||||||
val intent = ReaderActivity.newIntent(activity, presenter.manga, chapter)
|
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(
|
val activityOptions = ActivityOptions.makeSceneTransitionAnimation(
|
||||||
activity,
|
activity,
|
||||||
sharedElement,
|
sharedElement,
|
||||||
|
|
|
@ -30,6 +30,7 @@ import android.view.animation.AnimationUtils
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
|
import androidx.core.transition.addListener
|
||||||
import androidx.core.view.WindowCompat
|
import androidx.core.view.WindowCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import androidx.core.view.WindowInsetsControllerCompat
|
import androidx.core.view.WindowInsetsControllerCompat
|
||||||
|
@ -609,7 +610,14 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
||||||
val newViewer = ReadingModeType.toViewer(presenter.getMangaReadingMode(), this)
|
val newViewer = ReadingModeType.toViewer(presenter.getMangaReadingMode(), this)
|
||||||
|
|
||||||
updateCropBordersShortcut()
|
updateCropBordersShortcut()
|
||||||
|
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())
|
setOrientation(presenter.getMangaOrientationType())
|
||||||
|
}
|
||||||
|
|
||||||
// Destroy previous viewer if there was one
|
// Destroy previous viewer if there was one
|
||||||
if (prevViewer != null) {
|
if (prevViewer != null) {
|
||||||
|
|
Loading…
Reference in a new issue