Kaynağa Gözat

Feature: TextBox tab UI

cooperku_kdanmobile 5 yıl önce
ebeveyn
işleme
3338977f0c
30 değiştirilmiş dosya ile 879 ekleme ve 1 silme
  1. 1 1
      reader/src/main/java/com/kdanmobile/reader/screen/view/ViewerEditTabView.kt
  2. 87 0
      reader/src/main/java/com/kdanmobile/reader/screen/view/ViewerEditView.kt
  3. 104 0
      reader/src/main/java/com/kdanmobile/reader/screen/view/edit/TextAttrView.kt
  4. 58 0
      reader/src/main/java/com/kdanmobile/reader/screen/view/edit/TextBoxTabView.kt
  5. 74 0
      reader/src/main/java/com/kdanmobile/reader/screen/view/edit/TextSeekBar.kt
  6. 47 0
      reader/src/main/java/com/kdanmobile/reader/screen/view/edit/TitleButton.kt
  7. 17 0
      reader/src/main/res/drawable/blue_seekbar_progress.xml
  8. 12 0
      reader/src/main/res/drawable/ic_aligncenter.xml
  9. 12 0
      reader/src/main/res/drawable/ic_aligncenter_selected.xml
  10. 12 0
      reader/src/main/res/drawable/ic_alignleft_accent.xml
  11. 12 0
      reader/src/main/res/drawable/ic_alignleft_accent_selected.xml
  12. 12 0
      reader/src/main/res/drawable/ic_alignright.xml
  13. 12 0
      reader/src/main/res/drawable/ic_alignright_selected.xml
  14. 12 0
      reader/src/main/res/drawable/ic_bold.xml
  15. 12 0
      reader/src/main/res/drawable/ic_bold_selected.xml
  16. 12 0
      reader/src/main/res/drawable/ic_form_selected.xml
  17. 12 0
      reader/src/main/res/drawable/ic_italic.xml
  18. 12 0
      reader/src/main/res/drawable/ic_italic_selected.xml
  19. 18 0
      reader/src/main/res/drawable/ic_shape_selected.xml
  20. 12 0
      reader/src/main/res/drawable/ic_signature_selected.xml
  21. 12 0
      reader/src/main/res/drawable/ic_stamp_selected.xml
  22. 12 0
      reader/src/main/res/drawable/ic_textbox_selected.xml
  23. 12 0
      reader/src/main/res/drawable/shape_rec_blue_border_rcorner.xml
  24. 27 0
      reader/src/main/res/layout/view_viewer_edit_item_edittext.xml
  25. 55 0
      reader/src/main/res/layout/view_viewer_edit_item_seekbar.xml
  26. 68 0
      reader/src/main/res/layout/view_viewer_edit_item_text_attr.xml
  27. 38 0
      reader/src/main/res/layout/view_viewer_edit_item_title_button.xml
  28. 86 0
      reader/src/main/res/layout/view_viewer_edit_tab_text_box.xml
  29. 16 0
      reader/src/main/res/values/attrs.xml
  30. 3 0
      reader/src/main/res/values/colors.xml

+ 1 - 1
reader/src/main/java/com/kdanmobile/reader/screen/view/ViewerEditTabView.kt

@@ -15,7 +15,7 @@ class ViewerEditTabView : ConstraintLayout {
             viewerEdit_tab_textBox?.setOnClickListener(value)
         }
 
