diff --git a/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt b/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt index 25fa9fc40492..3fd49bcb8a4a 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt @@ -27,6 +27,8 @@ import mozilla.components.feature.addons.ui.AddonInstallationDialogFragment import mozilla.components.feature.addons.ui.AddonsManagerAdapter import mozilla.components.feature.addons.ui.PermissionsDialogFragment import mozilla.components.feature.addons.ui.translatedName +import network.novak.fenix.components.PagedAddonsManagerAdapter +import network.novak.fenix.components.PagedAddonInstallationDialogFragment import org.mozilla.fenix.R import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.ext.components @@ -47,7 +49,7 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) * Whether or not an add-on installation is in progress. */ private var isInstallationInProgress = false - private var adapter: AddonsManagerAdapter? = null + private var adapter: PagedAddonsManagerAdapter? = null override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -87,7 +89,7 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) lifecycleScope.launch(Dispatchers.Main) { runIfFragmentIsAttached { if (!shouldRefresh) { - adapter = AddonsManagerAdapter( + adapter = PagedAddonsManagerAdapter( requireContext().components.addonCollectionProvider, managementView, addons, @@ -120,8 +122,8 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) } } - private fun createAddonStyle(context: Context): AddonsManagerAdapter.Style { - return AddonsManagerAdapter.Style( + private fun createAddonStyle(context: Context): PagedAddonsManagerAdapter.Style { + return PagedAddonsManagerAdapter.Style( sectionsTextColor = ThemeManager.resolveAttribute(R.attr.primaryText, context), addonNameTextColor = ThemeManager.resolveAttribute(R.attr.primaryText, context), addonSummaryTextColor = ThemeManager.resolveAttribute(R.attr.secondaryText, context), @@ -140,7 +142,7 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) private fun hasExistingAddonInstallationDialogFragment(): Boolean { return parentFragmentManager.findFragmentByTag(INSTALLATION_DIALOG_FRAGMENT_TAG) - as? AddonInstallationDialogFragment != null + as? PagedAddonInstallationDialogFragment != null } private fun showPermissionDialog(addon: Addon) { @@ -171,10 +173,10 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) requireComponents.analytics.metrics.track(Event.AddonInstalled(addon.id)) val addonCollectionProvider = requireContext().components.addonCollectionProvider - val dialog = AddonInstallationDialogFragment.newInstance( + val dialog = PagedAddonInstallationDialogFragment.newInstance( addon = addon, addonCollectionProvider = addonCollectionProvider, - promptsStyling = AddonInstallationDialogFragment.PromptsStyling( + promptsStyling = PagedAddonInstallationDialogFragment.PromptsStyling( gravity = Gravity.BOTTOM, shouldWidthMatchParent = true, confirmButtonBackgroundColor = ThemeManager.resolveAttribute( diff --git a/app/src/main/java/org/mozilla/fenix/components/Components.kt b/app/src/main/java/org/mozilla/fenix/components/Components.kt index 9e2b069f5ec4..8551dbb0974c 100644 --- a/app/src/main/java/org/mozilla/fenix/components/Components.kt +++ b/app/src/main/java/org/mozilla/fenix/components/Components.kt @@ -9,6 +9,7 @@ import android.content.Intent import androidx.core.content.getSystemService import androidx.core.net.toUri import mozilla.components.feature.addons.AddonManager +import mozilla.components.feature.addons.AddonsProvider import mozilla.components.feature.addons.amo.AddonCollectionProvider import mozilla.components.feature.addons.migration.DefaultSupportedAddonsChecker import mozilla.components.feature.addons.migration.SupportedAddonsChecker @@ -16,6 +17,7 @@ import mozilla.components.feature.addons.update.AddonUpdater import mozilla.components.feature.addons.update.DefaultAddonUpdater import mozilla.components.lib.publicsuffixlist.PublicSuffixList import mozilla.components.support.migration.state.MigrationStore +import network.novak.fenix.components.PagedAddonCollectionProvider import org.mozilla.fenix.BuildConfig import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.components.metrics.AppStartupTelemetry @@ -72,7 +74,7 @@ class Components(private val context: Context) { val addonCollectionProvider by lazy { if (!BuildConfig.AMO_COLLECTION.isNullOrEmpty()) { - AddonCollectionProvider( + PagedAddonCollectionProvider( context, core.client, collectionAccount = BuildConfig.AMO_ACCOUNT, @@ -80,7 +82,7 @@ class Components(private val context: Context) { maxCacheAgeInMinutes = DAY_IN_MINUTES ) } else { - AddonCollectionProvider(context, core.client, maxCacheAgeInMinutes = DAY_IN_MINUTES) + PagedAddonCollectionProvider(context, core.client, maxCacheAgeInMinutes = DAY_IN_MINUTES) } }