Added loaders to superuser and hide

This commit is contained in:
Viktor De Pasquale 2019-10-31 20:53:37 +01:00
parent 6aa22267f4
commit 5e089451af
3 changed files with 78 additions and 25 deletions

View File

@ -47,6 +47,7 @@ class HideViewModel(
.toList()
.map { it.sort() }
.map { it to items.calculateDiff(it) }
.applyViewModel(this)
.subscribeK {
items.update(it.first, it.second)
query()

View File

@ -13,8 +13,13 @@
</data>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
dividerVertical="@{R.drawable.divider_l1}"
invisibleUnless="@{viewModel.loaded || !viewModel.items.empty}"
itemBinding="@{viewModel.itemBinding}"
items="@{viewModel.items}"
android:layout_width="match_parent"
@ -29,4 +34,27 @@
tools:listitem="@layout/item_hide_md2"
tools:paddingTop="40dp" />
<LinearLayout
goneUnless="@{viewModel.loading &amp;&amp; viewModel.items.empty}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/safetynet_attest_loading"
android:textAppearance="?appearanceTextTitleNormal"
android:textStyle="bold" />
<ProgressBar
style="?styleProgressIndeterminate"
android:layout_marginTop="@dimen/l1" />
</LinearLayout>
</FrameLayout>
</layout>

View File

@ -26,19 +26,19 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/l1"
android:orientation="vertical">
android:orientation="vertical"
android:paddingTop="@dimen/l1">
<com.google.android.material.card.MaterialCardView
style="?styleCardNormal"
android:id="@+id/superuser_hide"
style="?styleCardNormal"
android:layout_width="0dp"
app:layout_constraintEnd_toStartOf="@+id/superuser_safetynet"
app:layout_constraintStart_toStartOf="parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1"
android:layout_marginEnd="@dimen/l1"
android:onClick="@{() -> viewModel.hidePressed()}"
app:layout_constraintEnd_toStartOf="@+id/superuser_safetynet"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
@ -57,9 +57,9 @@
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/magisk_hide_md2"
android:requiresFadingEdge="horizontal"
android:singleLine="true"
android:text="@string/magisk_hide_md2"
android:textAppearance="?appearanceTextBodyNormal"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
@ -82,14 +82,14 @@
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
style="?styleCardNormal"
android:id="@+id/superuser_safetynet"
style="?styleCardNormal"
android:layout_width="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/superuser_hide"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/l1"
android:onClick="@{() -> viewModel.safetynetPressed()}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/superuser_hide"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
@ -108,9 +108,9 @@
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/safetyNet"
android:requiresFadingEdge="horizontal"
android:singleLine="true"
android:text="@string/safetyNet"
android:textAppearance="?appearanceTextBodyNormal"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
@ -142,21 +142,45 @@
<androidx.recyclerview.widget.RecyclerView
dividerHorizontal="@{R.drawable.divider_l1}"
dividerVertical="@{R.drawable.divider_l1}"
goneUnless="@{viewModel.loaded || !viewModel.items.empty}"
itemBinding="@{viewModel.itemBinding}"
items="@{viewModel.items}"
nestedScrollingEnabled="@{false}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
app:layout_constraintTop_toBottomOf="@+id/superuser_top_barrier"
android:orientation="vertical"
android:paddingStart="@dimen/l1"
android:paddingTop="@dimen/l1"
android:paddingBottom="@dimen/l1"
app:layoutManager="androidx.recyclerview.widget.StaggeredGridLayoutManager"
app:layout_constraintTop_toBottomOf="@+id/superuser_top_barrier"
app:spanCount="2"
tools:listitem="@layout/item_policy_md2" />
<LinearLayout
goneUnless="@{viewModel.loading &amp;&amp; viewModel.items.empty}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/superuser_top_barrier">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/safetynet_attest_loading"
android:textAppearance="?appearanceTextTitleNormal"
android:textStyle="bold" />
<ProgressBar
style="?styleProgressIndeterminate"
android:layout_marginTop="@dimen/l1" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>