pull/737/head
gedoor 4 years ago
parent ffd3308362
commit ea507382a7
  1. 13
      app/src/main/java/io/legado/app/base/adapter/SimpleRecyclerAdapter.kt
  2. 4
      app/src/main/java/io/legado/app/ui/about/ReadRecordActivity.kt
  3. 4
      app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt
  4. 4
      app/src/main/java/io/legado/app/ui/association/ImportRssSourceDialog.kt
  5. 5
      app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookAdapter.kt
  6. 4
      app/src/main/java/io/legado/app/ui/book/cache/CacheAdapter.kt
  7. 4
      app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt
  8. 4
      app/src/main/java/io/legado/app/ui/book/info/ChapterListAdapter.kt
  9. 4
      app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt
  10. 4
      app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt
  11. 4
      app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt
  12. 4
      app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt
  13. 4
      app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt
  14. 4
      app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt
  15. 4
      app/src/main/java/io/legado/app/ui/config/ThemeListDialog.kt
  16. 4
      app/src/main/java/io/legado/app/ui/filepicker/adapter/FileAdapter.kt
  17. 4
      app/src/main/java/io/legado/app/ui/filepicker/adapter/PathAdapter.kt
  18. 4
      app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt
  19. 4
      app/src/main/java/io/legado/app/ui/replace/GroupManageDialog.kt
  20. 4
      app/src/main/java/io/legado/app/ui/replace/ReplaceRuleAdapter.kt
  21. 4
      app/src/main/java/io/legado/app/ui/rss/favorites/RssFavoritesAdapter.kt
  22. 4
      app/src/main/java/io/legado/app/ui/rss/source/manage/GroupManageDialog.kt
  23. 4
      app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubAdapter.kt
  24. 4
      app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt
  25. 4
      app/src/main/java/io/legado/app/ui/widget/dialog/TextListDialog.kt
  26. 4
      app/src/main/java/io/legado/app/ui/widget/font/FontAdapter.kt
  27. 4
      app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt

@ -31,18 +31,7 @@ abstract class SimpleRecyclerAdapter<ITEM, VB : ViewBinding>(protected val conte
var itemAnimation: ItemAnimation? = null var itemAnimation: ItemAnimation? = null
open val diffItemCallback: DiffUtil.ItemCallback<ITEM> = abstract val diffItemCallback: DiffUtil.ItemCallback<ITEM>
object : DiffUtil.ItemCallback<ITEM>() {
override fun areItemsTheSame(oldItem: ITEM, newItem: ITEM): Boolean {
return false
}
override fun areContentsTheSame(oldItem: ITEM, newItem: ITEM): Boolean {
return true
}
}
fun setOnItemClickListener(listener: (holder: ItemViewHolder, item: ITEM) -> Unit) { fun setOnItemClickListener(listener: (holder: ItemViewHolder, item: ITEM) -> Unit) {
itemClickListener = listener itemClickListener = listener

@ -8,8 +8,8 @@ import android.view.ViewGroup
import io.legado.app.App import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseActivity import io.legado.app.base.BaseActivity
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.data.entities.ReadRecordShow import io.legado.app.data.entities.ReadRecordShow
import io.legado.app.databinding.ActivityReadRecordBinding import io.legado.app.databinding.ActivityReadRecordBinding
import io.legado.app.databinding.ItemReadRecordBinding import io.legado.app.databinding.ItemReadRecordBinding
@ -92,7 +92,7 @@ class ReadRecordActivity : BaseActivity<ActivityReadRecordBinding>() {
} }
inner class RecordAdapter(context: Context) : inner class RecordAdapter(context: Context) :
SimpleRecyclerAdapter<ReadRecordShow, ItemReadRecordBinding>(context) { CommonRecyclerAdapter<ReadRecordShow, ItemReadRecordBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemReadRecordBinding { override fun getViewBinding(parent: ViewGroup): ItemReadRecordBinding {
return ItemReadRecordBinding.inflate(inflater, parent, false) return ItemReadRecordBinding.inflate(inflater, parent, false)

@ -12,8 +12,8 @@ import androidx.appcompat.widget.Toolbar
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseDialogFragment import io.legado.app.base.BaseDialogFragment
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.constant.PreferKey import io.legado.app.constant.PreferKey
import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.BookSource
import io.legado.app.databinding.DialogEditTextBinding import io.legado.app.databinding.DialogEditTextBinding
@ -126,7 +126,7 @@ class ImportBookSourceDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickList
} }
inner class SourcesAdapter(context: Context) : inner class SourcesAdapter(context: Context) :
SimpleRecyclerAdapter<BookSource, ItemSourceImportBinding>(context) { CommonRecyclerAdapter<BookSource, ItemSourceImportBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemSourceImportBinding { override fun getViewBinding(parent: ViewGroup): ItemSourceImportBinding {
return ItemSourceImportBinding.inflate(inflater, parent, false) return ItemSourceImportBinding.inflate(inflater, parent, false)

@ -12,8 +12,8 @@ import androidx.appcompat.widget.Toolbar
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseDialogFragment import io.legado.app.base.BaseDialogFragment
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.constant.PreferKey import io.legado.app.constant.PreferKey
import io.legado.app.data.entities.RssSource import io.legado.app.data.entities.RssSource
import io.legado.app.databinding.DialogEditTextBinding import io.legado.app.databinding.DialogEditTextBinding
@ -126,7 +126,7 @@ class ImportRssSourceDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListe
} }
inner class SourcesAdapter(context: Context) : inner class SourcesAdapter(context: Context) :
SimpleRecyclerAdapter<RssSource, ItemSourceImportBinding>(context) { CommonRecyclerAdapter<RssSource, ItemSourceImportBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemSourceImportBinding { override fun getViewBinding(parent: ViewGroup): ItemSourceImportBinding {
return ItemSourceImportBinding.inflate(inflater, parent, false) return ItemSourceImportBinding.inflate(inflater, parent, false)

@ -5,8 +5,8 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookGroup import io.legado.app.data.entities.BookGroup
import io.legado.app.databinding.ItemArrangeBookBinding import io.legado.app.databinding.ItemArrangeBookBinding
@ -18,7 +18,8 @@ import org.jetbrains.anko.sdk27.listeners.onClick
import java.util.* import java.util.*
class ArrangeBookAdapter(context: Context, val callBack: CallBack) : class ArrangeBookAdapter(context: Context, val callBack: CallBack) :
SimpleRecyclerAdapter<Book, ItemArrangeBookBinding>(context), CommonRecyclerAdapter<Book, ItemArrangeBookBinding>(context),
ItemTouchCallback.Callback { ItemTouchCallback.Callback {
val groupRequestCode = 12 val groupRequestCode = 12
private val selectedBooks: HashSet<Book> = hashSetOf() private val selectedBooks: HashSet<Book> = hashSetOf()

@ -4,8 +4,8 @@ import android.content.Context
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookChapter import io.legado.app.data.entities.BookChapter
import io.legado.app.databinding.ItemDownloadBinding import io.legado.app.databinding.ItemDownloadBinding
@ -16,7 +16,7 @@ import java.util.concurrent.CopyOnWriteArraySet
class CacheAdapter(context: Context, private val callBack: CallBack) : class CacheAdapter(context: Context, private val callBack: CallBack) :
SimpleRecyclerAdapter<Book, ItemDownloadBinding>(context) { CommonRecyclerAdapter<Book, ItemDownloadBinding>(context) {
val cacheChapters = hashMapOf<String, HashSet<String>>() val cacheChapters = hashMapOf<String, HashSet<String>>()
var downloadMap: ConcurrentHashMap<String, CopyOnWriteArraySet<BookChapter>>? = null var downloadMap: ConcurrentHashMap<String, CopyOnWriteArraySet<BookChapter>>? = null

@ -15,8 +15,8 @@ import androidx.recyclerview.widget.RecyclerView
import io.legado.app.App import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseDialogFragment import io.legado.app.base.BaseDialogFragment
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.data.entities.BookGroup import io.legado.app.data.entities.BookGroup
import io.legado.app.databinding.DialogBookGroupPickerBinding import io.legado.app.databinding.DialogBookGroupPickerBinding
import io.legado.app.databinding.DialogEditTextBinding import io.legado.app.databinding.DialogEditTextBinding
@ -152,7 +152,7 @@ class GroupSelectDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
} }
private inner class GroupAdapter(context: Context) : private inner class GroupAdapter(context: Context) :
SimpleRecyclerAdapter<BookGroup, ItemGroupSelectBinding>(context), CommonRecyclerAdapter<BookGroup, ItemGroupSelectBinding>(context),
ItemTouchCallback.Callback { ItemTouchCallback.Callback {
private var isMoved: Boolean = false private var isMoved: Boolean = false

@ -3,8 +3,8 @@ package io.legado.app.ui.book.info
import android.content.Context import android.content.Context
import android.view.ViewGroup import android.view.ViewGroup
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.data.entities.BookChapter import io.legado.app.data.entities.BookChapter
import io.legado.app.databinding.ItemChapterListBinding import io.legado.app.databinding.ItemChapterListBinding
import io.legado.app.lib.theme.accentColor import io.legado.app.lib.theme.accentColor
@ -12,7 +12,7 @@ import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.textColorResource import org.jetbrains.anko.textColorResource
class ChapterListAdapter(context: Context, var callBack: CallBack) : class ChapterListAdapter(context: Context, var callBack: CallBack) :
SimpleRecyclerAdapter<BookChapter, ItemChapterListBinding>(context) { CommonRecyclerAdapter<BookChapter, ItemChapterListBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemChapterListBinding { override fun getViewBinding(parent: ViewGroup): ItemChapterListBinding {
return ItemChapterListBinding.inflate(inflater, parent, false) return ItemChapterListBinding.inflate(inflater, parent, false)

@ -19,8 +19,8 @@ import androidx.appcompat.view.menu.MenuBuilder
import androidx.appcompat.view.menu.MenuItemImpl import androidx.appcompat.view.menu.MenuItemImpl
import androidx.core.view.isVisible import androidx.core.view.isVisible
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.databinding.ItemTextBinding import io.legado.app.databinding.ItemTextBinding
import io.legado.app.databinding.PopupActionMenuBinding import io.legado.app.databinding.PopupActionMenuBinding
import io.legado.app.service.BaseReadAloudService import io.legado.app.service.BaseReadAloudService
@ -89,7 +89,7 @@ class TextActionMenu(private val context: Context, private val callBack: CallBac
} }
inner class Adapter(context: Context) : inner class Adapter(context: Context) :
SimpleRecyclerAdapter<MenuItemImpl, ItemTextBinding>(context) { CommonRecyclerAdapter<MenuItemImpl, ItemTextBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemTextBinding { override fun getViewBinding(parent: ViewGroup): ItemTextBinding {
return ItemTextBinding.inflate(inflater, parent, false) return ItemTextBinding.inflate(inflater, parent, false)

@ -13,8 +13,8 @@ import androidx.recyclerview.widget.LinearLayoutManager
import io.legado.app.App import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseDialogFragment import io.legado.app.base.BaseDialogFragment
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.constant.PreferKey import io.legado.app.constant.PreferKey
import io.legado.app.data.entities.HttpTTS import io.legado.app.data.entities.HttpTTS
import io.legado.app.databinding.DialogHttpTtsEditBinding import io.legado.app.databinding.DialogHttpTtsEditBinding
@ -128,7 +128,7 @@ class SpeakEngineDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
} }
inner class Adapter(context: Context) : inner class Adapter(context: Context) :
SimpleRecyclerAdapter<HttpTTS, ItemHttpTtsBinding>(context) { CommonRecyclerAdapter<HttpTTS, ItemHttpTtsBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemHttpTtsBinding { override fun getViewBinding(parent: ViewGroup): ItemHttpTtsBinding {
return ItemHttpTtsBinding.inflate(inflater, parent, false) return ItemHttpTtsBinding.inflate(inflater, parent, false)

@ -17,8 +17,8 @@ import com.google.android.material.snackbar.Snackbar
import io.legado.app.App import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseDialogFragment import io.legado.app.base.BaseDialogFragment
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.data.entities.TxtTocRule import io.legado.app.data.entities.TxtTocRule
import io.legado.app.databinding.DialogEditTextBinding import io.legado.app.databinding.DialogEditTextBinding
import io.legado.app.databinding.DialogTocRegexBinding import io.legado.app.databinding.DialogTocRegexBinding
@ -189,7 +189,7 @@ class TocRegexDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
} }
inner class TocRegexAdapter(context: Context) : inner class TocRegexAdapter(context: Context) :
SimpleRecyclerAdapter<TxtTocRule, ItemTocRegexBinding>(context), CommonRecyclerAdapter<TxtTocRule, ItemTocRegexBinding>(context),
ItemTouchCallback.Callback { ItemTouchCallback.Callback {
override fun getViewBinding(parent: ViewGroup): ItemTocRegexBinding { override fun getViewBinding(parent: ViewGroup): ItemTocRegexBinding {

@ -2,8 +2,8 @@ package io.legado.app.ui.book.search
import android.view.ViewGroup import android.view.ViewGroup
import io.legado.app.App import io.legado.app.App
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder 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.data.entities.SearchKeyword
import io.legado.app.databinding.ItemFilletTextBinding import io.legado.app.databinding.ItemFilletTextBinding
import io.legado.app.ui.widget.anima.explosion_field.ExplosionField import io.legado.app.ui.widget.anima.explosion_field.ExplosionField
@ -15,7 +15,7 @@ import org.jetbrains.anko.sdk27.listeners.onLongClick
class HistoryKeyAdapter(activity: SearchActivity, val callBack: CallBack) : class HistoryKeyAdapter(activity: SearchActivity, val callBack: CallBack) :
SimpleRecyclerAdapter<SearchKeyword, ItemFilletTextBinding>(activity) { CommonRecyclerAdapter<SearchKeyword, ItemFilletTextBinding>(activity) {
private val explosionField = ExplosionField.attach2Window(activity) private val explosionField = ExplosionField.attach2Window(activity)

@ -12,8 +12,8 @@ import androidx.fragment.app.DialogFragment
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import io.legado.app.App import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.constant.AppPattern import io.legado.app.constant.AppPattern
import io.legado.app.databinding.DialogEditTextBinding import io.legado.app.databinding.DialogEditTextBinding
import io.legado.app.databinding.DialogRecyclerViewBinding import io.legado.app.databinding.DialogRecyclerViewBinding
@ -109,7 +109,7 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener {
} }
private inner class GroupAdapter(context: Context) : private inner class GroupAdapter(context: Context) :
SimpleRecyclerAdapter<String, ItemGroupManageBinding>(context) { CommonRecyclerAdapter<String, ItemGroupManageBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemGroupManageBinding { override fun getViewBinding(parent: ViewGroup): ItemGroupManageBinding {
return ItemGroupManageBinding.inflate(inflater, parent, false) return ItemGroupManageBinding.inflate(inflater, parent, false)

@ -3,8 +3,8 @@ package io.legado.app.ui.book.toc
import android.content.Context import android.content.Context
import android.view.ViewGroup import android.view.ViewGroup
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.data.entities.BookChapter import io.legado.app.data.entities.BookChapter
import io.legado.app.databinding.ItemChapterListBinding import io.legado.app.databinding.ItemChapterListBinding
import io.legado.app.lib.theme.accentColor import io.legado.app.lib.theme.accentColor
@ -13,7 +13,7 @@ import io.legado.app.utils.visible
import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.sdk27.listeners.onClick
class ChapterListAdapter(context: Context, val callback: Callback) : class ChapterListAdapter(context: Context, val callback: Callback) :
SimpleRecyclerAdapter<BookChapter, ItemChapterListBinding>(context) { CommonRecyclerAdapter<BookChapter, ItemChapterListBinding>(context) {
val cacheFileNames = hashSetOf<String>() val cacheFileNames = hashSetOf<String>()

@ -9,8 +9,8 @@ import androidx.appcompat.widget.Toolbar
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseDialogFragment import io.legado.app.base.BaseDialogFragment
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.databinding.DialogRecyclerViewBinding import io.legado.app.databinding.DialogRecyclerViewBinding
import io.legado.app.databinding.ItemThemeConfigBinding import io.legado.app.databinding.ItemThemeConfigBinding
import io.legado.app.help.ThemeConfig import io.legado.app.help.ThemeConfig
@ -96,7 +96,7 @@ class ThemeListDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
} }
inner class Adapter : inner class Adapter :
SimpleRecyclerAdapter<ThemeConfig.Config, ItemThemeConfigBinding>(requireContext()) { CommonRecyclerAdapter<ThemeConfig.Config, ItemThemeConfigBinding>(requireContext()) {
override fun getViewBinding(parent: ViewGroup): ItemThemeConfigBinding { override fun getViewBinding(parent: ViewGroup): ItemThemeConfigBinding {
return ItemThemeConfigBinding.inflate(inflater, parent, false) return ItemThemeConfigBinding.inflate(inflater, parent, false)

@ -3,8 +3,8 @@ package io.legado.app.ui.filepicker.adapter
import android.content.Context import android.content.Context
import android.view.ViewGroup import android.view.ViewGroup
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.databinding.ItemFileFilepickerBinding import io.legado.app.databinding.ItemFileFilepickerBinding
import io.legado.app.help.AppConfig import io.legado.app.help.AppConfig
import io.legado.app.lib.theme.getPrimaryDisabledTextColor import io.legado.app.lib.theme.getPrimaryDisabledTextColor
@ -19,7 +19,7 @@ import java.util.*
class FileAdapter(context: Context, val callBack: CallBack) : class FileAdapter(context: Context, val callBack: CallBack) :
SimpleRecyclerAdapter<FileItem, ItemFileFilepickerBinding>(context) { CommonRecyclerAdapter<FileItem, ItemFileFilepickerBinding>(context) {
private var rootPath: String? = null private var rootPath: String? = null
var currentPath: String? = null var currentPath: String? = null
private set private set

@ -3,8 +3,8 @@ package io.legado.app.ui.filepicker.adapter
import android.content.Context import android.content.Context
import android.os.Environment import android.os.Environment
import android.view.ViewGroup import android.view.ViewGroup
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.databinding.ItemPathFilepickerBinding import io.legado.app.databinding.ItemPathFilepickerBinding
import io.legado.app.ui.filepicker.utils.ConvertUtils import io.legado.app.ui.filepicker.utils.ConvertUtils
import io.legado.app.ui.filepicker.utils.FilePickerIcon import io.legado.app.ui.filepicker.utils.FilePickerIcon
@ -13,7 +13,7 @@ import java.util.*
class PathAdapter(context: Context, val callBack: CallBack) : class PathAdapter(context: Context, val callBack: CallBack) :
SimpleRecyclerAdapter<String, ItemPathFilepickerBinding>(context) { CommonRecyclerAdapter<String, ItemPathFilepickerBinding>(context) {
private val paths = LinkedList<String>() private val paths = LinkedList<String>()
private val arrowIcon = ConvertUtils.toDrawable(FilePickerIcon.getArrow()) private val arrowIcon = ConvertUtils.toDrawable(FilePickerIcon.getArrow())

@ -7,8 +7,8 @@ import android.view.ViewGroup
import android.widget.PopupMenu import android.widget.PopupMenu
import io.legado.app.App import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.BookSource
import io.legado.app.databinding.ItemFilletTextBinding import io.legado.app.databinding.ItemFilletTextBinding
import io.legado.app.databinding.ItemFindBookBinding import io.legado.app.databinding.ItemFindBookBinding
@ -24,7 +24,7 @@ import org.jetbrains.anko.sdk27.listeners.onLongClick
class ExploreAdapter(context: Context, private val scope: CoroutineScope, val callBack: CallBack) : class ExploreAdapter(context: Context, private val scope: CoroutineScope, val callBack: CallBack) :
SimpleRecyclerAdapter<BookSource, ItemFindBookBinding>(context) { CommonRecyclerAdapter<BookSource, ItemFindBookBinding>(context) {
private var exIndex = -1 private var exIndex = -1
private var scrollTo = -1 private var scrollTo = -1

@ -12,8 +12,8 @@ import androidx.fragment.app.DialogFragment
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import io.legado.app.App import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.constant.AppPattern import io.legado.app.constant.AppPattern
import io.legado.app.databinding.DialogEditTextBinding import io.legado.app.databinding.DialogEditTextBinding
import io.legado.app.databinding.DialogRecyclerViewBinding import io.legado.app.databinding.DialogRecyclerViewBinding
@ -114,7 +114,7 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener {
} }
private inner class GroupAdapter(context: Context) : private inner class GroupAdapter(context: Context) :
SimpleRecyclerAdapter<String, ItemGroupManageBinding>(context) { CommonRecyclerAdapter<String, ItemGroupManageBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemGroupManageBinding { override fun getViewBinding(parent: ViewGroup): ItemGroupManageBinding {
return ItemGroupManageBinding.inflate(inflater, parent, false) return ItemGroupManageBinding.inflate(inflater, parent, false)

@ -8,8 +8,8 @@ import android.widget.PopupMenu
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.data.entities.ReplaceRule import io.legado.app.data.entities.ReplaceRule
import io.legado.app.databinding.ItemReplaceRuleBinding import io.legado.app.databinding.ItemReplaceRuleBinding
import io.legado.app.lib.theme.backgroundColor import io.legado.app.lib.theme.backgroundColor
@ -20,7 +20,7 @@ import java.util.*
class ReplaceRuleAdapter(context: Context, var callBack: CallBack) : class ReplaceRuleAdapter(context: Context, var callBack: CallBack) :
SimpleRecyclerAdapter<ReplaceRule, ItemReplaceRuleBinding>(context), CommonRecyclerAdapter<ReplaceRule, ItemReplaceRuleBinding>(context),
ItemTouchCallback.Callback { ItemTouchCallback.Callback {
private val selected = linkedSetOf<ReplaceRule>() private val selected = linkedSetOf<ReplaceRule>()

@ -7,8 +7,8 @@ import com.bumptech.glide.load.DataSource
import com.bumptech.glide.load.engine.GlideException import com.bumptech.glide.load.engine.GlideException
import com.bumptech.glide.request.RequestListener import com.bumptech.glide.request.RequestListener
import com.bumptech.glide.request.target.Target import com.bumptech.glide.request.target.Target
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.data.entities.RssStar import io.legado.app.data.entities.RssStar
import io.legado.app.databinding.ItemRssArticleBinding import io.legado.app.databinding.ItemRssArticleBinding
import io.legado.app.help.ImageLoader import io.legado.app.help.ImageLoader
@ -17,7 +17,7 @@ import io.legado.app.utils.visible
import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.sdk27.listeners.onClick
class RssFavoritesAdapter(context: Context, val callBack: CallBack) : class RssFavoritesAdapter(context: Context, val callBack: CallBack) :
SimpleRecyclerAdapter<RssStar, ItemRssArticleBinding>(context) { CommonRecyclerAdapter<RssStar, ItemRssArticleBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemRssArticleBinding { override fun getViewBinding(parent: ViewGroup): ItemRssArticleBinding {
return ItemRssArticleBinding.inflate(inflater, parent, false) return ItemRssArticleBinding.inflate(inflater, parent, false)

@ -12,8 +12,8 @@ import androidx.recyclerview.widget.LinearLayoutManager
import io.legado.app.App import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseDialogFragment import io.legado.app.base.BaseDialogFragment
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.constant.AppPattern import io.legado.app.constant.AppPattern
import io.legado.app.databinding.DialogEditTextBinding import io.legado.app.databinding.DialogEditTextBinding
import io.legado.app.databinding.DialogRecyclerViewBinding import io.legado.app.databinding.DialogRecyclerViewBinding
@ -113,7 +113,7 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
} }
private inner class GroupAdapter(context: Context) : private inner class GroupAdapter(context: Context) :
SimpleRecyclerAdapter<String, ItemGroupManageBinding>(context) { CommonRecyclerAdapter<String, ItemGroupManageBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemGroupManageBinding { override fun getViewBinding(parent: ViewGroup): ItemGroupManageBinding {
return ItemGroupManageBinding.inflate(inflater, parent, false) return ItemGroupManageBinding.inflate(inflater, parent, false)

@ -6,15 +6,15 @@ import android.view.ViewGroup
import android.widget.PopupMenu import android.widget.PopupMenu
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.data.entities.RuleSub import io.legado.app.data.entities.RuleSub
import io.legado.app.databinding.ItemRuleSubBinding import io.legado.app.databinding.ItemRuleSubBinding
import io.legado.app.ui.widget.recycler.ItemTouchCallback import io.legado.app.ui.widget.recycler.ItemTouchCallback
import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.sdk27.listeners.onClick
class RuleSubAdapter(context: Context, val callBack: Callback) : class RuleSubAdapter(context: Context, val callBack: Callback) :
SimpleRecyclerAdapter<RuleSub, ItemRuleSubBinding>(context), CommonRecyclerAdapter<RuleSub, ItemRuleSubBinding>(context),
ItemTouchCallback.Callback { ItemTouchCallback.Callback {
private val typeArray = context.resources.getStringArray(R.array.rule_type) private val typeArray = context.resources.getStringArray(R.array.rule_type)

@ -6,8 +6,8 @@ import android.view.ViewGroup
import android.widget.PopupWindow import android.widget.PopupWindow
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.databinding.ItemFilletTextBinding import io.legado.app.databinding.ItemFilletTextBinding
import io.legado.app.databinding.PopupKeyboardToolBinding import io.legado.app.databinding.PopupKeyboardToolBinding
import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.sdk27.listeners.onClick
@ -40,7 +40,7 @@ class KeyboardToolPop(
} }
inner class Adapter(context: Context) : inner class Adapter(context: Context) :
SimpleRecyclerAdapter<String, ItemFilletTextBinding>(context) { CommonRecyclerAdapter<String, ItemFilletTextBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemFilletTextBinding { override fun getViewBinding(parent: ViewGroup): ItemFilletTextBinding {
return ItemFilletTextBinding.inflate(inflater, parent, false) return ItemFilletTextBinding.inflate(inflater, parent, false)

@ -9,8 +9,8 @@ import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseDialogFragment import io.legado.app.base.BaseDialogFragment
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.databinding.DialogRecyclerViewBinding import io.legado.app.databinding.DialogRecyclerViewBinding
import io.legado.app.databinding.ItemLogBinding import io.legado.app.databinding.ItemLogBinding
import io.legado.app.utils.getSize import io.legado.app.utils.getSize
@ -59,7 +59,7 @@ class TextListDialog : BaseDialogFragment() {
} }
class TextAdapter(context: Context) : class TextAdapter(context: Context) :
SimpleRecyclerAdapter<String, ItemLogBinding>(context) { CommonRecyclerAdapter<String, ItemLogBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemLogBinding { override fun getViewBinding(parent: ViewGroup): ItemLogBinding {
return ItemLogBinding.inflate(inflater, parent, false) return ItemLogBinding.inflate(inflater, parent, false)

@ -4,8 +4,8 @@ import android.content.Context
import android.graphics.Typeface import android.graphics.Typeface
import android.os.Build import android.os.Build
import android.view.ViewGroup import android.view.ViewGroup
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.databinding.ItemFontBinding import io.legado.app.databinding.ItemFontBinding
import io.legado.app.utils.DocItem import io.legado.app.utils.DocItem
import io.legado.app.utils.RealPathUtil import io.legado.app.utils.RealPathUtil
@ -16,7 +16,7 @@ import org.jetbrains.anko.toast
import java.io.File import java.io.File
class FontAdapter(context: Context, val callBack: CallBack) : class FontAdapter(context: Context, val callBack: CallBack) :
SimpleRecyclerAdapter<DocItem, ItemFontBinding>(context) { CommonRecyclerAdapter<DocItem, ItemFontBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemFontBinding { override fun getViewBinding(parent: ViewGroup): ItemFontBinding {
return ItemFontBinding.inflate(inflater, parent, false) return ItemFontBinding.inflate(inflater, parent, false)

@ -15,8 +15,8 @@ import androidx.preference.PreferenceViewHolder
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseDialogFragment import io.legado.app.base.BaseDialogFragment
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.databinding.DialogRecyclerViewBinding import io.legado.app.databinding.DialogRecyclerViewBinding
import io.legado.app.databinding.ItemIconPreferenceBinding import io.legado.app.databinding.ItemIconPreferenceBinding
import io.legado.app.lib.theme.primaryColor import io.legado.app.lib.theme.primaryColor
@ -156,7 +156,7 @@ class IconListPreference(context: Context, attrs: AttributeSet) : ListPreference
inner class Adapter(context: Context) : inner class Adapter(context: Context) :
SimpleRecyclerAdapter<CharSequence, ItemIconPreferenceBinding>(context) { CommonRecyclerAdapter<CharSequence, ItemIconPreferenceBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemIconPreferenceBinding { override fun getViewBinding(parent: ViewGroup): ItemIconPreferenceBinding {
return ItemIconPreferenceBinding.inflate(inflater, parent, false) return ItemIconPreferenceBinding.inflate(inflater, parent, false)

Loading…
Cancel
Save