优化逻辑

pull/379/head
口口吕 4 years ago
parent a911213c88
commit 48e7d49ae7
  1. 4
      app/src/main/java/io/legado/app/ui/book/explore/ExploreShowAdapter.kt
  2. 17
      app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt
  3. 9
      app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt
  4. 1
      app/src/main/res/values-zh-rHK/strings.xml
  5. 1
      app/src/main/res/values-zh-rTW/strings.xml
  6. 1
      app/src/main/res/values-zh/strings.xml
  7. 1
      app/src/main/res/values/strings.xml

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

@ -42,7 +42,13 @@ class SearchAdapter(context: Context, val callBack: CallBack) :
tv_author.text = context.getString(R.string.author_show, searchBook.author) tv_author.text = context.getString(R.string.author_show, searchBook.author)
bv_originCount.setBadgeCount(searchBook.origins.size) bv_originCount.setBadgeCount(searchBook.origins.size)
upLasted(itemView, searchBook.latestChapterTitle) upLasted(itemView, searchBook.latestChapterTitle)
tv_introduce.text = context.getString(R.string.intro_show, searchBook.intro) if (searchBook.intro.isNullOrEmpty()) {
tv_introduce.text =
context.getString(R.string.intro_show_null)
} else {
tv_introduce.text =
context.getString(R.string.intro_show, searchBook.intro)
}
upKind(itemView, searchBook.getKindList()) upKind(itemView, searchBook.getKindList())
iv_cover.load(searchBook.coverUrl, searchBook.name, searchBook.author) iv_cover.load(searchBook.coverUrl, searchBook.name, searchBook.author)
@ -58,8 +64,15 @@ class SearchAdapter(context: Context, val callBack: CallBack) :
context.getString(R.string.author_show, searchBook.author) context.getString(R.string.author_show, searchBook.author)
"origins" -> bv_originCount.setBadgeCount(searchBook.origins.size) "origins" -> bv_originCount.setBadgeCount(searchBook.origins.size)
"last" -> upLasted(itemView, searchBook.latestChapterTitle) "last" -> upLasted(itemView, searchBook.latestChapterTitle)
"intro" -> tv_introduce.text = "intro" -> {
if (searchBook.intro.isNullOrEmpty()) {
tv_introduce.text =
context.getString(R.string.intro_show_null)
} else {
tv_introduce.text =
context.getString(R.string.intro_show, searchBook.intro) context.getString(R.string.intro_show, searchBook.intro)
}
}
"kind" -> upKind(itemView, searchBook.getKindList()) "kind" -> upKind(itemView, searchBook.getKindList())
"cover" -> iv_cover.load( "cover" -> iv_cover.load(
searchBook.coverUrl, searchBook.coverUrl,

@ -11,10 +11,7 @@ import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.BookSource
import io.legado.app.help.coroutine.Coroutine import io.legado.app.help.coroutine.Coroutine
import io.legado.app.lib.theme.accentColor import io.legado.app.lib.theme.accentColor
import io.legado.app.utils.ACache import io.legado.app.utils.*
import io.legado.app.utils.dp
import io.legado.app.utils.gone
import io.legado.app.utils.visible
import kotlinx.android.synthetic.main.item_fillet_text.view.* import kotlinx.android.synthetic.main.item_fillet_text.view.*
import kotlinx.android.synthetic.main.item_find_book.view.* import kotlinx.android.synthetic.main.item_find_book.view.*
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
@ -55,12 +52,12 @@ class ExploreAdapter(context: Context, private val scope: CoroutineScope, val ca
.inflate(R.layout.item_fillet_text, gl_child, false) .inflate(R.layout.item_fillet_text, gl_child, false)
gl_child.addView(tv) gl_child.addView(tv)
tv.text_view.text = kind.title tv.text_view.text = kind.title
if (!kind.url.isNullOrEmpty()) {
tv.text_view.onClick { tv.text_view.onClick {
kind.url?.let { kindUrl ->
callBack.openExplore( callBack.openExplore(
item.bookSourceUrl, item.bookSourceUrl,
kind.title, kind.title,
kindUrl kind.url.toString()
) )
} }
} }

@ -223,6 +223,7 @@
<string name="load_error_retry">載入失敗,點擊重試</string> <string name="load_error_retry">載入失敗,點擊重試</string>
<string name="book_intro">內容簡介</string> <string name="book_intro">內容簡介</string>
<string name="intro_show">簡介: %s</string> <string name="intro_show">簡介: %s</string>
<string name="intro_show_null">簡介: 暫無簡介</string>
<string name="open_from_other">打開外部書籍</string> <string name="open_from_other">打開外部書籍</string>
<string name="origin_show">來源: %s</string> <string name="origin_show">來源: %s</string>
<string name="import_replace_rule">本地導入</string> <string name="import_replace_rule">本地導入</string>

@ -223,6 +223,7 @@
<string name="load_error_retry">載入失敗,點擊重試</string> <string name="load_error_retry">載入失敗,點擊重試</string>
<string name="book_intro">內容簡介</string> <string name="book_intro">內容簡介</string>
<string name="intro_show">簡介:%s</string> <string name="intro_show">簡介:%s</string>
<string name="intro_show_null">簡介: 暫無簡介</string>
<string name="open_from_other">打開外部書籍</string> <string name="open_from_other">打開外部書籍</string>
<string name="origin_show">來源: %s</string> <string name="origin_show">來源: %s</string>
<string name="import_replace_rule">本機匯入</string> <string name="import_replace_rule">本機匯入</string>

@ -225,6 +225,7 @@
<string name="load_error_retry">加载失败,点击重试</string> <string name="load_error_retry">加载失败,点击重试</string>
<string name="book_intro">内容简介</string> <string name="book_intro">内容简介</string>
<string name="intro_show">简介:%s</string> <string name="intro_show">简介:%s</string>
<string name="intro_show_null">简介: 暂无简介</string>
<string name="open_from_other">打开外部书籍</string> <string name="open_from_other">打开外部书籍</string>
<string name="origin_show">来源: %s</string> <string name="origin_show">来源: %s</string>
<string name="import_replace_rule">本地导入</string> <string name="import_replace_rule">本地导入</string>

@ -225,6 +225,7 @@
<string name="load_error_retry">Load failed, tap to retry</string> <string name="load_error_retry">Load failed, tap to retry</string>
<string name="book_intro">Book description</string> <string name="book_intro">Book description</string>
<string name="intro_show">Description:%s</string> <string name="intro_show">Description:%s</string>
<string name="intro_show_null">Description: no introduction</string>
<string name="open_from_other">Open external book</string> <string name="open_from_other">Open external book</string>
<string name="origin_show">Origin: %s</string> <string name="origin_show">Origin: %s</string>
<string name="import_replace_rule">Import local rules</string> <string name="import_replace_rule">Import local rules</string>

Loading…
Cancel
Save