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() .toList()
.map { it.sort() } .map { it.sort() }
.map { it to items.calculateDiff(it) } .map { it to items.calculateDiff(it) }
.applyViewModel(this)
.subscribeK { .subscribeK {
items.update(it.first, it.second) items.update(it.first, it.second)
query() query()

View File

@ -13,20 +13,48 @@
</data> </data>
<androidx.recyclerview.widget.RecyclerView <FrameLayout
dividerVertical="@{R.drawable.divider_l1}"
itemBinding="@{viewModel.itemBinding}"
items="@{viewModel.items}"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:clipToPadding="false"
android:orientation="vertical" <androidx.recyclerview.widget.RecyclerView
android:paddingStart="@dimen/l1" dividerVertical="@{R.drawable.divider_l1}"
android:paddingTop="@{viewModel.insets.top + (int) @dimen/internal_action_bar_size + (int) @dimen/l1}" invisibleUnless="@{viewModel.loaded || !viewModel.items.empty}"
android:paddingEnd="@dimen/l1" itemBinding="@{viewModel.itemBinding}"
android:paddingBottom="@{viewModel.insets.bottom}" items="@{viewModel.items}"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" android:layout_width="match_parent"
tools:listitem="@layout/item_hide_md2" android:layout_height="match_parent"
tools:paddingTop="40dp" /> android:clipToPadding="false"
android:orientation="vertical"
android:paddingStart="@dimen/l1"
android:paddingTop="@{viewModel.insets.top + (int) @dimen/internal_action_bar_size + (int) @dimen/l1}"
android:paddingEnd="@dimen/l1"
android:paddingBottom="@{viewModel.insets.bottom}"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
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> </layout>

View File

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