mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 10:57:39 +00:00
Removed intermediate loading item
- adding intermediate items causes recyclerview renderer to display artifacts (copies of some views)
This commit is contained in:
parent
495e734428
commit
265dca3723
@ -150,19 +150,6 @@ class ModuleItem(val item: Module) : ObservableItem<ModuleItem>(), Observable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object LoadingItem : ComparableRvItem<LoadingItem>() {
|
|
||||||
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<T> : ComparableRvItem<T>(), Observable {
|
abstract class ObservableItem<T> : ComparableRvItem<T>(), Observable {
|
||||||
|
|
||||||
private val list = PropertyChangeRegistry()
|
private val list = PropertyChangeRegistry()
|
||||||
|
@ -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.internal.DownloadSubject
|
||||||
import com.topjohnwu.magisk.model.entity.module.Module
|
import com.topjohnwu.magisk.model.entity.module.Module
|
||||||
import com.topjohnwu.magisk.model.entity.module.Repo
|
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.ModuleItem
|
||||||
import com.topjohnwu.magisk.model.entity.recycler.RepoItem
|
import com.topjohnwu.magisk.model.entity.recycler.RepoItem
|
||||||
import com.topjohnwu.magisk.model.entity.recycler.SectionTitle
|
import com.topjohnwu.magisk.model.entity.recycler.SectionTitle
|
||||||
@ -107,16 +106,12 @@ class ModuleViewModel(
|
|||||||
.map { it.map { RepoItem(it) } }
|
.map { it.map { RepoItem(it) } }
|
||||||
.subscribeK(onError = {
|
.subscribeK(onError = {
|
||||||
Timber.e(it)
|
Timber.e(it)
|
||||||
items.remove(LoadingItem)
|
|
||||||
}) {
|
}) {
|
||||||
items.remove(LoadingItem)
|
|
||||||
if (!items.contains(sectionRemote)) {
|
if (!items.contains(sectionRemote)) {
|
||||||
items.add(sectionRemote)
|
items.add(sectionRemote)
|
||||||
}
|
}
|
||||||
items.addAll(it)
|
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(
|
private fun loadRepos(
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<data>
|
|
||||||
|
|
||||||
<variable
|
|
||||||
name="item"
|
|
||||||
type="com.topjohnwu.magisk.model.entity.recycler.LoadingItem" />
|
|
||||||
|
|
||||||
<variable
|
|
||||||
name="viewModel"
|
|
||||||
type="com.topjohnwu.magisk.base.viewmodel.LoadingViewModel" />
|
|
||||||
|
|
||||||
</data>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:minHeight="?listPreferredItemHeightSmall"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="@dimen/l1">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/safetynet_attest_loading"
|
|
||||||
android:textAppearance="?appearanceTextTitleNormal" />
|
|
||||||
|
|
||||||
<ProgressBar
|
|
||||||
style="?styleProgressIndeterminate"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginTop="@dimen/l1" />
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</layout>
|
|
Loading…
x
Reference in New Issue
Block a user