修复简介多了几个空格的问题,是因为格式话做了缩进

pull/1090/head
gedoor 3 years ago
parent 029be1d6a8
commit 4e4b700c41
  1. 11
      app/src/main/java/io/legado/app/data/entities/SearchBook.kt
  2. 6
      app/src/main/java/io/legado/app/ui/book/explore/ExploreShowAdapter.kt
  3. 18
      app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt

@ -1,7 +1,9 @@
package io.legado.app.data.entities
import android.content.Context
import android.os.Parcelable
import androidx.room.*
import io.legado.app.R
import io.legado.app.utils.GSON
import io.legado.app.utils.fromJsonObject
import kotlinx.parcelize.IgnoredOnParcel
@ -84,6 +86,15 @@ data class SearchBook(
return "无最新章节"
}
fun trimIntro(context: Context): String {
val trimIntro = intro?.trim()
return if (trimIntro.isNullOrEmpty()) {
context.getString(R.string.intro_show_null)
} else {
context.getString(R.string.intro_show, trimIntro)
}
}
fun toBook() = Book(
name = name,
author = author,

@ -34,11 +34,7 @@ class ExploreShowAdapter(context: Context, val callBack: CallBack) :
tvLasted.text = context.getString(R.string.lasted_show, item.latestChapterTitle)
tvLasted.visible()
}
if (item.intro.isNullOrEmpty()) {
tvIntroduce.text = context.getString(R.string.intro_show_null)
} else {
tvIntroduce.text = context.getString(R.string.intro_show, item.intro)
}
tvIntroduce.text = item.trimIntro(context)
val kinds = item.getKindList()
if (kinds.isEmpty()) {
llKind.gone()

@ -79,13 +79,7 @@ class SearchAdapter(context: Context, val callBack: CallBack) :
tvAuthor.text = context.getString(R.string.author_show, searchBook.author)
bvOriginCount.setBadgeCount(searchBook.origins.size)
upLasted(binding, searchBook.latestChapterTitle)
if (searchBook.intro.isNullOrEmpty()) {
tvIntroduce.text =
context.getString(R.string.intro_show_null)
} else {
tvIntroduce.text =
context.getString(R.string.intro_show, searchBook.intro)
}
tvIntroduce.text = searchBook.trimIntro(context)
upKind(binding, searchBook.getKindList())
ivCover.load(searchBook.coverUrl, searchBook.name, searchBook.author)
@ -98,15 +92,7 @@ class SearchAdapter(context: Context, val callBack: CallBack) :
when (it) {
"origins" -> bvOriginCount.setBadgeCount(searchBook.origins.size)
"last" -> upLasted(binding, searchBook.latestChapterTitle)
"intro" -> {
if (searchBook.intro.isNullOrEmpty()) {
tvIntroduce.text =
context.getString(R.string.intro_show_null)
} else {
tvIntroduce.text =
context.getString(R.string.intro_show, searchBook.intro)
}
}
"intro" -> tvIntroduce.text = searchBook.trimIntro(context)
"kind" -> upKind(binding, searchBook.getKindList())
"cover" -> ivCover.load(
searchBook.coverUrl,

Loading…
Cancel
Save