Explorar el Código

Merge branch 'viewerEditTab'

cooperku_kdanmobile hace 5 años
padre
commit
cc6320826a
Se han modificado 84 ficheros con 2345 adiciones y 2 borrados
  1. 4 2
      reader/src/main/AndroidManifest.xml
  2. 9 0
      reader/src/main/java/com/kdanmobile/reader/ReaderActivity.kt
  3. 144 0
      reader/src/main/java/com/kdanmobile/reader/screen/ViewerSettingActivity.kt
  4. 65 0
      reader/src/main/java/com/kdanmobile/reader/screen/ViewerSettingViewModel.kt
  5. 11 0
      reader/src/main/java/com/kdanmobile/reader/screen/ViewerSettingViewModelFactory.kt
  6. 83 0
      reader/src/main/java/com/kdanmobile/reader/screen/data/ViewerSettingSharePrefs.kt
  7. 103 0
      reader/src/main/java/com/kdanmobile/reader/screen/model/SharePrefsModel.kt
  8. 97 0
      reader/src/main/java/com/kdanmobile/reader/screen/view/ReadingModeSelectView.kt
  9. 51 0
      reader/src/main/java/com/kdanmobile/reader/screen/view/RowSwitchView.kt
  10. 39 0
      reader/src/main/java/com/kdanmobile/reader/screen/view/ScreenSettingView.kt
  11. 51 0
      reader/src/main/java/com/kdanmobile/reader/screen/view/ToolbarSettingView.kt
  12. 66 0
      reader/src/main/java/com/kdanmobile/reader/screen/view/TurnPageModeSelectView.kt
  13. 57 0
      reader/src/main/java/com/kdanmobile/reader/screen/view/ViewerEditTabView.kt
  14. 125 0
      reader/src/main/java/com/kdanmobile/reader/screen/view/ViewerEditView.kt
  15. 104 0
      reader/src/main/java/com/kdanmobile/reader/screen/view/edit/TextAttrView.kt
  16. 58 0
      reader/src/main/java/com/kdanmobile/reader/screen/view/edit/TextBoxTabView.kt
  17. 74 0
      reader/src/main/java/com/kdanmobile/reader/screen/view/edit/TextSeekBar.kt
  18. 47 0
      reader/src/main/java/com/kdanmobile/reader/screen/view/edit/TitleButton.kt
  19. BIN
      reader/src/main/res/drawable-hdpi/ic_stat_lock.png
  20. BIN
      reader/src/main/res/drawable-xhdpi/ic_stat_lock.png
  21. BIN
      reader/src/main/res/drawable-xxhdpi/ic_stat_lock.png
  22. 17 0
      reader/src/main/res/drawable/blue_seekbar_progress.xml
  23. 12 0
      reader/src/main/res/drawable/ic_aligncenter.xml
  24. 12 0
      reader/src/main/res/drawable/ic_aligncenter_selected.xml
  25. 12 0
      reader/src/main/res/drawable/ic_alignleft_accent.xml
  26. 12 0
      reader/src/main/res/drawable/ic_alignleft_accent_selected.xml
  27. 12 0
      reader/src/main/res/drawable/ic_alignright.xml
  28. 12 0
      reader/src/main/res/drawable/ic_alignright_selected.xml
  29. 12 0
      reader/src/main/res/drawable/ic_bold.xml
  30. 12 0
      reader/src/main/res/drawable/ic_bold_selected.xml
  31. 12 0
      reader/src/main/res/drawable/ic_form.xml
  32. 12 0
      reader/src/main/res/drawable/ic_form_selected.xml
  33. 12 0
      reader/src/main/res/drawable/ic_italic.xml
  34. 12 0
      reader/src/main/res/drawable/ic_italic_selected.xml
  35. 18 0
      reader/src/main/res/drawable/ic_shape.xml
  36. 18 0
      reader/src/main/res/drawable/ic_shape_selected.xml
  37. 12 0
      reader/src/main/res/drawable/ic_signature.xml
  38. 12 0
      reader/src/main/res/drawable/ic_signature_selected.xml
  39. 12 0
      reader/src/main/res/drawable/ic_stamp.xml
  40. 12 0
      reader/src/main/res/drawable/ic_stamp_selected.xml
  41. BIN
      reader/src/main/res/drawable/ic_stat_lock.png
  42. 12 0
      reader/src/main/res/drawable/ic_textbox.xml
  43. 12 0
      reader/src/main/res/drawable/ic_textbox_selected.xml
  44. 8 0
      reader/src/main/res/drawable/selector_day_mode.xml
  45. 8 0
      reader/src/main/res/drawable/selector_lilac_mode.xml
  46. 8 0
      reader/src/main/res/drawable/selector_night_mode.xml
  47. 8 0
      reader/src/main/res/drawable/selector_sefia_mode.xml
  48. 9 0
      reader/src/main/res/drawable/shape_day_mode.xml
  49. 9 0
      reader/src/main/res/drawable/shape_day_mode_checked.xml
  50. 9 0
      reader/src/main/res/drawable/shape_night_mode.xml
  51. 9 0
      reader/src/main/res/drawable/shape_night_mode_checked.xml
  52. 12 0
      reader/src/main/res/drawable/shape_rec_blue_border_rcorner.xml
  53. 10 0
      reader/src/main/res/drawable/shape_rec_w_up_rcorner.xml
  54. 9 0
      reader/src/main/res/drawable/shape_sepia_mode.xml
  55. 9 0
      reader/src/main/res/drawable/shape_sepia_mode_checked.xml
  56. 9 0
      reader/src/main/res/drawable/shape_white_lilac_mode.xml
  57. 9 0
      reader/src/main/res/drawable/shape_white_lilac_mode_checked.xml
  58. 4 0
      reader/src/main/res/layout/activity_reader.xml
  59. 79 0
      reader/src/main/res/layout/activity_viewer_setting.xml
  60. 88 0
      reader/src/main/res/layout/view_reading_mode_select.xml
  61. 29 0
      reader/src/main/res/layout/view_row_switch.xml
  62. 27 0
      reader/src/main/res/layout/view_screen_setting.xml
  63. 36 0
      reader/src/main/res/layout/view_toolbar_setting.xml
  64. 52 0
      reader/src/main/res/layout/view_turn_page_mode_select.xml
  65. 41 0
      reader/src/main/res/layout/view_viewer_edit.xml
  66. 27 0
      reader/src/main/res/layout/view_viewer_edit_item_edittext.xml
  67. 55 0
      reader/src/main/res/layout/view_viewer_edit_item_seekbar.xml
  68. 68 0
      reader/src/main/res/layout/view_viewer_edit_item_text_attr.xml
  69. 38 0
      reader/src/main/res/layout/view_viewer_edit_item_title_button.xml
  70. 50 0
      reader/src/main/res/layout/view_viewer_edit_tab.xml
  71. 86 0
      reader/src/main/res/layout/view_viewer_edit_tab_text_box.xml
  72. 4 0
      reader/src/main/res/values-de/strings.xml
  73. 4 0
      reader/src/main/res/values-es/strings.xml
  74. 4 0
      reader/src/main/res/values-fr/strings.xml
  75. 4 0
      reader/src/main/res/values-it/strings.xml
  76. 4 0
      reader/src/main/res/values-ja/strings.xml
  77. 4 0
      reader/src/main/res/values-ko/strings.xml
  78. 4 0
      reader/src/main/res/values-pt/strings.xml
  79. 4 0
      reader/src/main/res/values-ru/strings.xml
  80. 4 0
      reader/src/main/res/values-zh-rTW/strings.xml
  81. 4 0
      reader/src/main/res/values-zh/strings.xml
  82. 25 0
      reader/src/main/res/values/attrs.xml
  83. 3 0
      reader/src/main/res/values/colors.xml
  84. 14 0
      reader/src/main/res/values/strings.xml

