diff --git a/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceAdapter.kt b/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceAdapter.kt index 4946cbe06..83fa15094 100644 --- a/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceAdapter.kt @@ -1,2 +1,40 @@ package io.legado.app.ui.main.booksource +import android.view.View +import android.view.ViewGroup +import androidx.paging.PagedListAdapter +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.RecyclerView +import io.legado.app.data.entities.Source + +class BookSourceAdapter : PagedListAdapter(DIFF_CALLBACK) { + + companion object { + + @JvmField + val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: Source, newItem: Source): Boolean = + oldItem.id == newItem.id + + override fun areContentsTheSame(oldItem: Source, newItem: Source): Boolean = + oldItem.id == newItem.id + && oldItem.name == newItem.name + && oldItem.group == newItem.group + && oldItem.isEnabled == newItem.isEnabled + } + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + + override fun onBindViewHolder(holder: MyViewHolder, position: Int) { + + } + + + class MyViewHolder(view: View) : RecyclerView.ViewHolder(view) { + + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/item_book_source.xml b/app/src/main/res/layout/item_book_source.xml new file mode 100644 index 000000000..c7b5e9d41 --- /dev/null +++ b/app/src/main/res/layout/item_book_source.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file