Sfoglia il codice sorgente

Merge branch 'fix-share-dialog-oom'

Wayne 6 anni fa
parent
commit
5a8ff271aa

+ 5 - 2
src/main/java/com/bomostory/sceneeditmodule/share/ShareDialog.kt

@@ -1,7 +1,6 @@
 package com.bomostory.sceneeditmodule.share
 
 import android.graphics.PorterDuff
-import android.graphics.drawable.Drawable
 import android.media.MediaMetadataRetriever
 import android.os.Bundle
 import android.support.v4.app.DialogFragment
@@ -13,6 +12,7 @@ import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
 import android.widget.SeekBar
+import com.bomostory.sceneeditmodule.SceneDrawer
 import com.bomostory.sceneeditmodule.basicdata.Project
 import com.bomostory.sceneeditmodule.utils.HorizontalItemDecoration
 import com.bomostory.sceneeditmodule.utils.TimeUtils
@@ -192,7 +192,10 @@ class ShareDialog : DialogFragment() {
             fun bind(p1: Int) {
                 itemView.apply {
                     project.story?.apply {
-                        screenshot.setImageDrawable(Drawable.createFromPath(this.scenes[p1].backgroundPath))
+                        val width = context.resources.getDimension(R.dimen.share_dialog_screenshot_width).toInt()
+                        val height = context.resources.getDimension(R.dimen.share_dialog_screenshot_height).toInt()
+                        val bitmap = SceneDrawer.drawScene(context, scenes[p1], 0, width, height)
+                        screenshot.setImageBitmap(bitmap)
                     }
                 }
             }

+ 3 - 0
src/main/res/values/dimens.xml

@@ -19,4 +19,7 @@
     <dimen name="export_pdf_screenshot_height">72dp</dimen>
     <dimen name="export_pdf_cover_width">72dp</dimen>
     <dimen name="export_pdf_cover_height">72dp</dimen>
+
+    <dimen name="share_dialog_screenshot_width">144dp</dimen>
+    <dimen name="share_dialog_screenshot_height">72dp</dimen>
 </resources>