فهرست منبع

Merge branch 'recordFix'

cooperku_kdanmobile 6 سال پیش
والد
کامیت
fd03de3d48

+ 0 - 2
src/main/java/com/bomostory/sceneeditmodule/Config.kt

@@ -8,11 +8,9 @@ object Config {
     private const val ASSETS_FOLDER_PATH = "/Bomo/Assets"
     private const val PROJECTS_FOLDER_PATH = "/Bomo/Projects"
     private const val IMAGE_FOLDER_PATH = "/Bomo/Image"
-    private const val RECORD_FOLDER_PATH = "/Bomo/Record"
     val IMAGE_FOLDER = File(Environment.getExternalStorageDirectory(), IMAGE_FOLDER_PATH)
     val ASSETS_FOLDER = File(Environment.getExternalStorageDirectory(), ASSETS_FOLDER_PATH)
     val PROJECTS_FOLDER = File(Environment.getExternalStorageDirectory(), PROJECTS_FOLDER_PATH)
-    val RECORD_FOLDER = File(Environment.getExternalStorageDirectory(), RECORD_FOLDER_PATH)
     const val PROJECT_FILE_NAME = "index"
     val PDF_FOLDER = File(ROOT, "pdf")
 

+ 5 - 3
src/main/java/com/bomostory/sceneeditmodule/SceneEditActivity.kt

@@ -499,7 +499,9 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
 
     override fun onPause() {
         super.onPause()
-        cancelRecording()
+        if (isRecord) {
+            cancelRecording()
+        }
     }
 
     private fun cancelRecording() {
@@ -519,7 +521,8 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
     }
 
     private fun getRecordFilePath(): String {
-        return "${Config.RECORD_FOLDER}/Project${project.name}_Record_Scene${System.currentTimeMillis()}.mp3"
+        val projectFolder = File(Config.PROJECTS_FOLDER, project.name)
+        return "${projectFolder.absolutePath}/Record/${System.currentTimeMillis()}.mp3"
     }
 
     private fun initRecord(){
@@ -535,7 +538,6 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
                     }
                 }
                 recordPath = getRecordFilePath()
-                println("recordPath = $recordPath")
                 audioRecorder.prepare(File(recordPath))
                 audioRecorder.startRecording()
                 startRecord.setImageDrawable(resources.getDrawable(R.drawable.ic_btn_record_stop))