manager: fix module install
This commit is contained in:
@@ -177,6 +177,8 @@ private fun ModuleList(
|
||||
onRefresh = { viewModel.fetchModuleList() })
|
||||
Box(modifier.pullRefresh(refreshState)) {
|
||||
if (viewModel.isOverlayAvailable) {
|
||||
val context = LocalContext.current
|
||||
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.spacedBy(16.dp),
|
||||
@@ -206,8 +208,8 @@ private fun ModuleList(
|
||||
viewModel.checkUpdate(module) { value = it.orEmpty() }
|
||||
}
|
||||
|
||||
val context = LocalContext.current
|
||||
val downloadingText = stringResource(R.string.module_downloading)
|
||||
val startDownloadingText = stringResource(R.string.module_start_downloading)
|
||||
|
||||
ModuleItem(module, isChecked, updateUrl, onUninstall = {
|
||||
scope.launch { onModuleUninstall(module) }
|
||||
@@ -231,6 +233,14 @@ private fun ModuleList(
|
||||
}
|
||||
}, onUpdate = {
|
||||
|
||||
scope.launch {
|
||||
Toast.makeText(
|
||||
context,
|
||||
startDownloadingText.format(module.name),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
|
||||
val downloading = downloadingText.format(module.name)
|
||||
download(
|
||||
context,
|
||||
@@ -244,13 +254,14 @@ private fun ModuleList(
|
||||
)
|
||||
})
|
||||
|
||||
DownloadListener(context, onInstallModule)
|
||||
|
||||
// fix last item shadow incomplete in LazyColumn
|
||||
Spacer(Modifier.height(1.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DownloadListener(context, onInstallModule)
|
||||
|
||||
} else {
|
||||
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||
Text(stringResource(R.string.module_overlay_fs_not_available))
|
||||
@@ -364,7 +375,7 @@ private fun ModuleItem(
|
||||
Button(
|
||||
modifier = Modifier
|
||||
.padding(0.dp)
|
||||
.defaultMinSize(48.dp, 32.dp),
|
||||
.defaultMinSize(52.dp, 32.dp),
|
||||
onClick = { onUpdate(module) },
|
||||
shape = RoundedCornerShape(6.dp),
|
||||
contentPadding = PaddingValues(0.dp)
|
||||
|
||||
@@ -52,6 +52,17 @@
|
||||
<string name="home_support_title">支持开发</string>
|
||||
<string name="home_support_content">KernelSU 将保持免费和开源,向开发者捐赠以表示支持。</string>
|
||||
<string name="about_source_code"><![CDATA[在 %1$s 查看源码<br/>加入我们的 %2$s 频道<br/>加入我们的 <b><a href="https://pd.qq.com/s/8lipl1brp">QQ 频道</a></b>]]></string>
|
||||
<string name="profile_default">默认</string>
|
||||
<string name="profile_template">模版</string>
|
||||
<string name="profile_custom">自定义</string>
|
||||
<string name="profile_name">名称</string>
|
||||
<string name="profile_namespace">命名空间</string>
|
||||
<string name="profile_namespace_inherited">继承</string>
|
||||
<string name="profile_namespace_global">全局</string>
|
||||
<string name="profile_namespace_individual">私有</string>
|
||||
<string name="profile_groups">组</string>
|
||||
<string name="profile_capabilities">权能</string>
|
||||
<string name="profile_selinux_context">SELinux</string>
|
||||
<string name="profile_umount_modules">卸载模块</string>
|
||||
<string name="failed_to_update_app_profile">为 %s 更新 App Profile 失败</string>
|
||||
<string name="require_kernel_version">当前内核版本 %d 过低,管理器无法正常工作,请升级内核版本至 %d 或以上!</string>
|
||||
@@ -62,4 +73,5 @@
|
||||
<string name="profile_selinux_rules">规则</string>
|
||||
<string name="module_update">更新</string>
|
||||
<string name="module_downloading">正在下载模块:%s</string>
|
||||
<string name="module_start_downloading">开始下载:%s</string>
|
||||
</resources>
|
||||
|
||||
@@ -78,4 +78,5 @@
|
||||
<string name="profile_selinux_rules">Rules</string>
|
||||
<string name="module_update">Update</string>
|
||||
<string name="module_downloading">Downloading module: %s</string>
|
||||
<string name="module_start_downloading">Start downloading: %s</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user