新增漫画阅读模式[条漫、日漫等]
新增条漫侧边留白功能 更新滤镜功能,现在支持亮度跟随系统 其他界面更新
This commit is contained in:
1 parent
c35177715c
commit
1701285d33
24 files changed
+585
-277
No files matched your search
@@ -44,6 +44,12 @@ class DetailSeekBar @JvmOverloads constructor(
|
||||
binding.slider.valueTo = value.toFloat()
|
||||
}
|
||||
|
||||
var min: Int
|
||||
get() = binding.slider.valueFrom.toInt()
|
||||
set(value) {
|
||||
binding.slider.valueFrom = value.toFloat()
|
||||
}
|
||||
|
||||
init {
|
||||
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.DetailSeekBar)
|
||||
isBottomBackground =
|
||||
@@ -57,17 +63,6 @@ class DetailSeekBar @JvmOverloads constructor(
|
||||
|
||||
binding.slider.valueTo = typedArray.getInteger(R.styleable.DetailSeekBar_max, 0).toFloat()
|
||||
typedArray.recycle()
|
||||
binding.ivSeekPlus.setOnClickListener {
|
||||
val newValue = (binding.slider.value + 1).coerceAtMost(binding.slider.valueTo)
|
||||
binding.slider.value = newValue
|
||||
onChanged?.invoke(newValue.toInt())
|
||||
}
|
||||
|
||||
binding.ivSeekReduce.setOnClickListener {
|
||||
val newValue = (binding.slider.value - 1).coerceAtLeast(binding.slider.valueFrom)
|
||||
binding.slider.value = newValue
|
||||
onChanged?.invoke(newValue.toInt())
|
||||
}
|
||||
|
||||
binding.slider.addOnChangeListener { _, value, fromUser ->
|
||||
upValue(value.toInt())
|
||||
|
||||
@@ -23,6 +23,7 @@ class SimpleCounterView @JvmOverloads constructor(
|
||||
|
||||
private var _progress = 0
|
||||
private var _max = 100
|
||||
private var _min = 0
|
||||
private val isBottomBackground: Boolean
|
||||
|
||||
var valueFormat: ((Int) -> String)? = null
|
||||
@@ -39,7 +40,7 @@ class SimpleCounterView @JvmOverloads constructor(
|
||||
var progress: Int
|
||||
get() = _progress
|
||||
set(value) {
|
||||
_progress = value.coerceIn(0, _max)
|
||||
_progress = value.coerceIn(_min, _max)
|
||||
updateValue()
|
||||
}
|
||||
|
||||
@@ -51,11 +52,22 @@ class SimpleCounterView @JvmOverloads constructor(
|
||||
updateValue()
|
||||
}
|
||||
|
||||
var min: Int
|
||||
get() = _min
|
||||
set(value) {
|
||||
_min = value
|
||||
_progress = _progress.coerceAtLeast(_min)
|
||||
updateValue()
|
||||
}
|
||||
|
||||
init {
|
||||
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.DetailSeekBar)
|
||||
isBottomBackground = typedArray.getBoolean(R.styleable.DetailSeekBar_isBottomBackground, false)
|
||||
val title = typedArray.getText(R.styleable.DetailSeekBar_title)
|
||||
_max = typedArray.getInt(R.styleable.DetailSeekBar_max, 100)
|
||||
_min = typedArray.getInt(R.styleable.DetailSeekBar_min, 0)
|
||||
_progress = _progress.coerceIn(_min, _max)
|
||||
|
||||
typedArray.recycle()
|
||||
|
||||
binding.tvSeekTitle.text = title
|
||||
@@ -70,7 +82,7 @@ class SimpleCounterView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
binding.ivSeekReduce.setOnClickListener {
|
||||
if (_progress > 0) {
|
||||
if (_progress > _min) {
|
||||
_progress--
|
||||
updateValue()
|
||||
onChanged?.invoke(_progress)
|
||||
@@ -119,6 +131,7 @@ class SimpleCounterView @JvmOverloads constructor(
|
||||
customView {
|
||||
val detailSeekBar = DetailSeekBar(ctx).apply {
|
||||
max = _max
|
||||
min = _min
|
||||
progress = _progress
|
||||
valueFormat = this@SimpleCounterView.valueFormat
|
||||
setTitle(binding.tvSeekTitle.text)
|
||||
@@ -168,7 +181,7 @@ class SimpleCounterView @JvmOverloads constructor(
|
||||
|
||||
private val decrementRunnable = object : Runnable {
|
||||
override fun run() {
|
||||
if (_progress > 0) {
|
||||
if (_progress > _min) {
|
||||
_progress--
|
||||
updateValue()
|
||||
onChanged?.invoke(_progress)
|
||||
|
||||
Reference in new issue
Block a user