From f032adabc583b7b434ae80e7ba65bbf66a10b147 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 4 Nov 2019 20:10:07 +0800 Subject: [PATCH] up --- .../java/io/legado/app/help/ImageLoader.kt | 6 +++++ .../legado/app/ui/audio/AudioPlayActivity.kt | 7 ++++++ app/src/main/res/drawable/bg_gradient.xml | 8 +++++++ .../main/res/layout/activity_audio_play.xml | 23 ++++++++++++------- 4 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 app/src/main/res/drawable/bg_gradient.xml diff --git a/app/src/main/java/io/legado/app/help/ImageLoader.kt b/app/src/main/java/io/legado/app/help/ImageLoader.kt index 10a9a8a50..836cb6e1d 100644 --- a/app/src/main/java/io/legado/app/help/ImageLoader.kt +++ b/app/src/main/java/io/legado/app/help/ImageLoader.kt @@ -9,6 +9,7 @@ import androidx.annotation.DrawableRes import com.bumptech.glide.Glide import com.bumptech.glide.RequestBuilder import com.bumptech.glide.RequestManager +import com.bumptech.glide.load.Transformation import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions import com.bumptech.glide.load.resource.bitmap.CenterCrop @@ -70,6 +71,11 @@ object ImageLoader { return this } + fun bitmapTransform(transformation: Transformation): ImageLoadBuilder { + requestOptions = requestOptions.apply(RequestOptions.bitmapTransform(transformation)) + return this + } + fun toRound(corner: Int): ImageLoadBuilder { requestOptions = requestOptions.transform(RoundedCorners(corner)) return this diff --git a/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt b/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt index 73ed2b909..d2a7e19ce 100644 --- a/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt +++ b/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt @@ -9,6 +9,7 @@ import io.legado.app.constant.Bus import io.legado.app.constant.Status import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter +import io.legado.app.help.BlurTransformation import io.legado.app.help.ImageLoader import io.legado.app.service.help.AudioPlay import io.legado.app.utils.getViewModel @@ -72,6 +73,12 @@ class AudioPlayActivity : VMBaseActivity(R.layout.activity_a .error(R.drawable.image_cover_default) .centerCrop() .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() { diff --git a/app/src/main/res/drawable/bg_gradient.xml b/app/src/main/res/drawable/bg_gradient.xml new file mode 100644 index 000000000..6c2f91672 --- /dev/null +++ b/app/src/main/res/drawable/bg_gradient.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_audio_play.xml b/app/src/main/res/layout/activity_audio_play.xml index 9646fd7c5..d9d73a5f0 100644 --- a/app/src/main/res/layout/activity_audio_play.xml +++ b/app/src/main/res/layout/activity_audio_play.xml @@ -1,16 +1,18 @@ + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toBottomOf="@+id/title_bar" /> + android:src="@drawable/ic_timer_black_24dp" + android:tint="@color/md_white_1000" /> + android:src="@drawable/ic_skip_previous" + android:tint="@color/md_white_1000" /> @@ -111,7 +116,8 @@ android:layout_height="36dp" android:background="?attr/selectableItemBackgroundBorderless" android:contentDescription="@string/skip_next" - android:src="@drawable/ic_skip_next" /> + android:src="@drawable/ic_skip_next" + android:tint="@color/md_white_1000" />