+ 4 - 2
reader/src/main/AndroidManifest.xml

@@ -5,8 +5,10 @@
     <application>
         <activity
             android:name=".ReaderActivity"
-            android:theme="@style/ReaderActivityNoActionBarNoTitle"
-            />
+            android:theme="@style/ReaderActivityNoActionBarNoTitle" />
+        <activity
+            android:name=".screen.ViewerSettingActivity"
+            android:theme="@style/ReaderActivityNoActionBarNoTitle" />
     </application>
 
 </manifest>

+ 9 - 0
reader/src/main/java/com/kdanmobile/reader/ReaderActivity.kt

@@ -3,6 +3,7 @@ package com.kdanmobile.reader
 import android.annotation.SuppressLint
 import android.arch.lifecycle.Observer
 import android.arch.lifecycle.ViewModelProviders
+import android.content.Intent
 import android.net.Uri
 import android.os.Build
 import android.support.v7.app.AppCompatActivity
@@ -27,6 +28,7 @@ import com.kdanmobile.reader.screen.view.SearchView
 import com.kdanmobile.reader.screen.view.ThumbnailView
 import com.kdanmobile.reader.utils.AnimationUtil
 import com.kdanmobile.reader.utils.DensityUtil
+import com.kdanmobile.reader.screen.ViewerSettingActivity
 import kotlinx.android.synthetic.main.activity_reader.*
 import kotlin.Exception
 
@@ -78,6 +80,7 @@ abstract class ReaderActivity : AppCompatActivity() {
         cloneOriginConstraintSet()
         setupToolbar()
         setupLeftToolbar()
+        setupRightSideToolbar()
         setupBottomToolbar()
 
         val factory = ReaderViewModelFactory()
@@ -340,6 +343,12 @@ abstract class ReaderActivity : AppCompatActivity() {
         cloneOriginConstraintSet()
     }
 
+    private fun setupRightSideToolbar() {
+        iv_readerActivity_setting.setOnClickListener {
+            startActivity(Intent(this, ViewerSettingActivity::class.java))
+        }
+    }
+
     private fun setupBottomToolbar() {
         val context = this
         /** Set buttons color **/

+ 144 - 0
reader/src/main/java/com/kdanmobile/reader/screen/ViewerSettingActivity.kt

@@ -0,0 +1,144 @@
+package com.kdanmobile.reader.screen
+
+import android.arch.lifecycle.Observer
+import android.arch.lifecycle.ViewModelProviders
+import android.support.v7.app.AppCompatActivity
+import android.os.Bundle
+import android.view.MenuItem
+import android.widget.CompoundButton
+import com.kdanmobile.reader.R
+import com.kdanmobile.reader.screen.model.SharePrefsModel
+import com.kdanmobile.reader.screen.view.ReadingModeSelectView
+import com.kdanmobile.reader.screen.view.TurnPageModeSelectView
+import kotlinx.android.synthetic.main.activity_viewer_setting.*
+
+class ViewerSettingActivity : AppCompatActivity() {
+
+    private lateinit var viewModel: ViewerSettingViewModel
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        setContentView(R.layout.activity_viewer_setting)
+
+        viewModel = ViewModelProviders.of(this, ViewerSettingViewModelFactory(SharePrefsModel(applicationContext)))
+                .get(ViewerSettingViewModel::class.java)
+
+        viewModel.readMode.observe(this, Observer(this::onReadModeChanged))
+        viewModel.isCropModeEnable.observe(this, Observer(this::onCropModeEnableChanged))
+        viewModel.isShowStateBarEnable.observe(this, Observer(this::onShowStateBarEnableChanged))
+        viewModel.turnPageDirection.observe(this, Observer(this::onTurnPageDirectionChanged))
+        viewModel.isShowTurnPageBtnEnable.observe(this, Observer(this::onShowTurnPageBtnEnableChange))
+        viewModel.isLockScreenSleepEnable.observe(this, Observer(this::onLockScreenSleepEnableChange))
+        viewModel.isShowCommentToolEnable.observe(this, Observer(this::onShowCommentToolEnableChange))
+        viewModel.isShowBOTAToolEnable.observe(this, Observer(this::onShowBOTAToolEnableChange))
+
+        setupToolbar()
+        setupReadingModeView()
+        setupTurnPageView()
+        setupScreenSettingView()
+        setupToolbarSettingView()
+
+        rowSwitchView_smartCrop.onCheckedChangeListener = CompoundButton.OnCheckedChangeListener { _, isChecked ->
+            viewModel.setCropModeEnable(isChecked)
+        }
+        rowSwitchView_showStateBar.onCheckedChangeListener = CompoundButton.OnCheckedChangeListener { _, isChecked ->
+            viewModel.setShowStateBarEnable(isChecked)
+        }
+    }
+
+    private fun setupToolbar() {
+        setSupportActionBar(toolbar_viewerSetting)
+        supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_arrow_back_black_24dp)
+        supportActionBar?.setDisplayHomeAsUpEnabled(true)
+    }
+
+    override fun onOptionsItemSelected(item: MenuItem?): Boolean {
+        when (item?.itemId) {
+            android.R.id.home -> finish()
+        }
+        return super.onOptionsItemSelected(item)
+    }
+
+    private fun setupReadingModeView() {
+        readingModeSelectView.isLock = true
+        readingModeSelectView.onReadModeSelectListener = object : ReadingModeSelectView.OnReadModeSelectListener {
+            override fun onReadModeSelect(readMode: Int) {
+                viewModel.setReadMode(readMode)
+            }
+        }
+    }
+
+    private fun setupTurnPageView() {
+        turnPageModeSelectView.onTurnPageModeChangedListener = object : TurnPageModeSelectView.OnTurnPageModeChangedListener {
+            override fun onTurnPageModeChanged(direction: Int) {
+                viewModel.setTurnPageDirection(direction)
+            }
+        }
+        turnPageModeSelectView.onShowTurnPageBtnEnableChangedListener = CompoundButton.OnCheckedChangeListener { _, isChecked ->
+            viewModel.setTurnPageButtonEnable(isChecked)
+        }
+    }
+
+    private fun setupScreenSettingView() {
+        screenSettingView.onCheckedChangeListener = CompoundButton.OnCheckedChangeListener { _, isChecked ->
+            viewModel.setLockScreenSleepEnable(isChecked)
+        }
+    }
+
+    private fun setupToolbarSettingView() {
+        toolbarSettingView.onCheckedChangeListenerComment = CompoundButton.OnCheckedChangeListener { _, isChecked ->
+            viewModel.setShowCommentToolEnable(isChecked)
+        }
+        toolbarSettingView.onCheckedChangeListenerBOTA = CompoundButton.OnCheckedChangeListener { _, isChecked ->
+            viewModel.setShowBOTAToolEnable(isChecked)
+        }
+    }
+
+    private fun onReadModeChanged(readMode: Int?) {
+        readMode?.let {
+            readingModeSelectView.currentReadMode = it
+        }
+    }
+
+    private fun onCropModeEnableChanged(enable: Boolean?) {
+        enable?.let {
+            rowSwitchView_smartCrop.isChecked = it
+        }
+    }
+
+    private fun onShowStateBarEnableChanged(enable: Boolean?) {
+        enable?.let {
+            rowSwitchView_showStateBar.isChecked = it
+        }
+    }
+
+    private fun onTurnPageDirectionChanged(direction: Int?) {
+        direction?.let {
+            turnPageModeSelectView.direction = it
+        }
+    }
+
+    private fun onShowTurnPageBtnEnableChange(enable: Boolean?) {
+        enable?.let {
+            turnPageModeSelectView.isTurnPageBtnEnable = it
+        }
+    }
+
+    private fun onLockScreenSleepEnableChange(enable: Boolean?) {
+        enable?.let {
+            screenSettingView.isLockScreenSleepEnable = it
+        }
+    }
+
+    private fun onShowCommentToolEnableChange(enable: Boolean?) {
+        enable?.let {
+            toolbarSettingView.isShowCommentToolEnable = it
+        }
+    }
+
+    private fun onShowBOTAToolEnableChange(enable: Boolean?) {
+        enable?.let {
+            toolbarSettingView.isShowBOTAToolEnable = it
+        }
+    }
+}

+ 65 - 0
reader/src/main/java/com/kdanmobile/reader/screen/ViewerSettingViewModel.kt

@@ -0,0 +1,65 @@
+package com.kdanmobile.reader.screen
+
+import android.arch.lifecycle.LiveData
+import android.arch.lifecycle.ViewModel
+import com.kdanmobile.reader.screen.model.SharePrefsModel
+
+class ViewerSettingViewModel(private val sharePrefsModel: SharePrefsModel) : ViewModel() {
+
+    val readMode: LiveData<Int>
+        get() = sharePrefsModel.readMode
+
+    val isCropModeEnable: LiveData<Boolean>
+        get() = sharePrefsModel.isCropModeEnable
+
+    val isShowStateBarEnable: LiveData<Boolean>
+        get() = sharePrefsModel.isShowStateBarEnable
+
+    val turnPageDirection: LiveData<Int>
+        get() = sharePrefsModel.turnPageDirection
+
+    val isShowTurnPageBtnEnable: LiveData<Boolean>
+        get() = sharePrefsModel.isShowTurnPageBtnEnable
+
+    val isLockScreenSleepEnable: LiveData<Boolean>
+        get() = sharePrefsModel.isLockScreenSleepEnable
+
+    val isShowCommentToolEnable: LiveData<Boolean>
+        get() = sharePrefsModel.isShowCommentToolEnable
+
+    val isShowBOTAToolEnable: LiveData<Boolean>
+        get() = sharePrefsModel.isShowBOTAToolEnable
+
+    fun setReadMode(readMode: Int) {
+        sharePrefsModel.setReadMode(readMode)
+    }
+
+    fun setCropModeEnable(enable: Boolean) {
+        sharePrefsModel.setCropModeEnable(enable)
+    }
+
+    fun setShowStateBarEnable(enable: Boolean) {
+        sharePrefsModel.setShowStateBarEnable(enable)
+    }
+
+    fun setTurnPageDirection(direction: Int) {
+        sharePrefsModel.setTurnPageDirection(direction)
+    }
+
+    fun setTurnPageButtonEnable(enable: Boolean) {
+        sharePrefsModel.setTurnPageButtonEnable(enable)
+    }
+
+    fun setLockScreenSleepEnable(enable: Boolean) {
+        sharePrefsModel.setLockScreenSleepEnable(enable)
+    }
+
+    fun setShowCommentToolEnable(enable: Boolean) {
+        sharePrefsModel.setShowCommentToolEnable(enable)
+    }
+
+    fun setShowBOTAToolEnable(enable: Boolean) {
+        sharePrefsModel.setShowBOTAToolEnable(enable)
+    }
+}
+

+ 11 - 0
reader/src/main/java/com/kdanmobile/reader/screen/ViewerSettingViewModelFactory.kt

@@ -0,0 +1,11 @@
+package com.kdanmobile.reader.screen
+
+import android.arch.lifecycle.ViewModel
+import android.arch.lifecycle.ViewModelProvider
+import com.kdanmobile.reader.screen.model.SharePrefsModel
+
+class ViewerSettingViewModelFactory(private val sharePrefsModel: SharePrefsModel) : ViewModelProvider.Factory {
+    override fun <T : ViewModel?> create(modelClass: Class<T>): T {
+        return ViewerSettingViewModel(sharePrefsModel) as T
+    }
+}

+ 83 - 0
reader/src/main/java/com/kdanmobile/reader/screen/data/ViewerSettingSharePrefs.kt

@@ -0,0 +1,83 @@
+package com.kdanmobile.reader.screen.data
+
+import android.content.Context
+import android.content.SharedPreferences
+
+class ViewerSettingSharePrefs(val context: Context, sharedPrefsFileName: String) {
+    companion object {
+        const val readMode = "READ_MODE"
+        const val cropMode = "CROP_MODE"
+        const val stateBar = "STATE_BAR"
+        const val turnPageDirection = "TURN_PAGE_DIRECTION"
+        const val turnPageBtn = "TURN_PAGE_BUTTON"
+        const val screenSleep = "SCREEN_SLEEP"
+        const val commentTool = "COMMENT_TOOL"
+        const val botaTool = "BOTA_TOOL"
+    }
+
+    private var sharedPreferences: SharedPreferences = context.getSharedPreferences(sharedPrefsFileName, Context.MODE_PRIVATE)
+
+    fun getReadMode(): Int {
+        return sharedPreferences.getInt(readMode, 0)
+    }
+
+    fun setReadMode(showMode: Int) {
+        sharedPreferences.edit().putInt(readMode, showMode).apply()
+    }
+
+    fun isCropModeEnable(): Boolean {
+        return sharedPreferences.getBoolean(cropMode, false)
+    }
+
+    fun setCropModeEnable(enable: Boolean) {
+        sharedPreferences.edit().putBoolean(cropMode, enable).apply()
+    }
+
+    fun isShowStateBarEnable(): Boolean {
+        return sharedPreferences.getBoolean(stateBar, false)
+    }
+
+    fun setShowStateBarEnable(enable: Boolean) {
+        sharedPreferences.edit().putBoolean(stateBar, enable).apply()
+    }
+
+    fun getTurnPageDirection(): Int {
+        return sharedPreferences.getInt(turnPageDirection, 0)
+    }
+
+    fun setTurnPageDirection(direction: Int) {
+        sharedPreferences.edit().putInt(turnPageDirection, direction).apply()
+    }
+
+    fun isShowTurnPageButtonEnable(): Boolean {
+        return sharedPreferences.getBoolean(turnPageBtn, false)
+    }
+
+    fun setShowTurnPageButtonEnable(enable: Boolean) {
+        sharedPreferences.edit().putBoolean(turnPageBtn, enable).apply()
+    }
+
+    fun isLockScreenSleepEnable(): Boolean {
+        return sharedPreferences.getBoolean(screenSleep, false)
+    }
+
+    fun setLockScreenSleepEnable(enable: Boolean) {
+        sharedPreferences.edit().putBoolean(screenSleep, enable).apply()
+    }
+
+    fun isShowCommentToolEnable(): Boolean {
+        return sharedPreferences.getBoolean(commentTool, false)
+    }
+
+    fun setShowCommentToolEnable(enable: Boolean) {
+        sharedPreferences.edit().putBoolean(commentTool, enable).apply()
+    }
+
+    fun isShowBOTAToolEnable(): Boolean {
+        return sharedPreferences.getBoolean(botaTool, false)
+    }
+
+    fun setShowBOTAToolEnable(enable: Boolean) {
+        sharedPreferences.edit().putBoolean(botaTool, enable).apply()
+    }
+}

+ 103 - 0
reader/src/main/java/com/kdanmobile/reader/screen/model/SharePrefsModel.kt

