From 86dabae7d39315e4c9b3f8ac2df3cfef1ba99316 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 21 Oct 2020 11:44:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/widget/seekbar/VerticalSeekBar.kt | 32 +++---------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/seekbar/VerticalSeekBar.kt b/app/src/main/java/io/legado/app/ui/widget/seekbar/VerticalSeekBar.kt index 8154efa70..736b9eb3a 100644 --- a/app/src/main/java/io/legado/app/ui/widget/seekbar/VerticalSeekBar.kt +++ b/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