Skip to content

Commit eb74b18

Browse files
authored
feat: rename APIs parameters for homogenization purpose (#479)
1 parent e153641 commit eb74b18

File tree

62 files changed

+266
-266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+266
-266
lines changed

app/src/main/java/com/orange/ouds/app/ui/components/ComponentCode.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ fun FunctionCall.Builder.contentDescriptionArgument(@StringRes id: Int) {
4242

4343
fun FunctionCall.Builder.onClickArgument(init: Code.Builder.() -> Unit = {}) = lambdaArgument("onClick", init)
4444

45-
fun FunctionCall.Builder.textArgument(text: String?) = typedArgument("text", text)
45+
fun FunctionCall.Builder.labelArgument(label: String?) = typedArgument("label", label)
4646

4747
fun FunctionCall.Builder.enabledArgument(boolean: Boolean) = typedArgument("enabled", boolean)

app/src/main/java/com/orange/ouds/app/ui/components/button/ButtonDemoScreen.kt

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ import com.orange.ouds.app.ui.components.Component
2626
import com.orange.ouds.app.ui.components.coloredBoxCall
2727
import com.orange.ouds.app.ui.components.contentDescriptionArgument
2828
import com.orange.ouds.app.ui.components.enabledArgument
29+
import com.orange.ouds.app.ui.components.labelArgument
2930
import com.orange.ouds.app.ui.components.onClickArgument
3031
import com.orange.ouds.app.ui.components.painterArgument
31-
import com.orange.ouds.app.ui.components.textArgument
3232
import com.orange.ouds.app.ui.utilities.composable.CodeSnippet
3333
import com.orange.ouds.app.ui.utilities.composable.CustomizationBottomSheetScaffold
3434
import com.orange.ouds.app.ui.utilities.composable.CustomizationChoiceChips
@@ -88,9 +88,9 @@ fun ButtonDemoScreen() = DemoScreen(rememberButtonDemoState()) {
8888
onSelectionChange = { id -> layout = ButtonDemoState.Layout.entries[id] }
8989
)
9090
CustomizationTextField(
91-
label = stringResource(R.string.app_components_common_text_label),
92-
value = text,
93-
onValueChange = { value -> text = value })
91+
label = stringResource(R.string.app_components_common_label_label),
92+
value = label,
93+
onValueChange = { value -> label = value })
9494
}
9595
) {
9696
DetailScreenDescription(
@@ -125,7 +125,7 @@ private fun ButtonDemo(state: ButtonDemoState) {
125125
when (layout) {
126126
ButtonDemoState.Layout.TextOnly -> {
127127
OudsButton(
128-
text = text,
128+
label = label,
129129
onClick = {},
130130
enabled = enabled,
131131
style = style,
@@ -135,7 +135,7 @@ private fun ButtonDemo(state: ButtonDemoState) {
135135
ButtonDemoState.Layout.IconAndText -> {
136136
OudsButton(
137137
icon = icon,
138-
text = text,
138+
label = label,
139139
onClick = {},
140140
enabled = enabled,
141141
style = style,
@@ -168,7 +168,7 @@ private fun ButtonDemoCodeSnippet(state: ButtonDemoState, modifier: Modifier = M
168168
}
169169
}
170170
if (layout in listOf(ButtonDemoState.Layout.TextOnly, ButtonDemoState.Layout.IconAndText)) {
171-
textArgument(text)
171+
labelArgument(label)
172172
}
173173
onClickArgument()
174174
enabledArgument(enabled)

app/src/main/java/com/orange/ouds/app/ui/components/button/ButtonDemoState.kt

+8-8
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ import com.orange.ouds.core.component.OudsButtonDefaults
2626

2727
@Composable
2828
fun rememberButtonDemoState(
29-
text: String = stringResource(id = R.string.app_components_button_label),
29+
label: String = stringResource(id = R.string.app_components_button_label),
3030
enabled: Boolean = true,
3131
onColoredBox: Boolean = false,
3232
style: OudsButton.Style = OudsButtonDefaults.Style,
3333
hierarchy: OudsButton.Hierarchy = OudsButtonDefaults.Hierarchy,
3434
layout: ButtonDemoState.Layout = ButtonDemoState.Layout.TextOnly
35-
) = rememberSaveable(text, enabled, style, hierarchy, layout, saver = ButtonDemoState.Saver) {
36-
ButtonDemoState(text, enabled, onColoredBox, style, hierarchy, layout)
35+
) = rememberSaveable(label, enabled, style, hierarchy, layout, saver = ButtonDemoState.Saver) {
36+
ButtonDemoState(label, enabled, onColoredBox, style, hierarchy, layout)
3737
}
3838

3939
class ButtonDemoState(
40-
text: String,
40+
label: String,
4141
enabled: Boolean,
4242
onColoredBox: Boolean,
4343
style: OudsButton.Style,
@@ -48,7 +48,7 @@ class ButtonDemoState(
4848
companion object {
4949

5050
val Saver = run {
51-
val textKey = "text"
51+
val labelKey = "label"
5252
val enabledKey = "enabled"
5353
val onColoredBoxKey = "onColoredBox"
5454
val styleKey = "style"
@@ -57,7 +57,7 @@ class ButtonDemoState(
5757
mapSaver(
5858
save = { state ->
5959
mapOf(
60-
textKey to state.text,
60+
labelKey to state.label,
6161
enabledKey to state.enabled,
6262
onColoredBoxKey to state.onColoredBox,
6363
styleKey to state.style,
@@ -67,7 +67,7 @@ class ButtonDemoState(
6767
},
6868
restore = { map ->
6969
ButtonDemoState(
70-
map[textKey] as String,
70+
map[labelKey] as String,
7171
map[enabledKey] as Boolean,
7272
map[onColoredBoxKey] as Boolean,
7373
map[styleKey] as OudsButton.Style,
@@ -79,7 +79,7 @@ class ButtonDemoState(
7979
}
8080
}
8181

82-
var text: String by mutableStateOf(text)
82+
var label: String by mutableStateOf(label)
8383

8484
var enabled: Boolean by mutableStateOf(enabled)
8585

app/src/main/java/com/orange/ouds/app/ui/components/checkbox/CheckboxItemDemoScreen.kt

+8-8
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ import com.orange.ouds.app.ui.components.controlitem.ControlItemEnabledCustomiza
2626
import com.orange.ouds.app.ui.components.controlitem.ControlItemErrorCustomization
2727
import com.orange.ouds.app.ui.components.controlitem.ControlItemHelperTextCustomization
2828
import com.orange.ouds.app.ui.components.controlitem.ControlItemIconCustomization
29-
import com.orange.ouds.app.ui.components.controlitem.ControlItemInvertedCustomization
29+
import com.orange.ouds.app.ui.components.controlitem.ControlItemReversedCustomization
3030
import com.orange.ouds.app.ui.components.controlitem.ControlItemReadOnlyCustomization
31-
import com.orange.ouds.app.ui.components.controlitem.ControlItemTextCustomization
31+
import com.orange.ouds.app.ui.components.controlitem.ControlItemLabelCustomization
3232
import com.orange.ouds.app.ui.components.controlitem.controlItemArguments
3333
import com.orange.ouds.app.ui.components.onClickArgument
3434
import com.orange.ouds.app.ui.utilities.composable.CodeSnippet
@@ -49,11 +49,11 @@ fun CheckboxItemDemoScreen(indeterminate: Boolean = false) = DemoScreen(remember
4949
bottomSheetContent = {
5050
ControlItemIconCustomization()
5151
ControlItemDividerCustomization()
52-
ControlItemInvertedCustomization()
52+
ControlItemReversedCustomization()
5353
ControlItemEnabledCustomization()
5454
ControlItemReadOnlyCustomization()
5555
ControlItemErrorCustomization()
56-
ControlItemTextCustomization()
56+
ControlItemLabelCustomization()
5757
ControlItemHelperTextCustomization()
5858
}
5959
) {
@@ -91,11 +91,11 @@ private fun CheckboxItemDemo(state: CheckboxItemDemoState) {
9191
CheckboxIdentifier.Second -> checkedValues.copy(second = value)
9292
}
9393
},
94-
text = text,
94+
label = label,
9595
helperText = helperText,
9696
icon = if (icon) OudsControlItem.Icon(painterResource(id = R.drawable.ic_heart)) else null,
9797
divider = divider,
98-
inverted = inverted,
98+
reversed = reversed,
9999
enabled = enabled,
100100
readOnly = readOnly,
101101
error = error
@@ -123,11 +123,11 @@ private fun IndeterminateCheckboxItemDemo(state: CheckboxItemDemoState) {
123123
}
124124
}
125125
},
126-
text = text,
126+
label = label,
127127
helperText = helperText,
128128
icon = if (icon) OudsControlItem.Icon(painterResource(id = R.drawable.ic_heart)) else null,
129129
divider = divider,
130-
inverted = inverted,
130+
reversed = reversed,
131131
enabled = enabled,
132132
readOnly = readOnly,
133133
error = error

app/src/main/java/com/orange/ouds/app/ui/components/checkbox/CheckboxItemDemoState.kt

+12-12
Original file line numberDiff line numberDiff line change
@@ -32,40 +32,40 @@ fun rememberCheckboxItemDemoState(
3232
), // only used for indeterminate checkbox item demo
3333
icon: Boolean = false,
3434
divider: Boolean = false,
35-
inverted: Boolean = false,
35+
reversed: Boolean = false,
3636
enabled: Boolean = true,
3737
readOnly: Boolean = false,
3838
error: Boolean = false,
39-
text: String = stringResource(id = R.string.app_components_common_text_label),
39+
label: String = stringResource(id = R.string.app_components_common_label_label),
4040
helperText: String? = null
4141
) = rememberSaveable(
4242
checkedValues,
4343
toggleableStateValues,
4444
icon,
4545
divider,
46-
inverted,
46+
reversed,
4747
enabled,
4848
readOnly,
4949
error,
50-
text,
50+
label,
5151
helperText,
5252
saver = CheckboxItemDemoState.Saver
5353
) {
54-
CheckboxItemDemoState(checkedValues, toggleableStateValues, icon, divider, inverted, enabled, readOnly, error, text, helperText)
54+
CheckboxItemDemoState(checkedValues, toggleableStateValues, icon, divider, reversed, enabled, readOnly, error, label, helperText)
5555
}
5656

5757
class CheckboxItemDemoState(
5858
checkedValues: Pair<Boolean, Boolean>,
5959
toggleableStateValues: Pair<ToggleableState, ToggleableState>,
6060
icon: Boolean,
6161
divider: Boolean,
62-
inverted: Boolean,
62+
reversed: Boolean,
6363
enabled: Boolean,
6464
readOnly: Boolean,
6565
error: Boolean,
66-
text: String,
66+
label: String,
6767
helperText: String?
68-
) : ControlItemDemoState(icon, divider, inverted, enabled, readOnly, error, text, helperText) {
68+
) : ControlItemDemoState(icon, divider, reversed, enabled, readOnly, error, label, helperText) {
6969
companion object {
7070
val Saver = run {
7171
val checkedValuesKey = "checkedValues"
@@ -77,11 +77,11 @@ class CheckboxItemDemoState(
7777
toggleableStateValuesKey to state.toggleableStateValues,
7878
IconKey to state.icon,
7979
DividerKey to state.divider,
80-
InvertedKey to state.inverted,
80+
ReversedKey to state.reversed,
8181
EnabledKey to state.enabled,
8282
ReadOnlyKey to state.readOnly,
8383
ErrorKey to state.error,
84-
TextKey to state.text,
84+
LabelKey to state.label,
8585
HelperTextKey to state.helperText
8686
)
8787
},
@@ -92,11 +92,11 @@ class CheckboxItemDemoState(
9292
map[toggleableStateValuesKey] as Pair<ToggleableState, ToggleableState>,
9393
map[IconKey] as Boolean,
9494
map[DividerKey] as Boolean,
95-
map[InvertedKey] as Boolean,
95+
map[ReversedKey] as Boolean,
9696
map[EnabledKey] as Boolean,
9797
map[ReadOnlyKey] as Boolean,
9898
map[ErrorKey] as Boolean,
99-
map[TextKey] as String,
99+
map[LabelKey] as String,
100100
map[HelperTextKey] as String?
101101
)
102102
}

app/src/main/java/com/orange/ouds/app/ui/components/controlitem/ControlItemDemoElements.kt

+11-11
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import androidx.compose.runtime.Composable
1616
import androidx.compose.ui.res.stringResource
1717
import com.orange.ouds.app.R
1818
import com.orange.ouds.app.ui.components.enabledArgument
19+
import com.orange.ouds.app.ui.components.labelArgument
1920
import com.orange.ouds.app.ui.components.painterArgument
20-
import com.orange.ouds.app.ui.components.textArgument
2121
import com.orange.ouds.app.ui.utilities.FunctionCall
2222
import com.orange.ouds.app.ui.utilities.composable.CustomizationSwitchListItem
2323
import com.orange.ouds.app.ui.utilities.composable.CustomizationTextField
@@ -42,11 +42,11 @@ fun <T : ControlItemDemoState> T.ControlItemDividerCustomization() {
4242
}
4343

4444
@Composable
45-
fun <T : ControlItemDemoState> T.ControlItemInvertedCustomization() {
45+
fun <T : ControlItemDemoState> T.ControlItemReversedCustomization() {
4646
CustomizationSwitchListItem(
47-
label = stringResource(R.string.app_components_controlItem_inverted_label),
48-
checked = inverted,
49-
onCheckedChange = { inverted = it },
47+
label = stringResource(R.string.app_components_controlItem_reversed_label),
48+
checked = reversed,
49+
onCheckedChange = { reversed = it },
5050
)
5151
}
5252

@@ -81,11 +81,11 @@ fun <T : ControlItemDemoState> T.ControlItemErrorCustomization() {
8181
}
8282

8383
@Composable
84-
fun <T : ControlItemDemoState> T.ControlItemTextCustomization() {
84+
fun <T : ControlItemDemoState> T.ControlItemLabelCustomization() {
8585
CustomizationTextField(
86-
label = stringResource(R.string.app_components_common_text_label),
87-
value = text,
88-
onValueChange = { value -> text = value }
86+
label = stringResource(R.string.app_components_common_label_label),
87+
value = label,
88+
onValueChange = { value -> label = value }
8989
)
9090
}
9191

@@ -99,15 +99,15 @@ fun <T : ControlItemDemoState> T.ControlItemHelperTextCustomization() {
9999
}
100100

101101
fun FunctionCall.Builder.controlItemArguments(state: ControlItemDemoState) = with(state) {
102-
textArgument(text)
102+
labelArgument(label)
103103
if (!helperText.isNullOrBlank()) typedArgument("helperText", helperText)
104104
if (icon) {
105105
constructorCallArgument<OudsControlItem.Icon>("icon") {
106106
painterArgument(R.drawable.ic_heart)
107107
}
108108
}
109109
if (!divider) typedArgument("divider", divider)
110-
if (inverted) typedArgument("inverted", inverted)
110+
if (reversed) typedArgument("reversed", reversed)
111111
if (!enabled) enabledArgument(enabled)
112112
if (readOnly) typedArgument("readOnly", readOnly)
113113
if (error) typedArgument("error", error)

app/src/main/java/com/orange/ouds/app/ui/components/controlitem/ControlItemDemoState.kt

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,31 @@ import androidx.compose.runtime.setValue
2020
abstract class ControlItemDemoState(
2121
icon: Boolean,
2222
divider: Boolean,
23-
inverted: Boolean,
23+
reversed: Boolean,
2424
enabled: Boolean,
2525
readOnly: Boolean,
2626
error: Boolean,
27-
text: String,
27+
label: String,
2828
helperText: String?
2929
) {
3030
companion object {
3131
const val IconKey = "icon"
3232
const val DividerKey = "divider"
33-
const val InvertedKey = "inverted"
33+
const val ReversedKey = "reversed"
3434
const val EnabledKey = "enabled"
3535
const val ReadOnlyKey = "readOnly"
3636
const val ErrorKey = "error"
37-
const val TextKey = "text"
37+
const val LabelKey = "label"
3838
const val HelperTextKey = "helperText"
3939
}
4040

4141
var icon: Boolean by mutableStateOf(icon)
4242
var divider: Boolean by mutableStateOf(divider)
43-
var inverted: Boolean by mutableStateOf(inverted)
43+
var reversed: Boolean by mutableStateOf(reversed)
4444
var enabled: Boolean by mutableStateOf(enabled)
4545
var readOnly: Boolean by mutableStateOf(readOnly)
4646
var error: Boolean by mutableStateOf(error)
47-
var text: String by mutableStateOf(text)
47+
var label: String by mutableStateOf(label)
4848
var helperText: String? by mutableStateOf(helperText)
4949

5050
val enabledSwitchEnabled: Boolean

0 commit comments

Comments
 (0)