@@ -0,0 +1,103 @@
+package com.kdanmobile.reader.screen.model
+
+import android.arch.lifecycle.LiveData
+import android.arch.lifecycle.MutableLiveData
+import android.content.Context
+import com.kdanmobile.reader.screen.data.ViewerSettingSharePrefs
+
+class SharePrefsModel(context: Context) {
+    companion object {
+        const val viewerSettingFileName = "viewer_setting"
+    }
+
+    val readMode: LiveData<Int>
+        get() = mReadMode
+
+    val isCropModeEnable: LiveData<Boolean>
+        get() = mIsCropModeEnable
+
+    val isShowStateBarEnable: LiveData<Boolean>
+        get() = mIsShowStateBarEnable
+
+    val turnPageDirection: LiveData<Int>
+        get() = mTurnPageDirection
+
+    val isShowTurnPageBtnEnable: LiveData<Boolean>
+        get() = mIsShowTurnPageBtnEnable
+
+    val isLockScreenSleepEnable: LiveData<Boolean>
+        get() = mIsLockScreenSleepEnable
+
+    val isShowCommentToolEnable: LiveData<Boolean>
+        get() = mIsShowCommentToolEnable
+
+    val isShowBOTAToolEnable: LiveData<Boolean>
+        get() = mIsShowBOTAToolEnable
+
+    private var mReadMode = MutableLiveData<Int>()
+
+    private var mIsCropModeEnable = MutableLiveData<Boolean>()
+
+    private var mIsShowStateBarEnable = MutableLiveData<Boolean>()
+
+    private var mTurnPageDirection = MutableLiveData<Int>()
+
+    private var mIsShowTurnPageBtnEnable = MutableLiveData<Boolean>()
+
+    private var mIsLockScreenSleepEnable = MutableLiveData<Boolean>()
+
+    private var mIsShowCommentToolEnable = MutableLiveData<Boolean>()
+
+    private var mIsShowBOTAToolEnable = MutableLiveData<Boolean>()
+
+    private val viewSettingSharePrefs = ViewerSettingSharePrefs(context, viewerSettingFileName).apply {
+        mReadMode.value = this.getReadMode()
+        mIsCropModeEnable.value = this.isCropModeEnable()
+        mIsShowStateBarEnable.value = this.isShowStateBarEnable()
+        mTurnPageDirection.value = this.getTurnPageDirection()
+        mIsShowTurnPageBtnEnable.value = this.isShowTurnPageButtonEnable()
+        mIsLockScreenSleepEnable.value = this.isLockScreenSleepEnable()
+        mIsShowCommentToolEnable.value = this.isShowCommentToolEnable()
+        mIsShowBOTAToolEnable.value = this.isShowBOTAToolEnable()
+    }
+
+    fun setReadMode(readMode: Int) {
+        viewSettingSharePrefs.setReadMode(readMode)
+        mReadMode.value = readMode
+    }
+
+    fun setCropModeEnable(enable: Boolean) {
+        viewSettingSharePrefs.setCropModeEnable(enable)
+        mIsCropModeEnable.value = enable
+    }
+
+    fun setShowStateBarEnable(enable: Boolean) {
+        viewSettingSharePrefs.setShowStateBarEnable(enable)
+        mIsShowStateBarEnable.value = enable
+    }
+
+    fun setTurnPageDirection(direction: Int) {
+        viewSettingSharePrefs.setTurnPageDirection(direction)
+        mTurnPageDirection.value = direction
+    }
+
+    fun setTurnPageButtonEnable(enable: Boolean) {
+        viewSettingSharePrefs.setShowTurnPageButtonEnable(enable)
+        mIsShowTurnPageBtnEnable.value = enable
+    }
+
+    fun setLockScreenSleepEnable(enable: Boolean) {
+        viewSettingSharePrefs.setLockScreenSleepEnable(enable)
+        mIsLockScreenSleepEnable.value = enable
+    }
+
+    fun setShowCommentToolEnable(enable: Boolean) {
+        viewSettingSharePrefs.setShowCommentToolEnable(enable)
+        mIsShowCommentToolEnable.value = enable
+    }
+
+    fun setShowBOTAToolEnable(enable: Boolean) {
+        viewSettingSharePrefs.setShowBOTAToolEnable(enable)
+        mIsShowBOTAToolEnable.value = enable
+    }
+}

+ 97 - 0
reader/src/main/java/com/kdanmobile/reader/screen/view/ReadingModeSelectView.kt

@@ -0,0 +1,97 @@
+package com.kdanmobile.reader.screen.view
+
+import android.content.Context
+import android.support.constraint.ConstraintLayout
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import android.view.View
+import com.kdanmobile.reader.R
+import kotlinx.android.synthetic.main.view_reading_mode_select.view.*
+
+class ReadingModeSelectView : ConstraintLayout {
+    companion object {
+        const val modeDay = 0
+        const val modeNight = 1
+        const val modeSefia = 2
+        const val modeLilac = 5
+    }
+
+    interface OnReadModeSelectListener {
+        fun onReadModeSelect(readMode: Int)
+    }
+
+    var onReadModeSelectListener: OnReadModeSelectListener? = null
+
+    var currentReadMode: Int? = null
+        set(value) {
+            field = value
+            when (value) {
+                modeDay -> setReadModeBtnActivated(btn_readingMode_day)
+                modeNight -> setReadModeBtnActivated(btn_readingMode_night)
+                modeSefia -> setReadModeBtnActivated(btn_readingMode_sefia)
+                modeLilac -> setReadModeBtnActivated(btn_readingMode_lilac)
+            }
+        }
+
+    var isLock: Boolean = false
+        set(value) {
+            field = value
+            setReadModeBtnLockVisible(isLock)
+        }
+
+    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_reading_mode_select, this).apply {
+            btn_readingMode_day.setOnClickListener {
+                onReadModeSelectListener?.onReadModeSelect(modeDay)
+                setReadModeBtnActivated(it)
+            }
+            btn_readingMode_lilac.setOnClickListener {
+                onReadModeSelectListener?.onReadModeSelect(modeLilac)
+                setReadModeBtnActivated(it)
+            }
+            btn_readingMode_night.setOnClickListener {
+                if (!isLock) {
+                    onReadModeSelectListener?.onReadModeSelect(modeNight)
+                    setReadModeBtnActivated(it)
+                }
+            }
+            btn_readingMode_sefia.setOnClickListener {
+                if (!isLock) {
+                    onReadModeSelectListener?.onReadModeSelect(modeSefia)
+                    setReadModeBtnActivated(it)
+                }
+            }
+            setReadModeBtnLockVisible(isLock)
+        }
+    }
+
+    private fun setReadModeBtnActivated(view: View?) {
+        btn_readingMode_day?.isActivated = false
+        btn_readingMode_lilac?.isActivated = false
+        btn_readingMode_night?.isActivated = false
+        btn_readingMode_sefia?.isActivated = false
+        view?.isActivated = true
+    }
+
+    private fun setReadModeBtnLockVisible(isVisible: Boolean) {
+        if (isVisible) {
+            iv_readingMode_night_lock?.visibility = View.VISIBLE
+            iv_readingMode_sefia_lock?.visibility = View.VISIBLE
+        } else {
+            iv_readingMode_night_lock?.visibility = View.INVISIBLE
+            iv_readingMode_sefia_lock?.visibility = View.INVISIBLE
+        }
+    }
+}

+ 51 - 0
reader/src/main/java/com/kdanmobile/reader/screen/view/RowSwitchView.kt

@@ -0,0 +1,51 @@
+package com.kdanmobile.reader.screen.view
+
+import android.content.Context
+import android.support.constraint.ConstraintLayout
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import android.widget.CompoundButton
+import com.kdanmobile.reader.R
+import kotlinx.android.synthetic.main.view_row_switch.view.*
+
+class RowSwitchView : ConstraintLayout {
+    var text = ""
+
+    var isChecked = false
+        set(value) {
+            field = value
+            rowSwitchView_switch?.isChecked = isChecked
+        }
+
+    var onCheckedChangeListener: CompoundButton.OnCheckedChangeListener? = null
+        set(value) {
+            field = value
+            rowSwitchView_switch?.setOnCheckedChangeListener(onCheckedChangeListener)
+        }
+
+    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.RowSwitchView, 0, 0)
+        text = typedArray.getString(R.styleable.RowSwitchView_text)
+        isChecked = typedArray.getBoolean(R.styleable.RowSwitchView_isChecked, false)
+    }
+
+    private fun initView() {
+        LayoutInflater.from(context).inflate(R.layout.view_row_switch, this)
+        rowSwitchView_text.text = text
+        rowSwitchView_switch.isChecked = isChecked
+    }
+}

