From 634b989b3cd9fd311e0336bf9c1a313560e02b32 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 15 Aug 2019 10:22:32 +0800 Subject: [PATCH] up --- .../ui/changesource/ChangeSourceAdapter.kt | 20 +++++++++++++++++++ .../app/ui/changesource/ChangeSourceDialog.kt | 3 +++ .../main/res/layout/item_change_source.xml | 18 +++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 app/src/main/res/layout/item_change_source.xml diff --git a/app/src/main/java/io/legado/app/ui/changesource/ChangeSourceAdapter.kt b/app/src/main/java/io/legado/app/ui/changesource/ChangeSourceAdapter.kt index 455615940..f6e3e62d7 100644 --- a/app/src/main/java/io/legado/app/ui/changesource/ChangeSourceAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/changesource/ChangeSourceAdapter.kt @@ -1,2 +1,22 @@ package io.legado.app.ui.changesource +import android.content.Context +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.SearchBook +import kotlinx.android.synthetic.main.item_change_source.view.* + + +class ChangeSourceAdapter(context: Context) : SimpleRecyclerAdapter(context, R.layout.item_change_source) { + + + override fun convert(holder: ItemViewHolder, item: SearchBook, payloads: MutableList) { + holder.itemView.apply { + tv_origin.text = item.originName + tv_last.text = item.latestChapterTitle + } + } + + +} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/changesource/ChangeSourceDialog.kt b/app/src/main/java/io/legado/app/ui/changesource/ChangeSourceDialog.kt index bc57ec135..bb9f8ab67 100644 --- a/app/src/main/java/io/legado/app/ui/changesource/ChangeSourceDialog.kt +++ b/app/src/main/java/io/legado/app/ui/changesource/ChangeSourceDialog.kt @@ -30,6 +30,7 @@ class ChangeSourceDialog : DialogFragment() { } private lateinit var viewModel: ChangeSourceViewModel + private lateinit var changeSourceAdapter: ChangeSourceAdapter var callBack: CallBack? = null override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { @@ -66,7 +67,9 @@ class ChangeSourceDialog : DialogFragment() { } private fun initRecyclerView() { + changeSourceAdapter = ChangeSourceAdapter(requireContext()) recycler_view.layoutManager = LinearLayoutManager(context) + recycler_view.adapter = changeSourceAdapter } private fun initSearchView() { diff --git a/app/src/main/res/layout/item_change_source.xml b/app/src/main/res/layout/item_change_source.xml new file mode 100644 index 000000000..128f2710f --- /dev/null +++ b/app/src/main/res/layout/item_change_source.xml @@ -0,0 +1,18 @@ + + + + + + + \ No newline at end of file