-    var onClickListenerTabSignture: OnClickListener? = null
+    var onClickListenerTabSignature: OnClickListener? = null
         set(value) {
             field = value
             viewerEdit_tab_signature?.setOnClickListener(value)

+ 87 - 0
reader/src/main/java/com/kdanmobile/reader/screen/view/ViewerEditView.kt

@@ -2,14 +2,26 @@ package com.kdanmobile.reader.screen.view
 
 import android.content.Context
 import android.support.constraint.ConstraintLayout
+import android.support.v4.content.ContextCompat
 import android.util.AttributeSet
 import android.view.LayoutInflater
 import android.view.View
+import android.widget.ImageButton
 import com.kdanmobile.reader.R
+import com.kdanmobile.reader.screen.view.edit.TextBoxTabView
 import kotlinx.android.synthetic.main.view_viewer_edit.view.*
 
 class ViewerEditView : ConstraintLayout {
 
+    private enum class ViewerEditTabType {
+        NONE, TEXT_BOX, SIGNATURE, STAMP, SHAPE, FORM
+    }
+
+    private var tabType = ViewerEditTabType.NONE
+    private var selected: ImageButton? = null
+
+//    private val selectedColor = ContextCompat.getColor(context, R.color.reader_viewer_edit_tab_color_selected)
+
     constructor(context: Context) : super(context) {
         initView()
     }
@@ -30,9 +42,84 @@ class ViewerEditView : ConstraintLayout {
 
     private fun setupTabView() {
         viewerEdit_tab.onClickListenerTabTextBox = OnClickListener(this::setupTextBoxView)
+        viewerEdit_tab.onClickListenerTabSignature = OnClickListener(this::setupSignatureView)
+        viewerEdit_tab.onClickListenerTabStamp = OnClickListener(this::setupStampView)
+        viewerEdit_tab.onClickListenerTabShape = OnClickListener(this::setupShapeView)
+        viewerEdit_tab.onClickListenerTabForm = OnClickListener(this::setupFormView)
+    }
+
+    private fun getButtonDrawable(tabType: ViewerEditTabType, isSelected: Boolean): Int {
+        when (tabType) {
+            ViewerEditTabType.NONE, ViewerEditTabType.TEXT_BOX ->
+                return if (isSelected) R.drawable.ic_textbox_selected else R.drawable.ic_textbox
+            ViewerEditTabType.SIGNATURE ->
+                return if (isSelected) R.drawable.ic_signature_selected else R.drawable.ic_signature
+            ViewerEditTabType.STAMP ->
+                return if (isSelected) R.drawable.ic_stamp_selected else R.drawable.ic_stamp
+            ViewerEditTabType.SHAPE ->
+                return if (isSelected) R.drawable.ic_shape_selected else R.drawable.ic_shape
+            ViewerEditTabType.FORM ->
+                return if (isSelected) R.drawable.ic_form_selected else R.drawable.ic_form
+        }
+    }
+
+    private fun setupContent(button: ImageButton, tabType: ViewerEditTabType): Boolean {
+        var changed = false
+        if (this.tabType != tabType) {
+            selected?.setImageDrawable(ContextCompat.getDrawable(context, getButtonDrawable(this.tabType, false)))
+            this.tabType = tabType
+//            selected?.clearColorFilter()
+            selected = button
+            button.setImageDrawable(ContextCompat.getDrawable(context, getButtonDrawable(this.tabType, true)))
+//            button.drawable.setColorFilter(selectedColor, PorterDuff.Mode.SRC_IN)
+//            button.setColorFilter(selectedColor, PorterDuff.Mode.SRC_IN)
+//            button.setColorFilter(Color.BLACK, PorterDuff.Mode.SCREEN)
+
+            viewEdit_layout_tab_content.removeAllViews()
+            changed = true
+        }
+        return changed
     }
 
     private fun setupTextBoxView(view: View) {
         //TODO implements tab view and add to viewEdit_layout_tab_content
+        val changed = setupContent(view as ImageButton, ViewerEditTabType.TEXT_BOX)
+        if (changed) {
+            val textBoxTabView = TextBoxTabView(context)
+            val params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT)
+            viewEdit_layout_tab_content.addView(textBoxTabView, params)
+        }
+    }
+
+    private fun setupSignatureView(view: View) {
+        //TODO implements tab view and add to viewEdit_layout_tab_content
+        val changed = setupContent(view as ImageButton, ViewerEditTabType.SIGNATURE)
+        if (changed) {
+            LayoutInflater.from(context).inflate(R.layout.view_viewer_edit_tab, viewEdit_layout_tab_content)
+        }
+    }
+
+    private fun setupStampView(view: View) {
+        //TODO implements tab view and add to viewEdit_layout_tab_content
+        val changed = setupContent(view as ImageButton, ViewerEditTabType.STAMP)
+        if (changed) {
+            LayoutInflater.from(context).inflate(R.layout.view_viewer_edit_tab, viewEdit_layout_tab_content)
+        }
+    }
+
+    private fun setupShapeView(view: View) {
+        //TODO implements tab view and add to viewEdit_layout_tab_content
+        val changed = setupContent(view as ImageButton, ViewerEditTabType.SHAPE)
+        if (changed) {
+            LayoutInflater.from(context).inflate(R.layout.view_viewer_edit_tab, viewEdit_layout_tab_content)
+        }
+    }
+
+    private fun setupFormView(view: View) {
+//TODO implements tab view and add to viewEdit_layout_tab_content
+        val changed = setupContent(view as ImageButton, ViewerEditTabType.FORM)
+        if (changed) {
+            LayoutInflater.from(context).inflate(R.layout.view_viewer_edit_tab, viewEdit_layout_tab_content)
+        }
     }
 }

+ 104 - 0
reader/src/main/java/com/kdanmobile/reader/screen/view/edit/TextAttrView.kt

@@ -0,0 +1,104 @@
+package com.kdanmobile.reader.screen.view.edit
+
+import android.content.Context
+import android.graphics.PorterDuff
+import android.support.constraint.ConstraintLayout
+import android.support.v4.content.ContextCompat
+import android.util.AttributeSet
+import android.view.Gravity
+import android.view.LayoutInflater
+import com.kdanmobile.reader.R
+import kotlinx.android.synthetic.main.view_viewer_edit_item_text_attr.view.*
+
+class TextAttrView : ConstraintLayout {
+
+    interface OnTextAttrClickListener {
+        fun onBoldClick(isSelected: Boolean)
+
+        fun onItalicClick(isSelected: Boolean)
+
+        fun onAlignmentClick(gravity: Int)
+    }
+    var onTextAttrClickListener: OnTextAttrClickListener? = null
+
+    var isTextBold = false
+        set(value) {
+            field = value
+            when (value) {
+                true -> btn_text_bold?.setColorFilter(selectedColor, PorterDuff.Mode.SRC_IN)
+                false -> btn_text_bold?.clearColorFilter()
+            }
+        }
+    var isTextItalic = false
+        set(value) {
+            field = value
+            when (value) {
+                true -> btn_text_italic?.setColorFilter(selectedColor, PorterDuff.Mode.SRC_IN)
+                false -> btn_text_italic?.clearColorFilter()
+            }
+        }
+    var alignment = Gravity.LEFT
+        set(value) {
+            field = value
+            when (value) {
+                Gravity.LEFT -> {
+                    btn_text_align_left.setColorFilter(selectedColor, PorterDuff.Mode.SRC_IN)
+                    btn_text_align_center.clearColorFilter()
+                    btn_text_align_right.clearColorFilter()
+                }
+                Gravity.CENTER -> {
+                    btn_text_align_left.clearColorFilter()
+                    btn_text_align_center.setColorFilter(selectedColor, PorterDuff.Mode.SRC_IN)
+                    btn_text_align_right.clearColorFilter()
+                }
+                Gravity.RIGHT -> {
+                    btn_text_align_left.clearColorFilter()
+                    btn_text_align_center.clearColorFilter()
+                    btn_text_align_right.setColorFilter(selectedColor, PorterDuff.Mode.SRC_IN)
+                }
+            }
+        }
+    private val selectedColor = ContextCompat.getColor(context, R.color.reader_viewer_edit_tab_color_selected)
+
+    constructor(context: Context) : super(context) {
+        initView()
+    }
+
+    constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+        initView()
+    }
+
+    constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) {
+        initView()
+    }
+
+    private fun initView() {
+        LayoutInflater.from(context).inflate(R.layout.view_viewer_edit_item_text_attr, this)
+
+        btn_text_bold.setOnClickListener {
+            isTextBold = !isTextBold
+            onTextAttrClickListener?.onBoldClick(isTextBold)
+        }
+        btn_text_italic.setOnClickListener {
+            isTextItalic = !isTextItalic
+            onTextAttrClickListener?.onItalicClick(isTextItalic)
+        }
+
+        btn_text_align_left.setOnClickListener {
+            alignment = Gravity.LEFT
+            onTextAttrClickListener?.onAlignmentClick(alignment)
+        }
+        btn_text_align_center.setOnClickListener {
+            alignment = Gravity.CENTER
+            onTextAttrClickListener?.onAlignmentClick(alignment)
+        }
+        btn_text_align_right.setOnClickListener {
+            alignment = Gravity.RIGHT
+            onTextAttrClickListener?.onAlignmentClick(alignment)
+        }
+
+        isTextBold = false
+        isTextItalic = false
+        alignment = Gravity.LEFT
+    }
+}

+ 58 - 0
reader/src/main/java/com/kdanmobile/reader/screen/view/edit/TextBoxTabView.kt

@@ -0,0 +1,58 @@
+package com.kdanmobile.reader.screen.view.edit
+
+import android.content.Context
+import android.support.constraint.ConstraintLayout
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import android.widget.SeekBar
+import com.kdanmobile.reader.R
+import kotlinx.android.synthetic.main.view_viewer_edit_tab_text_box.view.*
+
+class TextBoxTabView : ConstraintLayout {
+
+    constructor(context: Context) : super(context) {
+        initView()
+    }
+
+    constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+        initView()
+    }
+
+    constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) {
+        initView()
+    }
+
+    private fun initView() {
+        LayoutInflater.from(context).inflate(R.layout.view_viewer_edit_tab_text_box, this)
+
+        titleButton_textBox.onButtonClickListener = OnClickListener { _ ->
+            println("onButtonClick")
+        }
+
+        textAttrView_textBox.onTextAttrClickListener = object : TextAttrView.OnTextAttrClickListener {
+            override fun onBoldClick(isSelected: Boolean) {
+                println("onBoldClick $isSelected")
+            }
+
+            override fun onItalicClick(isSelected: Boolean) {
+                println("onItalicClick $isSelected")
+            }
+
+            override fun onAlignmentClick(gravity: Int) {
+                println("onAlignmentClick $gravity")
+            }
+        }
+
+        seekBar_textBox_textSize.onSeekBarChangeListener = object : SeekBar.OnSeekBarChangeListener {
+            override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
+                println("onProgressChanged $progress")
+            }
+
+            override fun onStartTrackingTouch(seekBar: SeekBar) {
+            }
+
+            override fun onStopTrackingTouch(seekBar: SeekBar) {
+            }
+        }
+    }
+}

