mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 12:05:30 +00:00
Allow download modules when Magisk is not installed
This commit is contained in:
parent
fa3865e962
commit
de4e26b488
@ -1,6 +1,7 @@
|
||||
package com.topjohnwu.magisk.events.dialog
|
||||
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.core.Info
|
||||
import com.topjohnwu.magisk.core.download.Action
|
||||
import com.topjohnwu.magisk.core.download.DownloadService
|
||||
import com.topjohnwu.magisk.core.download.Subject
|
||||
@ -21,17 +22,21 @@ class ModuleInstallDialog(private val item: Repo) : DialogEvent() {
|
||||
applyTitle(context.getString(R.string.repo_install_title, item.name))
|
||||
.applyMessage(context.getString(R.string.repo_install_msg, item.downloadFilename))
|
||||
.cancellable(true)
|
||||
.applyButton(MagiskDialog.ButtonType.POSITIVE) {
|
||||
titleRes = R.string.install
|
||||
icon = R.drawable.ic_install
|
||||
onClick { download(true) }
|
||||
}
|
||||
.applyButton(MagiskDialog.ButtonType.NEGATIVE) {
|
||||
titleRes = R.string.download
|
||||
icon = R.drawable.ic_download_md2
|
||||
onClick { download(false) }
|
||||
}
|
||||
.reveal()
|
||||
|
||||
if (Info.env.isActive) {
|
||||
applyButton(MagiskDialog.ButtonType.POSITIVE) {
|
||||
titleRes = R.string.install
|
||||
icon = R.drawable.ic_install
|
||||
onClick { download(true) }
|
||||
}
|
||||
}
|
||||
|
||||
reveal()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,9 +116,8 @@ open class MainActivity : BaseUIActivity<MainViewModel, ActivityMainMd2Binding>(
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
binding.mainNavigation.menu.apply {
|
||||
val isRoot = Shell.rootAccess()
|
||||
findItem(R.id.modulesFragment)?.isEnabled = isRoot
|
||||
findItem(R.id.superuserFragment)?.isEnabled = isRoot
|
||||
findItem(R.id.superuserFragment)?.isEnabled = Info.env.isActive
|
||||
findItem(R.id.logFragment)?.isEnabled = Info.env.isActive
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import com.topjohnwu.magisk.BR
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.arch.*
|
||||
import com.topjohnwu.magisk.core.Config
|
||||
import com.topjohnwu.magisk.core.Info
|
||||
import com.topjohnwu.magisk.core.download.Subject
|
||||
import com.topjohnwu.magisk.core.model.module.Module
|
||||
import com.topjohnwu.magisk.core.tasks.RepoUpdater
|
||||
@ -100,11 +101,13 @@ class ModuleViewModel(
|
||||
|
||||
val adapter = adapterOf<RvItem>()
|
||||
val items = MergeObservableList<RvItem>()
|
||||
.insertItem(InstallModule)
|
||||
.insertList(updatableSectionList)
|
||||
.insertList(itemsUpdatable)
|
||||
.insertList(installSectionList)
|
||||
.insertList(itemsInstalled)
|
||||
.also { if (Info.env.isActive) {
|
||||
it.insertItem(InstallModule)
|
||||
.insertList(updatableSectionList)
|
||||
.insertList(itemsUpdatable)
|
||||
.insertList(installSectionList)
|
||||
.insertList(itemsInstalled)
|
||||
} }
|
||||
.insertItem(sectionOnline)
|
||||
.insertList(itemsOnline)
|
||||
val itemBinding = itemBindingOf<RvItem> {
|
||||
|
Loading…
Reference in New Issue
Block a user