mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-01-11 19:53:37 +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"
|
||||
|
||||
fun loaded() = RootUtils.fs.getFile(Const.MAGISK_PATH).exists()
|
||||
|
||||
suspend fun installed() = withContext(Dispatchers.IO) {
|
||||
RootUtils.fs.getFile(Const.MAGISK_PATH)
|
||||
.listFiles()
|
||||
|
@ -20,6 +20,7 @@ import com.topjohnwu.magisk.core.Config
|
||||
import com.topjohnwu.magisk.core.Const
|
||||
import com.topjohnwu.magisk.core.Info
|
||||
import com.topjohnwu.magisk.core.isRunningAsStub
|
||||
import com.topjohnwu.magisk.core.model.module.LocalModule
|
||||
import com.topjohnwu.magisk.databinding.ActivityMainMd2Binding
|
||||
import com.topjohnwu.magisk.ktx.startAnimations
|
||||
import com.topjohnwu.magisk.ui.home.HomeFragmentDirections
|
||||
@ -84,7 +85,7 @@ class MainActivity : BaseMainActivity<ActivityMainMd2Binding>() {
|
||||
}
|
||||
binding.mainNavigation.menu.apply {
|
||||
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 =
|
||||
|
@ -37,7 +37,7 @@ class ModuleViewModel : BaseViewModel() {
|
||||
val data get() = uri
|
||||
|
||||
init {
|
||||
if (Info.env.isActive) {
|
||||
if (Info.env.isActive && LocalModule.loaded()) {
|
||||
items.insertItem(InstallModule)
|
||||
.insertList(itemsInstalled)
|
||||
}
|
||||
|
@ -33,7 +33,6 @@
|
||||
tools:listitem="@layout/item_module_md2" />
|
||||
|
||||
<LinearLayout
|
||||
goneUnless="@{viewModel.loading}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@ -41,6 +40,7 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
goneUnless="@{viewModel.loading}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/loading"
|
||||
@ -49,8 +49,16 @@
|
||||
|
||||
<ProgressBar
|
||||
style="@style/WidgetFoundation.ProgressBar.Indeterminate"
|
||||
goneUnless="@{viewModel.loading}"
|
||||
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>
|
||||
|
||||
</FrameLayout>
|
||||
|
@ -111,6 +111,7 @@
|
||||
<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="zygisk_module_unloaded">Zygisk module not loaded due to incompatibility</string>
|
||||
<string name="module_empty">No module installed</string>
|
||||
|
||||
<!--Settings-->
|
||||
<string name="settings_dark_mode_title">Theme Mode</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user