Several home screen changes
This commit is contained in:
parent
1276c28e03
commit
da2b00de59
@ -31,11 +31,6 @@ sealed class TappableHeadlineItem : ComparableRvItem<TappableHeadlineItem>() {
|
|||||||
override val icon = R.drawable.ic_hide_md2
|
override val icon = R.drawable.ic_hide_md2
|
||||||
}
|
}
|
||||||
|
|
||||||
object Safetynet : TappableHeadlineItem() {
|
|
||||||
override val title = R.string.safetynet
|
|
||||||
override val icon = R.drawable.ic_safetynet_md2
|
|
||||||
}
|
|
||||||
|
|
||||||
object ThemeMode : TappableHeadlineItem() {
|
object ThemeMode : TappableHeadlineItem() {
|
||||||
override val title = R.string.settings_dark_mode_title
|
override val title = R.string.settings_dark_mode_title
|
||||||
override val icon = R.drawable.ic_day_night
|
override val icon = R.drawable.ic_day_night
|
||||||
|
@ -134,6 +134,9 @@ class HomeViewModel(
|
|||||||
HomeFragmentDirections.actionHomeFragmentToInstallFragment().publish()
|
HomeFragmentDirections.actionHomeFragmentToInstallFragment().publish()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun onSafetyNetPressed() =
|
||||||
|
HomeFragmentDirections.actionHomeFragmentToSafetynetFragment().publish()
|
||||||
|
|
||||||
fun hideNotice() {
|
fun hideNotice() {
|
||||||
Config.safetyNotice = false
|
Config.safetyNotice = false
|
||||||
isNoticeVisible = false
|
isNoticeVisible = false
|
||||||
|
@ -42,7 +42,6 @@ class SuperuserViewModel(
|
|||||||
val adapter = adapterOf<ComparableRvItem<*>>()
|
val adapter = adapterOf<ComparableRvItem<*>>()
|
||||||
val items = MergeObservableList<ComparableRvItem<*>>()
|
val items = MergeObservableList<ComparableRvItem<*>>()
|
||||||
.insertItem(TappableHeadlineItem.Hide)
|
.insertItem(TappableHeadlineItem.Hide)
|
||||||
.insertItem(TappableHeadlineItem.Safetynet)
|
|
||||||
.insertList(itemsHelpers)
|
.insertList(itemsHelpers)
|
||||||
.insertList(itemsPolicies)
|
.insertList(itemsPolicies)
|
||||||
val itemBinding = itemBindingOf<ComparableRvItem<*>> {
|
val itemBinding = itemBindingOf<ComparableRvItem<*>> {
|
||||||
@ -75,13 +74,9 @@ class SuperuserViewModel(
|
|||||||
@Suppress("REDUNDANT_ELSE_IN_WHEN")
|
@Suppress("REDUNDANT_ELSE_IN_WHEN")
|
||||||
override fun onItemPressed(item: TappableHeadlineItem) = when (item) {
|
override fun onItemPressed(item: TappableHeadlineItem) = when (item) {
|
||||||
TappableHeadlineItem.Hide -> hidePressed()
|
TappableHeadlineItem.Hide -> hidePressed()
|
||||||
TappableHeadlineItem.Safetynet -> safetynetPressed()
|
|
||||||
else -> Unit
|
else -> Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun safetynetPressed() =
|
|
||||||
SuperuserFragmentDirections.actionSuperuserFragmentToSafetynetFragment().publish()
|
|
||||||
|
|
||||||
private fun hidePressed() =
|
private fun hidePressed() =
|
||||||
SuperuserFragmentDirections.actionSuperuserFragmentToHideFragment().publish()
|
SuperuserFragmentDirections.actionSuperuserFragmentToHideFragment().publish()
|
||||||
|
|
||||||
|
@ -5,6 +5,10 @@
|
|||||||
|
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
|
<import type="com.topjohnwu.magisk.core.Info" />
|
||||||
|
|
||||||
|
<import type="com.topjohnwu.magisk.ui.home.MagiskState" />
|
||||||
|
|
||||||
<variable
|
<variable
|
||||||
name="viewModel"
|
name="viewModel"
|
||||||
type="com.topjohnwu.magisk.ui.home.HomeViewModel" />
|
type="com.topjohnwu.magisk.ui.home.HomeViewModel" />
|
||||||
@ -99,6 +103,35 @@
|
|||||||
android:layout_marginTop="@dimen/l1"
|
android:layout_marginTop="@dimen/l1"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/home_magisk_wrapper" />
|
app:layout_constraintTop_toBottomOf="@+id/home_magisk_wrapper" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
style="@style/WidgetFoundation.Button.Outlined"
|
||||||
|
android:layout_marginStart="@dimen/l1"
|
||||||
|
android:layout_marginEnd="@dimen/l1"
|
||||||
|
android:layout_marginTop="@dimen/l1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/home_check_safetynet"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:onClick="@{() -> viewModel.onSafetyNetPressed()}"
|
||||||
|
app:cornerRadius="@dimen/r1"
|
||||||
|
app:icon="@drawable/ic_safetynet_md2" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
style="@style/WidgetFoundation.Button.Outlined.Error"
|
||||||
|
android:layout_marginStart="@dimen/l1"
|
||||||
|
android:layout_marginEnd="@dimen/l1"
|
||||||
|
android:layout_marginTop="@dimen/l_125"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/uninstall_magisk_title"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:onClick="@{() -> viewModel.onDeletePressed()}"
|
||||||
|
gone="@{Info.env.magiskVersionCode < 0 || viewModel.stateMagisk == MagiskState.LOADING || !viewModel.isConnected}"
|
||||||
|
app:cornerRadius="@dimen/r1"
|
||||||
|
app:icon="@drawable/ic_delete_md2" />
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
style="@style/WidgetFoundation.Card"
|
style="@style/WidgetFoundation.Card"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
<import type="com.topjohnwu.magisk.core.Info" />
|
<import type="com.topjohnwu.magisk.core.Info" />
|
||||||
|
|
||||||
<import type="com.topjohnwu.magisk.core.InfoKt" />
|
|
||||||
|
|
||||||
<import type="com.topjohnwu.magisk.ui.home.MagiskState" />
|
<import type="com.topjohnwu.magisk.ui.home.MagiskState" />
|
||||||
|
|
||||||
<variable
|
<variable
|
||||||
@ -48,22 +46,10 @@
|
|||||||
android:textAppearance="@style/AppearanceFoundation.Title"
|
android:textAppearance="@style/AppearanceFoundation.Title"
|
||||||
android:textColor="?colorPrimary"
|
android:textColor="?colorPrimary"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/home_magisk_icon"
|
app:layout_constraintBottom_toBottomOf="@+id/home_magisk_icon"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/home_magisk_uninstall"
|
app:layout_constraintEnd_toStartOf="@+id/home_magisk_action"
|
||||||
app:layout_constraintStart_toEndOf="@+id/home_magisk_icon"
|
app:layout_constraintStart_toEndOf="@+id/home_magisk_icon"
|
||||||
app:layout_constraintTop_toTopOf="@+id/home_magisk_icon" />
|
app:layout_constraintTop_toTopOf="@+id/home_magisk_icon" />
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/home_magisk_uninstall"
|
|
||||||
style="@style/WidgetFoundation.Icon.Error"
|
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:clickable="true"
|
|
||||||
gone="@{Info.env.magiskVersionCode < 0 || viewModel.stateMagisk == MagiskState.LOADING || !viewModel.isConnected}"
|
|
||||||
android:onClick="@{() -> viewModel.onDeletePressed()}"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/home_magisk_title"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/home_magisk_action"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/home_magisk_title"
|
|
||||||
app:srcCompat="@drawable/ic_delete_md2" />
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/home_magisk_action"
|
android:id="@+id/home_magisk_action"
|
||||||
invisible="@{viewModel.stateMagisk == MagiskState.LOADING || !viewModel.isConnected}"
|
invisible="@{viewModel.stateMagisk == MagiskState.LOADING || !viewModel.isConnected}"
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
app:layout_constraintEnd_toStartOf="@+id/headline_icon_pointer"
|
app:layout_constraintEnd_toStartOf="@+id/headline_icon_pointer"
|
||||||
app:layout_constraintStart_toEndOf="@+id/tappable_icon"
|
app:layout_constraintStart_toEndOf="@+id/tappable_icon"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="@string/magisk_hide_md2" />
|
tools:text="@string/magiskhide" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/headline_icon_pointer"
|
android:id="@+id/headline_icon_pointer"
|
||||||
@ -64,4 +64,4 @@
|
|||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -33,6 +33,14 @@
|
|||||||
app:popEnterAnim="@anim/fragment_enter_pop"
|
app:popEnterAnim="@anim/fragment_enter_pop"
|
||||||
app:popExitAnim="@anim/fragment_exit_pop" />
|
app:popExitAnim="@anim/fragment_exit_pop" />
|
||||||
|
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_homeFragment_to_safetynetFragment"
|
||||||
|
app:destination="@id/safetynetFragment"
|
||||||
|
app:enterAnim="@anim/fragment_enter"
|
||||||
|
app:exitAnim="@anim/fragment_exit"
|
||||||
|
app:popEnterAnim="@anim/fragment_enter_pop"
|
||||||
|
app:popExitAnim="@anim/fragment_exit_pop" />
|
||||||
|
|
||||||
</fragment>
|
</fragment>
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
@ -108,14 +116,6 @@
|
|||||||
android:label="SuperuserFragment"
|
android:label="SuperuserFragment"
|
||||||
tools:layout="@layout/fragment_superuser_md2">
|
tools:layout="@layout/fragment_superuser_md2">
|
||||||
|
|
||||||
<action
|
|
||||||
android:id="@+id/action_superuserFragment_to_safetynetFragment"
|
|
||||||
app:destination="@id/safetynetFragment"
|
|
||||||
app:enterAnim="@anim/fragment_enter"
|
|
||||||
app:exitAnim="@anim/fragment_exit"
|
|
||||||
app:popEnterAnim="@anim/fragment_enter_pop"
|
|
||||||
app:popExitAnim="@anim/fragment_exit_pop" />
|
|
||||||
|
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_superuserFragment_to_hideFragment"
|
android:id="@+id/action_superuserFragment_to_hideFragment"
|
||||||
app:destination="@id/hideFragment"
|
app:destination="@id/hideFragment"
|
||||||
@ -192,4 +192,4 @@
|
|||||||
app:popUpTo="@id/superuserFragment"
|
app:popUpTo="@id/superuserFragment"
|
||||||
app:popUpToInclusive="false" />
|
app:popUpToInclusive="false" />
|
||||||
|
|
||||||
</navigation>
|
</navigation>
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
<string name="invalid_update_channel">Invalid Update Channel</string>
|
<string name="invalid_update_channel">Invalid Update Channel</string>
|
||||||
<string name="uninstall_magisk_title">Uninstall Magisk</string>
|
<string name="uninstall_magisk_title">Uninstall Magisk</string>
|
||||||
<string name="uninstall_magisk_msg">All modules will be disabled/removed!\nRoot will be removed!\nYour data potentially encrypted if not already!</string>
|
<string name="uninstall_magisk_msg">All modules will be disabled/removed!\nRoot will be removed!\nYour data potentially encrypted if not already!</string>
|
||||||
|
<string name="home_check_safetynet">Check SafetyNet</string>
|
||||||
|
|
||||||
<!--Install-->
|
<!--Install-->
|
||||||
<string name="keep_force_encryption">Preserve force encryption</string>
|
<string name="keep_force_encryption">Preserve force encryption</string>
|
||||||
|
@ -87,6 +87,13 @@
|
|||||||
<item name="iconTint">?colorOnPrimary</item>
|
<item name="iconTint">?colorOnPrimary</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="WidgetFoundation.Button.Outlined.Error">
|
||||||
|
<item name="strokeColor">@color/color_error_transient</item>
|
||||||
|
<item name="rippleColor">@color/color_error_transient</item>
|
||||||
|
<item name="android:textColor">@color/color_error_transient</item>
|
||||||
|
<item name="iconTint">@color/color_error_transient</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="WidgetFoundation.Button.Flat" parent="Widget.MaterialComponents.Button.UnelevatedButton">
|
<style name="WidgetFoundation.Button.Flat" parent="Widget.MaterialComponents.Button.UnelevatedButton">
|
||||||
<item name="android:textStyle">bold</item>
|
<item name="android:textStyle">bold</item>
|
||||||
<item name="iconGravity">textStart</item>
|
<item name="iconGravity">textStart</item>
|
||||||
@ -206,4 +213,4 @@
|
|||||||
<item name="srcCompat">@drawable/ic_checkbox</item>
|
<item name="srcCompat">@drawable/ic_checkbox</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user