From 4c0deef70c38ffa25fea309b9aada7fea011fc3b Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 22 Feb 2020 15:13:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/read/TextActionMenu.kt | 6 +++++- .../io/legado/app/ui/book/search/BookAdapter.kt | 4 ++-- .../app/ui/book/search/HistoryKeyAdapter.kt | 4 ++-- .../legado/app/ui/main/explore/ExploreAdapter.kt | 4 ++-- .../io/legado/app/ui/widget/KeyboardToolPop.kt | 4 ++-- .../app/ui/widget/prefs/NameListPreference.kt | 2 +- app/src/main/res/layout/item_fillet_text.xml | 15 +++++++++++++++ app/src/main/res/layout/item_text.xml | 3 +-- app/src/main/res/menu/content_select_action.xml | 11 +++++++---- 9 files changed, 37 insertions(+), 16 deletions(-) create mode 100644 app/src/main/res/layout/item_fillet_text.xml diff --git a/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt index b0c2f3148..357830f0d 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt @@ -8,12 +8,13 @@ import android.widget.PopupWindow import androidx.appcompat.view.SupportMenuInflater import androidx.appcompat.view.menu.MenuBuilder import androidx.appcompat.view.menu.MenuItemImpl +import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter -import kotlinx.android.synthetic.main.item_text.view.* +import kotlinx.android.synthetic.main.item_fillet_text.view.* import kotlinx.android.synthetic.main.popup_action_menu.view.* import org.jetbrains.anko.sdk27.listeners.onClick @@ -35,6 +36,9 @@ class TextActionMenu(context: Context, callBack: CallBack) : private fun initRecyclerView() = with(contentView) { val adapter = Adapter(context) recycler_view.layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false) + recycler_view.addItemDecoration( + DividerItemDecoration(context, DividerItemDecoration.HORIZONTAL) + ) recycler_view.adapter = adapter val menu = MenuBuilder(context) SupportMenuInflater(context).inflate(R.menu.content_select_action, menu) diff --git a/app/src/main/java/io/legado/app/ui/book/search/BookAdapter.kt b/app/src/main/java/io/legado/app/ui/book/search/BookAdapter.kt index 070837520..05ea3c782 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/BookAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/BookAdapter.kt @@ -5,11 +5,11 @@ import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.data.entities.Book -import kotlinx.android.synthetic.main.item_text.view.* +import kotlinx.android.synthetic.main.item_fillet_text.view.* import org.jetbrains.anko.sdk27.listeners.onClick class BookAdapter(context: Context, val callBack: CallBack) : - SimpleRecyclerAdapter(context, R.layout.item_text) { + SimpleRecyclerAdapter(context, R.layout.item_fillet_text) { override fun convert(holder: ItemViewHolder, item: Book, payloads: MutableList) { with(holder.itemView) { diff --git a/app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt b/app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt index cfe7699a8..e59605495 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt @@ -6,7 +6,7 @@ import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.data.entities.SearchKeyword import io.legado.app.ui.widget.anima.explosion_field.ExplosionField -import kotlinx.android.synthetic.main.item_text.view.* +import kotlinx.android.synthetic.main.item_fillet_text.view.* import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch @@ -15,7 +15,7 @@ import org.jetbrains.anko.sdk27.listeners.onLongClick class HistoryKeyAdapter(activity: SearchActivity, val callBack: CallBack) : - SimpleRecyclerAdapter(activity, R.layout.item_text) { + SimpleRecyclerAdapter(activity, R.layout.item_fillet_text) { private val explosionField = ExplosionField.attach2Window(activity) diff --git a/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt b/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt index 6c4691284..3ceeca8b6 100644 --- a/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt @@ -14,8 +14,8 @@ import io.legado.app.lib.theme.accentColor import io.legado.app.utils.ACache import io.legado.app.utils.gone import io.legado.app.utils.visible +import kotlinx.android.synthetic.main.item_fillet_text.view.* import kotlinx.android.synthetic.main.item_find_book.view.* -import kotlinx.android.synthetic.main.item_text.view.* import kotlinx.coroutines.CoroutineScope import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.sdk27.listeners.onLongClick @@ -46,7 +46,7 @@ class ExploreAdapter(context: Context, private val scope: CoroutineScope, val ca gl_child.removeAllViews() kindList.map { kind -> val tv = LayoutInflater.from(context) - .inflate(R.layout.item_text, gl_child, false) + .inflate(R.layout.item_fillet_text, gl_child, false) gl_child.addView(tv) tv.text_view.text = kind.title tv.text_view.onClick { diff --git a/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt b/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt index 4c61917bc..56dff107c 100644 --- a/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt +++ b/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt @@ -10,7 +10,7 @@ import androidx.recyclerview.widget.RecyclerView import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter -import kotlinx.android.synthetic.main.item_text.view.* +import kotlinx.android.synthetic.main.item_fillet_text.view.* import kotlinx.android.synthetic.main.popup_keyboard_tool.view.* import org.jetbrains.anko.sdk27.listeners.onClick @@ -40,7 +40,7 @@ class KeyboardToolPop( } inner class Adapter(context: Context) : - SimpleRecyclerAdapter(context, R.layout.item_text) { + SimpleRecyclerAdapter(context, R.layout.item_fillet_text) { override fun convert(holder: ItemViewHolder, item: String, payloads: MutableList) { with(holder.itemView) { diff --git a/app/src/main/java/io/legado/app/ui/widget/prefs/NameListPreference.kt b/app/src/main/java/io/legado/app/ui/widget/prefs/NameListPreference.kt index b51db7a19..d8b51e90f 100644 --- a/app/src/main/java/io/legado/app/ui/widget/prefs/NameListPreference.kt +++ b/app/src/main/java/io/legado/app/ui/widget/prefs/NameListPreference.kt @@ -11,7 +11,7 @@ import io.legado.app.R class NameListPreference(context: Context, attrs: AttributeSet) : ListPreference(context, attrs) { init { - widgetLayoutResource = R.layout.item_text + widgetLayoutResource = R.layout.item_fillet_text } override fun onBindViewHolder(holder: PreferenceViewHolder?) { diff --git a/app/src/main/res/layout/item_fillet_text.xml b/app/src/main/res/layout/item_fillet_text.xml new file mode 100644 index 000000000..331bd8a2c --- /dev/null +++ b/app/src/main/res/layout/item_fillet_text.xml @@ -0,0 +1,15 @@ + + diff --git a/app/src/main/res/layout/item_text.xml b/app/src/main/res/layout/item_text.xml index 331bd8a2c..e37188e47 100644 --- a/app/src/main/res/layout/item_text.xml +++ b/app/src/main/res/layout/item_text.xml @@ -4,8 +4,7 @@ android:id="@+id/text_view" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_margin="3dp" - android:background="@drawable/selector_fillet_btn_bg" + android:background="?attr/selectableItemBackground" android:ellipsize="end" android:gravity="center" android:padding="5dp" diff --git a/app/src/main/res/menu/content_select_action.xml b/app/src/main/res/menu/content_select_action.xml index d83b82ef3..b9bdf7b40 100644 --- a/app/src/main/res/menu/content_select_action.xml +++ b/app/src/main/res/menu/content_select_action.xml @@ -1,9 +1,12 @@ - + + android:title="@string/replace" /> + + + \ No newline at end of file