Commit 86551909 authored by Viktor De Pasquale's avatar Viktor De Pasquale

Added safe mode notice to modules screen

parent 588e94c1
package com.topjohnwu.magisk.redesign.module package com.topjohnwu.magisk.redesign.module
import android.graphics.Insets
import com.topjohnwu.magisk.R import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.databinding.FragmentModuleMd2Binding import com.topjohnwu.magisk.databinding.FragmentModuleMd2Binding
import com.topjohnwu.magisk.redesign.compat.CompatFragment import com.topjohnwu.magisk.redesign.compat.CompatFragment
...@@ -10,6 +11,8 @@ class ModuleFragment : CompatFragment<ModuleViewModel, FragmentModuleMd2Binding> ...@@ -10,6 +11,8 @@ class ModuleFragment : CompatFragment<ModuleViewModel, FragmentModuleMd2Binding>
override val layoutRes = R.layout.fragment_module_md2 override val layoutRes = R.layout.fragment_module_md2
override val viewModel by viewModel<ModuleViewModel>() override val viewModel by viewModel<ModuleViewModel>()
override fun consumeSystemWindowInsets(insets: Insets) = insets
override fun onStart() { override fun onStart() {
super.onStart() super.onStart()
......
package com.topjohnwu.magisk.redesign.module package com.topjohnwu.magisk.redesign.module
import com.topjohnwu.magisk.BR
import com.topjohnwu.magisk.model.entity.recycler.ModuleRvItem
import com.topjohnwu.magisk.redesign.compat.CompatViewModel import com.topjohnwu.magisk.redesign.compat.CompatViewModel
import com.topjohnwu.magisk.redesign.home.itemBindingOf
import com.topjohnwu.magisk.redesign.superuser.diffListOf
class ModuleViewModel : CompatViewModel() class ModuleViewModel : CompatViewModel() {
\ No newline at end of file
val items = diffListOf<ModuleRvItem>()
val itemBinding = itemBindingOf<ModuleRvItem> {
it.bindExtra(BR.viewModel, this)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"> <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> <data>
<import type="com.topjohnwu.magisk.Config" />
<variable <variable
name="viewModel" name="viewModel"
type="com.topjohnwu.magisk.redesign.module.ModuleViewModel" /> type="com.topjohnwu.magisk.redesign.module.ModuleViewModel" />
...@@ -11,12 +15,51 @@ ...@@ -11,12 +15,51 @@
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:clipToPadding="false"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fillViewport="true"> android:fillViewport="true"
android:paddingTop="@{viewModel.insets.top + (int) @dimen/internal_action_bar_size}"
android:paddingBottom="@{viewModel.insets.bottom + (int) @dimen/l2}"
tools:paddingTop="24dp">
<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">
<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.recyclerview.widget.RecyclerView
itemBinding="@{viewModel.itemBinding}"
items="@{viewModel.items}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/l1"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintTop_toBottomOf="@+id/module_notice" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
......
...@@ -68,4 +68,6 @@ ...@@ -68,4 +68,6 @@
<string name="install_next">Next</string> <string name="install_next">Next</string>
<string name="install_start">Let\'s go</string> <string name="install_start">Let\'s go</string>
<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>
</resources> </resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment