From 803f81e8cf016d28a811505adf543b6d0d1c2781 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 11 Sep 2019 14:16:21 +0800 Subject: [PATCH] up --- .../app/lib/theme/view/ATEAccentBgTextView.kt | 20 ++++++++----------- .../res/layout-land/activity_book_info.xml | 16 +++++++++------ .../main/res/layout/activity_book_info.xml | 16 +++++++++------ app/src/main/res/layout/item_search.xml | 9 ++++++--- app/src/main/res/values/attrs.xml | 4 ++++ 5 files changed, 38 insertions(+), 27 deletions(-) diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATEAccentBgTextView.kt b/app/src/main/java/io/legado/app/lib/theme/view/ATEAccentBgTextView.kt index 6aef2175a..fe1f0b0ea 100644 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATEAccentBgTextView.kt +++ b/app/src/main/java/io/legado/app/lib/theme/view/ATEAccentBgTextView.kt @@ -4,25 +4,21 @@ import android.content.Context import android.graphics.Color import android.util.AttributeSet import androidx.appcompat.widget.AppCompatTextView +import io.legado.app.R import io.legado.app.lib.theme.ColorUtils import io.legado.app.lib.theme.Selector import io.legado.app.lib.theme.ThemeStore -import io.legado.app.utils.dp -class ATEAccentBgTextView : AppCompatTextView { - constructor(context: Context) : super(context) - - constructor(context: Context, attrs: AttributeSet) : super(context, attrs) - - constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super( - context, - attrs, - defStyleAttr - ) +class ATEAccentBgTextView(context: Context, attrs: AttributeSet) : + AppCompatTextView(context, attrs) { init { + val typedArray = context.obtainStyledAttributes(attrs, R.styleable.ATEAccentBgTextView) + val radios = + typedArray.getDimensionPixelOffset(R.styleable.ATEAccentBgTextView_abt_radius, 0) + typedArray.recycle() background = Selector.shapeBuild() - .setCornerRadius(3.dp) + .setCornerRadius(radios) .setDefaultBgColor(ThemeStore.accentColor(context)) .setPressedBgColor(ColorUtils.darkenColor(ThemeStore.accentColor(context))) .create() diff --git a/app/src/main/res/layout-land/activity_book_info.xml b/app/src/main/res/layout-land/activity_book_info.xml index 7711735ad..49fba475e 100644 --- a/app/src/main/res/layout-land/activity_book_info.xml +++ b/app/src/main/res/layout-land/activity_book_info.xml @@ -83,7 +83,8 @@ android:layout_marginStart="8dp" android:paddingLeft="5dp" android:paddingRight="5dp" - android:text="@string/change_origin" /> + android:text="@string/change_origin" + app:abt_radius="2dp" /> @@ -104,7 +105,8 @@ android:paddingRight="3dp" android:singleLine="true" android:text="@string/app_name" - android:textSize="12sp" /> + android:textSize="12sp" + app:abt_radius="2dp" /> + android:textSize="12sp" + app:abt_radius="2dp" /> + android:textSize="12sp" + app:abt_radius="2dp" /> @@ -226,7 +230,7 @@ android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" - android:background="?android:attr/selectableItemBackgroundBorderless" + android:background="?android:attr/selectableItemBackground" android:ellipsize="middle" android:gravity="center_vertical" android:paddingLeft="10dp" @@ -297,7 +301,7 @@ android:textColor="@color/tv_text_default" android:textSize="15sp" /> - + android:text="@string/change_origin" + app:abt_radius="2dp" /> @@ -95,7 +96,8 @@ android:paddingRight="3dp" android:singleLine="true" android:text="@string/app_name" - android:textSize="12sp" /> + android:textSize="12sp" + app:abt_radius="2dp" /> + android:textSize="12sp" + app:abt_radius="2dp" /> + android:textSize="12sp" + app:abt_radius="2dp" /> @@ -218,7 +222,7 @@ android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" - android:background="?android:attr/selectableItemBackgroundBorderless" + android:background="?android:attr/selectableItemBackground" android:ellipsize="middle" android:gravity="center_vertical" android:paddingLeft="10dp" @@ -286,7 +290,7 @@ android:textColor="@color/tv_text_default" android:textSize="15sp" /> - + android:textSize="12sp" + app:abt_radius="2dp" /> + android:textSize="12sp" + app:abt_radius="2dp" /> + android:textSize="12sp" + app:abt_radius="2dp" /> diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index d4b45f4ea..f121f58ae 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -130,4 +130,8 @@ + + + + \ No newline at end of file