pull/436/head
gedoor 4 years ago
parent 2a19fe8e35
commit 86dabae7d3
  1. 32
      app/src/main/java/io/legado/app/ui/widget/seekbar/VerticalSeekBar.kt

@ -17,7 +17,8 @@ import java.lang.reflect.InvocationTargetException
import java.lang.reflect.Method
@Suppress("SameParameterValue")
class VerticalSeekBar : AppCompatSeekBar {
class VerticalSeekBar @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
AppCompatSeekBar(context, attrs) {
private var mIsDragging: Boolean = false
private var mThumb: Drawable? = null
@ -54,37 +55,12 @@ class VerticalSeekBar : AppCompatSeekBar {
}
}
constructor(context: Context) : super(context) {
initialize(context, null, 0)
}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
initialize(context, attrs, 0)
}
constructor(
context: Context,
attrs: AttributeSet,
defStyle: Int
) : super(context, attrs, defStyle) {
initialize(context, attrs, defStyle)
}
private fun initialize(
context: Context,
attrs: AttributeSet?,
defStyleAttr: Int
) {
init {
ATH.setTint(this, ThemeStore.accentColor(context))
ViewCompat.setLayoutDirection(this, ViewCompat.LAYOUT_DIRECTION_LTR)
if (attrs != null) {
val a = context.obtainStyledAttributes(
attrs,
R.styleable.VerticalSeekBar,
defStyleAttr,
0
)
val a = context.obtainStyledAttributes(attrs, R.styleable.VerticalSeekBar)
val rotationAngle = a.getInteger(R.styleable.VerticalSeekBar_seekBarRotation, 0)
if (isValidRotationAngle(rotationAngle)) {
mRotationAngle = rotationAngle

Loading…
Cancel
Save