优化代码

pull/737/head
gedoor 4 years ago
parent e58cb1f0cc
commit 9c50359568
  1. 2
      app/src/main/java/io/legado/app/base/adapter/InfiniteScrollListener.kt
  2. 2
      app/src/main/java/io/legado/app/base/adapter/RecyclerAdapter.kt
  3. 4
      app/src/main/java/io/legado/app/ui/about/ReadRecordActivity.kt
  4. 4
      app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt
  5. 4
      app/src/main/java/io/legado/app/ui/association/ImportRssSourceDialog.kt
  6. 4
      app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookAdapter.kt
  7. 4
      app/src/main/java/io/legado/app/ui/book/cache/CacheAdapter.kt
  8. 4
      app/src/main/java/io/legado/app/ui/book/explore/ExploreShowAdapter.kt
  9. 4
      app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt
  10. 4
      app/src/main/java/io/legado/app/ui/book/info/ChapterListAdapter.kt
  11. 4
      app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt
  12. 4
      app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt
  13. 4
      app/src/main/java/io/legado/app/ui/book/read/config/BgAdapter.kt
  14. 4
      app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt
  15. 4
      app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt
  16. 4
      app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt
  17. 4
      app/src/main/java/io/legado/app/ui/book/search/BookAdapter.kt
  18. 4
      app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt
  19. 4
      app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt
  20. 4
      app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentAdapter.kt
  21. 4
      app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugAdapter.kt
  22. 4
      app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt
  23. 4
      app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt
  24. 4
      app/src/main/java/io/legado/app/ui/config/ThemeListDialog.kt
  25. 4
      app/src/main/java/io/legado/app/ui/filepicker/adapter/FileAdapter.kt
  26. 4
      app/src/main/java/io/legado/app/ui/filepicker/adapter/PathAdapter.kt
  27. 4
      app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt
  28. 4
      app/src/main/java/io/legado/app/ui/main/rss/RssAdapter.kt
  29. 4
      app/src/main/java/io/legado/app/ui/replace/GroupManageDialog.kt
  30. 4
      app/src/main/java/io/legado/app/ui/replace/ReplaceRuleAdapter.kt
  31. 4
      app/src/main/java/io/legado/app/ui/rss/article/BaseRssArticlesAdapter.kt
  32. 4
      app/src/main/java/io/legado/app/ui/rss/favorites/RssFavoritesAdapter.kt
  33. 4
      app/src/main/java/io/legado/app/ui/rss/source/debug/RssSourceDebugAdapter.kt
  34. 4
      app/src/main/java/io/legado/app/ui/rss/source/manage/GroupManageDialog.kt
  35. 4
      app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubAdapter.kt
  36. 4
      app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt
  37. 4
      app/src/main/java/io/legado/app/ui/widget/dialog/TextListDialog.kt
  38. 4
      app/src/main/java/io/legado/app/ui/widget/font/FontAdapter.kt
  39. 4
      app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt

