feat: various M3 related tweaks
This commit is contained in:
parent
14a4a4fec0
commit
5cf0943e26
|
|
@ -161,6 +161,9 @@ object RealtimeSocket {
|
||||||
RevoltAPI.channelCache[channelUpdateFrame.id] =
|
RevoltAPI.channelCache[channelUpdateFrame.id] =
|
||||||
existing.mergeWithPartial(channelUpdateFrame.data)
|
existing.mergeWithPartial(channelUpdateFrame.data)
|
||||||
}
|
}
|
||||||
|
"Authenticated" -> {
|
||||||
|
// No effect
|
||||||
|
}
|
||||||
else -> {
|
else -> {
|
||||||
Log.i("RealtimeSocket", "Unknown frame: $rawFrame")
|
Log.i("RealtimeSocket", "Unknown frame: $rawFrame")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.text.BasicTextField
|
import androidx.compose.foundation.text.BasicTextField
|
||||||
import androidx.compose.foundation.text.KeyboardActions
|
import androidx.compose.foundation.text.KeyboardActions
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
|
|
@ -87,7 +88,8 @@ fun MessageField(
|
||||||
unfocusedIndicatorColor = Color.Transparent,
|
unfocusedIndicatorColor = Color.Transparent,
|
||||||
disabledIndicatorColor = Color.Transparent,
|
disabledIndicatorColor = Color.Transparent,
|
||||||
errorIndicatorColor = Color.Transparent,
|
errorIndicatorColor = Color.Transparent,
|
||||||
placeholderColor = Color.Gray
|
placeholderColor = Color.Gray,
|
||||||
|
containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp)
|
||||||
),
|
),
|
||||||
contentPadding = PaddingValues(16.dp),
|
contentPadding = PaddingValues(16.dp),
|
||||||
leadingIcon = {
|
leadingIcon = {
|
||||||
|
|
@ -126,7 +128,11 @@ fun MessageField(
|
||||||
.padding(4.dp)
|
.padding(4.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
shape = RoundedCornerShape(
|
||||||
|
topStart = 16.dp,
|
||||||
|
topEnd = 16.dp
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,10 @@ enum class Presence {
|
||||||
|
|
||||||
fun presenceFromStatus(status: String): Presence {
|
fun presenceFromStatus(status: String): Presence {
|
||||||
return when (status) {
|
return when (status) {
|
||||||
"online" -> Presence.Online
|
"Online" -> Presence.Online
|
||||||
"idle" -> Presence.Idle
|
"Idle" -> Presence.Idle
|
||||||
"dnd" -> Presence.Dnd
|
"Busy" -> Presence.Dnd
|
||||||
"focus" -> Presence.Focus
|
"Focus" -> Presence.Focus
|
||||||
else -> Presence.Offline
|
else -> Presence.Offline
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,12 +126,6 @@ fun DoubleDrawer(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxHeight()
|
.fillMaxHeight()
|
||||||
.fillMaxWidth(drawerWeight)
|
.fillMaxWidth(drawerWeight)
|
||||||
.clip(
|
|
||||||
RoundedCornerShape(
|
|
||||||
topEnd = 16.dp,
|
|
||||||
bottomEnd = 16.dp
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.align(Alignment.CenterStart)
|
.align(Alignment.CenterStart)
|
||||||
.offset {
|
.offset {
|
||||||
IntOffset(
|
IntOffset(
|
||||||
|
|
@ -140,15 +134,18 @@ fun DoubleDrawer(
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
startPanel()
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.clip(RoundedCornerShape(topEnd = 16.dp, bottomEnd = 16.dp))
|
||||||
|
) {
|
||||||
|
startPanel()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.clip(
|
|
||||||
RoundedCornerShape(contentCornerRadius)
|
|
||||||
)
|
|
||||||
.align(Alignment.Center)
|
.align(Alignment.Center)
|
||||||
.offset {
|
.offset {
|
||||||
IntOffset(
|
IntOffset(
|
||||||
|
|
@ -157,7 +154,13 @@ fun DoubleDrawer(
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
content()
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.clip(RoundedCornerShape(contentCornerRadius))
|
||||||
|
) {
|
||||||
|
content()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Box(
|
Box(
|
||||||
|
|
@ -178,7 +181,13 @@ fun DoubleDrawer(
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
endPanel()
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.clip(RoundedCornerShape(topStart = 16.dp, bottomStart = 16.dp))
|
||||||
|
) {
|
||||||
|
endPanel()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
|
|
@ -96,7 +95,11 @@ fun ChatRouterScreen(topNav: NavController, viewModel: ChatRouterViewModel = vie
|
||||||
val navController = rememberNavController(bottomSheetNavigator)
|
val navController = rememberNavController(bottomSheetNavigator)
|
||||||
val navBackStackEntry by navController.currentBackStackEntryAsState()
|
val navBackStackEntry by navController.currentBackStackEntryAsState()
|
||||||
|
|
||||||
ModalBottomSheetLayout(bottomSheetNavigator = bottomSheetNavigator) {
|
ModalBottomSheetLayout(
|
||||||
|
sheetShape = RoundedCornerShape(topStart = 16.dp, topEnd = 16.dp),
|
||||||
|
sheetBackgroundColor = MaterialTheme.colorScheme.surface,
|
||||||
|
bottomSheetNavigator = bottomSheetNavigator,
|
||||||
|
) {
|
||||||
Column {
|
Column {
|
||||||
AnimatedVisibility(visible = RealtimeSocket.disconnectionState != DisconnectionState.Connected) {
|
AnimatedVisibility(visible = RealtimeSocket.disconnectionState != DisconnectionState.Connected) {
|
||||||
DisconnectedNotice(
|
DisconnectedNotice(
|
||||||
|
|
@ -178,7 +181,7 @@ fun ChatRouterScreen(topNav: NavController, viewModel: ChatRouterViewModel = vie
|
||||||
Surface(
|
Surface(
|
||||||
tonalElevation = 1.dp,
|
tonalElevation = 1.dp,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(vertical = 4.dp)
|
.padding(start = 4.dp, top = 8.dp, bottom = 8.dp)
|
||||||
.clip(RoundedCornerShape(16.dp))
|
.clip(RoundedCornerShape(16.dp))
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
|
|
@ -215,7 +218,7 @@ fun ChatRouterScreen(topNav: NavController, viewModel: ChatRouterViewModel = vie
|
||||||
Text(
|
Text(
|
||||||
text = server?.name
|
text = server?.name
|
||||||
?: stringResource(R.string.unknown),
|
?: stringResource(R.string.unknown),
|
||||||
fontWeight = FontWeight.Black,
|
style = MaterialTheme.typography.labelLarge,
|
||||||
fontSize = 24.sp,
|
fontSize = 24.sp,
|
||||||
modifier = Modifier.padding(16.dp)
|
modifier = Modifier.padding(16.dp)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,14 @@ import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.KeyboardArrowDown
|
import androidx.compose.material.icons.filled.KeyboardArrowDown
|
||||||
import androidx.compose.material3.*
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
|
@ -402,7 +404,13 @@ fun ChannelScreen(
|
||||||
navController.navigate("channel/${channel.id}/info")
|
navController.navigate("channel/${channel.id}/info")
|
||||||
}
|
}
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.background(MaterialTheme.colorScheme.surface)
|
.clip(
|
||||||
|
RoundedCornerShape(
|
||||||
|
bottomStart = 16.dp,
|
||||||
|
bottomEnd = 16.dp
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.background(MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp))
|
||||||
.padding(16.dp),
|
.padding(16.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,19 @@
|
||||||
package chat.revolt.screens.chat.views
|
package chat.revolt.screens.chat.views
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Close
|
import androidx.compose.material.icons.filled.Close
|
||||||
|
import androidx.compose.material.icons.filled.Settings
|
||||||
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.SpanStyle
|
||||||
|
import androidx.compose.ui.text.buildAnnotatedString
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.text.withStyle
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
|
|
@ -33,6 +42,7 @@ class HomeScreenViewModel @Inject constructor(
|
||||||
fun HomeScreen(navController: NavController, viewModel: HomeScreenViewModel = hiltViewModel()) {
|
fun HomeScreen(navController: NavController, viewModel: HomeScreenViewModel = hiltViewModel()) {
|
||||||
Column {
|
Column {
|
||||||
PageHeader(text = stringResource(id = R.string.home))
|
PageHeader(text = stringResource(id = R.string.home))
|
||||||
|
|
||||||
LinkOnHome(
|
LinkOnHome(
|
||||||
heading = stringResource(id = R.string.logout),
|
heading = stringResource(id = R.string.logout),
|
||||||
icon = Icons.Default.Close,
|
icon = Icons.Default.Close,
|
||||||
|
|
@ -44,5 +54,18 @@ fun HomeScreen(navController: NavController, viewModel: HomeScreenViewModel = hi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
LinkOnHome(
|
||||||
|
heading = stringResource(id = R.string.settings),
|
||||||
|
icon = Icons.Default.Settings,
|
||||||
|
onClick = {
|
||||||
|
navController.navigate("settings")
|
||||||
|
})
|
||||||
|
Text(buildAnnotatedString {
|
||||||
|
withStyle(style = SpanStyle(fontWeight = FontWeight.Bold)) {
|
||||||
|
append("Note: ")
|
||||||
|
}
|
||||||
|
append("Settings are accessible from the top left status icon in the drawer. The link here is temporary until a tutorial is in place.")
|
||||||
|
}, modifier = Modifier.padding(16.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue