diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 83a3b16b7..6d7a5da08 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -18,12 +18,12 @@ plugins { id("com.android.application") id("com.google.gms.google-services") id("kotlin-android") - id("kotlin-kapt") id("kotlin-parcelize") id("com.google.firebase.appdistribution") id("com.google.firebase.crashlytics") id("firebase") id("dagger.hilt.android.plugin") + id("kotlin-kapt") // This must be the last statement in the plugins {} to avoid "options not recognized" warning } android { diff --git a/app/src/main/java/com/orange/ods/app/ui/MainScreen.kt b/app/src/main/java/com/orange/ods/app/ui/MainScreen.kt index 787d4d7f6..c8ac64622 100644 --- a/app/src/main/java/com/orange/ods/app/ui/MainScreen.kt +++ b/app/src/main/java/com/orange/ods/app/ui/MainScreen.kt @@ -50,8 +50,8 @@ import com.orange.ods.app.ui.search.SearchScreen import com.orange.ods.app.ui.utilities.extension.isDarkModeEnabled import com.orange.ods.app.ui.utilities.extension.isOrange import com.orange.ods.compose.theme.OdsTheme +import com.orange.ods.extension.orElse import com.orange.ods.theme.OdsThemeConfigurationContract -import com.orange.ods.utilities.extension.orElse import com.orange.ods.xml.theme.OdsXml import com.orange.ods.xml.utilities.extension.xml diff --git a/app/src/main/java/com/orange/ods/app/ui/about/AboutScreen.kt b/app/src/main/java/com/orange/ods/app/ui/about/AboutScreen.kt index 31aaf6a03..be1170a19 100644 --- a/app/src/main/java/com/orange/ods/app/ui/about/AboutScreen.kt +++ b/app/src/main/java/com/orange/ods/app/ui/about/AboutScreen.kt @@ -35,8 +35,8 @@ import com.orange.ods.app.ui.utilities.extension.versionCode import com.orange.ods.compose.component.list.OdsListItem import com.orange.ods.compose.text.OdsTextCaption import com.orange.ods.compose.text.OdsTextH4 -import com.orange.ods.utilities.extension.ifNotNull -import com.orange.ods.utilities.extension.orElse +import com.orange.ods.extension.ifNotNull +import com.orange.ods.extension.orElse @Composable fun AboutScreen(onAboutItemClick: (Long) -> Unit) { diff --git a/app/src/main/java/com/orange/ods/app/ui/components/Component.kt b/app/src/main/java/com/orange/ods/app/ui/components/Component.kt index 540bea13e..4bdf41965 100644 --- a/app/src/main/java/com/orange/ods/app/ui/components/Component.kt +++ b/app/src/main/java/com/orange/ods/app/ui/components/Component.kt @@ -98,7 +98,8 @@ sealed class Component( Variant.ButtonsDefault, Variant.ButtonsOutlined, Variant.ButtonsText, - Variant.ButtonsFunctional + Variant.ButtonsFunctional, + Variant.ButtonsTextToggleGroup ), demoScreen = { variant, _ -> if (variant != null) ComponentButtons(variant = variant) } ) @@ -293,6 +294,7 @@ sealed class Variant( object ButtonsDefault : Variant(R.string.component_buttons_high_emphasis, "${OdsComposable.OdsButton.name} with ${OdsButtonStyle.Default.name}") object ButtonsOutlined : Variant(R.string.component_buttons_medium_emphasis, OdsComposable.OdsOutlinedButton.name) object ButtonsText : Variant(R.string.component_buttons_low_emphasis, OdsComposable.OdsTextButton.name) + object ButtonsTextToggleGroup : Variant(R.string.component_button_text_toggle_group, OdsComposable.OdsTextToggleButtonsRow.name) object ButtonsFunctional : Variant(R.string.component_buttons_functional, "${OdsComposable.OdsButton.name} with a functional style") object ButtonsIcon : Variant(R.string.component_buttons_icon, OdsComposable.OdsIconButton.name) diff --git a/app/src/main/java/com/orange/ods/app/ui/components/ComponentsScreen.kt b/app/src/main/java/com/orange/ods/app/ui/components/ComponentsScreen.kt index e0b9cbc42..019b92276 100644 --- a/app/src/main/java/com/orange/ods/app/ui/components/ComponentsScreen.kt +++ b/app/src/main/java/com/orange/ods/app/ui/components/ComponentsScreen.kt @@ -31,7 +31,7 @@ import com.orange.ods.app.R import com.orange.ods.app.ui.LocalMainTopAppBarManager import com.orange.ods.app.ui.utilities.DrawableManager import com.orange.ods.compose.component.card.OdsSmallCard -import com.orange.ods.utilities.extension.orElse +import com.orange.ods.extension.orElse @Composable fun ComponentsScreen(onComponentClick: (Long) -> Unit) { diff --git a/app/src/main/java/com/orange/ods/app/ui/components/banners/ComponentBanners.kt b/app/src/main/java/com/orange/ods/app/ui/components/banners/ComponentBanners.kt index e0a2454ac..0f33b1c4c 100644 --- a/app/src/main/java/com/orange/ods/app/ui/components/banners/ComponentBanners.kt +++ b/app/src/main/java/com/orange/ods/app/ui/components/banners/ComponentBanners.kt @@ -43,7 +43,7 @@ import com.orange.ods.compose.component.banner.OdsBannerButton import com.orange.ods.compose.component.banner.OdsBannerImage import com.orange.ods.compose.component.list.OdsListItem import com.orange.ods.compose.component.list.OdsSwitchTrailing -import com.orange.ods.utilities.extension.ifNotNull +import com.orange.ods.extension.ifNotNull @OptIn(ExperimentalMaterialApi::class) @Composable diff --git a/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonCustomizationState.kt b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonCustomizationState.kt index 2c8efc05d..aca0e559e 100644 --- a/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonCustomizationState.kt +++ b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonCustomizationState.kt @@ -21,23 +21,31 @@ import com.orange.ods.compose.component.button.OdsTextButtonStyle @Composable fun rememberButtonCustomizationState( + toggleCount: MutableState = rememberSaveable { mutableStateOf(ButtonCustomizationState.MinToggleCount) }, buttonStyle: MutableState = rememberSaveable { mutableStateOf(OdsButtonStyle.Default) }, textButtonStyle: MutableState = rememberSaveable { mutableStateOf(OdsTextButtonStyle.Default) }, leadingIcon: MutableState = rememberSaveable { mutableStateOf(false) }, fullScreenWidth: MutableState = rememberSaveable { mutableStateOf(false) }, + sameItemsWeight: MutableState = rememberSaveable { mutableStateOf(false) }, enabled: MutableState = rememberSaveable { mutableStateOf(true) } ) = - remember(buttonStyle, textButtonStyle, leadingIcon, fullScreenWidth, enabled) { - ButtonCustomizationState(buttonStyle, textButtonStyle, leadingIcon, fullScreenWidth, enabled) + remember(buttonStyle, textButtonStyle, leadingIcon, fullScreenWidth, sameItemsWeight, enabled, toggleCount) { + ButtonCustomizationState(toggleCount, buttonStyle, textButtonStyle, leadingIcon, fullScreenWidth, sameItemsWeight, enabled) } class ButtonCustomizationState( + val toggleCount: MutableState, val buttonStyle: MutableState, val textButtonStyle: MutableState, val leadingIcon: MutableState, val fullScreenWidth: MutableState, + val sameItemsWeight: MutableState, val enabled: MutableState ) { + companion object { + const val MinToggleCount = 2 + const val MaxToggleCount = 3 + } val hasLeadingIcon get() = leadingIcon.value @@ -47,4 +55,7 @@ class ButtonCustomizationState( val hasFullScreenWidth get() = fullScreenWidth.value + + val hasSameItemsWeight + get() = sameItemsWeight.value } \ No newline at end of file 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 5cf3bf2fe..9d5b45ab0 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 @@ -36,7 +36,7 @@ import com.orange.ods.compose.OdsComposable import com.orange.ods.compose.component.button.OdsButton import com.orange.ods.compose.component.button.OdsButtonStyle import com.orange.ods.compose.theme.OdsDisplaySurface -import com.orange.ods.utilities.extension.fullName +import com.orange.ods.extension.fullName @Composable fun ButtonsContained(customizationState: ButtonCustomizationState) { 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 af60e59f1..91ea83926 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 @@ -36,7 +36,7 @@ import com.orange.ods.compose.OdsComposable import com.orange.ods.compose.component.button.OdsTextButton import com.orange.ods.compose.component.button.OdsTextButtonStyle import com.orange.ods.compose.theme.OdsDisplaySurface -import com.orange.ods.utilities.extension.fullName +import com.orange.ods.extension.fullName @Composable fun ButtonsText(customizationState: ButtonCustomizationState) { diff --git a/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsTextToggleGroup.kt b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsTextToggleGroup.kt new file mode 100644 index 000000000..86d7fe558 --- /dev/null +++ b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsTextToggleGroup.kt @@ -0,0 +1,122 @@ +/* + * + * Copyright 2021 Orange + * + * Use of this source code is governed by an MIT-style + * license that can be found in the LICENSE file or at + * https://opensource.org/licenses/MIT. + * / + */ + +package com.orange.ods.app.ui.components.buttons + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.dimensionResource +import com.orange.ods.app.domain.recipes.LocalRecipes +import com.orange.ods.app.ui.utilities.composable.CodeImplementationColumn +import com.orange.ods.app.ui.utilities.composable.FunctionCallCode +import com.orange.ods.compose.OdsComposable +import com.orange.ods.compose.annotation.ExperimentalOdsApi +import com.orange.ods.compose.component.button.OdsTextToggleButtonsRow +import com.orange.ods.compose.component.button.OdsTextToggleButtonsRowItem +import com.orange.ods.compose.theme.OdsDisplaySurface + +@Composable +fun ButtonsTextToggleButtonsRow(customizationState: ButtonCustomizationState) { + val textToggleButtons = + LocalRecipes.current.first().ingredients.take(ButtonCustomizationState.MaxToggleCount).map { ingredient -> + OdsTextToggleButtonsRowItem(ingredient.food.name, customizationState.isEnabled) + } + + var selectedIndex by rememberSaveable { mutableStateOf(0) } + + with(customizationState) { + Column( + modifier = Modifier + .verticalScroll(rememberScrollState()) + .padding(vertical = dimensionResource(id = com.orange.ods.R.dimen.screen_vertical_margin)) + ) { + ToggleButtonsRow( + textToggleButtons = textToggleButtons, + selectedIndex = selectedIndex, + onSelectedIndexChange = { index -> selectedIndex = index }, + toggleCount = toggleCount.value, + sameItemsWeight = hasSameItemsWeight, + ) + + Spacer(modifier = Modifier.padding(top = dimensionResource(com.orange.ods.R.dimen.spacing_s))) + + InvertedBackgroundColumn { + ToggleButtonsRow( + textToggleButtons = textToggleButtons, + selectedIndex = selectedIndex, + onSelectedIndexChange = { index -> selectedIndex = index }, + toggleCount = toggleCount.value, + sameItemsWeight = hasSameItemsWeight, + displaySurface = displaySurface + ) + } + + CodeImplementationColumn( + modifier = Modifier.padding(horizontal = dimensionResource(id = com.orange.ods.R.dimen.screen_horizontal_margin)) + ) { + FunctionCallCode( + name = OdsComposable.OdsTextToggleButtonsRow.name, + exhaustiveParameters = false, + parameters = { + list("textToggleButtons") { + textToggleButtons.take(toggleCount.value).forEach { item -> + classInstance(OdsTextToggleButtonsRowItem::class.java) { + text(item.text) + enabled(customizationState.isEnabled) + } + } + } + stringRepresentation("selectedIndex", selectedIndex) + stringRepresentation("sameItemsWeight", hasSameItemsWeight) + } + ) + } + } + } +} + +@OptIn(ExperimentalOdsApi::class) +@Composable +private fun ToggleButtonsRow( + textToggleButtons: List, + selectedIndex: Int, + onSelectedIndexChange: (Int) -> Unit, + toggleCount: Int, + sameItemsWeight: Boolean, + displaySurface: OdsDisplaySurface = OdsDisplaySurface.Default +) { + Row( + modifier = Modifier + .fillMaxWidth() + .padding(top = dimensionResource(com.orange.ods.R.dimen.spacing_m)) + .padding(horizontal = dimensionResource(com.orange.ods.R.dimen.screen_horizontal_margin)), + horizontalArrangement = Arrangement.Center + ) { + OdsTextToggleButtonsRow( + textToggleButtons = textToggleButtons.take(toggleCount), + selectedIndex = selectedIndex, + onSelectedIndexChange = onSelectedIndexChange, + sameItemsWeight = sameItemsWeight, + displaySurface = displaySurface + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/orange/ods/app/ui/components/buttons/ComponentButtons.kt b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ComponentButtons.kt index 40d230670..9d7955355 100644 --- a/app/src/main/java/com/orange/ods/app/ui/components/buttons/ComponentButtons.kt +++ b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ComponentButtons.kt @@ -29,6 +29,7 @@ import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.res.stringResource import com.orange.ods.app.R import com.orange.ods.app.ui.components.Variant +import com.orange.ods.app.ui.components.utilities.ComponentCountRow import com.orange.ods.app.ui.components.utilities.ComponentCustomizationBottomSheetScaffold import com.orange.ods.app.ui.utilities.composable.Subtitle import com.orange.ods.compose.component.button.OdsButtonStyle @@ -58,35 +59,59 @@ fun ComponentButtons(variant: Variant) { ComponentCustomizationBottomSheetScaffold( bottomSheetScaffoldState = rememberBottomSheetScaffoldState(), bottomSheetContent = { - if (variant == Variant.ButtonsFunctional) { - Subtitle(textRes = R.string.component_button_style_functional, horizontalPadding = true) - OdsChoiceChipsFlowRow( - selectedChip = buttonStyle, - modifier = Modifier.padding(horizontal = dimensionResource(id = com.orange.ods.R.dimen.screen_horizontal_margin)), - outlinedChips = true - ) { - OdsChoiceChip(textRes = R.string.component_button_style_functional_positive, value = OdsButtonStyle.FunctionalPositive) - OdsChoiceChip(textRes = R.string.component_button_style_functional_negative, value = OdsButtonStyle.FunctionalNegative) + when (variant) { + Variant.ButtonsFunctional -> { + Subtitle(textRes = R.string.component_button_style_functional, horizontalPadding = true) + OdsChoiceChipsFlowRow( + selectedChip = buttonStyle, + modifier = Modifier.padding(horizontal = dimensionResource(id = com.orange.ods.R.dimen.screen_horizontal_margin)), + outlinedChips = true + ) { + OdsChoiceChip(textRes = R.string.component_button_style_functional_positive, value = OdsButtonStyle.FunctionalPositive) + OdsChoiceChip(textRes = R.string.component_button_style_functional_negative, value = OdsButtonStyle.FunctionalNegative) + } } - } else if (variant == Variant.ButtonsText) { - Subtitle(textRes = R.string.component_style, horizontalPadding = true) - OdsChoiceChipsFlowRow( - selectedChip = textButtonStyle, - modifier = Modifier.padding(horizontal = dimensionResource(id = com.orange.ods.R.dimen.screen_horizontal_margin)), - outlinedChips = true - ) { - OdsChoiceChip(textRes = R.string.component_button_style_primary, value = OdsTextButtonStyle.Primary) - OdsChoiceChip(textRes = R.string.component_button_style_default, value = OdsTextButtonStyle.Default) + Variant.ButtonsText -> { + Subtitle(textRes = R.string.component_style, horizontalPadding = true) + OdsChoiceChipsFlowRow( + selectedChip = textButtonStyle, + modifier = Modifier.padding(horizontal = dimensionResource(id = com.orange.ods.R.dimen.screen_horizontal_margin)), + outlinedChips = true + ) { + OdsChoiceChip(textRes = R.string.component_button_style_primary, value = OdsTextButtonStyle.Primary) + OdsChoiceChip(textRes = R.string.component_button_style_default, value = OdsTextButtonStyle.Default) + } } + Variant.ButtonsTextToggleGroup -> { + ComponentCountRow( + modifier = Modifier.padding(start = dimensionResource(id = com.orange.ods.R.dimen.screen_horizontal_margin)), + title = stringResource(id = R.string.component_button_icon_toggle_count), + count = toggleCount, + minusIconContentDescription = stringResource(id = R.string.component_button_icon_toggle_remove), + plusIconContentDescription = stringResource(id = R.string.component_button_icon_toggle_add), + minCount = ButtonCustomizationState.MinToggleCount, + maxCount = ButtonCustomizationState.MaxToggleCount + ) + + OdsListItem( + text = stringResource(id = R.string.component_buttons_text_toggle_group_same_weight), + trailing = OdsSwitchTrailing(checked = sameItemsWeight) + ) + } + else -> {} } - OdsListItem( - text = stringResource(id = R.string.component_element_icon), - trailing = OdsSwitchTrailing(checked = leadingIcon) - ) - OdsListItem( - text = stringResource(id = R.string.component_button_full_screen_width), - trailing = OdsSwitchTrailing(checked = fullScreenWidth) - ) + + if (variant != Variant.ButtonsTextToggleGroup) { + OdsListItem( + text = stringResource(id = R.string.component_element_icon), + trailing = OdsSwitchTrailing(checked = leadingIcon) + ) + OdsListItem( + text = stringResource(id = R.string.component_button_full_screen_width), + trailing = OdsSwitchTrailing(checked = fullScreenWidth) + ) + } + OdsListItem( text = stringResource(id = R.string.component_state_enabled), trailing = OdsSwitchTrailing(checked = enabled) @@ -97,6 +122,7 @@ fun ComponentButtons(variant: Variant) { Variant.ButtonsPrimary, Variant.ButtonsDefault, Variant.ButtonsFunctional -> ButtonsContained(customizationState) Variant.ButtonsOutlined -> ButtonsOutlined(customizationState) Variant.ButtonsText -> ButtonsText(customizationState) + Variant.ButtonsTextToggleGroup -> ButtonsTextToggleButtonsRow(customizationState) else -> {} } } diff --git a/app/src/main/java/com/orange/ods/app/ui/components/buttons/icons/ButtonsIconToggleGroup.kt b/app/src/main/java/com/orange/ods/app/ui/components/buttons/icons/ButtonsIconToggleGroup.kt index ba3a5e217..6d471842c 100644 --- a/app/src/main/java/com/orange/ods/app/ui/components/buttons/icons/ButtonsIconToggleGroup.kt +++ b/app/src/main/java/com/orange/ods/app/ui/components/buttons/icons/ButtonsIconToggleGroup.kt @@ -89,7 +89,7 @@ fun ButtonsIconToggleGroup(customizationState: ButtonIconCustomizationState) { } } } - stringRepresentation("selectedButtonIndex", selectedIndex) + stringRepresentation("selectedIndex", selectedIndex) } ) } diff --git a/app/src/main/java/com/orange/ods/app/ui/components/listitem/ComponentListItem.kt b/app/src/main/java/com/orange/ods/app/ui/components/listitem/ComponentListItem.kt index d85067b46..4ae57cbef 100644 --- a/app/src/main/java/com/orange/ods/app/ui/components/listitem/ComponentListItem.kt +++ b/app/src/main/java/com/orange/ods/app/ui/components/listitem/ComponentListItem.kt @@ -51,7 +51,7 @@ import com.orange.ods.compose.component.list.OdsListItemIconType import com.orange.ods.compose.component.list.OdsListItemTrailing import com.orange.ods.compose.component.list.OdsSwitchTrailing import com.orange.ods.compose.component.list.iconType -import com.orange.ods.utilities.extension.orElse +import com.orange.ods.extension.orElse @OptIn(ExperimentalMaterialApi::class) @Composable diff --git a/app/src/main/java/com/orange/ods/app/ui/components/textfields/ComponentTextField.kt b/app/src/main/java/com/orange/ods/app/ui/components/textfields/ComponentTextField.kt index e193cfca7..1462b899f 100644 --- a/app/src/main/java/com/orange/ods/app/ui/components/textfields/ComponentTextField.kt +++ b/app/src/main/java/com/orange/ods/app/ui/components/textfields/ComponentTextField.kt @@ -41,8 +41,8 @@ import com.orange.ods.compose.component.list.OdsListItem import com.orange.ods.compose.component.list.OdsSwitchTrailing import com.orange.ods.compose.component.tab.OdsTab import com.orange.ods.compose.component.tab.OdsTabRow -import com.orange.ods.utilities.composable.Keyboard -import com.orange.ods.utilities.composable.keyboardAsState +import com.orange.ods.compose.utilities.composable.Keyboard +import com.orange.ods.compose.utilities.composable.keyboardAsState import kotlinx.coroutines.launch @OptIn(ExperimentalMaterialApi::class) diff --git a/app/src/main/java/com/orange/ods/app/ui/search/SearchScreen.kt b/app/src/main/java/com/orange/ods/app/ui/search/SearchScreen.kt index 33d157b8b..a9d463c38 100644 --- a/app/src/main/java/com/orange/ods/app/ui/search/SearchScreen.kt +++ b/app/src/main/java/com/orange/ods/app/ui/search/SearchScreen.kt @@ -47,9 +47,9 @@ import com.orange.ods.compose.component.list.OdsListItem import com.orange.ods.compose.component.list.OdsListItemIcon import com.orange.ods.compose.component.list.OdsListItemIconType import com.orange.ods.compose.component.list.iconType +import com.orange.ods.extension.orElse import com.orange.ods.theme.guideline.GuidelineColor import com.orange.ods.theme.guideline.toHexString -import com.orange.ods.utilities.extension.orElse @Composable fun SearchScreen( diff --git a/app/src/main/java/com/orange/ods/app/ui/utilities/DrawableManager.kt b/app/src/main/java/com/orange/ods/app/ui/utilities/DrawableManager.kt index 6f6e81678..5e2d8c5f3 100644 --- a/app/src/main/java/com/orange/ods/app/ui/utilities/DrawableManager.kt +++ b/app/src/main/java/com/orange/ods/app/ui/utilities/DrawableManager.kt @@ -16,7 +16,7 @@ import androidx.compose.runtime.Composable import com.orange.ods.app.R import com.orange.ods.app.ui.LocalThemeManager import com.orange.ods.app.ui.utilities.extension.isOrange -import com.orange.ods.utilities.extension.orElse +import com.orange.ods.extension.orElse object DrawableManager { diff --git a/app/src/main/java/com/orange/ods/app/ui/utilities/composable/CodeImplementation.kt b/app/src/main/java/com/orange/ods/app/ui/utilities/composable/CodeImplementation.kt index 62be7bb0a..e4d101d0a 100644 --- a/app/src/main/java/com/orange/ods/app/ui/utilities/composable/CodeImplementation.kt +++ b/app/src/main/java/com/orange/ods/app/ui/utilities/composable/CodeImplementation.kt @@ -31,7 +31,7 @@ import com.orange.ods.app.ui.UiFramework import com.orange.ods.compose.component.menu.OdsExposedDropdownMenu import com.orange.ods.compose.component.menu.OdsExposedDropdownMenuItem import com.orange.ods.compose.theme.OdsTheme -import com.orange.ods.utilities.extension.orElse +import com.orange.ods.extension.orElse const val IconPainterValue = "" const val ImagePainterValue = "" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4105ab2e2..5c02ebfb0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -146,6 +146,7 @@ Medium emphasis buttons Low emphasis buttons Functional buttons + Same items weight Full screen width Primary @@ -153,6 +154,7 @@ Functional Positive Negative + Toggle text button group Buttons: Icons diff --git a/changelog.md b/changelog.md index 5f1dc030a..d92c99042 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - \[App\] Add list item component ([#555](https://github.com/Orange-OpenSource/ods-android/issues/555)) +- \[App\] Add toggle text buttons group component ([#530](https://github.com/Orange-OpenSource/ods-android/issues/530)) +- \[Lib\] Add `OdsTextToggleButtonsRow` component ([#530](https://github.com/Orange-OpenSource/ods-android/issues/530)) ### Changed @@ -48,9 +50,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - \[Lib\] Fix a bug where `enabled` property of `OdsIconToggleButtonsRowItem` has no effect ([#329](https://github.com/Orange-OpenSource/ods-android/issues/329)) - -### Fixed - - \[Lib\] Vocalize icon toggle button state change in `OdsIconToggleButtonsRow` component ([#567](https://github.com/Orange-OpenSource/ods-android/issues/567)) ## [0.13.0](https://github.com/Orange-OpenSource/ods-android/compare/0.12.0...0.13.0) - 2023-06-01 diff --git a/docs/components/Buttons.md b/docs/components/Buttons.md index e4ad3dd9c..f2b83d20b 100644 --- a/docs/components/Buttons.md +++ b/docs/components/Buttons.md @@ -14,9 +14,10 @@ description: Buttons allow users to take actions, and make choices, with a singl * [Text button](#text-button) * [Outlined button](#outlined-button) * [Contained button](#contained-button) + * [Text toggle buttons group](#text-toggle-buttons-group) * [Icon button](#icon-button) * [Icon toggle button](#icon-toggle-button) - * [Icon toggle buttons row](#icon-toggle-buttons-row) + * [Icon toggle buttons group](#icon-toggle-buttons-group) * [Component specific tokens](#component-specific-tokens) --- @@ -66,6 +67,7 @@ style `@style/Widget.Orange.Button.Text` on your `Button` layout In the layout: ```xml +