Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
821938089 committed Aug 15, 2024
1 parent 35f5168 commit bcd6837
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
3 changes: 2 additions & 1 deletion app/src/main/java/io/legado/app/data/entities/BookGroup.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/legado/app/model/ImageProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion app/src/main/java/io/legado/app/ui/widget/dialog/TextDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit bcd6837

Please sign in to comment.