diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ExpandableRichTextViewer.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ExpandableRichTextViewer.kt index 9082a0c2e..1b715234a 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ExpandableRichTextViewer.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ExpandableRichTextViewer.kt @@ -1,5 +1,6 @@ package com.vitorpamplona.amethyst.ui.components +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.PaddingValues @@ -19,13 +20,12 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.drawBehind -import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.ui.actions.ImmutableListOfLists +import com.vitorpamplona.amethyst.ui.note.getGradient import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.theme.ButtonBorder import com.vitorpamplona.amethyst.ui.theme.secondaryButtonBackground @@ -80,16 +80,7 @@ fun ExpandableRichTextViewer( modifier = Modifier .align(Alignment.BottomCenter) .fillMaxWidth() - .drawBehind { - drawRect( - Brush.verticalGradient( - colors = listOf( - backgroundColor.value.copy(alpha = 0f), - backgroundColor.value - ) - ) - ) - } + .background(getGradient(backgroundColor)) ) { ShowMoreButton() { showFullText = !showFullText diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/BadgeCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/BadgeCompose.kt index f1643c7d0..1d77bf897 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/BadgeCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/BadgeCompose.kt @@ -1,6 +1,7 @@ package com.vitorpamplona.amethyst.ui.note import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.background import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -26,7 +27,6 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.compositeOver import androidx.compose.ui.platform.LocalContext @@ -79,9 +79,7 @@ fun BadgeCompose(likeSetCard: BadgeCard, isInnerNote: Boolean = false, routeForL Column( modifier = Modifier - .drawBehind { - drawRect(backgroundColor.value) - } + .background(backgroundColor.value) .combinedClickable( onClick = { scope.launch { diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ChatroomMessageCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ChatroomMessageCompose.kt index 6b40db728..d3e3f7327 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ChatroomMessageCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ChatroomMessageCompose.kt @@ -2,6 +2,7 @@ package com.vitorpamplona.amethyst.ui.note import androidx.compose.animation.Crossfade import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.interaction.MutableInteractionSource @@ -40,7 +41,6 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip -import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Shape import androidx.compose.ui.graphics.compositeOver @@ -923,7 +923,7 @@ private fun RenderRelayIcon(iconUrl: String) { Modifier .size(Size13dp) .clip(shape = CircleShape) - .drawBehind { drawRect(backgroundColor) } + .background(backgroundColor) } RobohashFallbackAsyncImage( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/MessageSetCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/MessageSetCompose.kt index 591aaac25..71cd77a3f 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/MessageSetCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/MessageSetCompose.kt @@ -22,7 +22,6 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.compositeOver import androidx.compose.ui.res.painterResource @@ -70,11 +69,7 @@ fun MessageSetCompose(messageSetCard: MessageSetCard, routeForLastRead: String, val columnModifier = remember(backgroundColor.value) { Modifier - .drawBehind { - drawRect( - backgroundColor.value - ) - } + .background(backgroundColor.value) .padding( start = 12.dp, end = 12.dp, diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/MultiSetCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/MultiSetCompose.kt index 1e17dda7b..1fe5246c2 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/MultiSetCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/MultiSetCompose.kt @@ -3,6 +3,7 @@ package com.vitorpamplona.amethyst.ui.note import android.util.Log import androidx.compose.animation.Crossfade import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.layout.Box @@ -35,7 +36,6 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip -import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.compositeOver import androidx.compose.ui.layout.ContentScale @@ -114,9 +114,7 @@ fun MultiSetCompose(multiSetCard: MultiSetCard, routeForLastRead: String, accoun val columnModifier = remember(backgroundColor.value) { Modifier - .drawBehind { - drawRect(backgroundColor.value) - } + .background(backgroundColor.value) .padding( start = 12.dp, end = 12.dp, @@ -440,7 +438,7 @@ fun CrossfadeToDisplayAmount(authorComment: MutableState): Brush { + return Brush.verticalGradient( + colors = listOf( + backgroundColor.value.copy(alpha = 0f), + backgroundColor.value + ) + ) +} + @Composable private fun RenderAudioTrack( note: Note, @@ -2017,7 +1996,7 @@ private fun ChannelNotePicture(baseChannel: Channel) { .width(30.dp) .height(30.dp) .clip(shape = CircleShape) - .drawBehind { drawRect(backgroundColor) } + .background(backgroundColor) .border( 2.dp, backgroundColor, @@ -3049,7 +3028,7 @@ fun DisplayBlankAuthor(size: Dp, modifier: Modifier = Modifier) { modifier .size(size) .clip(shape = CircleShape) - .drawBehind { drawRect(backgroundColor) } + .background(backgroundColor) } RobohashAsyncImage( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapUserSetCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapUserSetCompose.kt index f0a3b79e5..e2891771a 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapUserSetCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapUserSetCompose.kt @@ -21,7 +21,6 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.compositeOver import androidx.compose.ui.res.stringResource @@ -60,9 +59,7 @@ fun ZapUserSetCompose(zapSetCard: ZapUserSetCard, isInnerNote: Boolean = false, Column( modifier = Modifier - .drawBehind { - drawRect(backgroundColor.value) - } + .background(backgroundColor.value) .clickable { nav("User/${zapSetCard.user.pubkeyHex}") } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChannelScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChannelScreen.kt index 1d4b42d73..cf767d193 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChannelScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChannelScreen.kt @@ -53,7 +53,6 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip -import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Shape import androidx.compose.ui.graphics.SolidColor @@ -734,7 +733,7 @@ fun LiveFlag() { modifier = remember { Modifier .clip(SmallBorder) - .drawBehind { drawRect(Color.Red) } + .background(Color.Red) .padding(horizontal = 5.dp) } ) @@ -749,7 +748,7 @@ fun EndedFlag() { modifier = remember { Modifier .clip(SmallBorder) - .drawBehind { drawRect(Color.Black) } + .background(Color.Black) .padding(horizontal = 5.dp) } ) @@ -764,7 +763,7 @@ fun OfflineFlag() { modifier = remember { Modifier .clip(SmallBorder) - .drawBehind { drawRect(Color.Black) } + .background(Color.Black) .padding(horizontal = 5.dp) } ) @@ -779,7 +778,7 @@ fun ScheduledFlag() { modifier = remember { Modifier .clip(SmallBorder) - .drawBehind { drawRect(Color.Black) } + .background(Color.Black) .padding(horizontal = 5.dp) } ) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ProfileScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ProfileScreen.kt index 276ffa358..c7497acf6 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ProfileScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ProfileScreen.kt @@ -25,7 +25,6 @@ import androidx.compose.runtime.livedata.observeAsState import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip -import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Color import androidx.compose.ui.input.nestedscroll.NestedScrollConnection @@ -1189,7 +1188,7 @@ private fun WatchAndRenderBadgeImage( pictureModifier .width(size) .height(size) - .drawBehind { drawRect(bgColor) } + .background(bgColor) } ) } else { @@ -1202,7 +1201,7 @@ private fun WatchAndRenderBadgeImage( .width(size) .height(size) .clip(shape = CircleShape) - .drawBehind { drawRect(bgColor) } + .background(bgColor) .run { if (onClick != null) { this.clickable(onClick = { onClick(eventId) }) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/theme/Theme.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/theme/Theme.kt index b3ccb57d0..ae2d0f8fc 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/theme/Theme.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/theme/Theme.kt @@ -1,6 +1,7 @@ package com.vitorpamplona.amethyst.ui.theme import android.app.Activity +import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.fillMaxWidth @@ -15,7 +16,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.SideEffect import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip -import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.graphics.compositeOver @@ -123,12 +123,10 @@ val LightImageModifier = Modifier val DarkProfile35dpModifier = Modifier .size(Size35dp) .clip(shape = CircleShape) - .drawBehind { drawRect(DarkColorPalette.background) } val LightProfile35dpModifier = Modifier .fillMaxWidth() .clip(shape = CircleShape) - .drawBehind { drawRect(LightColorPalette.background) } val DarkReplyBorderModifier = Modifier .padding(top = 5.dp) @@ -189,9 +187,7 @@ val MarkDownStyleOnDark = RichTextDefaults.copy( DarkSubtleBorder, QuoteBorder ) - .drawBehind { - drawRect(DarkColorPalette.onSurface.copy(alpha = 0.05f)) - } + .background(DarkColorPalette.onSurface.copy(alpha = 0.05f)) ), stringStyle = RichTextDefaults.stringStyle?.copy( linkStyle = SpanStyle( @@ -222,9 +218,7 @@ val MarkDownStyleOnLight = RichTextDefaults.copy( LightSubtleBorder, QuoteBorder ) - .drawBehind { - drawRect(LightColorPalette.onSurface.copy(alpha = 0.05f)) - } + .background(DarkColorPalette.onSurface.copy(alpha = 0.05f)) ), stringStyle = RichTextDefaults.stringStyle?.copy( linkStyle = SpanStyle(