manager: show webui and action label when a module has it

This commit is contained in:
rifsxd
2025-05-28 20:42:57 +06:00
parent 18f0eb8a36
commit 15b703b5f2
2 changed files with 24 additions and 7 deletions

View File

@@ -679,10 +679,7 @@ fun ModuleItem(
LabelItem( LabelItem(
text = if (module.enabled) stringResource(R.string.enabled) else stringResource(R.string.disabled), text = if (module.enabled) stringResource(R.string.enabled) else stringResource(R.string.disabled),
style = if (module.enabled) style = if (module.enabled)
com.dergoogler.mmrl.ui.component.LabelItemDefaults.style.copy( com.dergoogler.mmrl.ui.component.LabelItemDefaults.style.copy()
containerColor = MaterialTheme.colorScheme.primaryContainer,
contentColor = MaterialTheme.colorScheme.onPrimaryContainer
)
else else
com.dergoogler.mmrl.ui.component.LabelItemDefaults.style.copy( com.dergoogler.mmrl.ui.component.LabelItemDefaults.style.copy(
containerColor = MaterialTheme.colorScheme.errorContainer, containerColor = MaterialTheme.colorScheme.errorContainer,
@@ -690,12 +687,31 @@ fun ModuleItem(
) )
) )
// Update notifier indicator // Update notifier indicator
if (module.hasWebUi) {
LabelItem(
text = stringResource(R.string.webui),
style = com.dergoogler.mmrl.ui.component.LabelItemDefaults.style.copy(
containerColor = MaterialTheme.colorScheme.primaryContainer,
contentColor = MaterialTheme.colorScheme.onPrimaryContainer
)
)
}
// Update notifier indicator
if (module.hasActionScript) {
LabelItem(
text = stringResource(R.string.action),
style = com.dergoogler.mmrl.ui.component.LabelItemDefaults.style.copy(
containerColor = MaterialTheme.colorScheme.secondaryContainer,
contentColor = MaterialTheme.colorScheme.onSecondaryContainer
)
)
}
if (updateUrl.isNotEmpty() && !module.remove) { if (updateUrl.isNotEmpty() && !module.remove) {
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(
containerColor = MaterialTheme.colorScheme.secondaryContainer, containerColor = MaterialTheme.colorScheme.onTertiary,
contentColor = MaterialTheme.colorScheme.onSecondaryContainer contentColor = MaterialTheme.colorScheme.onTertiaryContainer
) )
) )
} }
@@ -774,7 +790,7 @@ fun ModuleItem(
// WebUI // WebUI
if (module.hasWebUi) { if (module.hasWebUi) {
DropdownMenuItem( DropdownMenuItem(
text = { Text(stringResource(R.string.open)) }, text = { Text(stringResource(R.string.webui)) },
onClick = { onClick = {
menuExpanded = false menuExpanded = false
onClick(module) onClick(module)

View File

@@ -177,6 +177,7 @@
<string name="settings_check_update_summary">Automatically check for updates when opening the app.</string> <string name="settings_check_update_summary">Automatically check for updates when opening the app.</string>
<string name="grant_root_failed">Failed to grant root!</string> <string name="grant_root_failed">Failed to grant root!</string>
<string name="action">Action</string> <string name="action">Action</string>
<string name="webui">WebUI</string>
<string name="open">Open</string> <string name="open">Open</string>
<string name="enable_web_debugging">Enable WebView debugging</string> <string name="enable_web_debugging">Enable WebView debugging</string>
<string name="enable_web_debugging_summary">Can be used to debug WebUI. Please enable only when needed.</string> <string name="enable_web_debugging_summary">Can be used to debug WebUI. Please enable only when needed.</string>