mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
Show unloaded Zygisk modules in UI
This commit is contained in:
parent
fbe17dde03
commit
a73acfb9c2
@ -29,10 +29,12 @@ data class LocalModule(
|
|||||||
private val ruleFile = SuFile(path, "sepolicy.rule")
|
private val ruleFile = SuFile(path, "sepolicy.rule")
|
||||||
private val riruFolder = SuFile(path, "riru")
|
private val riruFolder = SuFile(path, "riru")
|
||||||
private val zygiskFolder = SuFile(path, "zygisk")
|
private val zygiskFolder = SuFile(path, "zygisk")
|
||||||
|
private val unloaded = SuFile(zygiskFolder, "unloaded")
|
||||||
|
|
||||||
val updated: Boolean get() = updateFile.exists()
|
val updated: Boolean get() = updateFile.exists()
|
||||||
val isRiru: Boolean get() = (id == "riru-core") || riruFolder.exists()
|
val isRiru: Boolean get() = (id == "riru-core") || riruFolder.exists()
|
||||||
val isZygisk: Boolean get() = zygiskFolder.exists()
|
val isZygisk: Boolean get() = zygiskFolder.exists()
|
||||||
|
val zygiskUnloaded: Boolean get() = unloaded.exists()
|
||||||
|
|
||||||
var enable: Boolean
|
var enable: Boolean
|
||||||
get() = !disableFile.exists()
|
get() = !disableFile.exists()
|
||||||
|
@ -9,6 +9,7 @@ import com.topjohnwu.magisk.databinding.DiffRvItem
|
|||||||
import com.topjohnwu.magisk.databinding.ObservableDiffRvItem
|
import com.topjohnwu.magisk.databinding.ObservableDiffRvItem
|
||||||
import com.topjohnwu.magisk.databinding.RvContainer
|
import com.topjohnwu.magisk.databinding.RvContainer
|
||||||
import com.topjohnwu.magisk.databinding.set
|
import com.topjohnwu.magisk.databinding.set
|
||||||
|
import com.topjohnwu.magisk.utils.TextHolder
|
||||||
import com.topjohnwu.magisk.utils.asText
|
import com.topjohnwu.magisk.utils.asText
|
||||||
|
|
||||||
object InstallModule : DiffRvItem<InstallModule>() {
|
object InstallModule : DiffRvItem<InstallModule>() {
|
||||||
@ -21,6 +22,25 @@ class LocalModuleRvItem(
|
|||||||
|
|
||||||
override val layoutRes = R.layout.item_module_md2
|
override val layoutRes = R.layout.item_module_md2
|
||||||
|
|
||||||
|
val showNotice: Boolean
|
||||||
|
val noticeText: TextHolder
|
||||||
|
|
||||||
|
init {
|
||||||
|
val isZygisk = item.isZygisk
|
||||||
|
val isRiru = item.isRiru
|
||||||
|
val zygiskUnloaded = isZygisk && item.zygiskUnloaded
|
||||||
|
|
||||||
|
showNotice = zygiskUnloaded ||
|
||||||
|
(Info.isZygiskEnabled && isRiru) ||
|
||||||
|
(!Info.isZygiskEnabled && isZygisk)
|
||||||
|
noticeText =
|
||||||
|
when {
|
||||||
|
zygiskUnloaded -> R.string.zygisk_module_unloaded.asText()
|
||||||
|
isRiru -> R.string.suspend_text_riru.asText(R.string.zygisk.asText())
|
||||||
|
else -> R.string.suspend_text_zygisk.asText(R.string.zygisk.asText())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@get:Bindable
|
@get:Bindable
|
||||||
var isEnabled = item.enable
|
var isEnabled = item.enable
|
||||||
set(value) = set(value, field, { field = it }, BR.enabled, BR.updateReady) {
|
set(value) = set(value, field, { field = it }, BR.enabled, BR.updateReady) {
|
||||||
@ -38,14 +58,7 @@ class LocalModuleRvItem(
|
|||||||
get() = item.updateInfo != null && !isRemoved && isEnabled
|
get() = item.updateInfo != null && !isRemoved && isEnabled
|
||||||
set(_) = notifyPropertyChanged(BR.updateReady)
|
set(_) = notifyPropertyChanged(BR.updateReady)
|
||||||
|
|
||||||
val isSuspended =
|
val isUpdated = item.updated
|
||||||
(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
|
|
||||||
|
|
||||||
fun delete() {
|
fun delete() {
|
||||||
isRemoved = !isRemoved
|
isRemoved = !isRemoved
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
style="@style/WidgetFoundation.Card"
|
style="@style/WidgetFoundation.Card"
|
||||||
isEnabled="@{!item.removed && item.enabled && !item.suspended}"
|
isEnabled="@{!item.removed && item.enabled && !item.showNotice}"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:nextFocusRight="@id/module_indicator"
|
android:nextFocusRight="@id/module_indicator"
|
||||||
@ -173,14 +173,14 @@
|
|||||||
tools:constraint_referenced_ids="module_update,module_remove" />
|
tools:constraint_referenced_ids="module_update,module_remove" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/module_suspend_text"
|
android:id="@+id/module_notice_text"
|
||||||
goneUnless="@{item.suspended}"
|
goneUnless="@{item.showNotice}"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/l1"
|
android:layout_marginStart="@dimen/l1"
|
||||||
android:layout_marginEnd="@dimen/l_50"
|
android:layout_marginEnd="@dimen/l_50"
|
||||||
android:fontFamily="sans-serif-medium"
|
android:fontFamily="sans-serif-medium"
|
||||||
android:text="@{item.suspendText}"
|
android:text="@{item.noticeText}"
|
||||||
android:textAppearance="@style/AppearanceFoundation.Caption.Primary"
|
android:textAppearance="@style/AppearanceFoundation.Caption.Primary"
|
||||||
android:textColor="?colorError"
|
android:textColor="?colorError"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/module_remove"
|
app:layout_constraintBottom_toBottomOf="@+id/module_remove"
|
||||||
|
@ -110,6 +110,7 @@
|
|||||||
<string name="update_available">Update Available</string>
|
<string name="update_available">Update Available</string>
|
||||||
<string name="suspend_text_riru">Module suspended because %1$s is enabled</string>
|
<string name="suspend_text_riru">Module suspended because %1$s is enabled</string>
|
||||||
<string name="suspend_text_zygisk">Module suspended because %1$s is not enabled</string>
|
<string name="suspend_text_zygisk">Module suspended because %1$s is not enabled</string>
|
||||||
|
<string name="zygisk_module_unloaded">Zygisk module not loaded due to incompatibility</string>
|
||||||
|
|
||||||
<!--Settings-->
|
<!--Settings-->
|
||||||
<string name="settings_dark_mode_title">Theme Mode</string>
|
<string name="settings_dark_mode_title">Theme Mode</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user