including material3 dependencies and attempting 1 for 1 swap of imports

This commit is contained in:
Adam Brown 2022-09-04 15:07:16 +01:00 committed by Adam Brown
parent f20e3a4c40
commit 1a6f8b6b40
24 changed files with 98 additions and 92 deletions

View File

@ -106,7 +106,7 @@ ext.Dependencies.with {
androidxComposeUi = "androidx.compose.ui:ui:${composeVer}" androidxComposeUi = "androidx.compose.ui:ui:${composeVer}"
androidxComposeFoundation = "androidx.compose.foundation:foundation:${composeVer}" androidxComposeFoundation = "androidx.compose.foundation:foundation:${composeVer}"
androidxComposeMaterial = "androidx.compose.material:material:${composeVer}" androidxComposeMaterial = "androidx.compose.material3:material3:1.0.0-beta01"
androidxComposeIconsExtended = "androidx.compose.material:material-icons-extended:${composeVer}" androidxComposeIconsExtended = "androidx.compose.material:material-icons-extended:${composeVer}"
androidxActivityCompose = "androidx.activity:activity-compose:1.4.0" androidxActivityCompose = "androidx.activity:activity-compose:1.4.0"
kotlinCompilerExtensionVersion = "1.3.0" kotlinCompilerExtensionVersion = "1.3.0"

View File

@ -3,7 +3,7 @@ package app.dapk.st.design.components
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.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier

View File

@ -3,8 +3,8 @@ package app.dapk.st.design.components
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.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Button import androidx.compose.material3.Button
import androidx.compose.material.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier

View File

@ -6,7 +6,7 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier

View File

@ -1,9 +1,9 @@
package app.dapk.st.design.components package app.dapk.st.design.components
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.material.DropdownMenu import androidx.compose.material3.DropdownMenu
import androidx.compose.material.Icon import androidx.compose.material3.Icon
import androidx.compose.material.IconButton import androidx.compose.material3.IconButton
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.MoreVert import androidx.compose.material.icons.outlined.MoreVert
import androidx.compose.runtime.* import androidx.compose.runtime.*

View File

@ -1,8 +1,8 @@
package app.dapk.st.design.components package app.dapk.st.design.components
import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material.darkColors import androidx.compose.material3.darkColorScheme
import androidx.compose.runtime.* import androidx.compose.runtime.*
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import com.google.accompanist.systemuicontroller.rememberSystemUiController import com.google.accompanist.systemuicontroller.rememberSystemUiController
@ -12,7 +12,7 @@ private object Palette {
val brandPrimary = Color(0xFFb41cca) val brandPrimary = Color(0xFFb41cca)
} }
private val DARK_COLOURS = darkColors( private val DARK_COLOURS = darkColorScheme(
primary = Palette.brandPrimary, primary = Palette.brandPrimary,
onPrimary = Color(0xDDFFFFFF), onPrimary = Color(0xDDFFFFFF),
) )
@ -56,9 +56,9 @@ fun SmallTalkTheme(content: @Composable () -> Unit) {
val systemUiController = rememberSystemUiController() val systemUiController = rememberSystemUiController()
val systemInDarkTheme = isSystemInDarkTheme() val systemInDarkTheme = isSystemInDarkTheme()
MaterialTheme( MaterialTheme(
colors = if (systemInDarkTheme) DARK_COLOURS else LIGHT_COLOURS, // colorScheme = if (systemInDarkTheme) DARK_COLOURS else LIGHT_COLOURS,
) { ) {
val backgroundColor = MaterialTheme.colors.background val backgroundColor = MaterialTheme.colorScheme.background
SideEffect { SideEffect {
systemUiController.setSystemBarsColor(backgroundColor) systemUiController.setSystemBarsColor(backgroundColor)
} }

View File

@ -4,7 +4,7 @@ import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.offset
import androidx.compose.material.* import androidx.compose.material3.*
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@ -14,6 +14,7 @@ import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
@OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
fun Toolbar( fun Toolbar(
onNavigate: (() -> Unit)? = null, onNavigate: (() -> Unit)? = null,
@ -23,7 +24,7 @@ fun Toolbar(
) { ) {
val navigationIcon = foo(onNavigate) val navigationIcon = foo(onNavigate)
TopAppBar( SmallTopAppBar(
modifier = Modifier.height(72.dp).run { modifier = Modifier.height(72.dp).run {
if (offset == null) { if (offset == null) {
this this
@ -31,13 +32,14 @@ fun Toolbar(
this.offset(offset) this.offset(offset)
} }
}, },
backgroundColor = MaterialTheme.colors.background, colors = TopAppBarDefaults.smallTopAppBarColors(
navigationIcon = navigationIcon, containerColor = MaterialTheme.colorScheme.background
),
navigationIcon = navigationIcon ?: {},
title = title?.let { title = title?.let {
{ Text(it, maxLines = 2) } { Text(it, maxLines = 2) }
} ?: {}, } ?: {},
actions = actions, actions = actions,
elevation = 0.dp
) )
Divider(modifier = Modifier.fillMaxWidth(), color = Color.Black.copy(alpha = 0.2f), thickness = 0.5.dp) Divider(modifier = Modifier.fillMaxWidth(), color = Color.Black.copy(alpha = 0.2f), thickness = 0.5.dp)
} }

View File

@ -2,9 +2,9 @@ package app.dapk.st.design.components
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.material.Divider import androidx.compose.material3.Divider
import androidx.compose.material.Icon import androidx.compose.material3.Icon
import androidx.compose.material.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier

View File

@ -4,9 +4,9 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material.CircularProgressIndicator import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
@ -17,7 +17,7 @@ import androidx.compose.ui.unit.sp
@Composable @Composable
fun Header(label: String) { fun Header(label: String) {
Box(Modifier.padding(top = 24.dp, start = 24.dp, end = 24.dp)) { Box(Modifier.padding(top = 24.dp, start = 24.dp, end = 24.dp)) {
Text(text = label.uppercase(), fontWeight = FontWeight.Bold, fontSize = 12.sp, color = MaterialTheme.colors.primary) Text(text = label.uppercase(), fontWeight = FontWeight.Bold, fontSize = 12.sp, color = MaterialTheme.colorScheme.primary)
} }
} }

View File

@ -10,8 +10,8 @@ import androidx.compose.foundation.lazy.LazyListState
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.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material.Text import androidx.compose.material3.Text
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
@ -155,7 +155,7 @@ private fun DirectoryItem(room: RoomFoo, onClick: (RoomId) -> Unit, clock: Clock
onClick(overview.roomId) onClick(overview.roomId)
}) { }) {
Row(Modifier.padding(20.dp)) { Row(Modifier.padding(20.dp)) {
val secondaryText = MaterialTheme.colors.onBackground.copy(alpha = 0.5f) val secondaryText = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.5f)
Box(Modifier.fillMaxHeight(), contentAlignment = Alignment.Center) { Box(Modifier.fillMaxHeight(), contentAlignment = Alignment.Center) {
CircleishAvatar(overview.roomAvatarUrl?.value, roomName, size = 50.dp) CircleishAvatar(overview.roomAvatarUrl?.value, roomName, size = 50.dp)
@ -171,7 +171,7 @@ private fun DirectoryItem(room: RoomFoo, onClick: (RoomId) -> Unit, clock: Clock
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
fontFamily = FontFamily.SansSerif, fontFamily = FontFamily.SansSerif,
fontWeight = FontWeight.Medium, fontWeight = FontWeight.Medium,
color = MaterialTheme.colors.onBackground color = MaterialTheme.colorScheme.onBackground
) )
Spacer(modifier = Modifier.width(6.dp)) Spacer(modifier = Modifier.width(6.dp))
@ -184,7 +184,7 @@ private fun DirectoryItem(room: RoomFoo, onClick: (RoomId) -> Unit, clock: Clock
fontSize = 12.sp, fontSize = 12.sp,
maxLines = 1, maxLines = 1,
text = formattedTimestamp, text = formattedTimestamp,
color = if (hasUnread) MaterialTheme.colors.primary else secondaryText color = if (hasUnread) MaterialTheme.colorScheme.primary else secondaryText
) )
} }
@ -198,7 +198,7 @@ private fun DirectoryItem(room: RoomFoo, onClick: (RoomId) -> Unit, clock: Clock
Box( Box(
Modifier Modifier
.align(Alignment.Center) .align(Alignment.Center)
.background(color = MaterialTheme.colors.primary, shape = CircleShape) .background(color = MaterialTheme.colorScheme.primary, shape = CircleShape)
.size(22.dp), .size(22.dp),
contentAlignment = Alignment.Center contentAlignment = Alignment.Center
) { ) {
@ -214,7 +214,7 @@ private fun DirectoryItem(room: RoomFoo, onClick: (RoomId) -> Unit, clock: Clock
fontSize = unreadTextSize, fontSize = unreadTextSize,
fontWeight = FontWeight.Medium, fontWeight = FontWeight.Medium,
text = unreadLabelContent, text = unreadLabelContent,
color = MaterialTheme.colors.onPrimary color = MaterialTheme.colorScheme.onPrimary
) )
} }
} }
@ -244,7 +244,7 @@ private fun body(overview: RoomOverview, secondaryText: Color, typing: SyncServi
"$name is typing..." "$name is typing..."
}, },
maxLines = 1, maxLines = 1,
color = MaterialTheme.colors.primary color = MaterialTheme.colorScheme.primary
) )
} }
else -> when (val lastMessage = overview.lastMessage) { else -> when (val lastMessage = overview.lastMessage) {

View File

@ -1,7 +1,7 @@
package app.dapk.st.home package app.dapk.st.home
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.material.* import androidx.compose.material3.*
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
@ -17,6 +17,7 @@ import app.dapk.st.home.HomeScreenState.Page.Profile
import app.dapk.st.login.LoginScreen import app.dapk.st.login.LoginScreen
import app.dapk.st.profile.ProfileScreen import app.dapk.st.profile.ProfileScreen
@OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
fun HomeScreen(homeViewModel: HomeViewModel) { fun HomeScreen(homeViewModel: HomeViewModel) {
SmallTalkTheme { SmallTalkTheme {
@ -61,10 +62,10 @@ fun HomeScreen(homeViewModel: HomeViewModel) {
private fun BottomBar(state: SignedIn, homeViewModel: HomeViewModel) { private fun BottomBar(state: SignedIn, homeViewModel: HomeViewModel) {
Column { Column {
Divider(modifier = Modifier.fillMaxWidth(), color = Color.Black.copy(alpha = 0.2f), thickness = 0.5.dp) Divider(modifier = Modifier.fillMaxWidth(), color = Color.Black.copy(alpha = 0.2f), thickness = 0.5.dp)
BottomNavigation(elevation = 0.dp, backgroundColor = Color.Transparent, modifier = Modifier.height(IntrinsicSize.Min)) { NavigationBar(containerColor = Color.Transparent, modifier = Modifier.height(IntrinsicSize.Min)) {
Page.values().forEach { page -> Page.values().forEach { page ->
when (page) { when (page) {
Directory -> BottomNavigationItem( Directory -> NavigationBarItem(
icon = { Icon(page.icon, contentDescription = null) }, icon = { Icon(page.icon, contentDescription = null) },
selected = state.page == page, selected = state.page == page,
onClick = { onClick = {
@ -74,7 +75,7 @@ private fun BottomBar(state: SignedIn, homeViewModel: HomeViewModel) {
} }
}, },
) )
Profile -> BottomNavigationItem( Profile -> NavigationBarItem(
icon = { icon = {
Box(modifier = Modifier.fillMaxHeight()) { Box(modifier = Modifier.fillMaxHeight()) {
CircleishAvatar(state.me.avatarUrl?.value, state.me.displayName ?: state.me.userId.value, size = 25.dp) CircleishAvatar(state.me.avatarUrl?.value, state.me.displayName ?: state.me.userId.value, size = 25.dp)

View File

@ -2,9 +2,9 @@ package app.dapk.st.home
import android.os.Bundle import android.os.Bundle
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.compose.material.AlertDialog import androidx.compose.material3.AlertDialog
import androidx.compose.material.Text import androidx.compose.material3.Text
import androidx.compose.material.TextButton import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import app.dapk.st.core.DapkActivity import app.dapk.st.core.DapkActivity

View File

@ -4,7 +4,7 @@ import android.widget.Toast
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.* import androidx.compose.material3.*
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Visibility import androidx.compose.material.icons.filled.Visibility
import androidx.compose.material.icons.filled.VisibilityOff import androidx.compose.material.icons.filled.VisibilityOff
@ -34,7 +34,7 @@ import app.dapk.st.core.StartObserving
import app.dapk.st.login.LoginEvent.LoginComplete import app.dapk.st.login.LoginEvent.LoginComplete
import app.dapk.st.login.LoginScreenState.* import app.dapk.st.login.LoginScreenState.*
@OptIn(ExperimentalComposeUiApi::class) @OptIn(ExperimentalComposeUiApi::class, ExperimentalMaterial3Api::class)
@Composable @Composable
fun LoginScreen(loginViewModel: LoginViewModel, onLoggedIn: () -> Unit) { fun LoginScreen(loginViewModel: LoginViewModel, onLoggedIn: () -> Unit) {
loginViewModel.ObserveEvents(onLoggedIn) loginViewModel.ObserveEvents(onLoggedIn)

View File

@ -7,7 +7,7 @@ import android.os.Bundle
import android.os.Parcelable import android.os.Parcelable
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Surface import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import app.dapk.st.core.* import app.dapk.st.core.*
import app.dapk.st.design.components.SmallTalkTheme import app.dapk.st.design.components.SmallTalkTheme

View File

@ -10,7 +10,7 @@ import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicTextField import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.* import androidx.compose.material3.*
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Check import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.filled.Close
@ -64,9 +64,7 @@ internal fun MessengerScreen(roomId: RoomId, attachments: List<MessageAttachment
Column { Column {
Toolbar(onNavigate = { navigator.navigate.upToHome() }, roomTitle, actions = { Toolbar(onNavigate = { navigator.navigate.upToHome() }, roomTitle, actions = {
OverflowMenu { OverflowMenu {
DropdownMenuItem(onClick = {}) { DropdownMenuItem(text = { Text("Settings") }, onClick = {})
Text("Settings")
}
} }
}) })
when (state.composerState) { when (state.composerState) {
@ -126,7 +124,7 @@ private fun ColumnScope.Room(roomStateLce: Lce<MessengerState>) {
"$name is typing..." "$name is typing..."
}, },
maxLines = 1, maxLines = 1,
color = MaterialTheme.colors.primary color = MaterialTheme.colorScheme.primary
) )
} }
} }
@ -251,7 +249,7 @@ private fun MessageImage(content: BubbleContent<RoomEvent.Image>) {
fontSize = 11.sp, fontSize = 11.sp,
text = content.message.author.displayName ?: content.message.author.id.value, text = content.message.author.displayName ?: content.message.author.id.value,
maxLines = 1, maxLines = 1,
color = MaterialTheme.colors.onPrimary color = MaterialTheme.colorScheme.onPrimary
) )
} }
@ -274,7 +272,7 @@ private fun MessageImage(content: BubbleContent<RoomEvent.Image>) {
fontSize = 9.sp, fontSize = 9.sp,
text = "${editedPrefix ?: ""}${content.message.time}", text = "${editedPrefix ?: ""}${content.message.time}",
textAlign = TextAlign.End, textAlign = TextAlign.End,
color = MaterialTheme.colors.onPrimary, color = MaterialTheme.colorScheme.onPrimary,
modifier = Modifier.wrapContentSize() modifier = Modifier.wrapContentSize()
) )
SendStatus(content.message) SendStatus(content.message)
@ -359,12 +357,12 @@ private fun TextBubbleContent(content: BubbleContent<RoomEvent.Message>) {
fontSize = 11.sp, fontSize = 11.sp,
text = content.message.author.displayName ?: content.message.author.id.value, text = content.message.author.displayName ?: content.message.author.id.value,
maxLines = 1, maxLines = 1,
color = MaterialTheme.colors.onPrimary color = MaterialTheme.colorScheme.onPrimary
) )
} }
Text( Text(
text = content.message.content, text = content.message.content,
color = MaterialTheme.colors.onPrimary, color = MaterialTheme.colorScheme.onPrimary,
fontSize = 15.sp, fontSize = 15.sp,
modifier = Modifier.wrapContentSize(), modifier = Modifier.wrapContentSize(),
textAlign = TextAlign.Start, textAlign = TextAlign.Start,
@ -377,7 +375,7 @@ private fun TextBubbleContent(content: BubbleContent<RoomEvent.Message>) {
fontSize = 9.sp, fontSize = 9.sp,
text = "${editedPrefix ?: ""}${content.message.time}", text = "${editedPrefix ?: ""}${content.message.time}",
textAlign = TextAlign.End, textAlign = TextAlign.End,
color = MaterialTheme.colors.onPrimary, color = MaterialTheme.colorScheme.onPrimary,
modifier = Modifier.wrapContentSize() modifier = Modifier.wrapContentSize()
) )
SendStatus(content.message) SendStatus(content.message)
@ -416,13 +414,13 @@ private fun ReplyBubbleContent(content: BubbleContent<RoomEvent.Reply>) {
fontSize = 11.sp, fontSize = 11.sp,
text = replyName, text = replyName,
maxLines = 1, maxLines = 1,
color = MaterialTheme.colors.onPrimary color = MaterialTheme.colorScheme.onPrimary
) )
when (val replyingTo = content.message.replyingTo) { when (val replyingTo = content.message.replyingTo) {
is Message -> { is Message -> {
Text( Text(
text = replyingTo.content, text = replyingTo.content,
color = MaterialTheme.colors.onPrimary, color = MaterialTheme.colorScheme.onPrimary,
fontSize = 15.sp, fontSize = 15.sp,
modifier = Modifier.wrapContentSize(), modifier = Modifier.wrapContentSize(),
textAlign = TextAlign.Start, textAlign = TextAlign.Start,
@ -457,14 +455,14 @@ private fun ReplyBubbleContent(content: BubbleContent<RoomEvent.Reply>) {
fontSize = 11.sp, fontSize = 11.sp,
text = content.message.message.author.displayName ?: content.message.message.author.id.value, text = content.message.message.author.displayName ?: content.message.message.author.id.value,
maxLines = 1, maxLines = 1,
color = MaterialTheme.colors.onPrimary color = MaterialTheme.colorScheme.onPrimary
) )
} }
when (val message = content.message.message) { when (val message = content.message.message) {
is Message -> { is Message -> {
Text( Text(
text = message.content, text = message.content,
color = MaterialTheme.colors.onPrimary, color = MaterialTheme.colorScheme.onPrimary,
fontSize = 15.sp, fontSize = 15.sp,
modifier = Modifier.wrapContentSize(), modifier = Modifier.wrapContentSize(),
textAlign = TextAlign.Start, textAlign = TextAlign.Start,
@ -497,7 +495,7 @@ private fun ReplyBubbleContent(content: BubbleContent<RoomEvent.Reply>) {
fontSize = 9.sp, fontSize = 9.sp,
text = content.message.time, text = content.message.time,
textAlign = TextAlign.End, textAlign = TextAlign.End,
color = MaterialTheme.colors.onPrimary, color = MaterialTheme.colorScheme.onPrimary,
modifier = Modifier.wrapContentSize() modifier = Modifier.wrapContentSize()
) )
SendStatus(content.message.message) SendStatus(content.message.message)
@ -522,12 +520,12 @@ private fun RowScope.SendStatus(message: RoomEvent) {
Spacer(modifier = Modifier.width(4.dp)) Spacer(modifier = Modifier.width(4.dp))
Box( Box(
modifier = Modifier modifier = Modifier
.border(0.5.dp, MaterialTheme.colors.onPrimary, CircleShape) .border(0.5.dp, MaterialTheme.colorScheme.onPrimary, CircleShape)
.size(10.dp) .size(10.dp)
.padding(2.dp) .padding(2.dp)
) { ) {
if (isSent) { if (isSent) {
Icon(imageVector = Icons.Filled.Check, "", tint = MaterialTheme.colors.onPrimary) Icon(imageVector = Icons.Filled.Check, "", tint = MaterialTheme.colorScheme.onPrimary)
} }
} }
} }
@ -536,11 +534,11 @@ private fun RowScope.SendStatus(message: RoomEvent) {
Spacer(modifier = Modifier.width(4.dp)) Spacer(modifier = Modifier.width(4.dp))
Box( Box(
modifier = Modifier modifier = Modifier
.border(0.5.dp, MaterialTheme.colors.error, CircleShape) .border(0.5.dp, MaterialTheme.colorScheme.error, CircleShape)
.size(10.dp) .size(10.dp)
.padding(2.dp) .padding(2.dp)
) { ) {
Icon(imageVector = Icons.Filled.Close, "", tint = MaterialTheme.colors.error) Icon(imageVector = Icons.Filled.Close, "", tint = MaterialTheme.colorScheme.error)
} }
} }
} }
@ -548,6 +546,7 @@ private fun RowScope.SendStatus(message: RoomEvent) {
} }
} }
@OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
private fun TextComposer(state: ComposerState.Text, onTextChange: (String) -> Unit, onSend: () -> Unit) { private fun TextComposer(state: ComposerState.Text, onTextChange: (String) -> Unit, onSend: () -> Unit) {
Row( Row(
@ -562,7 +561,7 @@ private fun TextComposer(state: ComposerState.Text, onTextChange: (String) -> Un
.align(Alignment.Bottom) .align(Alignment.Bottom)
.weight(1f) .weight(1f)
.fillMaxHeight() .fillMaxHeight()
.background(MaterialTheme.colors.onSurface.copy(alpha = TextFieldDefaults.BackgroundOpacity), RoundedCornerShape(24.dp)), .background(MaterialTheme.colorScheme.onSurface.copy(alpha = 1.0f), RoundedCornerShape(24.dp)),
contentAlignment = Alignment.TopStart, contentAlignment = Alignment.TopStart,
) { ) {
Box(Modifier.padding(14.dp)) { Box(Modifier.padding(14.dp)) {
@ -573,8 +572,8 @@ private fun TextComposer(state: ComposerState.Text, onTextChange: (String) -> Un
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
value = state.value, value = state.value,
onValueChange = { onTextChange(it) }, onValueChange = { onTextChange(it) },
cursorBrush = SolidColor(MaterialTheme.colors.primary), cursorBrush = SolidColor(MaterialTheme.colorScheme.primary),
textStyle = LocalTextStyle.current.copy(color = LocalContentColor.current.copy(LocalContentAlpha.current)), // textStyle = LocalTextStyle.current.copy(color = LocalContentColor.current.copy(LocalContentAlpha.current)),
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.Sentences, autoCorrect = true) keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.Sentences, autoCorrect = true)
) )
} }
@ -585,7 +584,7 @@ private fun TextComposer(state: ComposerState.Text, onTextChange: (String) -> Un
enabled = state.value.isNotEmpty(), enabled = state.value.isNotEmpty(),
modifier = Modifier modifier = Modifier
.clip(CircleShape) .clip(CircleShape)
.background(if (state.value.isEmpty()) Color.DarkGray else MaterialTheme.colors.primary) .background(if (state.value.isEmpty()) Color.DarkGray else MaterialTheme.colorScheme.primary)
.run { .run {
if (size.height == 0 || size.width == 0) { if (size.height == 0 || size.width == 0) {
this this
@ -604,7 +603,7 @@ private fun TextComposer(state: ComposerState.Text, onTextChange: (String) -> Un
Icon( Icon(
imageVector = Icons.Filled.Send, imageVector = Icons.Filled.Send,
contentDescription = "", contentDescription = "",
tint = MaterialTheme.colors.onPrimary, tint = MaterialTheme.colorScheme.onPrimary,
) )
} }
} }
@ -615,7 +614,10 @@ private fun AttachmentComposer(state: ComposerState.Attachments, onSend: () -> U
Box(modifier = Modifier.fillMaxSize()) { Box(modifier = Modifier.fillMaxSize()) {
val context = LocalContext.current val context = LocalContext.current
Image( Image(
modifier = Modifier.fillMaxHeight().wrapContentWidth().align(Alignment.Center), modifier = Modifier
.fillMaxHeight()
.wrapContentWidth()
.align(Alignment.Center),
painter = rememberAsyncImagePainter( painter = rememberAsyncImagePainter(
model = ImageRequest.Builder(context) model = ImageRequest.Builder(context)
.data(state.values.first().uri.value.toUri()) .data(state.values.first().uri.value.toUri())
@ -624,18 +626,21 @@ private fun AttachmentComposer(state: ComposerState.Attachments, onSend: () -> U
contentDescription = null, contentDescription = null,
) )
Box(Modifier.align(Alignment.BottomEnd).padding(12.dp)) { Box(
Modifier
.align(Alignment.BottomEnd)
.padding(12.dp)) {
IconButton( IconButton(
enabled = true, enabled = true,
modifier = Modifier modifier = Modifier
.clip(CircleShape) .clip(CircleShape)
.background(MaterialTheme.colors.primary), .background(MaterialTheme.colorScheme.primary),
onClick = onSend, onClick = onSend,
) { ) {
Icon( Icon(
imageVector = Icons.Filled.Send, imageVector = Icons.Filled.Send,
contentDescription = "", contentDescription = "",
tint = MaterialTheme.colors.onPrimary, tint = MaterialTheme.colorScheme.onPrimary,
) )
} }
} }

View File

@ -7,10 +7,9 @@ import android.os.Bundle
import android.os.Parcelable import android.os.Parcelable
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Surface import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import app.dapk.st.messenger.MessengerModule import app.dapk.st.messenger.MessengerModule
import app.dapk.st.messenger.MessengerScreen
import app.dapk.st.design.components.SmallTalkTheme import app.dapk.st.design.components.SmallTalkTheme
import app.dapk.st.core.DapkActivity import app.dapk.st.core.DapkActivity
import app.dapk.st.core.module import app.dapk.st.core.module

View File

@ -7,7 +7,7 @@ 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.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.* import androidx.compose.material3.*
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.CameraAlt import androidx.compose.material.icons.filled.CameraAlt
import androidx.compose.material.icons.filled.Settings import androidx.compose.material.icons.filled.Settings
@ -84,11 +84,11 @@ private fun ProfilePage(context: Context, viewModel: ProfileViewModel, profile:
IconButton(modifier = Modifier IconButton(modifier = Modifier
.size(avatarSize * 0.314f) .size(avatarSize * 0.314f)
.align(Alignment.BottomEnd) .align(Alignment.BottomEnd)
.background(MaterialTheme.colors.primary, shape = CircleShape) .background(MaterialTheme.colorScheme.primary, shape = CircleShape)
.padding(12.dp), .padding(12.dp),
onClick = {} onClick = {}
) { ) {
Icon(Icons.Filled.CameraAlt, contentDescription = null, tint = MaterialTheme.colors.onPrimary) Icon(Icons.Filled.CameraAlt, contentDescription = null, tint = MaterialTheme.colorScheme.onPrimary)
} }
} }
} }

View File

@ -3,7 +3,7 @@ package app.dapk.st.settings
import android.os.Bundle import android.os.Bundle
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Surface import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import app.dapk.st.core.DapkActivity import app.dapk.st.core.DapkActivity
import app.dapk.st.core.module import app.dapk.st.core.module

View File

@ -13,7 +13,7 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.* import androidx.compose.material3.*
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Visibility import androidx.compose.material.icons.filled.Visibility
import androidx.compose.material.icons.filled.VisibilityOff import androidx.compose.material.icons.filled.VisibilityOff
@ -50,7 +50,7 @@ import app.dapk.st.navigator.Navigator
import app.dapk.st.settings.SettingsEvent.* import app.dapk.st.settings.SettingsEvent.*
import app.dapk.st.settings.eventlogger.EventLogActivity import app.dapk.st.settings.eventlogger.EventLogActivity
@OptIn(ExperimentalComposeUiApi::class) @OptIn(ExperimentalComposeUiApi::class, ExperimentalMaterial3Api::class)
@Composable @Composable
internal fun SettingsScreen(viewModel: SettingsViewModel, onSignOut: () -> Unit, navigator: Navigator) { internal fun SettingsScreen(viewModel: SettingsViewModel, onSignOut: () -> Unit, navigator: Navigator) {
viewModel.ObserveEvents(onSignOut) viewModel.ObserveEvents(onSignOut)

View File

@ -3,7 +3,7 @@ package app.dapk.st.settings.eventlogger
import android.os.Bundle import android.os.Bundle
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Surface import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import app.dapk.st.core.DapkActivity import app.dapk.st.core.DapkActivity
import app.dapk.st.core.module import app.dapk.st.core.module

View File

@ -5,9 +5,9 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.* 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.material.DropdownMenu import androidx.compose.material3.DropdownMenu
import androidx.compose.material.DropdownMenuItem import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material.Text import androidx.compose.material3.Text
import androidx.compose.runtime.* import androidx.compose.runtime.*
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
@ -85,13 +85,12 @@ private fun Events(selectedPageContent: SelectedState, onExit: () -> Unit, onSel
DropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) { DropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) {
filterItems.forEachIndexed { index, item -> filterItems.forEachIndexed { index, item ->
DropdownMenuItem( DropdownMenuItem(
text = { Text(item ?: "all") },
onClick = { onClick = {
expanded = false expanded = false
onSelectTag(filterItems[index]) onSelectTag(filterItems[index])
} }
) { )
Text(item ?: "all")
}
} }
} }
} }

View File

@ -6,7 +6,7 @@ import android.os.Bundle
import android.os.Parcelable import android.os.Parcelable
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Surface import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import app.dapk.st.core.DapkActivity import app.dapk.st.core.DapkActivity
import app.dapk.st.core.module import app.dapk.st.core.module

View File

@ -6,8 +6,8 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.LazyListState
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.material.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
@ -93,7 +93,7 @@ private fun DirectoryItem(item: Item, onClick: (Item) -> Unit) {
.clickable { onClick(item) } .clickable { onClick(item) }
) { ) {
Row(Modifier.padding(20.dp)) { Row(Modifier.padding(20.dp)) {
val secondaryText = MaterialTheme.colors.onBackground.copy(alpha = 0.5f) val secondaryText = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.5f)
Box(Modifier.fillMaxHeight(), contentAlignment = Alignment.Center) { Box(Modifier.fillMaxHeight(), contentAlignment = Alignment.Center) {
CircleishAvatar(item.roomAvatarUrl?.value, roomName, size = 50.dp) CircleishAvatar(item.roomAvatarUrl?.value, roomName, size = 50.dp)
@ -109,7 +109,7 @@ private fun DirectoryItem(item: Item, onClick: (Item) -> Unit) {
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
fontFamily = FontFamily.SansSerif, fontFamily = FontFamily.SansSerif,
fontWeight = FontWeight.Medium, fontWeight = FontWeight.Medium,
color = MaterialTheme.colors.onBackground color = MaterialTheme.colorScheme.onBackground
) )
Spacer(modifier = Modifier.width(6.dp)) Spacer(modifier = Modifier.width(6.dp))
} }

View File

@ -3,7 +3,7 @@ package app.dapk.st.verification
import android.os.Bundle import android.os.Bundle
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Surface import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import app.dapk.st.design.components.SmallTalkTheme import app.dapk.st.design.components.SmallTalkTheme
import app.dapk.st.core.DapkActivity import app.dapk.st.core.DapkActivity