From 86551909fccf2f900c151440844a2c3f87ce4d40 Mon Sep 17 00:00:00 2001 From: Viktor De Pasquale Date: Wed, 30 Oct 2019 17:54:43 +0100 Subject: [PATCH] Added safe mode notice to modules screen --- .../magisk/redesign/module/ModuleFragment.kt | 3 ++ .../magisk/redesign/module/ModuleViewModel.kt | 13 ++++- .../main/res/layout/fragment_module_md2.xml | 49 +++++++++++++++++-- app/src/main/res/values/strings_md2.xml | 2 + 4 files changed, 63 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleFragment.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleFragment.kt index 51117413f..c252eaf18 100644 --- a/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleFragment.kt +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleFragment.kt @@ -1,5 +1,6 @@ package com.topjohnwu.magisk.redesign.module +import android.graphics.Insets import com.topjohnwu.magisk.R import com.topjohnwu.magisk.databinding.FragmentModuleMd2Binding import com.topjohnwu.magisk.redesign.compat.CompatFragment @@ -10,6 +11,8 @@ class ModuleFragment : CompatFragment override val layoutRes = R.layout.fragment_module_md2 override val viewModel by viewModel() + override fun consumeSystemWindowInsets(insets: Insets) = insets + override fun onStart() { super.onStart() diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt index 8ae35ecb0..35979b2e7 100644 --- a/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt @@ -1,5 +1,16 @@ 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.home.itemBindingOf +import com.topjohnwu.magisk.redesign.superuser.diffListOf -class ModuleViewModel : CompatViewModel() \ No newline at end of file +class ModuleViewModel : CompatViewModel() { + + val items = diffListOf() + val itemBinding = itemBindingOf { + it.bindExtra(BR.viewModel, this) + } + +} \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_module_md2.xml b/app/src/main/res/layout/fragment_module_md2.xml index aec90e437..36d00c488 100644 --- a/app/src/main/res/layout/fragment_module_md2.xml +++ b/app/src/main/res/layout/fragment_module_md2.xml @@ -1,8 +1,12 @@ - + + + @@ -11,12 +15,51 @@ + 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"> + android:layout_height="wrap_content"> + + + + + + + + + + diff --git a/app/src/main/res/values/strings_md2.xml b/app/src/main/res/values/strings_md2.xml index 39e731cdb..6f01e8357 100644 --- a/app/src/main/res/values/strings_md2.xml +++ b/app/src/main/res/values/strings_md2.xml @@ -68,4 +68,6 @@ Next Let\'s go + You\'re in safe mode. None of user modules will work.\nThis message will disappear once safe mode is disabled. + \ No newline at end of file