From 3c2e0f53de61ce0f4b4f00fc77f4afe3c5764af1 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 3 Feb 2020 18:56:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/info/BookInfoActivity.kt | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt index 0c1713246..9a829baa8 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt @@ -112,23 +112,13 @@ class BookInfoActivity : } private fun showBook(book: Book) { + showCover(book) tv_name.text = book.name tv_author.text = getString(R.string.author_show, book.author) tv_origin.text = getString(R.string.origin_show, book.originName) tv_lasted.text = getString(R.string.lasted_show, book.latestChapterTitle) tv_toc.text = getString(R.string.toc_s, book.latestChapterTitle) tv_intro.text = book.getDisplayIntro() - book.getDisplayCover()?.let { - ImageLoader.load(this, it) - .centerCrop() - .into(iv_cover) - ImageLoader.load(this, it) - .transition(DrawableTransitionOptions.withCrossFade(1500)) - .thumbnail(defaultCover()) - .centerCrop() - .apply(bitmapTransform(BlurTransformation(this, 25))) - .into(bg_book) //模糊、渐变、缩小效果 - } val kinds = book.getKindList() if (kinds.isEmpty()) { ll_kind.gone() @@ -161,6 +151,20 @@ class BookInfoActivity : } } + private fun showCover(book: Book) { + book.getDisplayCover()?.let { + ImageLoader.load(this, it) + .centerCrop() + .into(iv_cover) + ImageLoader.load(this, it) + .transition(DrawableTransitionOptions.withCrossFade(1500)) + .thumbnail(defaultCover()) + .centerCrop() + .apply(bitmapTransform(BlurTransformation(this, 25))) + .into(bg_book) //模糊、渐变、缩小效果 + } + } + private fun showChapter(chapterList: List) { viewModel.bookData.value?.let { if (it.durChapterIndex < chapterList.size) { @@ -285,6 +289,7 @@ class BookInfoActivity : viewModel.bookData.value?.let { it.coverUrl = coverUrl viewModel.saveBook() + showCover(it) } }