+ 39 - 0
reader/src/main/java/com/kdanmobile/reader/screen/view/ScreenSettingView.kt

@@ -0,0 +1,39 @@
+package com.kdanmobile.reader.screen.view
+
+import android.content.Context
+import android.support.constraint.ConstraintLayout
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import android.widget.CompoundButton
+import com.kdanmobile.reader.R
+import kotlinx.android.synthetic.main.view_screen_setting.view.*
+
+class ScreenSettingView : ConstraintLayout {
+    var onCheckedChangeListener: CompoundButton.OnCheckedChangeListener? = null
+        set(value) {
+            field = value
+            rowSwitchView_lockScreenSleepEnable?.onCheckedChangeListener = value
+        }
+
+    var isLockScreenSleepEnable: Boolean = false
+        set(value) {
+            field = value
+            rowSwitchView_lockScreenSleepEnable?.isChecked = value
+        }
+
+    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_screen_setting, this)
+    }
+}

+ 51 - 0
reader/src/main/java/com/kdanmobile/reader/screen/view/ToolbarSettingView.kt

@@ -0,0 +1,51 @@
+package com.kdanmobile.reader.screen.view
+
+import android.content.Context
+import android.support.constraint.ConstraintLayout
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import android.widget.CompoundButton
+import com.kdanmobile.reader.R
+import kotlinx.android.synthetic.main.view_toolbar_setting.view.*
+
+class ToolbarSettingView : ConstraintLayout {
+    var onCheckedChangeListenerComment: CompoundButton.OnCheckedChangeListener? = null
+        set(value) {
+            field = value
+            rowSwitchView_show_commentTool?.onCheckedChangeListener = value
+        }
+
+    var onCheckedChangeListenerBOTA: CompoundButton.OnCheckedChangeListener? = null
+        set(value) {
+            field = value
+            rowSwitchView_show_BOTATool?.onCheckedChangeListener = value
+        }
+
+    var isShowCommentToolEnable: Boolean = false
+        set(value) {
+            field = value
+            rowSwitchView_show_commentTool?.isChecked = value
+        }
+
+    var isShowBOTAToolEnable: Boolean = false
+        set(value) {
+            field = value
+            rowSwitchView_show_BOTATool?.isChecked = value
+        }
+
+    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_toolbar_setting, this)
+    }
+}

+ 66 - 0
reader/src/main/java/com/kdanmobile/reader/screen/view/TurnPageModeSelectView.kt

@@ -0,0 +1,66 @@
+package com.kdanmobile.reader.screen.view
+
+import android.content.Context
+import android.support.constraint.ConstraintLayout
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import android.widget.CompoundButton
+import com.kdanmobile.reader.R
+import kotlinx.android.synthetic.main.view_turn_page_mode_select.view.*
+
+class TurnPageModeSelectView : ConstraintLayout {
+    companion object {
+        const val vertical = 0
+        const val horizontal = 1
+    }
+
+    interface OnTurnPageModeChangedListener {
+        fun onTurnPageModeChanged(direction: Int)
+    }
+
+    var onTurnPageModeChangedListener: OnTurnPageModeChangedListener? = null
+
+    var onShowTurnPageBtnEnableChangedListener: CompoundButton.OnCheckedChangeListener? = null
+        set(value) {
+            field = value
+            rowSwitchView_showTurnPageBtn?.onCheckedChangeListener = value
+        }
+
+    var direction: Int? = null
+        set(value) {
+            field = value
+            when (value) {
+                vertical -> radioBtn_turnPageMode_vertically.isChecked = true
+                horizontal -> radioBtn_turnPageMode_horizontally.isChecked = true
+            }
+        }
+
+    var isTurnPageBtnEnable: Boolean = false
+        set(value) {
+            field = value
+            rowSwitchView_showTurnPageBtn?.isChecked = value
+        }
+
+    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_turn_page_mode_select, this)
+
+        radioGroup_turnPageMode.setOnCheckedChangeListener { _, checkedId ->
+            when (checkedId) {
+                R.id.radioBtn_turnPageMode_vertically -> onTurnPageModeChangedListener?.onTurnPageModeChanged(vertical)
+                R.id.radioBtn_turnPageMode_horizontally -> onTurnPageModeChangedListener?.onTurnPageModeChanged(horizontal)
+            }
+        }
+    }
+}

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

@@ -0,0 +1,57 @@
+package com.kdanmobile.reader.screen.view
+
+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_tab.view.*
+
+class ViewerEditTabView : ConstraintLayout {
+
+    var onClickListenerTabTextBox: OnClickListener? = null
+        set(value) {
+            field = value
+            viewerEdit_tab_textBox?.setOnClickListener(value)
+        }
+
+    var onClickListenerTabSignature: OnClickListener? = null
+        set(value) {
+            field = value
+            viewerEdit_tab_signature?.setOnClickListener(value)
+        }
+
+    var onClickListenerTabStamp: OnClickListener? = null
+        set(value) {
+            field = value
+            viewerEdit_tab_stamp?.setOnClickListener(value)
+        }
+
+    var onClickListenerTabShape: OnClickListener? = null
+        set(value) {
+            field = value
+            viewerEdit_tab_shape?.setOnClickListener(value)
+        }
+
+    var onClickListenerTabForm: OnClickListener? = null
+        set(value) {
+            field = value
+            viewerEdit_tab_form?.setOnClickListener(value)
+        }
+
+    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, this)
+    }
+}

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

@@ -0,0 +1,125 @@
+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()
+    }
+
+    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, this)
+
+        setupTabView()
+    }
+
+    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
+    }
+}

BIN
reader/src/main/res/drawable-hdpi/ic_stat_lock.png


BIN
reader/src/main/res/drawable-xhdpi/ic_stat_lock.png


BIN
reader/src/main/res/drawable-xxhdpi/ic_stat_lock.png


+ 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.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:strokeAlpha="0.6"
+      android:fillColor="#000"
+      android:fillType="nonZero"
+      android:fillAlpha="0.6"/>
+</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.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:strokeAlpha="0.6"
+      android:fillColor="#000"
+      android:fillType="nonZero"
+      android:fillAlpha="0.6"/>
+  <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:strokeAlpha="0.6"
+      android:fillColor="#000"
+      android:fillType="nonZero"
+      android:fillAlpha="0.6"/>
+</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.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:strokeAlpha="0.6"
+      android:fillColor="#000"
+      android:fillType="nonZero"
+      android:fillAlpha="0.6"/>
+</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.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:strokeAlpha="0.6"
+      android:fillColor="#000"
+      android:fillType="evenOdd"
+      android:fillAlpha="0.6"/>
+</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>

BIN
reader/src/main/res/drawable/ic_stat_lock.png


+ 12 - 0
reader/src/main/res/drawable/ic_textbox.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,1h-6v2L7,3L7,1L1,1v6h2v10L1,17v6h6v-2h10v2h6v-6h-2L21,7h2zM3,3h2v2L3,5L3,3zM5,21L3,21v-2h2v2zM17,19L7,19v-2L5,17L5,7h2L7,5h10v2h2v10h-2v2zM21,21h-2v-2h2v2zM19,5L19,3h2v2h-2zM13,10v6h-2v-6L8,10L8,8h8v2h-3z"
+      android:strokeAlpha="0.6"
+      android:fillColor="#000"
+      android:fillType="nonZero"
+      android:fillAlpha="0.6"/>
+</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>

