pull/60/head
kunfei 5 years ago
parent 84bdf11bdd
commit bdc315dc0b
  1. 2
      app/build.gradle
  2. 15
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt

@ -160,8 +160,6 @@ 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'

@ -2,11 +2,13 @@ package io.legado.app.ui.book.info
import android.app.Activity
import android.content.Intent
import android.graphics.drawable.Drawable
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.RequestBuilder
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.bumptech.glide.request.RequestOptions.bitmapTransform
import io.legado.app.R
@ -15,6 +17,7 @@ import io.legado.app.constant.BookType
import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookChapter
import io.legado.app.data.entities.BookGroup
import io.legado.app.help.BlurTransformation
import io.legado.app.help.ImageLoader
import io.legado.app.help.IntentDataHelp
import io.legado.app.ui.audio.AudioPlayActivity
@ -26,7 +29,6 @@ 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
@ -44,7 +46,7 @@ class BookInfoActivity : VMBaseActivity<BookInfoViewModel>(R.layout.activity_boo
override fun onActivityCreated(savedInstanceState: Bundle?) {
setSupportActionBar(toolbar)
title_bar.getBackground().setAlpha(0)
title_bar.background.alpha = 0
viewModel.bookData.observe(this, Observer { showBook(it) })
viewModel.isLoadingData.observe(this, Observer { upLoading(it) })
viewModel.chapterListData.observe(this, Observer { showChapter(it) })
@ -96,6 +98,11 @@ class BookInfoActivity : VMBaseActivity<BookInfoViewModel>(R.layout.activity_boo
return super.onMenuOpened(featureId, menu)
}
private fun defaultCover(): RequestBuilder<Drawable> {
return ImageLoader.load(this, R.drawable.image_cover_default)
.apply(bitmapTransform(BlurTransformation(this, 25)))
}
private fun showBook(book: Book) {
tv_name.text = book.name
tv_author.text = getString(R.string.author_show, book.author)
@ -110,9 +117,9 @@ class BookInfoActivity : VMBaseActivity<BookInfoViewModel>(R.layout.activity_boo
.into(iv_cover)
Glide.with(this).load(it)
.transition(DrawableTransitionOptions.withCrossFade(1500))
.error(R.drawable.image_cover_default)
.thumbnail(defaultCover())
.centerCrop()
.apply(bitmapTransform(BlurTransformation(125, 6)))
.apply(bitmapTransform(BlurTransformation(this, 25)))
.into(bg_book) //模糊、渐变、缩小效果
}
val kinds = book.getKindList()

Loading…
Cancel
Save