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 ba416c992..cbff84976 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 @@ -332,11 +332,11 @@ object TintHelper { compatSwitch: Boolean, useDarker: Boolean ): Drawable? { - var tint = tint + var tint1 = tint if (useDarker) { - tint = ColorUtils.shiftColor(tint, 1.1f) + tint1 = ColorUtils.shiftColor(tint1, 1.1f) } - tint = ColorUtils.adjustAlpha(tint, if (compatSwitch && !thumb) 0.5f else 1.0f) + tint1 = ColorUtils.adjustAlpha(tint1, if (compatSwitch && !thumb) 0.5f else 1.0f) val disabled: Int var normal: Int if (thumb) { @@ -375,7 +375,7 @@ object TintHelper { intArrayOf(android.R.attr.state_enabled, android.R.attr.state_activated), intArrayOf(android.R.attr.state_enabled, android.R.attr.state_checked) ), - intArrayOf(disabled, normal, tint, tint) + intArrayOf(disabled, normal, tint1, tint1) ) return createTintedDrawable(from, sl) } @@ -414,20 +414,20 @@ object TintHelper { // This returns a NEW Drawable because of the mutate() call. The mutate() call is necessary because Drawables with the same resource have shared states otherwise. @CheckResult fun createTintedDrawable(drawable: Drawable?, @ColorInt color: Int): Drawable? { - var drawable: Drawable? = drawable ?: return null - drawable = DrawableCompat.wrap(drawable!!.mutate()) - DrawableCompat.setTintMode(drawable!!, PorterDuff.Mode.SRC_IN) - DrawableCompat.setTint(drawable, color) - return drawable + var drawable1: Drawable? = drawable ?: return null + drawable1 = DrawableCompat.wrap(drawable1!!.mutate()) + DrawableCompat.setTintMode(drawable1!!, PorterDuff.Mode.SRC_IN) + DrawableCompat.setTint(drawable1, color) + return drawable1 } // This returns a NEW Drawable because of the mutate() call. The mutate() call is necessary because Drawables with the same resource have shared states otherwise. @CheckResult fun createTintedDrawable(drawable: Drawable?, sl: ColorStateList): Drawable? { - var drawable: Drawable? = drawable ?: return null - drawable = DrawableCompat.wrap(drawable!!.mutate()) - DrawableCompat.setTintList(drawable!!, sl) - return drawable + var drawable1: Drawable? = drawable ?: return null + drawable1 = DrawableCompat.wrap(drawable1!!.mutate()) + DrawableCompat.setTintList(drawable1!!, sl) + return drawable1 } fun setCursorTint(editText: EditText, @ColorInt color: Int) { diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt index 95487bfe6..075c72aca 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt @@ -14,6 +14,7 @@ import kotlinx.coroutines.Deferred import okhttp3.FormBody import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.RequestBody +import okhttp3.RequestBody.Companion.toRequestBody import retrofit2.Response import java.net.URLEncoder import java.util.* @@ -148,7 +149,7 @@ class AnalyzeUrl( Method.POST -> { bodyTxt?.let { if (it.isJson()) { - body = RequestBody.create(jsonType, it) + body = it.toRequestBody(jsonType) } else { analyzeFields(it) }