+ 74 - 0
reader/src/main/java/com/kdanmobile/reader/screen/view/edit/TextSeekBar.kt

@@ -0,0 +1,74 @@
+package com.kdanmobile.reader.screen.view.edit
+
+import android.content.Context
+import android.support.constraint.ConstraintLayout
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import android.widget.SeekBar
+import com.kdanmobile.reader.R
+import kotlinx.android.synthetic.main.view_viewer_edit_item_seekbar.view.*
+
+class TextSeekBar : ConstraintLayout {
+
+    private var title = ""
+    private var unit = ""
+    private var maxValue = 100
+    private var minValue = 0
+    private var initValue = 0
+
+    var currentValue = 0
+        set(value) {
+            field = Math.max(Math.min(value, maxValue), minValue)
+            tv_seekBarValue?.text = "$field$unit"
+            seekBar?.progress = field - minValue
+        }
+    var onSeekBarChangeListener: SeekBar.OnSeekBarChangeListener? = null
+
+    constructor(context: Context) : super(context) {
+        initView()
+    }
+
+    constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+        initAttr(attrs)
+        initView()
+    }
+
+    constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) {
+        initAttr(attrs)
+        initView()
+    }
+
+    private fun initAttr(attributeSet: AttributeSet) {
+        val typedArray = context.theme.obtainStyledAttributes(attributeSet, R.styleable.TextSeekBar, 0, 0)
+        title = typedArray.getString(R.styleable.TextSeekBar_title) ?: ""
+        unit = typedArray.getString(R.styleable.TextSeekBar_unit) ?: ""
+        maxValue = typedArray.getInteger(R.styleable.TextSeekBar_maxValue, 100)
+        minValue = typedArray.getInteger(R.styleable.TextSeekBar_minValue, 0)
+        if (maxValue < minValue)
+            maxValue = minValue
+        initValue = typedArray.getInteger(R.styleable.TextSeekBar_initValue, 0)
+        initValue = Math.max(Math.min(initValue, maxValue), minValue)
+    }
+
+    private fun initView() {
+        LayoutInflater.from(context).inflate(R.layout.view_viewer_edit_item_seekbar, this)
+
+        tv_seekBarTitle.text = title
+        seekBar.max = maxValue - minValue
+        seekBar.setOnSeekBarChangeListener(object: SeekBar.OnSeekBarChangeListener {
+            override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
+                currentValue = progress + minValue
+                onSeekBarChangeListener?.onProgressChanged(seekBar, currentValue, fromUser)
+            }
+
+            override fun onStartTrackingTouch(seekBar: SeekBar) {
+                onSeekBarChangeListener?.onStartTrackingTouch(seekBar)
+            }
+
+            override fun onStopTrackingTouch(seekBar: SeekBar) {
+                onSeekBarChangeListener?.onStopTrackingTouch(seekBar)
+            }
+        })
+        currentValue = initValue
+    }
+}

+ 47 - 0
reader/src/main/java/com/kdanmobile/reader/screen/view/edit/TitleButton.kt

@@ -0,0 +1,47 @@
+package com.kdanmobile.reader.screen.view.edit
+
+import android.content.Context
+import android.support.constraint.ConstraintLayout
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import com.kdanmobile.reader.R
+import kotlinx.android.synthetic.main.view_viewer_edit_item_title_button.view.*
+
+class TitleButton : ConstraintLayout {
+
+    private var title = ""
+    private var buttonText = ""
+
+    var onButtonClickListener: OnClickListener? = null
+        set(value) {
+            field = value
+            btn_add?.setOnClickListener(value)
+        }
+
+    constructor(context: Context) : super(context) {
+        initView()
+    }
+
+    constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+        initAttr(attrs)
+        initView()
+    }
+
+    constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) {
+        initAttr(attrs)
+        initView()
+    }
+
+    private fun initAttr(attributeSet: AttributeSet) {
+        val typedArray = context.theme.obtainStyledAttributes(attributeSet, R.styleable.TitleButton, 0, 0)
+        title = typedArray.getString(R.styleable.TitleButton_title) ?: ""
+        buttonText = typedArray.getString(R.styleable.TitleButton_buttonText) ?: ""
+    }
+
+    private fun initView() {
+        LayoutInflater.from(context).inflate(R.layout.view_viewer_edit_item_title_button, this)
+
+        tv_title.text = title
+        btn_add.text = buttonText
+    }
+}

