Bladeren bron

Show story name and author on cover in CoverEditorDialog

Wayne 6 jaren geleden
bovenliggende
commit
1eb5332928
1 gewijzigde bestanden met toevoegingen van 31 en 0 verwijderingen
  1. 31 0
      src/main/java/com/bomostory/sceneeditmodule/cover/FrontCoverEditorView.kt

+ 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
+            }
+        })
     }
 }