From 6ed9cdc3ffb0a91cc9047bb34633c1b1f402d60a Mon Sep 17 00:00:00 2001 From: Administrator Date: Sun, 15 Dec 2019 09:38:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0BookInfo=E9=AB=98=E6=96=AF?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E8=83=8C=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 3 +++ app/src/main/AndroidManifest.xml | 3 ++- .../io/legado/app/ui/book/info/BookInfoActivity.kt | 11 +++++++++++ app/src/main/res/layout/activity_book_info.xml | 7 +++++++ app/src/main/res/values/styles.xml | 6 ++++++ 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index c2bc779e2..8bd44a700 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -159,6 +159,9 @@ dependencies { //MarkDown implementation 'ru.noties.markwon:core:3.0.2' + + //高斯模糊 + implementation 'jp.wasabeef:glide-transformations:4.1.0' } apply plugin: 'com.google.gms.google-services' \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6d456ff25..d3eff6243 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -78,7 +78,8 @@ - + 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 cf89e975c..9ed5ffb6d 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 @@ -6,6 +6,9 @@ import android.os.Bundle import android.view.Menu import android.view.MenuItem import androidx.lifecycle.Observer +import com.bumptech.glide.Glide +import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions +import com.bumptech.glide.request.RequestOptions.bitmapTransform import io.legado.app.R import io.legado.app.base.VMBaseActivity import io.legado.app.constant.BookType @@ -23,6 +26,7 @@ import io.legado.app.ui.chapterlist.ChapterListActivity import io.legado.app.utils.getViewModel import io.legado.app.utils.gone import io.legado.app.utils.visible +import jp.wasabeef.glide.transformations.BlurTransformation import kotlinx.android.synthetic.main.activity_book_info.* import kotlinx.android.synthetic.main.view_title_bar.* import org.jetbrains.anko.sdk27.listeners.onClick @@ -40,6 +44,7 @@ class BookInfoActivity : VMBaseActivity(R.layout.activity_boo override fun onActivityCreated(savedInstanceState: Bundle?) { setSupportActionBar(toolbar) + title_bar.getBackground().setAlpha(0) viewModel.bookData.observe(this, Observer { showBook(it) }) viewModel.isLoadingData.observe(this, Observer { upLoading(it) }) viewModel.chapterListData.observe(this, Observer { showChapter(it) }) @@ -103,6 +108,12 @@ class BookInfoActivity : VMBaseActivity(R.layout.activity_boo .error(R.drawable.image_cover_default) .centerCrop() .into(iv_cover) + Glide.with(this).load(it) + .transition(DrawableTransitionOptions.withCrossFade(1500)) + .error(R.drawable.image_cover_default) + .centerCrop() + .apply(bitmapTransform(BlurTransformation(125, 6))) + .into(bg_book) //模糊、渐变、缩小效果 } val kinds = book.getKindList() if (kinds.isEmpty()) { diff --git a/app/src/main/res/layout/activity_book_info.xml b/app/src/main/res/layout/activity_book_info.xml index 6fa8db584..fdad506fb 100644 --- a/app/src/main/res/layout/activity_book_info.xml +++ b/app/src/main/res/layout/activity_book_info.xml @@ -6,6 +6,13 @@ android:layout_height="match_parent" android:orientation="vertical"> + + true + + +