ソースを参照

Show story name and author on cover in CoverEditorDialog

Wayne 6 年 前
コミット
1eb5332928

+ 31 - 0
src/main/java/com/bomostory/sceneeditmodule/cover/FrontCoverEditorView.kt

@@ -1,6 +1,8 @@
 package com.bomostory.sceneeditmodule.cover
 
 import android.content.Context
+import android.text.Editable
+import android.text.TextWatcher
 import android.util.AttributeSet
 import android.view.View
 import android.widget.ArrayAdapter
@@ -66,5 +68,34 @@ class FrontCoverEditorView @JvmOverloads constructor(
                 add(s)
             }
         }
+
+        et_frontCoverEditor_projectName.addTextChangedListener(object : TextWatcher {
+            override fun afterTextChanged(editable: Editable?) {
+                if (editable == null) return
+                tv_frontCoverEditor_coverTitle.text = editable.toString()
+            }
+
+            override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
+                // do nothing
+            }
+
+            override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
+                // do nothing
+            }
+        })
+        et_frontCoverEditor_author.addTextChangedListener(object : TextWatcher {
+            override fun afterTextChanged(editable: Editable?) {
+                if (editable == null) return
+                tv_frontCoverEditor_coverAuthor.text = editable.toString()
+            }
+
+            override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
+                // do nothing
+            }
+
+            override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
+                // do nothing
+            }
+        })
     }
 }