|
@@ -5,52 +5,55 @@ import android.app.ProgressDialog
|
|
|
import android.content.DialogInterface
|
|
|
import android.content.Intent
|
|
|
import android.graphics.Bitmap
|
|
|
+import android.os.Bundle
|
|
|
import android.support.v7.app.AppCompatActivity
|
|
|
import android.support.v7.widget.LinearLayoutManager
|
|
|
-import android.os.Bundle
|
|
|
import android.support.v7.widget.RecyclerView
|
|
|
+import android.util.DisplayMetrics
|
|
|
import android.view.*
|
|
|
import android.widget.PopupWindow
|
|
|
+import android.widget.SeekBar
|
|
|
+import com.bomostory.sceneeditmodule.*
|
|
|
+import com.bomostory.sceneeditmodule.basicdata.*
|
|
|
+import com.bomostory.sceneeditmodule.navigationbar.actor.SelectActorView
|
|
|
+import com.bomostory.sceneeditmodule.navigationbar.brush.BrushView
|
|
|
+import com.bomostory.sceneeditmodule.navigationbar.dialogue.DialogueView
|
|
|
+import com.bomostory.sceneeditmodule.screen.movie.MovieEditActivity
|
|
|
+import com.bomostory.sceneeditmodule.screen.view.EditActorView
|
|
|
+import com.bomostory.sceneeditmodule.screen.view.LayerView
|
|
|
+import com.bomostory.sceneeditmodule.screen.view.OnTouchBoMoSceneListener
|
|
|
+import com.bomostory.sceneeditmodule.screen.view.OnTouchSceneListener
|
|
|
+import com.bomostory.sceneeditmodule.utils.FileUtils
|
|
|
+import com.example.tfat.myapplication.navigationbar.EditSceneView
|
|
|
import com.example.tfat.myapplication.navigationbar.NavigationBarView
|
|
|
+import com.example.tfat.myapplication.navigationbar.RecordFinishView
|
|
|
import com.example.tfat.myapplication.navigationbar.actor.ActorAdapter
|
|
|
+import com.example.tfat.myapplication.navigationbar.actor.LayerManagementDialog
|
|
|
import com.example.tfat.myapplication.navigationbar.scene.AddSceneAdapter
|
|
|
import com.example.tfat.myapplication.navigationbar.scene.AddSceneView
|
|
|
import com.example.tfat.myapplication.navigationbar.scene.ControlSceneView
|
|
|
import com.example.tfat.myapplication.navigationbar.scene.SceneAdapter
|
|
|
-import com.bomostory.sceneeditmodule.navigationbar.actor.SelectActorView
|
|
|
import com.google.gson.Gson
|
|
|
import kotlinx.android.synthetic.main.activity_scene_edit.*
|
|
|
-import com.bomostory.sceneeditmodule.basicdata.*
|
|
|
-import com.bomostory.sceneeditmodule.navigationbar.dialogue.DialogueView
|
|
|
-import com.example.tfat.myapplication.navigationbar.actor.LayerManagementDialog
|
|
|
import kotlinx.android.synthetic.main.control_actor_dialog.view.*
|
|
|
-import com.bomostory.sceneeditmodule.utils.FileUtils
|
|
|
-import android.util.DisplayMetrics
|
|
|
-import android.util.Log
|
|
|
import android.widget.RadioGroup
|
|
|
import com.bomostory.sceneeditmodule.EditTextDialog
|
|
|
-import com.bomostory.sceneeditmodule.screen.movie.MovieEditActivity
|
|
|
-import com.example.tfat.myapplication.navigationbar.EditSceneView
|
|
|
-import com.example.tfat.myapplication.navigationbar.RecordFinishView
|
|
|
-import io.reactivex.android.schedulers.AndroidSchedulers
|
|
|
-import io.reactivex.schedulers.Schedulers
|
|
|
-import kotlinx.android.synthetic.main.layer_management_fragment.*
|
|
|
import kotlinx.android.synthetic.main.popupview_opacity_dialog.view.*
|
|
|
import kotlinx.android.synthetic.main.view_control_dialogue_dialog.view.*
|
|
|
-import java.util.concurrent.CopyOnWriteArrayList
|
|
|
-import android.widget.SeekBar
|
|
|
import com.bomostory.sceneeditmodule.DialogueColorData
|
|
|
import com.bomostory.sceneeditmodule.SceneDrawer
|
|
|
import com.bomostory.sceneeditmodule.navigationbar.actor.ObjectView
|
|
|
-import com.bomostory.sceneeditmodule.navigationbar.brush.BrushView
|
|
|
-import com.bomostory.sceneeditmodule.screen.view.*
|
|
|
+import io.reactivex.android.schedulers.AndroidSchedulers
|
|
|
+import io.reactivex.schedulers.Schedulers
|
|
|
import kotlinx.android.synthetic.main.actor_select_view.view.*
|
|
|
-import kotlinx.android.synthetic.main.movie_item_view.*
|
|
|
+import kotlinx.android.synthetic.main.layer_management_fragment.*
|
|
|
import kotlinx.android.synthetic.main.navigation_bar_view.view.*
|
|
|
import kotlinx.android.synthetic.main.popupview_color_dialog.view.*
|
|
|
import kotlinx.android.synthetic.main.popupview_setting.view.*
|
|
|
import kotlinx.android.synthetic.main.scene_brush_view.view.*
|
|
|
+import java.io.File
|
|
|
import java.util.*
|
|
|
+import java.util.concurrent.CopyOnWriteArrayList
|
|
|
|
|
|
|
|
|
class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener, EditActorView.OnActorChangeListener,
|
|
@@ -75,6 +78,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
private var editTextDialog = EditTextDialog()
|
|
|
private val monitorSize = DisplayMetrics()
|
|
|
private var timer = Timer()
|
|
|
+ private val audioRecorder = AudioRecorder()
|
|
|
companion object {
|
|
|
const val PHOTO_FROM_GALLERY = 1
|
|
|
const val LAYER_MANAGEMENT = "layer_management"
|
|
@@ -492,9 +496,48 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
viewContainer.addView(controlSceneView)
|
|
|
startRecord.visibility = View.VISIBLE
|
|
|
}
|
|
|
+
|
|
|
+ override fun onPause() {
|
|
|
+ super.onPause()
|
|
|
+ cancelRecording()
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun cancelRecording() {
|
|
|
+ audioRecorder.cancelRecording()
|
|
|
+
|
|
|
+ tv_scene_activity_record_time.visibility = View.INVISIBLE
|
|
|
+ timer.cancel()
|
|
|
+ timer = Timer()
|
|
|
+ recordingTime = 0L
|
|
|
+ tv_scene_activity_record_time.text = "Recording 00:00"
|
|
|
+ isRecord = false
|
|
|
+ startRecord.setImageDrawable(resources.getDrawable(R.drawable.ic_btn_record))
|
|
|
+ navigationBar.visibility = View.VISIBLE
|
|
|
+ initControlBarView()
|
|
|
+ initControlSceneView()
|
|
|
+ initRecordFinishView()
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun getRecordFilePath(): String {
|
|
|
+ return "${Config.RECORD_FOLDER}/Project${project.name}_Record_Scene${System.currentTimeMillis()}.mp3"
|
|
|
+ }
|
|
|
+
|
|
|
private fun initRecord(){
|
|
|
+ var recordPath: String? = null
|
|
|
startRecord.setOnClickListener(View.OnClickListener {
|
|
|
if (!isRecord) {
|
|
|
+ // delete record
|
|
|
+ project.story?.let {
|
|
|
+ it.scenes?.let{
|
|
|
+ it[currentSceneIndex].record = null
|
|
|
+ if (it[currentSceneIndex].recordPath != null)
|
|
|
+ File(it[currentSceneIndex].recordPath).delete()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ recordPath = getRecordFilePath()
|
|
|
+ println("recordPath = $recordPath")
|
|
|
+ audioRecorder.prepare(File(recordPath))
|
|
|
+ audioRecorder.startRecording()
|
|
|
startRecord.setImageDrawable(resources.getDrawable(R.drawable.ic_btn_record_stop))
|
|
|
startRecordTime = System.currentTimeMillis()
|
|
|
isRecord = true
|
|
@@ -511,6 +554,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
}
|
|
|
}, 1000, 1000)
|
|
|
} else {
|
|
|
+ audioRecorder.stopRecording()
|
|
|
tv_scene_activity_record_time.visibility = View.INVISIBLE
|
|
|
timer.cancel()
|
|
|
timer = Timer()
|
|
@@ -522,6 +566,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
project.story?.let {
|
|
|
it.scenes?.let{
|
|
|
it[currentSceneIndex].record = record
|
|
|
+ it[currentSceneIndex].recordPath = recordPath
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@@ -547,6 +592,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
project.story?.let {
|
|
|
it.scenes?.let{
|
|
|
it[currentSceneIndex].record = autoSwipeRecord
|
|
|
+ it[currentSceneIndex].recordPath = recordPath
|
|
|
}
|
|
|
}
|
|
|
}
|