diff --git a/app/src/main/java/io/legado/app/lib/theme/TintHelper.kt b/app/src/main/java/io/legado/app/lib/theme/TintHelper.kt index 0ab6fcfc4..ba416c992 100644 --- a/app/src/main/java/io/legado/app/lib/theme/TintHelper.kt +++ b/app/src/main/java/io/legado/app/lib/theme/TintHelper.kt @@ -326,7 +326,8 @@ object TintHelper { private fun modifySwitchDrawable( context: Context, - from: Drawable, @ColorInt tint: Int, + from: Drawable, + @ColorInt tint: Int, thumb: Boolean, compatSwitch: Boolean, useDarker: Boolean diff --git a/app/src/main/java/io/legado/app/lib/theme/prefs/IconListPreference.kt b/app/src/main/java/io/legado/app/lib/theme/prefs/IconListPreference.kt index f1389a989..d78849b3e 100644 --- a/app/src/main/java/io/legado/app/lib/theme/prefs/IconListPreference.kt +++ b/app/src/main/java/io/legado/app/lib/theme/prefs/IconListPreference.kt @@ -36,6 +36,7 @@ class IconListPreference(context: Context, attrs: AttributeSet) : ListPreference for (drawable in drawables) { val resId = context.resources.getIdentifier(drawable.toString(), "mipmap", context.packageName) + @Suppress("DEPRECATION") val d = context.resources.getDrawable(resId) mEntryDrawables.add(d) diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATEAccentBgTextView.kt b/app/src/main/java/io/legado/app/lib/theme/view/ATEAccentBgTextView.kt index fbc849d6c..6de1037b9 100644 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATEAccentBgTextView.kt +++ b/app/src/main/java/io/legado/app/lib/theme/view/ATEAccentBgTextView.kt @@ -11,18 +11,18 @@ import io.legado.app.utils.dp class ATEAccentBgTextView : AppCompatTextView { constructor(context: Context) : super(context) { - init(context, null) + init(context) } constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - init(context, attrs) + init(context) } constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { - init(context, attrs) + init(context) } - private fun init(context: Context, attrs: AttributeSet?) { + private fun init(context: Context) { background = Selector.shapeBuild() .setCornerRadius(3.dp) .setDefaultBgColor(ThemeStore.accentColor(context)) diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATEAccentStrokeTextView.kt b/app/src/main/java/io/legado/app/lib/theme/view/ATEAccentStrokeTextView.kt index def0146f3..c6aea80f0 100644 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATEAccentStrokeTextView.kt +++ b/app/src/main/java/io/legado/app/lib/theme/view/ATEAccentStrokeTextView.kt @@ -10,18 +10,19 @@ import io.legado.app.utils.dp class ATEAccentStrokeTextView : AppCompatTextView { constructor(context: Context) : super(context) { - init(context, null) + init(context) } constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - init(context, attrs) + init(context) } constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { - init(context, attrs) + init(context) } - private fun init(context: Context, attrs: AttributeSet?) { + @Suppress("DEPRECATION") + private fun init(context: Context) { background = Selector.shapeBuild() .setCornerRadius(3.dp) .setStrokeWidth(1.dp) diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATECheckBox.kt b/app/src/main/java/io/legado/app/lib/theme/view/ATECheckBox.kt index 15e3b5f14..643299f35 100644 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATECheckBox.kt +++ b/app/src/main/java/io/legado/app/lib/theme/view/ATECheckBox.kt @@ -12,18 +12,18 @@ import io.legado.app.lib.theme.ThemeStore class ATECheckBox : AppCompatCheckBox { constructor(context: Context) : super(context) { - init(context, null) + init(context) } constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - init(context, attrs) + init(context) } constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { - init(context, attrs) + init(context) } - private fun init(context: Context, attrs: AttributeSet?) { + private fun init(context: Context) { ATH.setTint(this, ThemeStore.accentColor(context)) } } diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATEPrimaryTextView.kt b/app/src/main/java/io/legado/app/lib/theme/view/ATEPrimaryTextView.kt index b39385688..97d4d08b1 100644 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATEPrimaryTextView.kt +++ b/app/src/main/java/io/legado/app/lib/theme/view/ATEPrimaryTextView.kt @@ -11,18 +11,18 @@ import io.legado.app.lib.theme.ThemeStore class ATEPrimaryTextView : AppCompatTextView { constructor(context: Context) : super(context) { - init(context, null) + init(context) } constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - init(context, attrs) + init(context) } constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { - init(context, attrs) + init(context) } - private fun init(context: Context, attrs: AttributeSet?) { + private fun init(context: Context) { setTextColor(ThemeStore.textColorPrimary(context)) } } diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATERadioButton.kt b/app/src/main/java/io/legado/app/lib/theme/view/ATERadioButton.kt index 583d5e054..8af025c2f 100644 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATERadioButton.kt +++ b/app/src/main/java/io/legado/app/lib/theme/view/ATERadioButton.kt @@ -4,7 +4,7 @@ import android.content.Context import android.util.AttributeSet import androidx.appcompat.widget.AppCompatRadioButton import io.legado.app.lib.theme.ATH -import io.legado.app.lib.theme.ThemeStore +import io.legado.app.lib.theme.accentColor /** * @author Aidan Follestad (afollestad) @@ -12,18 +12,18 @@ import io.legado.app.lib.theme.ThemeStore class ATERadioButton : AppCompatRadioButton { constructor(context: Context) : super(context) { - init(context, null) + init(context) } constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - init(context, attrs) + init(context) } constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { - init(context, attrs) + init(context) } - private fun init(context: Context, attrs: AttributeSet?) { - ATH.setTint(this, ThemeStore.accentColor(context)) + private fun init(context: Context) { + ATH.setTint(this@ATERadioButton, context.accentColor) } } diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATESecondaryTextView.kt b/app/src/main/java/io/legado/app/lib/theme/view/ATESecondaryTextView.kt index dec5d938e..f84814b90 100644 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATESecondaryTextView.kt +++ b/app/src/main/java/io/legado/app/lib/theme/view/ATESecondaryTextView.kt @@ -11,18 +11,18 @@ import io.legado.app.lib.theme.ThemeStore class ATESecondaryTextView : AppCompatTextView { constructor(context: Context) : super(context) { - init(context, null) + init(context) } constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - init(context, attrs) + init(context) } constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { - init(context, attrs) + init(context) } - private fun init(context: Context, attrs: AttributeSet?) { + private fun init(context: Context) { setTextColor(ThemeStore.textColorSecondary(context)) } }