+ 17 - 0
reader/src/main/res/drawable/blue_seekbar_progress.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+    <item android:id="@android:id/background">
+        <shape android:shape="rectangle" >
+            <solid
+                android:color="#30AFFD" />
+        </shape>
+    </item>
+    <item android:id="@android:id/progress">
+        <clip>
+            <shape android:shape="rectangle" >
+                <solid
+                    android:color="#0077fd" />
+            </shape>
+        </clip>
+    </item>
+</layer-list>

+ 12 - 0
reader/src/main/res/drawable/ic_aligncenter.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M7,15L7,17L17,17L17,15L7,15ZM3,21L21,21L21,19L3,19L3,21ZM3,13L21,13L21,11L3,11L3,13ZM7,7L7,9L17,9L17,7L7,7ZM3,3L3,5L21,5L21,3L3,3Z"
+      android:strokeWidth="1"
+      android:fillColor="#000000"
+      android:fillType="nonZero"
+      android:strokeColor="#00000000"/>
+</vector>

+ 12 - 0
reader/src/main/res/drawable/ic_aligncenter_selected.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M7,15L7,17L17,17L17,15L7,15ZM3,21L21,21L21,19L3,19L3,21ZM3,13L21,13L21,11L3,11L3,13ZM7,7L7,9L17,9L17,7L7,7ZM3,3L3,5L21,5L21,3L3,3Z"
+      android:strokeWidth="1"
+      android:fillColor="#0077FD"
+      android:fillType="nonZero"
+      android:strokeColor="#00000000"/>
+</vector>

+ 12 - 0
reader/src/main/res/drawable/ic_alignleft_accent.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M15,15L3,15L3,17L15,17L15,15ZM15,7L3,7L3,9L15,9L15,7ZM3,13L21,13L21,11L3,11L3,13ZM3,21L21,21L21,19L3,19L3,21ZM3,3L3,5L21,5L21,3L3,3Z"
+      android:strokeWidth="1"
+      android:fillColor="#000000"
+      android:fillType="nonZero"
+      android:strokeColor="#00000000"/>
+</vector>

+ 12 - 0
reader/src/main/res/drawable/ic_alignleft_accent_selected.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M15,15L3,15L3,17L15,17L15,15ZM15,7L3,7L3,9L15,9L15,7ZM3,13L21,13L21,11L3,11L3,13ZM3,21L21,21L21,19L3,19L3,21ZM3,3L3,5L21,5L21,3L3,3Z"
+      android:strokeWidth="1"
+      android:fillColor="#0077FD"
+      android:fillType="nonZero"
+      android:strokeColor="#00000000"/>
+</vector>

+ 12 - 0
reader/src/main/res/drawable/ic_alignright.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M3,21L21,21L21,19L3,19L3,21ZM9,17L21,17L21,15L9,15L9,17ZM3,13L21,13L21,11L3,11L3,13ZM9,9L21,9L21,7L9,7L9,9ZM3,3L3,5L21,5L21,3L3,3Z"
+      android:strokeWidth="1"
+      android:fillColor="#000000"
+      android:fillType="nonZero"
+      android:strokeColor="#00000000"/>
+</vector>

+ 12 - 0
reader/src/main/res/drawable/ic_alignright_selected.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M3,21L21,21L21,19L3,19L3,21ZM9,17L21,17L21,15L9,15L9,17ZM3,13L21,13L21,11L3,11L3,13ZM9,9L21,9L21,7L9,7L9,9ZM3,3L3,5L21,5L21,3L3,3Z"
+      android:strokeWidth="1"
+      android:fillColor="#0077FD"
+      android:fillType="nonZero"
+      android:strokeColor="#00000000"/>
+</vector>

+ 12 - 0
reader/src/main/res/drawable/ic_bold.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M15.6,10.79C16.57,10.12 17.25,9.02 17.25,8C17.25,5.74 15.5,4 13.25,4L7,4L7,18L14.04,18C16.13,18 17.75,16.3 17.75,14.21C17.75,12.69 16.89,11.39 15.6,10.79ZM10,6.5L13,6.5C13.83,6.5 14.5,7.17 14.5,8C14.5,8.83 13.83,9.5 13,9.5L10,9.5L10,6.5ZM13.5,15.5L10,15.5L10,12.5L13.5,12.5C14.33,12.5 15,13.17 15,14C15,14.83 14.33,15.5 13.5,15.5Z"
+      android:strokeWidth="1"
+      android:fillColor="#000000"
+      android:fillType="nonZero"
+      android:strokeColor="#00000000"/>
+</vector>

