diff --git a/app/src/main/java/io/legado/app/ui/widget/anima/RotateLoading.kt b/app/src/main/java/io/legado/app/ui/widget/anima/RotateLoading.kt index 13c4f346d..e587da788 100644 --- a/app/src/main/java/io/legado/app/ui/widget/anima/RotateLoading.kt +++ b/app/src/main/java/io/legado/app/ui/widget/anima/RotateLoading.kt @@ -18,9 +18,13 @@ import io.legado.app.utils.dp * Created by Victor on 2015/4/28. */ @Suppress("MemberVisibilityCanBePrivate") -class RotateLoading : View { +class RotateLoading @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : View(context, attrs, defStyleAttr) { - private lateinit var mPaint: Paint + private var mPaint: Paint private var loadingRectF: RectF? = null private var shadowRectF: RectF? = null @@ -55,19 +59,7 @@ class RotateLoading : View { private val hidden = Runnable { this.stopInternal() } - constructor(context: Context) : super(context) { - initView(context, null) - } - - constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - initView(context, attrs) - } - - constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { - initView(context, attrs) - } - - private fun initView(context: Context, attrs: AttributeSet?) { + init { loadingColor = context.accentColor thisWidth = DEFAULT_WIDTH.dp shadowPosition = DEFAULT_SHADOW_POSITION.dp diff --git a/app/src/main/java/io/legado/app/ui/widget/dynamiclayout/DynamicFrameLayout.kt b/app/src/main/java/io/legado/app/ui/widget/dynamiclayout/DynamicFrameLayout.kt index 683cbc5d9..d3115bdc9 100644 --- a/app/src/main/java/io/legado/app/ui/widget/dynamiclayout/DynamicFrameLayout.kt +++ b/app/src/main/java/io/legado/app/ui/widget/dynamiclayout/DynamicFrameLayout.kt @@ -13,7 +13,10 @@ import io.legado.app.R import kotlinx.android.synthetic.main.view_dynamic.view.* @Suppress("unused") -class DynamicFrameLayout(context: Context, attrs: AttributeSet?) : FrameLayout(context, attrs), ViewSwitcher { +class DynamicFrameLayout @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null +) : FrameLayout(context, attrs), ViewSwitcher { private var errorView: View? = null private var errorImage: AppCompatImageView? = null diff --git a/app/src/main/java/io/legado/app/ui/widget/image/CircleImageView.kt b/app/src/main/java/io/legado/app/ui/widget/image/CircleImageView.kt index 2364deab7..f5781183e 100644 --- a/app/src/main/java/io/legado/app/ui/widget/image/CircleImageView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/image/CircleImageView.kt @@ -25,8 +25,10 @@ import kotlin.math.min import kotlin.math.pow @Suppress("unused", "MemberVisibilityCanBePrivate") -class CircleImageView(context: Context, attrs: AttributeSet) : - AppCompatImageView(context, attrs) { +class CircleImageView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null +) : AppCompatImageView(context, attrs) { private val mDrawableRect = RectF() private val mBorderRect = RectF()