|
@@ -12,6 +12,7 @@ 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.*
|
|
@@ -27,18 +28,6 @@ class AnnotationAttributeView @JvmOverloads constructor(
|
|
|
const val DEFAULT_THICKNESS = 5
|
|
|
}
|
|
|
|
|
|
- private enum class Color(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),
|
|
|
- }
|
|
|
|
|
|
init {
|
|
|
inflate(context, R.layout.view_reader_annotation_property, this)
|
|
@@ -67,17 +56,17 @@ class AnnotationAttributeView @JvmOverloads constructor(
|
|
|
update()
|
|
|
}
|
|
|
var onChangeListener: OnChangeListener? = null
|
|
|
- private val colorBtnMap = HashMap<Color, ImageView>().apply {
|
|
|
- put(Color.Color1, iv_readerAnnotationProperty_color1)
|
|
|
- put(Color.Color2, iv_readerAnnotationProperty_color2)
|
|
|
- put(Color.Color3, iv_readerAnnotationProperty_color3)
|
|
|
- put(Color.Color4, iv_readerAnnotationProperty_color4)
|
|
|
- put(Color.Color5, iv_readerAnnotationProperty_color5)
|
|
|
- put(Color.Color6, iv_readerAnnotationProperty_color6)
|
|
|
- put(Color.Color7, iv_readerAnnotationProperty_color7)
|
|
|
- put(Color.Color8, iv_readerAnnotationProperty_color8)
|
|
|
- put(Color.Color9, iv_readerAnnotationProperty_color9)
|
|
|
- put(Color.Color10, iv_readerAnnotationProperty_color10)
|
|
|
+ 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) {
|
|
@@ -104,7 +93,7 @@ class AnnotationAttributeView @JvmOverloads constructor(
|
|
|
return context.resources.getColor(colorEnum.colorResId)
|
|
|
}
|
|
|
set(value) {
|
|
|
- Color.values().forEach {
|
|
|
+ AnnotationColor.values().forEach {
|
|
|
val c = context.resources.getColor(it.colorResId)
|
|
|
if (c == value) {
|
|
|
colorEnum = it
|
|
@@ -112,7 +101,7 @@ class AnnotationAttributeView @JvmOverloads constructor(
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- private var colorEnum: Color = Color.Color1
|
|
|
+ private var colorEnum: AnnotationColor = AnnotationColor.Color1
|
|
|
set(value) {
|
|
|
field = value
|
|
|
updateColor()
|