diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/metadata/ChannelMetadataScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/metadata/ChannelMetadataScreen.kt index 7d3b4d890..3acf85351 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/metadata/ChannelMetadataScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/metadata/ChannelMetadataScreen.kt @@ -64,6 +64,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.RelayUrlEditF import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.relaySetupInfoBuilder import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.DoubleVertSpacer +import com.vitorpamplona.amethyst.ui.theme.HorzHalfVertPadding import com.vitorpamplona.amethyst.ui.theme.SettingsCategoryFirstModifier import com.vitorpamplona.amethyst.ui.theme.SettingsCategorySpacingModifier import com.vitorpamplona.amethyst.ui.theme.ThemeComparisonColumn @@ -224,6 +225,7 @@ private fun ChannelMetadataScaffold( item, onDelete = { postViewModel.deleteHomeRelay(item) }, nip11CachedRetriever = Amethyst.instance.nip11Cache, + modifier = HorzHalfVertPadding, accountViewModel = accountViewModel, nav = nav, ) @@ -232,6 +234,7 @@ private fun ChannelMetadataScaffold( item { RelayUrlEditField( onNewRelay = { postViewModel.addHomeRelay(relaySetupInfoBuilder(it)) }, + modifier = Modifier, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/NewNoteButton.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/NewNoteButton.kt index 623653458..8049609ed 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/NewNoteButton.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/NewNoteButton.kt @@ -20,19 +20,35 @@ */ package com.vitorpamplona.amethyst.ui.screen.loggedIn.home +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape import androidx.compose.material3.FloatingActionButton import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.R +import com.vitorpamplona.amethyst.ui.navigation.navs.EmptyNav import com.vitorpamplona.amethyst.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.navigation.routes.Route import com.vitorpamplona.amethyst.ui.painterRes import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.Size26Modifier import com.vitorpamplona.amethyst.ui.theme.Size55Modifier +import com.vitorpamplona.amethyst.ui.theme.ThemeComparisonRow + +@Composable +fun NewNoteButtonPreview() { + ThemeComparisonRow { + Box(Modifier.size(200.dp), contentAlignment = Alignment.Center) { + NewNoteButton(EmptyNav()) + } + } +} @Composable fun NewNoteButton(nav: INav) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/AllRelayListScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/AllRelayListScreen.kt index 546f23961..1a3798d75 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/AllRelayListScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/AllRelayListScreen.kt @@ -37,7 +37,6 @@ import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedButton import androidx.compose.material3.Scaffold -import androidx.compose.material3.Switch import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -89,12 +88,11 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.search.SearchRelayLi import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.search.renderSearchItems import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.trusted.TrustedRelayListViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.trusted.renderTrustedItems -import com.vitorpamplona.amethyst.ui.screen.loggedIn.settings.SettingsRow import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.FeedPadding import com.vitorpamplona.amethyst.ui.theme.RowColSpacing -import com.vitorpamplona.amethyst.ui.theme.SettingsCategoryFirstModifier -import com.vitorpamplona.amethyst.ui.theme.SettingsCategorySpacingModifier +import com.vitorpamplona.amethyst.ui.theme.SettingsCategoryFirstWithHorzBorderModifier +import com.vitorpamplona.amethyst.ui.theme.SettingsCategorySpacingWithHorzBorderModifier import com.vitorpamplona.amethyst.ui.theme.grayText @Composable @@ -339,7 +337,7 @@ fun MappedAllRelayListView( SettingsCategory( R.string.public_home_section, R.string.public_home_section_explainer, - SettingsCategoryFirstModifier, + SettingsCategoryFirstWithHorzBorderModifier, ) } renderNip65HomeItems(homeFeedState, nip65ViewModel, accountViewModel, nav, outboxCounts, homeDragState) @@ -348,7 +346,7 @@ fun MappedAllRelayListView( SettingsCategory( R.string.public_notif_section, R.string.public_notif_section_explainer, - SettingsCategorySpacingModifier, + SettingsCategorySpacingWithHorzBorderModifier, ) } renderNip65NotifItems(notifFeedState, nip65ViewModel, accountViewModel, nav, inboxCounts, notifDragState) @@ -357,7 +355,7 @@ fun MappedAllRelayListView( SettingsCategoryWithButton( R.string.private_inbox_section, R.string.private_inbox_section_explainer, - SettingsCategorySpacingModifier, + SettingsCategorySpacingWithHorzBorderModifier, action = { ResetDMRelays(dmViewModel) }, @@ -369,7 +367,7 @@ fun MappedAllRelayListView( SettingsCategory( R.string.private_outbox_section, R.string.private_outbox_section_explainer, - SettingsCategorySpacingModifier, + SettingsCategorySpacingWithHorzBorderModifier, ) } renderPrivateOutboxItems(privateOutboxFeedState, privateOutboxViewModel, accountViewModel, nav, privateHomeCounts, privateOutboxDragState) @@ -378,7 +376,7 @@ fun MappedAllRelayListView( SettingsCategory( R.string.proxy_section, R.string.proxy_section_explainer, - SettingsCategorySpacingModifier, + SettingsCategorySpacingWithHorzBorderModifier, ) } renderProxyItems(proxyRelays, proxyViewModel, accountViewModel, nav, proxyCounts, proxyDragState) @@ -387,7 +385,7 @@ fun MappedAllRelayListView( SettingsCategory( R.string.broadcast_section, R.string.broadcast_section_explainer, - SettingsCategorySpacingModifier, + SettingsCategorySpacingWithHorzBorderModifier, ) } renderBroadcastItems(broadcastRelays, broadcastViewModel, accountViewModel, nav, broadcastDragState) @@ -396,7 +394,7 @@ fun MappedAllRelayListView( SettingsCategoryWithButton( R.string.indexer_section, R.string.indexer_section_explainer, - SettingsCategorySpacingModifier, + SettingsCategorySpacingWithHorzBorderModifier, ) { ResetIndexerRelays(indexerViewModel) } @@ -407,7 +405,7 @@ fun MappedAllRelayListView( SettingsCategoryWithButton( R.string.search_section, R.string.search_section_explainer, - SettingsCategorySpacingModifier, + SettingsCategorySpacingWithHorzBorderModifier, ) { ResetSearchRelays(searchViewModel) } @@ -418,34 +416,16 @@ fun MappedAllRelayListView( SettingsCategory( R.string.local_section, R.string.local_section_explainer, - SettingsCategorySpacingModifier, + SettingsCategorySpacingWithHorzBorderModifier, ) } - item { - val sendKind0 by accountViewModel.account.settings.syncedSettings.security.sendKind0EventsToLocalRelay - .collectAsStateWithLifecycle() - var checked by remember(sendKind0) { mutableStateOf(sendKind0) } - - SettingsRow( - R.string.send_kind0_to_local_relay_title, - R.string.send_kind0_to_local_relay_description, - ) { - Switch( - checked = checked, - onCheckedChange = { - checked = it - accountViewModel.toggleSendKind0ToLocalRelay(it) - }, - ) - } - } renderLocalItems(localFeedState, localViewModel, accountViewModel, nav, localDragState) item { SettingsCategory( R.string.trusted_section, R.string.trusted_section_explainer, - SettingsCategorySpacingModifier, + SettingsCategorySpacingWithHorzBorderModifier, ) } renderTrustedItems(trustedFeedState, trustedViewModel, accountViewModel, nav, trustedDragState) @@ -454,7 +434,7 @@ fun MappedAllRelayListView( SettingsCategory( R.string.favorite_section, R.string.favorite_section_explainer, - SettingsCategorySpacingModifier, + SettingsCategorySpacingWithHorzBorderModifier, ) } renderRelayFeedsItems(relayFeedsFeedState, relayFeedsViewModel, accountViewModel, nav, feedsDragState) @@ -463,7 +443,7 @@ fun MappedAllRelayListView( SettingsCategory( R.string.blocked_section, R.string.blocked_section_explainer, - SettingsCategorySpacingModifier, + SettingsCategorySpacingWithHorzBorderModifier, ) } renderBlockedItems(blockedFeedState, blockedViewModel, accountViewModel, nav, blockedDragState) @@ -472,7 +452,7 @@ fun MappedAllRelayListView( SettingsCategory( R.string.connected_section, R.string.connected_section_description, - SettingsCategorySpacingModifier, + SettingsCategorySpacingWithHorzBorderModifier, ) } renderConnectedItems(connectedRelays, connectedViewModel, accountViewModel, nav) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/blocked/BlockedRelayListView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/blocked/BlockedRelayListView.kt index 708771539..58ff8c636 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/blocked/BlockedRelayListView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/blocked/BlockedRelayListView.kt @@ -40,6 +40,8 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.RelayUrlEditF import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.relaySetupInfoBuilder import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.rememberRelayDragState import com.vitorpamplona.amethyst.ui.theme.FeedPadding +import com.vitorpamplona.amethyst.ui.theme.HorzHalfVertPadding +import com.vitorpamplona.amethyst.ui.theme.HorzPadding import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer @Composable @@ -79,6 +81,7 @@ fun LazyListScope.renderBlockedItems( item, onDelete = { postViewModel.deleteRelay(item) }, nip11CachedRetriever = Amethyst.instance.nip11Cache, + modifier = HorzHalfVertPadding, index = index, dragState = dragState, accountViewModel = accountViewModel, @@ -90,6 +93,7 @@ fun LazyListScope.renderBlockedItems( Spacer(modifier = StdVertSpacer) RelayUrlEditField( onNewRelay = { postViewModel.addRelay(relaySetupInfoBuilder(it)) }, + modifier = HorzPadding, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/broadcast/BroadcastRelayListView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/broadcast/BroadcastRelayListView.kt index a8e9d1d7e..ee2ba432d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/broadcast/BroadcastRelayListView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/broadcast/BroadcastRelayListView.kt @@ -40,6 +40,8 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.RelayUrlEditF import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.relaySetupInfoBuilder import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.rememberRelayDragState import com.vitorpamplona.amethyst.ui.theme.FeedPadding +import com.vitorpamplona.amethyst.ui.theme.HorzHalfVertPadding +import com.vitorpamplona.amethyst.ui.theme.HorzPadding import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer @Composable @@ -79,6 +81,7 @@ fun LazyListScope.renderBroadcastItems( item, onDelete = { postViewModel.deleteRelay(item) }, nip11CachedRetriever = Amethyst.instance.nip11Cache, + modifier = HorzHalfVertPadding, index = index, dragState = dragState, accountViewModel = accountViewModel, @@ -90,6 +93,7 @@ fun LazyListScope.renderBroadcastItems( Spacer(modifier = StdVertSpacer) RelayUrlEditField( onNewRelay = { postViewModel.addRelay(relaySetupInfoBuilder(it)) }, + modifier = HorzPadding, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/BasicRelaySetupInfoDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/BasicRelaySetupInfoDialog.kt index 2ce7eb1ec..2c07dca5a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/BasicRelaySetupInfoDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/BasicRelaySetupInfoDialog.kt @@ -21,16 +21,17 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier import com.vitorpamplona.amethyst.model.nip11RelayInfo.Nip11CachedRetriever import com.vitorpamplona.amethyst.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.navigation.routes.Route import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.amethyst.ui.theme.HorzHalfVertPadding @Composable fun BasicRelaySetupInfoDialog( item: BasicRelaySetupInfo, nip11CachedRetriever: Nip11CachedRetriever, + modifier: Modifier = Modifier, onDelete: ((BasicRelaySetupInfo) -> Unit)?, countResult: RelayCountResult? = null, index: Int = -1, @@ -45,7 +46,7 @@ fun BasicRelaySetupInfoDialog( onDelete = onDelete, onClick = { nav.nav(Route.RelayInfo(item.relay.url)) }, nip11CachedRetriever = nip11CachedRetriever, - modifier = HorzHalfVertPadding, + modifier = modifier, index = index, dragState = dragState, countResult = countResult, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/RelayUrlEditField.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/RelayUrlEditField.kt index 1b49e15bf..b51eb899c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/RelayUrlEditField.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/RelayUrlEditField.kt @@ -111,6 +111,7 @@ fun RelayUrlEditFieldPreview() { onNewRelay = {}, relaySuggestions = relaySuggestions, nip11CachedRetriever = Nip11CachedRetriever { TODO() }, + modifier = Modifier, accountViewModel = accountViewModel, nav = EmptyNav(), ) @@ -120,12 +121,14 @@ fun RelayUrlEditFieldPreview() { @Composable fun RelayUrlEditField( onNewRelay: (NormalizedRelayUrl) -> Unit, + modifier: Modifier, accountViewModel: AccountViewModel, nav: INav, ) { RelayUrlEditField( onNewRelay = onNewRelay, nip11CachedRetriever = Amethyst.instance.nip11Cache, + modifier = modifier, accountViewModel = accountViewModel, nav = nav, ) @@ -135,6 +138,7 @@ fun RelayUrlEditField( fun RelayUrlEditField( onNewRelay: (NormalizedRelayUrl) -> Unit, nip11CachedRetriever: Nip11CachedRetriever, + modifier: Modifier, accountViewModel: AccountViewModel, nav: INav, ) { @@ -143,6 +147,7 @@ fun RelayUrlEditField( onNewRelay = onNewRelay, relaySuggestions = relaySuggestions, nip11CachedRetriever = nip11CachedRetriever, + modifier = modifier, accountViewModel = accountViewModel, nav = nav, ) @@ -153,6 +158,7 @@ fun RelayUrlEditField( onNewRelay: (NormalizedRelayUrl) -> Unit, relaySuggestions: IRelaySuggestionState, nip11CachedRetriever: Nip11CachedRetriever, + modifier: Modifier, accountViewModel: AccountViewModel, nav: INav, ) { @@ -169,7 +175,7 @@ fun RelayUrlEditField( } } - Column { + Column(modifier) { OutlinedTextField( label = { Text(text = stringRes(R.string.add_a_relay)) }, modifier = Modifier.fillMaxWidth(), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/connected/ConnectedRelayListView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/connected/ConnectedRelayListView.kt index 13a8e6c04..31267faf9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/connected/ConnectedRelayListView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/connected/ConnectedRelayListView.kt @@ -35,6 +35,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.BasicRelaySetupInfo import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.BasicRelaySetupInfoDialog import com.vitorpamplona.amethyst.ui.theme.FeedPadding +import com.vitorpamplona.amethyst.ui.theme.HorzHalfVertPadding @Composable fun ConnectedRelayList( @@ -66,6 +67,7 @@ fun LazyListScope.renderConnectedItems( item, onDelete = null, nip11CachedRetriever = Amethyst.instance.nip11Cache, + modifier = HorzHalfVertPadding, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/dm/DMRelayListView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/dm/DMRelayListView.kt index b5bf34991..9b633fa12 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/dm/DMRelayListView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/dm/DMRelayListView.kt @@ -41,6 +41,8 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.RelayUrlEditF import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.relaySetupInfoBuilder import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.rememberRelayDragState import com.vitorpamplona.amethyst.ui.theme.FeedPadding +import com.vitorpamplona.amethyst.ui.theme.HorzHalfVertPadding +import com.vitorpamplona.amethyst.ui.theme.HorzPadding import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl @@ -82,6 +84,7 @@ fun LazyListScope.renderDMItems( item, onDelete = { postViewModel.deleteRelay(item) }, nip11CachedRetriever = Amethyst.instance.nip11Cache, + modifier = HorzHalfVertPadding, countResult = countResults[item.relay], index = index, dragState = dragState, @@ -94,6 +97,7 @@ fun LazyListScope.renderDMItems( Spacer(modifier = StdVertSpacer) RelayUrlEditField( onNewRelay = { postViewModel.addRelay(relaySetupInfoBuilder(it)) }, + modifier = HorzPadding, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/feeds/RelayFeedsListView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/feeds/RelayFeedsListView.kt index a18debeb4..5cb940b72 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/feeds/RelayFeedsListView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/feeds/RelayFeedsListView.kt @@ -40,6 +40,8 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.RelayUrlEditF import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.relaySetupInfoBuilder import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.rememberRelayDragState import com.vitorpamplona.amethyst.ui.theme.FeedPadding +import com.vitorpamplona.amethyst.ui.theme.HorzHalfVertPadding +import com.vitorpamplona.amethyst.ui.theme.HorzPadding import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer @Composable @@ -79,6 +81,7 @@ fun LazyListScope.renderRelayFeedsItems( item, onDelete = { postViewModel.deleteRelay(item) }, nip11CachedRetriever = Amethyst.instance.nip11Cache, + modifier = HorzHalfVertPadding, index = index, dragState = dragState, accountViewModel = accountViewModel, @@ -90,6 +93,7 @@ fun LazyListScope.renderRelayFeedsItems( Spacer(modifier = StdVertSpacer) RelayUrlEditField( onNewRelay = { postViewModel.addRelay(relaySetupInfoBuilder(it)) }, + modifier = HorzPadding, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/indexer/IndexerRelayListView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/indexer/IndexerRelayListView.kt index 18f86eb92..a1eb0d87e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/indexer/IndexerRelayListView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/indexer/IndexerRelayListView.kt @@ -41,6 +41,8 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.RelayUrlEditF import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.relaySetupInfoBuilder import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.rememberRelayDragState import com.vitorpamplona.amethyst.ui.theme.FeedPadding +import com.vitorpamplona.amethyst.ui.theme.HorzHalfVertPadding +import com.vitorpamplona.amethyst.ui.theme.HorzPadding import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl @@ -82,6 +84,7 @@ fun LazyListScope.renderIndexerItems( item, onDelete = { postViewModel.deleteRelay(item) }, nip11CachedRetriever = Amethyst.instance.nip11Cache, + modifier = HorzHalfVertPadding, countResult = countResults[item.relay], index = index, dragState = dragState, @@ -94,6 +97,7 @@ fun LazyListScope.renderIndexerItems( Spacer(modifier = StdVertSpacer) RelayUrlEditField( onNewRelay = { postViewModel.addRelay(relaySetupInfoBuilder(it)) }, + modifier = HorzPadding, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/local/LocalRelayListView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/local/LocalRelayListView.kt index 3098f8c5e..6c9bff9a9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/local/LocalRelayListView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/local/LocalRelayListView.kt @@ -25,11 +25,13 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.itemsIndexed +import androidx.compose.material3.Switch import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vitorpamplona.amethyst.Amethyst +import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.navigation.navs.rememberExtendedNav import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel @@ -39,7 +41,11 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.RelayDragStat import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.RelayUrlEditField import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.relaySetupInfoBuilder import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.rememberRelayDragState +import com.vitorpamplona.amethyst.ui.screen.loggedIn.settings.SettingsRow import com.vitorpamplona.amethyst.ui.theme.FeedPadding +import com.vitorpamplona.amethyst.ui.theme.HorzHalfVertPadding +import com.vitorpamplona.amethyst.ui.theme.HorzPadding +import com.vitorpamplona.amethyst.ui.theme.SettingsCategorySpacingWithHorzBorderModifier import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer @Composable @@ -79,6 +85,7 @@ fun LazyListScope.renderLocalItems( item, onDelete = { postViewModel.deleteRelay(item) }, nip11CachedRetriever = Amethyst.instance.nip11Cache, + modifier = HorzHalfVertPadding, index = index, dragState = dragState, accountViewModel = accountViewModel, @@ -87,9 +94,27 @@ fun LazyListScope.renderLocalItems( } item { + Spacer(modifier = StdVertSpacer) + if (feedState.isNotEmpty()) { + SettingsRow( + R.string.send_kind0_to_local_relay_title, + R.string.send_kind0_to_local_relay_description, + SettingsCategorySpacingWithHorzBorderModifier, + ) { + val checked by accountViewModel.account.settings.syncedSettings.security.sendKind0EventsToLocalRelay + .collectAsStateWithLifecycle() + Switch( + checked = checked, + onCheckedChange = { + accountViewModel.toggleSendKind0ToLocalRelay(it) + }, + ) + } + } Spacer(modifier = StdVertSpacer) RelayUrlEditField( onNewRelay = { postViewModel.addRelay(relaySetupInfoBuilder(it)) }, + modifier = HorzPadding, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/nip37/PrivateOutboxRelayListView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/nip37/PrivateOutboxRelayListView.kt index bda9095aa..36cf2c11e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/nip37/PrivateOutboxRelayListView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/nip37/PrivateOutboxRelayListView.kt @@ -41,6 +41,8 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.RelayUrlEditF import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.relaySetupInfoBuilder import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.rememberRelayDragState import com.vitorpamplona.amethyst.ui.theme.FeedPadding +import com.vitorpamplona.amethyst.ui.theme.HorzHalfVertPadding +import com.vitorpamplona.amethyst.ui.theme.HorzPadding import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl @@ -82,6 +84,7 @@ fun LazyListScope.renderPrivateOutboxItems( item, onDelete = { postViewModel.deleteRelay(item) }, nip11CachedRetriever = Amethyst.instance.nip11Cache, + modifier = HorzHalfVertPadding, countResult = countResults[item.relay], index = index, dragState = dragState, @@ -94,6 +97,7 @@ fun LazyListScope.renderPrivateOutboxItems( Spacer(modifier = StdVertSpacer) RelayUrlEditField( onNewRelay = { postViewModel.addRelay(relaySetupInfoBuilder(it)) }, + modifier = HorzPadding, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/nip65/Nip65RelayListView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/nip65/Nip65RelayListView.kt index 614ac571b..649af7718 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/nip65/Nip65RelayListView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/nip65/Nip65RelayListView.kt @@ -41,6 +41,8 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.RelayUrlEditF import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.relaySetupInfoBuilder import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.rememberRelayDragState import com.vitorpamplona.amethyst.ui.theme.FeedPadding +import com.vitorpamplona.amethyst.ui.theme.HorzHalfVertPadding +import com.vitorpamplona.amethyst.ui.theme.HorzPadding import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl @@ -141,6 +143,7 @@ fun LazyListScope.renderNip65HomeItems( item, onDelete = { postViewModel.deleteHomeRelay(item) }, nip11CachedRetriever = Amethyst.instance.nip11Cache, + modifier = HorzHalfVertPadding, countResult = countResults[item.relay], index = index, dragState = dragState, @@ -153,6 +156,7 @@ fun LazyListScope.renderNip65HomeItems( Spacer(modifier = StdVertSpacer) RelayUrlEditField( onNewRelay = { postViewModel.addHomeRelay(relaySetupInfoBuilder(it)) }, + modifier = HorzPadding, accountViewModel = accountViewModel, nav = nav, ) @@ -172,6 +176,7 @@ fun LazyListScope.renderNip65NotifItems( item, onDelete = { postViewModel.deleteNotifRelay(item) }, nip11CachedRetriever = Amethyst.instance.nip11Cache, + modifier = HorzHalfVertPadding, countResult = countResults[item.relay], index = index, dragState = dragState, @@ -184,6 +189,7 @@ fun LazyListScope.renderNip65NotifItems( Spacer(modifier = StdVertSpacer) RelayUrlEditField( onNewRelay = { postViewModel.addNotifRelay(relaySetupInfoBuilder(it)) }, + modifier = HorzPadding, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/proxy/ProxyRelayListView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/proxy/ProxyRelayListView.kt index 1a51e601b..e0a661aab 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/proxy/ProxyRelayListView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/proxy/ProxyRelayListView.kt @@ -41,6 +41,8 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.RelayUrlEditF import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.relaySetupInfoBuilder import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.rememberRelayDragState import com.vitorpamplona.amethyst.ui.theme.FeedPadding +import com.vitorpamplona.amethyst.ui.theme.HorzHalfVertPadding +import com.vitorpamplona.amethyst.ui.theme.HorzPadding import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl @@ -82,6 +84,7 @@ fun LazyListScope.renderProxyItems( item, onDelete = { postViewModel.deleteRelay(item) }, nip11CachedRetriever = Amethyst.instance.nip11Cache, + modifier = HorzHalfVertPadding, countResult = countResults[item.relay], index = index, dragState = dragState, @@ -94,6 +97,7 @@ fun LazyListScope.renderProxyItems( Spacer(modifier = StdVertSpacer) RelayUrlEditField( onNewRelay = { postViewModel.addRelay(relaySetupInfoBuilder(it)) }, + modifier = HorzPadding, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/search/SearchRelayListView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/search/SearchRelayListView.kt index 21e69fa22..27e12173c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/search/SearchRelayListView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/search/SearchRelayListView.kt @@ -41,6 +41,8 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.RelayUrlEditF import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.relaySetupInfoBuilder import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.rememberRelayDragState import com.vitorpamplona.amethyst.ui.theme.FeedPadding +import com.vitorpamplona.amethyst.ui.theme.HorzHalfVertPadding +import com.vitorpamplona.amethyst.ui.theme.HorzPadding import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl @@ -82,6 +84,7 @@ fun LazyListScope.renderSearchItems( item, onDelete = { postViewModel.deleteRelay(item) }, nip11CachedRetriever = Amethyst.instance.nip11Cache, + modifier = HorzHalfVertPadding, countResult = countResults[item.relay], index = index, dragState = dragState, @@ -94,6 +97,7 @@ fun LazyListScope.renderSearchItems( Spacer(modifier = StdVertSpacer) RelayUrlEditField( onNewRelay = { postViewModel.addRelay(relaySetupInfoBuilder(it)) }, + modifier = HorzPadding, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/trusted/TrustedRelayListView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/trusted/TrustedRelayListView.kt index 39831648b..317708226 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/trusted/TrustedRelayListView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/trusted/TrustedRelayListView.kt @@ -40,6 +40,8 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.RelayUrlEditF import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.relaySetupInfoBuilder import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.rememberRelayDragState import com.vitorpamplona.amethyst.ui.theme.FeedPadding +import com.vitorpamplona.amethyst.ui.theme.HorzHalfVertPadding +import com.vitorpamplona.amethyst.ui.theme.HorzPadding import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer @Composable @@ -79,6 +81,7 @@ fun LazyListScope.renderTrustedItems( item, onDelete = { postViewModel.deleteRelay(item) }, nip11CachedRetriever = Amethyst.instance.nip11Cache, + modifier = HorzHalfVertPadding, index = index, dragState = dragState, accountViewModel = accountViewModel, @@ -90,6 +93,7 @@ fun LazyListScope.renderTrustedItems( Spacer(modifier = StdVertSpacer) RelayUrlEditField( onNewRelay = { postViewModel.addRelay(relaySetupInfoBuilder(it)) }, + modifier = HorzPadding, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/vanish/RequestToVanishScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/vanish/RequestToVanishScreen.kt index 988531be4..a37dd09d9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/vanish/RequestToVanishScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/vanish/RequestToVanishScreen.kt @@ -82,6 +82,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.RelayUrlEditF import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.relaySetupInfoBuilder import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.DividerThickness +import com.vitorpamplona.amethyst.ui.theme.HorzHalfVertPadding import com.vitorpamplona.amethyst.ui.theme.ThemeComparisonColumn import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.displayUrl @@ -208,6 +209,7 @@ fun RequestToVanishScreen( BasicRelaySetupInfoDialog( info, onDelete = { selectedRelayUrls -= selectedRelayUrls }, + modifier = HorzHalfVertPadding, nip11CachedRetriever = nip11CachedRetriever, accountViewModel = accountViewModel, nav = nav, @@ -221,6 +223,7 @@ fun RequestToVanishScreen( allRelaysSelected = false }, nip11CachedRetriever = nip11CachedRetriever, + modifier = Modifier, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/AppSettingsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/AppSettingsScreen.kt index 39bb49260..fc799a4a0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/AppSettingsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/AppSettingsScreen.kt @@ -389,11 +389,12 @@ fun SettingsRow( fun SettingsRow( name: Int, description: Int, + modifier: Modifier = Modifier.fillMaxWidth(), content: @Composable () -> Unit, ) { Row( verticalAlignment = Alignment.CenterVertically, - modifier = Modifier.fillMaxWidth(), + modifier = modifier, horizontalArrangement = Arrangement.spacedBy(5.dp), ) { Column( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt index 7492eab70..3096570b8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt @@ -345,6 +345,9 @@ val PostKeyboard = val SettingsCategoryFirstModifier = Modifier.padding(bottom = 8.dp) val SettingsCategorySpacingModifier = Modifier.padding(top = 24.dp, bottom = 8.dp) +val SettingsCategoryFirstWithHorzBorderModifier = Modifier.padding(bottom = 8.dp, start = 10.dp, end = 10.dp) +val SettingsCategorySpacingWithHorzBorderModifier = Modifier.padding(top = 24.dp, bottom = 8.dp, start = 10.dp, end = 10.dp) + val SquaredQuoteBorderModifier = Modifier.aspectRatio(1f).clip(shape = QuoteBorder) val FillWidthQuoteBorderModifier = Modifier.fillMaxWidth().clip(shape = QuoteBorder)