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.
upstream-sync
kanish671 3 years ago committed by Mugurell
parent db97d85057
commit 9e30833506

@ -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)
}
}
}

Loading…
Cancel
Save