From ea507382a7a5d7f2e967e905c4aaa9b464199300 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 16 Dec 2020 09:42:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/base/adapter/SimpleRecyclerAdapter.kt | 13 +------------ .../io/legado/app/ui/about/ReadRecordActivity.kt | 4 ++-- .../app/ui/association/ImportBookSourceDialog.kt | 4 ++-- .../app/ui/association/ImportRssSourceDialog.kt | 4 ++-- .../app/ui/book/arrange/ArrangeBookAdapter.kt | 5 +++-- .../io/legado/app/ui/book/cache/CacheAdapter.kt | 4 ++-- .../legado/app/ui/book/group/GroupSelectDialog.kt | 4 ++-- .../legado/app/ui/book/info/ChapterListAdapter.kt | 4 ++-- .../io/legado/app/ui/book/read/TextActionMenu.kt | 4 ++-- .../app/ui/book/read/config/SpeakEngineDialog.kt | 4 ++-- .../app/ui/book/read/config/TocRegexDialog.kt | 4 ++-- .../legado/app/ui/book/search/HistoryKeyAdapter.kt | 4 ++-- .../app/ui/book/source/manage/GroupManageDialog.kt | 4 ++-- .../io/legado/app/ui/book/toc/ChapterListAdapter.kt | 4 ++-- .../java/io/legado/app/ui/config/ThemeListDialog.kt | 4 ++-- .../legado/app/ui/filepicker/adapter/FileAdapter.kt | 4 ++-- .../legado/app/ui/filepicker/adapter/PathAdapter.kt | 4 ++-- .../io/legado/app/ui/main/explore/ExploreAdapter.kt | 4 ++-- .../io/legado/app/ui/replace/GroupManageDialog.kt | 4 ++-- .../io/legado/app/ui/replace/ReplaceRuleAdapter.kt | 4 ++-- .../app/ui/rss/favorites/RssFavoritesAdapter.kt | 4 ++-- .../app/ui/rss/source/manage/GroupManageDialog.kt | 4 ++-- .../app/ui/rss/subscription/RuleSubAdapter.kt | 4 ++-- .../java/io/legado/app/ui/widget/KeyboardToolPop.kt | 4 ++-- .../legado/app/ui/widget/dialog/TextListDialog.kt | 4 ++-- .../io/legado/app/ui/widget/font/FontAdapter.kt | 4 ++-- .../app/ui/widget/prefs/IconListPreference.kt | 4 ++-- 27 files changed, 54 insertions(+), 64 deletions(-) diff --git a/app/src/main/java/io/legado/app/base/adapter/SimpleRecyclerAdapter.kt b/app/src/main/java/io/legado/app/base/adapter/SimpleRecyclerAdapter.kt index f8c5e7e85..d684449a4 100644 --- a/app/src/main/java/io/legado/app/base/adapter/SimpleRecyclerAdapter.kt +++ b/app/src/main/java/io/legado/app/base/adapter/SimpleRecyclerAdapter.kt @@ -31,18 +31,7 @@ abstract class SimpleRecyclerAdapter(protected val conte var itemAnimation: ItemAnimation? = null - open val diffItemCallback: DiffUtil.ItemCallback = - object : DiffUtil.ItemCallback() { - - override fun areItemsTheSame(oldItem: ITEM, newItem: ITEM): Boolean { - return false - } - - override fun areContentsTheSame(oldItem: ITEM, newItem: ITEM): Boolean { - return true - } - - } + abstract val diffItemCallback: DiffUtil.ItemCallback fun setOnItemClickListener(listener: (holder: ItemViewHolder, item: ITEM) -> Unit) { itemClickListener = listener diff --git a/app/src/main/java/io/legado/app/ui/about/ReadRecordActivity.kt b/app/src/main/java/io/legado/app/ui/about/ReadRecordActivity.kt index 58d2cd1a3..45659854b 100644 --- a/app/src/main/java/io/legado/app/ui/about/ReadRecordActivity.kt +++ b/app/src/main/java/io/legado/app/ui/about/ReadRecordActivity.kt @@ -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.SimpleRecyclerAdapter 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() { } inner class RecordAdapter(context: Context) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { override fun getViewBinding(parent: ViewGroup): ItemReadRecordBinding { return ItemReadRecordBinding.inflate(inflater, parent, false) diff --git a/app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt b/app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt index ef89a5097..d37c1cc3a 100644 --- a/app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt +++ b/app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { override fun getViewBinding(parent: ViewGroup): ItemSourceImportBinding { return ItemSourceImportBinding.inflate(inflater, parent, false) diff --git a/app/src/main/java/io/legado/app/ui/association/ImportRssSourceDialog.kt b/app/src/main/java/io/legado/app/ui/association/ImportRssSourceDialog.kt index 9753ac7f0..7c3fa1591 100644 --- a/app/src/main/java/io/legado/app/ui/association/ImportRssSourceDialog.kt +++ b/app/src/main/java/io/legado/app/ui/association/ImportRssSourceDialog.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { override fun getViewBinding(parent: ViewGroup): ItemSourceImportBinding { return ItemSourceImportBinding.inflate(inflater, parent, false) diff --git a/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookAdapter.kt b/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookAdapter.kt index af566ed2c..afb865e24 100644 --- a/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookAdapter.kt @@ -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.SimpleRecyclerAdapter import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookGroup import io.legado.app.databinding.ItemArrangeBookBinding @@ -18,7 +18,8 @@ import org.jetbrains.anko.sdk27.listeners.onClick import java.util.* class ArrangeBookAdapter(context: Context, val callBack: CallBack) : - SimpleRecyclerAdapter(context), + CommonRecyclerAdapter(context), + ItemTouchCallback.Callback { val groupRequestCode = 12 private val selectedBooks: HashSet = hashSetOf() diff --git a/app/src/main/java/io/legado/app/ui/book/cache/CacheAdapter.kt b/app/src/main/java/io/legado/app/ui/book/cache/CacheAdapter.kt index e28572e93..d936f0d17 100644 --- a/app/src/main/java/io/legado/app/ui/book/cache/CacheAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/cache/CacheAdapter.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { val cacheChapters = hashMapOf>() var downloadMap: ConcurrentHashMap>? = null diff --git a/app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt b/app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt index b341e6db9..23f4d6cb5 100644 --- a/app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context), + CommonRecyclerAdapter(context), ItemTouchCallback.Callback { private var isMoved: Boolean = false diff --git a/app/src/main/java/io/legado/app/ui/book/info/ChapterListAdapter.kt b/app/src/main/java/io/legado/app/ui/book/info/ChapterListAdapter.kt index 38a8c37e2..a7ad5ef6b 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/ChapterListAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/ChapterListAdapter.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { override fun getViewBinding(parent: ViewGroup): ItemChapterListBinding { return ItemChapterListBinding.inflate(inflater, parent, false) diff --git a/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt index 5d0946903..48c74e2bd 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { override fun getViewBinding(parent: ViewGroup): ItemTextBinding { return ItemTextBinding.inflate(inflater, parent, false) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt index 43d09c391..92c857d99 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { override fun getViewBinding(parent: ViewGroup): ItemHttpTtsBinding { return ItemHttpTtsBinding.inflate(inflater, parent, false) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt index 9899a5378..1c4252c3c 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context), + CommonRecyclerAdapter(context), ItemTouchCallback.Callback { override fun getViewBinding(parent: ViewGroup): ItemTocRegexBinding { diff --git a/app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt b/app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt index 5500573ac..7417c16c3 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(activity) { + CommonRecyclerAdapter(activity) { private val explosionField = ExplosionField.attach2Window(activity) diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt index 01483ad62..1a221453c 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { override fun getViewBinding(parent: ViewGroup): ItemGroupManageBinding { return ItemGroupManageBinding.inflate(inflater, parent, false) diff --git a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt b/app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt index bb1c7c53a..f0409de61 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { val cacheFileNames = hashSetOf() diff --git a/app/src/main/java/io/legado/app/ui/config/ThemeListDialog.kt b/app/src/main/java/io/legado/app/ui/config/ThemeListDialog.kt index 06cacaf1a..656490788 100644 --- a/app/src/main/java/io/legado/app/ui/config/ThemeListDialog.kt +++ b/app/src/main/java/io/legado/app/ui/config/ThemeListDialog.kt @@ -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.SimpleRecyclerAdapter 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 : - SimpleRecyclerAdapter(requireContext()) { + CommonRecyclerAdapter(requireContext()) { override fun getViewBinding(parent: ViewGroup): ItemThemeConfigBinding { return ItemThemeConfigBinding.inflate(inflater, parent, false) diff --git a/app/src/main/java/io/legado/app/ui/filepicker/adapter/FileAdapter.kt b/app/src/main/java/io/legado/app/ui/filepicker/adapter/FileAdapter.kt index 999157497..e59a59b9a 100644 --- a/app/src/main/java/io/legado/app/ui/filepicker/adapter/FileAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/filepicker/adapter/FileAdapter.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { private var rootPath: String? = null var currentPath: String? = null private set diff --git a/app/src/main/java/io/legado/app/ui/filepicker/adapter/PathAdapter.kt b/app/src/main/java/io/legado/app/ui/filepicker/adapter/PathAdapter.kt index f0d9b300f..88c2d9a9f 100644 --- a/app/src/main/java/io/legado/app/ui/filepicker/adapter/PathAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/filepicker/adapter/PathAdapter.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { private val paths = LinkedList() private val arrowIcon = ConvertUtils.toDrawable(FilePickerIcon.getArrow()) diff --git a/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt b/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt index 6532b63fb..98b935638 100644 --- a/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { private var exIndex = -1 private var scrollTo = -1 diff --git a/app/src/main/java/io/legado/app/ui/replace/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/replace/GroupManageDialog.kt index 33dfd191e..c2b8941de 100644 --- a/app/src/main/java/io/legado/app/ui/replace/GroupManageDialog.kt +++ b/app/src/main/java/io/legado/app/ui/replace/GroupManageDialog.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { override fun getViewBinding(parent: ViewGroup): ItemGroupManageBinding { return ItemGroupManageBinding.inflate(inflater, parent, false) diff --git a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleAdapter.kt b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleAdapter.kt index 4de23aadc..48ac5eec1 100644 --- a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleAdapter.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context), + CommonRecyclerAdapter(context), ItemTouchCallback.Callback { private val selected = linkedSetOf() diff --git a/app/src/main/java/io/legado/app/ui/rss/favorites/RssFavoritesAdapter.kt b/app/src/main/java/io/legado/app/ui/rss/favorites/RssFavoritesAdapter.kt index b5c921ff7..f630ec25e 100644 --- a/app/src/main/java/io/legado/app/ui/rss/favorites/RssFavoritesAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/rss/favorites/RssFavoritesAdapter.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { override fun getViewBinding(parent: ViewGroup): ItemRssArticleBinding { return ItemRssArticleBinding.inflate(inflater, parent, false) diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/GroupManageDialog.kt index e9d6cae62..b467131d4 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/manage/GroupManageDialog.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/GroupManageDialog.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { override fun getViewBinding(parent: ViewGroup): ItemGroupManageBinding { return ItemGroupManageBinding.inflate(inflater, parent, false) diff --git a/app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubAdapter.kt b/app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubAdapter.kt index 520c27445..0efea8371 100644 --- a/app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubAdapter.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context), + CommonRecyclerAdapter(context), ItemTouchCallback.Callback { private val typeArray = context.resources.getStringArray(R.array.rule_type) diff --git a/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt b/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt index aa8f71f04..e0b66934a 100644 --- a/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt +++ b/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { override fun getViewBinding(parent: ViewGroup): ItemFilletTextBinding { return ItemFilletTextBinding.inflate(inflater, parent, false) diff --git a/app/src/main/java/io/legado/app/ui/widget/dialog/TextListDialog.kt b/app/src/main/java/io/legado/app/ui/widget/dialog/TextListDialog.kt index 567f1687a..4c0643ba1 100644 --- a/app/src/main/java/io/legado/app/ui/widget/dialog/TextListDialog.kt +++ b/app/src/main/java/io/legado/app/ui/widget/dialog/TextListDialog.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { override fun getViewBinding(parent: ViewGroup): ItemLogBinding { return ItemLogBinding.inflate(inflater, parent, false) diff --git a/app/src/main/java/io/legado/app/ui/widget/font/FontAdapter.kt b/app/src/main/java/io/legado/app/ui/widget/font/FontAdapter.kt index 53b812fa7..73559cd1f 100644 --- a/app/src/main/java/io/legado/app/ui/widget/font/FontAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/widget/font/FontAdapter.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { override fun getViewBinding(parent: ViewGroup): ItemFontBinding { return ItemFontBinding.inflate(inflater, parent, false) diff --git a/app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt b/app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt index 8ed75bbd2..9cad1cdb7 100644 --- a/app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt +++ b/app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt @@ -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.SimpleRecyclerAdapter 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) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { override fun getViewBinding(parent: ViewGroup): ItemIconPreferenceBinding { return ItemIconPreferenceBinding.inflate(inflater, parent, false)