Slight performance improvements
This commit is contained in:
@@ -134,8 +134,6 @@ object LocalPreferences {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
println("AAA migrated: $migrated")
|
|
||||||
|
|
||||||
_savedAccounts = migrated
|
_savedAccounts = migrated
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.vitorpamplona.amethyst.ui.actions
|
|||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.defaultMinSize
|
import androidx.compose.foundation.layout.defaultMinSize
|
||||||
@@ -64,6 +63,8 @@ import com.vitorpamplona.amethyst.ui.note.SearchIcon
|
|||||||
import com.vitorpamplona.amethyst.ui.note.UsernameDisplay
|
import com.vitorpamplona.amethyst.ui.note.UsernameDisplay
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.SearchBarViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.SearchBarViewModel
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size20Modifier
|
import com.vitorpamplona.amethyst.ui.theme.Size20Modifier
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size55dp
|
import com.vitorpamplona.amethyst.ui.theme.Size55dp
|
||||||
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||||
@@ -313,10 +314,7 @@ private fun RenderSearchResults(
|
|||||||
) {
|
) {
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
modifier = Modifier.fillMaxHeight(),
|
modifier = Modifier.fillMaxHeight(),
|
||||||
contentPadding = PaddingValues(
|
contentPadding = FeedPadding,
|
||||||
top = 10.dp,
|
|
||||||
bottom = 10.dp
|
|
||||||
),
|
|
||||||
state = listState
|
state = listState
|
||||||
) {
|
) {
|
||||||
itemsIndexed(
|
itemsIndexed(
|
||||||
@@ -411,7 +409,7 @@ fun UserComposeForChat(
|
|||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
modifier = Modifier.padding(top = 10.dp),
|
modifier = Modifier.padding(top = 10.dp),
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import androidx.compose.foundation.clickable
|
|||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
@@ -67,6 +66,8 @@ import com.vitorpamplona.amethyst.service.relays.FeedType
|
|||||||
import com.vitorpamplona.amethyst.ui.note.RenderRelayIcon
|
import com.vitorpamplona.amethyst.ui.note.RenderRelayIcon
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Font14SP
|
import com.vitorpamplona.amethyst.ui.theme.Font14SP
|
||||||
import com.vitorpamplona.amethyst.ui.theme.HalfHorzPadding
|
import com.vitorpamplona.amethyst.ui.theme.HalfHorzPadding
|
||||||
import com.vitorpamplona.amethyst.ui.theme.HalfStartPadding
|
import com.vitorpamplona.amethyst.ui.theme.HalfStartPadding
|
||||||
@@ -154,10 +155,7 @@ fun NewRelayListView(onClose: () -> Unit, accountViewModel: AccountViewModel, re
|
|||||||
) {
|
) {
|
||||||
Row(modifier = Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically) {
|
Row(modifier = Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically) {
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
contentPadding = PaddingValues(
|
contentPadding = FeedPadding
|
||||||
top = 10.dp,
|
|
||||||
bottom = 10.dp
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
itemsIndexed(feedState, key = { _, item -> item.url }) { index, item ->
|
itemsIndexed(feedState, key = { _, item -> item.url }) { index, item ->
|
||||||
ServerConfig(
|
ServerConfig(
|
||||||
@@ -252,7 +250,7 @@ fun ServerConfigHeader() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -409,7 +407,7 @@ fun ServerConfigClickableLine(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import androidx.compose.foundation.ExperimentalFoundationApi
|
|||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
@@ -32,6 +31,7 @@ import com.vitorpamplona.amethyst.model.RelayInformation
|
|||||||
import com.vitorpamplona.amethyst.service.Nip11Retriever
|
import com.vitorpamplona.amethyst.service.Nip11Retriever
|
||||||
import com.vitorpamplona.amethyst.service.relays.Relay
|
import com.vitorpamplona.amethyst.service.relays.Relay
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
import kotlinx.collections.immutable.ImmutableList
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
import kotlinx.collections.immutable.toImmutableList
|
||||||
|
|
||||||
@@ -145,10 +145,7 @@ fun RelaySelectionDialog(
|
|||||||
)
|
)
|
||||||
|
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
contentPadding = PaddingValues(
|
contentPadding = FeedPadding
|
||||||
top = 10.dp,
|
|
||||||
bottom = 10.dp
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
itemsIndexed(
|
itemsIndexed(
|
||||||
relays,
|
relays,
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,6 @@ package com.vitorpamplona.amethyst.ui.components
|
|||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
@@ -27,6 +26,7 @@ import com.vitorpamplona.amethyst.R
|
|||||||
import com.vitorpamplona.amethyst.ui.note.getGradient
|
import com.vitorpamplona.amethyst.ui.note.getGradient
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.ButtonPadding
|
||||||
import com.vitorpamplona.amethyst.ui.theme.secondaryButtonBackground
|
import com.vitorpamplona.amethyst.ui.theme.secondaryButtonBackground
|
||||||
import com.vitorpamplona.quartz.events.ImmutableListOfLists
|
import com.vitorpamplona.quartz.events.ImmutableListOfLists
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ fun ShowMoreButton(onClick: () -> Unit) {
|
|||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
containerColor = MaterialTheme.colorScheme.secondaryButtonBackground
|
containerColor = MaterialTheme.colorScheme.secondaryButtonBackground
|
||||||
),
|
),
|
||||||
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)
|
contentPadding = ButtonPadding
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(R.string.show_more), color = Color.White)
|
Text(text = stringResource(R.string.show_more), color = Color.White)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import androidx.compose.animation.Crossfade
|
|||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
@@ -37,6 +36,7 @@ import com.vitorpamplona.amethyst.R
|
|||||||
import com.vitorpamplona.amethyst.model.Note
|
import com.vitorpamplona.amethyst.model.Note
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.ButtonPadding
|
||||||
import com.vitorpamplona.quartz.events.EventInterface
|
import com.vitorpamplona.quartz.events.EventInterface
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -143,7 +143,7 @@ fun ContentWarningNote(onDismiss: () -> Unit) {
|
|||||||
.buttonColors(
|
.buttonColors(
|
||||||
containerColor = MaterialTheme.colorScheme.primary
|
containerColor = MaterialTheme.colorScheme.primary
|
||||||
),
|
),
|
||||||
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)
|
contentPadding = ButtonPadding
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.show_anyway),
|
text = stringResource(R.string.show_anyway),
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import androidx.compose.ui.graphics.Color
|
|||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.window.Dialog
|
import androidx.compose.ui.window.Dialog
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Font14SP
|
import com.vitorpamplona.amethyst.ui.theme.Font14SP
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
import kotlinx.collections.immutable.ImmutableList
|
||||||
|
|
||||||
@@ -143,7 +144,7 @@ fun <T> SpinnerSelectionDialog(
|
|||||||
fontWeight = FontWeight.Bold
|
fontWeight = FontWeight.Bold
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Divider(color = Color.LightGray, thickness = 0.25.dp)
|
Divider(color = Color.LightGray, thickness = DividerThickness)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
itemsIndexed(options) { index, item ->
|
itemsIndexed(options) { index, item ->
|
||||||
@@ -160,7 +161,7 @@ fun <T> SpinnerSelectionDialog(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (index < options.lastIndex) {
|
if (index < options.lastIndex) {
|
||||||
Divider(color = Color.LightGray, thickness = 0.25.dp)
|
Divider(color = Color.LightGray, thickness = DividerThickness)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,14 +30,14 @@ import androidx.compose.ui.platform.LocalView
|
|||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import androidx.navigation.NavBackStackEntry
|
import androidx.navigation.NavBackStackEntry
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.theme.BottomTopHeight
|
import com.vitorpamplona.amethyst.ui.theme.BottomTopHeight
|
||||||
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.Font12SP
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size0dp
|
import com.vitorpamplona.amethyst.ui.theme.Size0dp
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.Size10Modifier
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size10dp
|
import com.vitorpamplona.amethyst.ui.theme.Size10dp
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
|
|
||||||
@@ -86,9 +86,18 @@ fun keyboardAsState(): State<Keyboard> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AppBottomBar(accountViewModel: AccountViewModel, navEntryState: State<NavBackStackEntry?>, nav: (Route, Boolean) -> Unit) {
|
fun IfKeyboardClosed(
|
||||||
|
inner: @Composable () -> Unit
|
||||||
|
) {
|
||||||
val isKeyboardOpen by keyboardAsState()
|
val isKeyboardOpen by keyboardAsState()
|
||||||
if (isKeyboardOpen == Keyboard.Closed) {
|
if (isKeyboardOpen == Keyboard.Closed) {
|
||||||
|
inner()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun AppBottomBar(accountViewModel: AccountViewModel, navEntryState: State<NavBackStackEntry?>, nav: (Route, Boolean) -> Unit) {
|
||||||
|
IfKeyboardClosed {
|
||||||
RenderBottomMenu(accountViewModel, navEntryState, nav)
|
RenderBottomMenu(accountViewModel, navEntryState, nav)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,30 +133,30 @@ private fun RowScope.HasNewItemsIcon(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val size = remember {
|
|
||||||
if ("Home" == route.base) 25.dp else 23.dp
|
|
||||||
}
|
|
||||||
val iconSize = remember {
|
|
||||||
if ("Home" == route.base) 24.dp else 20.dp
|
|
||||||
}
|
|
||||||
|
|
||||||
NavigationBarItem(
|
NavigationBarItem(
|
||||||
icon = {
|
icon = {
|
||||||
val hasNewItems = accountViewModel.notificationDots.hasNewItems[route]?.collectAsStateWithLifecycle()
|
ObserveNewItems(route, accountViewModel) { hasNewItems ->
|
||||||
|
NotifiableIcon(
|
||||||
NotifiableIcon(
|
route.icon,
|
||||||
route.icon,
|
route.notifSize,
|
||||||
size,
|
route.iconSize,
|
||||||
iconSize,
|
selected,
|
||||||
selected,
|
hasNewItems
|
||||||
hasNewItems
|
)
|
||||||
)
|
}
|
||||||
},
|
},
|
||||||
selected = selected,
|
selected = selected,
|
||||||
onClick = { nav(route, selected) }
|
onClick = { nav(route, selected) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ObserveNewItems(route: Route, accountViewModel: AccountViewModel, inner: @Composable (hasNewItems: State<Boolean>?) -> Unit) {
|
||||||
|
val hasNewItems = accountViewModel.notificationDots.hasNewItems[route]?.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
|
inner(hasNewItems)
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun NotifiableIcon(
|
private fun NotifiableIcon(
|
||||||
icon: Int,
|
icon: Int,
|
||||||
@@ -177,9 +186,7 @@ private fun NotificationDotIcon(modifier: Modifier) {
|
|||||||
Box(modifier.size(Size10dp)) {
|
Box(modifier.size(Size10dp)) {
|
||||||
Box(
|
Box(
|
||||||
modifier = remember {
|
modifier = remember {
|
||||||
Modifier
|
Size10Modifier.clip(shape = CircleShape)
|
||||||
.size(Size10dp)
|
|
||||||
.clip(shape = CircleShape)
|
|
||||||
}.background(MaterialTheme.colorScheme.primary),
|
}.background(MaterialTheme.colorScheme.primary),
|
||||||
contentAlignment = Alignment.TopEnd
|
contentAlignment = Alignment.TopEnd
|
||||||
) {
|
) {
|
||||||
@@ -187,7 +194,7 @@ private fun NotificationDotIcon(modifier: Modifier) {
|
|||||||
"",
|
"",
|
||||||
color = Color.White,
|
color = Color.White,
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
fontSize = 12.sp,
|
fontSize = Font12SP,
|
||||||
modifier = remember {
|
modifier = remember {
|
||||||
Modifier
|
Modifier
|
||||||
.wrapContentHeight()
|
.wrapContentHeight()
|
||||||
|
|||||||
@@ -813,7 +813,7 @@ fun TopBarWithBackButton(caption: String, popBack: () -> Unit) {
|
|||||||
},
|
},
|
||||||
actions = {}
|
actions = {}
|
||||||
)
|
)
|
||||||
Divider(thickness = 0.25.dp)
|
Divider(thickness = DividerThickness)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -835,7 +835,7 @@ fun FlexibleTopBarWithBackButton(
|
|||||||
actions = {}
|
actions = {}
|
||||||
)
|
)
|
||||||
Spacer(modifier = HalfVertSpacer)
|
Spacer(modifier = HalfVertSpacer)
|
||||||
Divider(thickness = 0.25.dp)
|
Divider(thickness = DividerThickness)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ import com.vitorpamplona.amethyst.ui.note.LoadStatuses
|
|||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountBackupDialog
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountBackupDialog
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.ConnectOrbotDialog
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.ConnectOrbotDialog
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
import com.vitorpamplona.amethyst.ui.theme.DoubleHorzSpacer
|
import com.vitorpamplona.amethyst.ui.theme.DoubleHorzSpacer
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size10dp
|
import com.vitorpamplona.amethyst.ui.theme.Size10dp
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size16dp
|
import com.vitorpamplona.amethyst.ui.theme.Size16dp
|
||||||
@@ -114,7 +115,7 @@ fun DrawerContent(
|
|||||||
nav
|
nav
|
||||||
)
|
)
|
||||||
Divider(
|
Divider(
|
||||||
thickness = 0.25.dp,
|
thickness = DividerThickness,
|
||||||
modifier = Modifier.padding(top = 20.dp)
|
modifier = Modifier.padding(top = 20.dp)
|
||||||
)
|
)
|
||||||
ListContent(
|
ListContent(
|
||||||
@@ -761,7 +762,7 @@ fun BottomContent(user: User, drawerState: DrawerState, loadProfilePicture: Bool
|
|||||||
Column(modifier = Modifier) {
|
Column(modifier = Modifier) {
|
||||||
Divider(
|
Divider(
|
||||||
modifier = Modifier.padding(top = 15.dp),
|
modifier = Modifier.padding(top = 15.dp),
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.runtime.Immutable
|
import androidx.compose.runtime.Immutable
|
||||||
import androidx.compose.runtime.State
|
import androidx.compose.runtime.State
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.navigation.NamedNavArgument
|
import androidx.navigation.NamedNavArgument
|
||||||
import androidx.navigation.NavBackStackEntry
|
import androidx.navigation.NavBackStackEntry
|
||||||
import androidx.navigation.NavDestination
|
import androidx.navigation.NavDestination
|
||||||
@@ -21,6 +22,10 @@ import com.vitorpamplona.amethyst.ui.dal.ChatroomListKnownFeedFilter
|
|||||||
import com.vitorpamplona.amethyst.ui.dal.DiscoverLiveNowFeedFilter
|
import com.vitorpamplona.amethyst.ui.dal.DiscoverLiveNowFeedFilter
|
||||||
import com.vitorpamplona.amethyst.ui.dal.HomeNewThreadFeedFilter
|
import com.vitorpamplona.amethyst.ui.dal.HomeNewThreadFeedFilter
|
||||||
import com.vitorpamplona.amethyst.ui.dal.NotificationFeedFilter
|
import com.vitorpamplona.amethyst.ui.dal.NotificationFeedFilter
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.Size20dp
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.Size23dp
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.Size24dp
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.Size25dp
|
||||||
import com.vitorpamplona.quartz.events.ChatroomKeyable
|
import com.vitorpamplona.quartz.events.ChatroomKeyable
|
||||||
import com.vitorpamplona.quartz.events.LiveActivitiesEvent
|
import com.vitorpamplona.quartz.events.LiveActivitiesEvent
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
import kotlinx.collections.immutable.ImmutableList
|
||||||
@@ -30,16 +35,18 @@ import kotlinx.collections.immutable.toImmutableList
|
|||||||
@Immutable
|
@Immutable
|
||||||
sealed class Route(
|
sealed class Route(
|
||||||
val route: String,
|
val route: String,
|
||||||
|
val base: String = route.substringBefore("?"),
|
||||||
val icon: Int,
|
val icon: Int,
|
||||||
|
val notifSize: Dp = Size23dp,
|
||||||
|
val iconSize: Dp = Size20dp,
|
||||||
val hasNewItems: (Account, Set<com.vitorpamplona.amethyst.model.Note>) -> Boolean = { _, _ -> false },
|
val hasNewItems: (Account, Set<com.vitorpamplona.amethyst.model.Note>) -> Boolean = { _, _ -> false },
|
||||||
val arguments: ImmutableList<NamedNavArgument> = persistentListOf()
|
val arguments: ImmutableList<NamedNavArgument> = persistentListOf()
|
||||||
) {
|
) {
|
||||||
val base: String
|
|
||||||
get() = route.substringBefore("?")
|
|
||||||
|
|
||||||
object Home : Route(
|
object Home : Route(
|
||||||
route = "Home?nip47={nip47}",
|
route = "Home?nip47={nip47}",
|
||||||
icon = R.drawable.ic_home,
|
icon = R.drawable.ic_home,
|
||||||
|
notifSize = Size25dp,
|
||||||
|
iconSize = Size24dp,
|
||||||
arguments = listOf(
|
arguments = listOf(
|
||||||
navArgument("nip47") { type = NavType.StringType; nullable = true; defaultValue = null }
|
navArgument("nip47") { type = NavType.StringType; nullable = true; defaultValue = null }
|
||||||
).toImmutableList(),
|
).toImmutableList(),
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import androidx.compose.ui.unit.dp
|
|||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
import com.vitorpamplona.amethyst.ui.screen.BadgeCard
|
import com.vitorpamplona.amethyst.ui.screen.BadgeCard
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
import com.vitorpamplona.amethyst.ui.theme.newItemBackgroundColor
|
import com.vitorpamplona.amethyst.ui.theme.newItemBackgroundColor
|
||||||
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -161,7 +162,7 @@ fun BadgeCompose(likeSetCard: BadgeCard, isInnerNote: Boolean = false, routeForL
|
|||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
modifier = Modifier.padding(top = 10.dp),
|
modifier = Modifier.padding(top = 10.dp),
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import androidx.compose.foundation.layout.Arrangement
|
|||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||||
import androidx.compose.foundation.layout.FlowRow
|
import androidx.compose.foundation.layout.FlowRow
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
@@ -22,6 +21,8 @@ import com.vitorpamplona.amethyst.R
|
|||||||
import com.vitorpamplona.amethyst.model.Note
|
import com.vitorpamplona.amethyst.model.Note
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.ButtonPadding
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size35dp
|
import com.vitorpamplona.amethyst.ui.theme.Size35dp
|
||||||
import kotlinx.collections.immutable.ImmutableSet
|
import kotlinx.collections.immutable.ImmutableSet
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ fun BlankNote(modifier: Modifier = Modifier, showDivider: Boolean = false, idHex
|
|||||||
if (!showDivider) {
|
if (!showDivider) {
|
||||||
Divider(
|
Divider(
|
||||||
modifier = Modifier.padding(vertical = 10.dp),
|
modifier = Modifier.padding(vertical = 10.dp),
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,7 +111,7 @@ fun HiddenNote(
|
|||||||
.buttonColors(
|
.buttonColors(
|
||||||
contentColor = MaterialTheme.colorScheme.primary
|
contentColor = MaterialTheme.colorScheme.primary
|
||||||
),
|
),
|
||||||
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)
|
contentPadding = ButtonPadding
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(R.string.show_anyway), color = Color.White)
|
Text(text = stringResource(R.string.show_anyway), color = Color.White)
|
||||||
}
|
}
|
||||||
@@ -118,7 +119,7 @@ fun HiddenNote(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -581,7 +581,7 @@ fun CommunityHeader(
|
|||||||
|
|
||||||
if (showBottomDiviser) {
|
if (showBottomDiviser) {
|
||||||
Divider(
|
Divider(
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.vitorpamplona.amethyst.ui.note
|
package com.vitorpamplona.amethyst.ui.note
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
@@ -27,6 +26,8 @@ import com.vitorpamplona.amethyst.R
|
|||||||
import com.vitorpamplona.amethyst.model.RelayInfo
|
import com.vitorpamplona.amethyst.model.RelayInfo
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.ButtonPadding
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.time.ZoneId
|
import java.time.ZoneId
|
||||||
@@ -86,7 +87,7 @@ fun RelayCompose(
|
|||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
modifier = Modifier.padding(top = 10.dp),
|
modifier = Modifier.padding(top = 10.dp),
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,7 +121,7 @@ fun AddRelayButton(onClick: () -> Unit) {
|
|||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
containerColor = MaterialTheme.colorScheme.primary
|
containerColor = MaterialTheme.colorScheme.primary
|
||||||
),
|
),
|
||||||
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)
|
contentPadding = ButtonPadding
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(id = R.string.add), color = Color.White)
|
Text(text = stringResource(id = R.string.add), color = Color.White)
|
||||||
}
|
}
|
||||||
@@ -135,7 +136,7 @@ fun RemoveRelayButton(onClick: () -> Unit) {
|
|||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
containerColor = MaterialTheme.colorScheme.primary
|
containerColor = MaterialTheme.colorScheme.primary
|
||||||
),
|
),
|
||||||
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)
|
contentPadding = ButtonPadding
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(R.string.remove), color = Color.White)
|
Text(text = stringResource(R.string.remove), color = Color.White)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.TextSpinner
|
|||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.TitleExplainer
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.TitleExplainer
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.getFragmentActivity
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.getFragmentActivity
|
||||||
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Font14SP
|
import com.vitorpamplona.amethyst.ui.theme.Font14SP
|
||||||
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||||
import com.vitorpamplona.quartz.encoders.decodePublicKey
|
import com.vitorpamplona.quartz.encoders.decodePublicKey
|
||||||
@@ -376,7 +377,7 @@ fun UpdateZapAmountDialog(
|
|||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
modifier = Modifier.padding(vertical = 10.dp),
|
modifier = Modifier.padding(vertical = 10.dp),
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
|
|
||||||
var qrScanning by remember { mutableStateOf(false) }
|
var qrScanning by remember { mutableStateOf(false) }
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.vitorpamplona.amethyst.model.User
|
import com.vitorpamplona.amethyst.model.User
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size55dp
|
import com.vitorpamplona.amethyst.ui.theme.Size55dp
|
||||||
import com.vitorpamplona.amethyst.ui.theme.StdPadding
|
import com.vitorpamplona.amethyst.ui.theme.StdPadding
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ fun UserCompose(
|
|||||||
|
|
||||||
if (showDiviser) {
|
if (showDiviser) {
|
||||||
Divider(
|
Divider(
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.UnfollowButton
|
|||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.WatchIsHiddenUser
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.WatchIsHiddenUser
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.showAmountAxis
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.showAmountAxis
|
||||||
import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange
|
import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size55dp
|
import com.vitorpamplona.amethyst.ui.theme.Size55dp
|
||||||
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||||
import com.vitorpamplona.quartz.events.LnZapEvent
|
import com.vitorpamplona.quartz.events.LnZapEvent
|
||||||
@@ -76,7 +77,7 @@ fun ZapNoteCompose(baseReqResponse: ZapReqResponse, accountViewModel: AccountVie
|
|||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
modifier = Modifier.padding(top = 10.dp),
|
modifier = Modifier.padding(top = 10.dp),
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.vitorpamplona.amethyst.ui.screen
|
|||||||
|
|
||||||
import androidx.compose.animation.Crossfade
|
import androidx.compose.animation.Crossfade
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
@@ -17,11 +16,11 @@ import androidx.compose.runtime.remember
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.vitorpamplona.amethyst.model.Note
|
import com.vitorpamplona.amethyst.model.Note
|
||||||
import com.vitorpamplona.amethyst.ui.note.ChatroomMessageCompose
|
import com.vitorpamplona.amethyst.ui.note.ChatroomMessageCompose
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Font14SP
|
import com.vitorpamplona.amethyst.ui.theme.Font14SP
|
||||||
import com.vitorpamplona.amethyst.ui.theme.HalfPadding
|
import com.vitorpamplona.amethyst.ui.theme.HalfPadding
|
||||||
|
|
||||||
@@ -91,10 +90,7 @@ fun ChatroomFeedLoaded(
|
|||||||
}
|
}
|
||||||
|
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
contentPadding = PaddingValues(
|
contentPadding = FeedPadding,
|
||||||
top = 10.dp,
|
|
||||||
bottom = 10.dp
|
|
||||||
),
|
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
reverseLayout = true,
|
reverseLayout = true,
|
||||||
state = listState
|
state = listState
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.vitorpamplona.amethyst.ui.screen
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.compose.animation.Crossfade
|
import androidx.compose.animation.Crossfade
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
@@ -14,10 +13,10 @@ import androidx.compose.runtime.LaunchedEffect
|
|||||||
import androidx.compose.runtime.MutableState
|
import androidx.compose.runtime.MutableState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.vitorpamplona.amethyst.ui.note.ChatroomHeaderCompose
|
import com.vitorpamplona.amethyst.ui.note.ChatroomHeaderCompose
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||||
import kotlin.time.ExperimentalTime
|
import kotlin.time.ExperimentalTime
|
||||||
import kotlin.time.measureTimedValue
|
import kotlin.time.measureTimedValue
|
||||||
|
|
||||||
@@ -89,10 +88,7 @@ private fun FeedLoaded(
|
|||||||
}
|
}
|
||||||
|
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
contentPadding = PaddingValues(
|
contentPadding = FeedPadding,
|
||||||
top = 10.dp,
|
|
||||||
bottom = 10.dp
|
|
||||||
),
|
|
||||||
state = listState
|
state = listState
|
||||||
) {
|
) {
|
||||||
itemsIndexed(
|
itemsIndexed(
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import androidx.compose.foundation.ExperimentalFoundationApi
|
|||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
@@ -31,11 +30,11 @@ import androidx.compose.runtime.setValue
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
import com.vitorpamplona.amethyst.ui.note.NoteCompose
|
import com.vitorpamplona.amethyst.ui.note.NoteCompose
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||||
import kotlin.time.ExperimentalTime
|
import kotlin.time.ExperimentalTime
|
||||||
import kotlin.time.measureTimedValue
|
import kotlin.time.measureTimedValue
|
||||||
|
|
||||||
@@ -65,16 +64,14 @@ fun RefresheableView(
|
|||||||
|
|
||||||
val modifier = remember {
|
val modifier = remember {
|
||||||
if (enablePullRefresh) {
|
if (enablePullRefresh) {
|
||||||
Modifier.pullRefresh(pullRefreshState)
|
Modifier.fillMaxSize().pullRefresh(pullRefreshState)
|
||||||
} else {
|
} else {
|
||||||
Modifier
|
Modifier.fillMaxSize()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Box(modifier) {
|
Box(modifier) {
|
||||||
Column(Modifier.fillMaxSize()) {
|
content()
|
||||||
content()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (enablePullRefresh) {
|
if (enablePullRefresh) {
|
||||||
PullRefreshIndicator(
|
PullRefreshIndicator(
|
||||||
@@ -191,10 +188,7 @@ private fun FeedLoaded(
|
|||||||
}
|
}
|
||||||
|
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
contentPadding = PaddingValues(
|
contentPadding = FeedPadding,
|
||||||
top = 10.dp,
|
|
||||||
bottom = 10.dp
|
|
||||||
),
|
|
||||||
state = listState
|
state = listState
|
||||||
) {
|
) {
|
||||||
itemsIndexed(state.feed.value, key = { _, item -> item.idHex }) { _, item ->
|
itemsIndexed(state.feed.value, key = { _, item -> item.idHex }) { _, item ->
|
||||||
|
|||||||
@@ -2,16 +2,15 @@ package com.vitorpamplona.amethyst.ui.screen
|
|||||||
|
|
||||||
import androidx.compose.animation.Crossfade
|
import androidx.compose.animation.Crossfade
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.itemsIndexed
|
import androidx.compose.foundation.lazy.itemsIndexed
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.vitorpamplona.amethyst.ui.note.ZapNoteCompose
|
import com.vitorpamplona.amethyst.ui.note.ZapNoteCompose
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LnZapFeedView(
|
fun LnZapFeedView(
|
||||||
@@ -52,10 +51,7 @@ private fun LnZapFeedLoaded(
|
|||||||
val listState = rememberLazyListState()
|
val listState = rememberLazyListState()
|
||||||
|
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
contentPadding = PaddingValues(
|
contentPadding = FeedPadding,
|
||||||
top = 10.dp,
|
|
||||||
bottom = 10.dp
|
|
||||||
),
|
|
||||||
state = listState
|
state = listState
|
||||||
) {
|
) {
|
||||||
itemsIndexed(state.feed.value, key = { _, item -> item.zapEvent.idHex }) { _, item ->
|
itemsIndexed(state.feed.value, key = { _, item -> item.zapEvent.idHex }) { _, item ->
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.vitorpamplona.amethyst.ui.screen
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.itemsIndexed
|
import androidx.compose.foundation.lazy.itemsIndexed
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
@@ -18,7 +17,6 @@ import androidx.compose.runtime.remember
|
|||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
@@ -29,6 +27,7 @@ import com.vitorpamplona.amethyst.ui.actions.NewRelayListView
|
|||||||
import com.vitorpamplona.amethyst.ui.components.BundledUpdate
|
import com.vitorpamplona.amethyst.ui.components.BundledUpdate
|
||||||
import com.vitorpamplona.amethyst.ui.note.RelayCompose
|
import com.vitorpamplona.amethyst.ui.note.RelayCompose
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
@@ -137,10 +136,7 @@ fun RelayFeedView(
|
|||||||
val listState = rememberLazyListState()
|
val listState = rememberLazyListState()
|
||||||
|
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
contentPadding = PaddingValues(
|
contentPadding = FeedPadding,
|
||||||
top = 10.dp,
|
|
||||||
bottom = 10.dp
|
|
||||||
),
|
|
||||||
state = listState
|
state = listState
|
||||||
) {
|
) {
|
||||||
itemsIndexed(feedState, key = { _, item -> item.url }) { _, item ->
|
itemsIndexed(feedState, key = { _, item -> item.url }) { _, item ->
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import androidx.compose.animation.Crossfade
|
|||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.itemsIndexed
|
import androidx.compose.foundation.lazy.itemsIndexed
|
||||||
@@ -16,9 +15,9 @@ import androidx.compose.runtime.getValue
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun RefreshingFeedStringFeedView(
|
fun RefreshingFeedStringFeedView(
|
||||||
@@ -99,10 +98,7 @@ private fun FeedLoaded(
|
|||||||
val listState = rememberLazyListState()
|
val listState = rememberLazyListState()
|
||||||
|
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
contentPadding = PaddingValues(
|
contentPadding = FeedPadding,
|
||||||
top = 10.dp,
|
|
||||||
bottom = 10.dp
|
|
||||||
),
|
|
||||||
state = listState
|
state = listState
|
||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import androidx.compose.foundation.clickable
|
|||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
@@ -91,7 +90,9 @@ import com.vitorpamplona.amethyst.ui.note.Reward
|
|||||||
import com.vitorpamplona.amethyst.ui.note.timeAgo
|
import com.vitorpamplona.amethyst.ui.note.timeAgo
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.ChannelHeader
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.ChannelHeader
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
import com.vitorpamplona.amethyst.ui.theme.DoubleVertSpacer
|
import com.vitorpamplona.amethyst.ui.theme.DoubleVertSpacer
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||||
import com.vitorpamplona.amethyst.ui.theme.SmallBorder
|
import com.vitorpamplona.amethyst.ui.theme.SmallBorder
|
||||||
import com.vitorpamplona.amethyst.ui.theme.lessImportantLink
|
import com.vitorpamplona.amethyst.ui.theme.lessImportantLink
|
||||||
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||||
@@ -172,10 +173,7 @@ fun ThreadFeedView(noteId: String, viewModel: FeedViewModel, accountViewModel: A
|
|||||||
}
|
}
|
||||||
|
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
contentPadding = PaddingValues(
|
contentPadding = FeedPadding,
|
||||||
top = 10.dp,
|
|
||||||
bottom = 10.dp
|
|
||||||
),
|
|
||||||
state = listState
|
state = listState
|
||||||
) {
|
) {
|
||||||
itemsIndexed(state.feed.value, key = { _, item -> item.idHex }) { index, item ->
|
itemsIndexed(state.feed.value, key = { _, item -> item.idHex }) { index, item ->
|
||||||
@@ -507,7 +505,7 @@ fun NoteMaster(
|
|||||||
ReactionsRow(note, true, accountViewModel, nav)
|
ReactionsRow(note, true, accountViewModel, nav)
|
||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,15 @@ package com.vitorpamplona.amethyst.ui.screen
|
|||||||
|
|
||||||
import androidx.compose.animation.Crossfade
|
import androidx.compose.animation.Crossfade
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.itemsIndexed
|
import androidx.compose.foundation.lazy.itemsIndexed
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.vitorpamplona.amethyst.ui.note.UserCompose
|
import com.vitorpamplona.amethyst.ui.note.UserCompose
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun RefreshingFeedUserFeedView(
|
fun RefreshingFeedUserFeedView(
|
||||||
@@ -67,10 +66,7 @@ private fun FeedLoaded(
|
|||||||
val listState = rememberLazyListState()
|
val listState = rememberLazyListState()
|
||||||
|
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
contentPadding = PaddingValues(
|
contentPadding = FeedPadding,
|
||||||
top = 10.dp,
|
|
||||||
bottom = 10.dp
|
|
||||||
),
|
|
||||||
state = listState
|
state = listState
|
||||||
) {
|
) {
|
||||||
itemsIndexed(state.feed.value, key = { _, item -> item.pubkeyHex }) { _, item ->
|
itemsIndexed(state.feed.value, key = { _, item -> item.pubkeyHex }) { _, item ->
|
||||||
|
|||||||
+2
-2
@@ -10,7 +10,6 @@ import androidx.activity.result.contract.ActivityResultContracts
|
|||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
@@ -47,6 +46,7 @@ import com.vitorpamplona.amethyst.model.Account
|
|||||||
import com.vitorpamplona.amethyst.ui.actions.CloseButton
|
import com.vitorpamplona.amethyst.ui.actions.CloseButton
|
||||||
import com.vitorpamplona.amethyst.ui.note.authenticate
|
import com.vitorpamplona.amethyst.ui.note.authenticate
|
||||||
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.ButtonPadding
|
||||||
import com.vitorpamplona.quartz.encoders.toNsec
|
import com.vitorpamplona.quartz.encoders.toNsec
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -131,7 +131,7 @@ private fun NSecCopyButton(
|
|||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
containerColor = MaterialTheme.colorScheme.primary
|
containerColor = MaterialTheme.colorScheme.primary
|
||||||
),
|
),
|
||||||
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)
|
contentPadding = ButtonPadding
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
tint = MaterialTheme.colorScheme.onPrimary,
|
tint = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import androidx.compose.foundation.interaction.MutableInteractionSource
|
|||||||
import androidx.compose.foundation.interaction.collectIsFocusedAsState
|
import androidx.compose.foundation.interaction.collectIsFocusedAsState
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.defaultMinSize
|
import androidx.compose.foundation.layout.defaultMinSize
|
||||||
@@ -117,6 +116,8 @@ import com.vitorpamplona.amethyst.ui.screen.NostrChannelFeedViewModel
|
|||||||
import com.vitorpamplona.amethyst.ui.screen.RefreshingChatroomFeedView
|
import com.vitorpamplona.amethyst.ui.screen.RefreshingChatroomFeedView
|
||||||
import com.vitorpamplona.amethyst.ui.screen.equalImmutableLists
|
import com.vitorpamplona.amethyst.ui.screen.equalImmutableLists
|
||||||
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.ButtonPadding
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
import com.vitorpamplona.amethyst.ui.theme.DoubleHorzSpacer
|
import com.vitorpamplona.amethyst.ui.theme.DoubleHorzSpacer
|
||||||
import com.vitorpamplona.amethyst.ui.theme.DoubleVertSpacer
|
import com.vitorpamplona.amethyst.ui.theme.DoubleVertSpacer
|
||||||
import com.vitorpamplona.amethyst.ui.theme.EditFieldBorder
|
import com.vitorpamplona.amethyst.ui.theme.EditFieldBorder
|
||||||
@@ -616,7 +617,7 @@ fun ChannelHeader(
|
|||||||
|
|
||||||
if (showBottomDiviser) {
|
if (showBottomDiviser) {
|
||||||
Divider(
|
Divider(
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1139,7 +1140,7 @@ fun JoinChatButton(accountViewModel: AccountViewModel, channel: Channel, nav: (S
|
|||||||
accountViewModel.account.follow(channel)
|
accountViewModel.account.follow(channel)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)
|
contentPadding = ButtonPadding
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(R.string.join), color = Color.White)
|
Text(text = stringResource(R.string.join), color = Color.White)
|
||||||
}
|
}
|
||||||
@@ -1156,7 +1157,7 @@ fun LeaveChatButton(accountViewModel: AccountViewModel, channel: Channel, nav: (
|
|||||||
accountViewModel.account.unfollow(channel)
|
accountViewModel.account.unfollow(channel)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)
|
contentPadding = ButtonPadding
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(R.string.leave), color = Color.White)
|
Text(text = stringResource(R.string.leave), color = Color.White)
|
||||||
}
|
}
|
||||||
@@ -1177,7 +1178,7 @@ fun JoinCommunityButton(accountViewModel: AccountViewModel, note: AddressableNot
|
|||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
containerColor = MaterialTheme.colorScheme.primary
|
containerColor = MaterialTheme.colorScheme.primary
|
||||||
),
|
),
|
||||||
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)
|
contentPadding = ButtonPadding
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(R.string.join), color = Color.White)
|
Text(text = stringResource(R.string.join), color = Color.White)
|
||||||
}
|
}
|
||||||
@@ -1198,7 +1199,7 @@ fun LeaveCommunityButton(accountViewModel: AccountViewModel, note: AddressableNo
|
|||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
containerColor = MaterialTheme.colorScheme.primary
|
containerColor = MaterialTheme.colorScheme.primary
|
||||||
),
|
),
|
||||||
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)
|
contentPadding = ButtonPadding
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(R.string.leave), color = Color.White)
|
Text(text = stringResource(R.string.leave), color = Color.White)
|
||||||
}
|
}
|
||||||
|
|||||||
+49
-53
@@ -221,64 +221,60 @@ fun ChatroomListScreenOnlyList(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Box(Modifier.fillMaxSize()) {
|
Column(
|
||||||
Column(Modifier.fillMaxHeight()) {
|
modifier = Modifier.fillMaxHeight()
|
||||||
Column(
|
) {
|
||||||
modifier = Modifier.padding(vertical = 0.dp)
|
Box(Modifier.fillMaxWidth()) {
|
||||||
|
TabRow(
|
||||||
|
containerColor = MaterialTheme.colorScheme.background,
|
||||||
|
contentColor = MaterialTheme.colorScheme.onBackground,
|
||||||
|
selectedTabIndex = pagerState.currentPage,
|
||||||
|
modifier = TabRowHeight
|
||||||
) {
|
) {
|
||||||
Box(Modifier.fillMaxWidth()) {
|
tabs.forEachIndexed { index, tab ->
|
||||||
TabRow(
|
Tab(
|
||||||
containerColor = MaterialTheme.colorScheme.background,
|
selected = pagerState.currentPage == index,
|
||||||
contentColor = MaterialTheme.colorScheme.onBackground,
|
text = {
|
||||||
selectedTabIndex = pagerState.currentPage,
|
Text(text = stringResource(tab.resource))
|
||||||
modifier = TabRowHeight
|
},
|
||||||
) {
|
onClick = {
|
||||||
tabs.forEachIndexed { index, tab ->
|
coroutineScope.launch { pagerState.animateScrollToPage(index) }
|
||||||
Tab(
|
|
||||||
selected = pagerState.currentPage == index,
|
|
||||||
text = {
|
|
||||||
Text(text = stringResource(tab.resource))
|
|
||||||
},
|
|
||||||
onClick = {
|
|
||||||
coroutineScope.launch { pagerState.animateScrollToPage(index) }
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
IconButton(
|
|
||||||
modifier = Modifier
|
|
||||||
.size(40.dp)
|
|
||||||
.align(Alignment.CenterEnd),
|
|
||||||
onClick = { moreActionsExpanded = true }
|
|
||||||
) {
|
|
||||||
Icon(
|
|
||||||
imageVector = Icons.Default.MoreVert,
|
|
||||||
contentDescription = null,
|
|
||||||
tint = MaterialTheme.colorScheme.placeholderText
|
|
||||||
)
|
|
||||||
|
|
||||||
ChatroomTabMenu(
|
|
||||||
moreActionsExpanded,
|
|
||||||
{ moreActionsExpanded = false },
|
|
||||||
{ markKnownAsRead.value = true },
|
|
||||||
{ markNewAsRead.value = true }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HorizontalPager(
|
|
||||||
state = pagerState,
|
|
||||||
modifier = Modifier.fillMaxSize()
|
|
||||||
) { page ->
|
|
||||||
ChatroomListFeedView(
|
|
||||||
viewModel = tabs[page].viewModel,
|
|
||||||
accountViewModel = accountViewModel,
|
|
||||||
nav = nav,
|
|
||||||
markAsRead = tabs[page].markAsRead
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IconButton(
|
||||||
|
modifier = Modifier
|
||||||
|
.size(40.dp)
|
||||||
|
.align(Alignment.CenterEnd),
|
||||||
|
onClick = { moreActionsExpanded = true }
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Default.MoreVert,
|
||||||
|
contentDescription = null,
|
||||||
|
tint = MaterialTheme.colorScheme.placeholderText
|
||||||
|
)
|
||||||
|
|
||||||
|
ChatroomTabMenu(
|
||||||
|
moreActionsExpanded,
|
||||||
|
{ moreActionsExpanded = false },
|
||||||
|
{ markKnownAsRead.value = true },
|
||||||
|
{ markNewAsRead.value = true }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HorizontalPager(
|
||||||
|
state = pagerState,
|
||||||
|
modifier = Modifier.fillMaxSize()
|
||||||
|
) { page ->
|
||||||
|
ChatroomListFeedView(
|
||||||
|
viewModel = tabs[page].viewModel,
|
||||||
|
accountViewModel = accountViewModel,
|
||||||
|
nav = nav,
|
||||||
|
markAsRead = tabs[page].markAsRead
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ import com.vitorpamplona.amethyst.ui.note.UsernameDisplay
|
|||||||
import com.vitorpamplona.amethyst.ui.screen.NostrChatroomFeedViewModel
|
import com.vitorpamplona.amethyst.ui.screen.NostrChatroomFeedViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.RefreshingChatroomFeedView
|
import com.vitorpamplona.amethyst.ui.screen.RefreshingChatroomFeedView
|
||||||
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
import com.vitorpamplona.amethyst.ui.theme.EditFieldBorder
|
import com.vitorpamplona.amethyst.ui.theme.EditFieldBorder
|
||||||
import com.vitorpamplona.amethyst.ui.theme.EditFieldModifier
|
import com.vitorpamplona.amethyst.ui.theme.EditFieldModifier
|
||||||
import com.vitorpamplona.amethyst.ui.theme.EditFieldTrailingIconModifier
|
import com.vitorpamplona.amethyst.ui.theme.EditFieldTrailingIconModifier
|
||||||
@@ -548,7 +549,7 @@ fun ChatroomHeader(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -592,7 +593,7 @@ fun GroupChatroomHeader(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import androidx.compose.animation.Crossfade
|
|||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
@@ -54,6 +53,7 @@ import com.vitorpamplona.amethyst.ui.screen.RefresheableView
|
|||||||
import com.vitorpamplona.amethyst.ui.screen.SaveableFeedState
|
import com.vitorpamplona.amethyst.ui.screen.SaveableFeedState
|
||||||
import com.vitorpamplona.amethyst.ui.screen.ScrollStateKeys
|
import com.vitorpamplona.amethyst.ui.screen.ScrollStateKeys
|
||||||
import com.vitorpamplona.amethyst.ui.screen.rememberForeverPagerState
|
import com.vitorpamplona.amethyst.ui.screen.rememberForeverPagerState
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||||
import com.vitorpamplona.amethyst.ui.theme.TabRowHeight
|
import com.vitorpamplona.amethyst.ui.theme.TabRowHeight
|
||||||
import com.vitorpamplona.quartz.events.ChannelCreateEvent
|
import com.vitorpamplona.quartz.events.ChannelCreateEvent
|
||||||
import com.vitorpamplona.quartz.events.CommunityDefinitionEvent
|
import com.vitorpamplona.quartz.events.CommunityDefinitionEvent
|
||||||
@@ -234,10 +234,7 @@ private fun DiscoverFeedLoaded(
|
|||||||
nav: (String) -> Unit
|
nav: (String) -> Unit
|
||||||
) {
|
) {
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
contentPadding = PaddingValues(
|
contentPadding = FeedPadding,
|
||||||
top = 10.dp,
|
|
||||||
bottom = 10.dp
|
|
||||||
),
|
|
||||||
state = listState
|
state = listState
|
||||||
) {
|
) {
|
||||||
itemsIndexed(state.feed.value, key = { _, item -> item.idHex }) { _, item ->
|
itemsIndexed(state.feed.value, key = { _, item -> item.idHex }) { _, item ->
|
||||||
@@ -273,10 +270,7 @@ private fun DiscoverFeedTwoColumnsLoaded(
|
|||||||
) {
|
) {
|
||||||
LazyVerticalGrid(
|
LazyVerticalGrid(
|
||||||
columns = GridCells.Fixed(2),
|
columns = GridCells.Fixed(2),
|
||||||
contentPadding = PaddingValues(
|
contentPadding = FeedPadding,
|
||||||
top = 10.dp,
|
|
||||||
bottom = 10.dp
|
|
||||||
),
|
|
||||||
state = listState
|
state = listState
|
||||||
) {
|
) {
|
||||||
itemsIndexed(state.feed.value, key = { _, item -> item.idHex }) { _, item ->
|
itemsIndexed(state.feed.value, key = { _, item -> item.idHex }) { _, item ->
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import com.vitorpamplona.amethyst.service.NostrGeohashDataSource
|
|||||||
import com.vitorpamplona.amethyst.service.ReverseGeoLocationUtil
|
import com.vitorpamplona.amethyst.service.ReverseGeoLocationUtil
|
||||||
import com.vitorpamplona.amethyst.ui.screen.NostrGeoHashFeedViewModel
|
import com.vitorpamplona.amethyst.ui.screen.NostrGeoHashFeedViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.RefresheableFeedView
|
import com.vitorpamplona.amethyst.ui.screen.RefresheableFeedView
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
import com.vitorpamplona.amethyst.ui.theme.StdPadding
|
import com.vitorpamplona.amethyst.ui.theme.StdPadding
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -124,7 +125,7 @@ fun GeoHashHeader(tag: String, modifier: Modifier = StdPadding, account: Account
|
|||||||
}
|
}
|
||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import com.vitorpamplona.amethyst.R
|
|||||||
import com.vitorpamplona.amethyst.service.NostrHashtagDataSource
|
import com.vitorpamplona.amethyst.service.NostrHashtagDataSource
|
||||||
import com.vitorpamplona.amethyst.ui.screen.NostrHashtagFeedViewModel
|
import com.vitorpamplona.amethyst.ui.screen.NostrHashtagFeedViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.RefresheableFeedView
|
import com.vitorpamplona.amethyst.ui.screen.RefresheableFeedView
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
import com.vitorpamplona.amethyst.ui.theme.StdPadding
|
import com.vitorpamplona.amethyst.ui.theme.StdPadding
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -121,7 +122,7 @@ fun HashtagHeader(tag: String, modifier: Modifier = StdPadding, account: Account
|
|||||||
}
|
}
|
||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -3,7 +3,6 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn
|
|||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
@@ -56,6 +55,7 @@ import com.vitorpamplona.amethyst.ui.screen.RefreshingFeedUserFeedView
|
|||||||
import com.vitorpamplona.amethyst.ui.screen.StringFeedView
|
import com.vitorpamplona.amethyst.ui.screen.StringFeedView
|
||||||
import com.vitorpamplona.amethyst.ui.screen.UserFeedViewModel
|
import com.vitorpamplona.amethyst.ui.screen.UserFeedViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.ButtonPadding
|
||||||
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
import com.vitorpamplona.amethyst.ui.theme.HorzPadding
|
import com.vitorpamplona.amethyst.ui.theme.HorzPadding
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size10dp
|
import com.vitorpamplona.amethyst.ui.theme.Size10dp
|
||||||
@@ -291,7 +291,7 @@ fun MutedWordHeader(tag: String, modifier: Modifier = StdPadding, account: Accou
|
|||||||
}
|
}
|
||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -347,7 +347,7 @@ fun HideWordButton(onClick: () -> Unit) {
|
|||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
containerColor = MaterialTheme.colorScheme.primary
|
containerColor = MaterialTheme.colorScheme.primary
|
||||||
),
|
),
|
||||||
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)
|
contentPadding = ButtonPadding
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(R.string.block_only), color = Color.White)
|
Text(text = stringResource(R.string.block_only), color = Color.White)
|
||||||
}
|
}
|
||||||
@@ -362,7 +362,7 @@ fun ShowWordButton(text: Int = R.string.unblock, onClick: () -> Unit) {
|
|||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
containerColor = MaterialTheme.colorScheme.primary
|
containerColor = MaterialTheme.colorScheme.primary
|
||||||
),
|
),
|
||||||
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)
|
contentPadding = ButtonPadding
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(text), color = Color.White, textAlign = TextAlign.Center)
|
Text(text = stringResource(text), color = Color.White, textAlign = TextAlign.Center)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import androidx.compose.animation.Crossfade
|
|||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.foundation.pager.HorizontalPager
|
import androidx.compose.foundation.pager.HorizontalPager
|
||||||
import androidx.compose.foundation.pager.PagerState
|
import androidx.compose.foundation.pager.PagerState
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
@@ -24,7 +23,6 @@ import androidx.compose.runtime.setValue
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalLifecycleOwner
|
import androidx.compose.ui.platform.LocalLifecycleOwner
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.LifecycleEventObserver
|
import androidx.lifecycle.LifecycleEventObserver
|
||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
@@ -52,16 +50,65 @@ fun HomeScreen(
|
|||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
nip47: String? = null
|
nip47: String? = null
|
||||||
) {
|
) {
|
||||||
var wantsToAddNip47 by remember(nip47) { mutableStateOf(nip47) }
|
ResolveNIP47(nip47, accountViewModel)
|
||||||
|
|
||||||
val pagerState = rememberForeverPagerState(key = PagerStateKeys.HOME_SCREEN) { 2 }
|
|
||||||
|
|
||||||
WatchAccountForHomeScreen(homeFeedViewModel, repliesFeedViewModel, accountViewModel)
|
WatchAccountForHomeScreen(homeFeedViewModel, repliesFeedViewModel, accountViewModel)
|
||||||
|
|
||||||
|
WatchLifeCycleChanges()
|
||||||
|
|
||||||
|
AssembleHomeTabs(homeFeedViewModel, repliesFeedViewModel) { pagerState, tabItems ->
|
||||||
|
AssembleHomePage(pagerState, tabItems, accountViewModel, nav)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
|
@Composable
|
||||||
|
private fun AssembleHomeTabs(
|
||||||
|
homeFeedViewModel: NostrHomeFeedViewModel,
|
||||||
|
repliesFeedViewModel: NostrHomeRepliesFeedViewModel,
|
||||||
|
inner: @Composable (PagerState, ImmutableList<TabItem>) -> Unit
|
||||||
|
) {
|
||||||
|
val pagerState = rememberForeverPagerState(key = PagerStateKeys.HOME_SCREEN) { 2 }
|
||||||
|
|
||||||
|
val tabs by remember(homeFeedViewModel, repliesFeedViewModel) {
|
||||||
|
mutableStateOf(
|
||||||
|
listOf(
|
||||||
|
TabItem(R.string.new_threads, homeFeedViewModel, Route.Home.base + "Follows", ScrollStateKeys.HOME_FOLLOWS),
|
||||||
|
TabItem(R.string.conversations, repliesFeedViewModel, Route.Home.base + "FollowsReplies", ScrollStateKeys.HOME_REPLIES)
|
||||||
|
).toImmutableList()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
inner(pagerState, tabs)
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
|
@Composable
|
||||||
|
private fun AssembleHomePage(
|
||||||
|
pagerState: PagerState,
|
||||||
|
tabs: ImmutableList<TabItem>,
|
||||||
|
accountViewModel: AccountViewModel,
|
||||||
|
nav: (String) -> Unit
|
||||||
|
) {
|
||||||
|
Column(Modifier.fillMaxHeight()) {
|
||||||
|
HomePages(pagerState, tabs, accountViewModel, nav)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ResolveNIP47(
|
||||||
|
nip47: String?,
|
||||||
|
accountViewModel: AccountViewModel
|
||||||
|
) {
|
||||||
|
var wantsToAddNip47 by remember(nip47) { mutableStateOf(nip47) }
|
||||||
|
|
||||||
if (wantsToAddNip47 != null) {
|
if (wantsToAddNip47 != null) {
|
||||||
UpdateZapAmountDialog({ wantsToAddNip47 = null }, wantsToAddNip47, accountViewModel)
|
UpdateZapAmountDialog({ wantsToAddNip47 = null }, wantsToAddNip47, accountViewModel)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun WatchLifeCycleChanges() {
|
||||||
val lifeCycleOwner = LocalLifecycleOwner.current
|
val lifeCycleOwner = LocalLifecycleOwner.current
|
||||||
DisposableEffect(lifeCycleOwner) {
|
DisposableEffect(lifeCycleOwner) {
|
||||||
val observer = LifecycleEventObserver { _, event ->
|
val observer = LifecycleEventObserver { _, event ->
|
||||||
@@ -75,23 +122,6 @@ fun HomeScreen(
|
|||||||
lifeCycleOwner.lifecycle.removeObserver(observer)
|
lifeCycleOwner.lifecycle.removeObserver(observer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val tabs by remember(homeFeedViewModel, repliesFeedViewModel) {
|
|
||||||
mutableStateOf(
|
|
||||||
listOf(
|
|
||||||
TabItem(R.string.new_threads, homeFeedViewModel, Route.Home.base + "Follows", ScrollStateKeys.HOME_FOLLOWS),
|
|
||||||
TabItem(R.string.conversations, repliesFeedViewModel, Route.Home.base + "FollowsReplies", ScrollStateKeys.HOME_REPLIES)
|
|
||||||
).toImmutableList()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Column(Modifier.fillMaxHeight()) {
|
|
||||||
Column(
|
|
||||||
modifier = Modifier.padding(vertical = 0.dp)
|
|
||||||
) {
|
|
||||||
HomePages(pagerState, tabs, accountViewModel, nav)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|||||||
+2
-1
@@ -62,6 +62,7 @@ import com.vitorpamplona.amethyst.ui.screen.RefresheableCardView
|
|||||||
import com.vitorpamplona.amethyst.ui.screen.ScrollStateKeys
|
import com.vitorpamplona.amethyst.ui.screen.ScrollStateKeys
|
||||||
import com.vitorpamplona.amethyst.ui.screen.SharedPreferencesViewModel
|
import com.vitorpamplona.amethyst.ui.screen.SharedPreferencesViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange
|
import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
import com.vitorpamplona.amethyst.ui.theme.RoyalBlue
|
import com.vitorpamplona.amethyst.ui.theme.RoyalBlue
|
||||||
import com.vitorpamplona.amethyst.ui.theme.chartStyle
|
import com.vitorpamplona.amethyst.ui.theme.chartStyle
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
@@ -213,7 +214,7 @@ fun SummaryBar(model: UserReactionsViewModel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.Box
|
|||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||||
import androidx.compose.foundation.layout.FlowRow
|
import androidx.compose.foundation.layout.FlowRow
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
@@ -134,6 +133,7 @@ import com.vitorpamplona.amethyst.ui.screen.RelayFeedViewModel
|
|||||||
import com.vitorpamplona.amethyst.ui.screen.UserFeedViewModel
|
import com.vitorpamplona.amethyst.ui.screen.UserFeedViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange
|
import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange
|
||||||
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.ButtonPadding
|
||||||
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size16Modifier
|
import com.vitorpamplona.amethyst.ui.theme.Size16Modifier
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size35dp
|
import com.vitorpamplona.amethyst.ui.theme.Size35dp
|
||||||
@@ -1697,7 +1697,7 @@ private fun InnerEditButton(onClick: () -> Unit) {
|
|||||||
.padding(horizontal = 3.dp)
|
.padding(horizontal = 3.dp)
|
||||||
.width(50.dp),
|
.width(50.dp),
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
contentPadding = PaddingValues(0.dp)
|
contentPadding = ZeroPadding
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
tint = Color.White,
|
tint = Color.White,
|
||||||
@@ -1716,7 +1716,7 @@ fun UnfollowButton(onClick: () -> Unit) {
|
|||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
containerColor = MaterialTheme.colorScheme.primary
|
containerColor = MaterialTheme.colorScheme.primary
|
||||||
),
|
),
|
||||||
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)
|
contentPadding = ButtonPadding
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(R.string.unfollow), color = Color.White)
|
Text(text = stringResource(R.string.unfollow), color = Color.White)
|
||||||
}
|
}
|
||||||
@@ -1731,7 +1731,7 @@ fun FollowButton(text: Int = R.string.follow, onClick: () -> Unit) {
|
|||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
containerColor = MaterialTheme.colorScheme.primary
|
containerColor = MaterialTheme.colorScheme.primary
|
||||||
),
|
),
|
||||||
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)
|
contentPadding = ButtonPadding
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(text), color = Color.White, textAlign = TextAlign.Center)
|
Text(text = stringResource(text), color = Color.White, textAlign = TextAlign.Center)
|
||||||
}
|
}
|
||||||
@@ -1746,7 +1746,7 @@ fun ShowUserButton(onClick: () -> Unit) {
|
|||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
containerColor = MaterialTheme.colorScheme.primary
|
containerColor = MaterialTheme.colorScheme.primary
|
||||||
),
|
),
|
||||||
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)
|
contentPadding = ButtonPadding
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(R.string.unblock), color = Color.White)
|
Text(text = stringResource(R.string.unblock), color = Color.White)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import android.util.Log
|
|||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.defaultMinSize
|
import androidx.compose.foundation.layout.defaultMinSize
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
@@ -65,6 +64,8 @@ import com.vitorpamplona.amethyst.ui.note.NoteCompose
|
|||||||
import com.vitorpamplona.amethyst.ui.note.SearchIcon
|
import com.vitorpamplona.amethyst.ui.note.SearchIcon
|
||||||
import com.vitorpamplona.amethyst.ui.note.UserCompose
|
import com.vitorpamplona.amethyst.ui.note.UserCompose
|
||||||
import com.vitorpamplona.amethyst.ui.note.UsernameDisplay
|
import com.vitorpamplona.amethyst.ui.note.UsernameDisplay
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size20Modifier
|
import com.vitorpamplona.amethyst.ui.theme.Size20Modifier
|
||||||
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||||
import com.vitorpamplona.quartz.events.findHashtags
|
import com.vitorpamplona.quartz.events.findHashtags
|
||||||
@@ -353,10 +354,7 @@ private fun DisplaySearchResults(
|
|||||||
|
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
modifier = Modifier.fillMaxHeight(),
|
modifier = Modifier.fillMaxHeight(),
|
||||||
contentPadding = PaddingValues(
|
contentPadding = FeedPadding,
|
||||||
top = 10.dp,
|
|
||||||
bottom = 10.dp
|
|
||||||
),
|
|
||||||
state = listState
|
state = listState
|
||||||
) {
|
) {
|
||||||
itemsIndexed(
|
itemsIndexed(
|
||||||
@@ -438,7 +436,7 @@ fun HashtagLine(tag: String, onClick: () -> Unit) {
|
|||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
modifier = Modifier.padding(top = 10.dp),
|
modifier = Modifier.padding(top = 10.dp),
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -479,7 +477,7 @@ fun UserLine(
|
|||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
modifier = Modifier.padding(top = 10.dp),
|
modifier = Modifier.padding(top = 10.dp),
|
||||||
thickness = 0.25.dp
|
thickness = DividerThickness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ val Size18dp = 18.dp
|
|||||||
val Size19dp = 19.dp
|
val Size19dp = 19.dp
|
||||||
val Size20dp = 20.dp
|
val Size20dp = 20.dp
|
||||||
val Size22dp = 22.dp
|
val Size22dp = 22.dp
|
||||||
|
val Size23dp = 23.dp
|
||||||
val Size24dp = 24.dp
|
val Size24dp = 24.dp
|
||||||
val Size25dp = 25.dp
|
val Size25dp = 25.dp
|
||||||
val Size30dp = 30.dp
|
val Size30dp = 30.dp
|
||||||
@@ -144,9 +145,6 @@ val EditFieldLeadingIconModifier = Modifier
|
|||||||
.height(32.dp)
|
.height(32.dp)
|
||||||
.padding(start = 2.dp)
|
.padding(start = 2.dp)
|
||||||
|
|
||||||
val FeedPadding = PaddingValues(
|
|
||||||
top = 10.dp,
|
|
||||||
bottom = 10.dp
|
|
||||||
)
|
|
||||||
|
|
||||||
val ZeroPadding = PaddingValues(0.dp)
|
val ZeroPadding = PaddingValues(0.dp)
|
||||||
|
val FeedPadding = PaddingValues(top = 10.dp, bottom = 10.dp)
|
||||||
|
val ButtonPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)
|
||||||
|
|||||||
Reference in New Issue
Block a user