mirror of
https://github.com/ReVanced/revanced-manager
synced 2026-04-25 17:15:36 +02:00
fix: Improve notification cards
- Smaller text size - Removed text buttons from announcement notifications
This commit is contained in:
@@ -25,6 +25,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import app.revanced.manager.R
|
||||
|
||||
@@ -57,7 +58,7 @@ fun NotificationCard(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(16.dp),
|
||||
verticalAlignment = Alignment.Top,
|
||||
verticalAlignment = if (actions != null) Alignment.Top else Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
||||
) {
|
||||
Box(
|
||||
@@ -74,18 +75,21 @@ fun NotificationCard(
|
||||
modifier = Modifier.weight(1f),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
title?.let {
|
||||
Column {
|
||||
title?.let {
|
||||
Text(
|
||||
text = it,
|
||||
style = MaterialTheme.typography.bodyMediumEmphasized.merge(fontWeight = FontWeight.SemiBold),
|
||||
color = LocalContentColor.current,
|
||||
)
|
||||
}
|
||||
Text(
|
||||
text = it,
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
text = text,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = LocalContentColor.current,
|
||||
)
|
||||
}
|
||||
Text(
|
||||
text = text,
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
color = LocalContentColor.current,
|
||||
)
|
||||
|
||||
actions?.let {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
@@ -95,11 +99,14 @@ fun NotificationCard(
|
||||
}
|
||||
}
|
||||
if (onDismiss != null) {
|
||||
// @TODO: Use xsmall icon buttons when that is available in Compose
|
||||
TooltipIconButton(
|
||||
modifier = Modifier.size(32.dp),
|
||||
onClick = onDismiss,
|
||||
tooltip = stringResource(R.string.close),
|
||||
) {
|
||||
Icon(
|
||||
modifier = Modifier.size(20.dp),
|
||||
imageVector = Icons.Outlined.Close,
|
||||
contentDescription = stringResource(R.string.close),
|
||||
)
|
||||
|
||||
@@ -450,36 +450,15 @@ fun DashboardScreen(
|
||||
vm.unreadAnnouncement?.let { announcement ->
|
||||
{
|
||||
NotificationCard(
|
||||
text = stringResource(R.string.new_announcement, announcement.title),
|
||||
title = stringResource(R.string.new_announcement),
|
||||
text = announcement.title,
|
||||
icon = Icons.Filled.Notifications,
|
||||
actions = {
|
||||
val colors = ButtonDefaults.textButtonColors(
|
||||
contentColor = LocalContentColor.current
|
||||
)
|
||||
|
||||
TextButton(
|
||||
onClick = vm::markUnreadAnnouncementRead,
|
||||
shapes = ButtonDefaults.shapes(),
|
||||
colors = colors
|
||||
) {
|
||||
Text(stringResource(R.string.dismiss))
|
||||
}
|
||||
TextButton(
|
||||
onClick = {
|
||||
vm.markUnreadAnnouncementRead()
|
||||
onAnnouncementClick(announcement)
|
||||
},
|
||||
shapes = ButtonDefaults.shapes(),
|
||||
colors = colors
|
||||
) {
|
||||
Text(stringResource(R.string.view_announcement))
|
||||
}
|
||||
},
|
||||
type = if (announcement.level > 0) NotificationCardType.ERROR else NotificationCardType.NORMAL,
|
||||
onClick = {
|
||||
vm.markUnreadAnnouncementRead()
|
||||
onAnnouncementClick(announcement)
|
||||
}
|
||||
},
|
||||
onDismiss = vm::markUnreadAnnouncementRead
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -569,7 +569,7 @@ Tap them for more details.</string>
|
||||
<string name="failed_to_import_keystore">Couldn’t import keystore</string>
|
||||
<string name="export">Export</string>
|
||||
<string name="confirm">Confirm</string>
|
||||
<string name="new_announcement">New announcement:\n%s</string>
|
||||
<string name="new_announcement">New announcement</string>
|
||||
|
||||
<string name="generic_required">Required</string>
|
||||
<string name="generic_optional">Optional</string>
|
||||
|
||||
Reference in New Issue
Block a user