|
@@ -68,6 +68,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
private var editTextDialog = EditTextDialog()
|
|
private var editTextDialog = EditTextDialog()
|
|
private val monitorSize = DisplayMetrics()
|
|
private val monitorSize = DisplayMetrics()
|
|
private var timer = Timer()
|
|
private var timer = Timer()
|
|
|
|
+ private val audioRecorder = AudioRecorder()
|
|
companion object {
|
|
companion object {
|
|
const val PHOTO_FROM_GALLERY = 1
|
|
const val PHOTO_FROM_GALLERY = 1
|
|
const val LAYER_MANAGEMENT = "layer_management"
|
|
const val LAYER_MANAGEMENT = "layer_management"
|
|
@@ -441,16 +442,44 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
startRecord.visibility = View.VISIBLE
|
|
startRecord.visibility = View.VISIBLE
|
|
}
|
|
}
|
|
|
|
|
|
- private fun getRecordFilePath(sceneIndex: Int): String {
|
|
|
|
- return "${Config.RECORD_FOLDER}/Project${project.name}_Record_Scene$sceneIndex.mp3"
|
|
|
|
|
|
+ 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(){
|
|
private fun initRecord(){
|
|
- val audioRecorder = AudioRecorder()
|
|
|
|
- var recordPath = ""
|
|
|
|
|
|
+ var recordPath: String? = null
|
|
startRecord.setOnClickListener(View.OnClickListener {
|
|
startRecord.setOnClickListener(View.OnClickListener {
|
|
if (!isRecord) {
|
|
if (!isRecord) {
|
|
- recordPath = getRecordFilePath(currentSceneIndex)
|
|
|
|
|
|
+ // 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")
|
|
println("recordPath = $recordPath")
|
|
audioRecorder.prepare(File(recordPath))
|
|
audioRecorder.prepare(File(recordPath))
|
|
audioRecorder.startRecording()
|
|
audioRecorder.startRecording()
|