+ 12 - 0
reader/src/main/res/drawable/ic_bold_selected.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M15.6,10.79C16.57,10.12 17.25,9.02 17.25,8C17.25,5.74 15.5,4 13.25,4L7,4L7,18L14.04,18C16.13,18 17.75,16.3 17.75,14.21C17.75,12.69 16.89,11.39 15.6,10.79ZM10,6.5L13,6.5C13.83,6.5 14.5,7.17 14.5,8C14.5,8.83 13.83,9.5 13,9.5L10,9.5L10,6.5ZM13.5,15.5L10,15.5L10,12.5L13.5,12.5C14.33,12.5 15,13.17 15,14C15,14.83 14.33,15.5 13.5,15.5Z"
+      android:strokeWidth="1"
+      android:fillColor="#0077FD"
+      android:fillType="nonZero"
+      android:strokeColor="#00000000"/>
+</vector>

+ 12 - 0
reader/src/main/res/drawable/ic_form_selected.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M19,5v14L5,19L5,5h14zM20.1,3L3.9,3c-0.5,0 -0.9,0.4 -0.9,0.9v16.2c0,0.4 0.4,0.9 0.9,0.9h16.2c0.4,0 0.9,-0.5 0.9,-0.9L21,3.9c0,-0.5 -0.5,-0.9 -0.9,-0.9zM11,7h6v2h-6L11,7zM11,11h6v2h-6v-2zM11,15h6v2h-6v-2zM7,7h2v2L7,9L7,7zM7,11h2v2L7,13v-2zM7,15h2v2L7,17v-2z"
+      android:strokeWidth="1"
+      android:fillColor="#0077FD"
+      android:fillType="nonZero"
+      android:strokeColor="#00000000"/>
+</vector>

+ 12 - 0
reader/src/main/res/drawable/ic_italic.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M10,4l0,3l2.21,0l-3.42,8l-2.79,0l0,3l8,0l0,-3l-2.21,0l3.42,-8l2.79,0l0,-3z"
+      android:strokeWidth="1"
+      android:fillColor="#000000"
+      android:fillType="evenOdd"
+      android:strokeColor="#00000000"/>
+</vector>

+ 12 - 0
reader/src/main/res/drawable/ic_italic_selected.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M10,4l0,3l2.21,0l-3.42,8l-2.79,0l0,3l8,0l0,-3l-2.21,0l3.42,-8l2.79,0l0,-3z"
+      android:strokeWidth="1"
+      android:fillColor="#0077FD"
+      android:fillType="nonZero"
+      android:strokeColor="#00000000"/>
+</vector>

+ 18 - 0
reader/src/main/res/drawable/ic_shape_selected.xml

@@ -0,0 +1,18 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M4,4v8h8V4H4zM2,2h12v12H2V2z"
+      android:strokeWidth="1"
+      android:fillColor="#0077FD"
+      android:fillType="nonZero"
+      android:strokeColor="#00000000"/>
+  <path
+      android:pathData="M14,20a6,6 0,1 0,0 -12,6 6,0 0,0 0,12zM14,22a8,8 0,1 1,0 -16,8 8,0 0,1 0,16z"
+      android:strokeWidth="1"
+      android:fillColor="#0077FD"
+      android:fillType="nonZero"
+      android:strokeColor="#00000000"/>
+</vector>

+ 12 - 0
reader/src/main/res/drawable/ic_signature_selected.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M13,18.639l2,-1.6V10H9v7.039l2,1.6V14h2v4.639zM17,10v8l-5,4 -5,-4v-8H5L4,2h16l-1,8h-2z"
+      android:strokeWidth="1"
+      android:fillColor="#0077FD"
+      android:fillType="nonZero"
+      android:strokeColor="#00000000"/>
+</vector>

+ 12 - 0
reader/src/main/res/drawable/ic_stamp_selected.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M14,14h5a1,1 0,0 1,1 1v3L4,18v-3a1,1 0,0 1,1 -1h5v-3.535a4,4 0,1 1,4 0L14,14zM5,19h14v2L5,21v-2z"
+      android:strokeWidth="1"
+      android:fillColor="#0077FD"
+      android:fillType="nonZero"
+      android:strokeColor="#00000000"/>
+</vector>

+ 12 - 0
reader/src/main/res/drawable/ic_textbox_selected.xml

