mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-04-18 22:41:28 +00:00
Display module status
This commit is contained in:
parent
0cc29350a0
commit
580c993c0b
@ -138,6 +138,8 @@ data class LocalModule(
|
|||||||
|
|
||||||
private val PERSIST get() = "${Const.MAGISKTMP}/mirror/persist/magisk"
|
private val PERSIST get() = "${Const.MAGISKTMP}/mirror/persist/magisk"
|
||||||
|
|
||||||
|
fun loaded() = RootUtils.fs.getFile(Const.MAGISK_PATH).exists()
|
||||||
|
|
||||||
suspend fun installed() = withContext(Dispatchers.IO) {
|
suspend fun installed() = withContext(Dispatchers.IO) {
|
||||||
RootUtils.fs.getFile(Const.MAGISK_PATH)
|
RootUtils.fs.getFile(Const.MAGISK_PATH)
|
||||||
.listFiles()
|
.listFiles()
|
||||||
|
@ -20,6 +20,7 @@ import com.topjohnwu.magisk.core.Config
|
|||||||
import com.topjohnwu.magisk.core.Const
|
import com.topjohnwu.magisk.core.Const
|
||||||
import com.topjohnwu.magisk.core.Info
|
import com.topjohnwu.magisk.core.Info
|
||||||
import com.topjohnwu.magisk.core.isRunningAsStub
|
import com.topjohnwu.magisk.core.isRunningAsStub
|
||||||
|
import com.topjohnwu.magisk.core.model.module.LocalModule
|
||||||
import com.topjohnwu.magisk.databinding.ActivityMainMd2Binding
|
import com.topjohnwu.magisk.databinding.ActivityMainMd2Binding
|
||||||
import com.topjohnwu.magisk.ktx.startAnimations
|
import com.topjohnwu.magisk.ktx.startAnimations
|
||||||
import com.topjohnwu.magisk.ui.home.HomeFragmentDirections
|
import com.topjohnwu.magisk.ui.home.HomeFragmentDirections
|
||||||
@ -84,7 +85,7 @@ class MainActivity : BaseMainActivity<ActivityMainMd2Binding>() {
|
|||||||
}
|
}
|
||||||
binding.mainNavigation.menu.apply {
|
binding.mainNavigation.menu.apply {
|
||||||
findItem(R.id.superuserFragment)?.isEnabled = Utils.showSuperUser()
|
findItem(R.id.superuserFragment)?.isEnabled = Utils.showSuperUser()
|
||||||
findItem(R.id.modulesFragment)?.isEnabled = Info.env.isActive
|
findItem(R.id.modulesFragment)?.isEnabled = Info.env.isActive && LocalModule.loaded()
|
||||||
}
|
}
|
||||||
|
|
||||||
val section =
|
val section =
|
||||||
|
@ -37,7 +37,7 @@ class ModuleViewModel : BaseViewModel() {
|
|||||||
val data get() = uri
|
val data get() = uri
|
||||||
|
|
||||||
init {
|
init {
|
||||||
if (Info.env.isActive) {
|
if (Info.env.isActive && LocalModule.loaded()) {
|
||||||
items.insertItem(InstallModule)
|
items.insertItem(InstallModule)
|
||||||
.insertList(itemsInstalled)
|
.insertList(itemsInstalled)
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
tools:listitem="@layout/item_module_md2" />
|
tools:listitem="@layout/item_module_md2" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
goneUnless="@{viewModel.loading}"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
@ -41,6 +40,7 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
goneUnless="@{viewModel.loading}"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/loading"
|
android:text="@string/loading"
|
||||||
@ -49,8 +49,16 @@
|
|||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
style="@style/WidgetFoundation.ProgressBar.Indeterminate"
|
style="@style/WidgetFoundation.ProgressBar.Indeterminate"
|
||||||
|
goneUnless="@{viewModel.loading}"
|
||||||
android:layout_marginTop="@dimen/l1" />
|
android:layout_marginTop="@dimen/l1" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
gone="@{viewModel.loading || viewModel.items.size() != 1 }"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/module_empty"
|
||||||
|
android:textAppearance="@style/AppearanceFoundation.Title"
|
||||||
|
android:textStyle="bold" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
@ -111,6 +111,7 @@
|
|||||||
<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>
|
<string name="zygisk_module_unloaded">Zygisk module not loaded due to incompatibility</string>
|
||||||
|
<string name="module_empty">No module installed</string>
|
||||||
|
|
||||||
<!--Settings-->
|
<!--Settings-->
|
||||||
<string name="settings_dark_mode_title">Theme Mode</string>
|
<string name="settings_dark_mode_title">Theme Mode</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user