1
0
mirror of https://github.com/etesync/android synced 2025-02-22 12:32:03 +00:00

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.
This commit is contained in:
Tom Hacohen 2020-09-10 13:39:54 +03:00
parent 44c29b4bcd
commit be12f1d319

View File

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