Sfoglia il codice sorgente

Merge branch 'master' of git.kdan.cc:Bomo/Bomo_for_Android_editorModule

faterhenry 6 anni fa
parent
commit
2d6950e08f

+ 2 - 7
src/main/java/com/bomostory/sceneeditmodule/MovieEditActivity.kt

@@ -14,13 +14,9 @@ import android.view.View
 import android.widget.CompoundButton
 import android.widget.SeekBar
 import android.widget.Toast
-import com.bomostory.sceneeditmodule.basicdata.DataParser
-import com.bomostory.sceneeditmodule.basicdata.Music
-import com.bomostory.sceneeditmodule.basicdata.Project
-import com.bomostory.sceneeditmodule.basicdata.Scene
+import com.bomostory.sceneeditmodule.basicdata.*
 import com.bomostory.sceneeditmodule.share.ExportPdfDialog
 import com.bomostory.sceneeditmodule.share.ShareDialog
-import com.bomostory.sceneeditmodule.basicdata.*
 import com.bomostory.sceneeditmodule.utils.MoviePlayer
 import com.bomostory.sceneeditmodule.utils.MusicPlayer
 import com.bomostory.sceneeditmodule.view.AudioTrackGroupView
@@ -283,8 +279,7 @@ class MovieEditActivity : AppCompatActivity(),
 
     private fun onClickSaveAndShareBtn(view: View) {
         shareDialog.apply {
-            name = project?.name ?: ""
-            author = project?.author ?: ""
+            project = this@MovieEditActivity.project ?: return@apply
             onClickBomo = Runnable { saveMovie() }
             onClickExportPdf = Runnable { onClickExportPdf() }
         }.show(supportFragmentManager)

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

@@ -6,6 +6,7 @@ import android.support.v4.app.FragmentManager
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
+import com.bomostory.sceneeditmodule.basicdata.Project
 import com.example.tfat.myapplication.R
 import kotlinx.android.synthetic.main.dialog_share.view.*
 
@@ -13,8 +14,7 @@ class ShareDialog : DialogFragment() {
 
     private val dialogTag = this::class.java.simpleName
 
-    var name: String = ""
-    var author: String = ""
+    lateinit var project: Project
 
     var onClickEditCover = Runnable {}
     var onClickExportPdf = Runnable {}
@@ -27,8 +27,9 @@ class ShareDialog : DialogFragment() {
 
     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
         return inflater.inflate(R.layout.dialog_share, container, false).apply {
-            tv_shareDialog_name.text = name
-            tv_shareDialog_author.text = author
+            movieView_shareDialog_preview.scene = project.story?.scenes?.get(0)
+            tv_shareDialog_name.text = project.name
+            tv_shareDialog_author.text = project.author
             btn_shareDialog_editCover.setOnClickListener { onClickEditCover.run() }
             btn_shareDialog_exportPdf.setOnClickListener { onClickExportPdf.run() }
             btn_shareDialog_print.setOnClickListener { onClickPrint.run() }

+ 15 - 15
src/main/res/layout/dialog_share.xml

@@ -46,8 +46,8 @@
         app:layout_constraintTop_toBottomOf="@id/tv_shareDialog_name"
         tools:text="by Alexander Wilson" />
 
-    <View
-        android:id="@+id/view_shareDialog_preview"
+    <com.bomostory.sceneeditmodule.view.MovieView
+        android:id="@+id/movieView_shareDialog_preview"
         android:layout_width="560dp"
         android:layout_height="280dp"
         android:layout_marginTop="24dp"
@@ -72,8 +72,8 @@
         android:text="@string/share_dialog_edit_cover"
         app:layout_constraintBottom_toTopOf="@id/btn_shareDialog_exportPdf"
         app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toLeftOf="@id/view_shareDialog_preview"
-        app:layout_constraintTop_toTopOf="@id/view_shareDialog_preview" />
+        app:layout_constraintRight_toLeftOf="@id/movieView_shareDialog_preview"
+        app:layout_constraintTop_toTopOf="@id/movieView_shareDialog_preview" />
 
     <Button
         android:id="@+id/btn_shareDialog_exportPdf"
@@ -89,7 +89,7 @@
         android:text="@string/share_dialog_export_pdf"
         app:layout_constraintBottom_toTopOf="@id/btn_shareDialog_print"
         app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toLeftOf="@id/view_shareDialog_preview"
+        app:layout_constraintRight_toLeftOf="@id/movieView_shareDialog_preview"
         app:layout_constraintTop_toBottomOf="@id/btn_shareDialog_editCover" />
 
     <TextView
@@ -107,7 +107,7 @@
         android:gravity="center"
         android:text="@string/share_dialog_print"
         app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toLeftOf="@id/view_shareDialog_preview"
+        app:layout_constraintRight_toLeftOf="@id/movieView_shareDialog_preview"
         app:layout_constraintTop_toBottomOf="@id/btn_shareDialog_exportPdf" />
 
     <ImageView
@@ -118,8 +118,8 @@
         android:layout_marginLeft="36dp"
         android:layout_marginRight="36dp"
         android:src="@drawable/ic_btn_bomo_01"
-        app:layout_constraintLeft_toRightOf="@id/view_shareDialog_preview"
-        app:layout_constraintTop_toTopOf="@id/view_shareDialog_preview" />
+        app:layout_constraintLeft_toRightOf="@id/movieView_shareDialog_preview"
+        app:layout_constraintTop_toTopOf="@id/movieView_shareDialog_preview" />
 
     <ImageView
         android:id="@+id/iv_shareDialog_youtube"
@@ -130,7 +130,7 @@
         android:layout_marginTop="16dp"
         android:layout_marginRight="36dp"
         android:src="@drawable/ic_btn_youtube_01"
-        app:layout_constraintLeft_toRightOf="@id/view_shareDialog_preview"
+        app:layout_constraintLeft_toRightOf="@id/movieView_shareDialog_preview"
         app:layout_constraintTop_toBottomOf="@id/iv_shareDialog_bomo" />
 
     <ImageView
@@ -142,7 +142,7 @@
         android:layout_marginTop="16dp"
         android:layout_marginRight="36dp"
         android:src="@drawable/ic_btn_facebook_01"
-        app:layout_constraintLeft_toRightOf="@id/view_shareDialog_preview"
+        app:layout_constraintLeft_toRightOf="@id/movieView_shareDialog_preview"
         app:layout_constraintTop_toBottomOf="@id/iv_shareDialog_youtube" />
 
     <ImageView
@@ -154,7 +154,7 @@
         android:layout_marginTop="16dp"
         android:layout_marginRight="36dp"
         android:src="@drawable/ic_btn_twitter_01"
-        app:layout_constraintLeft_toRightOf="@id/view_shareDialog_preview"
+        app:layout_constraintLeft_toRightOf="@id/movieView_shareDialog_preview"
         app:layout_constraintTop_toBottomOf="@id/iv_shareDialog_facebook" />
 
     <ImageView
@@ -166,7 +166,7 @@
         android:layout_marginTop="16dp"
         android:layout_marginRight="36dp"
         android:src="@drawable/ic_btn_more_01"
-        app:layout_constraintLeft_toRightOf="@id/view_shareDialog_preview"
+        app:layout_constraintLeft_toRightOf="@id/movieView_shareDialog_preview"
         app:layout_constraintTop_toBottomOf="@id/iv_shareDialog_twitter" />
 
     <ImageView
@@ -176,8 +176,8 @@
         android:layout_height="48dp"
         android:layout_marginTop="8dp"
         android:src="@drawable/ic_play"
-        app:layout_constraintLeft_toLeftOf="@id/view_shareDialog_preview"
-        app:layout_constraintTop_toBottomOf="@id/view_shareDialog_preview" />
+        app:layout_constraintLeft_toLeftOf="@id/movieView_shareDialog_preview"
+        app:layout_constraintTop_toBottomOf="@id/movieView_shareDialog_preview" />
 
     <TextView
         android:id="@+id/tv_shareDialog_time"
@@ -188,7 +188,7 @@
         android:textSize="16sp"
         android:textStyle="normal"
         app:layout_constraintBottom_toBottomOf="@id/iv_shareDialog_play"
-        app:layout_constraintRight_toRightOf="@id/view_shareDialog_preview"
+        app:layout_constraintRight_toRightOf="@id/movieView_shareDialog_preview"
         app:layout_constraintTop_toTopOf="@id/iv_shareDialog_play"
         tools:text="0:20/3:00" />