From 691e2bb353a9558467d12347916abad5f770c5b9 Mon Sep 17 00:00:00 2001 From: Pauline Auvray Date: Fri, 18 Aug 2023 16:24:11 +0200 Subject: [PATCH 1/2] [#613] Update buttons documentation --- docs/components/Buttons.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/components/Buttons.md b/docs/components/Buttons.md index e965559b3..269a6776a 100644 --- a/docs/components/Buttons.md +++ b/docs/components/Buttons.md @@ -54,7 +54,7 @@ OdsTextButton( text = "Text button", onClick = {}, enabled = true, - icon = painterResource(R.drawable.ic_coffee), // Optional, line can be removed if you don't need any icon + icon = OdsButtonIcon(painterResource(R.drawable.ic_coffee)), // Optional, line can be removed if you don't need any icon style = OdsTextButtonStyle.Primary ) ``` @@ -98,7 +98,7 @@ OdsOutlinedButton( text = "Outlined button", onClick = {}, enabled = true, - icon = painterResource(R.drawable.ic_coffee) // Optional, line can be removed if you don't need any icon + icon = OdsButtonIcon(painterResource(R.drawable.ic_coffee)) // Optional, line can be removed if you don't need any icon ) ``` @@ -149,7 +149,7 @@ OdsButton( text = "Contained button", onClick = {}, enabled = true, - icon = painterResource(R.drawable.ic_coffee) // Optional, line can be removed if you don't need any icon + icon = OdsButtonIcon(painterResource(R.drawable.ic_coffee)) // Optional, line can be removed if you don't need any icon ) ``` @@ -161,7 +161,7 @@ OdsButton( text = "Positive button", onClick = {}, enabled = true, - icon = painterResource(R.drawable.ic_coffee), // Optional, line can be removed if you don't need any icon + icon = OdsButtonIcon(painterResource(R.drawable.ic_coffee)), // Optional, line can be removed if you don't need any icon style = OdsButtonStyle.FunctionalPositive ) ``` From 8ca7e379060d3da944ce84dc737d7d878e76993e Mon Sep 17 00:00:00 2001 From: Pauline Auvray Date: Fri, 18 Aug 2023 16:24:30 +0200 Subject: [PATCH 2/2] [#613] Fix code implementation for buttons, use new API --- .../ods/app/ui/components/buttons/ButtonsContained.kt | 6 +++++- .../orange/ods/app/ui/components/buttons/ButtonsOutlined.kt | 6 +++++- .../com/orange/ods/app/ui/components/buttons/ButtonsText.kt | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsContained.kt b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsContained.kt index b440bc785..31dff263c 100644 --- a/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsContained.kt +++ b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsContained.kt @@ -86,7 +86,11 @@ fun ButtonsContained(customizationState: ButtonCustomizationState) { parameters = { simple("style", buttonStyle.value.fullName) if (hasFullScreenWidth) fillMaxWidth() - if (hasLeadingIcon) icon() + if (hasLeadingIcon) { + classInstance("icon", OdsButtonIcon::class.java) { + painter() + } + } if (!isEnabled) enabled(false) } ) diff --git a/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsOutlined.kt b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsOutlined.kt index b346c4337..8197bda6c 100644 --- a/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsOutlined.kt +++ b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsOutlined.kt @@ -62,7 +62,11 @@ fun ButtonsOutlined(customizationState: ButtonCustomizationState) { exhaustiveParameters = false, parameters = { if (hasFullScreenWidth) fillMaxWidth() - if (hasLeadingIcon) icon() + if (hasLeadingIcon) { + classInstance("icon", OdsButtonIcon::class.java) { + painter() + } + } if (!isEnabled) enabled(false) }) } diff --git a/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsText.kt b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsText.kt index d0ee0d5dd..1b9ab8f15 100644 --- a/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsText.kt +++ b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsText.kt @@ -81,7 +81,11 @@ fun ButtonsText(customizationState: ButtonCustomizationState) { parameters = { simple("style", textButtonStyle.value.fullName) if (hasFullScreenWidth) fillMaxWidth() - if (hasLeadingIcon) icon() + if (hasLeadingIcon) { + classInstance("icon", OdsButtonIcon::class.java) { + painter() + } + } if (!isEnabled) enabled(false) } )