feat: create components - circular progress indicator and linear progress indicator#1322
Conversation
🟢 Netlify deploy for commit 2b192f4 succeededDeploy preview: https://6a282c41b31e4527a86cf2b9--ouds-android.netlify.app |
| import com.orange.ouds.theme.OudsThemeContract | ||
|
|
||
| /** | ||
| * A Circular Progress Indicator shows the progress of a task using a circle. Useful when you need more visual focus or when space is limited. |
There was a problem hiding this comment.
We should add a TODO to remind us that we need to add the design guidelines URL when available.
Same comment for OudsLinearProgressIndicator.
| val progressIndicatorModifier = modifier.size(size) | ||
| val color = if (brandColor) OudsTheme.colorScheme.action.loading else OudsTheme.colorScheme.action.enabled | ||
| val strokeWidth = size * 0.125f // 25% of the radius | ||
| val strokeCap = if (OudsTheme.borders.radius.default.value > 0) StrokeCap.Round else StrokeCap.Square |
There was a problem hiding this comment.
The visual aspect of the circular indicator when progress is 0.75f looks better to me when using StrokeCap.Butt instead of StrokeCap.Square. Moreover, the gap size also looks closer to the one in Figma when using StrokeCap.Butt.
With StrokeCap.Square:
With StrokeCap.Butt:
By the way we also used StrokeCap.Butt in OudsTag.
| import com.orange.ouds.tokens.raw.OudsColorRawTokens | ||
| import com.orange.ouds.tokens.raw.OudsDimensionRawTokens | ||
|
|
||
| internal data class OrangeCompactProgressIndicatorTokens( |
There was a problem hiding this comment.
There was a problem hiding this comment.
I think this is an error. The mono tokens are for the integration in components that can be mono like the buttons. For the moment, I didn't replace the progress in all components.
| Column( | ||
| modifier = modifier, | ||
| horizontalAlignment = Alignment.CenterHorizontally, | ||
| verticalArrangement = Arrangement.spacedBy(spacePaddingBlock.value) |
There was a problem hiding this comment.
In the "User zoom and responsiveness" section of the Figma overview, it is written that:
Spacing between the text and the indicator must scale proportionally
So I assume we should apply the scale factor to spacePaddingBlock.
However in the Figma examples the spacing still remains the same whatever the zoom is, so I am not 100% sure about this.
There was a problem hiding this comment.
We keep this implementation without the scale factor applied, Anton will fix the Figma overview.
| val size = sizeCircularIndicator.value * scale | ||
|
|
||
| val progressIndicatorModifier = modifier.size(size) | ||
| val color = if (brandColor) OudsTheme.colorScheme.action.loading else OudsTheme.colorScheme.action.enabled |
| var track by mutableStateOf(track) | ||
|
|
||
| val progress: Float | ||
| get() = (progressText.toFloatOrNull() ?: 0f).coerceIn(0f, 1f) |
There was a problem hiding this comment.
The call to coerceIn should not be necessary because it is already done by the Material component.
| ProgressIndicatorDemoBottomSheetContent(state = state) | ||
| CustomizationTextInput( | ||
| applyTopPadding = true, | ||
| label = stringResource(R.string.app_components_progressIndicator_helperText_tech), |
There was a problem hiding this comment.
app_components_common_helperText_tech can be reused here.
| private fun CircularProgressIndicatorDemoContent(state: ProgressIndicatorDemoState) { | ||
| Box( | ||
| modifier = Modifier.fillMaxWidth(), | ||
| contentAlignment = Alignment.Center |
There was a problem hiding this comment.
If I am not wrong, the Box is not necessary because there is already a Box with centered content in DemoScreen.
Same comment for LinearProgressIndicatorDemoScreen.
|
|
||
| private fun Code.Builder.circularProgressIndicatorDemoCodeSnippet(state: ProgressIndicatorDemoState) { | ||
| with(state) { | ||
| functionCall("OudsCircularProgressIndicator") { |
There was a problem hiding this comment.
Both code snippets can probably be factorized into a single method.
| <string name="app_components_progressIndicator_brandColor_tech" translatable="false">Brand color</string> | ||
| <string name="app_components_progressIndicator_track_tech" translatable="false">Track</string> | ||
| <string name="app_components_progressIndicator_helperText_tech" translatable="false">Helper text</string> | ||
| <string name="app_components_progressIndicator_helperTextValue_tech" translatable="false">Helper text value</string> |
There was a problem hiding this comment.
This key is unused and can be removed.
231e818 to
f1e444c
Compare
Keep an OudsInternalCircularProgressIndicator for the moment
# Conflicts: # core/src/main/java/com/orange/ouds/core/utilities/OudsPreviewableComponent.kt
31bf268 to
2b192f4
Compare



No description provided.