mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
优化
This commit is contained in:
parent
94269e72fc
commit
20c2daeadb
@ -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) {
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
4
app/src/main/res/drawable/selector_circle_btn_bg.xml
Normal file
4
app/src/main/res/drawable/selector_circle_btn_bg.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/shape_circle" />
|
||||
</selector>
|
11
app/src/main/res/drawable/shape_circle.xml
Normal file
11
app/src/main/res/drawable/shape_circle.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<solid android:color="#60666666" />
|
||||
|
||||
<size
|
||||
android:width="120dp"
|
||||
android:height="120dp" />
|
||||
|
||||
</shape>
|
@ -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">
|
||||
|
||||
<ImageView
|
||||
<io.legado.app.ui.widget.image.ImageButton
|
||||
android:id="@+id/iv_timer"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="46dp"
|
||||
android:padding="5dp"
|
||||
android:background="@drawable/selector_circle_btn_bg"
|
||||
android:contentDescription="@string/set_timer"
|
||||
android:src="@drawable/ic_timer_black_24dp"
|
||||
app:tint="@color/md_white_1000"
|
||||
@ -142,11 +142,12 @@
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageView
|
||||
<io.legado.app.ui.widget.image.ImageButton
|
||||
android:id="@+id/iv_fast_rewind"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="46dp"
|
||||
android:padding="5dp"
|
||||
android:background="@drawable/selector_circle_btn_bg"
|
||||
android:contentDescription="@string/skip_previous"
|
||||
android:src="@drawable/ic_fast_rewind"
|
||||
app:tint="@color/md_white_1000"
|
||||
@ -157,11 +158,12 @@
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageView
|
||||
<io.legado.app.ui.widget.image.ImageButton
|
||||
android:id="@+id/iv_skip_previous"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="46dp"
|
||||
android:padding="5dp"
|
||||
android:background="@drawable/selector_circle_btn_bg"
|
||||
android:contentDescription="@string/skip_previous"
|
||||
android:src="@drawable/ic_skip_previous"
|
||||
app:tint="@color/md_white_1000"
|
||||
@ -181,11 +183,12 @@
|
||||
app:pressedTranslationZ="2dp"
|
||||
tools:ignore="ImageContrastCheck" />
|
||||
|
||||
<ImageView
|
||||
<io.legado.app.ui.widget.image.ImageButton
|
||||
android:id="@+id/iv_skip_next"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="46dp"
|
||||
android:padding="5dp"
|
||||
android:background="@drawable/selector_circle_btn_bg"
|
||||
android:contentDescription="@string/skip_next"
|
||||
android:src="@drawable/ic_skip_next"
|
||||
app:tint="@color/md_white_1000"
|
||||
@ -196,11 +199,12 @@
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageView
|
||||
<io.legado.app.ui.widget.image.ImageButton
|
||||
android:id="@+id/iv_fast_forward"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="46dp"
|
||||
android:padding="5dp"
|
||||
android:background="@drawable/selector_circle_btn_bg"
|
||||
android:contentDescription="@string/skip_next"
|
||||
android:src="@drawable/ic_fast_forward"
|
||||
app:tint="@color/md_white_1000"
|
||||
@ -211,11 +215,12 @@
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageView
|
||||
<io.legado.app.ui.widget.image.ImageButton
|
||||
android:id="@+id/iv_chapter"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="46dp"
|
||||
android:padding="5dp"
|
||||
android:background="@drawable/selector_circle_btn_bg"
|
||||
android:contentDescription="@string/chapter_list"
|
||||
android:src="@drawable/ic_chapter_list"
|
||||
app:tint="@color/md_white_1000"
|
||||
|
Loading…
Reference in New Issue
Block a user