diff --git a/app/src/main/java/io/legado/app/constant/Const.kt b/app/src/main/java/io/legado/app/constant/Const.kt index 97e267f85..b3500a2ae 100644 --- a/app/src/main/java/io/legado/app/constant/Const.kt +++ b/app/src/main/java/io/legado/app/constant/Const.kt @@ -21,6 +21,9 @@ val appInfo: AppInfo by lazy { appInfo } +val charsets = + arrayListOf("UTF-8", "GB2312", "GB18030", "GBK", "Unicode", "UTF-16", "UTF-16LE", "ASCII") + data class AppInfo( var versionCode: Long = 0L, var versionName: String = "" diff --git a/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt b/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt index 3f7f2419f..121f4f114 100644 --- a/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt @@ -14,6 +14,7 @@ import io.legado.app.base.VMBaseActivity import io.legado.app.constant.AppConst import io.legado.app.constant.EventBus import io.legado.app.constant.PreferKey +import io.legado.app.constant.charsets import io.legado.app.data.appDb import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter @@ -230,8 +231,6 @@ class CacheActivity : VMBaseActivity() } private fun showCharsetConfig() { - val charsets = - arrayListOf("UTF-8", "GB2312", "GBK", "Unicode", "UTF-16", "UTF-16LE", "ASCII") alert(R.string.set_charset) { val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply { editView.setFilterValues(charsets) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt index a869d016e..8dde10425 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt @@ -11,6 +11,7 @@ import androidx.core.view.isVisible import io.legado.app.R import io.legado.app.base.VMBaseActivity import io.legado.app.constant.PreferKey +import io.legado.app.constant.charsets import io.legado.app.data.appDb import io.legado.app.data.entities.Bookmark import io.legado.app.databinding.ActivityBookReadBinding @@ -222,8 +223,6 @@ abstract class ReadBookBaseActivity : } fun showCharsetConfig() { - val charsets = - arrayListOf("UTF-8", "GB2312", "GBK", "Unicode", "UTF-16", "UTF-16LE", "ASCII") alert(R.string.set_charset) { val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply { editView.setFilterValues(charsets)