pull/32/head
kunfei 5 years ago
parent 61a7a2dc3d
commit 093beaae86
  1. 8
      app/src/main/java/io/legado/app/ui/bookinfo/BookInfoActivity.kt
  2. 2
      app/src/main/java/io/legado/app/ui/bookinfo/BookInfoViewModel.kt
  3. 2
      app/src/main/java/io/legado/app/ui/search/SearchAdapter.kt
  4. 22
      app/src/main/res/layout/activity_book_info.xml
  5. 4
      app/src/main/res/layout/item_bookshelf_list.xml
  6. 5
      app/src/main/res/values/strings.xml

@ -22,10 +22,10 @@ class BookInfoActivity : VMBaseActivity<BookInfoViewModel>(R.layout.activity_boo
private fun showBook(book: Book) { private fun showBook(book: Book) {
tv_name.text = book.name tv_name.text = book.name
tv_author.text = book.author tv_author.text = getString(R.string.author_show, book.author)
tv_origin.text = book.originName tv_origin.text = getString(R.string.origin_show, book.originName)
tv_lasted.text = book.latestChapterTitle tv_lasted.text = getString(R.string.lasted_show, book.latestChapterTitle)
tv_intro.text = book.getDisplayIntro() tv_intro.text = getString(R.string.intro_show, book.getDisplayIntro())
book.getDisplayCover()?.let { book.getDisplayCover()?.let {
ImageLoader.load(this, it) ImageLoader.load(this, it)
.placeholder(R.drawable.img_cover_default) .placeholder(R.drawable.img_cover_default)

@ -10,11 +10,13 @@ import io.legado.app.data.entities.Book
class BookInfoViewModel(application: Application) : BaseViewModel(application) { class BookInfoViewModel(application: Application) : BaseViewModel(application) {
val bookData = MutableLiveData<Book>() val bookData = MutableLiveData<Book>()
var inBookshelf = false
fun loadData(intent: Intent) { fun loadData(intent: Intent) {
execute { execute {
intent.getStringExtra("bookUrl")?.let { intent.getStringExtra("bookUrl")?.let {
App.db.bookDao().getBook(it)?.let { book -> App.db.bookDao().getBook(it)?.let { book ->
inBookshelf = true
bookData.postValue(book) bookData.postValue(book)
} }
} ?: intent.getStringExtra("searchBookUrl")?.let { } ?: intent.getStringExtra("searchBookUrl")?.let {

@ -54,7 +54,7 @@ class SearchAdapter : PagedListAdapter<SearchShow, SearchAdapter.MyViewHolder>(D
if (searchBook.latestChapterTitle.isNullOrEmpty()) { if (searchBook.latestChapterTitle.isNullOrEmpty()) {
tv_lasted.gone() tv_lasted.gone()
} else { } else {
tv_lasted.text = context.getString(R.string.book_search_last, searchBook.latestChapterTitle) tv_lasted.text = context.getString(R.string.lasted_show, searchBook.latestChapterTitle)
tv_lasted.visible() tv_lasted.visible()
} }
tv_introduce.text = searchBook.intro tv_introduce.text = searchBook.intro

@ -36,29 +36,29 @@
<TextView <TextView
android:id="@+id/tv_name" android:id="@+id/tv_name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_weight="1"
android:singleLine="true" /> android:singleLine="true" />
<TextView <TextView
android:id="@+id/tv_author" android:id="@+id/tv_author"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_weight="1"
android:singleLine="true" /> android:singleLine="true" />
<TextView <TextView
android:id="@+id/tv_origin" android:id="@+id/tv_origin"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:singleLine="true" android:layout_weight="1"
app:layout_constraintTop_toBottomOf="@+id/tv_author" android:singleLine="true" />
app:layout_constraintLeft_toLeftOf="@+id/tv_name"
app:layout_constraintRight_toRightOf="@id/tv_name"
app:layout_constraintBottom_toTopOf="@id/tv_lasted" />
<LinearLayout <LinearLayout
android:id="@+id/ll_kind" android:id="@+id/ll_kind"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"> android:orientation="horizontal">
<io.legado.app.lib.theme.view.ATEAccentBgTextView <io.legado.app.lib.theme.view.ATEAccentBgTextView
@ -99,7 +99,9 @@
<TextView <TextView
android:id="@+id/tv_lasted" android:id="@+id/tv_lasted"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="0dp"
android:layout_weight="1"
android:singleLine="true"
app:layout_constraintLeft_toLeftOf="@+id/tv_name" app:layout_constraintLeft_toLeftOf="@+id/tv_name"
app:layout_constraintRight_toRightOf="@id/tv_name" app:layout_constraintRight_toRightOf="@id/tv_name"
app:layout_constraintBottom_toBottomOf="@+id/iv_cover" /> app:layout_constraintBottom_toBottomOf="@+id/iv_cover" />

@ -134,7 +134,7 @@
android:layout_width="@dimen/desc_icon_size" android:layout_width="@dimen/desc_icon_size"
android:layout_height="@dimen/desc_icon_size" android:layout_height="@dimen/desc_icon_size"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:contentDescription="@string/book_search_last" android:contentDescription="@string/lasted_show"
android:paddingStart="2dp" android:paddingStart="2dp"
android:paddingEnd="2dp" android:paddingEnd="2dp"
android:src="@drawable/ic_book_last" android:src="@drawable/ic_book_last"
@ -150,7 +150,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:singleLine="true" android:singleLine="true"
android:text="@string/book_search_last" android:text="@string/lasted_show"
android:textColor="@color/tv_text_secondary" android:textColor="@color/tv_text_secondary"
android:textSize="13sp" android:textSize="13sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"

@ -65,7 +65,7 @@
<string name="origin_format">来源: %s</string> <string name="origin_format">来源: %s</string>
<string name="read_dur_progress">最近: %s</string> <string name="read_dur_progress">最近: %s</string>
<string name="book_name">书名</string> <string name="book_name">书名</string>
<string name="book_search_last">最新: %s</string> <string name="lasted_show">最新: %s</string>
<string name="check_add_bookshelf">是否将《%s》放入书架?</string> <string name="check_add_bookshelf">是否将《%s》放入书架?</string>
<string name="import_books_count">共%s个Text文件</string> <string name="import_books_count">共%s个Text文件</string>
<string name="is_loading">加载中…</string> <string name="is_loading">加载中…</string>
@ -197,8 +197,9 @@
<string name="data_loading">加载数据中…</string> <string name="data_loading">加载数据中…</string>
<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="open_from_other">打开外部书籍</string> <string name="open_from_other">打开外部书籍</string>
<string name="origin">来源</string> <string name="origin_show">来源:%s</string>
<string name="import_replace_rule">本地导入</string> <string name="import_replace_rule">本地导入</string>
<string name="import_replace_rule_on_line">网络导入</string> <string name="import_replace_rule_on_line">网络导入</string>
<string name="bookshelf_px">书架排序</string> <string name="bookshelf_px">书架排序</string>

Loading…
Cancel
Save