+ 8 - 0
reader/src/main/res/drawable/selector_day_mode.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:drawable="@drawable/shape_day_mode_checked" android:state_pressed="true" />
+    <item android:drawable="@drawable/shape_day_mode_checked" android:state_activated="true" />
+    <item android:drawable="@drawable/shape_day_mode" />
+
+</selector>

+ 8 - 0
reader/src/main/res/drawable/selector_lilac_mode.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:drawable="@drawable/shape_white_lilac_mode_checked" android:state_pressed="true" />
+    <item android:drawable="@drawable/shape_white_lilac_mode_checked" android:state_activated="true" />
+    <item android:drawable="@drawable/shape_white_lilac_mode" />
+
+</selector>

+ 8 - 0
reader/src/main/res/drawable/selector_night_mode.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:drawable="@drawable/shape_night_mode_checked" android:state_pressed="true" />
+    <item android:drawable="@drawable/shape_night_mode_checked" android:state_activated="true" />
+    <item android:drawable="@drawable/shape_night_mode" />
+
+</selector>

+ 8 - 0
reader/src/main/res/drawable/selector_sefia_mode.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:drawable="@drawable/shape_sepia_mode_checked" android:state_pressed="true" />
+    <item android:drawable="@drawable/shape_sepia_mode_checked" android:state_activated="true" />
+    <item android:drawable="@drawable/shape_sepia_mode" />
+
+</selector>

+ 9 - 0
reader/src/main/res/drawable/shape_day_mode.xml

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

+ 9 - 0
reader/src/main/res/drawable/shape_day_mode_checked.xml

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

+ 9 - 0
reader/src/main/res/drawable/shape_night_mode.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="oval">
+    <solid android:color="#000000" />
+    <stroke
+        android:width="2dp"
+        android:color="#ffffff" />
+    <corners android:radius="4dp" />
+</shape>

+ 9 - 0
reader/src/main/res/drawable/shape_night_mode_checked.xml

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

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

+ 10 - 0
reader/src/main/res/drawable/shape_rec_w_up_rcorner.xml

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

+ 9 - 0
reader/src/main/res/drawable/shape_sepia_mode.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="oval">
+    <solid android:color="#eedebc" />
+    <stroke
+        android:width="2dp"
+        android:color="#ffffff" />
+    <corners android:radius="4dp" />
+</shape>

+ 9 - 0
reader/src/main/res/drawable/shape_sepia_mode_checked.xml

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

+ 9 - 0
reader/src/main/res/drawable/shape_white_lilac_mode.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="oval">
+    <solid android:color="#e2e2e2" />
+    <stroke
+        android:width="2dp"
+        android:color="#ffffff" />
+    <corners android:radius="4dp" />
+</shape>

+ 9 - 0
reader/src/main/res/drawable/shape_white_lilac_mode_checked.xml

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

+ 4 - 0
reader/src/main/res/layout/activity_reader.xml

@@ -284,4 +284,8 @@
             app:layout_constraintRight_toRightOf="parent"
             />
     </android.support.constraint.ConstraintLayout>
+
+    <com.kdanmobile.reader.screen.view.ViewerEditView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
 </android.support.constraint.ConstraintLayout>

+ 79 - 0
reader/src/main/res/layout/activity_viewer_setting.xml

@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView 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="match_parent"
+    tools:context=".screen.ViewerSettingActivity">
+
+    <android.support.constraint.ConstraintLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <android.support.v7.widget.Toolbar
+            android:id="@+id/toolbar_viewerSetting"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:elevation="4dp"
+            android:minHeight="?attr/actionBarSize"
+            android:theme="@style/ReaderToolBarStyle"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <com.kdanmobile.reader.screen.view.ReadingModeSelectView
+            android:id="@+id/readingModeSelectView"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/toolbar_viewerSetting" />
+
+        <com.kdanmobile.reader.screen.view.RowSwitchView
+            android:id="@+id/rowSwitchView_smartCrop"
+            android:layout_width="0dp"
+            android:layout_height="48dp"
+            android:layout_marginTop="24dp"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/readingModeSelectView"
+            app:text="@string/viewer_setting_switch_smart_crop" />
+
+        <com.kdanmobile.reader.screen.view.RowSwitchView
+            android:id="@+id/rowSwitchView_showStateBar"
+            android:layout_width="0dp"
+            android:layout_height="48dp"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/rowSwitchView_smartCrop"
+            app:text="@string/viewer_setting_switch_show_state_bar" />
+
+        <com.kdanmobile.reader.screen.view.TurnPageModeSelectView
+            android:id="@+id/turnPageModeSelectView"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="24dp"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/rowSwitchView_showStateBar" />
+
+        <com.kdanmobile.reader.screen.view.ScreenSettingView
+            android:id="@+id/screenSettingView"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="24dp"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/turnPageModeSelectView" />
+
+        <com.kdanmobile.reader.screen.view.ToolbarSettingView
+            android:id="@+id/toolbarSettingView"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="24dp"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/screenSettingView" />
+
+    </android.support.constraint.ConstraintLayout>
+</ScrollView>

+ 88 - 0
reader/src/main/res/layout/view_reading_mode_select.xml

@@ -0,0 +1,88 @@
+<?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">
+
+    <TextView
+        android:id="@+id/tv_readingMode"
+        style="@style/Base.TextAppearance.AppCompat.Body1"
+        android:layout_width="0dp"
+        android:layout_height="48dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginStart="16dp"
+        android:layout_marginTop="8dp"
+        android:text="@string/viewer_setting_page_background_and_display"
+        android:textColor="#030303"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent" />
+
+    <ImageButton
+        android:id="@+id/btn_readingMode_day"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:layout_marginLeft="16dp"
+        android:layout_marginStart="16dp"
+        android:background="#0000"
+        android:contentDescription="@string/viewer_setting_page_background_and_display"
+        android:src="@drawable/selector_day_mode"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/tv_readingMode" />
+
+    <ImageButton
+        android:id="@+id/btn_readingMode_lilac"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:layout_marginLeft="24dp"
+        android:layout_marginStart="24dp"
+        android:background="#0000"
+        android:contentDescription="@string/viewer_setting_page_background_and_display"
+        android:src="@drawable/selector_lilac_mode"
+        app:layout_constraintLeft_toRightOf="@+id/btn_readingMode_day"
+        app:layout_constraintTop_toBottomOf="@+id/tv_readingMode" />
+
+    <ImageButton
+        android:id="@+id/btn_readingMode_night"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:layout_marginLeft="24dp"
+        android:layout_marginStart="24dp"
+        android:background="#0000"
+        android:contentDescription="@string/viewer_setting_page_background_and_display"
+        android:src="@drawable/selector_night_mode"
+        app:layout_constraintLeft_toRightOf="@+id/btn_readingMode_lilac"
+        app:layout_constraintTop_toBottomOf="@+id/tv_readingMode" />
+
+    <ImageView
+        android:id="@+id/iv_readingMode_night_lock"
+        android:layout_width="16dp"
+        android:layout_height="21dp"
+        android:src="@drawable/ic_stat_lock"
+        app:layout_constraintBottom_toBottomOf="@+id/btn_readingMode_night"
+        app:layout_constraintLeft_toLeftOf="@+id/btn_readingMode_night"
+        app:layout_constraintRight_toRightOf="@+id/btn_readingMode_night"
+        app:layout_constraintTop_toTopOf="@+id/btn_readingMode_night" />
+
+    <ImageButton
+        android:id="@+id/btn_readingMode_sefia"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:layout_marginLeft="24dp"
+        android:layout_marginStart="24dp"
+        android:background="#0000"
+        android:contentDescription="@string/viewer_setting_page_background_and_display"
+        android:src="@drawable/selector_sefia_mode"
+        app:layout_constraintLeft_toRightOf="@+id/btn_readingMode_night"
+        app:layout_constraintTop_toBottomOf="@+id/tv_readingMode" />
+
+    <ImageView
+        android:id="@+id/iv_readingMode_sefia_lock"
+        android:layout_width="16dp"
+        android:layout_height="21dp"
+        android:src="@drawable/ic_stat_lock"
+        app:layout_constraintBottom_toBottomOf="@+id/btn_readingMode_sefia"
+        app:layout_constraintLeft_toLeftOf="@+id/btn_readingMode_sefia"
+        app:layout_constraintRight_toRightOf="@+id/btn_readingMode_sefia"
+        app:layout_constraintTop_toTopOf="@+id/btn_readingMode_sefia" />
+
+</android.support.constraint.ConstraintLayout>

