Merge pull request #58 from KKL369/master

增加BookInfo高斯模糊背景
pull/60/head
kunfei 5 years ago committed by GitHub
commit 55e9e845f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/build.gradle
  2. 3
      app/src/main/AndroidManifest.xml
  3. 11
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
  4. 7
      app/src/main/res/layout/activity_book_info.xml
  5. 6
      app/src/main/res/values/styles.xml

@ -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'

@ -78,7 +78,8 @@
<activity
android:name=".ui.about.DonateActivity"
android:launchMode="singleTask" />
<activity android:name=".ui.book.info.BookInfoActivity" />
<activity android:name=".ui.book.info.BookInfoActivity"
android:theme="@style/AppTheme.BookInfo" />
<activity android:name="io.legado.app.ui.book.info.edit.BookInfoEditActivity" />
<activity android:name=".ui.book.source.debug.BookSourceDebugActivity" />
<activity android:name=".ui.book.source.manage.BookSourceActivity">

@ -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<BookInfoViewModel>(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<BookInfoViewModel>(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()) {

@ -6,6 +6,13 @@
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/bg_book"
android:layout_width="match_parent"
android:layout_height="256dp"
app:layout_constraintBottom_toTopOf="@+id/view_info"
android:scaleType="centerCrop" />
<io.legado.app.ui.widget.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"

@ -23,6 +23,12 @@
<item name="android:windowNoTitle">true</item>
</style>
<!-- BookInfo主题 -->
<style name="AppTheme.BookInfo" parent="Base.AppTheme">
<item name="actionBarStyle">@style/AppTheme.AppBarOverlay.Light</item>
<item name="elevation">0dp</item><!--去掉toolbar阴影,去线留白-->
</style>
<!-- Base application theme. -->
<style name="Base.AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>

Loading…
Cancel
Save