Fix duplicated strings and use back button
This commit is contained in:
committed by
Florian Renaud
parent
7f0590b304
commit
db83f4bf6d
@@ -39,6 +39,7 @@ import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||
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.DockedSearchBar
|
||||
import io.element.android.libraries.designsystem.theme.components.Icon
|
||||
@@ -133,9 +134,7 @@ fun CreateRoomSearchBar(
|
||||
},
|
||||
leadingIcon = if (active.value) {
|
||||
{
|
||||
IconButton(onClick = { closeSearchBar() }) {
|
||||
Icon(DrawableR.drawable.ic_arrow_back, stringResource(StringR.string.a11y_back))
|
||||
}
|
||||
BackButton(onClick = { closeSearchBar() })
|
||||
}
|
||||
} else null,
|
||||
trailingIcon = {
|
||||
|
||||
@@ -104,7 +104,7 @@ fun ChangeServerView(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = {},
|
||||
navigationIcon = { BackButton(action = onBackPressed, enabled = interactionEnabled) }
|
||||
navigationIcon = { BackButton(onClick = onBackPressed, enabled = interactionEnabled) }
|
||||
)
|
||||
}
|
||||
) { padding ->
|
||||
@@ -192,7 +192,7 @@ fun ChangeServerView(
|
||||
IconButton(onClick = {
|
||||
homeserverFieldState = ""
|
||||
}, 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,
|
||||
|
||||
@@ -101,7 +101,7 @@ fun LoginRootScreen(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = {},
|
||||
navigationIcon = { BackButton(action = onBackPressed, enabled = interactionEnabled) },
|
||||
navigationIcon = { BackButton(onClick = onBackPressed, enabled = interactionEnabled) },
|
||||
)
|
||||
}
|
||||
) { padding ->
|
||||
@@ -267,7 +267,7 @@ internal fun LoginForm(
|
||||
IconButton(onClick = {
|
||||
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,
|
||||
|
||||
@@ -16,32 +16,31 @@
|
||||
|
||||
package io.element.android.libraries.designsystem.theme.components
|
||||
|
||||
import androidx.annotation.DrawableRes
|
||||
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.ui.Modifier
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||
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
|
||||
fun BackButton(
|
||||
action: () -> Unit,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
icon: ImageVector = Icons.Default.ArrowBack,
|
||||
contentDescription: String = stringResource(StringR.action_back),
|
||||
@DrawableRes icon: Int = DrawableR.drawable.ic_arrow_back,
|
||||
contentDescription: String = stringResource(StringR.string.a11y_back),
|
||||
enabled: Boolean = true
|
||||
) {
|
||||
IconButton(
|
||||
modifier = modifier,
|
||||
onClick = action,
|
||||
onClick = onClick,
|
||||
enabled = enabled,
|
||||
) {
|
||||
Icon(imageVector = icon, contentDescription = contentDescription)
|
||||
Icon(resourceId = icon, contentDescription = contentDescription)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +55,7 @@ internal fun BackButtonPreviewDark() = ElementPreviewDark { ContentToPreview() }
|
||||
@Composable
|
||||
private fun ContentToPreview() {
|
||||
Column {
|
||||
BackButton(action = { }, enabled = true, contentDescription = "Back")
|
||||
BackButton(action = { }, enabled = false, contentDescription = "Back")
|
||||
BackButton(onClick = { }, enabled = true, contentDescription = "Back")
|
||||
BackButton(onClick = { }, enabled = false, contentDescription = "Back")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,19 @@
|
||||
<resources>
|
||||
|
||||
<!-- Add new strings for Element X Android here -->
|
||||
<string name="action_back">Back</string>
|
||||
<string name="action_clear">Clear</string>
|
||||
|
||||
<!-- Common -->
|
||||
<string name="a11y_back">Back</string>
|
||||
<string name="a11y_clear">Clear</string>
|
||||
<!-- Login -->
|
||||
<string name="login_form_title">Enter your details</string>
|
||||
<string name="ex_login_username_hint">Email or username</string>
|
||||
<string name="login_show_password">Show 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="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_message">This server currently doesn\'t support sliding sync.</string>
|
||||
<string name="a11y_back">Back</string>
|
||||
<string name="a11y_clear">Clear</string>
|
||||
<!-- Create room -->
|
||||
<string name="search_for_someone">Search for someone</string>
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user