Repository navigation
Conversation
🟢 Netlify deploy for commit 6127a77 succeededDeploy preview: https://6ad7350ac985d4bda50345d5--ouds-android.netlify.app |
4caba61 to
f1e5d76
Compare
5de133d to
d1840d1
Compare
# Conflicts: # theme-contract/src/main/java/com/orange/ouds/theme/OudsVersion.kt # Conflicts: # core/src/main/java/com/orange/ouds/core/component/OudsCardItem.kt # core/src/main/java/com/orange/ouds/core/component/OudsListItem.kt # core/src/main/java/com/orange/ouds/core/component/OudsSmallCardItem.kt # core/src/main/java/com/orange/ouds/core/component/OudsSmallListItem.kt
…istItem and OudsCardItem
1599fac to
7ba67b9
Compare
| helperText: String? = null, | ||
| boldLabel: Boolean = false, | ||
| @IntroducedAt("2.3-Unreleased") belowTextContent: @Composable (OudsListItemScope.() -> Unit)? = null, | ||
| @IntroducedAt("2.3-Unreleased") bottomContent: @Composable (OudsListItemScope.() -> Unit)? = null, |
There was a problem hiding this comment.
Adding new parameters here instead of the last position might break source compatibility. This is highly unlikely because this would only happen if a user called this method without any parameter name.
Until now we added new parameters at the end to ensure we don't have any source compatibility issue, but we can decide to do differently if you want.
Here is what the official guidelines says:
Since every compose is a function, the following rules apply to the component API changes:
- Parameters of the functions MUST NOT be removed.
- Newly added parameter to existing functions MUST have default expressions.
- New parameters MAY be added as a last parameter, or second to last in cases of trailing lambdas.
- The developer might decide to put the new parameter closer to other parameters that are semantically close to a new one. Keep in mind that this might break source compatibility if the user uses the component without named parameters.
Same comment for OudsCardItem.
| background: Boolean = false, | ||
| helperText: String? = null, | ||
| boldLabel: Boolean = false, | ||
| @IntroducedAt("2.3-Unreleased") belowTextContent: @Composable (OudsListItemScope.() -> Unit)? = null, |
There was a problem hiding this comment.
It's a detail and I am not even sure you need to change this because it does not have any impact and will be updated by the prepareRelease task, but we should write @IntroducedAt("2.3.0-Unreleased").
|
|
||
| Column( | ||
| modifier = modifier.sizeIn(minWidth = this.size.minWidth) | ||
| modifier = modifier.sizeIn(minHeight = minHeight(size), minWidth = this.size.minWidth) |
There was a problem hiding this comment.
Min height is also applied to the Row below (this is also the case in Figma). We can keep it to match Figma but it should have no effect on the Column.
There was a problem hiding this comment.
I think we always had this case for another component but I don't remember which one and what we decided.
| } | ||
|
|
||
| @Composable | ||
| private fun CustomContentBox( |
There was a problem hiding this comment.
As this composable does not have Box parameter (such as contentAlignment or propagateMinConstraints), what do you think or renaming it to CustomContent (or ListItemContent)?
|
|
||
| interface Badge : OudsListItemLeadingTrailing { | ||
| @ConsistentCopyVisibility | ||
| data class ExtraParameters internal constructor(internal val state: OudsListItemState) : OudsComponentContent.ExtraParameters() |
There was a problem hiding this comment.
In OudsTagAsset and OudsBulletListUnorderedAsset which also are OudsPolymorphicComponentContent, we only declare a single ExtraParameters class that contains all properties. Some properties are sometimes useless (depending on the cases) but this simplifies the code here and where we call the PolymorphicContent method.
Then the following code:
trailing?.let {
when (trailing) {
is OudsListItemLeadingTrailing.Badge -> trailing.PolymorphicContent(
extraParameters = OudsListItemLeadingTrailing.Badge.ExtraParameters(state = state)
)
is OudsListItemLeadingTrailing.Content -> trailing.PolymorphicContent(
extraParameters = OudsListItemLeadingTrailing.Content.ExtraParameters(state = state)
)
is OudsListItemLeadingTrailing.Icon -> trailing.PolymorphicContent(
extraParameters = OudsListItemLeadingTrailing.Icon.ExtraParameters(state = state)
)
is OudsListItemLeadingTrailing.Image -> trailing.PolymorphicContent()
is OudsListItemLeadingTrailing.Tag -> trailing.PolymorphicContent(
extraParameters = OudsListItemLeadingTrailing.Tag.ExtraParameters(state = state)
)
is OudsListItemLeadingTrailing.Text -> {
trailing.PolymorphicContent(
extraParameters = OudsListItemLeadingTrailing.Text.ExtraParameters(
state = state,
verticalAlignment = verticalAlignment,
size = size
)
)
}
}
}could be simplified to this:
trailing?.PolymorphicContent(
extraParameters = OudsListItemLeadingTrailing.ExtraParameters(
state = state,
verticalAlignment = verticalAlignment,
size = size
)
)However, I am not sure because the dump does not seems to change but I wonder if this might break binary compatibility because for instance OudsListItemBadge which inherits from OudsComponentContent<OudsListItemLeadingTrailing.Badge.ExtraParameters> will now inherit from OudsComponentContent<OudsListItemLeadingTrailing.ExtraParameters>.
We can discuss that point after everything else is OK if you want, because I don't know if it's worth it.
| OudsSmallListItemTrailing.Badge( | ||
| count = TrailingBadgeExampleCount, | ||
| status = trailingBadgeExampleStatus, | ||
| enabled = enabled |
There was a problem hiding this comment.
This is not needed because the badge will inherit the enabled state of the list item.
Same comment for the tag.
If we fix this, this will also impact the code snippet.
| null | ||
| } | ||
|
|
||
| val baseLabelContent: @Composable OudsListItemScope.() -> Unit = { CustomContent(state = this.state, modifier = Modifier.fillMaxWidth()) } |
There was a problem hiding this comment.
I was looking for a way to factorize calls to CustomContent and I found this solution:
val baseLabelContent: @Composable OudsListItemScope.() -> Unit = requireNotNull(getContentOrNull(true))or this one:
fun getContentOrNull(contentActivated: Boolean): @Composable (OudsListItemScope.() -> Unit)? = if (contentActivated) getContent() else null
fun getContent(): @Composable (OudsListItemScope.() -> Unit) = { CustomContent(state = state, modifier = Modifier.fillMaxWidth()) }where getContent would replace baseLabelContent.
By the way, maybe getBaseListItemContent would be more appropriate because this is a top level function.
|
|
||
| @Composable | ||
| fun CustomContent(state: OudsListItemState, modifier: Modifier = Modifier) { | ||
| val enabled = state == OudsListItemState.Enabled |
There was a problem hiding this comment.
This should be:
val enabled = state != OudsListItemState.DisabledAlso, that's very minor, but this method could be private.
|
|
||
| enum class Leading { | ||
| None, Icon, Image | ||
| enum class Leading(val availableForSizes: List<Size> = listOf(Size.Default, Size.Small)) { |
There was a problem hiding this comment.
For other components, we chose to disabled the entries rather than hiding them. For instance for the FAB:
val enabledLayouts: List<Layout>
get() = when (size) {
Size.Small,
Size.Large -> listOf(Layout.IconOnly)
Size.Medium -> Layout.entries
}I don't know if we must follow the same pattern here or if we should hide them as you did.
| <string name="app_components_listItem_specificComponentExampleAlertLabel_label">مثال %1$s</string> | ||
| <string name="app_components_listItem_componentExampleAlertLabel_label">مثال على مكوّن</string> | ||
| <string name="app_components_listItem_componentExampleAlertDescription_text">يرجى الاطلاع على إعدادات المكون المحددة للحصول على خيارات التكوين الكاملة.</string> | ||
| <string name="app_components_listItem_contentExempleAlertDescription_text">استخدم عنصر "Content" للمحتوى المخصص الذي لا يمكن تمثيله بواسطة أي عنصر آخر موجود؛ إذ يوفر هذا العنصر مرونةً لتلبية متطلبات محددة للمنتج، ولكن ينبغي استخدامه كاستثناء وليس كحلٍ افتراضي.</string> |
There was a problem hiding this comment.
What do you think about renaming Example to Settings?
Also, there is a typo here, this should be Example instead of Exemple.
No description provided.