diff --git a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt index 48c9bc27b..915ea9f5a 100644 --- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt @@ -9,7 +9,6 @@ import io.legado.app.utils.* import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch -import okhttp3.internal.toHexString import java.io.BufferedWriter import java.io.File import java.io.FileWriter @@ -126,9 +125,9 @@ object ReadBookConfig { fun setTextColor(color: Int) { if (App.INSTANCE.isNightTheme) { - textColorNight = "#${color.toHexString()}" + textColorNight = "#${color.hexString}" } else { - textColor = "#${color.toHexString()}" + textColor = "#${color.hexString}" } } diff --git a/app/src/main/java/io/legado/app/utils/IntExtensions.kt b/app/src/main/java/io/legado/app/utils/IntExtensions.kt index 11946c14a..2354a6a78 100644 --- a/app/src/main/java/io/legado/app/utils/IntExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/IntExtensions.kt @@ -10,4 +10,7 @@ val Int.dp: Int val Int.sp: Int get() = android.util.TypedValue.applyDimension( android.util.TypedValue.COMPLEX_UNIT_SP, this.toFloat(), Resources.getSystem().displayMetrics - ).toInt() \ No newline at end of file + ).toInt() + +val Int.hexString: String + get() = Integer.toHexString(this) \ No newline at end of file