From be12f1d319d0d76a3f2509c5d81b23721020565b Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 10 Sep 2020 13:39:54 +0300 Subject: [PATCH] Collection creation: trigger an item load (even though empty). We need it because otherwise the view collection looks as if it's just loading, even though we know it's empty. --- .../etesync/syncadapter/ui/etebase/EditCollectionFragment.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/com/etesync/syncadapter/ui/etebase/EditCollectionFragment.kt b/app/src/main/java/com/etesync/syncadapter/ui/etebase/EditCollectionFragment.kt index c392f40d..829a6541 100644 --- a/app/src/main/java/com/etesync/syncadapter/ui/etebase/EditCollectionFragment.kt +++ b/app/src/main/java/com/etesync/syncadapter/ui/etebase/EditCollectionFragment.kt @@ -26,6 +26,7 @@ import yuku.ambilwarna.AmbilWarnaDialog class EditCollectionFragment(private val cachedCollection: CachedCollection, private val isCreating: Boolean = false) : Fragment() { private val model: AccountViewModel by activityViewModels() private val collectionModel: CollectionViewModel by activityViewModels() + private val itemsModel: ItemsViewModel by activityViewModels() private val loadingModel: LoadingViewModel by viewModels() override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { @@ -215,6 +216,8 @@ class EditCollectionFragment(private val cachedCollection: CachedCollection, pri requestSync(applicationContext, model.value!!.account) } if (isCreating) { + // Load the items since we just created it + itemsModel.loadItems(model.value!!, cachedCollection) parentFragmentManager.commit { replace(R.id.fragment_container, ViewCollectionFragment()) }