-
Notifications
You must be signed in to change notification settings - Fork 317
Migrate SliderViewHolderFactory to compose #2877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
1008585 to
ce1b600
Compare
449efc9 to
a7c1b3a
Compare
a7c1b3a to
6e56fe5
Compare
6e56fe5 to
799c434
Compare
|
Before Migration Screen_recording_20251105_145542.mp4After Migration Screen_recording_20251105_145805.mp4 |
| Text( | ||
| text = sliderPosition.roundToInt().toString(), | ||
| color = MaterialTheme.colorScheme.onPrimary, | ||
| modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we not hardcode these things? should they use existing named values? or define new customisable params?
| 0f, | ||
| (sliderWidth - placeable.width).toFloat(), | ||
| ) | ||
| val bottomPadding = 16.dp.toPx().roundToInt() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here - see comment below
| (sliderWidth * sliderValueNormalized - placeable.width / 2).coerceIn( | ||
| 0f, | ||
| (sliderWidth - placeable.width).toFloat(), | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok - we're trying to create a bubble that shows the curernt value when the user is dragging the slider. BUT, actually nowhere we were displaying the value when the user is not dragging the slider... this is actually an ui issue. I think it would be a lot better if we just create a new text field.
similar to the examples in https://developer.android.com/develop/ui/compose/components/slider
and, we then can avoid having to do this calculation - which can be tricky to accommodate when we have custom styling...
IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).
Fixes #2858
Description
Clear and concise code change description.
Alternative(s) considered
Have you considered any alternatives? And if so, why have you chosen the approach in this PR?
Type
Choose one: (Bug fix | Feature | Documentation | Testing | Code health | Builds | Releases | Other)
Screenshots (if applicable)
Checklist
./gradlew spotlessApplyand./gradlew spotlessCheckto check my code follows the style guide of this project../gradlew checkand./gradlew connectedCheckto test my changes locally.