From 9ef02d63a04d1956873e0f1800fb80e4ffc67ede Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Sat, 10 Jun 2023 10:08:06 -0400 Subject: [PATCH] Refactors color objects to avoid recreating them on-demand. --- .../ui/actions/JoinUserOrChannelView.kt | 7 +- .../amethyst/ui/actions/NewChannelView.kt | 7 +- .../amethyst/ui/actions/NewMediaView.kt | 3 +- .../amethyst/ui/actions/NewPollClosing.kt | 7 +- .../ui/actions/NewPollConsensusThreshold.kt | 7 +- .../amethyst/ui/actions/NewPollOption.kt | 5 +- .../ui/actions/NewPollPrimaryDescription.kt | 7 +- .../ui/actions/NewPollRecipientsField.kt | 5 +- .../ui/actions/NewPollVoteValueRange.kt | 11 ++- .../amethyst/ui/actions/NewPostView.kt | 23 +++-- .../amethyst/ui/actions/NewRelayListView.kt | 25 ++--- .../ui/actions/NewUserMetadataView.kt | 29 +++--- .../ui/components/ExpandableRichTextViewer.kt | 8 +- .../amethyst/ui/components/InvoicePreview.kt | 3 +- .../amethyst/ui/components/InvoiceRequest.kt | 8 +- .../amethyst/ui/components/RichTextViewer.kt | 7 +- .../amethyst/ui/components/SlidingCarousel.kt | 3 +- .../amethyst/ui/components/UrlPreviewCard.kt | 3 +- .../amethyst/ui/components/VideoView.kt | 3 +- .../ui/components/ZoomableContentView.kt | 8 +- .../amethyst/ui/navigation/AppTopBar.kt | 3 +- .../amethyst/ui/note/AddBountyAmountDialog.kt | 3 +- .../amethyst/ui/note/BadgeCompose.kt | 5 +- .../amethyst/ui/note/ChatroomCompose.kt | 3 +- .../ui/note/ChatroomMessageCompose.kt | 21 +++-- .../amethyst/ui/note/MessageSetCompose.kt | 37 +++++--- .../amethyst/ui/note/MultiSetCompose.kt | 4 +- .../ui/note/NIP05VerificationDisplay.kt | 3 +- .../amethyst/ui/note/NoteCompose.kt | 92 +++++++++---------- .../amethyst/ui/note/NoteQuickActionMenu.kt | 4 +- .../amethyst/ui/note/PollNote.kt | 8 +- .../amethyst/ui/note/ReactionsRow.kt | 3 +- .../amethyst/ui/note/RelayCompose.kt | 3 +- .../amethyst/ui/note/ReplyInformation.kt | 28 +++--- .../amethyst/ui/note/UpdateZapAmountDialog.kt | 11 ++- .../amethyst/ui/note/UserReactionsRow.kt | 3 +- .../amethyst/ui/note/UsernameDisplay.kt | 3 +- .../amethyst/ui/note/ZapCustomDialog.kt | 5 +- .../amethyst/ui/note/ZapNoteCompose.kt | 3 +- .../amethyst/ui/screen/ThreadFeedView.kt | 14 +-- .../ui/screen/loggedIn/ChannelScreen.kt | 11 ++- .../ui/screen/loggedIn/ChatroomListScreen.kt | 3 +- .../ui/screen/loggedIn/ConnectOrbotDialog.kt | 3 +- .../ui/screen/loggedIn/ProfileScreen.kt | 15 +-- .../ui/screen/loggedIn/SearchScreen.kt | 3 +- .../ui/screen/loggedIn/VideoScreen.kt | 7 +- .../ui/screen/loggedOff/LoginScreen.kt | 3 +- .../vitorpamplona/amethyst/ui/theme/Theme.kt | 48 +++++++++- .../components/TranslatableRichTextViewer.kt | 3 +- 49 files changed, 314 insertions(+), 217 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/JoinUserOrChannelView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/JoinUserOrChannelView.kt index 11666d4dc..563445952 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/JoinUserOrChannelView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/JoinUserOrChannelView.kt @@ -64,6 +64,7 @@ import com.vitorpamplona.amethyst.ui.note.UserPicture import com.vitorpamplona.amethyst.ui.note.UsernameDisplay import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.SearchBarViewModel +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.delay @@ -128,7 +129,7 @@ fun JoinUserOrChannelView(searchBarViewModel: SearchBarViewModel, onClose: () -> Text( text = "", - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, fontWeight = FontWeight.Bold ) } @@ -270,7 +271,7 @@ private fun SearchEditTextForJoin( placeholder = { Text( text = stringResource(R.string.channel_list_user_or_group_id_demo), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, trailingIcon = { @@ -416,7 +417,7 @@ private fun DisplayUserAboutInfo(baseUser: User) { Text( text = about, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, maxLines = 1, overflow = TextOverflow.Ellipsis ) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewChannelView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewChannelView.kt index b6b3e947b..336ba3ebe 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewChannelView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewChannelView.kt @@ -27,6 +27,7 @@ import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.Channel import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -79,7 +80,7 @@ fun NewChannelView(onClose: () -> Unit, accountViewModel: AccountViewModel, chan placeholder = { Text( text = stringResource(R.string.my_awesome_group), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, keyboardOptions = KeyboardOptions.Default.copy( @@ -98,7 +99,7 @@ fun NewChannelView(onClose: () -> Unit, accountViewModel: AccountViewModel, chan placeholder = { Text( text = "http://mygroup.com/logo.jpg", - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } ) @@ -115,7 +116,7 @@ fun NewChannelView(onClose: () -> Unit, accountViewModel: AccountViewModel, chan placeholder = { Text( text = stringResource(R.string.about_us), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, keyboardOptions = KeyboardOptions.Default.copy( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt index c68db2944..259087bc7 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt @@ -33,6 +33,7 @@ import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.ui.components.* import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.TextSpinner +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -221,7 +222,7 @@ fun ImageVideoPost(postViewModel: NewMediaModel, acc: Account) { placeholder = { Text( text = stringResource(R.string.content_description_example), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, keyboardOptions = KeyboardOptions.Default.copy( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollClosing.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollClosing.kt index c6d1d1f3e..d96e9c117 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollClosing.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollClosing.kt @@ -22,6 +22,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.ui.actions.NewPostViewModel +import com.vitorpamplona.amethyst.ui.theme.placeholderText @Composable fun NewPollClosing(pollViewModel: NewPostViewModel) { @@ -43,7 +44,7 @@ fun NewPollClosing(pollViewModel: NewPostViewModel) { ) val colorValid = TextFieldDefaults.outlinedTextFieldColors( focusedBorderColor = MaterialTheme.colors.primary, - unfocusedBorderColor = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + unfocusedBorderColor = MaterialTheme.colors.placeholderText ) Row( @@ -59,13 +60,13 @@ fun NewPollClosing(pollViewModel: NewPostViewModel) { label = { Text( text = stringResource(R.string.poll_closing_time), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, placeholder = { Text( text = stringResource(R.string.poll_closing_time_days), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } ) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollConsensusThreshold.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollConsensusThreshold.kt index d4e4d22bb..0f2ce8b0d 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollConsensusThreshold.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollConsensusThreshold.kt @@ -22,6 +22,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.ui.actions.NewPostViewModel +import com.vitorpamplona.amethyst.ui.theme.placeholderText @Composable fun NewPollConsensusThreshold(pollViewModel: NewPostViewModel) { @@ -43,7 +44,7 @@ fun NewPollConsensusThreshold(pollViewModel: NewPostViewModel) { ) val colorValid = TextFieldDefaults.outlinedTextFieldColors( focusedBorderColor = MaterialTheme.colors.primary, - unfocusedBorderColor = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + unfocusedBorderColor = MaterialTheme.colors.placeholderText ) Row( @@ -59,13 +60,13 @@ fun NewPollConsensusThreshold(pollViewModel: NewPostViewModel) { label = { Text( text = stringResource(R.string.poll_consensus_threshold), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, placeholder = { Text( text = stringResource(R.string.poll_consensus_threshold_percent), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } ) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollOption.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollOption.kt index 62c607638..82a80343c 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollOption.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollOption.kt @@ -11,6 +11,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.KeyboardCapitalization import androidx.compose.ui.tooling.preview.Preview import com.vitorpamplona.amethyst.R +import com.vitorpamplona.amethyst.ui.theme.placeholderText @Composable fun NewPollOption(pollViewModel: NewPostViewModel, optionIndex: Int) { @@ -35,13 +36,13 @@ fun NewPollOption(pollViewModel: NewPostViewModel, optionIndex: Int) { label = { Text( text = stringResource(R.string.poll_option_index).format(optionIndex + 1), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, placeholder = { Text( text = stringResource(R.string.poll_option_description), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, keyboardOptions = KeyboardOptions.Default.copy( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollPrimaryDescription.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollPrimaryDescription.kt index 685eb2e8f..d3e422d75 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollPrimaryDescription.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollPrimaryDescription.kt @@ -19,6 +19,7 @@ import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.ui.actions.NewPostViewModel import com.vitorpamplona.amethyst.ui.actions.UrlUserTagTransformation +import com.vitorpamplona.amethyst.ui.theme.placeholderText @OptIn(ExperimentalComposeUiApi::class) @Composable @@ -38,7 +39,7 @@ fun NewPollPrimaryDescription(pollViewModel: NewPostViewModel) { ) val colorValid = TextFieldDefaults.outlinedTextFieldColors( focusedBorderColor = MaterialTheme.colors.primary, - unfocusedBorderColor = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + unfocusedBorderColor = MaterialTheme.colors.placeholderText ) OutlinedTextField( @@ -49,7 +50,7 @@ fun NewPollPrimaryDescription(pollViewModel: NewPostViewModel) { label = { Text( text = stringResource(R.string.poll_primary_description), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, keyboardOptions = KeyboardOptions.Default.copy( @@ -67,7 +68,7 @@ fun NewPollPrimaryDescription(pollViewModel: NewPostViewModel) { placeholder = { Text( text = stringResource(R.string.poll_primary_description), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, colors = if (isInputValid) colorValid else colorInValid, diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollRecipientsField.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollRecipientsField.kt index b84ed0480..b3d75ae64 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollRecipientsField.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollRecipientsField.kt @@ -10,6 +10,7 @@ import androidx.compose.ui.res.stringResource import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.ui.actions.NewPostViewModel +import com.vitorpamplona.amethyst.ui.theme.placeholderText @Composable fun NewPollRecipientsField(pollViewModel: NewPostViewModel, account: Account) { @@ -29,13 +30,13 @@ fun NewPollRecipientsField(pollViewModel: NewPostViewModel, account: Account) { label = { Text( text = stringResource(R.string.poll_zap_recipients), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, placeholder = { Text( text = stringResource(R.string.poll_zap_recipients), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollVoteValueRange.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollVoteValueRange.kt index ee6a3f4fe..f585f6e0a 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollVoteValueRange.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPollVoteValueRange.kt @@ -21,6 +21,7 @@ import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.R +import com.vitorpamplona.amethyst.ui.theme.placeholderText @Composable fun NewPollVoteValueRange(pollViewModel: NewPostViewModel) { @@ -71,7 +72,7 @@ fun NewPollVoteValueRange(pollViewModel: NewPostViewModel) { ) val colorValid = TextFieldDefaults.outlinedTextFieldColors( focusedBorderColor = MaterialTheme.colors.primary, - unfocusedBorderColor = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + unfocusedBorderColor = MaterialTheme.colors.placeholderText ) Row( @@ -87,13 +88,13 @@ fun NewPollVoteValueRange(pollViewModel: NewPostViewModel) { label = { Text( text = stringResource(R.string.poll_zap_value_min), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, placeholder = { Text( text = stringResource(R.string.sats), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } ) @@ -106,13 +107,13 @@ fun NewPollVoteValueRange(pollViewModel: NewPostViewModel) { label = { Text( text = stringResource(R.string.poll_zap_value_max), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, placeholder = { Text( text = stringResource(R.string.sats), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } ) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt index 801038d5e..2848ce81f 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt @@ -73,6 +73,9 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.UserLine import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange import com.vitorpamplona.amethyst.ui.theme.ButtonBorder import com.vitorpamplona.amethyst.ui.theme.QuoteBorder +import com.vitorpamplona.amethyst.ui.theme.mediumImportanceLink +import com.vitorpamplona.amethyst.ui.theme.placeholderText +import com.vitorpamplona.amethyst.ui.theme.subtleBorder import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.Dispatchers @@ -200,7 +203,7 @@ fun NewPostView(onClose: () -> Unit, baseReplyTo: Note? = null, quote: Note? = n placeholder = { Text( text = stringResource(R.string.what_s_on_your_mind), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, colors = TextFieldDefaults @@ -219,9 +222,9 @@ fun NewPostView(onClose: () -> Unit, baseReplyTo: Note? = null, quote: Note? = n Button( onClick = { postViewModel.pollOptions[postViewModel.pollOptions.size] = "" }, - border = BorderStroke(1.dp, MaterialTheme.colors.onSurface.copy(alpha = 0.32f)), + border = BorderStroke(1.dp, MaterialTheme.colors.placeholderText), colors = ButtonDefaults.outlinedButtonColors( - contentColor = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + contentColor = MaterialTheme.colors.placeholderText ) ) { Image( @@ -293,7 +296,7 @@ fun NewPostView(onClose: () -> Unit, baseReplyTo: Note? = null, quote: Note? = n .clip(shape = QuoteBorder) .border( 1.dp, - MaterialTheme.colors.onSurface.copy(alpha = 0.12f), + MaterialTheme.colors.subtleBorder, QuoteBorder ) ) @@ -395,7 +398,7 @@ fun Notifying(baseMentions: ImmutableList?, onClick: (User) -> Unit) { Text( stringResource(R.string.reply_notify), fontWeight = FontWeight.Bold, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) mentions.forEachIndexed { idx, user -> @@ -410,7 +413,7 @@ fun Notifying(baseMentions: ImmutableList?, onClick: (User) -> Unit) { Button( shape = ButtonBorder, colors = ButtonDefaults.buttonColors( - backgroundColor = MaterialTheme.colors.primary.copy(alpha = 0.32f) + backgroundColor = MaterialTheme.colors.mediumImportanceLink ), onClick = { onClick(myUser) @@ -551,7 +554,7 @@ private fun ForwardZapTo( placeholder = { Text( text = stringResource(R.string.zap_forward_lnAddress), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, fontSize = 14.sp ) }, @@ -774,7 +777,7 @@ fun ImageVideoDescription( .clip(shape = QuoteBorder) .border( 1.dp, - MaterialTheme.colors.onSurface.copy(alpha = 0.12f), + MaterialTheme.colors.subtleBorder, QuoteBorder ) ) { @@ -819,7 +822,7 @@ fun ImageVideoDescription( modifier = Modifier .padding(end = 5.dp) .size(30.dp), - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + tint = MaterialTheme.colors.placeholderText ) } } @@ -909,7 +912,7 @@ fun ImageVideoDescription( placeholder = { Text( text = stringResource(R.string.content_description_example), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, keyboardOptions = KeyboardOptions.Default.copy( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewRelayListView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewRelayListView.kt index abca9e1a6..baf40bf7c 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewRelayListView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewRelayListView.kt @@ -52,6 +52,7 @@ import com.vitorpamplona.amethyst.model.RelaySetupInfo import com.vitorpamplona.amethyst.service.relays.FeedType import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.theme.ButtonBorder +import com.vitorpamplona.amethyst.ui.theme.placeholderText import java.lang.Math.round @Composable @@ -157,7 +158,7 @@ fun ServerConfigHeader() { maxLines = 1, fontSize = 14.sp, modifier = Modifier.weight(1.2f), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) Spacer(modifier = Modifier.size(5.dp)) @@ -167,7 +168,7 @@ fun ServerConfigHeader() { maxLines = 1, fontSize = 14.sp, modifier = Modifier.weight(1.2f), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) Spacer(modifier = Modifier.size(5.dp)) @@ -177,7 +178,7 @@ fun ServerConfigHeader() { maxLines = 1, fontSize = 14.sp, modifier = Modifier.weight(1f), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) Spacer(modifier = Modifier.size(5.dp)) @@ -187,7 +188,7 @@ fun ServerConfigHeader() { maxLines = 1, fontSize = 14.sp, modifier = Modifier.weight(1f), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) Spacer(modifier = Modifier.size(2.dp)) @@ -375,7 +376,7 @@ fun ServerConfig( maxLines = 1, fontSize = 12.sp, modifier = Modifier.weight(1.2f), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) IconButton( @@ -403,7 +404,7 @@ fun ServerConfig( maxLines = 1, fontSize = 12.sp, modifier = Modifier.weight(1.2f), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) Icon( @@ -420,7 +421,7 @@ fun ServerConfig( maxLines = 1, fontSize = 12.sp, modifier = Modifier.weight(1f), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) Icon( @@ -435,7 +436,7 @@ fun ServerConfig( maxLines = 1, fontSize = 12.sp, modifier = Modifier.weight(1f), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } } @@ -464,7 +465,7 @@ fun EditableServerConfig(relayToAdd: String, onNewRelay: (RelaySetupInfo) -> Uni placeholder = { Text( text = "server.com", - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, maxLines = 1 ) }, @@ -478,7 +479,7 @@ fun EditableServerConfig(relayToAdd: String, onNewRelay: (RelaySetupInfo) -> Uni modifier = Modifier .size(35.dp) .padding(horizontal = 5.dp), - tint = if (read) Color.Green else MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + tint = if (read) Color.Green else MaterialTheme.colors.placeholderText ) } @@ -489,7 +490,7 @@ fun EditableServerConfig(relayToAdd: String, onNewRelay: (RelaySetupInfo) -> Uni modifier = Modifier .size(35.dp) .padding(horizontal = 5.dp), - tint = if (write) Color.Green else MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + tint = if (write) Color.Green else MaterialTheme.colors.placeholderText ) } @@ -507,7 +508,7 @@ fun EditableServerConfig(relayToAdd: String, onNewRelay: (RelaySetupInfo) -> Uni shape = ButtonBorder, colors = ButtonDefaults .buttonColors( - backgroundColor = if (url.isNotBlank()) MaterialTheme.colors.primary else MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + backgroundColor = if (url.isNotBlank()) MaterialTheme.colors.primary else MaterialTheme.colors.placeholderText ) ) { Text(text = stringResource(id = R.string.add), color = Color.White) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewUserMetadataView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewUserMetadataView.kt index 0d7e83254..df879dc45 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewUserMetadataView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewUserMetadataView.kt @@ -28,6 +28,7 @@ import androidx.compose.ui.window.DialogProperties import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.Account +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext @@ -95,7 +96,7 @@ fun NewUserMetadataView(onClose: () -> Unit, account: Account) { placeholder = { Text( text = stringResource(R.string.my_display_name), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, keyboardOptions = KeyboardOptions.Default.copy( @@ -114,7 +115,7 @@ fun NewUserMetadataView(onClose: () -> Unit, account: Account) { placeholder = { Text( text = stringResource(R.string.my_username), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, singleLine = true @@ -133,7 +134,7 @@ fun NewUserMetadataView(onClose: () -> Unit, account: Account) { placeholder = { Text( text = stringResource(id = R.string.about_me), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, keyboardOptions = KeyboardOptions.Default.copy( @@ -152,13 +153,13 @@ fun NewUserMetadataView(onClose: () -> Unit, account: Account) { placeholder = { Text( text = "https://mywebsite.com/me.jpg", - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, leadingIcon = { UploadFromGallery( isUploading = postViewModel.isUploadingImageForPicture, - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + tint = MaterialTheme.colors.placeholderText, modifier = Modifier.padding(start = 5.dp) ) { postViewModel.uploadForPicture(it, context) @@ -177,13 +178,13 @@ fun NewUserMetadataView(onClose: () -> Unit, account: Account) { placeholder = { Text( text = "https://mywebsite.com/mybanner.jpg", - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, leadingIcon = { UploadFromGallery( isUploading = postViewModel.isUploadingImageForBanner, - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + tint = MaterialTheme.colors.placeholderText, modifier = Modifier.padding(start = 5.dp) ) { postViewModel.uploadForBanner(it, context) @@ -202,7 +203,7 @@ fun NewUserMetadataView(onClose: () -> Unit, account: Account) { placeholder = { Text( text = "https://mywebsite.com", - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, singleLine = true @@ -218,7 +219,7 @@ fun NewUserMetadataView(onClose: () -> Unit, account: Account) { placeholder = { Text( text = "_@mywebsite.com", - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, singleLine = true @@ -233,7 +234,7 @@ fun NewUserMetadataView(onClose: () -> Unit, account: Account) { placeholder = { Text( text = "me@mylightiningnode.com", - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, singleLine = true @@ -249,7 +250,7 @@ fun NewUserMetadataView(onClose: () -> Unit, account: Account) { placeholder = { Text( text = stringResource(R.string.lnurl), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } ) @@ -264,7 +265,7 @@ fun NewUserMetadataView(onClose: () -> Unit, account: Account) { placeholder = { Text( text = stringResource(R.string.twitter_proof_url_template), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } ) @@ -279,7 +280,7 @@ fun NewUserMetadataView(onClose: () -> Unit, account: Account) { placeholder = { Text( text = stringResource(R.string.mastodon_proof_url_template), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } ) @@ -294,7 +295,7 @@ fun NewUserMetadataView(onClose: () -> Unit, account: Account) { placeholder = { Text( text = stringResource(R.string.github_proof_url_template), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } ) 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 c16f878bd..9082a0c2e 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,6 +1,5 @@ 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 @@ -23,13 +22,13 @@ 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.graphics.compositeOver 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.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.theme.ButtonBorder +import com.vitorpamplona.amethyst.ui.theme.secondaryButtonBackground const val SHORT_TEXT_LENGTH = 350 @@ -101,14 +100,13 @@ fun ExpandableRichTextViewer( } @Composable -public fun ShowMoreButton(onClick: () -> Unit) { +fun ShowMoreButton(onClick: () -> Unit) { Button( modifier = Modifier.padding(top = 10.dp), onClick = onClick, shape = ButtonBorder, colors = ButtonDefaults.buttonColors( - backgroundColor = MaterialTheme.colors.primary.copy(alpha = 0.32f) - .compositeOver(MaterialTheme.colors.background) + backgroundColor = MaterialTheme.colors.secondaryButtonBackground ), contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp) ) { diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/InvoicePreview.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/InvoicePreview.kt index 9478e25e4..bb152be63 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/InvoicePreview.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/InvoicePreview.kt @@ -25,6 +25,7 @@ import androidx.core.content.ContextCompat.startActivity import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.service.lnurl.LnInvoiceUtil import com.vitorpamplona.amethyst.ui.theme.QuoteBorder +import com.vitorpamplona.amethyst.ui.theme.subtleBorder import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import java.text.NumberFormat @@ -67,7 +68,7 @@ fun InvoicePreview(lnInvoice: String, amount: String?) { .fillMaxWidth() .padding(start = 30.dp, end = 30.dp) .clip(shape = QuoteBorder) - .border(1.dp, MaterialTheme.colors.onSurface.copy(alpha = 0.12f), QuoteBorder) + .border(1.dp, MaterialTheme.colors.subtleBorder, QuoteBorder) ) { Column( modifier = Modifier diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/InvoiceRequest.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/InvoiceRequest.kt index 3d6c51035..6af52b5fd 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/InvoiceRequest.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/InvoiceRequest.kt @@ -37,6 +37,8 @@ import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.service.lnurl.LightningAddressResolver import com.vitorpamplona.amethyst.ui.theme.QuoteBorder +import com.vitorpamplona.amethyst.ui.theme.placeholderText +import com.vitorpamplona.amethyst.ui.theme.subtleBorder import kotlinx.coroutines.launch @Composable @@ -57,7 +59,7 @@ fun InvoiceRequest( .fillMaxWidth() .padding(start = 30.dp, end = 30.dp) .clip(shape = QuoteBorder) - .border(1.dp, MaterialTheme.colors.onSurface.copy(alpha = 0.12f), QuoteBorder) + .border(1.dp, MaterialTheme.colors.subtleBorder, QuoteBorder) ) { Column( modifier = Modifier @@ -98,7 +100,7 @@ fun InvoiceRequest( placeholder = { Text( text = stringResource(R.string.thank_you_so_much), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, keyboardOptions = KeyboardOptions.Default.copy( @@ -123,7 +125,7 @@ fun InvoiceRequest( placeholder = { Text( text = "1000", - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, keyboardOptions = KeyboardOptions.Default.copy( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/RichTextViewer.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/RichTextViewer.kt index f1b98fb1f..14a462fdd 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/RichTextViewer.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/RichTextViewer.kt @@ -43,6 +43,7 @@ import com.vitorpamplona.amethyst.ui.actions.toImmutableListOfLists import com.vitorpamplona.amethyst.ui.note.NoteCompose import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.theme.QuoteBorder +import com.vitorpamplona.amethyst.ui.theme.subtleBorder import com.vitorpamplona.amethyst.ui.uriToRoute import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableMap @@ -415,7 +416,7 @@ private fun RenderContentAsMarkdown(content: String, backgroundColor: MutableSta .clip(shape = QuoteBorder) .border( 1.dp, - MaterialTheme.colors.onSurface.copy(alpha = 0.12f), + MaterialTheme.colors.subtleBorder, QuoteBorder ) .background( @@ -767,7 +768,7 @@ private fun DisplayFullNote( nav: (String) -> Unit, loadedLink: LoadedBechLink ) { - val borderColor = MaterialTheme.colors.onSurface.copy(alpha = 0.12f) + val borderColor = MaterialTheme.colors.subtleBorder val modifier = remember { Modifier @@ -955,7 +956,7 @@ private fun DisplayNoteFromTag( .clip(shape = QuoteBorder) .border( 1.dp, - MaterialTheme.colors.onSurface.copy(alpha = 0.12f), + MaterialTheme.colors.subtleBorder, QuoteBorder ), parentBackgroundColor = backgroundColor, diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/SlidingCarousel.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/SlidingCarousel.kt index 52f2328a7..bd88d47d2 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/SlidingCarousel.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/SlidingCarousel.kt @@ -25,6 +25,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp +import com.vitorpamplona.amethyst.ui.theme.placeholderText @OptIn(ExperimentalFoundationApi::class) @Composable @@ -68,7 +69,7 @@ fun DotsIndicator( totalDots: Int, selectedIndex: Int, selectedColor: Color = MaterialTheme.colors.primary /* Color.Yellow */, - unSelectedColor: Color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) /* Color.Gray */, + unSelectedColor: Color = MaterialTheme.colors.placeholderText /* Color.Gray */, dotSize: Dp ) { LazyRow( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/UrlPreviewCard.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/UrlPreviewCard.kt index af957121c..29edd4a3e 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/UrlPreviewCard.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/UrlPreviewCard.kt @@ -21,6 +21,7 @@ import coil.compose.AsyncImage import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.service.previews.UrlInfoItem import com.vitorpamplona.amethyst.ui.theme.QuoteBorder +import com.vitorpamplona.amethyst.ui.theme.subtleBorder @Composable fun UrlPreviewCard( @@ -35,7 +36,7 @@ fun UrlPreviewCard( .clip(shape = QuoteBorder) .border( 1.dp, - MaterialTheme.colors.onSurface.copy(alpha = 0.12f), + MaterialTheme.colors.subtleBorder, QuoteBorder ) ) { diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/VideoView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/VideoView.kt index 3ab3b96d8..d71bd6dca 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/VideoView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/VideoView.kt @@ -131,14 +131,13 @@ fun VideoView( onDialog: ((Boolean) -> Unit)? = null ) { val lifecycleOwner = rememberUpdatedState(LocalLifecycleOwner.current) - val defaultVolume = remember { if (DefaultMutedSetting.value) 0f else 1f } val media = remember { MediaItem.Builder().setUri(videoUri).build() } exoPlayerData.exoPlayer.apply { repeatMode = Player.REPEAT_MODE_ALL videoScalingMode = C.VIDEO_SCALING_MODE_SCALE_TO_FIT - volume = defaultVolume + volume = if (DefaultMutedSetting.value) 0f else 1f if (videoUri.startsWith("file") == true) { setMediaItem(media) } else { diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt index 8c34ccc10..d515934b7 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt @@ -48,7 +48,6 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.compositeOver import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalClipboardManager import androidx.compose.ui.platform.LocalContext @@ -74,8 +73,9 @@ import com.vitorpamplona.amethyst.ui.actions.CloseButton import com.vitorpamplona.amethyst.ui.actions.LoadingAnimation import com.vitorpamplona.amethyst.ui.actions.SaveToGallery import com.vitorpamplona.amethyst.ui.note.BlankNote -import com.vitorpamplona.amethyst.ui.theme.Nip05 import com.vitorpamplona.amethyst.ui.theme.QuoteBorder +import com.vitorpamplona.amethyst.ui.theme.hashVerified +import com.vitorpamplona.amethyst.ui.theme.subtleBorder import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.Dispatchers @@ -180,7 +180,7 @@ fun ZoomableContentView(content: ZoomableContent, images: ImmutableList Unit ) { - val grayTint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + val grayTint = MaterialTheme.colors.placeholderText val time = remember { baseNote.createdAt() ?: 0 } Row(verticalAlignment = Alignment.CenterVertically) { @@ -361,7 +365,7 @@ fun ChatTimeAgo(time: Long) { Text( timeStr, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, fontSize = 12.sp ) } @@ -544,7 +548,7 @@ private fun RelayBadges(baseNote: Note) { imageVector = Icons.Default.ChevronRight, null, modifier = Modifier.size(15.dp), - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + tint = MaterialTheme.colors.placeholderText ) } } @@ -569,10 +573,13 @@ fun RenderRelay(dirtyUrl: String) { .clickable(onClick = { uri.openUri(website) }) } + val backgroundColor = MaterialTheme.colors.background + val iconModifier = remember(dirtyUrl) { Modifier .size(13.dp) .clip(shape = CircleShape) + .drawBehind { drawRect(backgroundColor) } } Box( @@ -580,11 +587,11 @@ fun RenderRelay(dirtyUrl: String) { ) { RobohashFallbackAsyncImage( robot = iconUrl, - robotSize = 13.dp, + robotSize = remember { 13.dp }, model = iconUrl, contentDescription = stringResource(id = R.string.relay_icon), colorFilter = RelayIconFilter, - modifier = iconModifier.background(MaterialTheme.colors.background) + modifier = iconModifier ) } } 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 0bd1f1103..eb764874b 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,6 +22,8 @@ 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 import androidx.compose.ui.unit.dp @@ -46,30 +48,35 @@ fun MessageSetCompose(messageSetCard: MessageSetCard, routeForLastRead: String, val scope = rememberCoroutineScope() - var isNew by remember { mutableStateOf(false) } + val defaultBackgroundColor = MaterialTheme.colors.background + val backgroundColor = remember { mutableStateOf(defaultBackgroundColor) } + val newItemColor = MaterialTheme.colors.newItemBackgroundColor - LaunchedEffect(key1 = messageSetCard.createdAt()) { - launch(Dispatchers.IO) { - val newIsNew = - messageSetCard.createdAt() > NotificationCache.load(routeForLastRead) + LaunchedEffect(key1 = messageSetCard) { + scope.launch(Dispatchers.IO) { + val isNew = messageSetCard.createdAt() > NotificationCache.load(routeForLastRead) NotificationCache.markAsRead(routeForLastRead, messageSetCard.createdAt()) - if (newIsNew != isNew) { - isNew = newIsNew + val newBackgroundColor = if (isNew) { + newItemColor.compositeOver(defaultBackgroundColor) + } else { + defaultBackgroundColor + } + + if (backgroundColor.value != newBackgroundColor) { + backgroundColor.value = newBackgroundColor } } } - val backgroundColor = if (isNew) { - MaterialTheme.colors.newItemBackgroundColor.compositeOver(MaterialTheme.colors.background) - } else { - MaterialTheme.colors.background - } - - val columnModifier = remember(isNew) { + val columnModifier = remember(backgroundColor.value) { Modifier - .background(backgroundColor) + .drawBehind { + drawRect( + 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 66cb7ed9d..451a96912 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 @@ -56,6 +56,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.showAmountAxis import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange import com.vitorpamplona.amethyst.ui.theme.newItemBackgroundColor +import com.vitorpamplona.amethyst.ui.theme.overPictureBackground import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableMap import kotlinx.coroutines.Dispatchers @@ -341,10 +342,11 @@ private fun AuthorPictureAndComment( amount?.let { Box(modifier = Modifier.fillMaxSize().clip(shape = CircleShape), contentAlignment = Alignment.BottomCenter) { + val backgroundColor = MaterialTheme.colors.overPictureBackground Box( modifier = Modifier .fillMaxWidth() - .background(MaterialTheme.colors.background.copy(0.62f)), + .drawBehind { drawRect(backgroundColor) }, contentAlignment = Alignment.BottomCenter ) { Text( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt index 6421c3f6f..3c601b3da 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt @@ -34,6 +34,7 @@ import com.vitorpamplona.amethyst.model.User import com.vitorpamplona.amethyst.model.UserMetadata import com.vitorpamplona.amethyst.service.Nip05Verifier import com.vitorpamplona.amethyst.ui.theme.Nip05 +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import java.util.Date @@ -150,7 +151,7 @@ private fun DisplayNIP05( if (user != "_") { Text( text = AnnotatedString(user), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, maxLines = 1, overflow = TextOverflow.Ellipsis ) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt index 62733e760..236484ad2 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt @@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.FlowRow -import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize @@ -26,8 +25,6 @@ import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CutCornerShape import androidx.compose.foundation.text.ClickableText -import androidx.compose.material.Button -import androidx.compose.material.ButtonDefaults import androidx.compose.material.Divider import androidx.compose.material.DropdownMenu import androidx.compose.material.DropdownMenuItem @@ -143,11 +140,13 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.ChannelHeader import com.vitorpamplona.amethyst.ui.screen.loggedIn.ReportNoteDialog import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange -import com.vitorpamplona.amethyst.ui.theme.ButtonBorder import com.vitorpamplona.amethyst.ui.theme.Following import com.vitorpamplona.amethyst.ui.theme.QuoteBorder +import com.vitorpamplona.amethyst.ui.theme.mediumImportanceLink import com.vitorpamplona.amethyst.ui.theme.newItemBackgroundColor +import com.vitorpamplona.amethyst.ui.theme.placeholderText import com.vitorpamplona.amethyst.ui.theme.replyBackground +import com.vitorpamplona.amethyst.ui.theme.subtleBorder import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableSet import kotlinx.collections.immutable.persistentListOf @@ -756,7 +755,7 @@ private fun RenderTextEvent( if (makeItShort && isAuthorTheLoggedUser) { Text( text = eventContent, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, maxLines = 2, overflow = TextOverflow.Ellipsis ) @@ -802,7 +801,7 @@ private fun RenderPoll( if (makeItShort && accountViewModel.isLoggedUser(note.author)) { Text( text = eventContent, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, maxLines = 2, overflow = TextOverflow.Ellipsis ) @@ -962,7 +961,7 @@ fun RenderAppDefinition( if (!website.isNullOrEmpty()) { Row(verticalAlignment = Alignment.CenterVertically) { Icon( - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + tint = MaterialTheme.colors.placeholderText, imageVector = Icons.Default.Link, contentDescription = stringResource(R.string.website), modifier = Modifier.size(16.dp) @@ -1058,7 +1057,7 @@ private fun RenderPrivateMessage( if (makeItShort && isAuthorTheLoggedUser) { Text( text = eventContent, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, maxLines = 2, overflow = TextOverflow.Ellipsis ) @@ -1310,17 +1309,8 @@ fun DisplayPeopleList( ) } ) { - Button( - modifier = Modifier.padding(top = 10.dp), - onClick = { expanded = !expanded }, - shape = ButtonBorder, - colors = ButtonDefaults.buttonColors( - backgroundColor = MaterialTheme.colors.primary.copy(alpha = 0.32f) - .compositeOver(MaterialTheme.colors.background) - ), - contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp) - ) { - Text(text = stringResource(R.string.show_more), color = Color.White) + ShowMoreButton { + expanded = !expanded } } } @@ -1527,17 +1517,8 @@ fun PinListHeader( ) } ) { - Button( - modifier = Modifier.padding(top = 10.dp), - onClick = { expanded = !expanded }, - shape = ButtonBorder, - colors = ButtonDefaults.buttonColors( - backgroundColor = MaterialTheme.colors.primary.copy(alpha = 0.32f) - .compositeOver(MaterialTheme.colors.background) - ), - contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp) - ) { - Text(text = stringResource(R.string.show_more), color = Color.White) + ShowMoreButton { + expanded = !expanded } } } @@ -1614,7 +1595,7 @@ private fun RenderReport( .clip(shape = QuoteBorder) .border( 1.dp, - MaterialTheme.colors.onSurface.copy(alpha = 0.12f), + MaterialTheme.colors.subtleBorder, QuoteBorder ), unPackReply = false, @@ -1699,7 +1680,7 @@ private fun ReplyNoteComposition( .clip(shape = QuoteBorder) .border( 1.dp, - MaterialTheme.colors.onSurface.copy(alpha = 0.12f), + MaterialTheme.colors.subtleBorder, QuoteBorder ), unPackReply = false, @@ -1760,7 +1741,7 @@ private fun FirstUserInfoRow( Text( " ${stringResource(id = R.string.boosted)}", fontWeight = FontWeight.Bold, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } else { DisplayFollowingHashtagsInPost(eventNote, accountViewModel, nav) @@ -1787,7 +1768,7 @@ private fun MoreOptionsButton( imageVector = Icons.Default.MoreVert, null, modifier = Modifier.size(15.dp), - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + tint = MaterialTheme.colors.placeholderText ) NoteDropDownMenu( @@ -1815,7 +1796,7 @@ fun TimeAgo(time: Long) { Text( timeStr, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, maxLines = 1 ) } @@ -1878,11 +1859,19 @@ private fun ChannelNotePicture(baseChannel: Channel) { val channelState by baseChannel.live.observeAsState() val channel = remember(channelState) { channelState?.channel } ?: return + val backgroundColor = MaterialTheme.colors.background + val modifier = remember { Modifier .width(30.dp) .height(30.dp) .clip(shape = CircleShape) + .drawBehind { drawRect(backgroundColor) } + .border( + 2.dp, + backgroundColor, + CircleShape + ) } val boxModifier = remember { @@ -1901,12 +1890,6 @@ private fun ChannelNotePicture(baseChannel: Channel) { model = model, contentDescription = stringResource(R.string.group_picture), modifier = modifier - .background(MaterialTheme.colors.background) - .border( - 2.dp, - MaterialTheme.colors.background, - CircleShape - ) ) } } @@ -2184,13 +2167,13 @@ private fun RenderPledgeAmount( imageVector = Icons.Default.Bolt, contentDescription = stringResource(R.string.zaps), modifier = Modifier.size(20.dp), - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + tint = MaterialTheme.colors.placeholderText ) } Text( text = reward, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } @@ -2228,7 +2211,7 @@ fun BadgeDisplay(baseNote: Note) { .clip(shape = CutCornerShape(20, 20, 20, 20)) .border( 5.dp, - MaterialTheme.colors.primary.copy(alpha = 0.32f), + MaterialTheme.colors.mediumImportanceLink, CutCornerShape(20) ) .background(backgroundFromImage.first) @@ -2434,7 +2417,7 @@ fun AudioTrackHeader(noteEvent: AudioTrackEvent, accountViewModel: AccountViewMo it.first.role?.let { Text( text = it.capitalize(Locale.ROOT), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, maxLines = 1 ) } @@ -2474,7 +2457,7 @@ private fun LongFormHeader(noteEvent: LongTextNoteEvent, note: Note, accountView .clip(shape = QuoteBorder) .border( 1.dp, - MaterialTheme.colors.onSurface.copy(alpha = 0.12f), + MaterialTheme.colors.subtleBorder, QuoteBorder ) ) { @@ -2644,7 +2627,7 @@ private fun ShowMoreRelaysButton(onClick: () -> Unit) { imageVector = Icons.Default.ExpandMore, null, modifier = iconModifier, - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + tint = MaterialTheme.colors.placeholderText ) } } @@ -2679,17 +2662,20 @@ fun NoteAuthorPicture( } if (author == null) { + val backgroundColor = MaterialTheme.colors.background + val nullModifier = remember { modifier .size(size) .clip(shape = CircleShape) + .drawBehind { drawRect(backgroundColor) } } RobohashAsyncImage( robot = "authornotfound", robotSize = size, contentDescription = stringResource(R.string.unknown_author), - modifier = nullModifier.background(MaterialTheme.colors.background) + modifier = nullModifier ) } else { UserPicture(author!!, size, accountViewModel, modifier, onClick) @@ -2764,6 +2750,8 @@ fun UserPicture( modifier: Modifier = Modifier, accountViewModel: AccountViewModel ) { + val backgroundColor = MaterialTheme.colors.background + val myBoxModifier = remember { Modifier.size(size) } @@ -2772,6 +2760,7 @@ fun UserPicture( modifier .size(size) .clip(shape = CircleShape) + .drawBehind { drawRect(backgroundColor) } } val myIconSize = remember(size) { size.div(3.5f) } @@ -2783,7 +2772,7 @@ fun UserPicture( ResizeImage(userPicture, size) }, contentDescription = stringResource(id = R.string.profile_image), - modifier = myImageModifier.background(MaterialTheme.colors.background) + modifier = myImageModifier ) ObserveAndDisplayFollowingMark(userHex, myIconSize, accountViewModel) @@ -2820,14 +2809,17 @@ private fun FollowingIcon(iconSize: Dp) { } Box(myIconBoxModifier, contentAlignment = Alignment.Center) { + val backgroundColor = MaterialTheme.colors.background + val myIconBackgroundModifier = remember { Modifier .clip(CircleShape) .fillMaxSize(0.6f) + .drawBehind { drawRect(backgroundColor) } } Box( - myIconBackgroundModifier.background(MaterialTheme.colors.background) + myIconBackgroundModifier ) val myIconModifier = remember { diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt index 93f2563d3..7640fbc58 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt @@ -45,7 +45,6 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.shadow import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.compositeOver import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.LocalClipboardManager @@ -69,6 +68,7 @@ import com.vitorpamplona.amethyst.ui.components.SelectTextDialog import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.ReportNoteDialog import com.vitorpamplona.amethyst.ui.theme.WarningColor +import com.vitorpamplona.amethyst.ui.theme.secondaryButtonBackground import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -137,7 +137,7 @@ fun NoteQuickActionMenu(note: Note, popupExpanded: Boolean, onDismiss: () -> Uni val backgroundColor = if (MaterialTheme.colors.isLight) { MaterialTheme.colors.primary } else { - MaterialTheme.colors.primary.copy(alpha = 0.32f).compositeOver(MaterialTheme.colors.background) + MaterialTheme.colors.secondaryButtonBackground } val showToast = { stringResource: Int -> diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/PollNote.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/PollNote.kt index 850c8b2d2..68b9d08e9 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/PollNote.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/PollNote.kt @@ -33,6 +33,8 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange import com.vitorpamplona.amethyst.ui.theme.ButtonBorder import com.vitorpamplona.amethyst.ui.theme.QuoteBorder +import com.vitorpamplona.amethyst.ui.theme.mediumImportanceLink +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import java.util.* @@ -124,7 +126,7 @@ private fun OptionNote( val color = if (poolOption.consensusThreadhold) { Color.Green.copy(alpha = 0.32f) } else { - MaterialTheme.colors.primary.copy(alpha = 0.32f) + MaterialTheme.colors.mediumImportanceLink } ZapVote( @@ -411,7 +413,7 @@ fun ZapVote( imageVector = Icons.Outlined.Bolt, contentDescription = stringResource(id = R.string.zaps), modifier = Modifier.size(20.dp), - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + tint = MaterialTheme.colors.placeholderText ) } else { Spacer(Modifier.width(3.dp)) @@ -429,7 +431,7 @@ fun ZapVote( Text( showAmount(poolOption.zappedValue), fontSize = 14.sp, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, modifier = modifier ) } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt index ac5bc297e..3473ae074 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt @@ -67,6 +67,7 @@ import com.vitorpamplona.amethyst.ui.actions.NewPostView import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange import com.vitorpamplona.amethyst.ui.theme.ButtonBorder +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.collections.immutable.toImmutableList import kotlinx.collections.immutable.toImmutableMap import kotlinx.coroutines.CoroutineScope @@ -78,7 +79,7 @@ import kotlin.math.roundToInt @Composable fun ReactionsRow(baseNote: Note, showReactionDetail: Boolean, accountViewModel: AccountViewModel, nav: (String) -> Unit) { - val grayTint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + val grayTint = MaterialTheme.colors.placeholderText var wantsToSeeReactions = remember { mutableStateOf(false) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/RelayCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/RelayCompose.kt index 7c9d63d80..95beaa343 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/RelayCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/RelayCompose.kt @@ -25,6 +25,7 @@ import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.RelayInfo import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.theme.ButtonBorder +import com.vitorpamplona.amethyst.ui.theme.placeholderText import java.time.Instant import java.time.ZoneId import java.time.format.DateTimeFormatter @@ -67,7 +68,7 @@ fun RelayCompose( Text( "${relay.counter} ${stringResource(R.string.posts_received)}", - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, maxLines = 1, overflow = TextOverflow.Ellipsis ) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReplyInformation.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReplyInformation.kt index e880c0f69..d40924bd1 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReplyInformation.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReplyInformation.kt @@ -21,6 +21,8 @@ import com.vitorpamplona.amethyst.model.* import com.vitorpamplona.amethyst.ui.actions.toImmutableListOfLists import com.vitorpamplona.amethyst.ui.components.CreateClickableTextWithEmoji import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel +import com.vitorpamplona.amethyst.ui.theme.lessImportantLink +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.Dispatchers @@ -69,7 +71,7 @@ private fun ReplyInformation( Text( stringResource(R.string.replying_to), fontSize = 13.sp, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) repliesToDisplay.forEachIndexed { idx, user -> @@ -80,13 +82,13 @@ private fun ReplyInformation( Text( ", ", fontSize = 13.sp, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } else if (idx < repliesToDisplay.size - 1) { Text( stringResource(R.string.and), fontSize = 13.sp, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } } else { @@ -94,25 +96,25 @@ private fun ReplyInformation( Text( ", ", fontSize = 13.sp, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } else if (idx < repliesToDisplay.size) { Text( stringResource(R.string.and), fontSize = 13.sp, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) ClickableText( AnnotatedString("${sortedMentions.size - 2}"), - style = LocalTextStyle.current.copy(color = MaterialTheme.colors.primary.copy(alpha = 0.52f), fontSize = 13.sp), + style = LocalTextStyle.current.copy(color = MaterialTheme.colors.lessImportantLink, fontSize = 13.sp), onClick = { expanded = true } ) Text( " ${stringResource(R.string.others)}", fontSize = 13.sp, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } } @@ -195,12 +197,12 @@ fun ReplyInformationChannel( Text( stringResource(R.string.in_channel), fontSize = 13.sp, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) ClickableText( text = channelName, - style = LocalTextStyle.current.copy(color = MaterialTheme.colors.primary.copy(alpha = 0.52f), fontSize = 13.sp), + style = LocalTextStyle.current.copy(color = MaterialTheme.colors.lessImportantLink, fontSize = 13.sp), onClick = { onChannelTagClick(channel) } ) @@ -209,7 +211,7 @@ fun ReplyInformationChannel( Text( stringResource(id = R.string.replying_to), fontSize = 13.sp, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) mentions.forEachIndexed { idx, user -> @@ -219,13 +221,13 @@ fun ReplyInformationChannel( Text( ", ", fontSize = 13.sp, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } else if (idx < mentions.size - 1) { Text( " ${stringResource(id = R.string.add)} ", fontSize = 13.sp, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } } @@ -246,7 +248,7 @@ private fun ReplyInfoMention( clickablePart = remember(innerUserState) { "$prefix${innerUserState?.user?.toBestDisplayName()}" }, tags = remember(innerUserState) { innerUserState?.user?.info?.latestMetadata?.tags?.toImmutableListOfLists() }, style = LocalTextStyle.current.copy( - color = MaterialTheme.colors.primary.copy(alpha = 0.52f), + color = MaterialTheme.colors.lessImportantLink, fontSize = 13.sp ), onClick = { onUserTagClick(user) } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountDialog.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountDialog.kt index 0978a2408..7f0449dce 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountDialog.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountDialog.kt @@ -78,6 +78,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.TextSpinner import com.vitorpamplona.amethyst.ui.screen.loggedIn.getFragmentActivity import com.vitorpamplona.amethyst.ui.theme.ButtonBorder +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch @@ -324,7 +325,7 @@ fun UpdateZapAmountDialog(onClose: () -> Unit, nip47uri: String? = null, account placeholder = { Text( text = "100, 1000, 5000", - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, singleLine = true, @@ -413,7 +414,7 @@ fun UpdateZapAmountDialog(onClose: () -> Unit, nip47uri: String? = null, account Text( stringResource(id = R.string.wallet_connect_service_explainer), Modifier.weight(1f), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, fontSize = 14.sp ) } @@ -452,7 +453,7 @@ fun UpdateZapAmountDialog(onClose: () -> Unit, nip47uri: String? = null, account placeholder = { Text( text = "npub, hex", - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, singleLine = true, @@ -474,7 +475,7 @@ fun UpdateZapAmountDialog(onClose: () -> Unit, nip47uri: String? = null, account placeholder = { Text( text = "wss://relay.server.com", - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, maxLines = 1 ) }, @@ -518,7 +519,7 @@ fun UpdateZapAmountDialog(onClose: () -> Unit, nip47uri: String? = null, account placeholder = { Text( text = stringResource(R.string.wallet_connect_service_secret_placeholder), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, trailingIcon = { diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UserReactionsRow.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UserReactionsRow.kt index 0397cf3b1..422e3676a 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UserReactionsRow.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UserReactionsRow.kt @@ -48,6 +48,7 @@ import com.vitorpamplona.amethyst.ui.components.BundledInsert import com.vitorpamplona.amethyst.ui.screen.loggedIn.showAmountAxis import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange import com.vitorpamplona.amethyst.ui.theme.RoyalBlue +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job import kotlinx.coroutines.flow.MutableStateFlow @@ -80,7 +81,7 @@ fun UserReactionsRow( imageVector = Icons.Default.ExpandMore, null, modifier = Modifier.size(20.dp), - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + tint = MaterialTheme.colors.placeholderText ) } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UsernameDisplay.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UsernameDisplay.kt index 3bc510ea7..955c00ce0 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UsernameDisplay.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UsernameDisplay.kt @@ -14,6 +14,7 @@ import com.vitorpamplona.amethyst.model.User import com.vitorpamplona.amethyst.ui.actions.ImmutableListOfLists import com.vitorpamplona.amethyst.ui.actions.toImmutableListOfLists import com.vitorpamplona.amethyst.ui.components.CreateTextWithEmoji +import com.vitorpamplona.amethyst.ui.theme.placeholderText @Composable fun NoteUsernameDisplay(baseNote: Note, weight: Modifier = Modifier) { @@ -53,7 +54,7 @@ private fun UserNameDisplay( CreateTextWithEmoji( text = remember { "@$bestUserName" }, tags = tags, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = modifier diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt index 298691c0d..8aae0e444 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt @@ -26,6 +26,7 @@ import com.vitorpamplona.amethyst.ui.actions.CloseButton import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.TextSpinner import com.vitorpamplona.amethyst.ui.theme.ButtonBorder +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -148,7 +149,7 @@ fun ZapCustomDialog(onClose: () -> Unit, accountViewModel: AccountViewModel, bas placeholder = { Text( text = "100, 1000, 5000", - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, singleLine = true, @@ -199,7 +200,7 @@ fun ZapCustomDialog(onClose: () -> Unit, accountViewModel: AccountViewModel, bas placeholder = { Text( text = stringResource(id = R.string.custom_zaps_add_a_message_example), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, singleLine = true, diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapNoteCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapNoteCompose.kt index 5a183186a..cae2d2a01 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapNoteCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapNoteCompose.kt @@ -35,6 +35,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.ShowUserButton import com.vitorpamplona.amethyst.ui.screen.loggedIn.UnfollowButton import com.vitorpamplona.amethyst.ui.screen.loggedIn.showAmountAxis import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -225,7 +226,7 @@ fun AboutDisplay(baseAuthor: User) { Text( userAboutMe, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, maxLines = 1, overflow = TextOverflow.Ellipsis ) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/ThreadFeedView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/ThreadFeedView.kt index dd53e50d2..4228c994a 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/ThreadFeedView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/ThreadFeedView.kt @@ -81,6 +81,8 @@ import com.vitorpamplona.amethyst.ui.note.NoteUsernameDisplay import com.vitorpamplona.amethyst.ui.note.ReactionsRow import com.vitorpamplona.amethyst.ui.note.timeAgo import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel +import com.vitorpamplona.amethyst.ui.theme.lessImportantLink +import com.vitorpamplona.amethyst.ui.theme.placeholderText import com.vitorpamplona.amethyst.ui.theme.selectedNote import kotlinx.collections.immutable.toImmutableList import kotlinx.collections.immutable.toImmutableSet @@ -141,8 +143,8 @@ fun ThreadFeedView(noteId: String, viewModel: FeedViewModel, accountViewModel: A item, modifier = Modifier.drawReplyLevel( item.replyLevel(), - MaterialTheme.colors.onSurface.copy(alpha = 0.32f), - if (item.idHex == noteId) MaterialTheme.colors.primary.copy(alpha = 0.52f) else MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + MaterialTheme.colors.placeholderText, + if (item.idHex == noteId) MaterialTheme.colors.lessImportantLink else MaterialTheme.colors.placeholderText ), accountViewModel = accountViewModel, nav = nav @@ -159,8 +161,8 @@ fun ThreadFeedView(noteId: String, viewModel: FeedViewModel, accountViewModel: A item, modifier = Modifier.drawReplyLevel( item.replyLevel(), - MaterialTheme.colors.onSurface.copy(alpha = 0.32f), - if (item.idHex == noteId) MaterialTheme.colors.primary.copy(alpha = 0.52f) else MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + MaterialTheme.colors.placeholderText, + if (item.idHex == noteId) MaterialTheme.colors.lessImportantLink else MaterialTheme.colors.placeholderText ), parentBackgroundColor = background, isBoostedNote = false, @@ -284,7 +286,7 @@ fun NoteMaster( Text( timeAgo(note.createdAt(), context = context), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, maxLines = 1 ) @@ -296,7 +298,7 @@ fun NoteMaster( imageVector = Icons.Default.MoreVert, null, modifier = Modifier.size(15.dp), - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + tint = MaterialTheme.colors.placeholderText ) NoteDropDownMenu(baseNote, moreActionsExpanded, { moreActionsExpanded = false }, accountViewModel) 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 2174bc9f2..048566282 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 @@ -80,6 +80,7 @@ import com.vitorpamplona.amethyst.ui.note.ChatroomMessageCompose import com.vitorpamplona.amethyst.ui.screen.NostrChannelFeedViewModel import com.vitorpamplona.amethyst.ui.screen.RefreshingChatroomFeedView import com.vitorpamplona.amethyst.ui.theme.ButtonBorder +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext @@ -281,7 +282,7 @@ fun DisplayReplyingToNote( modifier = Modifier .padding(end = 5.dp) .size(30.dp), - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + tint = MaterialTheme.colors.placeholderText ) } } @@ -318,7 +319,7 @@ fun EditFieldRow( placeholder = { Text( text = stringResource(R.string.reply_here), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, textStyle = LocalTextStyle.current.copy(textDirection = TextDirection.Content), @@ -334,7 +335,7 @@ fun EditFieldRow( leadingIcon = { UploadFromGallery( isUploading = channelScreenModel.isUploadingImage, - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + tint = MaterialTheme.colors.placeholderText, modifier = Modifier.padding(start = 5.dp) ) { val fileServer = if (isPrivate) { @@ -418,7 +419,7 @@ fun ChannelHeader(baseChannel: Channel, accountViewModel: AccountViewModel, nav: Row(verticalAlignment = Alignment.CenterVertically) { Text( "${channel.info.about}", - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + color = MaterialTheme.colors.placeholderText, maxLines = 2, overflow = TextOverflow.Ellipsis, fontSize = 12.sp @@ -489,7 +490,7 @@ private fun NoteCopyButton( shape = ButtonBorder, colors = ButtonDefaults .buttonColors( - backgroundColor = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + backgroundColor = MaterialTheme.colors.placeholderText ) ) { Icon( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChatroomListScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChatroomListScreen.kt index 96f21adea..3f548381f 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChatroomListScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChatroomListScreen.kt @@ -45,6 +45,7 @@ import com.vitorpamplona.amethyst.ui.screen.ChatroomListFeedView import com.vitorpamplona.amethyst.ui.screen.FeedViewModel import com.vitorpamplona.amethyst.ui.screen.NostrChatroomListKnownFeedViewModel import com.vitorpamplona.amethyst.ui.screen.NostrChatroomListNewFeedViewModel +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -123,7 +124,7 @@ fun ChatroomListScreen( Icon( imageVector = Icons.Default.MoreVert, contentDescription = null, - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + tint = MaterialTheme.colors.placeholderText ) ChatroomTabMenu( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ConnectOrbotDialog.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ConnectOrbotDialog.kt index 832d5275d..fa295db61 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ConnectOrbotDialog.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ConnectOrbotDialog.kt @@ -36,6 +36,7 @@ import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.ui.actions.CloseButton import com.vitorpamplona.amethyst.ui.components.richTextDefaults import com.vitorpamplona.amethyst.ui.theme.ButtonBorder +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.coroutines.launch @Composable @@ -121,7 +122,7 @@ fun ConnectOrbotDialog(onClose: () -> Unit, onPost: () -> Unit, portNumber: Muta placeholder = { Text( text = "9050", - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } ) 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 3e9b1a433..cd275ba71 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 @@ -97,6 +97,7 @@ import com.vitorpamplona.amethyst.ui.screen.RelayFeedViewModel import com.vitorpamplona.amethyst.ui.screen.UserFeedViewModel import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange import com.vitorpamplona.amethyst.ui.theme.ButtonBorder +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -447,7 +448,7 @@ private fun ProfileHeader( contentPadding = PaddingValues(0.dp) ) { Icon( - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + tint = MaterialTheme.colors.placeholderText, imageVector = Icons.Default.MoreVert, contentDescription = stringResource(R.string.more_options) ) @@ -610,7 +611,7 @@ private fun DrawAdditionalInfo( CreateTextWithEmoji( text = "@$it", tags = tags, - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) } } @@ -620,7 +621,7 @@ private fun DrawAdditionalInfo( Text( text = user.pubkeyDisplayHex(), modifier = Modifier.padding(top = 1.dp, bottom = 1.dp), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) IconButton( @@ -633,7 +634,7 @@ private fun DrawAdditionalInfo( imageVector = Icons.Default.ContentCopy, null, modifier = Modifier.size(15.dp), - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + tint = MaterialTheme.colors.placeholderText ) } @@ -660,7 +661,7 @@ private fun DrawAdditionalInfo( painter = painterResource(R.drawable.ic_qrcode), null, modifier = Modifier.size(15.dp), - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + tint = MaterialTheme.colors.placeholderText ) } } @@ -673,7 +674,7 @@ private fun DrawAdditionalInfo( if (!website.isNullOrEmpty()) { Row(verticalAlignment = Alignment.CenterVertically) { Icon( - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f), + tint = MaterialTheme.colors.placeholderText, imageVector = Icons.Default.Link, contentDescription = stringResource(R.string.website), modifier = Modifier.size(16.dp) @@ -1224,7 +1225,7 @@ private fun MessageButton(user: User, nav: (String) -> Unit) { shape = ButtonBorder, colors = ButtonDefaults .buttonColors( - backgroundColor = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + backgroundColor = MaterialTheme.colors.placeholderText ) ) { Icon( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/SearchScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/SearchScreen.kt index a96ecb5b0..7ac61cc93 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/SearchScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/SearchScreen.kt @@ -69,6 +69,7 @@ import com.vitorpamplona.amethyst.ui.note.UsernameDisplay import com.vitorpamplona.amethyst.ui.screen.NostrGlobalFeedViewModel import com.vitorpamplona.amethyst.ui.screen.RefresheableFeedView import com.vitorpamplona.amethyst.ui.screen.ScrollStateKeys +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.MutableStateFlow @@ -316,7 +317,7 @@ private fun SearchTextField( placeholder = { Text( text = stringResource(R.string.npub_hex_username), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, trailingIcon = { diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/VideoScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/VideoScreen.kt index 5060afdf7..fd43817b8 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/VideoScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/VideoScreen.kt @@ -87,6 +87,7 @@ import com.vitorpamplona.amethyst.ui.screen.LoadingFeed import com.vitorpamplona.amethyst.ui.screen.NostrVideoFeedViewModel import com.vitorpamplona.amethyst.ui.screen.ScrollStateKeys import com.vitorpamplona.amethyst.ui.screen.rememberForeverPagerState +import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.collections.immutable.ImmutableList import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay @@ -341,7 +342,7 @@ private fun VideoUserOptionAction( imageVector = Icons.Default.MoreVert, null, modifier = remember { Modifier.size(20.dp) }, - tint = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + tint = MaterialTheme.colors.placeholderText ) NoteDropDownMenu( @@ -494,8 +495,8 @@ private fun ShowProgress(postViewModel: NewMediaModel) { progress = postViewModel.uploadingPercentage.value, modifier = Modifier .size(55.dp) - .background(MaterialTheme.colors.background) - .clip(CircleShape), + .clip(CircleShape) + .background(MaterialTheme.colors.background), strokeWidth = 5.dp ) postViewModel.uploadingDescription.value?.let { diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/LoginScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/LoginScreen.kt index 450b14777..ee39b9f42 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/LoginScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/LoginScreen.kt @@ -40,6 +40,7 @@ import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.ui.qrcode.SimpleQrCodeScanner import com.vitorpamplona.amethyst.ui.screen.AccountStateViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.ConnectOrbotDialog +import com.vitorpamplona.amethyst.ui.theme.placeholderText import java.util.* @OptIn(ExperimentalComposeUiApi::class) @@ -122,7 +123,7 @@ fun LoginPage( placeholder = { Text( text = stringResource(R.string.nsec_npub_hex_private_key), - color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) + color = MaterialTheme.colors.placeholderText ) }, trailingIcon = { 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 c0e12b723..03fb9c4e4 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 @@ -4,7 +4,6 @@ import android.app.Activity import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material.Colors import androidx.compose.material.MaterialTheme -import androidx.compose.material.Shapes import androidx.compose.material.darkColors import androidx.compose.material.lightColors import androidx.compose.runtime.Composable @@ -37,6 +36,30 @@ private val LightReplyItemBackground = LightColorPalette.onSurface.copy(alpha = private val DarkSelectedNote = DarkNewItemBackground.compositeOver(DarkColorPalette.background) private val LightSelectedNote = LightNewItemBackground.compositeOver(LightColorPalette.background) +private val DarkButtonBackground = DarkColorPalette.primary.copy(alpha = 0.32f).compositeOver(DarkColorPalette.background) +private val LightButtonBackground = LightColorPalette.primary.copy(alpha = 0.32f).compositeOver(LightColorPalette.background) + +private val DarkLessImportantLink = DarkColorPalette.primary.copy(alpha = 0.52f) +private val LightLessImportantLink = LightColorPalette.primary.copy(alpha = 0.52f) + +private val DarkMediumImportantLink = DarkColorPalette.primary.copy(alpha = 0.32f) +private val LightMediumImportantLink = LightColorPalette.primary.copy(alpha = 0.32f) + +private val DarkVeryImportantLink = DarkColorPalette.primary.copy(alpha = 0.12f) +private val LightVeryImportantLink = LightColorPalette.primary.copy(alpha = 0.12f) + +private val DarkPlaceholderText = DarkColorPalette.onSurface.copy(alpha = 0.32f) +private val LightPlaceholderText = LightColorPalette.onSurface.copy(alpha = 0.32f) + +private val DarkSubtleBorder = DarkColorPalette.onSurface.copy(alpha = 0.12f) +private val LightSubtleBorder = LightColorPalette.onSurface.copy(alpha = 0.12f) + +private val DarkImageVerifier = Nip05.copy(0.52f).compositeOver(DarkColorPalette.background) +private val LightImageVerifier = Nip05.copy(0.52f).compositeOver(LightColorPalette.background) + +private val DarkOverPictureBackground = DarkColorPalette.background.copy(0.62f) +private val LightOverPictureBackground = LightColorPalette.background.copy(0.62f) + val Colors.newItemBackgroundColor: Color get() = if (isLight) LightNewItemBackground else DarkNewItemBackground @@ -46,6 +69,29 @@ val Colors.replyBackground: Color val Colors.selectedNote: Color get() = if (isLight) LightSelectedNote else DarkSelectedNote +val Colors.secondaryButtonBackground: Color + get() = if (isLight) LightButtonBackground else DarkButtonBackground + +val Colors.lessImportantLink: Color + get() = if (isLight) LightLessImportantLink else DarkLessImportantLink + +val Colors.mediumImportanceLink: Color + get() = if (isLight) LightMediumImportantLink else DarkMediumImportantLink +val Colors.veryImportantLink: Color + get() = if (isLight) LightVeryImportantLink else DarkVeryImportantLink + +val Colors.placeholderText: Color + get() = if (isLight) LightPlaceholderText else DarkPlaceholderText + +val Colors.subtleBorder: Color + get() = if (isLight) LightSubtleBorder else DarkSubtleBorder + +val Colors.hashVerified: Color + get() = if (isLight) LightImageVerifier else DarkImageVerifier + +val Colors.overPictureBackground: Color + get() = if (isLight) LightOverPictureBackground else DarkOverPictureBackground + @Composable fun AmethystTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) { val colors = if (darkTheme) { diff --git a/app/src/play/java/com/vitorpamplona/amethyst/ui/components/TranslatableRichTextViewer.kt b/app/src/play/java/com/vitorpamplona/amethyst/ui/components/TranslatableRichTextViewer.kt index 226137739..0b7b5b6ea 100644 --- a/app/src/play/java/com/vitorpamplona/amethyst/ui/components/TranslatableRichTextViewer.kt +++ b/app/src/play/java/com/vitorpamplona/amethyst/ui/components/TranslatableRichTextViewer.kt @@ -36,6 +36,7 @@ import com.vitorpamplona.amethyst.service.lang.LanguageTranslatorService import com.vitorpamplona.amethyst.service.lang.ResultOrError import com.vitorpamplona.amethyst.ui.actions.ImmutableListOfLists import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel +import com.vitorpamplona.amethyst.ui.theme.lessImportantLink import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import java.util.Locale @@ -117,7 +118,7 @@ private fun TranslationMessage( .padding(top = 5.dp) ) { val clickableTextStyle = - SpanStyle(color = MaterialTheme.colors.primary.copy(alpha = 0.52f)) + SpanStyle(color = MaterialTheme.colors.lessImportantLink) val annotatedTranslationString = buildAnnotatedString { withStyle(clickableTextStyle) {