@ -9,7 +9,7 @@ import androidx.recyclerview.widget.RecyclerView
* 上拉加载更多
*/
@Suppress("unused")
abstract class InfiniteScrollListener() : RecyclerView.OnScrollListener() {
abstract class InfiniteScrollListener : RecyclerView.OnScrollListener() {
private val loadMoreRunnable = Runnable { onLoadMore() }
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {

@ -16,7 +16,7 @@ import java.util.*
* 通用的adapter 可添加headerfooter以及不同类型item
*/
@Suppress("unused", "MemberVisibilityCanBePrivate")
abstract class CommonRecyclerAdapter<ITEM, VB : ViewBinding>(protected val context: Context) :
abstract class RecyclerAdapter<ITEM, VB : ViewBinding>(protected val context: Context) :
RecyclerView.Adapter<ItemViewHolder>() {
val inflater: LayoutInflater = LayoutInflater.from(context)

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

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

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

@ -5,8 +5,8 @@ import android.view.View
import android.view.ViewGroup
import androidx.core.os.bundleOf
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.RecyclerAdapter
import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookGroup
import io.legado.app.databinding.ItemArrangeBookBinding
@ -18,7 +18,7 @@ import org.jetbrains.anko.sdk27.listeners.onClick
import java.util.*
class ArrangeBookAdapter(context: Context, val callBack: CallBack) :
CommonRecyclerAdapter<Book, ItemArrangeBookBinding>(context),
RecyclerAdapter<Book, ItemArrangeBookBinding>(context),
ItemTouchCallback.Callback {
val groupRequestCode = 12

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

@ -3,8 +3,8 @@ package io.legado.app.ui.book.explore
import android.content.Context
import android.view.ViewGroup
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.RecyclerAdapter
import io.legado.app.data.entities.Book
import io.legado.app.data.entities.SearchBook
import io.legado.app.databinding.ItemSearchBinding
@ -13,7 +13,7 @@ import io.legado.app.utils.visible
import org.jetbrains.anko.sdk27.listeners.onClick
class ExploreShowAdapter(context: Context, val callBack: CallBack) :
CommonRecyclerAdapter<SearchBook, ItemSearchBinding>(context) {
RecyclerAdapter<SearchBook, ItemSearchBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemSearchBinding {
return ItemSearchBinding.inflate(inflater, parent, false)

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

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

@ -4,8 +4,8 @@ import android.content.Context
import android.net.Uri
import android.view.ViewGroup
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.RecyclerAdapter
import io.legado.app.constant.AppConst
import io.legado.app.databinding.ItemImportBookBinding
import io.legado.app.utils.*
@ -13,7 +13,7 @@ import org.jetbrains.anko.sdk27.listeners.onClick
class ImportBookAdapter(context: Context, val callBack: CallBack) :
CommonRecyclerAdapter<DocItem, ItemImportBookBinding>(context) {
RecyclerAdapter<DocItem, ItemImportBookBinding>(context) {
var selectedUris = hashSetOf<String>()
var checkableCount = 0
private var bookFileNames = arrayListOf<String>()

@ -19,8 +19,8 @@ import androidx.appcompat.view.menu.MenuBuilder
import androidx.appcompat.view.menu.MenuItemImpl
import androidx.core.view.isVisible
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.RecyclerAdapter
import io.legado.app.databinding.ItemTextBinding
import io.legado.app.databinding.PopupActionMenuBinding
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) :
CommonRecyclerAdapter<MenuItemImpl, ItemTextBinding>(context) {
RecyclerAdapter<MenuItemImpl, ItemTextBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemTextBinding {
return ItemTextBinding.inflate(inflater, parent, false)

@ -2,8 +2,8 @@ package io.legado.app.ui.book.read.config
import android.content.Context
import android.view.ViewGroup
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.RecyclerAdapter
import io.legado.app.constant.EventBus
import io.legado.app.databinding.ItemBgImageBinding
import io.legado.app.help.ImageLoader
@ -13,7 +13,7 @@ import org.jetbrains.anko.sdk27.listeners.onClick
import java.io.File
class BgAdapter(context: Context, val textColor: Int) :
CommonRecyclerAdapter<String, ItemBgImageBinding>(context) {
RecyclerAdapter<String, ItemBgImageBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemBgImageBinding {
return ItemBgImageBinding.inflate(inflater, parent, false)

@ -6,8 +6,8 @@ import android.view.*
import androidx.core.view.get
import io.legado.app.R
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.RecyclerAdapter
import io.legado.app.constant.EventBus
import io.legado.app.databinding.DialogReadBookStyleBinding
import io.legado.app.databinding.ItemReadStyleBinding
@ -207,7 +207,7 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
}
inner class StyleAdapter :
CommonRecyclerAdapter<ReadBookConfig.Config, ItemReadStyleBinding>(requireContext()) {
RecyclerAdapter<ReadBookConfig.Config, ItemReadStyleBinding>(requireContext()) {
override fun getViewBinding(parent: ViewGroup): ItemReadStyleBinding {
return ItemReadStyleBinding.inflate(inflater, parent, false)

@ -13,8 +13,8 @@ import androidx.recyclerview.widget.LinearLayoutManager
import io.legado.app.App
import io.legado.app.R
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.RecyclerAdapter
import io.legado.app.constant.PreferKey
import io.legado.app.data.entities.HttpTTS
import io.legado.app.databinding.DialogHttpTtsEditBinding
@ -128,7 +128,7 @@ class SpeakEngineDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
}
inner class Adapter(context: Context) :
CommonRecyclerAdapter<HttpTTS, ItemHttpTtsBinding>(context) {
RecyclerAdapter<HttpTTS, ItemHttpTtsBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemHttpTtsBinding {
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.R
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.RecyclerAdapter
import io.legado.app.data.entities.TxtTocRule
import io.legado.app.databinding.DialogEditTextBinding
import io.legado.app.databinding.DialogTocRegexBinding
@ -189,7 +189,7 @@ class TocRegexDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
}
inner class TocRegexAdapter(context: Context) :
CommonRecyclerAdapter<TxtTocRule, ItemTocRegexBinding>(context),
RecyclerAdapter<TxtTocRule, ItemTocRegexBinding>(context),
ItemTouchCallback.Callback {
override fun getViewBinding(parent: ViewGroup): ItemTocRegexBinding {

@ -2,14 +2,14 @@ package io.legado.app.ui.book.search
import android.content.Context
import android.view.ViewGroup
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.RecyclerAdapter
import io.legado.app.data.entities.Book
import io.legado.app.databinding.ItemFilletTextBinding
import org.jetbrains.anko.sdk27.listeners.onClick
class BookAdapter(context: Context, val callBack: CallBack) :
CommonRecyclerAdapter<Book, ItemFilletTextBinding>(context) {
RecyclerAdapter<Book, ItemFilletTextBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemFilletTextBinding {
return ItemFilletTextBinding.inflate(inflater, parent, false)

@ -2,8 +2,8 @@ package io.legado.app.ui.book.search
import android.view.ViewGroup
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.RecyclerAdapter
import io.legado.app.data.entities.SearchKeyword
import io.legado.app.databinding.ItemFilletTextBinding
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) :
CommonRecyclerAdapter<SearchKeyword, ItemFilletTextBinding>(activity) {
RecyclerAdapter<SearchKeyword, ItemFilletTextBinding>(activity) {
private val explosionField = ExplosionField.attach2Window(activity)

@ -4,8 +4,8 @@ import android.content.Context
import android.os.Bundle
import android.view.ViewGroup
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.RecyclerAdapter
import io.legado.app.data.entities.SearchBook
import io.legado.app.databinding.ItemSearchBinding
import io.legado.app.utils.gone
@ -13,7 +13,7 @@ import io.legado.app.utils.visible
import org.jetbrains.anko.sdk27.listeners.onClick
class SearchAdapter(context: Context, val callBack: CallBack) :
CommonRecyclerAdapter<SearchBook, ItemSearchBinding>(context) {
RecyclerAdapter<SearchBook, ItemSearchBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemSearchBinding {
return ItemSearchBinding.inflate(inflater, parent, false)

@ -3,8 +3,8 @@ package io.legado.app.ui.book.searchContent
import android.content.Context
import android.view.ViewGroup
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.RecyclerAdapter
import io.legado.app.databinding.ItemSearchListBinding
import io.legado.app.lib.theme.accentColor
import io.legado.app.utils.getCompatColor
@ -12,7 +12,7 @@ import io.legado.app.utils.hexString
import org.jetbrains.anko.sdk27.listeners.onClick
class SearchContentAdapter(context: Context, val callback: Callback) :
CommonRecyclerAdapter<SearchResult, ItemSearchListBinding>(context) {
RecyclerAdapter<SearchResult, ItemSearchListBinding>(context) {
val cacheFileNames = hashSetOf<String>()
val textColor = context.getCompatColor(R.color.primaryText).hexString.substring(2)

@ -4,12 +4,12 @@ import android.content.Context
import android.view.View
import android.view.ViewGroup
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.RecyclerAdapter
import io.legado.app.databinding.ItemLogBinding
class BookSourceDebugAdapter(context: Context) :
CommonRecyclerAdapter<String, ItemLogBinding>(context) {
RecyclerAdapter<String, ItemLogBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemLogBinding {
return ItemLogBinding.inflate(inflater, parent, false)

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

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

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

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

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

@ -7,8 +7,8 @@ import android.view.ViewGroup
import android.widget.PopupMenu
import io.legado.app.App
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.RecyclerAdapter
import io.legado.app.data.entities.BookSource
import io.legado.app.databinding.ItemFilletTextBinding
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) :
CommonRecyclerAdapter<BookSource, ItemFindBookBinding>(context) {
RecyclerAdapter<BookSource, ItemFindBookBinding>(context) {
private var exIndex = -1
private var scrollTo = -1

@ -5,8 +5,8 @@ import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.PopupMenu
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.RecyclerAdapter
import io.legado.app.data.entities.RssSource
import io.legado.app.databinding.ItemRssBinding
import io.legado.app.help.ImageLoader
@ -14,7 +14,7 @@ import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick
class RssAdapter(context: Context, val callBack: CallBack) :
CommonRecyclerAdapter<RssSource, ItemRssBinding>(context) {
RecyclerAdapter<RssSource, ItemRssBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemRssBinding {
return ItemRssBinding.inflate(inflater, parent, false)

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

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

@ -2,12 +2,12 @@ package io.legado.app.ui.rss.article
import android.content.Context
import androidx.viewbinding.ViewBinding
import io.legado.app.base.adapter.CommonRecyclerAdapter
import io.legado.app.base.adapter.RecyclerAdapter
import io.legado.app.data.entities.RssArticle
abstract class BaseRssArticlesAdapter<VB : ViewBinding>(context: Context, val callBack: CallBack) :
CommonRecyclerAdapter<RssArticle, VB>(context) {
RecyclerAdapter<RssArticle, VB>(context) {
interface CallBack {
val isGridLayout: Boolean

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

@ -4,12 +4,12 @@ import android.content.Context
import android.view.View
import android.view.ViewGroup
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.RecyclerAdapter
import io.legado.app.databinding.ItemLogBinding
class RssSourceDebugAdapter(context: Context) :
CommonRecyclerAdapter<String, ItemLogBinding>(context) {
RecyclerAdapter<String, ItemLogBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemLogBinding {
return ItemLogBinding.inflate(inflater, parent, false)

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

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

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

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

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

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

Loading…
Cancel
Save