mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -9,12 +9,13 @@ import io.legado.app.R
|
||||
import io.legado.app.help.config.AppConfig
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Suppress("ConstPropertyName")
|
||||
@Parcelize
|
||||
@Entity(tableName = "book_groups")
|
||||
data class BookGroup(
|
||||
@PrimaryKey
|
||||
val groupId: Long = 0b1,
|
||||
var groupName: String,
|
||||
var groupName: String = "",
|
||||
var cover: String? = null,
|
||||
var order: Int = 0,
|
||||
@ColumnInfo(defaultValue = "1")
|
||||
|
||||
@@ -40,7 +40,7 @@ object ImageProvider {
|
||||
private const val M = 1024 * 1024
|
||||
val cacheSize: Int
|
||||
get() {
|
||||
if (AppConfig.bitmapCacheSize <= 0) {
|
||||
if (AppConfig.bitmapCacheSize <= 0 || AppConfig.bitmapCacheSize >= 2048) {
|
||||
AppConfig.bitmapCacheSize = 50
|
||||
}
|
||||
return AppConfig.bitmapCacheSize * M
|
||||
|
||||
@@ -305,6 +305,7 @@ class ChangeBookSourceDialog() : BaseDialogFragment(R.layout.dialog_book_change_
|
||||
|
||||
override fun changeTo(searchBook: SearchBook) {
|
||||
val oldBookType = callBack?.oldBook?.type?.and(BookType.updateError.inv())
|
||||
?.and(BookType.notShelf.inv())
|
||||
if (searchBook.type == oldBookType) {
|
||||
changeSource(searchBook) {
|
||||
dismissAllowingStateLoss()
|
||||
|
||||
@@ -124,7 +124,7 @@ class OtherConfigFragment : PreferenceFragment(),
|
||||
PreferKey.bitmapCacheSize -> {
|
||||
NumberPickerDialog(requireContext())
|
||||
.setTitle(getString(R.string.bitmap_cache_size))
|
||||
.setMaxValue(9999)
|
||||
.setMaxValue(2047)
|
||||
.setMinValue(1)
|
||||
.setValue(AppConfig.bitmapCacheSize)
|
||||
.show {
|
||||
|
||||
@@ -23,7 +23,6 @@ import io.legado.app.ui.file.HandleFileContract
|
||||
import io.legado.app.ui.login.SourceLoginActivity
|
||||
import io.legado.app.ui.qrcode.QrCodeResult
|
||||
import io.legado.app.ui.rss.source.debug.RssSourceDebugActivity
|
||||
import io.legado.app.ui.widget.dialog.TextDialog
|
||||
import io.legado.app.ui.widget.dialog.UrlOptionDialog
|
||||
import io.legado.app.ui.widget.dialog.VariableDialog
|
||||
import io.legado.app.ui.widget.keyboard.KeyboardToolPop
|
||||
|
||||
@@ -77,7 +77,15 @@ class TextDialog() : BaseDialogFragment(R.layout.dialog_text_view) {
|
||||
}
|
||||
|
||||
Mode.HTML.name -> binding.textView.setHtml(content)
|
||||
else -> binding.textView.text = content
|
||||
else -> {
|
||||
if (content.length >= 32 * 1024) {
|
||||
val truncatedContent =
|
||||
content.substring(0, 32 * 1024) + "\n\n数据太大,无法全部显示…"
|
||||
binding.textView.text = truncatedContent
|
||||
} else {
|
||||
binding.textView.text = content
|
||||
}
|
||||
}
|
||||
}
|
||||
time = it.getLong("time", 0L)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user