|
@@ -1,7 +1,10 @@
|
|
|
package com.kdanmobile.reader.annotationattribute
|
|
|
|
|
|
import android.content.Context
|
|
|
+import android.graphics.PorterDuff
|
|
|
+import android.os.Build
|
|
|
import android.support.constraint.ConstraintLayout
|
|
|
+import android.support.v4.content.ContextCompat
|
|
|
import android.util.AttributeSet
|
|
|
import android.view.LayoutInflater
|
|
|
import android.widget.SeekBar
|
|
@@ -33,6 +36,10 @@ class AnnotationAttributeWindowSeekBar : ConstraintLayout {
|
|
|
override fun setEnabled(enabled: Boolean) {
|
|
|
super.setEnabled(enabled)
|
|
|
seekBar?.isEnabled = enabled
|
|
|
+
|
|
|
+ if (enabled) {
|
|
|
+ setSeekBarThumbColor(seekBar, ContextCompat.getColor(context, R.color.reader_annotation_attribute_seek_bar_thumb_tint))
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private var onSeekBarChangeListener: SeekBar.OnSeekBarChangeListener? = null
|
|
@@ -84,5 +91,15 @@ class AnnotationAttributeWindowSeekBar : ConstraintLayout {
|
|
|
}
|
|
|
})
|
|
|
this.progress = progress
|
|
|
+
|
|
|
+ setSeekBarThumbColor(seekBar, ContextCompat.getColor(context, R.color.reader_annotation_attribute_seek_bar_thumb_tint))
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun setSeekBarThumbColor(seekBar: SeekBar?, color: Int) {
|
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
|
+ seekBar?.thumb?.setTint(color)
|
|
|
+ } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
|
|
+ seekBar?.thumb?.setColorFilter(color, PorterDuff.Mode.SRC_ATOP)
|
|
|
+ }
|
|
|
}
|
|
|
}
|