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 + + +