Преглед изворни кода

Cover editing OK! (no scene choosing)

Wayne пре 6 година
родитељ
комит
af54af92fa

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

@@ -1,5 +1,6 @@
 package com.bomostory.sceneeditmodule.basicdata
 
+import com.bomostory.sceneeditmodule.cover.Category
 import com.bomostory.sceneeditmodule.cover.CoverColor
 import com.example.bomocloud.theme.ThemeAssetIndex
 import java.io.File
@@ -16,6 +17,7 @@ data class Project (
         var author: String? = null,
         var frontCoverColor: CoverColor = CoverColor.Color1,
         var backCoverColor: CoverColor = CoverColor.Color1,
+        var category: Category = Category.Others,
     // TODO : Remove this
         var scene1: String? = null,
     // TODO : Remove this

+ 10 - 0
src/main/java/com/bomostory/sceneeditmodule/cover/CoverEditorDialog.kt

@@ -21,7 +21,17 @@ class CoverEditorDialog : DialogFragment() {
 
     lateinit var onViewCreated: Runnable
     var onSave: View.OnClickListener? = null
+        set(value) {
+            field = value
+            frontCoverEditorView_coverEditorDialog.onSave = value
+            backCoverEditorView_coverEditorDialog.onSave = value
+        }
     var onCancel: View.OnClickListener? = null
+        set(value) {
+            field = value
+            frontCoverEditorView_coverEditorDialog.onCancel = value
+            backCoverEditorView_coverEditorDialog.onCancel = value
+        }
     var storyName: String
         get () {
             return frontCoverEditorView_coverEditorDialog.storyName

+ 6 - 0
src/main/java/com/bomostory/sceneeditmodule/utils/FileUtils.kt

@@ -54,6 +54,12 @@ object FileUtils {
         }
     }
 
+    fun changeProjectName(oldName: String, newName: String): Boolean {
+        val oldProjectFolder = File(Config.PROJECTS_FOLDER, oldName)
+        val newProjectFolder = File(Config.PROJECTS_FOLDER, newName)
+        return oldProjectFolder.renameTo(newProjectFolder)
+    }
+
     fun saveProject(context: Context, project: Project, scaleWidth: Int, scaleHeight: Int): Completable {
         return Completable.create {
             try {