pull/32/head
kunfei 5 years ago
parent fcdbc98d23
commit 634b989b3c
  1. 20
      app/src/main/java/io/legado/app/ui/changesource/ChangeSourceAdapter.kt
  2. 3
      app/src/main/java/io/legado/app/ui/changesource/ChangeSourceDialog.kt
  3. 18
      app/src/main/res/layout/item_change_source.xml

@ -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<SearchBook>(context, R.layout.item_change_source) {
override fun convert(holder: ItemViewHolder, item: SearchBook, payloads: MutableList<Any>) {
holder.itemView.apply {
tv_origin.text = item.originName
tv_last.text = item.latestChapterTitle
}
}
}

@ -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() {

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/tv_origin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
<TextView
android:id="@+id/tv_last"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
</LinearLayout>
Loading…
Cancel
Save