+ 29 - 0
reader/src/main/res/layout/view_row_switch.xml

@@ -0,0 +1,29 @@
+<?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">
+
+    <TextView
+        android:id="@+id/rowSwitchView_text"
+        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"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <Switch
+        android:id="@+id/rowSwitchView_switch"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginEnd="16dp"
+        android:layout_marginRight="16dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+</android.support.constraint.ConstraintLayout>

+ 27 - 0
reader/src/main/res/layout/view_screen_setting.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:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <TextView
+        android:id="@+id/tv_turnPageMode"
+        style="@style/Base.TextAppearance.AppCompat.Body1"
+        android:layout_width="wrap_content"
+        android:layout_height="24dp"
+        android:layout_marginLeft="16dp"
+        android:layout_marginStart="16dp"
+        android:text="@string/viewer_setting_screen_setting"
+        android:textColor="#0077fd"
+        app:layout_constraintLeft_toLeftOf="parent" />
+
+    <com.kdanmobile.reader.screen.view.RowSwitchView
+        android:id="@+id/rowSwitchView_lockScreenSleepEnable"
+        android:layout_width="0dp"
+        android:layout_height="48dp"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/tv_turnPageMode"
+        app:text="@string/viewer_setting_switch_screen_sleep" />
+
+</android.support.constraint.ConstraintLayout>

+ 36 - 0
reader/src/main/res/layout/view_toolbar_setting.xml

@@ -0,0 +1,36 @@
+<?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">
+
+    <TextView
+        android:id="@+id/tv_toolbar_setting"
+        style="@style/Base.TextAppearance.AppCompat.Body1"
+        android:layout_width="wrap_content"
+        android:layout_height="24dp"
+        android:layout_marginLeft="16dp"
+        android:layout_marginStart="16dp"
+        android:text="@string/viewer_setting_toolbar_display_setting"
+        android:textColor="#0077fd"
+        app:layout_constraintLeft_toLeftOf="parent" />
+
+    <com.kdanmobile.reader.screen.view.RowSwitchView
+        android:id="@+id/rowSwitchView_show_commentTool"
+        android:layout_width="0dp"
+        android:layout_height="48dp"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/tv_toolbar_setting"
+        app:text="@string/viewer_setting_toolbar_display_setting_comment" />
+
+    <com.kdanmobile.reader.screen.view.RowSwitchView
+        android:id="@+id/rowSwitchView_show_BOTATool"
+        android:layout_width="0dp"
+        android:layout_height="48dp"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/rowSwitchView_show_commentTool"
+        app:text="@string/viewer_setting_toolbar_display_setting_bota" />
+
+</android.support.constraint.ConstraintLayout>

+ 52 - 0
reader/src/main/res/layout/view_turn_page_mode_select.xml

@@ -0,0 +1,52 @@
+<?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">
+
+    <TextView
+        android:id="@+id/tv_turnPageMode"
+        style="@style/Base.TextAppearance.AppCompat.Body1"
+        android:layout_width="wrap_content"
+        android:layout_height="24dp"
+        android:layout_marginLeft="16dp"
+        android:layout_marginStart="16dp"
+        android:text="@string/viewer_setting_page_turn_mode"
+        android:textColor="#0077fd"
+        app:layout_constraintLeft_toLeftOf="parent" />
+
+    <RadioGroup
+        android:id="@+id/radioGroup_turnPageMode"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="12dp"
+        android:layout_marginStart="12dp"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/tv_turnPageMode">
+
+        <RadioButton
+            android:id="@+id/radioBtn_turnPageMode_horizontally"
+            android:layout_width="wrap_content"
+            android:layout_height="48dp"
+            android:text="@string/viewer_setting_page_turn_mode_horizontally"
+            app:layout_constraintLeft_toLeftOf="parent" />
+
+        <RadioButton
+            android:id="@+id/radioBtn_turnPageMode_vertically"
+            android:layout_width="wrap_content"
+            android:layout_height="48dp"
+            android:text="@string/viewer_setting_page_turn_mode_vertically"
+            app:layout_constraintLeft_toLeftOf="parent" />
+
+    </RadioGroup>
+
+    <com.kdanmobile.reader.screen.view.RowSwitchView
+        android:id="@+id/rowSwitchView_showTurnPageBtn"
+        android:layout_width="0dp"
+        android:layout_height="48dp"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/radioGroup_turnPageMode"
+        app:text="@string/viewer_setting_page_turn_button_visible" />
+
+</android.support.constraint.ConstraintLayout>

+ 41 - 0
reader/src/main/res/layout/view_viewer_edit.xml

@@ -0,0 +1,41 @@
+<?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:background="#42000000">
+
+    <android.support.constraint.ConstraintLayout
+        android:layout_width="360dp"
+        android:layout_height="336dp"
+        android:background="@drawable/shape_rec_w_up_rcorner"
+        android:elevation="4dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent">
+
+        <com.kdanmobile.reader.screen.view.ViewerEditTabView
+            android:id="@+id/viewerEdit_tab"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="4dp"
+            android:layout_marginStart="4dp"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <android.support.constraint.ConstraintLayout
+            android:id="@+id/viewEdit_layout_tab_content"
+            android:layout_width="0dp"
+            android:layout_height="0dp"
+            android:layout_marginEnd="8dp"
+            android:layout_marginRight="8dp"
+            android:layout_marginTop="12dp"
+            android:background="@android:color/darker_gray"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintLeft_toRightOf="@+id/viewerEdit_tab"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
+    </android.support.constraint.ConstraintLayout>
+</android.support.constraint.ConstraintLayout>

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

+ 50 - 0
reader/src/main/res/layout/view_viewer_edit_tab.xml

@@ -0,0 +1,50 @@
+<?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">
+
+    <ImageButton
+        android:id="@+id/viewerEdit_tab_textBox"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:background="@null"
+        android:src="@drawable/ic_textbox" />
+
+    <ImageButton
+        android:id="@+id/viewerEdit_tab_signature"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:layout_marginTop="8dp"
+        android:background="@null"
+        android:src="@drawable/ic_signature"
+        app:layout_constraintTop_toBottomOf="@+id/viewerEdit_tab_textBox" />
+
+    <ImageButton
+        android:id="@+id/viewerEdit_tab_stamp"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:layout_marginTop="8dp"
+        android:background="@null"
+        android:src="@drawable/ic_stamp"
+        app:layout_constraintTop_toBottomOf="@id/viewerEdit_tab_signature" />
+
+    <ImageButton
+        android:id="@+id/viewerEdit_tab_shape"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:layout_marginTop="8dp"
+        android:background="@null"
+        android:src="@drawable/ic_shape"
+        app:layout_constraintTop_toBottomOf="@+id/viewerEdit_tab_stamp" />
+
+    <ImageButton
+        android:id="@+id/viewerEdit_tab_form"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:layout_marginTop="8dp"
+        android:background="@null"
+        android:src="@drawable/ic_form"
+        app:layout_constraintTop_toBottomOf="@+id/viewerEdit_tab_shape" />
+
+</android.support.constraint.ConstraintLayout>

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

+ 4 - 0
reader/src/main/res/values-de/strings.xml

@@ -26,4 +26,8 @@
     <string name="fileManager_thishi_search">Bitte geben Sie mindestens 3 Zeichen ein.</string>
 
     <string name="dialogAddBookmark_page">Seite</string>
+    <string name="viewer_setting_page_turn_mode">Durch Seiten scrollen</string>
+    <string name="viewer_setting_page_turn_mode_horizontal">Horizontal</string>
+    <string name="viewer_setting_page_turn_mode_vertically">Vertikal</string>
+    <string name="viewer_setting_page_turn_mode_horizontally">Horizontal</string>
 </resources>

+ 4 - 0
reader/src/main/res/values-es/strings.xml

@@ -26,4 +26,8 @@
     <string name="fileManager_thishi_search">Por favor, introduce al menos 3 caracteres.</string>
 
     <string name="dialogAddBookmark_page">página</string>
+    <string name="viewer_setting_page_turn_mode">Desplace páginas</string>
+    <string name="viewer_setting_page_turn_mode_horizontal">Horizontalmente</string>
+    <string name="viewer_setting_page_turn_mode_vertically">Verticalmente</string>
+    <string name="viewer_setting_page_turn_mode_horizontally">Horizontalmente</string>
 </resources>

+ 4 - 0
reader/src/main/res/values-fr/strings.xml

@@ -26,4 +26,8 @@
     <string name="fileManager_thishi_search">Veuillez entrer au moins 3 caractères.</string>
 
     <string name="dialogAddBookmark_page">Page</string>
+    <string name="viewer_setting_page_turn_mode">Défilement des Pages</string>
+    <string name="viewer_setting_page_turn_mode_horizontal">Horizontalement</string>
+    <string name="viewer_setting_page_turn_mode_vertically">Verticalement</string>
+    <string name="viewer_setting_page_turn_mode_horizontally">Horizontalement</string>
 </resources>

+ 4 - 0
reader/src/main/res/values-it/strings.xml

@@ -26,4 +26,8 @@
     <string name="fileManager_thishi_search">Si prega di inserire almeno 3 caratteri.</string>
 
     <string name="dialogAddBookmark_page">Pagina</string>
+    <string name="viewer_setting_page_turn_mode">Pagine di scorrimento</string>
+    <string name="viewer_setting_page_turn_mode_horizontal">Orizzontalmente</string>
+    <string name="viewer_setting_page_turn_mode_vertically">Verticalmente</string>
+    <string name="viewer_setting_page_turn_mode_horizontally">Orizzontalmente</string>
 </resources>

+ 4 - 0
reader/src/main/res/values-ja/strings.xml

@@ -24,4 +24,8 @@
 
     <string name="fileManager_no_results">見つかりませんでした。</string>
     <string name="fileManager_thishi_search">少なくとも3文字入力して下さい。</string>
+    <string name="viewer_setting_page_turn_mode">ページをスクロールします</string>
+    <string name="viewer_setting_page_turn_mode_horizontal">横方向</string>
+    <string name="viewer_setting_page_turn_mode_vertically">縦方向</string>
+    <string name="viewer_setting_page_turn_mode_horizontally">横方向</string>
 </resources>

+ 4 - 0
reader/src/main/res/values-ko/strings.xml

@@ -26,4 +26,8 @@
     <string name="fileManager_thishi_search">최소 3자 이상 입력해 주십시오.</string>
 
     <string name="dialogAddBookmark_page">페이지</string>
+    <string name="viewer_setting_page_turn_mode">페이지 스크롤</string>
+    <string name="viewer_setting_page_turn_mode_horizontal">가로</string>
+    <string name="viewer_setting_page_turn_mode_vertically">세로</string>
+    <string name="viewer_setting_page_turn_mode_horizontally">가로</string>
 </resources>

+ 4 - 0
reader/src/main/res/values-pt/strings.xml

@@ -26,4 +26,8 @@
     <string name="fileManager_thishi_search">Por favor digite no mínimo 3 caracteres.</string>
 
     <string name="dialogAddBookmark_page">página</string>
+    <string name="viewer_setting_page_turn_mode">Páginas de rolagem</string>
+    <string name="viewer_setting_page_turn_mode_horizontal">Horizontalmente</string>
+    <string name="viewer_setting_page_turn_mode_vertically">Verticalmente</string>
+    <string name="viewer_setting_page_turn_mode_horizontally">Horizontalmente</string>
 </resources>

+ 4 - 0
reader/src/main/res/values-ru/strings.xml

@@ -26,4 +26,8 @@
     <string name="fileManager_thishi_search">Пожалуйста введите минимум 3 символа</string>
 
     <string name="dialogAddBookmark_page">страница</string>
+    <string name="viewer_setting_page_turn_mode">Прокручивание страниц</string>
+    <string name="viewer_setting_page_turn_mode_horizontal">Горизонтально</string>
+    <string name="viewer_setting_page_turn_mode_vertically">Вертикально</string>
+    <string name="viewer_setting_page_turn_mode_horizontally">Горизонтально</string>
 </resources>

+ 4 - 0
reader/src/main/res/values-zh-rTW/strings.xml

@@ -26,4 +26,8 @@
     <string name="fileManager_thishi_search">請至少輸入3個字元</string>
 
     <string name="dialogAddBookmark_page">頁數</string>
+    <string name="viewer_setting_page_turn_mode">翻頁設定</string>
+    <string name="viewer_setting_page_turn_mode_horizontal">水平滾動</string>
+    <string name="viewer_setting_page_turn_mode_vertically">垂直滾動</string>
+    <string name="viewer_setting_page_turn_mode_horizontally">水平滾動</string>
 </resources>

+ 4 - 0
reader/src/main/res/values-zh/strings.xml

@@ -26,4 +26,8 @@
     <string name="fileManager_thishi_search">请至少输入3个字符</string>
 
     <string name="dialogAddBookmark_page">页码</string>
+    <string name="viewer_setting_page_turn_mode">翻页设置</string>
+    <string name="viewer_setting_page_turn_mode_horizontal">水平滚动</string>
+    <string name="viewer_setting_page_turn_mode_vertically">垂直滚动</string>
+    <string name="viewer_setting_page_turn_mode_horizontally">水平滚动</string>
 </resources>

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

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <declare-styleable name="RowSwitchView">
+        <attr name="text" format="string" />
+        <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>

+ 14 - 0
reader/src/main/res/values/strings.xml

@@ -29,4 +29,18 @@
     <string name="fileManager_thishi_search">Please enter at least 3 characters.</string>
 
     <string name="dialogAddBookmark_page">page</string>
+
+    <!--viewer setting-->
+    <string name="viewer_setting_page_background_and_display">Page Background And Display</string>
+    <string name="viewer_setting_switch_smart_crop">Smart Crop Mode</string>
+    <string name="viewer_setting_switch_show_state_bar">Show State Bar</string>
+    <string name="viewer_setting_page_turn_mode">Scroll Pages</string>
+    <string name="viewer_setting_page_turn_mode_horizontally">Horizontally</string>
+    <string name="viewer_setting_page_turn_mode_vertically">Vertically</string>
+    <string name="viewer_setting_page_turn_button_visible">Show turn page button</string>
+    <string name="viewer_setting_screen_setting">Screen Setting</string>
+    <string name="viewer_setting_switch_screen_sleep">Screen Sleep Setting Enable</string>
+    <string name="viewer_setting_toolbar_display_setting">Toolbar Display Setting</string>
+    <string name="viewer_setting_toolbar_display_setting_comment">Display Comment Tool</string>
+    <string name="viewer_setting_toolbar_display_setting_bota">Display BOTA tool</string>
 </resources>