From c96730885943dfad52692ccb4d10d60ea1d3c6de Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 22 Apr 2020 09:17:23 -0400 Subject: [PATCH] Replace deprecated adapterPosition with bindingAdapterPosition --- .../kanade/tachiyomi/ui/download/DownloadHolder.kt | 6 +++--- .../kanade/tachiyomi/ui/extension/ExtensionHolder.kt | 2 +- .../kanade/tachiyomi/ui/manga/track/TrackHolder.kt | 12 ++++++------ .../eu/kanade/tachiyomi/ui/migration/SourceHolder.kt | 2 +- .../tachiyomi/ui/recent/updates/UpdatesHolder.kt | 2 +- .../eu/kanade/tachiyomi/ui/source/SourceHolder.kt | 4 ++-- .../ui/source/browse/BrowseSourceController.kt | 2 +- .../ui/source/global_search/GlobalSearchAdapter.kt | 4 ++-- .../source/global_search/GlobalSearchCardHolder.kt | 4 ++-- .../source/global_search/GlobalSearchController.kt | 2 +- .../ui/source/global_search/GlobalSearchHolder.kt | 2 +- 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadHolder.kt index 0f1ea754e5..939113b9cd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadHolder.kt @@ -81,11 +81,11 @@ class DownloadHolder(private val view: View, val adapter: DownloadAdapter) : private fun showPopupMenu(view: View) { view.popupMenu(R.menu.download_single, { - findItem(R.id.move_to_top).isVisible = adapterPosition != 0 + findItem(R.id.move_to_top).isVisible = bindingAdapterPosition != 0 findItem(R.id.move_to_bottom).isVisible = - adapterPosition != adapter.itemCount - 1 + bindingAdapterPosition != adapter.itemCount - 1 }, { - adapter.downloadItemListener.onMenuItemClick(adapterPosition, this) + adapter.downloadItemListener.onMenuItemClick(bindingAdapterPosition, this) true }) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionHolder.kt index 6e3d667666..53f2b5b7ce 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionHolder.kt @@ -30,7 +30,7 @@ class ExtensionHolder(view: View, override val adapter: ExtensionAdapter) : init { ext_button.setOnClickListener { - adapter.buttonClickListener.onButtonClick(adapterPosition) + adapter.buttonClickListener.onButtonClick(bindingAdapterPosition) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackHolder.kt index c34ea614de..4a8a59ad99 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackHolder.kt @@ -18,12 +18,12 @@ class TrackHolder(view: View, adapter: TrackAdapter) : BaseViewHolder(view) { init { val listener = adapter.rowClickListener - logo_container.setOnClickListener { listener.onLogoClick(adapterPosition) } - track_set.setOnClickListener { listener.onSetClick(adapterPosition) } - track_title.setOnClickListener { listener.onSetClick(adapterPosition) } - track_status.setOnClickListener { listener.onStatusClick(adapterPosition) } - track_chapters.setOnClickListener { listener.onChaptersClick(adapterPosition) } - track_score.setOnClickListener { listener.onScoreClick(adapterPosition) } + logo_container.setOnClickListener { listener.onLogoClick(bindingAdapterPosition) } + track_set.setOnClickListener { listener.onSetClick(bindingAdapterPosition) } + track_title.setOnClickListener { listener.onSetClick(bindingAdapterPosition) } + track_status.setOnClickListener { listener.onStatusClick(bindingAdapterPosition) } + track_chapters.setOnClickListener { listener.onChaptersClick(bindingAdapterPosition) } + track_score.setOnClickListener { listener.onScoreClick(bindingAdapterPosition) } } @SuppressLint("SetTextI18n") diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceHolder.kt index b6de462ee9..1a053e9541 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceHolder.kt @@ -29,7 +29,7 @@ class SourceHolder(view: View, override val adapter: SourceAdapter) : source_latest.gone() source_browse.setText(R.string.select) source_browse.setOnClickListener { - adapter.selectClickListener?.onSelectClick(adapterPosition) + adapter.selectClickListener?.onSelectClick(bindingAdapterPosition) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesHolder.kt index b5a52a9a8d..d8beb1f13f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesHolder.kt @@ -37,7 +37,7 @@ class UpdatesHolder(private val view: View, private val adapter: UpdatesAdapter) init { manga_cover.setOnClickListener { - adapter.coverClickListener.onCoverClick(adapterPosition) + adapter.coverClickListener.onCoverClick(bindingAdapterPosition) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceHolder.kt index ec58cf8f31..3388f85a35 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceHolder.kt @@ -28,11 +28,11 @@ class SourceHolder(view: View, override val adapter: SourceAdapter) : init { source_browse.setOnClickListener { - adapter.browseClickListener.onBrowseClick(adapterPosition) + adapter.browseClickListener.onBrowseClick(bindingAdapterPosition) } source_latest.setOnClickListener { - adapter.latestClickListener.onLatestClick(adapterPosition) + adapter.latestClickListener.onLatestClick(bindingAdapterPosition) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceController.kt index 4ffe3a85c8..0721da28ec 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceController.kt @@ -446,7 +446,7 @@ open class BrowseSourceController(bundle: Bundle) : val adapter = adapter ?: return null adapter.allBoundViewHolders.forEach { holder -> - val item = adapter.getItem(holder.adapterPosition) as? SourceItem + val item = adapter.getItem(holder.bindingAdapterPosition) as? SourceItem if (item != null && item.manga.id!! == manga.id!!) { return holder as SourceHolder } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchAdapter.kt index c65dc79458..ecf15d1991 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchAdapter.kt @@ -48,7 +48,7 @@ class GlobalSearchAdapter(val controller: GlobalSearchController) : * @param outState The bundle where the state is saved. */ private fun saveHolderState(holder: RecyclerView.ViewHolder, outState: Bundle) { - val key = "holder_${holder.adapterPosition}" + val key = "holder_${holder.bindingAdapterPosition}" val holderState = SparseArray() holder.itemView.saveHierarchyState(holderState) outState.putSparseParcelableArray(key, holderState) @@ -60,7 +60,7 @@ class GlobalSearchAdapter(val controller: GlobalSearchController) : * @param holder The holder to restore. */ private fun restoreHolderState(holder: RecyclerView.ViewHolder) { - val key = "holder_${holder.adapterPosition}" + val key = "holder_${holder.bindingAdapterPosition}" val holderState = bundle.getSparseParcelableArray(key) if (holderState != null) { holder.itemView.restoreHierarchyState(holderState) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchCardHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchCardHolder.kt index cfd36f8659..0cb9f69e56 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchCardHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchCardHolder.kt @@ -17,13 +17,13 @@ class GlobalSearchCardHolder(view: View, adapter: GlobalSearchCardAdapter) : init { // Call onMangaClickListener when item is pressed. itemView.setOnClickListener { - val item = adapter.getItem(adapterPosition) + val item = adapter.getItem(bindingAdapterPosition) if (item != null) { adapter.mangaClickListener.onMangaClick(item.manga) } } itemView.setOnLongClickListener { - val item = adapter.getItem(adapterPosition) + val item = adapter.getItem(bindingAdapterPosition) if (item != null) { adapter.mangaClickListener.onMangaLongClick(item.manga) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchController.kt index 5205a2c04a..7e19e1de01 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchController.kt @@ -163,7 +163,7 @@ open class GlobalSearchController( val adapter = adapter ?: return null adapter.allBoundViewHolders.forEach { holder -> - val item = adapter.getItem(holder.adapterPosition) + val item = adapter.getItem(holder.bindingAdapterPosition) if (item != null && source.id == item.source.id) { return holder as GlobalSearchHolder } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchHolder.kt index 8fb28fcee8..54e8b51036 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchHolder.kt @@ -85,7 +85,7 @@ class GlobalSearchHolder(view: View, val adapter: GlobalSearchAdapter) : */ private fun getHolder(manga: Manga): GlobalSearchCardHolder? { mangaAdapter.allBoundViewHolders.forEach { holder -> - val item = mangaAdapter.getItem(holder.adapterPosition) + val item = mangaAdapter.getItem(holder.bindingAdapterPosition) if (item != null && item.manga.id!! == manga.id!!) { return holder as GlobalSearchCardHolder }