From 265dca372363faeed177b09356e9bfd0acdf98ab Mon Sep 17 00:00:00 2001 From: Viktor De Pasquale Date: Tue, 12 Nov 2019 15:58:32 +0100 Subject: [PATCH] Removed intermediate loading item - adding intermediate items causes recyclerview renderer to display artifacts (copies of some views) --- .../model/entity/recycler/ModuleRvItem.kt | 13 ------- .../magisk/redesign/module/ModuleViewModel.kt | 5 --- app/src/main/res/layout/item_loading.xml | 38 ------------------- 3 files changed, 56 deletions(-) delete mode 100644 app/src/main/res/layout/item_loading.xml diff --git a/app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/ModuleRvItem.kt b/app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/ModuleRvItem.kt index 885f13b0e..cfd5a4003 100644 --- a/app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/ModuleRvItem.kt +++ b/app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/ModuleRvItem.kt @@ -150,19 +150,6 @@ class ModuleItem(val item: Module) : ObservableItem(), Observable { } -object LoadingItem : ComparableRvItem() { - override val layoutRes = R.layout.item_loading - - override fun onBindingBound(binding: ViewDataBinding) { - super.onBindingBound(binding) - val params = binding.root.layoutParams as? StaggeredGridLayoutManager.LayoutParams ?: return - params.isFullSpan = true - } - - override fun contentSameAs(other: LoadingItem) = this == other - override fun itemSameAs(other: LoadingItem) = this === other -} - abstract class ObservableItem : ComparableRvItem(), Observable { private val list = PropertyChangeRegistry() diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt index e5171c7f2..155ab4a78 100644 --- a/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt @@ -14,7 +14,6 @@ import com.topjohnwu.magisk.model.download.RemoteFileService import com.topjohnwu.magisk.model.entity.internal.DownloadSubject import com.topjohnwu.magisk.model.entity.module.Module import com.topjohnwu.magisk.model.entity.module.Repo -import com.topjohnwu.magisk.model.entity.recycler.LoadingItem import com.topjohnwu.magisk.model.entity.recycler.ModuleItem import com.topjohnwu.magisk.model.entity.recycler.RepoItem import com.topjohnwu.magisk.model.entity.recycler.SectionTitle @@ -107,16 +106,12 @@ class ModuleViewModel( .map { it.map { RepoItem(it) } } .subscribeK(onError = { Timber.e(it) - items.remove(LoadingItem) }) { - items.remove(LoadingItem) if (!items.contains(sectionRemote)) { items.add(sectionRemote) } items.addAll(it) } - // do on subscribe doesn't perform the action on main thread, so this is perfectly fine - items.add(LoadingItem) } private fun loadRepos( diff --git a/app/src/main/res/layout/item_loading.xml b/app/src/main/res/layout/item_loading.xml deleted file mode 100644 index c10346364..000000000 --- a/app/src/main/res/layout/item_loading.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file