pull/46/head
kunfei 5 years ago
parent 70f2353136
commit f032adabc5
  1. 6
      app/src/main/java/io/legado/app/help/ImageLoader.kt
  2. 7
      app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt
  3. 8
      app/src/main/res/drawable/bg_gradient.xml
  4. 23
      app/src/main/res/layout/activity_audio_play.xml

@ -9,6 +9,7 @@ import androidx.annotation.DrawableRes
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.RequestBuilder import com.bumptech.glide.RequestBuilder
import com.bumptech.glide.RequestManager import com.bumptech.glide.RequestManager
import com.bumptech.glide.load.Transformation
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions import com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions
import com.bumptech.glide.load.resource.bitmap.CenterCrop import com.bumptech.glide.load.resource.bitmap.CenterCrop
@ -70,6 +71,11 @@ object ImageLoader {
return this return this
} }
fun bitmapTransform(transformation: Transformation<Bitmap>): ImageLoadBuilder<S> {
requestOptions = requestOptions.apply(RequestOptions.bitmapTransform(transformation))
return this
}
fun toRound(corner: Int): ImageLoadBuilder<S> { fun toRound(corner: Int): ImageLoadBuilder<S> {
requestOptions = requestOptions.transform(RoundedCorners(corner)) requestOptions = requestOptions.transform(RoundedCorners(corner))
return this return this

@ -9,6 +9,7 @@ import io.legado.app.constant.Bus
import io.legado.app.constant.Status import io.legado.app.constant.Status
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookChapter import io.legado.app.data.entities.BookChapter
import io.legado.app.help.BlurTransformation
import io.legado.app.help.ImageLoader import io.legado.app.help.ImageLoader
import io.legado.app.service.help.AudioPlay import io.legado.app.service.help.AudioPlay
import io.legado.app.utils.getViewModel import io.legado.app.utils.getViewModel
@ -72,6 +73,12 @@ class AudioPlayActivity : VMBaseActivity<AudioPlayViewModel>(R.layout.activity_a
.error(R.drawable.image_cover_default) .error(R.drawable.image_cover_default)
.centerCrop() .centerCrop()
.setAsDrawable(iv_cover) .setAsDrawable(iv_cover)
ImageLoader.load(this, book.getDisplayCover())
.placeholder(R.drawable.image_cover_default)
.error(R.drawable.image_cover_default)
.centerCrop()
.bitmapTransform(BlurTransformation(this, 25))
.setAsDrawable(iv_bg)
} }
private fun playButton() { private fun playButton() {

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!--实现应用背景颜色渐变-->
<gradient
android:startColor="#000000"
android:endColor="#00000000"
android:angle="90" />
</shape>

@ -1,16 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/background"
tools:context=".ui.audio.AudioPlayActivity"> tools:context=".ui.audio.AudioPlayActivity">
<ImageView <ImageView
android:id="@+id/iv_bg" android:id="@+id/iv_bg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<io.legado.app.ui.widget.TitleBar <io.legado.app.ui.widget.TitleBar
@ -25,11 +27,12 @@
android:layout_height="260dp" android:layout_height="260dp"
android:layout_gravity="center" android:layout_gravity="center"
android:contentDescription="@string/img_cover" android:contentDescription="@string/img_cover"
android:scaleType="centerCrop"
android:src="@drawable/image_cover_default" android:src="@drawable/image_cover_default"
app:layout_constraintTop_toBottomOf="@+id/title_bar"
app:layout_constraintBottom_toTopOf="@+id/ll_player_progress" app:layout_constraintBottom_toTopOf="@+id/ll_player_progress"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" /> app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title_bar" />
<LinearLayout <LinearLayout
android:id="@+id/ll_player_progress" android:id="@+id/ll_player_progress"
@ -77,7 +80,8 @@
android:layout_height="36dp" android:layout_height="36dp"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/set_timer" android:contentDescription="@string/set_timer"
android:src="@drawable/ic_timer_black_24dp" /> android:src="@drawable/ic_timer_black_24dp"
android:tint="@color/md_white_1000" />
<View <View
android:layout_width="0dp" android:layout_width="0dp"
@ -90,7 +94,8 @@
android:layout_height="36dp" android:layout_height="36dp"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/skip_previous" android:contentDescription="@string/skip_previous"
android:src="@drawable/ic_skip_previous" /> android:src="@drawable/ic_skip_previous"
android:tint="@color/md_white_1000" />
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_play_stop" android:id="@+id/fab_play_stop"
@ -99,8 +104,8 @@
android:layout_margin="10dp" android:layout_margin="10dp"
android:contentDescription="@string/audio_play" android:contentDescription="@string/audio_play"
android:src="@drawable/ic_play_24dp" android:src="@drawable/ic_play_24dp"
android:tint="@color/tv_text_default" android:tint="@color/md_black_1000"
app:backgroundTint="@color/background_menu" app:backgroundTint="@color/md_white_1000"
app:elevation="2dp" app:elevation="2dp"
app:fabSize="normal" app:fabSize="normal"
app:pressedTranslationZ="2dp" /> app:pressedTranslationZ="2dp" />
@ -111,7 +116,8 @@
android:layout_height="36dp" android:layout_height="36dp"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/skip_next" android:contentDescription="@string/skip_next"
android:src="@drawable/ic_skip_next" /> android:src="@drawable/ic_skip_next"
android:tint="@color/md_white_1000" />
<View <View
android:layout_width="0dp" android:layout_width="0dp"
@ -124,6 +130,7 @@
android:layout_height="36dp" android:layout_height="36dp"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_chapter_list" android:src="@drawable/ic_chapter_list"
android:tint="@color/md_white_1000"
android:contentDescription="@string/chapter_list" /> android:contentDescription="@string/chapter_list" />
</LinearLayout> </LinearLayout>

Loading…
Cancel
Save