浏览代码

Save video by click more button in share dialog

Wayne 6 年之前
父节点
当前提交
c84da6ad88
共有 1 个文件被更改,包括 15 次插入3 次删除
  1. 15 3
      src/main/java/com/bomostory/sceneeditmodule/MovieEditActivity.kt

+ 15 - 3
src/main/java/com/bomostory/sceneeditmodule/MovieEditActivity.kt

@@ -5,11 +5,11 @@ import android.app.ProgressDialog
 import android.content.DialogInterface
 import android.content.Intent
 import android.net.Uri
-import android.support.v7.app.AppCompatActivity
 import android.os.Bundle
 import android.os.Environment
 import android.os.Handler
 import android.support.v4.app.DialogFragment
+import android.support.v7.app.AppCompatActivity
 import android.util.Log
 import android.view.View
 import android.widget.CompoundButton
@@ -19,6 +19,7 @@ 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.share.ShareDialog
 import com.bomostory.sceneeditmodule.utils.MoviePlayer
 import com.bomostory.sceneeditmodule.utils.MusicPlayer
 import com.bomostory.sceneeditmodule.view.AudioTrackGroupView
@@ -71,6 +72,8 @@ class MovieEditActivity : AppCompatActivity(),
         dialogFragment.dismiss()
     }
 
+    private val shareDialog = ShareDialog()
+
     private val mHideHandler = Handler()
     private val mHidePart2Runnable = Runnable {
         window.decorView.systemUiVisibility =
@@ -151,7 +154,7 @@ class MovieEditActivity : AppCompatActivity(),
         movieEditView.onAddMusicClickListener = View.OnClickListener(this::addMusic)
         movieEditView.onEditMusicClickListener = View.OnClickListener(this::editMusic)
         movieEditView.onDeleteMusicClickListener = View.OnClickListener(this::deleteMusic)
-        movieEditView.onSaveMovieClickListener = View.OnClickListener(this::saveMovie)
+        movieEditView.onSaveMovieClickListener = View.OnClickListener(this::onClickSaveAndShareBtn)
         movieEditView.onSeekBarChangeListener = object : SeekBar.OnSeekBarChangeListener {
             override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
                 if (fromUser) {
@@ -264,7 +267,16 @@ class MovieEditActivity : AppCompatActivity(),
         }
     }
 
-    private fun saveMovie(view: View) {
+    private fun onClickSaveAndShareBtn(view: View) {
+        shareDialog.apply {
+            name = project?.name ?: ""
+            author = project?.author ?: ""
+            onClickMore = Runnable { saveMovie() }
+        }
+                .show(supportFragmentManager)
+    }
+
+    private fun saveMovie() {
         val scaledWidth = resources.getDimensionPixelSize(R.dimen.movie_width)
         val scaleHeight = resources.getDimensionPixelSize(R.dimen.movie_height)