Downgrade com.google.android.material to fix the cut-off slider#6987
Merged
seadowg merged 1 commit intogetodk:masterfrom Dec 9, 2025
Merged
Downgrade com.google.android.material to fix the cut-off slider#6987seadowg merged 1 commit intogetodk:masterfrom
seadowg merged 1 commit intogetodk:masterfrom
Conversation
seadowg
approved these changes
Dec 9, 2025
Member
|
Filed upstream in case someone else has the requirement: material-components/material-components-android#4984 |
Member
|
I bet we're going to need to do a custom implementation to support indicators at less frequent intervals (new requirement). Looks like the standard one snaps to the interval indicators: https://m3.material.io/components/sliders/guidelines#b0825f89-5029-43d5-a80c-f0520d0f1186 |
|
Tested with success Verified on Android 16, 10 Verified cases:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6974
Why is this the best possible solution? Were any other approaches considered?
The issue occurred after upgrading
com.google.android.materialat the beginning of the current release cycle. The problem is that the slider provided by that dependency does not support null values. There must always be a default value within the start–end range, but we want to support ano valuestate, just like in every other question type.To achieve this, we created an extension of the slider class and tried to mimic that behavior by setting the value to the range’s start while hiding the thumb see https://github.com/getodk/collect/blob/f725a3bf4aa6da2b59079d8596dd3e25c42d587c/collect_app/src/main/java/org/odk/collect/android/views/TrackingTouchSlider.kt. It looks like in the newest version the way the slider is drawn has changed, and now the space behind the thumb is not drawn at all. As a result, when we hide it, a blank gap appears, making the slider look cut off.
Unfortunately, there’s no easy fix for this, so the best option for now seems to be downgrading to the version that worked for us previously.
I think we may need to consider building our own slider if we want to keep supporting
no valuestates. The current solution with hiding the thumb is already a workaround, and even if we found a way to fill the blank space behind it, it would be convoluted. This might actually be a good moment to consider implementing our own slider entirely, especially since we’re also thinking about adding a new appearance for the range question type that supports translatable labels.How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
It should simply fix the issue. We don't need to spend time testing the behavior of range question types, since the only change is reverting to the previously well-tested version of
com.google.android.material.Do we need any specific form for testing your changes? If so, please attach one.
No.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
No.
Before submitting this PR, please make sure you have:
./gradlew connectedAndroidTest(or./gradlew testLab) and confirmed all checks still passDateFormatsTest