@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M23,7L23,1L17,1L17,3L7,3L7,1L1,1L1,7L3,7L3,17L1,17L1,23L7,23L7,21L17,21L17,23L23,23L23,17L21,17L21,7L23,7ZM3,3L5,3L5,5L3,5L3,3ZM5,21L3,21L3,19L5,19L5,21ZM17,19L7,19L7,17L5,17L5,7L7,7L7,5L17,5L17,7L19,7L19,17L17,17L17,19ZM21,21L19,21L19,19L21,19L21,21ZM19,5L19,3L21,3L21,5L19,5ZM13,10L13,16L11,16L11,10L8,10L8,8L16,8L16,10L13,10Z"
+      android:strokeWidth="1"
+      android:fillColor="#0077FD"
+      android:fillType="nonZero"
+      android:strokeColor="#00000000"/>
+</vector>

+ 12 - 0
reader/src/main/res/drawable/shape_rec_blue_border_rcorner.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+
+    <solid android:color="#ffffff" />
+
+    <stroke
+        android:width="1dp"
+        android:color="#0077fd" />
+
+    <corners android:radius="18dp"/>
+</shape>

+ 27 - 0
reader/src/main/res/layout/view_viewer_edit_item_edittext.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:id="@+id/layout_title_add"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="#14000000">
+
+    <EditText
+        android:id="@+id/et_input"
+        style="@style/Base.TextAppearance.Widget.AppCompat.Toolbar.Subtitle"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="16dp"
+        android:layout_marginStart="16dp"
+        android:layout_marginRight="16dp"
+        android:layout_marginEnd="16dp"
+        android:gravity="start"
+        android:textColor="#f5a623"
+        android:textSize="24sp"
+        android:text="Sample Text"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent" />
+
+</android.support.constraint.ConstraintLayout>

+ 55 - 0
reader/src/main/res/layout/view_viewer_edit_item_seekbar.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    tools:parentTag="android.support.constraint.ConstraintLayout">
+
+    <TextView
+        android:id="@+id/tv_seekBarTitle"
+        style="@style/Base.TextAppearance.Widget.AppCompat.Toolbar.Subtitle"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="16dp"
+        android:layout_marginStart="16dp"
+        android:paddingBottom="8dp"
+        android:textColor="#de000000"
+        android:text="Size"
+        android:textSize="12sp"
+        app:layout_constraintBottom_toTopOf="@+id/seekBar"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <SeekBar
+        android:id="@+id/seekBar"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="16dp"
+        android:layout_marginStart="16dp"
+        android:maxHeight="2dp"
+        android:minHeight="2dp"
+        android:progressDrawable="@drawable/blue_seekbar_progress"
+        android:thumbTint="#0077fd"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toLeftOf="@+id/tv_seekBarValue"
+        app:layout_constraintTop_toBottomOf="@+id/tv_seekBarTitle" />
+
+    <TextView
+        android:id="@+id/tv_seekBarValue"
+        android:layout_width="36dp"
+        android:layout_height="wrap_content"
+        android:gravity="end"
+        android:layout_marginEnd="16dp"
+        android:layout_marginRight="16dp"
+        android:textColor="#61000000"
+        android:text="24pt"
+        android:textSize="12sp"
+        app:layout_constraintBottom_toBottomOf="@+id/seekBar"
+        app:layout_constraintLeft_toRightOf="@+id/seekBar"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="@+id/seekBar" />
+
+</merge>

+ 68 - 0
reader/src/main/res/layout/view_viewer_edit_item_text_attr.xml

@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<merge
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="48dp"
+    android:background="#00ff00"
+    tools:parentTag="android.support.constraint.ConstraintLayout">
+
+    <ImageButton
+        android:id="@+id/btn_text_bold"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:padding="12dp"
+        android:background="@null"
+        android:src="@drawable/ic_bold"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toLeftOf="@+id/btn_text_italic" />
+    <ImageButton
+        android:id="@+id/btn_text_italic"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:padding="12dp"
+        android:background="@null"
+        android:src="@drawable/ic_italic"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toRightOf="@+id/btn_text_bold"
+        app:layout_constraintRight_toLeftOf="@+id/btn_text_align_left" />
+    <ImageButton
+        android:id="@+id/btn_text_align_left"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:padding="12dp"
+        android:background="@null"
+        android:src="@drawable/ic_alignleft_accent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toRightOf="@+id/btn_text_italic"
+        app:layout_constraintRight_toLeftOf="@+id/btn_text_align_center" />
+    <ImageButton
+        android:id="@+id/btn_text_align_center"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:padding="12dp"
+        android:background="@null"
+        android:src="@drawable/ic_aligncenter"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toRightOf="@+id/btn_text_align_left"
+        app:layout_constraintRight_toLeftOf="@+id/btn_text_align_right" />
+    <ImageButton
+        android:id="@+id/btn_text_align_right"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:padding="12dp"
+        android:background="@null"
+        android:src="@drawable/ic_alignright"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toRightOf="@+id/btn_text_align_center"
+        app:layout_constraintRight_toRightOf="parent" />
+
+</merge>

