Browse Source

Fixed getter setter

Wayne 6 years ago
parent
commit
c5be7a9e03

+ 5 - 1
src/main/java/com/bomostory/sceneeditmodule/cover/BackCoverEditorView.kt

@@ -14,10 +14,14 @@ class BackCoverEditorView @JvmOverloads constructor(
 
     var onCancel: View.OnClickListener? = null
     var onSave: View.OnClickListener? = null
-    val selectedColor: CoverColor
+    var selectedColor: CoverColor
         get() {
             return coverColorSelectorView_backCoverEditor.selectedColor
         }
+        set(value) {
+            coverColorSelectorView_backCoverEditor.selectedColor = value
+        }
+
 
     init {
         View.inflate(context, R.layout.view_back_cover_editor, this)

+ 28 - 4
src/main/java/com/bomostory/sceneeditmodule/cover/CoverEditorDialog.kt

@@ -21,10 +21,34 @@ class CoverEditorDialog : DialogFragment() {
 
     var onSave: View.OnClickListener? = null
     var onCancel: View.OnClickListener? = null
-    var storyName = frontCoverEditorView_coverEditorDialog.storyName
-    var author = frontCoverEditorView_coverEditorDialog.author
-    var frontCoverColor = frontCoverEditorView_coverEditorDialog.selectedColor
-    var backCoverColor = backCoverEditorView_coverEditorDialog.selectedColor
+    var storyName: String
+        get () {
+            return frontCoverEditorView_coverEditorDialog.storyName
+        }
+        set(value) {
+            frontCoverEditorView_coverEditorDialog.storyName = value
+        }
+    var author: String
+        get() {
+            return frontCoverEditorView_coverEditorDialog.author
+        }
+        set(value) {
+            frontCoverEditorView_coverEditorDialog.author = value
+        }
+    var frontCoverColor: CoverColor
+        get() {
+            return frontCoverEditorView_coverEditorDialog.selectedColor
+        }
+        set(value) {
+            frontCoverEditorView_coverEditorDialog.selectedColor = value
+        }
+    var backCoverColor: CoverColor
+        get() {
+            return backCoverEditorView_coverEditorDialog.selectedColor
+        }
+        set(value) {
+            backCoverEditorView_coverEditorDialog.selectedColor = value
+        }
 
     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
         return inflater.inflate(R.layout.dialog_cover_editor, container, false).apply {