Update create room screen

This commit is contained in:
Florian Renaud 2023-03-03 10:32:28 +01:00
parent 5832110a25
commit 00a19107ce
6 changed files with 40 additions and 11 deletions

View file

@ -43,7 +43,7 @@ class CreateRoomRootNode @AssistedInject constructor(
@Composable @Composable
override fun View(modifier: Modifier) { override fun View(modifier: Modifier) {
val state = presenter.present() val state = presenter.present()
CreateRoomRootView( CreateRoomRootScreen(
state = state, state = state,
modifier = modifier modifier = modifier
) )

View file

@ -17,26 +17,44 @@
package io.element.android.features.createroom.root package io.element.android.features.createroom.root
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.material3.MaterialTheme import androidx.compose.foundation.layout.displayCutoutPadding
import androidx.compose.foundation.layout.fillMaxWidth
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
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.tooling.preview.PreviewParameter
import io.element.android.libraries.designsystem.preview.ElementPreviewDark import io.element.android.libraries.designsystem.preview.ElementPreviewDark
import io.element.android.libraries.designsystem.preview.ElementPreviewLight import io.element.android.libraries.designsystem.preview.ElementPreviewLight
import io.element.android.libraries.designsystem.theme.components.Icon
import io.element.android.libraries.designsystem.theme.components.IconButton
import io.element.android.libraries.designsystem.theme.components.Text import io.element.android.libraries.designsystem.theme.components.Text
import io.element.android.libraries.designsystem.R.drawable as DrawableR
import io.element.android.libraries.ui.strings.R.string as StringR
@Composable @Composable
fun CreateRoomRootView( fun CreateRoomRootScreen(
state: CreateRoomRootState, state: CreateRoomRootState,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
onBackPressed: () -> Unit = {}
) { ) {
Box(modifier, contentAlignment = Alignment.Center) { Box(
modifier = modifier
.fillMaxWidth()
.displayCutoutPadding(),
) {
Text( Text(
"CreateRoom feature view", text = stringResource(id = StringR.create_chat),
color = MaterialTheme.colorScheme.primary, modifier = Modifier.align(Alignment.Center)
) )
IconButton(
modifier = Modifier
.align(Alignment.CenterEnd),
onClick = onBackPressed,
) {
Icon(resourceId = DrawableR.ic_close, contentDescription = stringResource(id = StringR.action_close))
}
} }
} }
@ -52,7 +70,7 @@ fun CreateRoomRootViewDarkPreview(@PreviewParameter(CreateRoomRootStateProvider:
@Composable @Composable
private fun ContentToPreview(state: CreateRoomRootState) { private fun ContentToPreview(state: CreateRoomRootState) {
CreateRoomRootView( CreateRoomRootScreen(
state = state, state = state,
) )
} }

View file

@ -43,8 +43,8 @@ fun elementColorsDark() = ElementColors(
val materialColorSchemeDark = darkColorScheme( val materialColorSchemeDark = darkColorScheme(
primary = Color.White, primary = Color.White,
onPrimary = Color.Black, onPrimary = Color.Black,
primaryContainer = Color.White, primaryContainer = Color.Black,
onPrimaryContainer = Color.Black, onPrimaryContainer = Color.White,
// TODO inversePrimary = ColorDarkTokens.InversePrimary, // TODO inversePrimary = ColorDarkTokens.InversePrimary,
secondary = DarkGrey, secondary = DarkGrey,
// TODO onSecondary = ColorDarkTokens.OnSecondary, // TODO onSecondary = ColorDarkTokens.OnSecondary,

View file

@ -44,8 +44,8 @@ fun elementColorsLight() = ElementColors(
val materialColorSchemeLight = lightColorScheme( val materialColorSchemeLight = lightColorScheme(
primary = Black_900, primary = Black_900,
onPrimary = Color.White, onPrimary = Color.White,
primaryContainer = Color.Black, primaryContainer = Color.White,
onPrimaryContainer = Color.White, onPrimaryContainer = Color.Black,
// TODO inversePrimary = ColorLightTokens.InversePrimary, // TODO inversePrimary = ColorLightTokens.InversePrimary,
secondary = Gray_200, secondary = Gray_200,
// TODO onSecondary = ColorLightTokens.OnSecondary, // TODO onSecondary = ColorLightTokens.OnSecondary,

View file

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="14dp"
android:height="14dp"
android:tint="#000000"
android:viewportWidth="14"
android:viewportHeight="14">
<path
android:fillColor="@android:color/white"
android:pathData="M12.871,2.374C13.262,1.984 13.262,1.35 12.871,0.96C12.481,0.569 11.847,0.569 11.457,0.96L6.928,5.489L2.398,0.96C2.008,0.569 1.375,0.569 0.984,0.96C0.594,1.35 0.594,1.984 0.984,2.374L5.513,6.903L0.79,11.627C0.4,12.017 0.4,12.65 0.79,13.041C1.181,13.431 1.814,13.431 2.204,13.041L6.928,8.318L11.651,13.041C12.041,13.431 12.675,13.431 13.065,13.041C13.456,12.65 13.456,12.017 13.065,11.627L8.342,6.903L12.871,2.374Z" />
</vector>

View file

@ -14,5 +14,6 @@
<string name="server_selection_server_footer">You can only connect to an existing server that supports sliding sync. Your homeserver admin will need to configure it.</string> <string name="server_selection_server_footer">You can only connect to an existing server that supports sliding sync. Your homeserver admin will need to configure it.</string>
<string name="server_selection_sliding_sync_alert_title">Server not supported</string> <string name="server_selection_sliding_sync_alert_title">Server not supported</string>
<string name="server_selection_sliding_sync_alert_message">This server currently doesn\'t support sliding sync.</string> <string name="server_selection_sliding_sync_alert_message">This server currently doesn\'t support sliding sync.</string>
<string name="create_chat">Create chat</string>
</resources> </resources>