From 9e30833506404534f81b593cc08390269ac80ff7 Mon Sep 17 00:00:00 2001 From: kanish671 Date: Thu, 15 Apr 2021 19:30:02 +0530 Subject: [PATCH] For #18672 - Rename TopSites even on the second page Index calculation for notifying changes while renaming a top site in the second page was being wrongly calculated. Since it is page 2, we would need to take a mod with the number of top sites per page to get the actual index of the top site that was being renamed. --- .../viewholders/topsites/TopSitesPagerAdapter.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/topsites/TopSitesPagerAdapter.kt b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/topsites/TopSitesPagerAdapter.kt index c960dc69f..e7ea586c8 100644 --- a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/topsites/TopSitesPagerAdapter.kt +++ b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/topsites/TopSitesPagerAdapter.kt @@ -12,6 +12,7 @@ import kotlinx.android.synthetic.main.component_top_sites.view.* import mozilla.components.feature.top.sites.TopSite import org.mozilla.fenix.home.sessioncontrol.AdapterItem import org.mozilla.fenix.home.sessioncontrol.TopSiteInteractor +import org.mozilla.fenix.home.sessioncontrol.viewholders.TopSitePagerViewHolder.Companion.TOP_SITES_PER_PAGE import org.mozilla.fenix.home.sessioncontrol.viewholders.TopSiteViewHolder class TopSitesPagerAdapter( @@ -36,7 +37,7 @@ class TopSitesPagerAdapter( val adapter = holder.itemView.top_sites_list.adapter as TopSitesAdapter val payload = payloads[0] as AdapterItem.TopSitePagerPayload for (item in payload.changed) { - adapter.notifyItemChanged(item.first, item.second) + adapter.notifyItemChanged(item.first % TOP_SITES_PER_PAGE, item.second) } } }