|
@@ -9,6 +9,8 @@ import android.support.v4.app.FragmentManager
|
|
|
import android.view.LayoutInflater
|
|
|
import android.view.View
|
|
|
import android.view.ViewGroup
|
|
|
+import com.bomostory.sceneeditmodule.CoverDrawer
|
|
|
+import com.bomostory.sceneeditmodule.basicdata.Project
|
|
|
import com.example.tfat.myapplication.R
|
|
|
import kotlinx.android.synthetic.main.dialog_export_pdf.view.*
|
|
|
|
|
@@ -20,6 +22,7 @@ class ExportPdfDialog : DialogFragment() {
|
|
|
Booklet,
|
|
|
}
|
|
|
|
|
|
+ lateinit var project: Project
|
|
|
var image1Path = ""
|
|
|
var image2Path = ""
|
|
|
var image3Path = ""
|
|
@@ -66,9 +69,26 @@ class ExportPdfDialog : DialogFragment() {
|
|
|
Picasso.get().load(image3Path).into(iv_exportPdfDialog_standard_3)
|
|
|
*/
|
|
|
}
|
|
|
+ iv_exportPdfDialog_foldableBookletCoverFront.setImageBitmap(createFrontCover(context))
|
|
|
+ iv_exportPdfDialog_foldableBookletCoverBack.setImageBitmap(createBackCover(context))
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private fun createFrontCover(context: Context): Bitmap {
|
|
|
+ val width = context.resources.getDimension(R.dimen.export_pdf_cover_width).toInt()
|
|
|
+ val height = context.resources.getDimension(R.dimen.export_pdf_cover_height).toInt()
|
|
|
+ val name = project.name ?: ""
|
|
|
+ val color = project.frontCoverColor.getColor(context)
|
|
|
+ return CoverDrawer.drawFrontCover(width, height, name, color)
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun createBackCover(context: Context): Bitmap {
|
|
|
+ val width = context.resources.getDimension(R.dimen.export_pdf_cover_width).toInt()
|
|
|
+ val height = context.resources.getDimension(R.dimen.export_pdf_cover_height).toInt()
|
|
|
+ val color = project.backCoverColor.getColor(context)
|
|
|
+ return CoverDrawer.drawBackCover(context, width, height, color)
|
|
|
+ }
|
|
|
+
|
|
|
private fun decodeImage(context: Context, imgPath: String): Bitmap {
|
|
|
val options = BitmapFactory.Options().apply {
|
|
|
inJustDecodeBounds = true
|