Minor refactoring

pull/722/head
Vitor Pamplona 2023-12-14 15:02:49 -05:00
rodzic 91b3b9e0e9
commit 3a76c2a2de
2 zmienionych plików z 53 dodań i 95 usunięć

Wyświetl plik

@ -156,6 +156,7 @@ import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer
import com.vitorpamplona.amethyst.ui.theme.UserNameMaxRowHeight
import com.vitorpamplona.amethyst.ui.theme.UserNameRowHeight
import com.vitorpamplona.amethyst.ui.theme.WidthAuthorPictureModifier
import com.vitorpamplona.amethyst.ui.theme.channelNotePictureModifier
import com.vitorpamplona.amethyst.ui.theme.grayText
import com.vitorpamplona.amethyst.ui.theme.lessImportantLink
import com.vitorpamplona.amethyst.ui.theme.mediumImportanceLink
@ -411,18 +412,18 @@ fun RenderReportState(
val canPreview = (!state.isAcceptable && showReportedNote) || state.canPreview
NormalNote(
note,
routeForLastRead,
modifier,
isBoostedNote,
isQuotedNote,
unPackReply,
makeItShort,
addMarginTop,
canPreview,
parentBackgroundColor,
accountViewModel,
nav
baseNote = note,
routeForLastRead = routeForLastRead,
modifier = modifier,
isBoostedNote = isBoostedNote,
isQuotedNote = isQuotedNote,
unPackReply = unPackReply,
makeItShort = makeItShort,
addMarginTop = addMarginTop,
canPreview = canPreview,
parentBackgroundColor = parentBackgroundColor,
accountViewModel = accountViewModel,
nav = nav
)
}
}
@ -522,19 +523,19 @@ fun NormalNote(
else ->
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) { showPopup ->
CheckNewAndRenderNote(
baseNote,
routeForLastRead,
modifier,
isBoostedNote,
isQuotedNote,
unPackReply,
makeItShort,
addMarginTop,
canPreview,
parentBackgroundColor,
accountViewModel,
showPopup,
nav
baseNote = baseNote,
routeForLastRead = routeForLastRead,
modifier = modifier,
isBoostedNote = isBoostedNote,
isQuotedNote = isQuotedNote,
unPackReply = unPackReply,
makeItShort = makeItShort,
addMarginTop = addMarginTop,
canPreview = canPreview,
parentBackgroundColor = parentBackgroundColor,
accountViewModel = accountViewModel,
showPopup = showPopup,
nav = nav
)
}
}
@ -2880,27 +2881,12 @@ private fun ChannelNotePicture(baseChannel: Channel, loadProfilePicture: Boolean
it.channel.profilePicture()
}.distinctUntilChanged().observeAsState()
val backgroundColor = MaterialTheme.colorScheme.background
val modifier = remember {
Modifier
.width(30.dp)
.height(30.dp)
.clip(shape = CircleShape)
.background(backgroundColor)
.border(
2.dp,
backgroundColor,
CircleShape
)
}
Box(Size30Modifier) {
RobohashFallbackAsyncImage(
robot = baseChannel.idHex,
model = model,
contentDescription = stringResource(R.string.group_picture),
modifier = modifier,
modifier = MaterialTheme.colorScheme.channelNotePictureModifier,
loadProfilePicture = loadProfilePicture
)
}
@ -2987,9 +2973,7 @@ fun DisplayHighlight(
val quote =
remember {
highlight
.split("\n")
.map { "> *${it.removeSuffix(" ")}*" }
.joinToString("\n")
.split("\n").joinToString("\n") { "> *${it.removeSuffix(" ")}*" }
}
TranslatableRichTextViewer(

Wyświetl plik

@ -95,35 +95,18 @@ private val LightZapraiserBackground = BitcoinOrange.copy(0.52f).compositeOver(L
private val DarkOverPictureBackground = DarkColorPalette.background.copy(0.62f)
private val LightOverPictureBackground = LightColorPalette.background.copy(0.62f)
val RepostPictureBorderDark = Modifier.border(
2.dp,
DarkColorPalette.background,
CircleShape
)
val RepostPictureBorderLight = Modifier.border(
2.dp,
LightColorPalette.background,
CircleShape
)
val RepostPictureBorderDark = Modifier.border(2.dp, DarkColorPalette.background, CircleShape)
val RepostPictureBorderLight = Modifier.border(2.dp, LightColorPalette.background, CircleShape)
val DarkImageModifier = Modifier
.fillMaxWidth()
.clip(shape = QuoteBorder)
.border(
1.dp,
DarkSubtleBorder,
QuoteBorder
)
.border(1.dp, DarkSubtleBorder, QuoteBorder)
val LightImageModifier = Modifier
.fillMaxWidth()
.clip(shape = QuoteBorder)
.border(
1.dp,
LightSubtleBorder,
QuoteBorder
)
.border(1.dp, LightSubtleBorder, QuoteBorder)
val DarkProfile35dpModifier = Modifier
.size(Size35dp)
@ -137,41 +120,37 @@ val DarkReplyBorderModifier = Modifier
.padding(top = 5.dp)
.fillMaxWidth()
.clip(shape = QuoteBorder)
.border(
1.dp,
DarkSubtleBorder,
QuoteBorder
)
.border(1.dp, DarkSubtleBorder, QuoteBorder)
val LightReplyBorderModifier = Modifier
.padding(top = 2.dp, bottom = 0.dp, start = 0.dp, end = 0.dp)
.fillMaxWidth()
.clip(shape = QuoteBorder)
.border(
1.dp,
LightSubtleBorder,
QuoteBorder
)
.border(1.dp, LightSubtleBorder, QuoteBorder)
val DarkInnerPostBorderModifier = Modifier
.padding(top = 5.dp)
.fillMaxWidth()
.clip(shape = QuoteBorder)
.border(
1.dp,
DarkSubtleBorder,
QuoteBorder
)
.border(1.dp, DarkSubtleBorder, QuoteBorder)
val LightInnerPostBorderModifier = Modifier
.padding(top = 5.dp)
.fillMaxWidth()
.clip(shape = QuoteBorder)
.border(
1.dp,
LightSubtleBorder,
QuoteBorder
)
.border(1.dp, LightSubtleBorder, QuoteBorder)
val DarkChannelNotePictureModifier = Modifier
.size(30.dp)
.clip(shape = CircleShape)
.background(DarkColorPalette.background)
.border(2.dp, DarkColorPalette.background, CircleShape)
val LightChannelNotePictureModifier = Modifier
.size(30.dp)
.clip(shape = CircleShape)
.background(LightColorPalette.background)
.border(2.dp, LightColorPalette.background, CircleShape)
val RichTextDefaults = RichTextStyle().resolveDefaults()
@ -190,11 +169,7 @@ val MarkDownStyleOnDark = RichTextDefaults.copy(
.padding(0.dp)
.fillMaxWidth()
.clip(shape = QuoteBorder)
.border(
1.dp,
DarkSubtleBorder,
QuoteBorder
)
.border(1.dp, DarkSubtleBorder, QuoteBorder)
.background(DarkColorPalette.onSurface.copy(alpha = 0.05f))
),
stringStyle = RichTextDefaults.stringStyle?.copy(
@ -224,11 +199,7 @@ val MarkDownStyleOnLight = RichTextDefaults.copy(
.padding(0.dp)
.fillMaxWidth()
.clip(shape = QuoteBorder)
.border(
1.dp,
LightSubtleBorder,
QuoteBorder
)
.border(1.dp, LightSubtleBorder, QuoteBorder)
.background(DarkColorPalette.onSurface.copy(alpha = 0.05f))
),
stringStyle = RichTextDefaults.stringStyle?.copy(
@ -320,6 +291,9 @@ val ColorScheme.replyModifier: Modifier
val ColorScheme.innerPostModifier: Modifier
get() = if (isLight) LightInnerPostBorderModifier else DarkInnerPostBorderModifier
val ColorScheme.channelNotePictureModifier: Modifier
get() = if (isLight) LightChannelNotePictureModifier else DarkChannelNotePictureModifier
val ColorScheme.chartStyle: ChartStyle
get() {
val defaultColors = if (isLight) DefaultColors.Light else DefaultColors.Dark