enhancement: increase action button size (#869)

This commit is contained in:
Diego Beraldin 2024-05-19 10:59:48 +02:00 committed by GitHub
parent 1f05bdeedf
commit fa79ca39ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 539 additions and 540 deletions

View File

@ -139,7 +139,7 @@ fun FloatingActionButtonMenu(
Icon(
modifier =
Modifier
.size(IconSize.m)
.size(IconSize.l)
.background(
color = MaterialTheme.colorScheme.primaryContainer,
shape = CircleShape,

View File

@ -73,87 +73,87 @@ fun CommunityAndCreatorInfo(
val fullColor = MaterialTheme.colorScheme.onBackground.copy(alpha = additionalAlphaFactor)
val ancillaryColor = MaterialTheme.colorScheme.onBackground.copy(alpha = ancillaryTextAlpha * additionalAlphaFactor)
Row(
modifier = modifier,
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Spacing.s),
) {
if (communityIcon.isNotEmpty()) {
if (autoLoadImages) {
CustomImage(
modifier =
Modifier
.onClick(
CustomizedContent(ContentFontClass.AncillaryText) {
Row(
modifier = modifier,
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Spacing.s),
) {
if (communityIcon.isNotEmpty()) {
if (autoLoadImages) {
CustomImage(
modifier =
Modifier
.onClick(
onClick = {
if (community != null) {
onOpenCommunity?.invoke(community)
}
},
onDoubleClick = onDoubleClick ?: {},
)
.padding(Spacing.xxxs)
.size(iconSize)
.clip(RoundedCornerShape(iconSize / 2)),
url = communityIcon,
quality = FilterQuality.Low,
contentScale = ContentScale.FillBounds,
)
} else {
PlaceholderImage(
modifier =
Modifier.onClick(
onClick = {
if (community != null) {
onOpenCommunity?.invoke(community)
}
},
onDoubleClick = onDoubleClick ?: {},
)
.padding(Spacing.xxxs)
.size(iconSize)
.clip(RoundedCornerShape(iconSize / 2)),
url = communityIcon,
quality = FilterQuality.Low,
contentScale = ContentScale.FillBounds,
)
} else {
PlaceholderImage(
modifier =
Modifier.onClick(
onClick = {
if (community != null) {
onOpenCommunity?.invoke(community)
}
},
onDoubleClick = onDoubleClick ?: {},
),
size = IconSize.l,
title = communityName,
)
}
} else if (creatorAvatar.isNotEmpty()) {
if (autoLoadImages) {
CustomImage(
modifier =
Modifier
.onClick(
),
size = IconSize.l,
title = communityName,
)
}
} else if (creatorAvatar.isNotEmpty()) {
if (autoLoadImages) {
CustomImage(
modifier =
Modifier
.onClick(
onClick = {
if (creator != null) {
onOpenCreator?.invoke(creator)
}
},
onDoubleClick = onDoubleClick ?: {},
)
.padding(Spacing.xxxs)
.size(iconSize)
.clip(RoundedCornerShape(iconSize / 2)),
url = creatorAvatar,
quality = FilterQuality.Low,
contentScale = ContentScale.FillBounds,
)
} else {
PlaceholderImage(
modifier =
Modifier.onClick(
onClick = {
if (creator != null) {
onOpenCreator?.invoke(creator)
}
},
onDoubleClick = onDoubleClick ?: {},
)
.padding(Spacing.xxxs)
.size(iconSize)
.clip(RoundedCornerShape(iconSize / 2)),
url = creatorAvatar,
quality = FilterQuality.Low,
contentScale = ContentScale.FillBounds,
)
} else {
PlaceholderImage(
modifier =
Modifier.onClick(
onClick = {
if (creator != null) {
onOpenCreator?.invoke(creator)
}
},
onDoubleClick = onDoubleClick ?: {},
),
size = iconSize,
title = creatorName,
)
),
size = iconSize,
title = creatorName,
)
}
}
}
Column(
modifier = Modifier.padding(vertical = Spacing.xxxs),
) {
if (community != null) {
CustomizedContent(ContentFontClass.AncillaryText) {
Column(
modifier = Modifier.padding(vertical = Spacing.xxxs),
) {
if (community != null) {
Text(
modifier =
Modifier
@ -169,9 +169,7 @@ fun CommunityAndCreatorInfo(
color = if (creator == null) ancillaryColor else fullColor,
)
}
}
if (creator != null) {
CustomizedContent(ContentFontClass.AncillaryText) {
if (creator != null) {
Text(
modifier =
Modifier
@ -188,78 +186,78 @@ fun CommunityAndCreatorInfo(
)
}
}
}
if (isOp) {
IndicatorChip(
modifier = Modifier.align(Alignment.CenterVertically),
text = OP_LABEL,
)
}
if (isBot) {
IndicatorChip(
modifier = Modifier.align(Alignment.CenterVertically),
text = BOT_LABEL,
)
}
if (isOp) {
IndicatorChip(
modifier = Modifier.align(Alignment.CenterVertically),
text = OP_LABEL,
)
}
if (isBot) {
IndicatorChip(
modifier = Modifier.align(Alignment.CenterVertically),
text = BOT_LABEL,
)
}
Spacer(modifier = Modifier.weight(1f))
Spacer(modifier = Modifier.weight(1f))
val buttonModifier = Modifier.size(IconSize.m).padding(3.5.dp)
if (isFromModerator) {
Icon(
modifier = buttonModifier,
imageVector = Icons.Default.LocalPolice,
contentDescription = null,
)
}
if (distinguished) {
Icon(
modifier = buttonModifier,
imageVector = Icons.Default.WorkspacePremium,
contentDescription = null,
)
} else if (featuredLocal) {
Icon(
modifier = buttonModifier,
imageVector = Icons.Default.Verified,
contentDescription = null,
)
} else if (featuredCommunity) {
Icon(
modifier = buttonModifier,
imageVector = Icons.Default.Stars,
contentDescription = null,
)
}
val buttonModifier = Modifier.size(IconSize.l).padding(3.5.dp)
if (isFromModerator) {
Icon(
modifier = buttonModifier,
imageVector = Icons.Default.LocalPolice,
contentDescription = null,
)
}
if (distinguished) {
Icon(
modifier = buttonModifier,
imageVector = Icons.Default.WorkspacePremium,
contentDescription = null,
)
} else if (featuredLocal) {
Icon(
modifier = buttonModifier,
imageVector = Icons.Default.Verified,
contentDescription = null,
)
} else if (featuredCommunity) {
Icon(
modifier = buttonModifier,
imageVector = Icons.Default.Stars,
contentDescription = null,
)
}
if (locked) {
Icon(
modifier = buttonModifier,
imageVector = Icons.Default.Lock,
contentDescription = null,
)
}
if (indicatorExpanded != null) {
val expandedModifier =
Modifier
.padding(end = Spacing.xs)
.onClick(
onClick = {
onToggleExpanded?.invoke()
},
if (locked) {
Icon(
modifier = buttonModifier,
imageVector = Icons.Default.Lock,
contentDescription = null,
)
}
if (indicatorExpanded != null) {
val expandedModifier =
Modifier
.padding(end = Spacing.xs)
.onClick(
onClick = {
onToggleExpanded?.invoke()
},
)
if (indicatorExpanded) {
Icon(
modifier = expandedModifier,
imageVector = Icons.Default.ExpandLess,
contentDescription = null,
)
if (indicatorExpanded) {
Icon(
modifier = expandedModifier,
imageVector = Icons.Default.ExpandLess,
contentDescription = null,
)
} else {
Icon(
modifier = expandedModifier,
imageVector = Icons.Default.ExpandMore,
contentDescription = null,
)
} else {
Icon(
modifier = expandedModifier,
imageVector = Icons.Default.ExpandMore,
contentDescription = null,
)
}
}
}
}

View File

@ -79,7 +79,7 @@ fun InboxReplySubtitle(
onOptionSelected: ((OptionId) -> Unit)? = null,
onReply: (() -> Unit)? = null,
) {
val buttonModifier = Modifier.size(IconSize.m)
val buttonModifier = Modifier.size(IconSize.l)
val themeRepository = remember { getThemeRepository() }
val upVoteColor by themeRepository.upVoteColor.collectAsState()
val downVoteColor by themeRepository.downVoteColor.collectAsState()
@ -89,48 +89,48 @@ fun InboxReplySubtitle(
var optionsOffset by remember { mutableStateOf(Offset.Zero) }
val ancillaryColor = MaterialTheme.colorScheme.onBackground.copy(alpha = ancillaryTextAlpha)
Column(
modifier = modifier,
verticalArrangement = Arrangement.spacedBy(Spacing.xxs),
) {
val communityName = community?.readableName(preferNicknames).orEmpty()
val communityIcon = community?.icon.orEmpty()
val creatorName = creator?.readableName(preferNicknames).orEmpty()
val creatorAvatar = creator?.avatar.orEmpty()
if (communityName.isNotEmpty() || creatorName.isNotEmpty()) {
Row(
modifier = Modifier.padding(horizontal = Spacing.xxs),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Spacing.xs),
) {
if (creatorName.isNotEmpty()) {
Row(
modifier =
Modifier
.weight(1f)
.onClick(
onClick = {
if (creator != null) {
onOpenCreator?.invoke(creator)
}
},
),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Spacing.xxs),
) {
if (creatorAvatar.isNotEmpty() && autoLoadImages) {
CustomImage(
modifier =
Modifier
.padding(Spacing.xxxs)
.size(iconSize)
.clip(RoundedCornerShape(iconSize / 2)),
url = creatorAvatar,
quality = FilterQuality.Low,
contentScale = ContentScale.FillBounds,
)
}
CustomizedContent(ContentFontClass.AncillaryText) {
CustomizedContent(ContentFontClass.AncillaryText) {
Column(
modifier = modifier,
verticalArrangement = Arrangement.spacedBy(Spacing.xxs),
) {
val communityName = community?.readableName(preferNicknames).orEmpty()
val communityIcon = community?.icon.orEmpty()
val creatorName = creator?.readableName(preferNicknames).orEmpty()
val creatorAvatar = creator?.avatar.orEmpty()
if (communityName.isNotEmpty() || creatorName.isNotEmpty()) {
Row(
modifier = Modifier.padding(horizontal = Spacing.xxs),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Spacing.xs),
) {
if (creatorName.isNotEmpty()) {
Row(
modifier =
Modifier
.weight(1f)
.onClick(
onClick = {
if (creator != null) {
onOpenCreator?.invoke(creator)
}
},
),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Spacing.xxs),
) {
if (creatorAvatar.isNotEmpty() && autoLoadImages) {
CustomImage(
modifier =
Modifier
.padding(Spacing.xxxs)
.size(iconSize)
.clip(RoundedCornerShape(iconSize / 2)),
url = creatorAvatar,
quality = FilterQuality.Low,
contentScale = ContentScale.FillBounds,
)
}
Text(
modifier = Modifier.padding(vertical = Spacing.xs),
text = creatorName,
@ -141,181 +141,181 @@ fun InboxReplySubtitle(
)
}
}
if (communityName.isNotEmpty()) {
Row(
modifier =
Modifier
.weight(1f)
.onClick(
onClick = {
if (community != null) {
onOpenCommunity?.invoke(community)
}
},
),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Spacing.xs),
) {
Spacer(modifier = Modifier.weight(1f))
if (communityIcon.isNotEmpty() && autoLoadImages) {
CustomImage(
modifier =
Modifier
.padding(Spacing.xxxs)
.size(iconSize)
.clip(RoundedCornerShape(iconSize / 2)),
url = communityIcon,
quality = FilterQuality.Low,
contentScale = ContentScale.FillBounds,
)
}
CustomizedContent(ContentFontClass.AncillaryText) {
Text(
modifier = Modifier.padding(vertical = Spacing.xs),
text = communityName,
style = MaterialTheme.typography.bodySmall,
overflow = TextOverflow.Ellipsis,
maxLines = 1,
color = ancillaryColor,
)
}
}
}
}
if (communityName.isNotEmpty()) {
Box {
Row(
modifier =
Modifier
.weight(1f)
.onClick(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Spacing.xxs),
) {
Icon(
modifier =
buttonModifier.padding(
top = 3.5.dp,
bottom = 3.5.dp,
end = 3.5.dp,
).onClick(
onClick = {
if (community != null) {
onOpenCommunity?.invoke(community)
}
onReply?.invoke()
},
),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Spacing.xs),
) {
Spacer(modifier = Modifier.weight(1f))
if (communityIcon.isNotEmpty() && autoLoadImages) {
CustomImage(
modifier =
Modifier
.padding(Spacing.xxxs)
.size(iconSize)
.clip(RoundedCornerShape(iconSize / 2)),
url = communityIcon,
quality = FilterQuality.Low,
contentScale = ContentScale.FillBounds,
imageVector = Icons.AutoMirrored.Default.Chat,
contentDescription = null,
tint = ancillaryColor,
)
Row(
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
modifier = Modifier.size(IconSize.m).padding(1.5.dp),
imageVector = Icons.Default.Schedule,
contentDescription = null,
tint = ancillaryColor,
)
}
CustomizedContent(ContentFontClass.AncillaryText) {
Text(
modifier = Modifier.padding(vertical = Spacing.xs),
text = communityName,
style = MaterialTheme.typography.bodySmall,
overflow = TextOverflow.Ellipsis,
maxLines = 1,
modifier = Modifier.padding(start = Spacing.xxs),
text = date?.prettifyDate() ?: "",
style = MaterialTheme.typography.labelMedium,
color = ancillaryColor,
)
}
}
}
}
Box {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Spacing.xxs),
) {
Icon(
modifier =
buttonModifier.padding(
top = 3.5.dp,
bottom = 3.5.dp,
end = 3.5.dp,
).onClick(
onClick = {
onReply?.invoke()
},
),
imageVector = Icons.AutoMirrored.Default.Chat,
contentDescription = null,
tint = ancillaryColor,
)
Row(
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
modifier = Modifier.size(IconSize.s).padding(0.5.dp),
imageVector = Icons.Default.Schedule,
contentDescription = null,
tint = ancillaryColor,
)
Text(
modifier = Modifier.padding(start = Spacing.xxs),
text = date?.prettifyDate() ?: "",
style = MaterialTheme.typography.labelMedium,
color = ancillaryColor,
)
}
if (options.isNotEmpty()) {
Icon(
modifier =
Modifier.size(IconSize.m)
.padding(Spacing.xs)
.onGloballyPositioned {
optionsOffset = it.positionInParent()
}
.onClick(
onClick = {
optionsExpanded = true
},
),
imageVector = Icons.Default.MoreHoriz,
contentDescription = null,
tint = ancillaryColor,
)
}
Spacer(modifier = Modifier.weight(1f))
FeedbackButton(
modifier =
buttonModifier.padding(
top = 2.5.dp,
bottom = 2.5.dp,
end = 2.5.dp,
),
imageVector = Icons.Default.ArrowCircleUp,
tintColor =
if (upVoted) {
upVoteColor ?: defaultUpvoteColor
} else {
ancillaryColor
},
onClick = {
onUpVote?.invoke()
},
)
if (showScores) {
Text(
text =
formatToReadableValue(
voteFormat = voteFormat,
score = score,
upVotes = upVotes,
downVotes = downVotes,
upVoteColor = upVoteColor ?: defaultUpvoteColor,
downVoteColor = downVoteColor ?: defaultDownVoteColor,
upVoted = upVoted,
downVoted = downVoted,
),
style = MaterialTheme.typography.labelMedium,
color = ancillaryColor,
)
}
if (downVoteEnabled) {
if (options.isNotEmpty()) {
Icon(
modifier =
Modifier.size(IconSize.m)
.padding(Spacing.xs)
.onGloballyPositioned {
optionsOffset = it.positionInParent()
}
.onClick(
onClick = {
optionsExpanded = true
},
),
imageVector = Icons.Default.MoreHoriz,
contentDescription = null,
tint = ancillaryColor,
)
}
Spacer(modifier = Modifier.weight(1f))
FeedbackButton(
modifier =
buttonModifier.padding(
top = 2.5.dp,
bottom = 2.5.dp,
start = 2.5.dp,
end = 2.5.dp,
),
imageVector = Icons.Default.ArrowCircleDown,
imageVector = Icons.Default.ArrowCircleUp,
tintColor =
if (downVoted) {
downVoteColor ?: defaultDownVoteColor
if (upVoted) {
upVoteColor ?: defaultUpvoteColor
} else {
ancillaryColor
},
onClick = {
onDownVote?.invoke()
onUpVote?.invoke()
},
)
if (showScores) {
Text(
text =
formatToReadableValue(
voteFormat = voteFormat,
score = score,
upVotes = upVotes,
downVotes = downVotes,
upVoteColor = upVoteColor ?: defaultUpvoteColor,
downVoteColor = downVoteColor ?: defaultDownVoteColor,
upVoted = upVoted,
downVoted = downVoted,
),
style = MaterialTheme.typography.labelMedium,
color = ancillaryColor,
)
}
if (downVoteEnabled) {
FeedbackButton(
modifier =
buttonModifier.padding(
top = 2.5.dp,
bottom = 2.5.dp,
start = 2.5.dp,
),
imageVector = Icons.Default.ArrowCircleDown,
tintColor =
if (downVoted) {
downVoteColor ?: defaultDownVoteColor
} else {
ancillaryColor
},
onClick = {
onDownVote?.invoke()
},
)
}
}
}
CustomDropDown(
expanded = optionsExpanded,
onDismiss = {
optionsExpanded = false
},
offset =
DpOffset(
x = optionsOffset.x.toLocalDp(),
y = optionsOffset.y.toLocalDp(),
),
) {
options.forEach { option ->
DropdownMenuItem(
text = {
Text(option.text)
},
onClick = {
optionsExpanded = false
onOptionSelected?.invoke(option.id)
},
)
CustomDropDown(
expanded = optionsExpanded,
onDismiss = {
optionsExpanded = false
},
offset =
DpOffset(
x = optionsOffset.x.toLocalDp(),
y = optionsOffset.y.toLocalDp(),
),
) {
options.forEach { option ->
DropdownMenuItem(
text = {
Text(option.text)
},
onClick = {
optionsExpanded = false
onOptionSelected?.invoke(option.id)
},
)
}
}
}
}

View File

@ -40,12 +40,14 @@ import androidx.compose.ui.unit.dp
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.data.VoteFormat
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.data.formatToReadableValue
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.di.getThemeRepository
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.repository.ContentFontClass
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.CornerSize
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.IconSize
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.Spacing
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.ancillaryTextAlpha
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.readContentAlpha
import com.github.diegoberaldin.raccoonforlemmy.core.commonui.components.CustomDropDown
import com.github.diegoberaldin.raccoonforlemmy.core.commonui.components.CustomizedContent
import com.github.diegoberaldin.raccoonforlemmy.core.commonui.components.FeedbackButton
import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.onClick
import com.github.diegoberaldin.raccoonforlemmy.core.utils.datetime.prettifyDate
@ -87,218 +89,220 @@ fun PostCardFooter(
val ancillaryColor =
MaterialTheme.colorScheme.onBackground.copy(alpha = ancillaryTextAlpha * additionalAlphaFactor)
Box(modifier = modifier) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Spacing.xxs),
) {
val buttonModifier = Modifier.size(IconSize.m)
if (comments != null) {
Row(
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
CustomizedContent(ContentFontClass.AncillaryText) {
Box(modifier = modifier) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Spacing.xxs),
) {
val buttonModifier = Modifier.size(IconSize.l)
if (comments != null) {
Row(
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
modifier =
buttonModifier.padding(
top = 3.5.dp,
end = 3.5.dp,
bottom = 3.5.dp,
)
.onClick(
onClick = {
onReply?.invoke()
},
),
imageVector = Icons.AutoMirrored.Default.Chat,
contentDescription = null,
tint = ancillaryColor,
)
Text(
text = "$comments",
style = MaterialTheme.typography.labelMedium,
color = ancillaryColor,
)
}
}
if (unreadComments != null) {
Text(
modifier =
buttonModifier.padding(
top = 3.5.dp,
end = 3.5.dp,
bottom = 3.5.dp,
)
.onClick(
onClick = {
onReply?.invoke()
Modifier
.padding(start = Spacing.xxs)
.background(
color = MaterialTheme.colorScheme.secondary,
shape = RoundedCornerShape(CornerSize.s),
)
.padding(horizontal = Spacing.xxs),
text = "+$unreadComments",
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.onSecondary,
)
}
listOf(
updateDate.orEmpty(),
publishDate.orEmpty(),
).firstOrNull {
it.isNotBlank()
}?.also { publishDate ->
Row(
modifier = Modifier.padding(start = Spacing.xs),
verticalAlignment = Alignment.CenterVertically,
) {
val isShowingUpdateDate = !updateDate.isNullOrBlank()
Icon(
modifier =
Modifier.size(IconSize.m).then(
if (!isShowingUpdateDate) {
Modifier.padding(1.5.dp)
} else {
Modifier.padding(0.25.dp)
},
),
imageVector = Icons.AutoMirrored.Default.Chat,
contentDescription = null,
tint = ancillaryColor,
)
Text(
text = "$comments",
style = MaterialTheme.typography.labelMedium,
color = ancillaryColor,
)
imageVector =
if (isShowingUpdateDate) {
Icons.Default.Update
} else {
Icons.Default.Schedule
},
contentDescription = null,
tint = ancillaryColor,
)
Text(
modifier = Modifier.padding(start = Spacing.xxs),
text = publishDate.prettifyDate(),
style = MaterialTheme.typography.labelMedium,
color = ancillaryColor,
)
}
}
}
if (unreadComments != null) {
Text(
modifier =
Modifier
.padding(start = Spacing.xxs)
.background(
color = MaterialTheme.colorScheme.secondary,
shape = RoundedCornerShape(CornerSize.s),
)
.padding(horizontal = Spacing.xxs),
text = "+$unreadComments",
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.onSecondary,
)
}
listOf(
updateDate.orEmpty(),
publishDate.orEmpty(),
).firstOrNull {
it.isNotBlank()
}?.also { publishDate ->
Row(
modifier = Modifier.padding(start = Spacing.xs),
verticalAlignment = Alignment.CenterVertically,
) {
val isShowingUpdateDate = !updateDate.isNullOrBlank()
if (options.isNotEmpty()) {
Icon(
modifier =
Modifier.size(IconSize.s).then(
if (!isShowingUpdateDate) {
Modifier.padding(0.5.dp)
} else {
Modifier
},
),
imageVector =
if (isShowingUpdateDate) {
Icons.Default.Update
} else {
Icons.Default.Schedule
},
Modifier.size(IconSize.m)
.padding(Spacing.xs)
.onGloballyPositioned {
optionsOffset = it.positionInParent()
}
.onClick(
onClick = {
optionsMenuOpen.value = true
},
),
imageVector = Icons.Default.MoreHoriz,
contentDescription = null,
tint = ancillaryColor,
)
}
Spacer(modifier = Modifier.weight(1f))
if (actionButtonsActive) {
FeedbackButton(
modifier =
buttonModifier.padding(
top = 2.5.dp,
bottom = 2.5.dp,
end = 2.5.dp,
),
imageVector =
if (!saved) {
Icons.Default.BookmarkBorder
} else {
Icons.Default.Bookmark
},
tintColor =
if (saved) {
MaterialTheme.colorScheme.secondary
} else {
ancillaryColor
},
onClick = {
onSave?.invoke()
},
)
}
FeedbackButton(
modifier = buttonModifier.padding(all = 2.5.dp),
imageVector =
if (actionButtonsActive) {
Icons.Default.ArrowCircleUp
} else {
Icons.Default.ArrowUpward
},
tintColor =
if (upVoted) {
upVoteColor ?: defaultUpvoteColor
} else {
ancillaryColor
},
onClick = {
onUpVote?.invoke()
},
)
if (showScores) {
Text(
modifier = Modifier.padding(start = Spacing.xxs),
text = publishDate.prettifyDate(),
text =
formatToReadableValue(
voteFormat = voteFormat,
score = score,
upVotes = upVotes,
downVotes = downVotes,
upVoteColor = upVoteColor ?: defaultUpvoteColor,
downVoteColor = downVoteColor ?: defaultDownVoteColor,
upVoted = upVoted,
downVoted = downVoted,
),
style = MaterialTheme.typography.labelMedium,
color = ancillaryColor,
)
}
}
if (options.isNotEmpty()) {
Icon(
modifier =
Modifier.size(IconSize.m)
.padding(Spacing.xs)
.onGloballyPositioned {
optionsOffset = it.positionInParent()
}
.onClick(
onClick = {
optionsMenuOpen.value = true
},
if (downVoteEnabled) {
FeedbackButton(
modifier =
buttonModifier.padding(
top = 2.5.dp,
bottom = 2.5.dp,
end = 2.5.dp,
),
imageVector = Icons.Default.MoreHoriz,
contentDescription = null,
tint = ancillaryColor,
)
}
Spacer(modifier = Modifier.weight(1f))
if (actionButtonsActive) {
FeedbackButton(
modifier =
buttonModifier.padding(
top = 2.5.dp,
bottom = 2.5.dp,
end = 2.5.dp,
),
imageVector =
if (!saved) {
Icons.Default.BookmarkBorder
} else {
Icons.Default.Bookmark
imageVector =
if (actionButtonsActive) {
Icons.Default.ArrowCircleDown
} else {
Icons.Default.ArrowDownward
},
tintColor =
if (downVoted) {
downVoteColor ?: defaultDownVoteColor
} else {
ancillaryColor
},
onClick = {
onDownVote?.invoke()
},
tintColor =
if (saved) {
MaterialTheme.colorScheme.secondary
} else {
ancillaryColor
},
onClick = {
onSave?.invoke()
},
)
)
}
}
FeedbackButton(
modifier = buttonModifier.padding(all = 2.5.dp),
imageVector =
if (actionButtonsActive) {
Icons.Default.ArrowCircleUp
} else {
Icons.Default.ArrowUpward
},
tintColor =
if (upVoted) {
upVoteColor ?: defaultUpvoteColor
} else {
ancillaryColor
},
onClick = {
onUpVote?.invoke()
},
)
if (showScores) {
Text(
text =
formatToReadableValue(
voteFormat = voteFormat,
score = score,
upVotes = upVotes,
downVotes = downVotes,
upVoteColor = upVoteColor ?: defaultUpvoteColor,
downVoteColor = downVoteColor ?: defaultDownVoteColor,
upVoted = upVoted,
downVoted = downVoted,
),
style = MaterialTheme.typography.labelMedium,
color = ancillaryColor,
)
}
if (downVoteEnabled) {
FeedbackButton(
modifier =
buttonModifier.padding(
top = 2.5.dp,
bottom = 2.5.dp,
end = 2.5.dp,
),
imageVector =
if (actionButtonsActive) {
Icons.Default.ArrowCircleDown
} else {
Icons.Default.ArrowDownward
},
tintColor =
if (downVoted) {
downVoteColor ?: defaultDownVoteColor
} else {
ancillaryColor
},
onClick = {
onDownVote?.invoke()
},
)
}
}
CustomDropDown(
expanded = optionsMenuOpen.value,
onDismiss = {
optionsMenuOpen.value = false
},
offset =
DpOffset(
x = optionsOffset.x.toLocalDp(),
y = optionsOffset.y.toLocalDp(),
),
) {
options.forEach { option ->
DropdownMenuItem(
text = {
Text(option.text)
},
onClick = {
optionsMenuOpen.value = false
onOptionSelected?.invoke(option.id)
},
)
CustomDropDown(
expanded = optionsMenuOpen.value,
onDismiss = {
optionsMenuOpen.value = false
},
offset =
DpOffset(
x = optionsOffset.x.toLocalDp(),
y = optionsOffset.y.toLocalDp(),
),
) {
options.forEach { option ->
DropdownMenuItem(
text = {
Text(option.text)
},
onClick = {
optionsMenuOpen.value = false
onOptionSelected?.invoke(option.id)
},
)
}
}
}
}

View File

@ -60,8 +60,7 @@ fun CustomMarkdownWrapper(
if (maxLines == null) {
Dp.Unspecified
} else {
val lineHeight =
typography.paragraph.lineHeight
val lineHeight = typography.paragraph.lineHeight
val base =
if (lineHeight.isUnspecified) {
floor(typography.paragraph.fontSize.toPx() * MAX_LINES_SCALE_FACTOR)

View File

@ -11,7 +11,6 @@ import androidx.compose.material.BottomNavigationItem
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Home
import androidx.compose.material3.Badge
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
@ -35,7 +34,6 @@ import com.github.diegoberaldin.raccoonforlemmy.feature.profile.ui.ProfileTab
import com.github.diegoberaldin.raccoonforlemmy.feature.search.ui.ExploreTab
import com.github.diegoberaldin.raccoonforlemmy.feature.settings.ui.SettingsTab
@OptIn(ExperimentalMaterial3Api::class)
@Composable
internal fun RowScope.TabNavigationItem(
tab: Tab,

View File

@ -173,7 +173,7 @@ internal fun MessageCard(
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
modifier = Modifier.size(IconSize.s).padding(0.5.dp),
modifier = Modifier.size(IconSize.m).padding(0.5.dp),
imageVector = Icons.Default.Schedule,
contentDescription = null,
tint = ancillaryColor,

View File

@ -161,7 +161,7 @@ private fun DraftFooter(
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
modifier = Modifier.size(IconSize.s).padding(0.5.dp),
modifier = Modifier.size(IconSize.m).padding(1.5.dp),
imageVector = Icons.Default.Schedule,
contentDescription = null,
tint = ancillaryColor,

View File

@ -200,7 +200,7 @@ private fun ModlogFooter(
onOpen: (() -> Unit)? = null,
onOptionSelected: ((OptionId) -> Unit)? = null,
) {
val buttonModifier = Modifier.size(IconSize.m).padding(3.dp)
val buttonModifier = Modifier.size(IconSize.l).padding(3.dp)
var optionsExpanded by remember { mutableStateOf(false) }
var optionsOffset by remember { mutableStateOf(Offset.Zero) }
val ancillaryColor = MaterialTheme.colorScheme.onBackground.copy(alpha = ancillaryTextAlpha)
@ -216,7 +216,7 @@ private fun ModlogFooter(
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
modifier = Modifier.size(IconSize.s).padding(0.5.dp),
modifier = Modifier.size(IconSize.m).padding(1.5.dp),
imageVector = Icons.Default.Schedule,
contentDescription = null,
tint = ancillaryColor,

View File

@ -206,7 +206,7 @@ fun RawContentDialog(
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
modifier = Modifier.size(IconSize.s).padding(0.5.dp),
modifier = Modifier.size(IconSize.m).padding(1.5.dp),
imageVector = Icons.Default.Schedule,
contentDescription = null,
tint = fullColor,
@ -231,7 +231,7 @@ fun RawContentDialog(
horizontalArrangement = Arrangement.spacedBy(Spacing.xxs),
) {
Icon(
modifier = Modifier.size(IconSize.s),
modifier = Modifier.size(IconSize.m).padding(0.25.dp),
imageVector = Icons.Default.Update,
contentDescription = null,
tint = fullColor,

View File

@ -197,7 +197,7 @@ private fun ReportFooter(
onOpenResolve: (() -> Unit)? = null,
onOptionSelected: ((OptionId) -> Unit)? = null,
) {
val buttonModifier = Modifier.size(IconSize.m).padding(3.dp)
val buttonModifier = Modifier.size(IconSize.l).padding(3.dp)
var optionsExpanded by remember { mutableStateOf(false) }
var optionsOffset by remember { mutableStateOf(Offset.Zero) }
val ancillaryColor = MaterialTheme.colorScheme.onBackground.copy(alpha = ancillaryTextAlpha)
@ -213,7 +213,7 @@ private fun ReportFooter(
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
modifier = Modifier.size(IconSize.s).padding(0.5.dp),
modifier = Modifier.size(IconSize.m).padding(1.5.dp),
imageVector = Icons.Default.Schedule,
contentDescription = null,
tint = ancillaryColor,