Skip to content

Commit 0d0708e

Browse files
committed
Review: Content of different chips in demo screen is now different
1 parent c7f19dd commit 0d0708e

5 files changed

Lines changed: 27 additions & 19 deletions

File tree

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ import androidx.annotation.StringRes
1616
import androidx.compose.foundation.layout.Arrangement
1717
import androidx.compose.foundation.layout.FlowRow
1818
import androidx.compose.foundation.layout.padding
19+
import androidx.compose.material.icons.Icons
20+
import androidx.compose.material.icons.filled.Person
21+
import androidx.compose.material.icons.filled.Phone
1922
import androidx.compose.runtime.Composable
2023
import androidx.compose.ui.Modifier
21-
import androidx.compose.ui.res.painterResource
2224
import androidx.compose.ui.res.stringResource
2325
import com.orange.ouds.app.R
2426
import com.orange.ouds.app.ui.components.contentDescriptionArgument
@@ -55,15 +57,17 @@ fun ChipDemoContent(
5557
state: ChipDemoState,
5658
content: @Composable (index: Int, icon: OudsChip.Icon) -> Unit
5759
) {
60+
val icons = listOf(
61+
Icons.Filled.Person,
62+
Icons.Filled.Phone
63+
)
5864
FlowRow(horizontalArrangement = Arrangement.spacedBy(OudsTheme.spaces.fixed.short)) {
59-
val icon = OudsChip.Icon(
60-
painter = painterResource(id = R.drawable.ic_heart),
61-
contentDescription = stringResource(id = R.string.app_components_common_icon_a11y)
62-
)
63-
with(state) {
64-
repeat(ChipDemoState.ChipCount) { index ->
65-
content(index, icon)
66-
}
65+
repeat(ChipDemoState.ChipCount) { index ->
66+
val icon = OudsChip.Icon(
67+
imageVector = icons[index % icons.count()],
68+
contentDescription = stringResource(id = R.string.app_components_common_icon_a11y)
69+
)
70+
content(index, icon)
6771
}
6872
}
6973
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ fun FilterChipDemoScreen() {
3333

3434
@Composable
3535
private fun FilterChipDemoContent(state: FilterChipDemoState) {
36-
val label = stringResource(R.string.app_components_chip_filterChip_label)
3736
ChipDemoContent(state = state) { index, icon ->
37+
val label = stringResource(R.string.app_components_chip_filterChip_filterChip_label, index + 1)
3838
with(state) {
3939
val selected = selectedValues[index]
4040
val onClick = { selectedValues = selectedValues.toMutableList().also { it[index] = !it[index] } }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fun SuggestionChipDemoScreen() {
3434
@Composable
3535
private fun SuggestionChipDemoContent(state: SuggestionChipDemoState) {
3636
ChipDemoContent(state = state) { index, icon ->
37-
val label = stringResource(R.string.app_components_chip_suggestionChip_label)
37+
val label = stringResource(R.string.app_components_chip_suggestionChip_suggestionChip_label, index + 1)
3838
with(state) {
3939
when (layout) {
4040
ChipDemoState.Layout.TextOnly -> {

app/src/main/res/values-ar/strings.xml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,9 @@
112112
<string name="app_components_button_description_text">الأزرار تسمح للمستخدمين باتخاذ قرارات أو أداء إجراء. لها عدة أنماط لتلبية احتياجات مختلفة.</string>
113113
<string name="app_components_button_hierarchy_label">التسلسل</string>
114114

115-
<!-- Components: link -->
116-
<string name="app_components_link_label">رابط</string>
117-
<string name="app_components_link_description_text">تُستخدم الروابط لتوجيه المستخدمين إلى موارد أو أقسام إضافية، سواء كانت داخلية (ضمن نفس التطبيق) أو خارجية (مثل موقع إلكتروني أو مستند).</string>
118-
<string name="app_components_link_backLayout_label">عوده</string>
119-
<string name="app_components_link_nextLayout_label">التالي</string>
120-
<string name="app_components_link_size_label">حجم</string>
115+
<!-- Components: checkbox -->
121116
<string name="app_components_checkbox_label">مربع اختيار</string>
122117
<string name="app_components_checkbox_description_text"> تتيح خانات الاختيار للمستخدمين تحديد خيار واحد أو عدة خيارات من قائمة، أو تفعيل/تعطيل إعدادات، أو تأكيد إجراء معين.</string>
123-
124-
<!-- Components: checkbox -->
125118
<string name="app_components_checkbox_checkbox_label">خانة اختيار</string>
126119
<string name="app_components_checkbox_checkboxItem_label">عنصر خانة اختيار</string>
127120
<string name="app_components_checkbox_indeterminateCheckbox_label">خانة اختيار غير محدد</string>
@@ -131,7 +124,9 @@
131124
<string name="app_components_chip_label">Chip</string>
132125
<string name="app_components_chip_description_text">Chips help people enter information, make selections, filter content, or trigger actions.</string>
133126
<string name="app_components_chip_filterChip_label">Filter chip</string>
127+
<string name="app_components_chip_filterChip_filterChip_label">Filter %d</string>
134128
<string name="app_components_chip_suggestionChip_label">Suggestion chip</string>
129+
<string name="app_components_chip_suggestionChip_suggestionChip_label">Suggestion %d</string>
135130

136131
<!-- Components: control item (common strings for checkbox/radio/switch items) -->
137132
<string name="app_components_controlItem_helperText_label">نص المساعدة</string>
@@ -146,6 +141,13 @@
146141
<string name="app_components_divider_horizontalDivider_label">فاصل أفقي</string>
147142
<string name="app_components_divider_verticalDivider_label">فاصل عمودي</string>
148143

144+
<!-- Components: link -->
145+
<string name="app_components_link_label">رابط</string>
146+
<string name="app_components_link_description_text">تُستخدم الروابط لتوجيه المستخدمين إلى موارد أو أقسام إضافية، سواء كانت داخلية (ضمن نفس التطبيق) أو خارجية (مثل موقع إلكتروني أو مستند).</string>
147+
<string name="app_components_link_backLayout_label">عوده</string>
148+
<string name="app_components_link_nextLayout_label">التالي</string>
149+
<string name="app_components_link_size_label">حجم</string>
150+
149151
<!-- Components: radio button -->
150152
<string name="app_components_radioButton_label">زر الاختيار</string>
151153
<string name="app_components_radioButton_description_text">يُستخدم زر الاختيار لتمكين المستخدم من تحديد خيار واحد فقط من بين مجموعة خيارات حصرية. يُعرض عادةً كدائرة صغيرة مع تسمية، وتُملأ عند التحديد.</string>

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@
135135
<string name="app_components_chip_label">Chip</string>
136136
<string name="app_components_chip_description_text">Chips help people enter information, make selections, filter content, or trigger actions.</string>
137137
<string name="app_components_chip_filterChip_label">Filter chip</string>
138+
<string name="app_components_chip_filterChip_filterChip_label">Filter %d</string>
138139
<string name="app_components_chip_suggestionChip_label">Suggestion chip</string>
140+
<string name="app_components_chip_suggestionChip_suggestionChip_label">Suggestion %d</string>
139141

140142
<!-- Components: control item (common strings for checkbox/radio/switch items) -->
141143
<string name="app_components_controlItem_helperText_label">Helper text</string>

0 commit comments

Comments
 (0)