Procházet zdrojové kódy

Merge branch 'f-annotation'

Wayne před 5 roky
rodič
revize
eb1e6c4b6c
48 změnil soubory, kde provedl 1192 přidání a 52 odebrání
  1. 217 4
      reader/src/main/java/com/kdanmobile/reader/ReaderActivity.kt
  2. 127 28
      reader/src/main/java/com/kdanmobile/reader/ReaderViewModel.kt
  3. 10 0
      reader/src/main/java/com/kdanmobile/reader/Utils.kt
  4. 5 0
      reader/src/main/java/com/kdanmobile/reader/annotationattribute/AnnotationAttribute.kt
  5. 16 0
      reader/src/main/java/com/kdanmobile/reader/annotationattribute/AnnotationColor.kt
  6. 6 0
      reader/src/main/java/com/kdanmobile/reader/annotationattribute/Brush.kt
  7. 9 0
      reader/src/main/java/com/kdanmobile/reader/annotationattribute/InkAttribute.kt
  8. 280 0
      reader/src/main/java/com/kdanmobile/reader/view/AnnotationAttributeView.kt
  9. 22 0
      reader/src/main/java/com/kdanmobile/reader/view/AnnotationAttributeWindow.kt
  10. 30 0
      reader/src/main/java/com/kdanmobile/reader/view/ColorOpacityDisplayerView.kt
  11. 1 1
      reader/src/main/java/com/kdanmobile/reader/HorizontalView.java
  12. 82 0
      reader/src/main/java/com/kdanmobile/reader/view/WaveLineView.java
  13. binární
      reader/src/main/res/drawable-hdpi/ic_freehand_triangle.png
  14. binární
      reader/src/main/res/drawable-hdpi/panel_property_color_preview.png
  15. binární
      reader/src/main/res/drawable-xhdpi/panel_property_color_preview.png
  16. 5 0
      reader/src/main/res/drawable-xxhdpi/bg_annotation_property_setting_window.xml
  17. binární
      reader/src/main/res/drawable-xxhdpi/ic_freehand_triangle.png
  18. binární
      reader/src/main/res/drawable-xxhdpi/seekbar_back.png
  19. binární
      reader/src/main/res/drawable-xxhdpi/seekbar_fill.png
  20. binární
      reader/src/main/res/drawable-xxhdpi/seekbar_handle_small_d.png
  21. binární
      reader/src/main/res/drawable-xxhdpi/seekbar_handle_small_disable.png
  22. binární
      reader/src/main/res/drawable-xxhdpi/seekbar_handle_small_p.png
  23. 12 0
      reader/src/main/res/drawable-xxhdpi/seekbar_img.xml
  24. 13 0
      reader/src/main/res/drawable-xxhdpi/seekbar_thumb_ttpod_small.xml
  25. binární
      reader/src/main/res/drawable/ink_brush_1.png
  26. binární
      reader/src/main/res/drawable/ink_brush_2.png
  27. binární
      reader/src/main/res/drawable/panel_property_color_previewbg.png
  28. 11 0
      reader/src/main/res/drawable/reader_annotation_property_color_border.xml
  29. 11 0
      reader/src/main/res/drawable/reader_annotation_property_color_border_select.xml
  30. 4 4
      reader/src/main/res/layout/activity_reader.xml
  31. 2 2
      reader/src/main/res/layout/activity_reader_hide_all.xml
  32. 2 2
      reader/src/main/res/layout/activity_reader_hide_top_left_bottom.xml
  33. 42 0
      reader/src/main/res/layout/view_color_opacity_displayer.xml
  34. 231 0
      reader/src/main/res/layout/view_reader_annotation_property.xml
  35. 3 1
      reader/src/main/res/values-de/strings.xml
  36. 2 1
      reader/src/main/res/values-es/strings.xml
  37. 2 1
      reader/src/main/res/values-fr/strings.xml
  38. 2 1
      reader/src/main/res/values-it/strings.xml
  39. 3 1
      reader/src/main/res/values-ja/strings.xml
  40. 2 1
      reader/src/main/res/values-ko/strings.xml
  41. 2 1
      reader/src/main/res/values-pt/strings.xml
  42. 2 1
      reader/src/main/res/values-ru/strings.xml
  43. 3 1
      reader/src/main/res/values-zh-rTW/strings.xml
  44. 3 1
      reader/src/main/res/values-zh/strings.xml
  45. 12 0
      reader/src/main/res/values/colors.xml
  46. 7 0
      reader/src/main/res/values/dimens.xml
  47. 5 1
      reader/src/main/res/values/strings.xml
  48. 6 0
      reader/src/main/res/values/styles.xml

+ 217 - 4
reader/src/main/java/com/kdanmobile/reader/ReaderActivity.kt

@@ -10,6 +10,11 @@ import android.support.v7.app.AppCompatActivity
 import android.os.Bundle
 import android.support.constraint.ConstraintLayout
 import android.support.constraint.ConstraintSet
+import android.widget.Toast
+import com.kdanmobile.kmpdfkit.pdfcommon.KMPDFReaderView
+import com.kdanmobile.reader.Utils.applyConstraintSet
+import com.kdanmobile.reader.view.AnnotationAttributeView
+import com.kdanmobile.reader.view.AnnotationAttributeWindow
 import android.support.v4.content.ContextCompat
 import android.support.v7.app.AlertDialog
 import android.view.Menu
@@ -20,8 +25,9 @@ import android.view.View
 import android.widget.EditText
 import android.widget.LinearLayout
 import android.widget.TextView
-import com.kdanmobile.kmpdfkit.pdfcommon.KMPDFReaderView
-import com.kdanmobile.reader.Utils.applyConstraintSet
+import com.kdanmobile.reader.annotationattribute.AnnotationAttribute
+import com.kdanmobile.reader.annotationattribute.AnnotationColor
+import com.kdanmobile.reader.annotationattribute.InkAttribute
 import com.kdanmobile.reader.screen.view.BookmarkView
 import com.kdanmobile.reader.screen.view.OutlineView
 import com.kdanmobile.reader.screen.view.SearchView
@@ -87,12 +93,19 @@ abstract class ReaderActivity : AppCompatActivity() {
         viewModel = ViewModelProviders.of(this, factory).get(ReaderViewModel::class.java)
         viewModel.isOpenedFileLiveData.observe(this, Observer(this::onIsOpenedFileUpdate))
         viewModel.fileNameLiveData.observe(this, Observer { tv_readerActivity_title.text = it })
+        viewModel.annotationModeLiveData.observe(this, Observer(this::onAnnotationModeUpdate))
+        viewModel.isCopyModeLiveData.observe(this, Observer (this::onIsCopyModeUpdate))
+        viewModel.highLightAttributeLiveData.observe(this, Observer(this::onHighlightAttributeUpdate))
+        viewModel.strikeAttributeLiveData.observe(this, Observer(this::onStrikeAttributeUpdate))
+        viewModel.underLineAttributeLiveData.observe(this, Observer(this::onUnderlineAttributeUpdate))
+        viewModel.inkAttributeLiveData.observe(this, Observer(this::onInkAttributeUpdate))
         viewModel.isOpenedFileLiveData.value?.also { isOpened ->
             if (isOpened) return@also
             val filePath = intent.getStringExtra(KEY_FILE_ABSOLUTE)
             val uri = Uri.parse(filePath)
             viewModel.openPdfFile(this, uri, intent.type)
         }
+        setupRightToolbar()
         viewModel.pageIndexLiveData.observe(this, Observer(this::onPageIndexChanged))
         viewModel.isPageInBookmarksLiveData.observe(this, Observer(this::onIsPageInBookmarksChanged))
     }
@@ -139,6 +152,81 @@ abstract class ReaderActivity : AppCompatActivity() {
         }
     }
 
