|
@@ -4,15 +4,12 @@ import android.app.AlertDialog
|
|
import android.app.ProgressDialog
|
|
import android.app.ProgressDialog
|
|
import android.arch.lifecycle.Observer
|
|
import android.arch.lifecycle.Observer
|
|
import android.arch.lifecycle.ViewModelProviders
|
|
import android.arch.lifecycle.ViewModelProviders
|
|
-import android.content.ContentResolver
|
|
|
|
-import android.content.ContentValues
|
|
|
|
import android.content.DialogInterface
|
|
import android.content.DialogInterface
|
|
import android.content.Intent
|
|
import android.content.Intent
|
|
import android.net.Uri
|
|
import android.net.Uri
|
|
import android.os.Bundle
|
|
import android.os.Bundle
|
|
import android.os.Environment
|
|
import android.os.Environment
|
|
import android.os.Handler
|
|
import android.os.Handler
|
|
-import android.provider.MediaStore
|
|
|
|
import android.support.v4.app.DialogFragment
|
|
import android.support.v4.app.DialogFragment
|
|
import android.support.v4.content.FileProvider
|
|
import android.support.v4.content.FileProvider
|
|
import android.support.v7.app.AppCompatActivity
|
|
import android.support.v7.app.AppCompatActivity
|
|
@@ -23,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
|
|
@@ -400,13 +399,18 @@ class MovieEditActivity : AppCompatActivity(),
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- onClickYoutube = Runnable {
|
|
|
|
|
|
+ onClickMore = Runnable {
|
|
saveMovie(object : OnMovieSavedListener {
|
|
saveMovie(object : OnMovieSavedListener {
|
|
override fun onSaved(file: File) {
|
|
override fun onSaved(file: File) {
|
|
- val isSuc = shareToOtherApp(file, "com.google.android.youtube")
|
|
|
|
- if (!isSuc) {
|
|
|
|
- Toast.makeText(context, R.string.share_youtube_not_found, Toast.LENGTH_SHORT).show()
|
|
|
|
- }
|
|
|
|
|
|
+ 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, ""))
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -419,30 +423,6 @@ class MovieEditActivity : AppCompatActivity(),
|
|
}.show(supportFragmentManager)
|
|
}.show(supportFragmentManager)
|
|
}
|
|
}
|
|
|
|
|
|
- private fun shareToOtherApp(file: File, packageNameKeyWord: String): Boolean {
|
|
|
|
- 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)
|
|
|
|
-
|
|
|
|
- val activities = packageManager.queryIntentActivities(intent, 0)
|
|
|
|
- if (!activities.isEmpty()) {
|
|
|
|
- activities.forEach {
|
|
|
|
- val name = it.activityInfo.packageName
|
|
|
|
- if (name.contains(packageNameKeyWord)) {
|
|
|
|
- intent.setClassName(name, it.activityInfo.name)
|
|
|
|
- startActivity(intent)
|
|
|
|
- return true
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return false
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private fun onClickExportPdf() {
|
|
private fun onClickExportPdf() {
|
|
ExportPdfDialog().also { exportPdfDialog ->
|
|
ExportPdfDialog().also { exportPdfDialog ->
|
|
exportPdfDialog.image1Path = viewModel.project?.scene1File?.path ?: ""
|
|
exportPdfDialog.image1Path = viewModel.project?.scene1File?.path ?: ""
|