From 20c2daeadbb8dcfedd3d77bcd7ff1822e441cf2e Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 24 Oct 2022 23:15:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/widget/image/CircleImageView.kt | 4 -- .../legado/app/ui/widget/image/ImageButton.kt | 20 +++++++ .../res/drawable/selector_circle_btn_bg.xml | 4 ++ app/src/main/res/drawable/shape_circle.xml | 11 ++++ .../main/res/layout/activity_audio_play.xml | 57 ++++++++++--------- 5 files changed, 66 insertions(+), 30 deletions(-) create mode 100644 app/src/main/java/io/legado/app/ui/widget/image/ImageButton.kt create mode 100644 app/src/main/res/drawable/selector_circle_btn_bg.xml create mode 100644 app/src/main/res/drawable/shape_circle.xml diff --git a/app/src/main/java/io/legado/app/ui/widget/image/CircleImageView.kt b/app/src/main/java/io/legado/app/ui/widget/image/CircleImageView.kt index 9030b6f1a..192a4a761 100644 --- a/app/src/main/java/io/legado/app/ui/widget/image/CircleImageView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/image/CircleImageView.kt @@ -7,7 +7,6 @@ import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.ColorDrawable import android.graphics.drawable.Drawable import android.net.Uri -import android.os.Build import android.text.TextPaint import android.util.AttributeSet import android.view.MotionEvent @@ -16,13 +15,11 @@ import android.view.ViewOutlineProvider import androidx.annotation.ColorInt import androidx.annotation.ColorRes import androidx.annotation.DrawableRes -import androidx.annotation.RequiresApi import androidx.appcompat.widget.AppCompatImageView import io.legado.app.R import io.legado.app.utils.getCompatColor import io.legado.app.utils.printOnDebug import io.legado.app.utils.spToPx - import kotlin.math.min import kotlin.math.pow @@ -431,7 +428,6 @@ class CircleImageView @JvmOverloads constructor( .pow(2.0) <= mBorderRadius.toDouble().pow(2.0) } - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) private inner class OutlineProvider : ViewOutlineProvider() { override fun getOutline(view: View, outline: Outline) { diff --git a/app/src/main/java/io/legado/app/ui/widget/image/ImageButton.kt b/app/src/main/java/io/legado/app/ui/widget/image/ImageButton.kt new file mode 100644 index 000000000..e21d00834 --- /dev/null +++ b/app/src/main/java/io/legado/app/ui/widget/image/ImageButton.kt @@ -0,0 +1,20 @@ +package io.legado.app.ui.widget.image + +import android.content.Context +import android.util.AttributeSet +import androidx.appcompat.widget.AppCompatImageView + +class ImageButton @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null +) : AppCompatImageView(context, attrs) { + + + override fun setEnabled(enabled: Boolean) { + if (isEnabled != enabled) { + imageAlpha = if (enabled) 0xFF else 0x3F + } + super.setEnabled(enabled) + } + +} \ No newline at end of file diff --git a/app/src/main/res/drawable/selector_circle_btn_bg.xml b/app/src/main/res/drawable/selector_circle_btn_bg.xml new file mode 100644 index 000000000..6144b889b --- /dev/null +++ b/app/src/main/res/drawable/selector_circle_btn_bg.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_circle.xml b/app/src/main/res/drawable/shape_circle.xml new file mode 100644 index 000000000..a46383db2 --- /dev/null +++ b/app/src/main/res/drawable/shape_circle.xml @@ -0,0 +1,11 @@ + + + + + + + + \ 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 7b984a74d..ad9bf920a 100644 --- a/app/src/main/res/layout/activity_audio_play.xml +++ b/app/src/main/res/layout/activity_audio_play.xml @@ -123,15 +123,15 @@ android:layout_height="wrap_content" android:gravity="center_vertical" android:orientation="horizontal" - android:paddingLeft="24dp" - android:paddingRight="24dp" + android:paddingHorizontal="6dp" app:layout_constraintBottom_toBottomOf="parent"> - - - - - -