From 1a6f8b6b40f50d6a73aee6dfe8222aef5c3d0d78 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Sun, 4 Sep 2022 15:07:16 +0100 Subject: [PATCH] including material3 dependencies and attempting 1 for 1 swap of imports --- dependencies.gradle | 2 +- .../app/dapk/st/design/components/Empty.kt | 2 +- .../app/dapk/st/design/components/Error.kt | 4 +- .../app/dapk/st/design/components/Icon.kt | 2 +- .../dapk/st/design/components/OverflowMenu.kt | 6 +- .../app/dapk/st/design/components/Theme.kt | 10 +-- .../app/dapk/st/design/components/Toolbar.kt | 12 ++-- .../app/dapk/st/design/components/itemRow.kt | 6 +- .../app/dapk/st/core/components/Components.kt | 8 +-- .../st/directory/DirectoryListingScreen.kt | 16 ++--- .../kotlin/app/dapk/st/home/HomeScreen.kt | 9 +-- .../kotlin/app/dapk/st/home/MainActivity.kt | 6 +- .../kotlin/app/dapk/st/login/LoginScreen.kt | 4 +- .../dapk/st/messenger/MessengerActivity.kt | 2 +- .../app/dapk/st/messenger/MessengerScreen.kt | 61 ++++++++++--------- .../roomsettings/RoomSettingsActivity.kt | 3 +- .../app/dapk/st/profile/ProfileScreen.kt | 6 +- .../app/dapk/st/settings/SettingsActivity.kt | 2 +- .../app/dapk/st/settings/SettingsScreen.kt | 4 +- .../settings/eventlogger/EventLogActivity.kt | 2 +- .../st/settings/eventlogger/EventLogScreen.kt | 11 ++-- .../app/dapk/st/share/ShareEntryActivity.kt | 2 +- .../app/dapk/st/share/ShareEntryScreen.kt | 8 +-- .../st/verification/VerificationActivity.kt | 2 +- 24 files changed, 98 insertions(+), 92 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 8bb353c..ccf0112 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -106,7 +106,7 @@ ext.Dependencies.with { androidxComposeUi = "androidx.compose.ui:ui:${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}" androidxActivityCompose = "androidx.activity:activity-compose:1.4.0" kotlinCompilerExtensionVersion = "1.3.0" diff --git a/design-library/src/main/kotlin/app/dapk/st/design/components/Empty.kt b/design-library/src/main/kotlin/app/dapk/st/design/components/Empty.kt index 3b13536..5046d13 100644 --- a/design-library/src/main/kotlin/app/dapk/st/design/components/Empty.kt +++ b/design-library/src/main/kotlin/app/dapk/st/design/components/Empty.kt @@ -3,7 +3,7 @@ package app.dapk.st.design.components import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.material.Text +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier diff --git a/design-library/src/main/kotlin/app/dapk/st/design/components/Error.kt b/design-library/src/main/kotlin/app/dapk/st/design/components/Error.kt index 3242945..722ff2c 100644 --- a/design-library/src/main/kotlin/app/dapk/st/design/components/Error.kt +++ b/design-library/src/main/kotlin/app/dapk/st/design/components/Error.kt @@ -3,8 +3,8 @@ package app.dapk.st.design.components import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.material.Button -import androidx.compose.material.Text +import androidx.compose.material3.Button +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier diff --git a/design-library/src/main/kotlin/app/dapk/st/design/components/Icon.kt b/design-library/src/main/kotlin/app/dapk/st/design/components/Icon.kt index 93f9529..dcd88b4 100644 --- a/design-library/src/main/kotlin/app/dapk/st/design/components/Icon.kt +++ b/design-library/src/main/kotlin/app/dapk/st/design/components/Icon.kt @@ -6,7 +6,7 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape -import androidx.compose.material.Text +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier diff --git a/design-library/src/main/kotlin/app/dapk/st/design/components/OverflowMenu.kt b/design-library/src/main/kotlin/app/dapk/st/design/components/OverflowMenu.kt index 72a9186..6fe0965 100644 --- a/design-library/src/main/kotlin/app/dapk/st/design/components/OverflowMenu.kt +++ b/design-library/src/main/kotlin/app/dapk/st/design/components/OverflowMenu.kt @@ -1,9 +1,9 @@ package app.dapk.st.design.components import androidx.compose.foundation.layout.Box -import androidx.compose.material.DropdownMenu -import androidx.compose.material.Icon -import androidx.compose.material.IconButton +import androidx.compose.material3.DropdownMenu +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.MoreVert import androidx.compose.runtime.* diff --git a/design-library/src/main/kotlin/app/dapk/st/design/components/Theme.kt b/design-library/src/main/kotlin/app/dapk/st/design/components/Theme.kt index 46e4d3c..0554042 100644 --- a/design-library/src/main/kotlin/app/dapk/st/design/components/Theme.kt +++ b/design-library/src/main/kotlin/app/dapk/st/design/components/Theme.kt @@ -1,8 +1,8 @@ package app.dapk.st.design.components import androidx.compose.foundation.isSystemInDarkTheme -import androidx.compose.material.MaterialTheme -import androidx.compose.material.darkColors +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.darkColorScheme import androidx.compose.runtime.* import androidx.compose.ui.graphics.Color import com.google.accompanist.systemuicontroller.rememberSystemUiController @@ -12,7 +12,7 @@ private object Palette { val brandPrimary = Color(0xFFb41cca) } -private val DARK_COLOURS = darkColors( +private val DARK_COLOURS = darkColorScheme( primary = Palette.brandPrimary, onPrimary = Color(0xDDFFFFFF), ) @@ -56,9 +56,9 @@ fun SmallTalkTheme(content: @Composable () -> Unit) { val systemUiController = rememberSystemUiController() val systemInDarkTheme = isSystemInDarkTheme() 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 { systemUiController.setSystemBarsColor(backgroundColor) } diff --git a/design-library/src/main/kotlin/app/dapk/st/design/components/Toolbar.kt b/design-library/src/main/kotlin/app/dapk/st/design/components/Toolbar.kt index c79b436..706a4cb 100644 --- a/design-library/src/main/kotlin/app/dapk/st/design/components/Toolbar.kt +++ b/design-library/src/main/kotlin/app/dapk/st/design/components/Toolbar.kt @@ -4,7 +4,7 @@ import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height 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.filled.ArrowBack 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.dp +@OptIn(ExperimentalMaterial3Api::class) @Composable fun Toolbar( onNavigate: (() -> Unit)? = null, @@ -23,7 +24,7 @@ fun Toolbar( ) { val navigationIcon = foo(onNavigate) - TopAppBar( + SmallTopAppBar( modifier = Modifier.height(72.dp).run { if (offset == null) { this @@ -31,13 +32,14 @@ fun Toolbar( this.offset(offset) } }, - backgroundColor = MaterialTheme.colors.background, - navigationIcon = navigationIcon, + colors = TopAppBarDefaults.smallTopAppBarColors( + containerColor = MaterialTheme.colorScheme.background + ), + navigationIcon = navigationIcon ?: {}, title = title?.let { { Text(it, maxLines = 2) } } ?: {}, actions = actions, - elevation = 0.dp ) Divider(modifier = Modifier.fillMaxWidth(), color = Color.Black.copy(alpha = 0.2f), thickness = 0.5.dp) } diff --git a/design-library/src/main/kotlin/app/dapk/st/design/components/itemRow.kt b/design-library/src/main/kotlin/app/dapk/st/design/components/itemRow.kt index 6fdc9fa..afe2169 100644 --- a/design-library/src/main/kotlin/app/dapk/st/design/components/itemRow.kt +++ b/design-library/src/main/kotlin/app/dapk/st/design/components/itemRow.kt @@ -2,9 +2,9 @@ package app.dapk.st.design.components import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.* -import androidx.compose.material.Divider -import androidx.compose.material.Icon -import androidx.compose.material.Text +import androidx.compose.material3.Divider +import androidx.compose.material3.Icon +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier diff --git a/domains/android/compose-core/src/main/kotlin/app/dapk/st/core/components/Components.kt b/domains/android/compose-core/src/main/kotlin/app/dapk/st/core/components/Components.kt index 3a793d9..fb1ade0 100644 --- a/domains/android/compose-core/src/main/kotlin/app/dapk/st/core/components/Components.kt +++ b/domains/android/compose-core/src/main/kotlin/app/dapk/st/core/components/Components.kt @@ -4,9 +4,9 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentSize -import androidx.compose.material.CircularProgressIndicator -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text +import androidx.compose.material3.CircularProgressIndicator +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -17,7 +17,7 @@ import androidx.compose.ui.unit.sp @Composable fun Header(label: String) { 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) } } diff --git a/features/directory/src/main/kotlin/app/dapk/st/directory/DirectoryListingScreen.kt b/features/directory/src/main/kotlin/app/dapk/st/directory/DirectoryListingScreen.kt index 5042a4e..95ed701 100644 --- a/features/directory/src/main/kotlin/app/dapk/st/directory/DirectoryListingScreen.kt +++ b/features/directory/src/main/kotlin/app/dapk/st/directory/DirectoryListingScreen.kt @@ -10,8 +10,8 @@ import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.shape.CircleShape -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -155,7 +155,7 @@ private fun DirectoryItem(room: RoomFoo, onClick: (RoomId) -> Unit, clock: Clock onClick(overview.roomId) }) { 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) { 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, fontFamily = FontFamily.SansSerif, fontWeight = FontWeight.Medium, - color = MaterialTheme.colors.onBackground + color = MaterialTheme.colorScheme.onBackground ) Spacer(modifier = Modifier.width(6.dp)) @@ -184,7 +184,7 @@ private fun DirectoryItem(room: RoomFoo, onClick: (RoomId) -> Unit, clock: Clock fontSize = 12.sp, maxLines = 1, 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( Modifier .align(Alignment.Center) - .background(color = MaterialTheme.colors.primary, shape = CircleShape) + .background(color = MaterialTheme.colorScheme.primary, shape = CircleShape) .size(22.dp), contentAlignment = Alignment.Center ) { @@ -214,7 +214,7 @@ private fun DirectoryItem(room: RoomFoo, onClick: (RoomId) -> Unit, clock: Clock fontSize = unreadTextSize, fontWeight = FontWeight.Medium, 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..." }, maxLines = 1, - color = MaterialTheme.colors.primary + color = MaterialTheme.colorScheme.primary ) } else -> when (val lastMessage = overview.lastMessage) { diff --git a/features/home/src/main/kotlin/app/dapk/st/home/HomeScreen.kt b/features/home/src/main/kotlin/app/dapk/st/home/HomeScreen.kt index 250265c..5786d21 100644 --- a/features/home/src/main/kotlin/app/dapk/st/home/HomeScreen.kt +++ b/features/home/src/main/kotlin/app/dapk/st/home/HomeScreen.kt @@ -1,7 +1,7 @@ package app.dapk.st.home import androidx.compose.foundation.layout.* -import androidx.compose.material.* +import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect 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.profile.ProfileScreen +@OptIn(ExperimentalMaterial3Api::class) @Composable fun HomeScreen(homeViewModel: HomeViewModel) { SmallTalkTheme { @@ -61,10 +62,10 @@ fun HomeScreen(homeViewModel: HomeViewModel) { private fun BottomBar(state: SignedIn, homeViewModel: HomeViewModel) { Column { 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 -> when (page) { - Directory -> BottomNavigationItem( + Directory -> NavigationBarItem( icon = { Icon(page.icon, contentDescription = null) }, selected = state.page == page, onClick = { @@ -74,7 +75,7 @@ private fun BottomBar(state: SignedIn, homeViewModel: HomeViewModel) { } }, ) - Profile -> BottomNavigationItem( + Profile -> NavigationBarItem( icon = { Box(modifier = Modifier.fillMaxHeight()) { CircleishAvatar(state.me.avatarUrl?.value, state.me.displayName ?: state.me.userId.value, size = 25.dp) diff --git a/features/home/src/main/kotlin/app/dapk/st/home/MainActivity.kt b/features/home/src/main/kotlin/app/dapk/st/home/MainActivity.kt index 9f7838d..cd9872b 100644 --- a/features/home/src/main/kotlin/app/dapk/st/home/MainActivity.kt +++ b/features/home/src/main/kotlin/app/dapk/st/home/MainActivity.kt @@ -2,9 +2,9 @@ package app.dapk.st.home import android.os.Bundle import androidx.activity.compose.setContent -import androidx.compose.material.AlertDialog -import androidx.compose.material.Text -import androidx.compose.material.TextButton +import androidx.compose.material3.AlertDialog +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.lifecycle.lifecycleScope import app.dapk.st.core.DapkActivity diff --git a/features/login/src/main/kotlin/app/dapk/st/login/LoginScreen.kt b/features/login/src/main/kotlin/app/dapk/st/login/LoginScreen.kt index 28f8e0f..81eb811 100644 --- a/features/login/src/main/kotlin/app/dapk/st/login/LoginScreen.kt +++ b/features/login/src/main/kotlin/app/dapk/st/login/LoginScreen.kt @@ -4,7 +4,7 @@ import android.widget.Toast import androidx.compose.foundation.layout.* import androidx.compose.foundation.text.KeyboardActions 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.filled.Visibility 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.LoginScreenState.* -@OptIn(ExperimentalComposeUiApi::class) +@OptIn(ExperimentalComposeUiApi::class, ExperimentalMaterial3Api::class) @Composable fun LoginScreen(loginViewModel: LoginViewModel, onLoggedIn: () -> Unit) { loginViewModel.ObserveEvents(onLoggedIn) diff --git a/features/messenger/src/main/kotlin/app/dapk/st/messenger/MessengerActivity.kt b/features/messenger/src/main/kotlin/app/dapk/st/messenger/MessengerActivity.kt index 6f707f9..9b592e9 100644 --- a/features/messenger/src/main/kotlin/app/dapk/st/messenger/MessengerActivity.kt +++ b/features/messenger/src/main/kotlin/app/dapk/st/messenger/MessengerActivity.kt @@ -7,7 +7,7 @@ import android.os.Bundle import android.os.Parcelable import androidx.activity.compose.setContent import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.material.Surface +import androidx.compose.material3.Surface import androidx.compose.ui.Modifier import app.dapk.st.core.* import app.dapk.st.design.components.SmallTalkTheme diff --git a/features/messenger/src/main/kotlin/app/dapk/st/messenger/MessengerScreen.kt b/features/messenger/src/main/kotlin/app/dapk/st/messenger/MessengerScreen.kt index 690f1f5..3a4583f 100644 --- a/features/messenger/src/main/kotlin/app/dapk/st/messenger/MessengerScreen.kt +++ b/features/messenger/src/main/kotlin/app/dapk/st/messenger/MessengerScreen.kt @@ -10,7 +10,7 @@ import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.BasicTextField 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.filled.Check import androidx.compose.material.icons.filled.Close @@ -64,9 +64,7 @@ internal fun MessengerScreen(roomId: RoomId, attachments: List) { "$name is typing..." }, maxLines = 1, - color = MaterialTheme.colors.primary + color = MaterialTheme.colorScheme.primary ) } } @@ -251,7 +249,7 @@ private fun MessageImage(content: BubbleContent) { fontSize = 11.sp, text = content.message.author.displayName ?: content.message.author.id.value, maxLines = 1, - color = MaterialTheme.colors.onPrimary + color = MaterialTheme.colorScheme.onPrimary ) } @@ -274,7 +272,7 @@ private fun MessageImage(content: BubbleContent) { fontSize = 9.sp, text = "${editedPrefix ?: ""}${content.message.time}", textAlign = TextAlign.End, - color = MaterialTheme.colors.onPrimary, + color = MaterialTheme.colorScheme.onPrimary, modifier = Modifier.wrapContentSize() ) SendStatus(content.message) @@ -359,12 +357,12 @@ private fun TextBubbleContent(content: BubbleContent) { fontSize = 11.sp, text = content.message.author.displayName ?: content.message.author.id.value, maxLines = 1, - color = MaterialTheme.colors.onPrimary + color = MaterialTheme.colorScheme.onPrimary ) } Text( text = content.message.content, - color = MaterialTheme.colors.onPrimary, + color = MaterialTheme.colorScheme.onPrimary, fontSize = 15.sp, modifier = Modifier.wrapContentSize(), textAlign = TextAlign.Start, @@ -377,7 +375,7 @@ private fun TextBubbleContent(content: BubbleContent) { fontSize = 9.sp, text = "${editedPrefix ?: ""}${content.message.time}", textAlign = TextAlign.End, - color = MaterialTheme.colors.onPrimary, + color = MaterialTheme.colorScheme.onPrimary, modifier = Modifier.wrapContentSize() ) SendStatus(content.message) @@ -416,13 +414,13 @@ private fun ReplyBubbleContent(content: BubbleContent) { fontSize = 11.sp, text = replyName, maxLines = 1, - color = MaterialTheme.colors.onPrimary + color = MaterialTheme.colorScheme.onPrimary ) when (val replyingTo = content.message.replyingTo) { is Message -> { Text( text = replyingTo.content, - color = MaterialTheme.colors.onPrimary, + color = MaterialTheme.colorScheme.onPrimary, fontSize = 15.sp, modifier = Modifier.wrapContentSize(), textAlign = TextAlign.Start, @@ -457,14 +455,14 @@ private fun ReplyBubbleContent(content: BubbleContent) { fontSize = 11.sp, text = content.message.message.author.displayName ?: content.message.message.author.id.value, maxLines = 1, - color = MaterialTheme.colors.onPrimary + color = MaterialTheme.colorScheme.onPrimary ) } when (val message = content.message.message) { is Message -> { Text( text = message.content, - color = MaterialTheme.colors.onPrimary, + color = MaterialTheme.colorScheme.onPrimary, fontSize = 15.sp, modifier = Modifier.wrapContentSize(), textAlign = TextAlign.Start, @@ -497,7 +495,7 @@ private fun ReplyBubbleContent(content: BubbleContent) { fontSize = 9.sp, text = content.message.time, textAlign = TextAlign.End, - color = MaterialTheme.colors.onPrimary, + color = MaterialTheme.colorScheme.onPrimary, modifier = Modifier.wrapContentSize() ) SendStatus(content.message.message) @@ -522,12 +520,12 @@ private fun RowScope.SendStatus(message: RoomEvent) { Spacer(modifier = Modifier.width(4.dp)) Box( modifier = Modifier - .border(0.5.dp, MaterialTheme.colors.onPrimary, CircleShape) + .border(0.5.dp, MaterialTheme.colorScheme.onPrimary, CircleShape) .size(10.dp) .padding(2.dp) ) { 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)) Box( modifier = Modifier - .border(0.5.dp, MaterialTheme.colors.error, CircleShape) + .border(0.5.dp, MaterialTheme.colorScheme.error, CircleShape) .size(10.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 private fun TextComposer(state: ComposerState.Text, onTextChange: (String) -> Unit, onSend: () -> Unit) { Row( @@ -562,7 +561,7 @@ private fun TextComposer(state: ComposerState.Text, onTextChange: (String) -> Un .align(Alignment.Bottom) .weight(1f) .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, ) { Box(Modifier.padding(14.dp)) { @@ -573,8 +572,8 @@ private fun TextComposer(state: ComposerState.Text, onTextChange: (String) -> Un modifier = Modifier.fillMaxWidth(), value = state.value, onValueChange = { onTextChange(it) }, - cursorBrush = SolidColor(MaterialTheme.colors.primary), - textStyle = LocalTextStyle.current.copy(color = LocalContentColor.current.copy(LocalContentAlpha.current)), + cursorBrush = SolidColor(MaterialTheme.colorScheme.primary), +// textStyle = LocalTextStyle.current.copy(color = LocalContentColor.current.copy(LocalContentAlpha.current)), keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.Sentences, autoCorrect = true) ) } @@ -585,7 +584,7 @@ private fun TextComposer(state: ComposerState.Text, onTextChange: (String) -> Un enabled = state.value.isNotEmpty(), modifier = Modifier .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 { if (size.height == 0 || size.width == 0) { this @@ -604,7 +603,7 @@ private fun TextComposer(state: ComposerState.Text, onTextChange: (String) -> Un Icon( imageVector = Icons.Filled.Send, 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()) { val context = LocalContext.current Image( - modifier = Modifier.fillMaxHeight().wrapContentWidth().align(Alignment.Center), + modifier = Modifier + .fillMaxHeight() + .wrapContentWidth() + .align(Alignment.Center), painter = rememberAsyncImagePainter( model = ImageRequest.Builder(context) .data(state.values.first().uri.value.toUri()) @@ -624,18 +626,21 @@ private fun AttachmentComposer(state: ComposerState.Attachments, onSend: () -> U contentDescription = null, ) - Box(Modifier.align(Alignment.BottomEnd).padding(12.dp)) { + Box( + Modifier + .align(Alignment.BottomEnd) + .padding(12.dp)) { IconButton( enabled = true, modifier = Modifier .clip(CircleShape) - .background(MaterialTheme.colors.primary), + .background(MaterialTheme.colorScheme.primary), onClick = onSend, ) { Icon( imageVector = Icons.Filled.Send, contentDescription = "", - tint = MaterialTheme.colors.onPrimary, + tint = MaterialTheme.colorScheme.onPrimary, ) } } diff --git a/features/messenger/src/main/kotlin/app/dapk/st/messenger/roomsettings/RoomSettingsActivity.kt b/features/messenger/src/main/kotlin/app/dapk/st/messenger/roomsettings/RoomSettingsActivity.kt index fe564b8..9508909 100644 --- a/features/messenger/src/main/kotlin/app/dapk/st/messenger/roomsettings/RoomSettingsActivity.kt +++ b/features/messenger/src/main/kotlin/app/dapk/st/messenger/roomsettings/RoomSettingsActivity.kt @@ -7,10 +7,9 @@ import android.os.Bundle import android.os.Parcelable import androidx.activity.compose.setContent import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.material.Surface +import androidx.compose.material3.Surface import androidx.compose.ui.Modifier import app.dapk.st.messenger.MessengerModule -import app.dapk.st.messenger.MessengerScreen import app.dapk.st.design.components.SmallTalkTheme import app.dapk.st.core.DapkActivity import app.dapk.st.core.module diff --git a/features/profile/src/main/kotlin/app/dapk/st/profile/ProfileScreen.kt b/features/profile/src/main/kotlin/app/dapk/st/profile/ProfileScreen.kt index 7dbb2a3..af305b8 100644 --- a/features/profile/src/main/kotlin/app/dapk/st/profile/ProfileScreen.kt +++ b/features/profile/src/main/kotlin/app/dapk/st/profile/ProfileScreen.kt @@ -7,7 +7,7 @@ import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items 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.filled.CameraAlt import androidx.compose.material.icons.filled.Settings @@ -84,11 +84,11 @@ private fun ProfilePage(context: Context, viewModel: ProfileViewModel, profile: IconButton(modifier = Modifier .size(avatarSize * 0.314f) .align(Alignment.BottomEnd) - .background(MaterialTheme.colors.primary, shape = CircleShape) + .background(MaterialTheme.colorScheme.primary, shape = CircleShape) .padding(12.dp), onClick = {} ) { - Icon(Icons.Filled.CameraAlt, contentDescription = null, tint = MaterialTheme.colors.onPrimary) + Icon(Icons.Filled.CameraAlt, contentDescription = null, tint = MaterialTheme.colorScheme.onPrimary) } } } diff --git a/features/settings/src/main/kotlin/app/dapk/st/settings/SettingsActivity.kt b/features/settings/src/main/kotlin/app/dapk/st/settings/SettingsActivity.kt index 471d387..fd3089a 100644 --- a/features/settings/src/main/kotlin/app/dapk/st/settings/SettingsActivity.kt +++ b/features/settings/src/main/kotlin/app/dapk/st/settings/SettingsActivity.kt @@ -3,7 +3,7 @@ package app.dapk.st.settings import android.os.Bundle import androidx.activity.compose.setContent import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.material.Surface +import androidx.compose.material3.Surface import androidx.compose.ui.Modifier import app.dapk.st.core.DapkActivity import app.dapk.st.core.module diff --git a/features/settings/src/main/kotlin/app/dapk/st/settings/SettingsScreen.kt b/features/settings/src/main/kotlin/app/dapk/st/settings/SettingsScreen.kt index 9a25014..96e32ae 100644 --- a/features/settings/src/main/kotlin/app/dapk/st/settings/SettingsScreen.kt +++ b/features/settings/src/main/kotlin/app/dapk/st/settings/SettingsScreen.kt @@ -13,7 +13,7 @@ import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.text.KeyboardActions 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.filled.Visibility 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.eventlogger.EventLogActivity -@OptIn(ExperimentalComposeUiApi::class) +@OptIn(ExperimentalComposeUiApi::class, ExperimentalMaterial3Api::class) @Composable internal fun SettingsScreen(viewModel: SettingsViewModel, onSignOut: () -> Unit, navigator: Navigator) { viewModel.ObserveEvents(onSignOut) diff --git a/features/settings/src/main/kotlin/app/dapk/st/settings/eventlogger/EventLogActivity.kt b/features/settings/src/main/kotlin/app/dapk/st/settings/eventlogger/EventLogActivity.kt index 80e519d..998d72a 100644 --- a/features/settings/src/main/kotlin/app/dapk/st/settings/eventlogger/EventLogActivity.kt +++ b/features/settings/src/main/kotlin/app/dapk/st/settings/eventlogger/EventLogActivity.kt @@ -3,7 +3,7 @@ package app.dapk.st.settings.eventlogger import android.os.Bundle import androidx.activity.compose.setContent import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.material.Surface +import androidx.compose.material3.Surface import androidx.compose.ui.Modifier import app.dapk.st.core.DapkActivity import app.dapk.st.core.module diff --git a/features/settings/src/main/kotlin/app/dapk/st/settings/eventlogger/EventLogScreen.kt b/features/settings/src/main/kotlin/app/dapk/st/settings/eventlogger/EventLogScreen.kt index 43a24dd..8a7d76e 100644 --- a/features/settings/src/main/kotlin/app/dapk/st/settings/eventlogger/EventLogScreen.kt +++ b/features/settings/src/main/kotlin/app/dapk/st/settings/eventlogger/EventLogScreen.kt @@ -5,9 +5,9 @@ import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items -import androidx.compose.material.DropdownMenu -import androidx.compose.material.DropdownMenuItem -import androidx.compose.material.Text +import androidx.compose.material3.DropdownMenu +import androidx.compose.material3.DropdownMenuItem +import androidx.compose.material3.Text import androidx.compose.runtime.* import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp @@ -85,13 +85,12 @@ private fun Events(selectedPageContent: SelectedState, onExit: () -> Unit, onSel DropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) { filterItems.forEachIndexed { index, item -> DropdownMenuItem( + text = { Text(item ?: "all") }, onClick = { expanded = false onSelectTag(filterItems[index]) } - ) { - Text(item ?: "all") - } + ) } } } diff --git a/features/share-entry/src/main/kotlin/app/dapk/st/share/ShareEntryActivity.kt b/features/share-entry/src/main/kotlin/app/dapk/st/share/ShareEntryActivity.kt index da44704..7a9be90 100644 --- a/features/share-entry/src/main/kotlin/app/dapk/st/share/ShareEntryActivity.kt +++ b/features/share-entry/src/main/kotlin/app/dapk/st/share/ShareEntryActivity.kt @@ -6,7 +6,7 @@ import android.os.Bundle import android.os.Parcelable import androidx.activity.compose.setContent import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.material.Surface +import androidx.compose.material3.Surface import androidx.compose.ui.Modifier import app.dapk.st.core.DapkActivity import app.dapk.st.core.module diff --git a/features/share-entry/src/main/kotlin/app/dapk/st/share/ShareEntryScreen.kt b/features/share-entry/src/main/kotlin/app/dapk/st/share/ShareEntryScreen.kt index 1dbc7e7..6a6ffb6 100644 --- a/features/share-entry/src/main/kotlin/app/dapk/st/share/ShareEntryScreen.kt +++ b/features/share-entry/src/main/kotlin/app/dapk/st/share/ShareEntryScreen.kt @@ -6,8 +6,8 @@ import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.rememberLazyListState -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -93,7 +93,7 @@ private fun DirectoryItem(item: Item, onClick: (Item) -> Unit) { .clickable { onClick(item) } ) { 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) { CircleishAvatar(item.roomAvatarUrl?.value, roomName, size = 50.dp) @@ -109,7 +109,7 @@ private fun DirectoryItem(item: Item, onClick: (Item) -> Unit) { overflow = TextOverflow.Ellipsis, fontFamily = FontFamily.SansSerif, fontWeight = FontWeight.Medium, - color = MaterialTheme.colors.onBackground + color = MaterialTheme.colorScheme.onBackground ) Spacer(modifier = Modifier.width(6.dp)) } diff --git a/features/verification/src/main/kotlin/app/dapk/st/verification/VerificationActivity.kt b/features/verification/src/main/kotlin/app/dapk/st/verification/VerificationActivity.kt index fbb230d..b568906 100644 --- a/features/verification/src/main/kotlin/app/dapk/st/verification/VerificationActivity.kt +++ b/features/verification/src/main/kotlin/app/dapk/st/verification/VerificationActivity.kt @@ -3,7 +3,7 @@ package app.dapk.st.verification import android.os.Bundle import androidx.activity.compose.setContent import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.material.Surface +import androidx.compose.material3.Surface import androidx.compose.ui.Modifier import app.dapk.st.design.components.SmallTalkTheme import app.dapk.st.core.DapkActivity