Explorar el Código

优化共享元素动画

HapeLee hace 11 meses
padre
commit
3aece2eadd

+ 1 - 1
app/src/main/java/io/legado/app/help/config/AppConfig.kt

@@ -586,7 +586,7 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
         get() = appCtx.getPrefBoolean(PreferKey.delayBookLoadEnable, true)
 
     val sharedElementEnterTransitionEnable
-        get() = appCtx.getPrefBoolean(PreferKey.sharedElementEnterTransitionEnable, true)
+        get() = appCtx.getPrefBoolean(PreferKey.sharedElementEnterTransitionEnable, false)
 
     var searchScope: String
         get() = appCtx.getPrefString("searchScope") ?: ""

+ 1 - 1
app/src/main/java/io/legado/app/help/config/ReadBookConfig.kt

@@ -61,7 +61,7 @@ object ReadBookConfig {
     var bgMeanColor: Int = 0
     val textColor: Int get() = durConfig.curTextColor()
     val textShadowColor: Int get() = durConfig.curTextShadowColor()
-
+    val menuColor: Int get() = durConfig.curMenuAc()
     init {
         initConfigs()
         initShareConfig()

+ 13 - 13
app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt

@@ -287,21 +287,21 @@ class ReadBookActivity : BaseReadBookActivity(),
     @SuppressLint("ClickableViewAccessibility")
     override fun onCreate(savedInstanceState: Bundle?) {
 
-        if (AppConfig.sharedElementEnterTransitionEnable) {
-            setEnterSharedElementCallback(MaterialContainerTransformSharedElementCallback())
-            setExitSharedElementCallback(MaterialContainerTransformSharedElementCallback())
-            val transform = MaterialContainerTransform().apply {
-                addTarget(binding.root)
-                scrimColor = Color.TRANSPARENT
-                duration = delayMillis
-            }
-            window.sharedElementEnterTransition = transform
-            window.sharedElementReturnTransition = transform
+
+        setEnterSharedElementCallback(MaterialContainerTransformSharedElementCallback())
+        setExitSharedElementCallback(MaterialContainerTransformSharedElementCallback())
+        val transform = MaterialContainerTransform().apply {
+            addTarget(binding.root)
+            scrimColor = Color.TRANSPARENT
+            duration = delayMillis
         }
+        window.sharedElementEnterTransition = transform
+        window.sharedElementReturnTransition = transform
+
         super.onCreate(savedInstanceState)
-        if (AppConfig.sharedElementEnterTransitionEnable){
-            binding.rootView.transitionName = intent.getStringExtra("transitionName")
-        }
+
+        binding.rootView.transitionName = intent.getStringExtra("transitionName")
+
         upScreenTimeOut()
         ReadBook.register(this)
         binding.readMenu.colorSurfaceContainer =

+ 1 - 2
app/src/main/java/io/legado/app/ui/book/read/page/entities/TextLine.kt

@@ -18,7 +18,6 @@ import io.legado.app.ui.book.read.page.provider.ChapterProvider
 import io.legado.app.utils.canvasrecorder.CanvasRecorderFactory
 import io.legado.app.utils.canvasrecorder.recordIfNeededThenDraw
 import io.legado.app.utils.dpToPx
-import io.legado.app.utils.themeColor
 
 /**
  * 行信息
@@ -178,7 +177,7 @@ data class TextLine(
             ChapterProvider.contentPaint
         }
         val textColor = if (isReadAloud) {
-            view.context.themeColor(androidx.appcompat.R.attr.colorPrimary)
+            ReadBookConfig.menuColor
         } else {
             ReadBookConfig.textColor
         }

+ 47 - 31
app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt

@@ -45,6 +45,8 @@ import io.legado.app.utils.bookshelfLayoutGrid
 import io.legado.app.utils.bookshelfLayoutMode
 import io.legado.app.utils.cnCompare
 import io.legado.app.utils.observeEvent
+import io.legado.app.utils.startActivity
+import io.legado.app.utils.startActivityForBook
 import io.legado.app.utils.viewbindingdelegate.viewBinding
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
@@ -290,46 +292,60 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
     }
 
     override fun open(book: Book, sharedView: View) {
-        val transitionName = "book_${book.bookUrl}"
-        sharedView.transitionName = transitionName
-
-        val cls = when {
-            book.isAudio -> AudioPlayActivity::class.java
-            book.isImage && AppConfig.showMangaUi -> ReadMangaActivity::class.java
-            else -> ReadBookActivity::class.java
-        }
+        if (AppConfig.sharedElementEnterTransitionEnable){
+            val transitionName = "book_${book.bookUrl}"
+            sharedView.transitionName = transitionName
+
+            val cls = when {
+                book.isAudio -> AudioPlayActivity::class.java
+                book.isImage && AppConfig.showMangaUi -> ReadMangaActivity::class.java
+                else -> ReadBookActivity::class.java
+            }
 
-        val intent = Intent(requireContext(), cls).apply {
-            putExtra("bookUrl", book.bookUrl)
-            putExtra("transitionName", transitionName)
-        }
+            val intent = Intent(requireContext(), cls).apply {
+                putExtra("bookUrl", book.bookUrl)
+                putExtra("transitionName", transitionName)
+            }
 
-        val options = ActivityOptionsCompat.makeSceneTransitionAnimation(
-            requireActivity(),
-            sharedView,
-            transitionName
-        )
+            val options = ActivityOptionsCompat.makeSceneTransitionAnimation(
+                requireActivity(),
+                sharedView,
+                transitionName
+            )
 
-        startActivity(intent, options.toBundle())
+            startActivity(intent, options.toBundle())
+        } else {
+            startActivityForBook(book)
+        }
     }
 
     override fun openBookInfo(book: Book, sharedView: View) {
-        val intent = Intent(requireContext(), BookInfoActivity::class.java).apply {
-            putExtra("name", book.name)
-            putExtra("author", book.author)
-            putExtra("bookUrl", book.bookUrl)
-            putExtra("transitionName", "book_${book.bookUrl}") // 给共享元素唯一标识
-        }
+        if (AppConfig.sharedElementEnterTransitionEnable){
+            val intent = Intent(requireContext(), BookInfoActivity::class.java).apply {
+                putExtra("name", book.name)
+                putExtra("author", book.author)
+                putExtra("bookUrl", book.bookUrl)
+                putExtra("transitionName", "book_${book.bookUrl}")
+            }
+
+            sharedView.transitionName = "book_${book.bookUrl}"
+
+            val options = ActivityOptionsCompat.makeSceneTransitionAnimation(
+                requireActivity(),
+                sharedView,
+                sharedView.transitionName
+            )
 
-        sharedView.transitionName = "book_${book.bookUrl}"
+            startActivity(intent, options.toBundle())
+        } else {
+            startActivity<BookInfoActivity> {
+                putExtra("name", book.name)
+                putExtra("author", book.author)
+                putExtra("bookUrl", book.bookUrl)
+            }
 
-        val options = ActivityOptionsCompat.makeSceneTransitionAnimation(
-            requireActivity(),
-            sharedView,
-            sharedView.transitionName
-        )
+        }
 
-        startActivity(intent, options.toBundle())
     }
 
 

+ 66 - 40
app/src/main/java/io/legado/app/ui/main/bookshelf/books/BookshelfFragment2.kt

@@ -49,6 +49,8 @@ import io.legado.app.utils.cnCompare
 import io.legado.app.utils.flowWithLifecycleAndDatabaseChangeFirst
 import io.legado.app.utils.observeEvent
 import io.legado.app.utils.showDialogFragment
+import io.legado.app.utils.startActivity
+import io.legado.app.utils.startActivityForBook
 import io.legado.app.utils.viewbindingdelegate.viewBinding
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
@@ -338,62 +340,86 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
     }
 
     override fun onItemClick(item: Any, sharedView: View) {
-        when (item) {
-            is Book -> {
-                val transitionName = "book_${item.bookUrl}"
-                sharedView.transitionName = transitionName
-
-                val cls = when {
-                    item.isAudio -> AudioPlayActivity::class.java
-                    item.isImage && AppConfig.showMangaUi -> ReadMangaActivity::class.java
-                    else -> ReadBookActivity::class.java
-                }
+        if (AppConfig.sharedElementEnterTransitionEnable){
+            when (item) {
+                is Book -> {
+                    val transitionName = "book_${item.bookUrl}"
+                    sharedView.transitionName = transitionName
+
+                    val cls = when {
+                        item.isAudio -> AudioPlayActivity::class.java
+                        item.isImage && AppConfig.showMangaUi -> ReadMangaActivity::class.java
+                        else -> ReadBookActivity::class.java
+                    }
 
-                val intent = Intent(requireContext(), cls).apply {
-                    putExtra("bookUrl", item.bookUrl)
-                    putExtra("transitionName", transitionName)
-                }
+                    val intent = Intent(requireContext(), cls).apply {
+                        putExtra("bookUrl", item.bookUrl)
+                        putExtra("transitionName", transitionName)
+                    }
+
+                    val options = ActivityOptionsCompat.makeSceneTransitionAnimation(
+                        requireActivity(),
+                        sharedView,
+                        transitionName
+                    )
 
-                val options = ActivityOptionsCompat.makeSceneTransitionAnimation(
-                    requireActivity(),
-                    sharedView,
-                    transitionName
-                )
+                    startActivity(intent, options.toBundle())
+                }
 
-                startActivity(intent, options.toBundle())
+                is BookGroup -> {
+                    groupId = item.groupId
+                    initBooksData()
+                    groupIdChangeListener?.onGroupIdChanged()
+                    updateBackCallbackState()
+                }
             }
+        } else {
+            when (item) {
+                is Book -> startActivityForBook(item)
 
-            is BookGroup -> {
-                groupId = item.groupId
-                initBooksData()
-                groupIdChangeListener?.onGroupIdChanged()
-                updateBackCallbackState()
+                is BookGroup -> {
+                    groupId = item.groupId
+                    initBooksData()
+                }
             }
         }
+
     }
 
     override fun onItemLongClick(item: Any, sharedView: View) {
-        when (item) {
-            is Book -> {
-                val intent = Intent(requireContext(), BookInfoActivity::class.java).apply {
+        if (AppConfig.sharedElementEnterTransitionEnable){
+            when (item) {
+                is Book -> {
+                    val intent = Intent(requireContext(), BookInfoActivity::class.java).apply {
+                        putExtra("name", item.name)
+                        putExtra("author", item.author)
+                        putExtra("bookUrl", item.bookUrl)
+                        putExtra("transitionName", "book_${item.bookUrl}") // 给共享元素唯一标识
+                    }
+
+                    sharedView.transitionName = "book_${item.bookUrl}"
+
+                    val options = ActivityOptionsCompat.makeSceneTransitionAnimation(
+                        requireActivity(),
+                        sharedView,
+                        sharedView.transitionName
+                    )
+
+                    startActivity(intent, options.toBundle())
+                }
+
+                is BookGroup -> showDialogFragment(GroupEditDialog(item))
+            }
+        } else {
+            when (item) {
+                is Book -> startActivity<BookInfoActivity> {
                     putExtra("name", item.name)
                     putExtra("author", item.author)
                     putExtra("bookUrl", item.bookUrl)
-                    putExtra("transitionName", "book_${item.bookUrl}") // 给共享元素唯一标识
                 }
 
-                sharedView.transitionName = "book_${item.bookUrl}"
-
-                val options = ActivityOptionsCompat.makeSceneTransitionAnimation(
-                    requireActivity(),
-                    sharedView,
-                    sharedView.transitionName
-                )
-
-                startActivity(intent, options.toBundle())
+                is BookGroup -> showDialogFragment(GroupEditDialog(item))
             }
-
-            is BookGroup -> showDialogFragment(GroupEditDialog(item))
         }
     }
 

+ 2 - 0
app/src/main/res/layout/dialog_read_book_style.xml

@@ -184,6 +184,7 @@
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:paddingHorizontal="16dp"
+                    android:layout_marginVertical="8dp"
                     app:singleLine="true"
                     app:singleSelection="true"
                     app:selectionRequired="true">
@@ -301,6 +302,7 @@
                 <ImageView
                     android:layout_width="16dp"
                     android:layout_height="48dp"
+                    android:importantForAccessibility="no"
                     app:layout_constraintStart_toEndOf="@id/cb_share_layout"
                     app:layout_constraintTop_toTopOf="parent"
                     app:layout_constraintBottom_toBottomOf="parent"

+ 79 - 83
app/src/main/res/layout/item_bookshelf_grid.xml

@@ -1,106 +1,102 @@
 <?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/cv_content"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content">
+    android:layout_height="wrap_content"
+    app:cardBackgroundColor="@android:color/transparent"
+    android:layout_marginBottom="4dp"
+    android:clickable="true"
+    android:focusable="true"
+    app:strokeWidth="0dp"
+    app:layout_constraintTop_toTopOf="parent">
 
-    <com.google.android.material.card.MaterialCardView
-        android:id="@+id/cv_content"
+    <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        app:cardBackgroundColor="@android:color/transparent"
-        android:layout_marginBottom="4dp"
-        android:clickable="true"
-        android:focusable="true"
-        app:strokeWidth="0dp"
-        app:layout_constraintTop_toTopOf="parent">
+        android:orientation="vertical">
 
-        <LinearLayout
+        <com.google.android.material.card.MaterialCardView
+            android:id="@+id/cd_cover"
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="vertical">
+            android:layout_height="match_parent"
+            app:cardCornerRadius="6dp"
+            android:layout_marginHorizontal="8dp"
+            android:layout_marginTop="8dp"
+            android:transitionName="img_cover"
+            app:strokeWidth="0dp">
 
-            <com.google.android.material.card.MaterialCardView
-                android:id="@+id/cd_cover"
+            <androidx.constraintlayout.widget.ConstraintLayout
                 android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                app:cardCornerRadius="6dp"
-                android:layout_marginHorizontal="8dp"
-                android:layout_marginTop="8dp"
-                android:transitionName="img_cover"
-                app:strokeWidth="0dp">
+                android:layout_height="wrap_content">
 
-                <androidx.constraintlayout.widget.ConstraintLayout
+                <io.legado.app.ui.widget.image.CoverImageView
+                    android:id="@+id/iv_cover"
                     android:layout_width="match_parent"
-                    android:layout_height="wrap_content">
+                    android:layout_height="match_parent"
+                    android:scaleType="centerCrop"
+                    android:src="@drawable/image_cover_default"
+                    tools:ignore="ImageContrastCheck" />
 
-                    <io.legado.app.ui.widget.image.CoverImageView
-                        android:id="@+id/iv_cover"
-                        android:layout_width="match_parent"
-                        android:layout_height="match_parent"
-                        android:scaleType="centerCrop"
-                        android:src="@drawable/image_cover_default"
-                        tools:ignore="ImageContrastCheck" />
+                <com.google.android.material.progressindicator.LinearProgressIndicator
+                    android:id="@+id/rl_loading"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginVertical="4dp"
+                    android:layout_marginHorizontal="12dp"
+                    android:indeterminate="true"
+                    android:visibility="invisible"
+                    android:layout_gravity="top"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintTop_toTopOf="parent" />
 
-                    <com.google.android.material.progressindicator.LinearProgressIndicator
-                        android:id="@+id/rl_loading"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:layout_marginVertical="4dp"
-                        android:layout_marginHorizontal="12dp"
-                        android:indeterminate="true"
-                        android:visibility="invisible"
-                        android:layout_gravity="top"
-                        app:layout_constraintEnd_toEndOf="parent"
-                        app:layout_constraintStart_toStartOf="parent"
-                        app:layout_constraintTop_toTopOf="parent" />
+                <com.google.android.material.card.MaterialCardView
+                    android:id="@+id/cd_unread"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_margin="4dp"
+                    android:visibility="visible"
+                    app:cardCornerRadius="4dp"
+                    app:strokeWidth="0dp"
+                    app:cardBackgroundColor="?attr/colorSecondaryVariant"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    app:layout_constraintTop_toTopOf="parent">
 
-                    <com.google.android.material.card.MaterialCardView
-                        android:id="@+id/cd_unread"
+                    <TextView
+                        android:id="@+id/tv_unread"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
-                        android:layout_margin="4dp"
-                        android:visibility="visible"
-                        app:cardCornerRadius="4dp"
-                        app:strokeWidth="0dp"
-                        app:cardBackgroundColor="?attr/colorSecondaryVariant"
-                        app:layout_constraintEnd_toEndOf="parent"
-                        app:layout_constraintTop_toTopOf="parent">
+                        android:textColor="?attr/colorOnSecondary"
+                        android:textSize="10sp"
+                        android:padding="4dp"
+                        android:textStyle="bold"
+                        android:includeFontPadding="false"
+                        tools:text="5"
+                        tools:ignore="SmallSp" />
 
-                        <TextView
-                            android:id="@+id/tv_unread"
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:textColor="?attr/colorOnSecondary"
-                            android:textSize="10sp"
-                            android:padding="4dp"
-                            android:textStyle="bold"
-                            android:includeFontPadding="false"
-                            tools:text="5"
-                            tools:ignore="SmallSp" />
+                </com.google.android.material.card.MaterialCardView>
 
-                    </com.google.android.material.card.MaterialCardView>
+            </androidx.constraintlayout.widget.ConstraintLayout>
 
-                </androidx.constraintlayout.widget.ConstraintLayout>
+        </com.google.android.material.card.MaterialCardView>
 
-            </com.google.android.material.card.MaterialCardView>
+        <!-- 书名 -->
+        <TextView
+            android:id="@+id/tv_name"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="4dp"
+            android:layout_marginBottom="6dp"
+            android:layout_marginHorizontal="8dp"
+            android:ellipsize="end"
+            android:gravity="left"
+            android:lines="2"
+            android:text="@string/book_name"
+            android:textSize="12sp"
+            android:textStyle="bold"
+            tools:ignore="RtlHardcoded" />
+    </LinearLayout>
+</com.google.android.material.card.MaterialCardView>
 
-            <!-- 书名 -->
-            <TextView
-                android:id="@+id/tv_name"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginTop="4dp"
-                android:layout_marginBottom="6dp"
-                android:layout_marginHorizontal="8dp"
-                android:ellipsize="end"
-                android:gravity="left"
-                android:lines="2"
-                android:text="@string/book_name"
-                android:textSize="12sp"
-                android:textStyle="bold"
-                tools:ignore="RtlHardcoded" />
-        </LinearLayout>
-    </com.google.android.material.card.MaterialCardView>
-</androidx.constraintlayout.widget.ConstraintLayout>

+ 137 - 142
app/src/main/res/layout/item_bookshelf_grid_group.xml

@@ -1,156 +1,151 @@
 <?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/cv_content"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content">
-
-    <com.google.android.material.card.MaterialCardView
-        android:id="@+id/cv_content"
+    android:layout_height="wrap_content"
+    android:layout_marginBottom="4dp"
+    android:foreground="?attr/selectableItemBackground"
+    android:clickable="true"
+    android:focusable="true"
+    app:strokeWidth="0dp"
+    app:layout_constraintTop_toTopOf="parent">
+
+    <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginBottom="4dp"
-        android:foreground="?attr/selectableItemBackground"
-        android:clickable="true"
-        android:focusable="true"
-        app:strokeWidth="0dp"
-        app:layout_constraintTop_toTopOf="parent">
+        android:orientation="vertical">
 
-        <LinearLayout
+        <com.google.android.material.card.MaterialCardView
+            android:id="@+id/cd_cover"
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="vertical">
-
-            <com.google.android.material.card.MaterialCardView
-                android:id="@+id/cd_cover"
+            android:layout_height="match_parent"
+            app:cardCornerRadius="6dp"
+            android:layout_marginHorizontal="8dp"
+            android:layout_marginTop="8dp"
+            android:transitionName="img_cover"
+            app:strokeWidth="0dp">
+
+            <androidx.constraintlayout.widget.ConstraintLayout
                 android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                app:cardCornerRadius="6dp"
-                android:layout_marginHorizontal="8dp"
-                android:layout_marginTop="8dp"
-                android:transitionName="img_cover"
-                app:strokeWidth="0dp">
+                android:layout_height="wrap_content">
 
-                <androidx.constraintlayout.widget.ConstraintLayout
+                <io.legado.app.ui.widget.image.CoverImageView
+                    android:id="@+id/iv_cover"
                     android:layout_width="match_parent"
-                    android:layout_height="wrap_content">
-
-                    <io.legado.app.ui.widget.image.CoverImageView
-                        android:id="@+id/iv_cover"
-                        android:layout_width="match_parent"
-                        android:layout_height="match_parent"
-                        android:scaleType="centerCrop"
-                        android:src="?attr/colorSurfaceVariant"
-                        tools:ignore="ImageContrastCheck" />
-
-                    <com.google.android.material.progressindicator.LinearProgressIndicator
-                        android:id="@+id/rl_loading"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:layout_marginVertical="4dp"
-                        android:layout_marginHorizontal="12dp"
-                        android:indeterminate="true"
-                        android:visibility="invisible"
-                        android:layout_gravity="top"
-                        app:layout_constraintTop_toTopOf="parent" />
+                    android:layout_height="match_parent"
+                    android:scaleType="centerCrop"
+                    android:src="?attr/colorSurfaceVariant"
+                    tools:ignore="ImageContrastCheck" />
 
-                    <com.google.android.material.card.MaterialCardView
-                        android:id="@+id/cd_unread"
+                <com.google.android.material.progressindicator.LinearProgressIndicator
+                    android:id="@+id/rl_loading"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginVertical="4dp"
+                    android:layout_marginHorizontal="12dp"
+                    android:indeterminate="true"
+                    android:visibility="invisible"
+                    android:layout_gravity="top"
+                    app:layout_constraintTop_toTopOf="parent" />
+
+                <com.google.android.material.card.MaterialCardView
+                    android:id="@+id/cd_unread"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_margin="4dp"
+                    android:visibility="visible"
+                    app:cardCornerRadius="4dp"
+                    app:strokeWidth="0dp"
+                    app:cardBackgroundColor="?attr/colorSecondaryVariant"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    app:layout_constraintTop_toTopOf="parent">
+
+                    <TextView
+                        android:id="@+id/tv_unread"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
-                        android:layout_margin="4dp"
-                        android:visibility="visible"
-                        app:cardCornerRadius="4dp"
-                        app:strokeWidth="0dp"
-                        app:cardBackgroundColor="?attr/colorSecondaryVariant"
-                        app:layout_constraintEnd_toEndOf="parent"
-                        app:layout_constraintTop_toTopOf="parent">
-
-                        <TextView
-                            android:id="@+id/tv_unread"
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:textColor="?attr/colorSurface"
-                            android:textSize="10sp"
-                            android:padding="4dp"
-                            android:textStyle="bold"
-                            android:includeFontPadding="false"
-                            tools:text="5"
-                            tools:ignore="SmallSp" />
-
-                    </com.google.android.material.card.MaterialCardView>
-
-                    <io.legado.app.ui.widget.image.CoverImageView
-                        android:id="@+id/iv_cover1"
-                        android:layout_width="0dp"
-                        android:layout_height="wrap_content"
-                        android:layout_marginTop="4dp"
-                        android:layout_marginBottom="2dp"
-                        android:layout_marginStart="4dp"
-                        android:layout_marginEnd="2dp"
-                        app:layout_constraintStart_toStartOf="parent"
-                        app:layout_constraintTop_toTopOf="parent"
-                        app:layout_constraintEnd_toStartOf="@id/iv_cover2"
-                        app:layout_constraintBottom_toTopOf="@id/iv_cover3"/>
-
-                    <io.legado.app.ui.widget.image.CoverImageView
-                        android:id="@+id/iv_cover2"
-                        android:layout_width="0dp"
-                        android:layout_height="match_parent"
-                        android:layout_marginTop="4dp"
-                        android:layout_marginBottom="2dp"
-                        android:layout_marginEnd="4dp"
-                        android:layout_marginStart="2dp"
-                        app:layout_constraintEnd_toEndOf="parent"
-                        app:layout_constraintTop_toTopOf="parent"
-                        app:layout_constraintStart_toEndOf="@id/iv_cover1"
-                        app:layout_constraintBottom_toTopOf="@id/iv_cover4"/>
-
-                    <io.legado.app.ui.widget.image.CoverImageView
-                        android:id="@+id/iv_cover3"
-                        android:layout_width="0dp"
-                        android:layout_height="wrap_content"
-                        android:layout_marginTop="2dp"
-                        android:layout_marginStart="4dp"
-                        android:layout_marginBottom="4dp"
-                        android:layout_marginEnd="2dp"
-                        app:layout_constraintBottom_toBottomOf="parent"
-                        app:layout_constraintStart_toStartOf="parent"
-                        app:layout_constraintTop_toBottomOf="@id/iv_cover1"
-                        app:layout_constraintEnd_toStartOf="@id/iv_cover4"/>
-
-                    <io.legado.app.ui.widget.image.CoverImageView
-                        android:id="@+id/iv_cover4"
-                        android:layout_width="0dp"
-                        android:layout_height="wrap_content"
-                        android:layout_marginTop="2dp"
-                        android:layout_marginEnd="4dp"
-                        android:layout_marginBottom="4dp"
-                        android:layout_marginStart="2dp"
-                        app:layout_constraintBottom_toBottomOf="parent"
-                        app:layout_constraintEnd_toEndOf="parent"
-                        app:layout_constraintTop_toBottomOf="@id/iv_cover2"
-                        app:layout_constraintStart_toEndOf="@id/iv_cover3"/>
-
-                </androidx.constraintlayout.widget.ConstraintLayout>
-
-            </com.google.android.material.card.MaterialCardView>
-
-            <!-- 书名 -->
-            <TextView
-                android:id="@+id/tv_name"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginTop="4dp"
-                android:layout_marginBottom="6dp"
-                android:layout_marginHorizontal="8dp"
-                android:ellipsize="end"
-                android:gravity="left"
-                android:lines="2"
-                android:text="@string/book_name"
-                android:textSize="12sp"
-                android:textStyle="bold"
-                tools:ignore="RtlHardcoded" />
-        </LinearLayout>
-    </com.google.android.material.card.MaterialCardView>
-</androidx.constraintlayout.widget.ConstraintLayout>
+                        android:textColor="?attr/colorSurface"
+                        android:textSize="10sp"
+                        android:padding="4dp"
+                        android:textStyle="bold"
+                        android:includeFontPadding="false"
+                        tools:text="5"
+                        tools:ignore="SmallSp" />
+
+                </com.google.android.material.card.MaterialCardView>
+
+                <io.legado.app.ui.widget.image.CoverImageView
+                    android:id="@+id/iv_cover1"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="4dp"
+                    android:layout_marginBottom="2dp"
+                    android:layout_marginStart="4dp"
+                    android:layout_marginEnd="2dp"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintTop_toTopOf="parent"
+                    app:layout_constraintEnd_toStartOf="@id/iv_cover2"
+                    app:layout_constraintBottom_toTopOf="@id/iv_cover3"/>
+
+                <io.legado.app.ui.widget.image.CoverImageView
+                    android:id="@+id/iv_cover2"
+                    android:layout_width="0dp"
+                    android:layout_height="match_parent"
+                    android:layout_marginTop="4dp"
+                    android:layout_marginBottom="2dp"
+                    android:layout_marginEnd="4dp"
+                    android:layout_marginStart="2dp"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    app:layout_constraintTop_toTopOf="parent"
+                    app:layout_constraintStart_toEndOf="@id/iv_cover1"
+                    app:layout_constraintBottom_toTopOf="@id/iv_cover4"/>
+
+                <io.legado.app.ui.widget.image.CoverImageView
+                    android:id="@+id/iv_cover3"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="2dp"
+                    android:layout_marginStart="4dp"
+                    android:layout_marginBottom="4dp"
+                    android:layout_marginEnd="2dp"
+                    app:layout_constraintBottom_toBottomOf="parent"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintTop_toBottomOf="@id/iv_cover1"
+                    app:layout_constraintEnd_toStartOf="@id/iv_cover4"/>
+
+                <io.legado.app.ui.widget.image.CoverImageView
+                    android:id="@+id/iv_cover4"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="2dp"
+                    android:layout_marginEnd="4dp"
+                    android:layout_marginBottom="4dp"
+                    android:layout_marginStart="2dp"
+                    app:layout_constraintBottom_toBottomOf="parent"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    app:layout_constraintTop_toBottomOf="@id/iv_cover2"
+                    app:layout_constraintStart_toEndOf="@id/iv_cover3"/>
+
+            </androidx.constraintlayout.widget.ConstraintLayout>
+
+        </com.google.android.material.card.MaterialCardView>
+
+        <!-- 书名 -->
+        <TextView
+            android:id="@+id/tv_name"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="4dp"
+            android:layout_marginBottom="6dp"
+            android:layout_marginHorizontal="8dp"
+            android:ellipsize="end"
+            android:gravity="left"
+            android:lines="2"
+            android:text="@string/book_name"
+            android:textSize="12sp"
+            android:textStyle="bold"
+            tools:ignore="RtlHardcoded" />
+    </LinearLayout>
+</com.google.android.material.card.MaterialCardView>

+ 58 - 47
app/src/main/res/layout/item_bookshelf_list.xml

@@ -19,58 +19,69 @@
             android:id="@+id/cd_cover"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_margin="8dp"
+            app:cardCornerRadius="6dp"
             app:strokeWidth="0dp"
-            app:cardCornerRadius="8dp"
-            app:layout_constraintTop_toTopOf="parent"
+            android:layout_margin="8dp"
+            android:transitionName="img_cover"
             app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
             app:layout_constraintBottom_toBottomOf="parent">
-            <io.legado.app.ui.widget.image.CoverImageView
-                android:id="@+id/iv_cover"
+            <androidx.constraintlayout.widget.ConstraintLayout
+                android:id="@+id/cl_cover"
                 android:layout_width="70dp"
-                android:layout_height="98dp"
-                android:scaleType="centerCrop"
-                android:src="@drawable/image_cover_default"
-                tools:ignore="ImageContrastCheck" />
-        </com.google.android.material.card.MaterialCardView>
-
-        <com.google.android.material.progressindicator.LinearProgressIndicator
-            android:id="@+id/rl_loading"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_marginVertical="4dp"
-            android:layout_marginHorizontal="6dp"
-            android:indeterminate="true"
-            android:visibility="invisible"
-            android:layout_gravity="top"
-            app:layout_constraintTop_toTopOf="@id/cd_cover"
-            app:layout_constraintStart_toStartOf="@id/cd_cover"
-            app:layout_constraintEnd_toEndOf="@id/cd_cover" />
-
-        <com.google.android.material.card.MaterialCardView
-            android:id="@+id/cd_unread"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_margin="4dp"
-            android:visibility="visible"
-            app:cardCornerRadius="4dp"
-            app:strokeWidth="0dp"
-            app:cardBackgroundColor="?attr/colorSecondaryVariant"
-            app:layout_constraintTop_toTopOf="@id/cd_cover"
-            app:layout_constraintEnd_toEndOf="@id/cd_cover">
-
-            <TextView
-                android:id="@+id/tv_unread"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="?attr/colorOnSecondary"
-                android:textSize="10sp"
-                android:padding="4dp"
-                android:textStyle="bold"
-                android:includeFontPadding="false"
-                tools:text="5"
-                tools:ignore="SmallSp" />
+                android:layout_height="98dp">
 
+                <io.legado.app.ui.widget.image.CoverImageView
+                    android:id="@+id/iv_cover"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:scaleType="centerCrop"
+                    android:src="@drawable/image_cover_default"
+                    app:layout_constraintTop_toTopOf="parent"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    tools:ignore="ImageContrastCheck" />
+
+                <com.google.android.material.progressindicator.LinearProgressIndicator
+                    android:id="@+id/rl_loading"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginVertical="4dp"
+                    android:layout_marginHorizontal="6dp"
+                    android:indeterminate="true"
+                    android:visibility="invisible"
+                    android:layout_gravity="top"
+                    app:layout_constraintTop_toTopOf="@id/iv_cover"
+                    app:layout_constraintStart_toStartOf="@id/iv_cover"
+                    app:layout_constraintEnd_toEndOf="@id/iv_cover" />
+
+                <com.google.android.material.card.MaterialCardView
+                    android:id="@+id/cd_unread"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_margin="4dp"
+                    android:visibility="visible"
+                    app:cardCornerRadius="4dp"
+                    app:strokeWidth="0dp"
+                    app:cardBackgroundColor="?attr/colorSecondaryVariant"
+                    app:layout_constraintTop_toTopOf="@id/iv_cover"
+                    app:layout_constraintEnd_toEndOf="@id/iv_cover">
+
+                    <TextView
+                        android:id="@+id/tv_unread"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:textColor="?attr/colorOnSecondary"
+                        android:textSize="10sp"
+                        android:padding="4dp"
+                        android:textStyle="bold"
+                        android:includeFontPadding="false"
+                        tools:text="5"
+                        tools:ignore="SmallSp" />
+
+                </com.google.android.material.card.MaterialCardView>
+
+            </androidx.constraintlayout.widget.ConstraintLayout>
         </com.google.android.material.card.MaterialCardView>
 
         <LinearLayout

+ 2 - 2
app/src/main/res/values-zh/strings.xml

@@ -1280,9 +1280,9 @@
     <string name="privacy">隐私</string>
     <string name="notification_permission">通知权限</string>
     <string name="background_permission">后台权限</string>
-    <string name="opt_animation">从书架进入阅读界面时,优化动画效果。</string>
+    <string name="opt_animation">从书架进入阅读界面时,优化动画效果。在某些设备上可能无法正常工作</string>
     <string name="use_animation">使用共享元素动画</string>
-    <string name="reduce_stutter">减少进入阅读界面时的卡顿,但加载书籍时间会延长。</string>
+    <string name="reduce_stutter">减少进入阅读界面时的卡顿,但加载书籍时间会延长。仅在开启共享元素动画时生效</string>
     <string name="delay_book_load">延缓书籍加载</string>
     <string name="compact_list">紧凑列表</string>
     <string name="author_read">%s • %d章未读</string>

+ 1 - 1
app/src/main/res/xml/pref_config_other.xml

@@ -162,7 +162,7 @@
         app:layout="@layout/view_preference_category">
 
         <io.legado.app.lib.prefs.SwitchPreference
-            android:defaultValue="true"
+            android:defaultValue="false"
             android:key="sharedElementEnterTransitionEnable"
             android:summary="@string/opt_animation"
             android:title="@string/use_animation" />

+ 1 - 1
app/version.properties

@@ -1,4 +1,4 @@
 VERSION_MAJOR=3
 VERSION_MINOR=26
 VERSION_PATCH=3
-VERSION_SUFFIX=-beta.6
+VERSION_SUFFIX=