mirror of
https://github.com/bitwarden/android.git
synced 2025-02-16 20:09:59 +03:00
BIT-1599: Add element IDs to SendScreen (#1074)
This commit is contained in:
parent
b75f1d8e60
commit
cdda76bdae
3 changed files with 15 additions and 3 deletions
|
@ -26,6 +26,8 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.graphics.painter.Painter
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
@ -46,6 +48,7 @@ import kotlinx.collections.immutable.persistentListOf
|
|||
* dialog.
|
||||
* @param modifier An optional [Modifier] for this Composable, defaulting to an empty Modifier.
|
||||
* This allows the caller to specify things like padding, size, etc.
|
||||
* @param optionsTestTag The optional test tag for the options button.
|
||||
* @param supportingLabel An optional secondary text label to display beneath the label.
|
||||
* @param trailingLabelIcons An optional list of small icons to be displayed after the [label].
|
||||
*/
|
||||
|
@ -57,6 +60,7 @@ fun BitwardenListItem(
|
|||
onClick: () -> Unit,
|
||||
selectionDataList: ImmutableList<SelectionItemData>,
|
||||
modifier: Modifier = Modifier,
|
||||
optionsTestTag: String? = null,
|
||||
supportingLabel: String? = null,
|
||||
trailingLabelIcons: ImmutableList<IconResource> = persistentListOf(),
|
||||
) {
|
||||
|
@ -117,6 +121,7 @@ fun BitwardenListItem(
|
|||
if (selectionDataList.isNotEmpty()) {
|
||||
IconButton(
|
||||
onClick = { shouldShowDialog = true },
|
||||
modifier = Modifier.semantics { optionsTestTag?.let { testTag = it } },
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_more_horizontal),
|
||||
|
@ -133,12 +138,13 @@ fun BitwardenListItem(
|
|||
title = label,
|
||||
onDismissRequest = { shouldShowDialog = false },
|
||||
selectionItems = {
|
||||
selectionDataList.forEach {
|
||||
selectionDataList.forEach { itemData ->
|
||||
BitwardenBasicDialogRow(
|
||||
text = it.text,
|
||||
modifier = Modifier.semantics { itemData.testTag?.let { testTag = it } },
|
||||
text = itemData.text,
|
||||
onClick = {
|
||||
shouldShowDialog = false
|
||||
it.onClick()
|
||||
itemData.onClick()
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@ -153,6 +159,7 @@ fun BitwardenListItem(
|
|||
data class SelectionItemData(
|
||||
val text: String,
|
||||
val onClick: () -> Unit,
|
||||
val testTag: String? = null,
|
||||
)
|
||||
|
||||
@Preview(showBackground = true)
|
||||
|
|
|
@ -63,6 +63,7 @@ fun SendContent(
|
|||
onClick = sendHandlers.onTextTypeClick,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.semantics { testTag = "SendTextFilter" }
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
}
|
||||
|
@ -75,6 +76,7 @@ fun SendContent(
|
|||
onClick = sendHandlers.onFileTypeClick,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.semantics { testTag = "SendFileFilter" }
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
}
|
||||
|
@ -108,6 +110,7 @@ fun SendContent(
|
|||
null
|
||||
},
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "SendCell" }
|
||||
.padding(
|
||||
start = 16.dp,
|
||||
// There is some built-in padding to the menu button that makes up
|
||||
|
|
|
@ -76,6 +76,7 @@ fun SendListItem(
|
|||
SelectionItemData(
|
||||
text = stringResource(id = R.string.copy_link),
|
||||
onClick = onCopyClick,
|
||||
testTag = "Copy",
|
||||
),
|
||||
SelectionItemData(
|
||||
text = stringResource(id = R.string.share_link),
|
||||
|
@ -95,6 +96,7 @@ fun SendListItem(
|
|||
// Only show options if allowed
|
||||
.filter { showMoreOptions }
|
||||
.toPersistentList(),
|
||||
optionsTestTag = "Options",
|
||||
modifier = modifier,
|
||||
)
|
||||
if (shouldShowDeleteConfirmationDialog) {
|
||||
|
|
Loading…
Add table
Reference in a new issue