You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Updated modules screen so it displays all the content in one recyclerview
Added "endless" scrolling support - this is done in order to display everything very swiftly and load as user needs it - for the most part we'll download only ~10 items and load the rest as scroll progresses, this accomplishes the illusion that whole list is being populated Added sections and updated repo view
This commit is contained in:
@@ -15,145 +15,23 @@
|
||||
|
||||
</data>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/module_remote"
|
||||
adapter="@{viewModel.adapter}"
|
||||
dividerHorizontal="@{R.drawable.divider_l1}"
|
||||
dividerVertical="@{R.drawable.divider_l1}"
|
||||
itemBinding="@{viewModel.itemBinding}"
|
||||
items="@{viewModel.items}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:fillViewport="true"
|
||||
android:paddingTop="@{viewModel.insets.top + (int) @dimen/internal_action_bar_size}"
|
||||
android:paddingBottom="@{viewModel.insets.bottom + (int) @dimen/l1}"
|
||||
tools:paddingBottom="64dp"
|
||||
tools:paddingTop="24dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/module_notice"
|
||||
style="?styleCardNormal"
|
||||
gone="@{!Config.coreOnly}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/l1"
|
||||
android:visibility="gone"
|
||||
app:cardBackgroundColor="?colorError"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/l1"
|
||||
android:text="@string/module_safe_mode_message"
|
||||
android:textAppearance="?appearanceTextCaptionOnPrimary"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
gone="@{viewModel.itemsPending.empty}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/l1"
|
||||
android:paddingEnd="@dimen/l1">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/l1"
|
||||
android:layout_marginBottom="@dimen/l1"
|
||||
android:text="Applied on next boot"
|
||||
android:textAppearance="?appearanceTextBodyNormal"
|
||||
android:textColor="?colorPrimaryTransient"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/module_reboot_button"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/module_reboot_button"
|
||||
style="?styleButtonText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/reboot"
|
||||
android:textAllCaps="false"
|
||||
app:icon="@drawable/ic_restart"
|
||||
app:iconPadding="@dimen/l_50"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
dividerHorizontal="@{R.drawable.divider_l1}"
|
||||
dividerVertical="@{R.drawable.divider_l1}"
|
||||
gone="@{viewModel.itemsPending.empty}"
|
||||
itemBinding="@{viewModel.itemBinding}"
|
||||
items="@{viewModel.itemsPending}"
|
||||
nestedScrollingEnabled="@{false}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/l1"
|
||||
android:paddingEnd="0dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.StaggeredGridLayoutManager"
|
||||
app:spanCount="2"
|
||||
tools:itemCount="1"
|
||||
tools:listitem="@layout/item_module_md2" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
gone="@{viewModel.itemsPending.empty || viewModel.items.empty}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/l1"
|
||||
android:paddingEnd="@dimen/l1"
|
||||
android:text="Active"
|
||||
android:textAppearance="?appearanceTextBodyNormal"
|
||||
android:textColor="?colorPrimaryTransient"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/module_reboot_button"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
dividerHorizontal="@{R.drawable.divider_l1}"
|
||||
dividerVertical="@{R.drawable.divider_l1}"
|
||||
gone="@{viewModel.items.empty}"
|
||||
itemBinding="@{viewModel.itemBinding}"
|
||||
items="@{viewModel.items}"
|
||||
nestedScrollingEnabled="@{false}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/l1"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/l1"
|
||||
android:paddingEnd="0dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.StaggeredGridLayoutManager"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_notice"
|
||||
app:spanCount="2"
|
||||
tools:itemCount="3"
|
||||
tools:listitem="@layout/item_module_md2" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="?styleButtonText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/l1"
|
||||
android:text="Download more"
|
||||
android:textAllCaps="false"
|
||||
app:icon="@drawable/ic_download_md2" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/l1"
|
||||
android:paddingTop="@{viewModel.insets.top + (int) @dimen/internal_action_bar_size + (int) @dimen/l1}"
|
||||
android:paddingEnd="0dp"
|
||||
android:paddingBottom="@{viewModel.insets.bottom}"
|
||||
app:layoutManager="androidx.recyclerview.widget.StaggeredGridLayoutManager"
|
||||
app:spanCount="2"
|
||||
tools:listitem="@layout/item_module_md2" />
|
||||
|
||||
</layout>
|
||||
@@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="item"
|
||||
type="com.topjohnwu.magisk.model.entity.recycler.RepoItem" />
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.module.ModuleViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="?styleCardVariant"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:layout_gravity="center"
|
||||
tools:layout_marginBottom="@dimen/l1"
|
||||
tools:layout_marginEnd="@dimen/l1">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/module_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/l1"
|
||||
android:layout_marginTop="@dimen/l1"
|
||||
android:layout_marginEnd="@dimen/l1"
|
||||
android:text="@{item.item.name}"
|
||||
android:textAppearance="?appearanceTextBodyNormal"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@tools:sample/lorem" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/module_version_author"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/l1"
|
||||
android:layout_marginEnd="@dimen/l1"
|
||||
android:text="@{@string/module_version_author(item.item.version ?? `?`, item.item.author ?? `?`)}"
|
||||
android:textAppearance="?appearanceTextCaptionVariant"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_title"
|
||||
tools:text="v1 by topjohnwu" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/module_description"
|
||||
gone="@{item.item.description.empty}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/l1"
|
||||
android:layout_marginTop="@dimen/l1"
|
||||
android:layout_marginEnd="@dimen/l1"
|
||||
android:text="@{item.item.description}"
|
||||
android:textAppearance="?appearanceTextCaptionVariant"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_version_author"
|
||||
tools:lines="4"
|
||||
tools:text="@tools:sample/lorem/random" />
|
||||
|
||||
<View
|
||||
android:id="@+id/module_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="@dimen/l1"
|
||||
android:background="?colorSurfaceVariant"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_description" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/l1"
|
||||
android:layout_marginEnd="@dimen/l1"
|
||||
android:text="@{@string/updated_on(item.item.lastUpdateString)}"
|
||||
android:textAppearance="?appearanceTextCaptionVariant"
|
||||
android:textSize="11sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/module_download"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_divider"
|
||||
tools:ignore="SmallSp"
|
||||
tools:text="@string/updated_on" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/module_download"
|
||||
style="?styleIconPrimary"
|
||||
android:contentDescription="@string/download"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_divider"
|
||||
app:srcCompat="@drawable/ic_download_md2" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<ProgressBar
|
||||
style="?styleProgressDeterminate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_gravity="bottom"
|
||||
tools:progress="40" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</layout>
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="item"
|
||||
type="com.topjohnwu.magisk.model.entity.recycler.SectionTitle" />
|
||||
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/module_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.title}"
|
||||
android:textAppearance="?appearanceTextBodyNormal"
|
||||
android:textColor="?colorPrimaryTransient"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/module_button"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/module_button"
|
||||
style="?styleButtonText"
|
||||
gone="@{item.button == 0 || item.icon == 0}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/l1"
|
||||
android:text="@{item.button}"
|
||||
android:textAllCaps="false"
|
||||
app:icon="@{item.icon}"
|
||||
app:iconPadding="@dimen/l_50"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/module_title"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
@@ -75,6 +75,9 @@
|
||||
|
||||
<string name="module_safe_mode_message">You\'re in safe mode. None of user modules will work.\nThis message will disappear once safe mode is disabled.</string>
|
||||
<string name="module_version_author">%1$s by %2$s</string>
|
||||
<string name="module_section_pending">Pending changes</string>
|
||||
<string name="module_section_active">Active</string>
|
||||
<string name="module_section_remote">Remote</string>
|
||||
|
||||
<string name="superuser_toggle_log">Toggles logging</string>
|
||||
<string name="superuser_toggle_notification">Toggles “toast” notifications</string>
|
||||
|
||||
Reference in New Issue
Block a user