diff --git a/app/src/main/java/com/topjohnwu/magisk/core/model/module/LocalModule.kt b/app/src/main/java/com/topjohnwu/magisk/core/model/module/LocalModule.kt index f5baa5d54..cd3d5eb12 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/model/module/LocalModule.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/model/module/LocalModule.kt @@ -21,8 +21,12 @@ data class LocalModule( private val disableFile = SuFile(path, "disable") private val updateFile = SuFile(path, "update") private val ruleFile = SuFile(path, "sepolicy.rule") + private val riruFolder = SuFile(path, "riru") + private val zygiskFolder = SuFile(path, "zygisk") val updated: Boolean get() = updateFile.exists() + val isRiru: Boolean get() = (id == "riru-core") || riruFolder.exists() + val isZygisk: Boolean get() = zygiskFolder.exists() var enable: Boolean get() = !disableFile.exists() diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleRvItem.kt b/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleRvItem.kt index 0166187e6..b874d146c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleRvItem.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleRvItem.kt @@ -3,12 +3,14 @@ package com.topjohnwu.magisk.ui.module import androidx.databinding.Bindable import com.topjohnwu.magisk.BR import com.topjohnwu.magisk.R +import com.topjohnwu.magisk.core.Info import com.topjohnwu.magisk.core.model.module.LocalModule import com.topjohnwu.magisk.core.model.module.OnlineModule import com.topjohnwu.magisk.databinding.DiffRvItem import com.topjohnwu.magisk.databinding.ObservableDiffRvItem import com.topjohnwu.magisk.databinding.RvContainer import com.topjohnwu.magisk.databinding.set +import com.topjohnwu.magisk.utils.asText object InstallModule : DiffRvItem() { override val layoutRes = R.layout.item_module_download @@ -70,6 +72,13 @@ class LocalModuleRvItem( item.remove = value } + val isSuspended = + (Info.isZygiskEnabled && item.isRiru) || (!Info.isZygiskEnabled && item.isZygisk) + + val suspendText = + if (item.isRiru) R.string.suspend_text_riru.asText(R.string.zygisk.asText()) + else R.string.suspend_text_zygisk.asText(R.string.zygisk.asText()) + val isUpdated get() = item.updated val isModified get() = isRemoved || isUpdated diff --git a/app/src/main/res/layout/item_module_md2.xml b/app/src/main/res/layout/item_module_md2.xml index 661a54ac5..7d27e1901 100644 --- a/app/src/main/res/layout/item_module_md2.xml +++ b/app/src/main/res/layout/item_module_md2.xml @@ -28,7 +28,7 @@ isEnabled="@{!item.removed}" android:layout_width="match_parent" android:layout_height="wrap_content" - android:alpha="@{item.enabled ? 1f : .5f}" + android:alpha="@{(item.enabled && !item.suspended) ? 1f : .5f}" android:nextFocusRight="@id/module_indicator" tools:layout_gravity="center" tools:layout_margin="@dimen/l1"> @@ -94,6 +94,22 @@ app:layout_constraintStart_toEndOf="@+id/module_info" app:layout_constraintTop_toTopOf="@+id/module_title" /> + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0088fa32f..5cae69fc4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -123,6 +123,8 @@ @string/home_installed_version Online Sorting Order + Module suspended because %1$s is enabled + Module suspended because %1$s is not enabled Theme Mode