+ 38 - 0
reader/src/main/res/layout/view_viewer_edit_item_title_button.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    tools:parentTag="android.support.constraint.ConstraintLayout">
+
+    <TextView
+        android:id="@+id/tv_title"
+        style="@style/Base.TextAppearance.Widget.AppCompat.Toolbar.Subtitle"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="16dp"
+        android:layout_marginStart="16dp"
+        android:textColor="#de000000"
+        android:text="Text"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent" />
+
+    <Button
+        android:id="@+id/btn_add"
+        android:layout_width="wrap_content"
+        android:layout_height="32dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginRight="16dp"
+        android:background="@drawable/shape_rec_blue_border_rcorner"
+        android:textColor="#0077fd"
+        android:textSize="14sp"
+        android:textStyle="bold"
+        android:text="ADD"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintRight_toRightOf="parent" />
+
+</merge>

+ 86 - 0
reader/src/main/res/layout/view_viewer_edit_tab_text_box.xml

@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:clickable="true"
+    android:focusable="true"
+    android:background="#FFFFFFFF">
+
+    <com.kdanmobile.reader.screen.view.edit.TitleButton
+        android:layout_width="match_parent"
+        android:layout_height="56dp"
+        android:id="@+id/titleButton_textBox"
+        app:title="Text"
+        app:buttonText="ADD"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toTopOf="@+id/editTextView_textBox" />
+
+    <android.support.constraint.ConstraintLayout
+        android:id="@+id/editTextView_textBox"
+        android:layout_width="match_parent"
+        android:layout_height="64dp"
+        android:orientation="vertical"
+        android:background="#14000000"
+        android:layout_marginBottom="8dp"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/titleButton_textBox"
+        app:layout_constraintBottom_toTopOf="@+id/textAttrView_textBox" >
+
+        <EditText
+            android:id="@+id/et_input"
+            style="@style/Base.TextAppearance.Widget.AppCompat.Toolbar.Subtitle"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="16dp"
+            android:layout_marginStart="16dp"
+            android:layout_marginRight="16dp"
+            android:layout_marginEnd="16dp"
+            android:gravity="start"
+            android:textColor="#f5a623"
+            android:textSize="24sp"
+            android:text="Sample Text"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent" />
+    </android.support.constraint.ConstraintLayout>
+
+    <com.kdanmobile.reader.screen.view.edit.TextAttrView
+        android:layout_width="match_parent"
+        android:layout_height="48dp"
+        android:id="@+id/textAttrView_textBox"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/editTextView_textBox"
+        app:layout_constraintBottom_toTopOf="@+id/colorChooser_textBox" />
+
+    <TextView
+        android:id="@+id/colorChooser_textBox"
+        android:layout_width="match_parent"
+        android:layout_height="48dp"
+        android:text="Color Chooser"
+        android:gravity="center"
+        android:background="#00ff00"
+        android:layout_marginTop="16dp"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/textAttrView_textBox"
+        app:layout_constraintBottom_toTopOf="@+id/seekBar_textBox_textSize" />
+
+    <com.kdanmobile.reader.screen.view.edit.TextSeekBar
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:id="@+id/seekBar_textBox_textSize"
+        android:layout_marginTop="16dp"
+        app:title="Size"
+        app:unit="pt"
+        app:maxValue="24"
+        app:minValue="10"
+        app:initValue="12"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/colorChooser_textBox" />
+
+</android.support.constraint.ConstraintLayout>

+ 16 - 0
reader/src/main/res/values/attrs.xml

@@ -6,4 +6,20 @@
         <attr name="isChecked" format="boolean" />
     </declare-styleable>
 
+    <attr name="title" format="string" />
+
+    <declare-styleable name="TextSeekBar">
+        <attr name="title" />
+        <attr name="unit" format="string" />
+        <attr name="maxValue" format="integer" />
+        <attr name="minValue" format="integer" />
+        <attr name="initValue" format="integer" />
+    </declare-styleable>
+
+    <declare-styleable name="TitleButton">
+        <attr name="title" />
+        <attr name="buttonText" format="string" />
+    </declare-styleable>
+
+
 </resources>

+ 3 - 0
reader/src/main/res/values/colors.xml

@@ -13,4 +13,7 @@
     <color name="highlight_default_color">#FFFF00</color>
     <color name="strike_default_color">#FF0000</color>
     <color name="underline_default_color">#FF0000</color>
+
+    <color name="reader_viewer_edit_tab_color_normal">#666666</color>
+    <color name="reader_viewer_edit_tab_color_selected">#0077FD</color>
 </resources>