manager: improved module update status label

This commit is contained in:
rifsxd
2025-05-29 19:54:21 +06:00
parent 11836b876f
commit 08477fc361
2 changed files with 19 additions and 7 deletions

View File

@@ -603,6 +603,7 @@ private fun ModuleList(
updatedModule.first, updatedModule.first,
"${module.name}-${updatedModule.second}.zip" "${module.name}-${updatedModule.second}.zip"
) )
viewModel.markNeedRefresh()
} }
}, },
onClick = { onClick = {
@@ -688,14 +689,14 @@ fun ModuleItem(
) )
if (module.remove) { if (module.remove) {
LabelItem( LabelItem(
text = stringResource(R.string.uninstall), text = stringResource(R.string.uninstalled),
style = com.dergoogler.mmrl.ui.component.LabelItemDefaults.style.copy( style = com.dergoogler.mmrl.ui.component.LabelItemDefaults.style.copy(
containerColor = MaterialTheme.colorScheme.errorContainer, containerColor = MaterialTheme.colorScheme.errorContainer,
contentColor = MaterialTheme.colorScheme.onErrorContainer contentColor = MaterialTheme.colorScheme.onErrorContainer
) )
) )
} }
if (updateUrl.isNotEmpty() && !module.remove) { if (updateUrl.isNotEmpty() && !module.remove && !module.update) {
LabelItem( LabelItem(
text = stringResource(R.string.module_update), text = stringResource(R.string.module_update),
style = com.dergoogler.mmrl.ui.component.LabelItemDefaults.style.copy( style = com.dergoogler.mmrl.ui.component.LabelItemDefaults.style.copy(
@@ -704,6 +705,17 @@ fun ModuleItem(
) )
) )
} }
if (!module.remove) {
if (module.update) {
LabelItem(
text = stringResource(R.string.module_updated),
style = com.dergoogler.mmrl.ui.component.LabelItemDefaults.style.copy(
containerColor = MaterialTheme.colorScheme.tertiaryContainer,
contentColor = MaterialTheme.colorScheme.onTertiaryContainer
)
)
}
}
if (module.hasWebUi) { if (module.hasWebUi) {
LabelItem( LabelItem(
text = stringResource(R.string.webui), text = stringResource(R.string.webui),
@@ -802,7 +814,9 @@ fun ModuleItem(
onUpdate(module) onUpdate(module)
} }
) )
HorizontalDivider()
} }
if (module.hasWebUi) { if (module.hasWebUi) {
DropdownMenuItem( DropdownMenuItem(
text = { Text(stringResource(R.string.webui)) }, text = { Text(stringResource(R.string.webui)) },
@@ -823,11 +837,7 @@ fun ModuleItem(
) )
} }
if ( if (module.hasWebUi || module.hasActionScript ) {
(updateUrl.isNotEmpty() && !module.remove) ||
module.hasWebUi ||
module.hasActionScript
) {
HorizontalDivider() HorizontalDivider()
} }

View File

@@ -52,6 +52,7 @@
<string name="module_install">Install</string> <string name="module_install">Install</string>
<string name="install">Install</string> <string name="install">Install</string>
<string name="reboot">Reboot</string> <string name="reboot">Reboot</string>
<string name="uninstalled">Uninstalled</string>
<string name="settings">Settings</string> <string name="settings">Settings</string>
<string name="reboot_userspace">Soft Reboot</string> <string name="reboot_userspace">Soft Reboot</string>
<string name="reboot_recovery">Reboot to Recovery</string> <string name="reboot_recovery">Reboot to Recovery</string>
@@ -137,6 +138,7 @@
<string name="profile_selinux_domain">Domain</string> <string name="profile_selinux_domain">Domain</string>
<string name="profile_selinux_rules">Rules</string> <string name="profile_selinux_rules">Rules</string>
<string name="module_update">Update</string> <string name="module_update">Update</string>
<string name="module_updated">Updated</string>
<string name="module_downloading">Downloading module: %s</string> <string name="module_downloading">Downloading module: %s</string>
<string name="module_start_downloading">Start downloading: %s</string> <string name="module_start_downloading">Start downloading: %s</string>
<string name="new_version_available">New version %s is available, click to upgrade.</string> <string name="new_version_available">New version %s is available, click to upgrade.</string>