|
|
@ -65,6 +65,8 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private var isInstallationInProgress = false
|
|
|
|
private var isInstallationInProgress = false
|
|
|
|
private var adapter: PagedAddonsManagerAdapter? = null
|
|
|
|
private var adapter: PagedAddonsManagerAdapter? = null
|
|
|
|
|
|
|
|
// We must save the add-on list in the class, or we won't have it
|
|
|
|
|
|
|
|
// downloaded for the non-suspending search function
|
|
|
|
private var addons: List<Addon>? = null
|
|
|
|
private var addons: List<Addon>? = null
|
|
|
|
|
|
|
|
|
|
|
|
override fun onCreateView(
|
|
|
|
override fun onCreateView(
|
|
|
@ -176,14 +178,14 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management)
|
|
|
|
val allowCache = args.installAddonId == null || installExternalAddonComplete
|
|
|
|
val allowCache = args.installAddonId == null || installExternalAddonComplete
|
|
|
|
lifecycleScope.launch(IO) {
|
|
|
|
lifecycleScope.launch(IO) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
val addons = requireContext().components.addonManager.getAddons(allowCache = allowCache)
|
|
|
|
addons = requireContext().components.addonManager.getAddons(allowCache = allowCache)
|
|
|
|
lifecycleScope.launch(Dispatchers.Main) {
|
|
|
|
lifecycleScope.launch(Dispatchers.Main) {
|
|
|
|
runIfFragmentIsAttached {
|
|
|
|
runIfFragmentIsAttached {
|
|
|
|
if (!shouldRefresh) {
|
|
|
|
if (!shouldRefresh) {
|
|
|
|
adapter = PagedAddonsManagerAdapter(
|
|
|
|
adapter = PagedAddonsManagerAdapter(
|
|
|
|
requireContext().components.addonCollectionProvider,
|
|
|
|
requireContext().components.addonCollectionProvider,
|
|
|
|
managementView,
|
|
|
|
managementView,
|
|
|
|
addons,
|
|
|
|
addons!!,
|
|
|
|
style = createAddonStyle(requireContext())
|
|
|
|
style = createAddonStyle(requireContext())
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -193,12 +195,12 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management)
|
|
|
|
|
|
|
|
|
|
|
|
recyclerView.adapter = adapter
|
|
|
|
recyclerView.adapter = adapter
|
|
|
|
if (shouldRefresh) {
|
|
|
|
if (shouldRefresh) {
|
|
|
|
adapter?.updateAddons(addons)
|
|
|
|
adapter?.updateAddons(addons!!)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
args.installAddonId?.let { addonIn ->
|
|
|
|
args.installAddonId?.let { addonIn ->
|
|
|
|
if (!installExternalAddonComplete) {
|
|
|
|
if (!installExternalAddonComplete) {
|
|
|
|
installExternalAddon(addons, addonIn)
|
|
|
|
installExternalAddon(addons!!, addonIn)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|