|
@@ -3,11 +3,11 @@ package com.kdanmobile.reader.screen.reader.mediabox.common
|
|
import android.content.Context
|
|
import android.content.Context
|
|
import android.graphics.PorterDuff
|
|
import android.graphics.PorterDuff
|
|
import android.os.Build
|
|
import android.os.Build
|
|
-import androidx.constraintlayout.widget.ConstraintLayout
|
|
|
|
-import androidx.core.content.ContextCompat
|
|
|
|
import android.util.AttributeSet
|
|
import android.util.AttributeSet
|
|
import android.view.LayoutInflater
|
|
import android.view.LayoutInflater
|
|
import android.widget.SeekBar
|
|
import android.widget.SeekBar
|
|
|
|
+import androidx.constraintlayout.widget.ConstraintLayout
|
|
|
|
+import androidx.core.content.ContextCompat
|
|
import com.kdanmobile.reader.R
|
|
import com.kdanmobile.reader.R
|
|
import kotlinx.android.synthetic.main.view_media_box_seekbar.view.*
|
|
import kotlinx.android.synthetic.main.view_media_box_seekbar.view.*
|
|
|
|
|
|
@@ -37,7 +37,9 @@ class MediaBoxSeekBar : ConstraintLayout {
|
|
|
|
|
|
var currentValue = 0
|
|
var currentValue = 0
|
|
set(value) {
|
|
set(value) {
|
|
- field = Math.max(Math.min(value, maxValue), minValue)
|
|
|
|
|
|
+ val v = value.coerceIn(minValue, maxValue)
|
|
|
|
+ if (field == v) return
|
|
|
|
+ field = v
|
|
tv_mediaBoxSeekBar_value?.text = "${formatter.format(currentValue)}$unit"
|
|
tv_mediaBoxSeekBar_value?.text = "${formatter.format(currentValue)}$unit"
|
|
seekBar_mediaBoxSeekBar?.progress = field - minValue
|
|
seekBar_mediaBoxSeekBar?.progress = field - minValue
|
|
}
|
|
}
|