Browse Source

Fountain max size = 9, Masker max size = 16

Wayne 5 years ago
parent
commit
4627c52c21

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

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

+ 15 - 1
reader/src/main/java/com/kdanmobile/reader/view/AnnotationAttributeView.kt

@@ -128,8 +128,12 @@ class AnnotationAttributeView @JvmOverloads constructor(
         set(value) {
             if (field == value) return
             field = value
-            thickness = brush.size
             update()
+            when (value) {
+                Brush.Fountain -> if (thickness > brush.maxSize) thickness = brush.maxSize
+                Brush.Marker -> thickness = brush.maxSize
+            }
+            onChangeListener?.onChange(this)
         }
     init {
         setupOpacitySeekBar()
@@ -253,6 +257,16 @@ class AnnotationAttributeView @JvmOverloads constructor(
     }
 
     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())