Browse Source

Merge branch 'cover-editor'

Wayne 6 years ago
parent
commit
0450064237

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

@@ -14,9 +14,14 @@ import kotlinx.android.synthetic.main.dialog_cover_editor.view.*
 
 class CoverEditorDialog : DialogFragment() {
     companion object {
+        const val FRONT_PAGE_POSITION = 0
         const val PAGE_COUNT = 2
     }
 
+    init {
+        isCancelable = false
+    }
+
     private val dialogTag = this::class.java.simpleName
 
     lateinit var onViewCreated: Runnable
@@ -126,4 +131,14 @@ class CoverEditorDialog : DialogFragment() {
         }
         super.show(manager, dialogTag)
     }
+
+    fun showDuplicatedProjectNameMsg() {
+        viewPager_coverEditorDialog_content.currentItem = FRONT_PAGE_POSITION
+        frontCoverEditorView_coverEditorDialog.showDuplicatedProjectNameMsg()
+    }
+
+    fun showEmptyProjectNameMsg() {
+        viewPager_coverEditorDialog_content.currentItem = FRONT_PAGE_POSITION
+        frontCoverEditorView_coverEditorDialog.showEmptyProjectNameMsg()
+    }
 }

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

@@ -98,4 +98,14 @@ class FrontCoverEditorView @JvmOverloads constructor(
             }
         })
     }
+
+    fun showDuplicatedProjectNameMsg() {
+        val msg = context.getString(R.string.front_cover_editor_dialog_duplicated_story_name_msg)
+        et_frontCoverEditor_projectName.error = msg
+    }
+
+    fun showEmptyProjectNameMsg() {
+        val msg = context.getString(R.string.front_cover_editor_dialog_empty_story_name_msg)
+        et_frontCoverEditor_projectName.error = msg
+    }
 }

+ 2 - 0
src/main/res/values/strings.xml

@@ -33,6 +33,8 @@
     <string name="front_cover_editor_dialog_save_btn">Save</string>
     <string name="front_cover_editor_dialog_choose_a_scene_btn">Choose a scene</string>
     <string name="front_cover_editor_dialog_cancel_btn">Cancel</string>
+    <string name="front_cover_editor_dialog_duplicated_story_name_msg">Story name already exist.</string>
+    <string name="front_cover_editor_dialog_empty_story_name_msg">Please enter story name.</string>
 
     <string name="category_item_daily">Daily</string>
     <string name="category_item_human_relations">Human relations</string>