+    private fun onIsCopyModeUpdate(isCopyMode: Boolean?) {
+        if (isCopyMode == null) return
+        when (isCopyMode) {
+            true -> {
+                val color = resources.getColor(R.color.reader_right_toolbar_selected_bg)
+                iv_readerActivity_copy.setBackgroundColor(color)
+                hideTopLeftBottomToolbars()
+            }
+            false -> {
+                iv_readerActivity_copy.setBackgroundDrawable(null)
+                showAllToolbars()
+            }
+        }
+    }
+
+    private fun onHighlightAttributeUpdate(annotationAttribute: AnnotationAttribute?) {
+        if (annotationAttribute == null) return
+        view_readerActivity_highLightStroke.setBackgroundColor(annotationAttribute.color)
+    }
+
+    private fun onStrikeAttributeUpdate(annotationAttribute: AnnotationAttribute?) {
+        if (annotationAttribute == null) return
+        view_readerActivity_strikeStroke.setBackgroundColor(annotationAttribute.color)
+    }
+
+    private fun onUnderlineAttributeUpdate(annotationAttribute: AnnotationAttribute?) {
+        if (annotationAttribute == null) return
+        view_readerActivity_underlineStroke.setBackgroundColor(annotationAttribute.color)
+    }
+
+    private fun onInkAttributeUpdate(inkAttribute: InkAttribute?) {
+        if (inkAttribute == null) return
+        val color = inkAttribute.color
+        AnnotationColor.values().forEach {
+            if (resources.getColor(it.colorResId) == color) {
+                val drawableResId = when (it) {
+                    AnnotationColor.Color1 -> R.drawable.ic_tool_freehand_s1
+                    AnnotationColor.Color2 -> R.drawable.ic_tool_freehand_s2
+                    AnnotationColor.Color3 -> R.drawable.ic_tool_freehand_s3
+                    AnnotationColor.Color4 -> R.drawable.ic_tool_freehand_s4
+                    AnnotationColor.Color5 -> R.drawable.ic_tool_freehand_s5
+                    AnnotationColor.Color6 -> R.drawable.ic_tool_freehand_s6
+                    AnnotationColor.Color7 -> R.drawable.ic_tool_freehand_s7
+                    AnnotationColor.Color8 -> R.drawable.ic_tool_freehand_s8
+                    AnnotationColor.Color9 -> R.drawable.ic_tool_freehand_s9
+                    AnnotationColor.Color10 -> R.drawable.ic_tool_freehand_s10
+                }
+                iv_readerActivity_inkStroke.setImageResource(drawableResId)
+                return
+            }
+        }
+    }
+
+    private fun onAnnotationModeUpdate(annotationMode: ReaderViewModel.AnnotationMode?) {
+        if (annotationMode == null) return
+        val map = HashMap<ReaderViewModel.AnnotationMode, View>().apply {
+            put(ReaderViewModel.AnnotationMode.Highlight, iv_readerActivity_highLight)
+            put(ReaderViewModel.AnnotationMode.Strike, iv_readerActivity_strike)
+            put(ReaderViewModel.AnnotationMode.Underline, iv_readerActivity_underline)
+            put(ReaderViewModel.AnnotationMode.Ink, iv_readerActivity_ink)
+        }
+        map.forEach {
+            if (it.key == annotationMode) {
+                val color = resources.getColor(R.color.reader_right_toolbar_selected_bg)
+                it.value.setBackgroundColor(color)
+            } else {
+                it.value.setBackgroundDrawable(null)
+            }
+        }
+        when (annotationMode == ReaderViewModel.AnnotationMode.None) {
+            true -> showAllToolbars()
+            false -> hideTopLeftBottomToolbars()
+        }
+    }
+
     private fun onIsOpenedFileUpdate(isOpened: Boolean?) {
         if (isOpened == null) return
         val container = viewGroup_readerActivity_container
@@ -146,6 +234,19 @@ abstract class ReaderActivity : AppCompatActivity() {
         if (!isOpened) return
         val context = this
         val readerView = object : KMPDFReaderView(context) {
+            @SuppressLint("ClickableViewAccessibility")
+            override fun onTouchEvent(motionEvent: MotionEvent): Boolean {
+                if (motionEvent.action == MotionEvent.ACTION_UP) {
+                    if (viewModel.isCopyModeLiveData.value == true) {
+                        if (viewModel.copySelection()) {
+                            val context = this@ReaderActivity
+                            Toast.makeText(context, R.string.reader_copy_text_success, Toast.LENGTH_SHORT).show()
+                        }
+                    }
+                }
+                return super.onTouchEvent(motionEvent)
+            }
+
             override fun onTapMainDocArea() {
                 super.onTapMainDocArea()
                 if (isBelowKitkat()) {
@@ -361,6 +462,119 @@ abstract class ReaderActivity : AppCompatActivity() {
         Utils.setTintDrawableList(context, ib_readerActivity_bottomToolbarKdanCloud, R.drawable.ic_kdan_cloud, normalColor, pressColor)
     }
 
+    private fun setupRightToolbar() {
+        iv_readerActivity_copy.setOnClickListener { viewModel.onClickCopyBtn() }
+        iv_readerActivity_highLight.apply {
+            setOnClickListener { viewModel.onClickHighlightBtn() }
+            setOnLongClickListener { btn ->
+                viewModel.onLongClickHighlightBtn()
+                val context = this@ReaderActivity
+                AnnotationAttributeWindow(context, true).also { window ->
+                    viewModel.highLightAttributeLiveData.value?.let { attr ->
+                        window.annotationAttributeView.annotationAttribute = attr
+                    }
+                    window.annotationAttributeView.onChangeListener = object : AnnotationAttributeView.OnChangeListener {
+                        override fun onChange(annotationAttributeView: AnnotationAttributeView) {
+                            viewModel.setHighLightAttributes(annotationAttributeView.annotationAttribute)
+                        }
+                    }
+                    val contentView = window.contentView.apply {
+                        val w = Utils.makeDropDownMeasureSpec(window.width)
+                        val y = Utils.makeDropDownMeasureSpec(window.height)
+                        measure(w, y)
+                    }
+                    val space = resources.getDimension(R.dimen.reader_annotation_property_setting_window_right_toolbar_space)
+                    val xOff = (-contentView.measuredWidth - space).toInt()
+                    val yOff = -btn.height
+                    window.showAsDropDown(btn, xOff, yOff)
+                }
+                return@setOnLongClickListener true
+            }
+        }
+        iv_readerActivity_strike.apply {
+            setOnClickListener { viewModel.onClickStrikeBtn() }
+            setOnLongClickListener { btn ->
+                viewModel.onLongClickStrikeBtn()
+                val context = this@ReaderActivity
+                AnnotationAttributeWindow(context, true).also { window ->
+                    viewModel.strikeAttributeLiveData.value?.let { attr ->
+                        window.annotationAttributeView.annotationAttribute = attr
+                    }
+                    window.annotationAttributeView.onChangeListener = object : AnnotationAttributeView.OnChangeListener {
+                        override fun onChange(annotationAttributeView: AnnotationAttributeView) {
+                            viewModel.setStrikeOutAttributes(annotationAttributeView.annotationAttribute)
+                        }
+                    }
+                    val contentView = window.contentView.apply {
+                        val w = Utils.makeDropDownMeasureSpec(window.width)
+                        val y = Utils.makeDropDownMeasureSpec(window.height)
+                        measure(w, y)
+                    }
+                    val space = resources.getDimension(R.dimen.reader_annotation_property_setting_window_right_toolbar_space)
+                    val xOff = (-contentView.measuredWidth - space).toInt()
+                    val yOff = -btn.height
+                    window.showAsDropDown(btn, xOff, yOff)
+                }
+                return@setOnLongClickListener true
+            }
+        }
+        iv_readerActivity_underline.apply {
+            setOnClickListener { viewModel.onClickUnderlineBtn() }
+            setOnLongClickListener { btn ->
+                viewModel.onLongClickUnderlineBtn()
+                val context = this@ReaderActivity
+                AnnotationAttributeWindow(context, true).also { window ->
+                    viewModel.underLineAttributeLiveData.value?.let { attr ->
+                        window.annotationAttributeView.annotationAttribute = attr
+                    }
+                    window.annotationAttributeView.onChangeListener = object : AnnotationAttributeView.OnChangeListener {
+                        override fun onChange(annotationAttributeView: AnnotationAttributeView) {
+                            viewModel.setUnderLineAttributes(annotationAttributeView.annotationAttribute)
+                        }
+                    }
+                    val contentView = window.contentView.apply {
+                        val w = Utils.makeDropDownMeasureSpec(window.width)
+                        val y = Utils.makeDropDownMeasureSpec(window.height)
+                        measure(w, y)
+                    }
+                    val space = resources.getDimension(R.dimen.reader_annotation_property_setting_window_right_toolbar_space)
+                    val xOff = (-contentView.measuredWidth - space).toInt()
+                    val yOff = -btn.height
+                    window.showAsDropDown(btn, xOff, yOff)
+                }
+                return@setOnLongClickListener true
+            }
+        }
+        iv_readerActivity_ink.apply {
+            setOnClickListener { viewModel.onClickInkBtn() }
+            setOnLongClickListener { btn ->
+                viewModel.onLongClickInkBtn()
+                val context = this@ReaderActivity
+                AnnotationAttributeWindow(context, false).also { window ->
+                    viewModel.inkAttributeLiveData.value?.let { attr ->
+                        window.annotationAttributeView.inkAttribute = attr
+                    }
+                    window.annotationAttributeView.onChangeListener = object : AnnotationAttributeView.OnChangeListener {
+                        override fun onChange(annotationAttributeView: AnnotationAttributeView) {
+                            viewModel.setInkAttributes(annotationAttributeView.inkAttribute)
+                        }
+                    }
+                    val contentView = window.contentView.apply {
+                        val w = Utils.makeDropDownMeasureSpec(window.width)
+                        val y = Utils.makeDropDownMeasureSpec(window.height)
+                        measure(w, y)
+                    }
+                    val space = resources.getDimension(R.dimen.reader_annotation_property_setting_window_right_toolbar_space)
+                    val xOff = (-contentView.measuredWidth - space).toInt()
+                    val yOff = -contentView.measuredHeight
+                    window.showAsDropDown(btn, xOff, yOff)
+                }
+                return@setOnLongClickListener true
+            }
+        }
+    }
+
+
     private fun setLeftToolbarWidth(width: Int) {
         var params = viewGroup_readerActivity_leftToolbar.layoutParams as ConstraintLayout.LayoutParams
         params.width = width + w_left
@@ -461,8 +675,7 @@ abstract class ReaderActivity : AppCompatActivity() {
         leftToolbarType = type
     }
 
-    fun onClick(view: View)
-    {
+    fun onClick(view: View) {
         when (view.id) {
             R.id.iv_readerActivity_thumbnail -> {
                 onThumbnailClick()

+ 127 - 28
reader/src/main/java/com/kdanmobile/reader/ReaderViewModel.kt

@@ -4,6 +4,7 @@ import android.arch.lifecycle.LiveData
 import android.arch.lifecycle.MutableLiveData
 import android.arch.lifecycle.ViewModel
 import android.content.Context
+import android.graphics.Color
 import android.graphics.Bitmap
 import android.graphics.RectF
 import android.net.Uri
@@ -11,16 +12,36 @@ import com.kdanmobile.kmpdfkit.annotation.bean.*
 import com.kdanmobile.kmpdfkit.globaldata.Config
 import com.kdanmobile.kmpdfkit.manager.KMPDFFactory
 import com.kdanmobile.kmpdfkit.manager.controller.KMPDFDocumentController
+import com.kdanmobile.kmpdfkit.pdfcommon.KMPDFReaderView
+import com.kdanmobile.reader.annotationattribute.AnnotationAttribute
+import com.kdanmobile.reader.annotationattribute.InkAttribute
 import com.kdanmobile.kmpdfkit.pdfcommon.*
+import com.kdanmobile.reader.annotationattribute.Brush
 import com.kdanmobile.reader.screen.handler.*
 
 class ReaderViewModel(private val pdfSdkLicense: String, private val pdfSdkRsaMsg: String) : ViewModel() {
+
     enum class ViewDirection(val mode: Config.PDFViewMode) {
         VerticalSinglePageContinues(Config.PDFViewMode.VERTICAL_SINGLE_PAGE_CONTINUES),
         VerticalSinglePage(Config.PDFViewMode.VERTICAL_SINGLE_PAGE),
         HorizontalSinglePage(Config.PDFViewMode.HORIZONTAL_SINGLE_PAGE)
     }
 
+    enum class AnnotationMode {
+        None,
+        Highlight,
+        Strike,
+        Underline,
+        Ink,
+    }
+
+    companion object {
+        val DEFAULT_HIGHLIGHT_ATTR = AnnotationAttribute(Color.parseColor("#ffdc1b"), 127)
+        val DEFAULT_STRIKE_ATTR = AnnotationAttribute(Color.parseColor("#dd0202"), 255)
+        val DEFAULT_UNDERLINE_ATTR = AnnotationAttribute(Color.parseColor("#dd0202"), 255)
+        val DEFAULT_INK_ATTR = InkAttribute(Color.parseColor("#dd0202"), 255, 1f, Brush.Fountain)
+    }
+
     var viewDirection = ViewDirection.VerticalSinglePageContinues
         set(value) {
             field = value
@@ -31,8 +52,10 @@ class ReaderViewModel(private val pdfSdkLicense: String, private val pdfSdkRsaMs
             field = value
             updateCrop()
         }
-    var isCopyMode = false
-        private set
+    val highLightAttributeLiveData = MutableLiveData<AnnotationAttribute>().apply { value = DEFAULT_HIGHLIGHT_ATTR }
+    val strikeAttributeLiveData = MutableLiveData<AnnotationAttribute>().apply { value = DEFAULT_STRIKE_ATTR }
+    var underLineAttributeLiveData = MutableLiveData<AnnotationAttribute>().apply { value = DEFAULT_UNDERLINE_ATTR }
+    var inkAttributeLiveData = MutableLiveData<InkAttribute>().apply { value = DEFAULT_INK_ATTR }
 
     private var isVerified = false
 
@@ -40,6 +63,8 @@ class ReaderViewModel(private val pdfSdkLicense: String, private val pdfSdkRsaMs
     private var kmpdfDocumentController: KMPDFDocumentController? = null
     val isOpenedFileLiveData = MutableLiveData<Boolean>().apply { value = false }
     val fileNameLiveData = MutableLiveData<String>()
+    val annotationModeLiveData = MutableLiveData<AnnotationMode>().apply { value = AnnotationMode.None }
+    var isCopyModeLiveData = MutableLiveData<Boolean>().apply { value = false }
 
     val pageIndexLiveData: LiveData<Int>
         get() = mPageIndexLiveData
@@ -85,69 +110,143 @@ class ReaderViewModel(private val pdfSdkLicense: String, private val pdfSdkRsaMs
         return kmpdfDocumentController?.copySelection() ?: false
     }
 
-    fun startCopyTextMode() {
+    fun onClickCopyBtn() {
+        if (annotationModeLiveData.value != AnnotationMode.None) stopAnnotationMode()
+        if (isCopyModeLiveData.value == true) {
+            stopCopyTextMode()
+        } else {
+            startCopyTextMode()
+        }
+    }
+
+    fun onClickHighlightBtn() {
+        if (isCopyModeLiveData.value == true) stopCopyTextMode()
+        if (annotationModeLiveData.value == AnnotationMode.Highlight) {
+            stopAnnotationMode()
+        } else {
+            startHighLightEditMode()
+        }
+    }
+
+    fun onLongClickHighlightBtn() {
+        if (isCopyModeLiveData.value == true) stopCopyTextMode()
+        startHighLightEditMode()
+    }
+
+    fun onClickStrikeBtn() {
+        if (isCopyModeLiveData.value == true) stopCopyTextMode()
+        if (annotationModeLiveData.value == AnnotationMode.Strike) {
+            stopAnnotationMode()
+        } else {
+            startStrikeOutEditMode()
+        }
+    }
+
+    fun onLongClickStrikeBtn() {
+        if (isCopyModeLiveData.value == true) stopCopyTextMode()
+        startStrikeOutEditMode()
+    }
+
+    fun onClickUnderlineBtn() {
+        if (isCopyModeLiveData.value == true) stopCopyTextMode()
+        if (annotationModeLiveData.value == AnnotationMode.Underline) {
+            stopAnnotationMode()
+        } else {
+            startUnderLineEditMode()
+        }
+    }
+
+    fun onLongClickUnderlineBtn() {
+        if (isCopyModeLiveData.value == true) stopCopyTextMode()
+        startUnderLineEditMode()
+    }
+
+    fun onClickInkBtn() {
+        if (isCopyModeLiveData.value == true) stopCopyTextMode()
+        if (annotationModeLiveData.value == AnnotationMode.Ink) {
+            stopAnnotationMode()
+        } else {
+            startInkEditMode()
+        }
+    }
+
+    fun onLongClickInkBtn() {
+        if (isCopyModeLiveData.value == true) stopCopyTextMode()
+        startInkEditMode()
+    }
+
+    private fun startCopyTextMode() {
         kmpdfDocumentController?.startCopyText()
-        isCopyMode = true
+        isCopyModeLiveData.postValue(true)
     }
 
-    fun stopCopyTextMode() {
+    private fun stopCopyTextMode() {
         kmpdfDocumentController?.stopCopyText()
-        isCopyMode = false
+        isCopyModeLiveData.postValue(false)
     }
 
-    fun setHighLightAttributes(color: Int, alpha: Int) {
-        kmpdfFactory?.setAnnotationAttribute(KMPDFHighlightAnnotationBean("", color, alpha))
+    fun setHighLightAttributes(annotationAttribute: AnnotationAttribute) {
+        highLightAttributeLiveData.postValue(annotationAttribute)
+        kmpdfFactory?.setAnnotationAttribute(KMPDFHighlightAnnotationBean("", annotationAttribute.color, annotationAttribute.alpha))
         kmpdfFactory?.annotConfig?.apply {
-            markerPenColor_hightlight = color
-            markerPenAlpha_hightlight = alpha
+            markerPenColor_hightlight = annotationAttribute.color
+            markerPenAlpha_hightlight = annotationAttribute.alpha
         }
     }
 
-    fun startHighLightEditMode() {
+    private fun startHighLightEditMode() {
         kmpdfFactory?.setAnnotationEditMode(KMPDFAnnotationBean.AnnotationType.HIGH_LIGHT)
+        annotationModeLiveData.postValue(AnnotationMode.Highlight)
     }
 
-    fun setStrikeOutAttributes(color: Int, alpha: Int) {
-        kmpdfFactory?.setAnnotationAttribute(KMPDFStrikeoutAnnotationBean("", color, alpha))
+    fun setStrikeOutAttributes(annotationAttribute: AnnotationAttribute) {
+        strikeAttributeLiveData.postValue(annotationAttribute)
+        kmpdfFactory?.setAnnotationAttribute(KMPDFStrikeoutAnnotationBean("",annotationAttribute.color, annotationAttribute.alpha))
         kmpdfFactory?.annotConfig?.apply {
-            markerPenColor_strikeout = color
-            markerPenAlpha_strikeout = alpha
+            markerPenColor_strikeout = annotationAttribute.color
+            markerPenAlpha_strikeout = annotationAttribute.alpha
         }
     }
 
-    fun startStrikeOutEditMode() {
+    private fun startStrikeOutEditMode() {
         kmpdfFactory?.setAnnotationEditMode(KMPDFAnnotationBean.AnnotationType.STRIKE_OUT)
+        annotationModeLiveData.postValue(AnnotationMode.Strike)
     }
 
-    fun setUnderLineAttributes(color: Int, alpha: Int) {
-        kmpdfFactory?.setAnnotationAttribute(KMPDFUnderlineAnnotationBean("", color, alpha))
+    fun setUnderLineAttributes(annotationAttribute: AnnotationAttribute) {
+        underLineAttributeLiveData.postValue(annotationAttribute)
+        kmpdfFactory?.setAnnotationAttribute(KMPDFUnderlineAnnotationBean("", annotationAttribute.color, annotationAttribute.alpha))
         kmpdfFactory?.annotConfig?.apply {
-            markerPenColor_underline = color
-            markerPenAlpha_underline = alpha
+            markerPenColor_underline = annotationAttribute.color
+            markerPenAlpha_underline = annotationAttribute.alpha
         }
     }
 
-    fun startUnderLineEditMode() {
+    private fun startUnderLineEditMode() {
         kmpdfFactory?.setAnnotationEditMode(KMPDFAnnotationBean.AnnotationType.UNDER_LINE)
+        annotationModeLiveData.postValue(AnnotationMode.Underline)
     }
 
-    fun setInkAttributes(color: Int, alpha: Int, width: Float) {
+    fun setInkAttributes(inkAttribute: InkAttribute) {
+        inkAttributeLiveData.postValue(inkAttribute)
         kmpdfFactory?.apply {
-            setAnnotationAttribute(KMPDFInkAnnotationBean("", color, width, alpha))
+            setAnnotationAttribute(KMPDFInkAnnotationBean("", inkAttribute.color, inkAttribute.width, inkAttribute.alpha))
             annotConfig?.apply {
-                markerPenColor_ink = color
-                markerPenAlpha_ink = alpha
-                markerPenSize_ink = width
+                markerPenColor_ink = inkAttribute.color
+                markerPenAlpha_ink = inkAttribute.alpha
+                markerPenSize_ink = inkAttribute.width
             }
         }
     }
 
-    fun startInkEditMode() {
+    private fun startInkEditMode() {
         kmpdfFactory?.setAnnotationEditMode(KMPDFAnnotationBean.AnnotationType.INK)
+        annotationModeLiveData.postValue(AnnotationMode.Ink)
     }
 
-    fun stopEditMode() {
+    private fun stopAnnotationMode() {
         kmpdfFactory?.setAnnotationEditMode(KMPDFAnnotationBean.AnnotationType.NULL)
+        annotationModeLiveData.postValue(AnnotationMode.None)
     }
 
     fun setReaderView(readerView: KMPDFReaderView) {

+ 10 - 0
reader/src/main/java/com/kdanmobile/reader/Utils.kt

@@ -15,6 +15,7 @@ import android.support.v7.widget.AppCompatImageView
 import android.transition.AutoTransition
 import android.transition.TransitionManager
 import android.view.View
+import android.view.ViewGroup
 import android.widget.ImageView
 
 object Utils {
@@ -68,4 +69,13 @@ object Utils {
         constraintSet.clone(context, layoutResId)
         this.applyConstraintSet(constraintSet, duration)
     }
+
+    fun makeDropDownMeasureSpec(measureSpec: Int): Int {
+        val mode = if (measureSpec == ViewGroup.LayoutParams.WRAP_CONTENT) {
+            View.MeasureSpec.UNSPECIFIED
+        } else {
+            View.MeasureSpec.EXACTLY
+        }
+        return View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(measureSpec), mode)
+    }
 }

+ 5 - 0
reader/src/main/java/com/kdanmobile/reader/annotationattribute/AnnotationAttribute.kt

@@ -0,0 +1,5 @@
+package com.kdanmobile.reader.annotationattribute
+
+import android.support.annotation.IntRange
+
+open class AnnotationAttribute(open var color: Int, @IntRange(from = 0, to = 255) open var alpha: Int)

+ 16 - 0
reader/src/main/java/com/kdanmobile/reader/annotationattribute/AnnotationColor.kt

@@ -0,0 +1,16 @@
+package com.kdanmobile.reader.annotationattribute
+
+import com.kdanmobile.reader.R
+
+enum class AnnotationColor(val colorResId: Int) {
+    Color1(R.color.reader_annotation_color_1),
+    Color2(R.color.reader_annotation_color_2),
+    Color3(R.color.reader_annotation_color_3),
+    Color4(R.color.reader_annotation_color_4),
+    Color5(R.color.reader_annotation_color_5),
+    Color6(R.color.reader_annotation_color_6),
+    Color7(R.color.reader_annotation_color_7),
+    Color8(R.color.reader_annotation_color_8),
+    Color9(R.color.reader_annotation_color_9),
+    Color10(R.color.reader_annotation_color_10),
+}

+ 6 - 0
reader/src/main/java/com/kdanmobile/reader/annotationattribute/Brush.kt

@@ -0,0 +1,6 @@
+package com.kdanmobile.reader.annotationattribute
+
+enum class Brush(val maxSize: Int) {
+    Fountain(9),
+    Marker(16),
+}

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

@@ -0,0 +1,9 @@
+package com.kdanmobile.reader.annotationattribute
+
+import android.support.annotation.IntRange
+
+data class InkAttribute(
+        override var color: Int,
+        @IntRange(from = 0, to = 255) override var alpha: Int,
+        var width: Float,
+        var brush: Brush) : AnnotationAttribute(color, alpha)

+ 280 - 0
reader/src/main/java/com/kdanmobile/reader/view/AnnotationAttributeView.kt

@@ -0,0 +1,280 @@
+package com.kdanmobile.reader.view
+
+import android.content.Context
+import android.support.v4.graphics.ColorUtils
+import android.util.AttributeSet
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.LinearLayout
+import android.widget.PopupWindow
+import android.widget.SeekBar
+import com.kdanmobile.reader.R
+import com.kdanmobile.reader.Utils
+import com.kdanmobile.reader.annotationattribute.AnnotationAttribute
+import com.kdanmobile.reader.annotationattribute.AnnotationColor
+import com.kdanmobile.reader.annotationattribute.Brush
+import com.kdanmobile.reader.annotationattribute.InkAttribute
+import kotlinx.android.synthetic.main.view_reader_annotation_property.view.*
+
+class AnnotationAttributeView @JvmOverloads constructor(
+        context: Context,
+        attrs: AttributeSet? = null,
+        defStyleAttr: Int = 0
+) : LinearLayout(context, attrs, defStyleAttr) {
+
+    companion object {
+        const val DEFAULT_OPACITY = 50
+        const val DEFAULT_THICKNESS = 5
+    }
+
+
+    init {
+        inflate(context, R.layout.view_reader_annotation_property, this)
+    }
+    var inkAttribute: InkAttribute
+        get() {
+            return InkAttribute(color, alpha, thickness.toFloat(), brush)
+        }
+        set(value) {
+            color = value.color
+            alpha = value.alpha
+            thickness = value.width.toInt()
+            brush = value.brush
+        }
+    var annotationAttribute: AnnotationAttribute
+        get() {
+            return AnnotationAttribute(color, alpha)
+        }
+        set(value) {
+            color = value.color
+            alpha = value.alpha
+        }
+    var isSimpleMode = true
+        set(value) {
+            field = value
+            update()
+        }
+    var onChangeListener: OnChangeListener? = null
+    private val colorBtnMap = HashMap<AnnotationColor, ImageView>().apply {
+        put(AnnotationColor.Color1, iv_readerAnnotationProperty_color1)
+        put(AnnotationColor.Color2, iv_readerAnnotationProperty_color2)
+        put(AnnotationColor.Color3, iv_readerAnnotationProperty_color3)
+        put(AnnotationColor.Color4, iv_readerAnnotationProperty_color4)
+        put(AnnotationColor.Color5, iv_readerAnnotationProperty_color5)
+        put(AnnotationColor.Color6, iv_readerAnnotationProperty_color6)
+        put(AnnotationColor.Color7, iv_readerAnnotationProperty_color7)
+        put(AnnotationColor.Color8, iv_readerAnnotationProperty_color8)
+        put(AnnotationColor.Color9, iv_readerAnnotationProperty_color9)
+        put(AnnotationColor.Color10, iv_readerAnnotationProperty_color10)
+    }
+    private var thickness: Int = DEFAULT_THICKNESS
+        set(value) {
+            field = value
+            updateThickness()
+        }
+    /**
+     * 1~255
+     */
+    private var alpha: Int
+        get() {
+            return Math.round(opacity.toFloat() / 100 * 255)
+        }
+        set(value) {
+            val progress = Math.round(value.toFloat() / 255 * 100)
+            seekBar_readerAnnotationProperty_opacity.progress = progress
+        }
+    /**
+     * 1~100
+     */
+    private var opacity: Int = DEFAULT_OPACITY
+    private var color: Int
+        get() {
+            return context.resources.getColor(colorEnum.colorResId)
+        }
+        set(value) {
+            AnnotationColor.values().forEach {
+                val c = context.resources.getColor(it.colorResId)
+                if (c == value) {
+                    colorEnum = it
+                    return
+                }
+            }
+        }
+    private var colorEnum: AnnotationColor = AnnotationColor.Color1
+        set(value) {
+            field = value
+            updateColor()
+            updateColorButtons()
+            onChangeListener?.onChange(this)
+        }
+    private val colorWithAlpha: Int
+        get() {
+            return  ColorUtils.setAlphaComponent(color, alpha)
+        }
+    private var brush = Brush.Fountain
+        set(value) {
+            if (field == value) return
+            field = value
+            update()
+            when (value) {
+                Brush.Fountain -> if (thickness > brush.maxSize) thickness = brush.maxSize
+                Brush.Marker -> thickness = brush.maxSize
+            }
+            onChangeListener?.onChange(this)
+        }
+    init {
+        setupOpacitySeekBar()
+        setupThicknessSeekBar()
+        setupColorButtons()
+        setupBrushes()
+        update()
+    }
+
+    private fun setupBrushes() {
+        iv_readerAnnotationProperty_brush1.setOnClickListener {
+            brush = Brush.Fountain
+        }
+        iv_readerAnnotationProperty_brush2.setOnClickListener {
+            brush = Brush.Marker
+        }
+    }
+
+    private fun setupThicknessSeekBar() {
+        seekBar_readerAnnotationProperty_thickness.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
+            override fun onProgressChanged(p0: SeekBar?, progress: Int, p2: Boolean) {
+                thickness = progress
+                updateThickness()
+            }
+
+            override fun onStartTrackingTouch(p0: SeekBar?) {
+            }
+
+            override fun onStopTrackingTouch(p0: SeekBar?) {
+                onChangeListener?.onChange(this@AnnotationAttributeView)
+            }
+        })
+    }
+
+    private fun setupColorButtons() {
+        colorBtnMap.values.forEach {
+            it.setOnClickListener(this::onClickColorBtn)
+        }
+    }
+
+    private fun setupOpacitySeekBar() {
+        seekBar_readerAnnotationProperty_opacity.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
+            val colorDisplayerView = ColorOpacityDisplayerView(context)
+            val windowW = ViewGroup.LayoutParams.WRAP_CONTENT
+            val windowH = ViewGroup.LayoutParams.WRAP_CONTENT
+            val window = PopupWindow(colorDisplayerView, windowW, windowH).apply {
+                animationStyle = android.R.style.Animation
+            }
+            val contentView = window.contentView.apply {
+                val w = Utils.makeDropDownMeasureSpec(window.width)
+                val h = Utils.makeDropDownMeasureSpec(window.height)
+                measure(w, h)
+            }
+
+            override fun onProgressChanged(seekBar: SeekBar, progress: Int, p2: Boolean) {
+                opacity = progress
+                val x = calculateOffsetX(seekBar)
+                val y = calculateOffsetY(seekBar)
+                window.update(seekBar, x, y, window.width, window.height)
+                updateOpacity()
+                colorDisplayerView.color = colorWithAlpha
+            }
+
+            override fun onStartTrackingTouch(seekBar: SeekBar) {
+                val x = calculateOffsetX(seekBar)
+                val y = calculateOffsetY(seekBar)
+                colorDisplayerView.color = colorWithAlpha
+                window.showAsDropDown(seekBar, x, y)
+            }
+
+            override fun onStopTrackingTouch(p0: SeekBar?) {
+                window.dismiss()
+                onChangeListener?.onChange(this@AnnotationAttributeView)
+            }
+
+            private fun calculateOffsetX(seekBar: SeekBar): Int {
+                val seekBarLineWidth = seekBar.width - seekBar.paddingLeft - seekBar.paddingRight
+                val progress = seekBar.progress.toFloat() / seekBar.max.toFloat()
+                return (seekBar.paddingLeft + seekBarLineWidth * progress - contentView.measuredWidth / 2).toInt()
+            }
+
+            private fun calculateOffsetY(seekBar: SeekBar): Int {
+                return -seekBar.height - contentView.measuredHeight
+            }
+        })
+    }
+
+    private fun onClickColorBtn(view: View) {
+        colorBtnMap.entries.forEach {
+            if (it.value == view) {
+                colorEnum = it.key
+                return
+            }
+        }
+    }
+
+    private fun update() {
+        updateOpacity()
+        updateThickness()
+        updateColor()
+        updateColorButtons()
+        group_readerAnnotationProperty_brushMode.visibility = if (isSimpleMode) View.GONE else View.VISIBLE
+        group_readerAnnotationProperty_brushMode.post {
+            when (brush) {
+                Brush.Fountain -> {
+                    iv_readerAnnotationProperty_triangle1.visibility = View.VISIBLE
+                    iv_readerAnnotationProperty_triangle2.visibility = View.INVISIBLE
+                }
+                Brush.Marker -> {
+                    iv_readerAnnotationProperty_triangle1.visibility = View.INVISIBLE
+                    iv_readerAnnotationProperty_triangle2.visibility = View.VISIBLE
+                }
+            }
+        }
+    }
+
+    private fun updateOpacity() {
+        seekBar_readerAnnotationProperty_opacity.progress = opacity
+        tv_readerAnnotationProperty_opacityValue.text = opacity.toString()
+        waveLineView_readerAnnotationProperty.setColor(colorWithAlpha)
+    }
+
+    private fun updateThickness() {
+        when (brush) {
+            Brush.Fountain -> {
+                seekBar_readerAnnotationProperty_thickness.max = brush.maxSize
+                seekBar_readerAnnotationProperty_thickness.isEnabled = true
+            }
+            Brush.Marker -> {
+                seekBar_readerAnnotationProperty_thickness.max = brush.maxSize
+                seekBar_readerAnnotationProperty_thickness.isEnabled = false
+            }
+        }
+        seekBar_readerAnnotationProperty_thickness.progress = thickness
+        tv_readerAnnotationProperty_thicknessValue.text = thickness.toString()
+        waveLineView_readerAnnotationProperty.setThickness(thickness.toFloat())
+    }
+
+    private fun updateColor() {
+        waveLineView_readerAnnotationProperty.setColor(colorWithAlpha)
+    }
+
+    private fun updateColorButtons() {
+        colorBtnMap.entries.forEach {
+            if (it.key == colorEnum) {
+                it.value.setImageResource(R.drawable.reader_annotation_property_color_border_select)
+            } else {
+                it.value.setImageResource(R.drawable.reader_annotation_property_color_border)
+            }
+        }
+    }
+
+    interface OnChangeListener {
+        fun onChange(annotationAttributeView: AnnotationAttributeView)
+    }
+}

+ 22 - 0
reader/src/main/java/com/kdanmobile/reader/view/AnnotationAttributeWindow.kt

@@ -0,0 +1,22 @@
+package com.kdanmobile.reader.view
+
+import android.content.Context
+import android.os.Build
+import android.widget.PopupWindow
+import com.kdanmobile.reader.R
+
+class AnnotationAttributeWindow(context: Context, isSimpleMode: Boolean) : PopupWindow(context) {
+    val annotationAttributeView: AnnotationAttributeView
+
+    init {
+        isOutsideTouchable = true
+        isFocusable = true
+        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
+            elevation = context.resources.getDimension(R.dimen.reader_annotation_property_setting_window_elevation)
+        }
+        setBackgroundDrawable(context.resources.getDrawable(R.drawable.bg_annotation_property_setting_window))
+        annotationAttributeView = AnnotationAttributeView(context)
+        annotationAttributeView.isSimpleMode = isSimpleMode
+        contentView = annotationAttributeView
+    }
+}

+ 30 - 0
reader/src/main/java/com/kdanmobile/reader/view/ColorOpacityDisplayerView.kt

@@ -0,0 +1,30 @@
+package com.kdanmobile.reader.view
+
+import android.content.Context
+import android.graphics.Color
+import android.support.constraint.ConstraintLayout
+import android.support.v4.graphics.ColorUtils
+import android.util.AttributeSet
+import android.view.View
+import com.kdanmobile.reader.R
+import kotlinx.android.synthetic.main.view_color_opacity_displayer.view.*
+
+class ColorOpacityDisplayerView @JvmOverloads constructor(
+        context: Context,
+        attrs: AttributeSet? = null,
+        defStyleAttr: Int = 0
+) : ConstraintLayout(context, attrs, defStyleAttr) {
+    init {
+        View.inflate(context, R.layout.view_color_opacity_displayer, this)
+    }
+
+    var color = Color.BLACK
+        set(value) {
+            field = value
+            update()
+        }
+
+    private fun update() {
+        view_colorOpacityDisplayer_color.setBackgroundColor(color)
+    }
+}

+ 1 - 1
reader/src/main/java/com/kdanmobile/reader/HorizontalView.java

@@ -1,4 +1,4 @@
-package com.kdanmobile.reader;
+package com.kdanmobile.reader.view;
 
 import android.app.Activity;
 import android.content.Context;

+ 82 - 0
reader/src/main/java/com/kdanmobile/reader/view/WaveLineView.java

@@ -0,0 +1,82 @@
+package com.kdanmobile.reader.view;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Paint.Cap;
+import android.graphics.Paint.Style;
+import android.graphics.Path;
+import android.support.annotation.NonNull;
+import android.util.AttributeSet;
+import android.view.View;
+
+/**
+ * @类名:WaveLineView
+ * @类描述:自定义控件实现波浪线
+ * @作者:zhouguifang
+ * @创建时间:2015-7-7-上午11:35:01
+ * @修改人:
+ * @修改时间:
+ * @修改备注:
+ * @版本:
+ * @Copyright:(c)-2015kdan mobile
+ */
+public class WaveLineView extends View {
+	private Paint paint;
+	private Path path;
+	private int color = 0xffff0000;
+	private float thickness = 20;
+	private float bili = 1.f / 6;
+
+	public WaveLineView(Context context, AttributeSet attrs) {
+		super(context, attrs);
+		paint = new Paint();
+		paint.setColor(color);
+		paint.setAntiAlias(true);
+		paint.setStrokeCap(Cap.ROUND);
+		paint.setStyle(Style.STROKE);
+		paint.setStrokeWidth(20f);
+	}
+
+	public void setThickness(float thickness) {
+		this.thickness = thickness;
+		invalidate();
+	}
+
+	public void setColor(int color) {
+		this.color = color;
+		invalidate();
+	}
+
+	@Override
+	public void draw(@NonNull Canvas canvas) {
+		super.draw(canvas);
+		if (getWidth() > 0) {
+			if (path == null) {
+				int w = getWidth();
+				int h = getHeight();
+				path = new Path();
+				path.moveTo(0, h / 2f);
+				path.lineTo((w * 30) / 360, (h / 2) - (h * bili * 0.5f));
+				path.lineTo((w * 45) / 360, (h / 2) - (h * bili * 0.707f));
+				path.lineTo((w * 60) / 360, (h / 2) - (h * bili * 0.866f));
+				path.lineTo((w * 90) / 360, (h / 2) - (h * bili * 1.0f));
+				path.lineTo((w * 120) / 360, (h / 2) - (h * bili * 0.866f));
+				path.lineTo((w * 135) / 360, (h / 2) - (h * bili * 0.707f));
+				path.lineTo((w * 150) / 360, (h / 2) - (h * bili * 0.5f));
+				path.lineTo((w * 180) / 360, (h / 2) - (h * bili * 0.0f));
+				path.lineTo((w * 210) / 360, (h / 2) + (h * bili * 0.5f));
+				path.lineTo((w * 225) / 360, (h / 2) + (h * bili * 0.707f));
+				path.lineTo((w * 240) / 360, (h / 2) + (h * bili * 0.866f));
+				path.lineTo((w * 270) / 360, (h / 2) + (h * bili * 1.0f));
+				path.lineTo((w * 300) / 360, (h / 2) + (h * bili * 0.866f));
+				path.lineTo((w * 315) / 360, (h / 2) + (h * bili * 0.707f));
+				path.lineTo((w * 330) / 360, (h / 2) + (h * bili * 0.5f));
+				path.lineTo((w * 360) / 360, (h / 2) + (h * bili * 0.0f));
+			}
+			paint.setColor(color);
+			paint.setStrokeWidth(thickness);
+			canvas.drawPath(path, paint);
+		}
+	}
+}

binární
reader/src/main/res/drawable-hdpi/ic_freehand_triangle.png


binární
reader/src/main/res/drawable-hdpi/panel_property_color_preview.png


binární
reader/src/main/res/drawable-xhdpi/panel_property_color_preview.png


+ 5 - 0
reader/src/main/res/drawable-xxhdpi/bg_annotation_property_setting_window.xml

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

binární
reader/src/main/res/drawable-xxhdpi/ic_freehand_triangle.png


binární
reader/src/main/res/drawable-xxhdpi/seekbar_back.png


binární
reader/src/main/res/drawable-xxhdpi/seekbar_fill.png


binární
reader/src/main/res/drawable-xxhdpi/seekbar_handle_small_d.png


binární
reader/src/main/res/drawable-xxhdpi/seekbar_handle_small_disable.png


binární
reader/src/main/res/drawable-xxhdpi/seekbar_handle_small_p.png


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

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+	<!-- 背景图 -->
+	<item android:id="@android:id/background"
+		  android:drawable="@drawable/seekbar_back" />
+	<!--全部能量图  -->
+	<!-- <item android:id="@+android:id/SecondaryProgress"
+		  android:drawable="@drawable/back" /> -->
+	<!-- 进和能量图 -->
+	<item android:id="@android:id/progress" 
+	      android:drawable="@drawable/seekbar_fill" />
+</layer-list>

+ 13 - 0
reader/src/main/res/drawable-xxhdpi/seekbar_thumb_ttpod_small.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+	<!-- 按下状态 -->
+	<item android:state_pressed="true" android:drawable="@drawable/seekbar_handle_small_p" />
+
+	<!-- 普通无焦点状态 -->
+	<item android:state_enabled="true" android:state_focused="false" android:state_pressed="false"
+		android:drawable="@drawable/seekbar_handle_small_d" />
+
+	<!-- disable状态 -->
+	<item android:state_enabled="false" android:state_focused="false"
+		android:drawable="@drawable/seekbar_handle_small_disable" />
+</selector> 

binární
reader/src/main/res/drawable/ink_brush_1.png


binární
reader/src/main/res/drawable/ink_brush_2.png


binární
reader/src/main/res/drawable/panel_property_color_previewbg.png


+ 11 - 0
reader/src/main/res/drawable/reader_annotation_property_color_border.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle" >
+
+    <stroke
+        android:width="2dp"
+        android:color="#afafaf" />
+
+    <solid android:color="#0000"/>
+    
+</shape>

+ 11 - 0
reader/src/main/res/drawable/reader_annotation_property_color_border_select.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle" >
+
+    <stroke
+        android:width="4dp"
+        android:color="#33b5e5" />
+
+    <solid android:color="#0000"/>
+    
+</shape>

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

@@ -42,7 +42,7 @@
             android:textSize="16sp"
             android:textStyle="bold"/>
     </android.support.v7.widget.Toolbar>
-    <com.kdanmobile.reader.HorizontalView
+    <com.kdanmobile.reader.view.HorizontalView
         android:id="@+id/viewGroup_readerActivity_leftToolbar"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/toolbar_readerActivity"
@@ -97,8 +97,8 @@
                     android:src="@drawable/ic_pagelist_search_nor" />
             </LinearLayout>
         </android.support.constraint.ConstraintLayout>
-    </com.kdanmobile.reader.HorizontalView>
-    <com.kdanmobile.reader.HorizontalView
+    </com.kdanmobile.reader.view.HorizontalView>
+    <com.kdanmobile.reader.view.HorizontalView
         android:id="@+id/viewGroup_readerActivity_rightToolbar"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"
@@ -239,7 +239,7 @@
                     style="@style/ReaderLeftRightToolbarIImageButton" />
             </android.support.constraint.ConstraintLayout>
         </ScrollView>
-    </com.kdanmobile.reader.HorizontalView>
+    </com.kdanmobile.reader.view.HorizontalView>
     <android.support.constraint.ConstraintLayout
         android:id="@+id/viewGroup_readerActivity_bottomToolbar"
         android:background="@color/black_54"

+ 2 - 2
reader/src/main/res/layout/activity_reader_hide_all.xml

@@ -12,14 +12,14 @@
         app:layout_constraintBottom_toTopOf="parent"
         android:layout_width="0dp"
         android:layout_height="wrap_content" />
-    <com.kdanmobile.reader.HorizontalView
+    <com.kdanmobile.reader.view.HorizontalView
         android:id="@+id/viewGroup_readerActivity_leftToolbar"
         app:layout_constraintRight_toLeftOf="parent"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content" />
-    <com.kdanmobile.reader.HorizontalView
+    <com.kdanmobile.reader.view.HorizontalView
         android:id="@+id/viewGroup_readerActivity_rightToolbar"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"

+ 2 - 2
reader/src/main/res/layout/activity_reader_hide_top_left_bottom.xml

@@ -12,14 +12,14 @@
         app:layout_constraintBottom_toTopOf="parent"
         android:layout_width="0dp"
         android:layout_height="wrap_content" />
-    <com.kdanmobile.reader.HorizontalView
+    <com.kdanmobile.reader.view.HorizontalView
         android:id="@+id/viewGroup_readerActivity_leftToolbar"
         app:layout_constraintRight_toLeftOf="parent"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content" />
-    <com.kdanmobile.reader.HorizontalView
+    <com.kdanmobile.reader.view.HorizontalView
         android:id="@+id/viewGroup_readerActivity_rightToolbar"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"

+ 42 - 0
reader/src/main/res/layout/view_color_opacity_displayer.xml

@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    tools:parentTag="android.support.constraint.ConstraintLayout"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content">
+    <View
+        android:id="@+id/view_colorOpacityDisplayer_transparentBg"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_marginLeft="8dp"
+        android:layout_marginRight="8dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginBottom="16dp"
+        android:background="@drawable/panel_property_color_previewbg"
+        app:layout_constraintLeft_toLeftOf="@id/view_colorOpacityDisplayer_displayer"
+        app:layout_constraintRight_toRightOf="@id/view_colorOpacityDisplayer_displayer"
+        app:layout_constraintTop_toTopOf="@id/view_colorOpacityDisplayer_displayer"
+        app:layout_constraintBottom_toBottomOf="@id/view_colorOpacityDisplayer_displayer"
+        />
+    <View
+        android:id="@+id/view_colorOpacityDisplayer_color"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:background="#8f00"
+        app:layout_constraintLeft_toLeftOf="@id/view_colorOpacityDisplayer_transparentBg"
+        app:layout_constraintRight_toRightOf="@id/view_colorOpacityDisplayer_transparentBg"
+        app:layout_constraintTop_toTopOf="@id/view_colorOpacityDisplayer_transparentBg"
+        app:layout_constraintBottom_toBottomOf="@id/view_colorOpacityDisplayer_transparentBg"
+        />
+    <View
+        android:id="@+id/view_colorOpacityDisplayer_displayer"
+        android:layout_width="@dimen/reader_color_displayer_width"
+        android:layout_height="@dimen/reader_color_displayer_height"
+        android:background="@drawable/panel_property_color_preview"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        />
+</merge>

+ 231 - 0
reader/src/main/res/layout/view_reader_annotation_property.xml

@@ -0,0 +1,231 @@
+<?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"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="240dp"
+    android:layout_height="wrap_content"
+    android:orientation="vertical">
+
+    <android.support.constraint.Group
+        android:id="@+id/group_readerAnnotationProperty_brushMode"
+        app:constraint_referenced_ids="tv_readerAnnotationProperty_thicknessName, seekBar_readerAnnotationProperty_thickness, tv_readerAnnotationProperty_thicknessValue, waveLineView_readerAnnotationProperty, iv_readerAnnotationProperty_triangle1, iv_readerAnnotationProperty_triangle2, iv_readerAnnotationProperty_brush1, iv_readerAnnotationProperty_brush2"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
+    <com.kdanmobile.reader.view.WaveLineView
+        android:id="@+id/waveLineView_readerAnnotationProperty"
+        android:layout_marginLeft="8dp"
+        android:layout_marginRight="8dp"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        android:layout_width="0dp"
+        android:layout_height="60dp" />
+
+    <TextView
+        android:id="@+id/tv_readerAnnotationProperty_thicknessName"
+        android:text="@string/pdfReader_ppw_thickness"
+        android:textSize="16sp"
+        android:layout_marginLeft="8dp"
+        android:layout_marginRight="8dp"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toTopOf="@id/seekBar_readerAnnotationProperty_thickness"
+        app:layout_constraintBottom_toBottomOf="@id/seekBar_readerAnnotationProperty_thickness"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
+    <TextView
+        android:id="@+id/tv_readerAnnotationProperty_opacityName"
+        android:text="@string/pdfReader_ppw_opacity"
+        android:textSize="16sp"
+        android:layout_marginLeft="8dp"
+        android:layout_marginRight="8dp"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toTopOf="@id/seekBar_readerAnnotationProperty_opacity"
+        app:layout_constraintBottom_toBottomOf="@id/seekBar_readerAnnotationProperty_opacity"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
+    <android.support.constraint.Barrier
+        android:id="@+id/barrier_readerAnnotationProperty_thicknessOpacityText"
+        app:constraint_referenced_ids="tv_readerAnnotationProperty_thicknessName, tv_readerAnnotationProperty_opacityName"
+        app:barrierDirection="right"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
+    <SeekBar
+        android:id="@+id/seekBar_readerAnnotationProperty_thickness"
+        android:layout_marginTop="8dp"
+        app:layout_constraintLeft_toRightOf="@id/barrier_readerAnnotationProperty_thicknessOpacityText"
+        app:layout_constraintRight_toLeftOf="@id/barrier_readerAnnotationProperty_thicknessOpacityValue"
+        app:layout_constraintTop_toBottomOf="@id/waveLineView_readerAnnotationProperty"
+        android:layout_width="0dp"
+        android:layout_height="32dp"
+        android:min="1"
+        android:max="16"
+        android:maxHeight="1dp"
+        android:minHeight="1dp"
+        android:paddingLeft="10dp"
+        android:paddingRight="10dp"
+        android:progress="3"
+        android:progressDrawable="@drawable/seekbar_img"
+        android:scrollbarStyle="insideOverlay"
+        android:thumb="@drawable/seekbar_thumb_ttpod_small"
+        android:thumbOffset="7dp" />
+
+    <SeekBar
+        android:id="@+id/seekBar_readerAnnotationProperty_opacity"
+        android:layout_marginTop="8dp"
+        app:layout_constraintLeft_toRightOf="@id/barrier_readerAnnotationProperty_thicknessOpacityText"
+        app:layout_constraintRight_toLeftOf="@id/barrier_readerAnnotationProperty_thicknessOpacityValue"
+        app:layout_constraintTop_toBottomOf="@id/seekBar_readerAnnotationProperty_thickness"
+        android:layout_width="0dp"
+        android:layout_height="32dp"
+        android:min="1"
+        android:max="100"
+        android:progress="50"
+        android:maxHeight="1dp"
+        android:minHeight="1dp"
+        android:paddingLeft="10dp"
+        android:paddingRight="10dp"
+        android:progressDrawable="@drawable/seekbar_img"
+        android:scrollbarStyle="insideOverlay"
+        android:thumb="@drawable/seekbar_thumb_ttpod_small"
+        />
+
+    <android.support.constraint.Barrier
+        android:id="@+id/barrier_readerAnnotationProperty_thicknessOpacityValue"
+        app:constraint_referenced_ids="tv_readerAnnotationProperty_thicknessValue, tv_readerAnnotationProperty_opacityValue"
+        app:barrierDirection="left"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
+    <TextView
+        android:id="@+id/tv_readerAnnotationProperty_thicknessValue"
+        tools:text="0"
+        android:textSize="16sp"
+        android:gravity="center"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="@id/seekBar_readerAnnotationProperty_thickness"
+        app:layout_constraintBottom_toBottomOf="@id/seekBar_readerAnnotationProperty_thickness"
+        android:layout_marginRight="8dp"
+        android:layout_width="32dp"
+        android:layout_height="wrap_content" />
+
+    <TextView
+        android:id="@+id/tv_readerAnnotationProperty_opacityValue"
+        tools:text="0"
+        android:textSize="16sp"
+        android:gravity="center"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="@id/seekBar_readerAnnotationProperty_opacity"
+        app:layout_constraintBottom_toBottomOf="@id/seekBar_readerAnnotationProperty_opacity"
+        android:layout_marginRight="8dp"
+        android:layout_width="32dp"
+        android:layout_height="wrap_content" />
+
+    <HorizontalScrollView
+        android:id="@+id/viewGroup_readerAnnotationProperty_color"
+        app:layout_constraintTop_toBottomOf="@id/seekBar_readerAnnotationProperty_opacity"
+        android:layout_marginTop="16dp"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content">
+        <LinearLayout
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:gravity="center"
+            android:orientation="horizontal">
+
+            <ImageView
+                style="@style/AnnotationPropertyColorImageView"
+                android:id="@+id/iv_readerAnnotationProperty_color1"
+                android:background="@color/reader_annotation_color_1" />
+
+            <ImageView
+                style="@style/AnnotationPropertyColorImageView"
+                android:id="@+id/iv_readerAnnotationProperty_color2"
+                android:background="@color/reader_annotation_color_2" />
+
+            <ImageView
+                style="@style/AnnotationPropertyColorImageView"
+                android:id="@+id/iv_readerAnnotationProperty_color3"
+                android:background="@color/reader_annotation_color_3" />
+
+            <ImageView
+                style="@style/AnnotationPropertyColorImageView"
+                android:id="@+id/iv_readerAnnotationProperty_color4"
+                android:background="@color/reader_annotation_color_4" />
+
+            <ImageView
+                style="@style/AnnotationPropertyColorImageView"
+                android:id="@+id/iv_readerAnnotationProperty_color5"
+                android:background="@color/reader_annotation_color_5" />
+
+            <ImageView
+                style="@style/AnnotationPropertyColorImageView"
+                android:id="@+id/iv_readerAnnotationProperty_color6"
+                android:background="@color/reader_annotation_color_6" />
+
+            <ImageView
+                style="@style/AnnotationPropertyColorImageView"
+                android:id="@+id/iv_readerAnnotationProperty_color7"
+                android:background="@color/reader_annotation_color_7" />
+
+            <ImageView
+                style="@style/AnnotationPropertyColorImageView"
+                android:id="@+id/iv_readerAnnotationProperty_color8"
+                android:background="@color/reader_annotation_color_8" />
+
+            <ImageView
+                style="@style/AnnotationPropertyColorImageView"
+                android:id="@+id/iv_readerAnnotationProperty_color9"
+                android:background="@color/reader_annotation_color_9" />
+
+            <ImageView
+                style="@style/AnnotationPropertyColorImageView"
+                android:id="@+id/iv_readerAnnotationProperty_color10"
+                android:background="@color/reader_annotation_color_10" />
+        </LinearLayout>
+    </HorizontalScrollView>
+
+    <ImageView
+        android:id="@+id/iv_readerAnnotationProperty_triangle1"
+        android:src="@drawable/ic_freehand_triangle"
+        app:layout_constraintTop_toBottomOf="@id/viewGroup_readerAnnotationProperty_color"
+        app:layout_constraintLeft_toLeftOf="@id/iv_readerAnnotationProperty_brush1"
+        app:layout_constraintRight_toRightOf="@id/iv_readerAnnotationProperty_brush1"
+        android:layout_width="24dp"
+        android:layout_height="24dp"/>
+    <ImageView
+        android:id="@+id/iv_readerAnnotationProperty_brush1"
+        android:src="@drawable/ink_brush_1"
+        android:adjustViewBounds="true"
+        app:layout_constraintTop_toBottomOf="@id/iv_readerAnnotationProperty_triangle1"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toLeftOf="@id/iv_readerAnnotationProperty_brush2"
+        android:layout_marginLeft="8dp"
+        android:layout_marginRight="8dp"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content" />
+    <ImageView
+        android:id="@+id/iv_readerAnnotationProperty_triangle2"
+        android:src="@drawable/ic_freehand_triangle"
+        app:layout_constraintTop_toBottomOf="@id/viewGroup_readerAnnotationProperty_color"
+        app:layout_constraintLeft_toLeftOf="@id/iv_readerAnnotationProperty_brush2"
+        app:layout_constraintRight_toRightOf="@id/iv_readerAnnotationProperty_brush2"
+        android:layout_width="24dp"
+        android:layout_height="24dp" />
+    <ImageView
+        android:id="@+id/iv_readerAnnotationProperty_brush2"
+        android:src="@drawable/ink_brush_2"
+        android:adjustViewBounds="true"
+        app:layout_constraintTop_toTopOf="@id/iv_readerAnnotationProperty_brush1"
+        app:layout_constraintBottom_toBottomOf="@id/iv_readerAnnotationProperty_brush1"
+        app:layout_constraintLeft_toRightOf="@id/iv_readerAnnotationProperty_brush1"
+        app:layout_constraintRight_toRightOf="parent"
+        android:layout_marginLeft="8dp"
+        android:layout_marginRight="8dp"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content" />
+</android.support.constraint.ConstraintLayout>

+ 3 - 1
reader/src/main/res/values-de/strings.xml

@@ -6,6 +6,9 @@
     <string name="reader_more_menu_text_reflow">Text Rückfluss</string>
     <string name="reader_more_menu_print">Drucken</string>
 
+    <string name="pdfReader_ppw_thickness">Größe</string>
+    <string name="pdfReader_ppw_opacity">Deckkraft</string>
+
     <string name="reader_more_menu_bookmark">Lesezeichen</string>
     <string name="reader_alert_dialog_title_add_bookmark">Lesezeichen hinzufügen</string>
     <string name="reader_alert_dialog_button_confirm">Bestätigen</string>
@@ -27,7 +30,6 @@
 
     <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>

+ 2 - 1
reader/src/main/res/values-es/strings.xml

@@ -5,6 +5,8 @@
     <string name="reader_more_menu_share">Compartir</string>
     <string name="reader_more_menu_text_reflow">Herramienta de marcado</string>
     <string name="reader_more_menu_print">Borrar firma</string>
+    <string name="pdfReader_ppw_thickness">Tamaño</string>
+    <string name="pdfReader_ppw_opacity">Opacidad</string>
 
     <string name="reader_more_menu_bookmark">Marcador</string>
     <string name="reader_alert_dialog_title_add_bookmark">Añadir marcador</string>
@@ -27,7 +29,6 @@
 
     <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>

+ 2 - 1
reader/src/main/res/values-fr/strings.xml

@@ -5,6 +5,8 @@
     <string name="reader_more_menu_share">Partager</string>
     <string name="reader_more_menu_text_reflow">Text Reflow</string>
     <string name="reader_more_menu_print">Imprimer</string>
+    <string name="pdfReader_ppw_thickness">Taille</string>
+    <string name="pdfReader_ppw_opacity">Opacité</string>
 
     <string name="reader_more_menu_bookmark">Marquer la page</string>
     <string name="reader_alert_dialog_title_add_bookmark">Ajouter un marque page</string>
@@ -27,7 +29,6 @@
 
     <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>

+ 2 - 1
reader/src/main/res/values-it/strings.xml

@@ -5,6 +5,8 @@
     <string name="reader_more_menu_share">Condividere</string>
     <string name="reader_more_menu_text_reflow">Testo riflusso</string>
     <string name="reader_more_menu_print">Stampa</string>
+    <string name="pdfReader_ppw_thickness">Dimensione</string>
+    <string name="pdfReader_ppw_opacity">Opacità</string>
 
     <string name="reader_more_menu_bookmark">Segnalibro</string>
     <string name="reader_alert_dialog_title_add_bookmark">Aggiungi segnalibro</string>
@@ -27,7 +29,6 @@
 
     <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>

+ 3 - 1
reader/src/main/res/values-ja/strings.xml

@@ -5,6 +5,8 @@
     <string name="reader_more_menu_print">印刷</string>
     <string name="reader_more_menu_file_info">ファイル内容</string>
     <string name="reader_more_menu_user_guide">ユーザーガイド</string>
+    <string name="pdfReader_ppw_thickness">サイズ</string>
+    <string name="pdfReader_ppw_opacity">透明度</string>
 
     <string name="reader_more_menu_bookmark">ブックマーク</string>
     <string name="reader_alert_dialog_title_add_bookmark">ブックマークを作成する</string>
@@ -25,7 +27,7 @@
     <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>
+    <string name="dialogAddBookmark_page">ページ数:</string>
 </resources>

+ 2 - 1
reader/src/main/res/values-ko/strings.xml

@@ -5,6 +5,8 @@
     <string name="reader_more_menu_share">공유</string>
     <string name="reader_more_menu_text_reflow">텍스트 리플로우</string>
     <string name="reader_more_menu_print">인쇄</string>
+    <string name="pdfReader_ppw_thickness">크기</string>
+    <string name="pdfReader_ppw_opacity">투명도</string>
 
     <string name="reader_more_menu_bookmark">북마크</string>
     <string name="reader_alert_dialog_title_add_bookmark">북마크 추가</string>
@@ -27,7 +29,6 @@
 
     <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>

+ 2 - 1
reader/src/main/res/values-pt/strings.xml

@@ -5,6 +5,8 @@
     <string name="reader_more_menu_share">Compartilhar</string>
     <string name="reader_more_menu_text_reflow">Refluxo de texto</string>
     <string name="reader_more_menu_print">Imprimir</string>
+    <string name="pdfReader_ppw_thickness">Tamanho</string>
+    <string name="pdfReader_ppw_opacity">Opacidade</string>
 
     <string name="reader_more_menu_bookmark">Marcador</string>
     <string name="reader_alert_dialog_title_add_bookmark">Adicionar marcador</string>
@@ -27,7 +29,6 @@
 
     <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>

+ 2 - 1
reader/src/main/res/values-ru/strings.xml

@@ -5,6 +5,8 @@
     <string name="reader_more_menu_share">Поделиться</string>
     <string name="reader_more_menu_text_reflow">Перенаправить Текст</string>
     <string name="reader_more_menu_print">Печать</string>
+    <string name="pdfReader_ppw_thickness">Размер</string>
+    <string name="pdfReader_ppw_opacity">Прозрачность</string>
 
     <string name="reader_more_menu_bookmark">Закладка</string>
     <string name="reader_alert_dialog_title_add_bookmark">Добавить закладку</string>
@@ -27,7 +29,6 @@
 
     <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>

+ 3 - 1
reader/src/main/res/values-zh-rTW/strings.xml

@@ -5,6 +5,9 @@
     <string name="reader_more_menu_print">列印</string>
     <string name="reader_more_menu_file_info">文件資訊</string>
     <string name="reader_more_menu_user_guide">使用指南</string>
+    <string name="reader_copy_text_success">已複製到剪貼簿中!</string>
+    <string name="pdfReader_ppw_thickness">大小</string>
+    <string name="pdfReader_ppw_opacity">透明度</string>
 
     <string name="reader_more_menu_bookmark">書籤</string>
     <string name="reader_alert_dialog_title_add_bookmark">新增書籤</string>
@@ -27,7 +30,6 @@
 
     <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>

+ 3 - 1
reader/src/main/res/values-zh/strings.xml

@@ -5,6 +5,9 @@
     <string name="reader_more_menu_print">打印</string>
     <string name="reader_more_menu_file_info">文件信息</string>
     <string name="reader_more_menu_user_guide">使用导航</string>
+    <string name="reader_copy_text_success">已复制到剪切板!</string>
+    <string name="pdfReader_ppw_thickness">厚度</string>
+    <string name="pdfReader_ppw_opacity">透明度</string>
 
     <string name="reader_more_menu_bookmark">书签</string>
     <string name="reader_alert_dialog_title_add_bookmark">添加书签</string>
@@ -27,7 +30,6 @@
 
     <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>

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

@@ -9,6 +9,18 @@
     <color name="reader_toolbar_title_color">#E2000000</color>
     <color name="reader_bottom_toolbar_bottom_color_normal">#FFFFFF</color>
     <color name="reader_bottom_toolbar_bottom_color_press">@color/picton_blue</color>
+    <color name="reader_right_toolbar_selected_bg">#6633B5E5</color>
+
+    <color name="reader_annotation_color_1">#000000</color>
+    <color name="reader_annotation_color_2">#296dd2</color>
+    <color name="reader_annotation_color_3">#57d214</color>
+    <color name="reader_annotation_color_4">#ffdc1b</color>
+    <color name="reader_annotation_color_5">#ff7e00</color>
+    <color name="reader_annotation_color_6">#fe866a</color>
+    <color name="reader_annotation_color_7">#d11bff</color>
+    <color name="reader_annotation_color_8">#ff1b89</color>
+    <color name="reader_annotation_color_9">#dd0202</color>
+    <color name="reader_annotation_color_10">#ffffff</color>
 
     <color name="highlight_default_color">#FFFF00</color>
     <color name="strike_default_color">#FF0000</color>

+ 7 - 0
reader/src/main/res/values/dimens.xml

@@ -1,3 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
 <resources>
+    <dimen name="reader_annotation_property_setting_window_right_toolbar_space">8dp</dimen>
+    <dimen name="reader_annotation_property_setting_window_elevation">2dp</dimen>
+
+    <dimen name="reader_color_displayer_width">54dp</dimen>
+    <dimen name="reader_color_displayer_height">60dp</dimen>
+
     <dimen name="reader_left_right_toolbar_icon_width">48dp</dimen>
 </resources>

+ 5 - 1
reader/src/main/res/values/strings.xml

@@ -7,6 +7,10 @@
     <string name="reader_more_menu_print">Print</string>
     <string name="reader_more_menu_file_info">File Info</string>
     <string name="reader_more_menu_user_guide">User Guide</string>
+    <string name="reader_copy_text_success">It has been copied to the clipboard!</string>
+
+    <string name="pdfReader_ppw_thickness">Size</string>
+    <string name="pdfReader_ppw_opacity">Opacity</string>
 
     <string name="reader_alert_dialog_title_add_bookmark">Add bookmark</string>
     <string name="reader_alert_dialog_title_delete_bookmark">Delete bookmark</string>
@@ -14,7 +18,7 @@
     <string name="reader_alert_dialog_button_confirm">Confirm</string>
     <string name="reader_alert_dialog_button_cancel">Cancel</string>
 
-    <string name="null_str">&#160;</string>
+    <string name="null_str" translatable="false">&#160;</string>
 
     <string name="outline_title">Outline</string>
     <string name="bookmark_title">Bookmark</string>

+ 6 - 0
reader/src/main/res/values/styles.xml

@@ -34,4 +34,10 @@
         <item name="android:padding">12dp</item>
         <item name="android:background">?android:attr/selectableItemBackground</item>
     </style>
+    <style name="AnnotationPropertyColorImageView">
+        <item name="android:layout_width">24dp</item>
+        <item name="android:layout_height">24dp</item>
+        <item name="android:layout_margin">8dp</item>
+        <item name="android:src">@drawable/reader_annotation_property_color_border</item>
+    </style>
 </resources>