Fix duplicated strings and use back button
This commit is contained in:
parent
7f0590b304
commit
db83f4bf6d
5 changed files with 21 additions and 24 deletions
|
|
@ -39,6 +39,7 @@ import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
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.BackButton
|
||||||
import io.element.android.libraries.designsystem.theme.components.CenterAlignedTopAppBar
|
import io.element.android.libraries.designsystem.theme.components.CenterAlignedTopAppBar
|
||||||
import io.element.android.libraries.designsystem.theme.components.DockedSearchBar
|
import io.element.android.libraries.designsystem.theme.components.DockedSearchBar
|
||||||
import io.element.android.libraries.designsystem.theme.components.Icon
|
import io.element.android.libraries.designsystem.theme.components.Icon
|
||||||
|
|
@ -133,9 +134,7 @@ fun CreateRoomSearchBar(
|
||||||
},
|
},
|
||||||
leadingIcon = if (active.value) {
|
leadingIcon = if (active.value) {
|
||||||
{
|
{
|
||||||
IconButton(onClick = { closeSearchBar() }) {
|
BackButton(onClick = { closeSearchBar() })
|
||||||
Icon(DrawableR.drawable.ic_arrow_back, stringResource(StringR.string.a11y_back))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else null,
|
} else null,
|
||||||
trailingIcon = {
|
trailingIcon = {
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ fun ChangeServerView(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {},
|
title = {},
|
||||||
navigationIcon = { BackButton(action = onBackPressed, enabled = interactionEnabled) }
|
navigationIcon = { BackButton(onClick = onBackPressed, enabled = interactionEnabled) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { padding ->
|
) { padding ->
|
||||||
|
|
@ -192,7 +192,7 @@ fun ChangeServerView(
|
||||||
IconButton(onClick = {
|
IconButton(onClick = {
|
||||||
homeserverFieldState = ""
|
homeserverFieldState = ""
|
||||||
}, enabled = interactionEnabled) {
|
}, enabled = interactionEnabled) {
|
||||||
Icon(imageVector = Icons.Filled.Close, contentDescription = stringResource(StringR.string.action_clear))
|
Icon(imageVector = Icons.Filled.Close, contentDescription = stringResource(StringR.string.a11y_clear))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else null,
|
} else null,
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ fun LoginRootScreen(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {},
|
title = {},
|
||||||
navigationIcon = { BackButton(action = onBackPressed, enabled = interactionEnabled) },
|
navigationIcon = { BackButton(onClick = onBackPressed, enabled = interactionEnabled) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { padding ->
|
) { padding ->
|
||||||
|
|
@ -267,7 +267,7 @@ internal fun LoginForm(
|
||||||
IconButton(onClick = {
|
IconButton(onClick = {
|
||||||
loginFieldState = ""
|
loginFieldState = ""
|
||||||
}) {
|
}) {
|
||||||
Icon(imageVector = Icons.Filled.Close, contentDescription = stringResource(StringR.string.action_clear))
|
Icon(imageVector = Icons.Filled.Close, contentDescription = stringResource(StringR.string.a11y_clear))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else null,
|
} else null,
|
||||||
|
|
|
||||||
|
|
@ -16,32 +16,31 @@
|
||||||
|
|
||||||
package io.element.android.libraries.designsystem.theme.components
|
package io.element.android.libraries.designsystem.theme.components
|
||||||
|
|
||||||
|
import androidx.annotation.DrawableRes
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.material.icons.Icons
|
|
||||||
import androidx.compose.material.icons.filled.ArrowBack
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
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.ui.strings.R.string as StringR
|
import io.element.android.libraries.designsystem.R as DrawableR
|
||||||
|
import io.element.android.libraries.ui.strings.R as StringR
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun BackButton(
|
fun BackButton(
|
||||||
action: () -> Unit,
|
onClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
icon: ImageVector = Icons.Default.ArrowBack,
|
@DrawableRes icon: Int = DrawableR.drawable.ic_arrow_back,
|
||||||
contentDescription: String = stringResource(StringR.action_back),
|
contentDescription: String = stringResource(StringR.string.a11y_back),
|
||||||
enabled: Boolean = true
|
enabled: Boolean = true
|
||||||
) {
|
) {
|
||||||
IconButton(
|
IconButton(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
onClick = action,
|
onClick = onClick,
|
||||||
enabled = enabled,
|
enabled = enabled,
|
||||||
) {
|
) {
|
||||||
Icon(imageVector = icon, contentDescription = contentDescription)
|
Icon(resourceId = icon, contentDescription = contentDescription)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,7 +55,7 @@ internal fun BackButtonPreviewDark() = ElementPreviewDark { ContentToPreview() }
|
||||||
@Composable
|
@Composable
|
||||||
private fun ContentToPreview() {
|
private fun ContentToPreview() {
|
||||||
Column {
|
Column {
|
||||||
BackButton(action = { }, enabled = true, contentDescription = "Back")
|
BackButton(onClick = { }, enabled = true, contentDescription = "Back")
|
||||||
BackButton(action = { }, enabled = false, contentDescription = "Back")
|
BackButton(onClick = { }, enabled = false, contentDescription = "Back")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,20 +2,19 @@
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Add new strings for Element X Android here -->
|
<!-- Add new strings for Element X Android here -->
|
||||||
<string name="action_back">Back</string>
|
<!-- Common -->
|
||||||
<string name="action_clear">Clear</string>
|
<string name="a11y_back">Back</string>
|
||||||
|
<string name="a11y_clear">Clear</string>
|
||||||
|
<!-- Login -->
|
||||||
<string name="login_form_title">Enter your details</string>
|
<string name="login_form_title">Enter your details</string>
|
||||||
<string name="ex_login_username_hint">Email or username</string>
|
<string name="ex_login_username_hint">Email or username</string>
|
||||||
<string name="login_show_password">Show password</string>
|
<string name="login_show_password">Show password</string>
|
||||||
<string name="login_hide_password">Hide password</string>
|
<string name="login_hide_password">Hide password</string>
|
||||||
|
|
||||||
<string name="ex_choose_server_subtitle">What is the address of your server?</string>
|
<string name="ex_choose_server_subtitle">What is the address of your server?</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_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="a11y_back">Back</string>
|
<!-- Create room -->
|
||||||
<string name="a11y_clear">Clear</string>
|
|
||||||
<string name="search_for_someone">Search for someone</string>
|
<string name="search_for_someone">Search for someone</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue