Преглед изворни кода

Fix: movie select view OOM crash

liweihao пре 6 година
родитељ
комит
c02fe0a36d

+ 5 - 1
src/main/java/com/bomostory/sceneeditmodule/screen/view/MovieSelectView.kt

@@ -10,6 +10,7 @@ import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
 import android.view.animation.Animation
+import com.bomostory.sceneeditmodule.SceneDrawer
 import com.bomostory.sceneeditmodule.basicdata.Scene
 import com.bomostory.sceneeditmodule.basicdata.Story
 import com.bomostory.sceneeditmodule.utils.AnimationUtils
@@ -109,7 +110,10 @@ class MovieSelectView : ConstraintLayout {
                 itemView.apply {
                     story?.apply {
                         number.text = "$p1"
-                        screenshot.setImageDrawable(Drawable.createFromPath(this.scenes[p1].backgroundPath))
+                        val width = context.resources.getDimension(R.dimen.export_pdf_screenshot_width).toInt()
+                        val height = context.resources.getDimension(R.dimen.export_pdf_screenshot_height).toInt()
+                        val bitmap = SceneDrawer.drawScene(context, scenes[p1], 0, width, height)
+                        screenshot.setImageBitmap(bitmap)
                         this.scenes[p1].record?.let {
                             period.text = TimeUtils.getPlayMovieTimeFormat(it.period)
                         }