Skip to content

Commit

Permalink
Fix for Attachment URL and access date shouldn't be editable. Closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Dima-Android committed Dec 3, 2024
1 parent 19ea325 commit 0282e52
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,18 @@ fun DatesRows(
detailValue = dateFormatItemDetails().format(dateAdded),
layoutType = layoutType,
showDivider = showDivider,
onRowTapped = {
//no action on tap, but still show ripple effect
}
)
FieldRow(
stringResource(id = Strings.date_modified),
dateFormatItemDetails().format(dateModified),
layoutType,
showDivider = showDivider,
onRowTapped = {
//no action on tap, but still show ripple effect
}
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ private fun ItemType(
)
) {
Column(
modifier = Modifier.padding(start = 28.dp + layoutType.calculateItemCreatorDeleteStartPadding())
) {
FieldRow(
detailTitle = stringResource(id = Strings.item_type),
Expand Down Expand Up @@ -192,17 +191,52 @@ private fun ListOfEditFieldRows(
} else {
field.valueOrAdditionalInfo
}
FieldEditableRow(
key = field.key,
fieldId = fieldId,
detailTitle = title,
detailValue = value,
layoutType = layoutType,
textColor = CustomTheme.colors.primaryContent,
onValueChange = onValueChange,
isMultilineAllowed = field.key == FieldKeys.Item.extra,
onFocusChanges = onFocusChanges
)

// We make all the fields, except title, to be not editable for standalone attachments.
if (viewState.data.isAttachment) {
FieldReadOnlyRow(layoutType, title, value)
} else {
FieldEditableRow(
key = field.key,
fieldId = fieldId,
detailTitle = title,
detailValue = value,
layoutType = layoutType,
textColor = CustomTheme.colors.primaryContent,
onValueChange = onValueChange,
isMultilineAllowed = field.key == FieldKeys.Item.extra,
onFocusChanges = onFocusChanges
)
}

}
}

@Composable
private fun FieldReadOnlyRow(
layoutType: CustomLayoutSize.LayoutType,
title: String,
value: String
) {
Column(
modifier = Modifier
.safeClickable(
interactionSource = remember { MutableInteractionSource() },
indication = ripple(),
onClick = {
//no action on tap, but still show ripple effect
}
)
) {
Column {
FieldRow(
detailTitle = title,
detailValue = value,
layoutType = layoutType,
showDivider = false
)
}
CustomDivider()
}
}

Expand Down

0 comments on commit 0282e52

Please sign in to comment.