From ea3fc5a076923d9f77c7649b8eee8a9fd2f5fac1 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 3 Apr 2022 20:51:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=89=B9=E9=87=8F=E6=8D=A2?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/arrange/SourcePickerDialog.kt | 12 +++++------ app/src/main/res/layout/item_1line_text.xml | 20 +++++++++++++++++++ .../res/layout/item_1line_text_and_del.xml | 2 +- 3 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 app/src/main/res/layout/item_1line_text.xml diff --git a/app/src/main/java/io/legado/app/ui/book/arrange/SourcePickerDialog.kt b/app/src/main/java/io/legado/app/ui/book/arrange/SourcePickerDialog.kt index 02c4c9897..50101e9a6 100644 --- a/app/src/main/java/io/legado/app/ui/book/arrange/SourcePickerDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/arrange/SourcePickerDialog.kt @@ -14,7 +14,7 @@ import io.legado.app.base.adapter.RecyclerAdapter import io.legado.app.data.appDb import io.legado.app.data.entities.BookSource import io.legado.app.databinding.DialogSourcePickerBinding -import io.legado.app.databinding.Item1lineTextAndDelBinding +import io.legado.app.databinding.Item1lineTextBinding import io.legado.app.lib.theme.primaryColor import io.legado.app.lib.theme.primaryTextColor import io.legado.app.utils.applyTint @@ -81,24 +81,24 @@ class SourcePickerDialog : BaseDialogFragment(R.layout.dialog_source_picker) { } inner class SourceAdapter(context: Context) : - RecyclerAdapter(context) { + RecyclerAdapter(context) { - override fun getViewBinding(parent: ViewGroup): Item1lineTextAndDelBinding { - return Item1lineTextAndDelBinding.inflate(inflater, parent, false).apply { + override fun getViewBinding(parent: ViewGroup): Item1lineTextBinding { + return Item1lineTextBinding.inflate(inflater, parent, false).apply { root.setPadding(16.dpToPx()) } } override fun convert( holder: ItemViewHolder, - binding: Item1lineTextAndDelBinding, + binding: Item1lineTextBinding, item: BookSource, payloads: MutableList ) { binding.textView.text = item.getDisPlayNameGroup() } - override fun registerListener(holder: ItemViewHolder, binding: Item1lineTextAndDelBinding) { + override fun registerListener(holder: ItemViewHolder, binding: Item1lineTextBinding) { binding.root.onClick { getItemByLayoutPosition(holder.layoutPosition)?.let { callback?.sourceOnClick(it) diff --git a/app/src/main/res/layout/item_1line_text.xml b/app/src/main/res/layout/item_1line_text.xml new file mode 100644 index 000000000..b2af0e293 --- /dev/null +++ b/app/src/main/res/layout/item_1line_text.xml @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_1line_text_and_del.xml b/app/src/main/res/layout/item_1line_text_and_del.xml index ae73faa7b..b65a0b09b 100644 --- a/app/src/main/res/layout/item_1line_text_and_del.xml +++ b/app/src/main/res/layout/item_1line_text_and_del.xml @@ -6,7 +6,6 @@ android:layout_height="wrap_content" android:gravity="center_vertical" android:orientation="horizontal" - android:background="?attr/selectableItemBackground" android:padding="6dp" tools:ignore="UseCompoundDrawables"> @@ -15,6 +14,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" + android:background="?attr/selectableItemBackground" android:singleLine="true" android:textColor="@color/primaryText" />