|
@@ -11,6 +11,7 @@ import android.os.Bundle
|
|
import android.os.Environment
|
|
import android.os.Environment
|
|
import android.os.Handler
|
|
import android.os.Handler
|
|
import android.support.v4.app.DialogFragment
|
|
import android.support.v4.app.DialogFragment
|
|
|
|
+import android.support.v4.content.FileProvider
|
|
import android.support.v7.app.AppCompatActivity
|
|
import android.support.v7.app.AppCompatActivity
|
|
import android.view.View
|
|
import android.view.View
|
|
import android.widget.CompoundButton
|
|
import android.widget.CompoundButton
|
|
@@ -19,14 +20,16 @@ import android.widget.Toast
|
|
import com.bomostory.sceneeditmodule.Config
|
|
import com.bomostory.sceneeditmodule.Config
|
|
import com.bomostory.sceneeditmodule.PdfMaker
|
|
import com.bomostory.sceneeditmodule.PdfMaker
|
|
import com.bomostory.sceneeditmodule.SuperMovieMaker
|
|
import com.bomostory.sceneeditmodule.SuperMovieMaker
|
|
-import com.bomostory.sceneeditmodule.basicdata.*
|
|
|
|
|
|
+import com.bomostory.sceneeditmodule.basicdata.Music
|
|
|
|
+import com.bomostory.sceneeditmodule.basicdata.Project
|
|
|
|
+import com.bomostory.sceneeditmodule.basicdata.Scene
|
|
import com.bomostory.sceneeditmodule.screen.movie.music.MusicEditDialog
|
|
import com.bomostory.sceneeditmodule.screen.movie.music.MusicEditDialog
|
|
import com.bomostory.sceneeditmodule.screen.movie.music.MusicSelectDialog
|
|
import com.bomostory.sceneeditmodule.screen.movie.music.MusicSelectDialog
|
|
import com.bomostory.sceneeditmodule.screen.movie.music.MusicSelectFragment
|
|
import com.bomostory.sceneeditmodule.screen.movie.music.MusicSelectFragment
|
|
-import com.bomostory.sceneeditmodule.share.ShareDialog
|
|
|
|
import com.bomostory.sceneeditmodule.screen.view.AudioTrackGroupView
|
|
import com.bomostory.sceneeditmodule.screen.view.AudioTrackGroupView
|
|
import com.bomostory.sceneeditmodule.screen.view.MovieSelectView
|
|
import com.bomostory.sceneeditmodule.screen.view.MovieSelectView
|
|
import com.bomostory.sceneeditmodule.share.ExportPdfDialog
|
|
import com.bomostory.sceneeditmodule.share.ExportPdfDialog
|
|
|
|
+import com.bomostory.sceneeditmodule.share.ShareDialog
|
|
import com.bomostory.sceneeditmodule.utils.MoviePlayerV2
|
|
import com.bomostory.sceneeditmodule.utils.MoviePlayerV2
|
|
import com.bomostory.sceneeditmodule.utils.MusicPlayerV2
|
|
import com.bomostory.sceneeditmodule.utils.MusicPlayerV2
|
|
import com.example.exportmedia.MediaHelper
|
|
import com.example.exportmedia.MediaHelper
|
|
@@ -375,7 +378,42 @@ class MovieEditActivity : AppCompatActivity(),
|
|
override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
|
override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- onClickBomo = Runnable { saveMovie() }
|
|
|
|
|
|
+ onClickBomo = Runnable {
|
|
|
|
+ saveMovie(object : OnMovieSavedListener {
|
|
|
|
+ override fun onSaved(file: File) {
|
|
|
|
+ AlertDialog.Builder(this@MovieEditActivity)
|
|
|
|
+ .setMessage("Complete")
|
|
|
|
+ .setPositiveButton("Play") { _, _ ->
|
|
|
|
+ val uri = Uri.parse(file.absolutePath)
|
|
|
|
+ val intent = Intent(Intent.ACTION_VIEW, uri).apply {
|
|
|
|
+ setDataAndType(uri, "video/mp4")
|
|
|
|
+ }
|
|
|
|
+ if (intent.resolveActivity(packageManager) != null) {
|
|
|
|
+ Intent.createChooser(intent, "").apply {
|
|
|
|
+ startActivity(this)
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ Toast.makeText(this@MovieEditActivity, "No app can play video", Toast.LENGTH_SHORT).show()
|
|
|
|
+ }
|
|
|
|
+ }.show()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ onClickMore = Runnable {
|
|
|
|
+ saveMovie(object : OnMovieSavedListener {
|
|
|
|
+ override fun onSaved(file: File) {
|
|
|
|
+ val authority = "$packageName"
|
|
|
|
+ val context = this@MovieEditActivity
|
|
|
|
+ val uri = FileProvider.getUriForFile(context, authority, file)
|
|
|
|
+
|
|
|
|
+ val intent = Intent(Intent.ACTION_SEND)
|
|
|
|
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET)
|
|
|
|
+ intent.type = "video/mp4"
|
|
|
|
+ intent.putExtra(Intent.EXTRA_STREAM, uri)
|
|
|
|
+ startActivity(Intent.createChooser(intent, ""))
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
onClickExportPdf = Runnable { onClickExportPdf() }
|
|
onClickExportPdf = Runnable { onClickExportPdf() }
|
|
onClickPlay = Runnable {
|
|
onClickPlay = Runnable {
|
|
moviePlayer.moviePlayListener = dialogMoviePlayListener
|
|
moviePlayer.moviePlayListener = dialogMoviePlayListener
|
|
@@ -422,7 +460,11 @@ class MovieEditActivity : AppCompatActivity(),
|
|
}.show(supportFragmentManager)
|
|
}.show(supportFragmentManager)
|
|
}
|
|
}
|
|
|
|
|
|
- private fun saveMovie() {
|
|
|
|
|
|
+ interface OnMovieSavedListener {
|
|
|
|
+ fun onSaved(file: File)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private fun saveMovie(onMovieSavedListener: OnMovieSavedListener) {
|
|
val scaledWidth = resources.getDimensionPixelSize(R.dimen.movie_width)
|
|
val scaledWidth = resources.getDimensionPixelSize(R.dimen.movie_width)
|
|
val scaleHeight = resources.getDimensionPixelSize(R.dimen.movie_height)
|
|
val scaleHeight = resources.getDimensionPixelSize(R.dimen.movie_height)
|
|
|
|
|
|
@@ -462,21 +504,7 @@ class MovieEditActivity : AppCompatActivity(),
|
|
AlertDialog.Builder(this).setMessage(msg).show()
|
|
AlertDialog.Builder(this).setMessage(msg).show()
|
|
delayedHide(100)
|
|
delayedHide(100)
|
|
}, {
|
|
}, {
|
|
- AlertDialog.Builder(this)
|
|
|
|
- .setMessage("Complete")
|
|
|
|
- .setPositiveButton("Play") { _, _ ->
|
|
|
|
- val uri = Uri.parse(outputFile.absolutePath)
|
|
|
|
- val intent = Intent(Intent.ACTION_VIEW, uri).apply {
|
|
|
|
- setDataAndType(uri, "video/mp4")
|
|
|
|
- }
|
|
|
|
- if (intent.resolveActivity(packageManager) != null) {
|
|
|
|
- Intent.createChooser(intent, "").apply {
|
|
|
|
- startActivity(this)
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- Toast.makeText(this, "No app can play video", Toast.LENGTH_SHORT).show()
|
|
|
|
- }
|
|
|
|
- }.show()
|
|
|
|
|
|
+ onMovieSavedListener.onSaved(outputFile)
|
|
delayedHide(100)
|
|
delayedHide(100)
|
|
})
|
|
})
|
|
}
|
|
}
|