Repository navigation
feat(android): an app can set the segmented slide's speed (0.9.1) - #154
Merged
Merged
Conversation
The owner wants the speed chosen in the app, not changed in DDS: the default stays 200ms with the standard easing, and an app that wants a slower or faster face passes its own spec. DdsSegmentedControl(slideAnimationSpec = DdsSegmentedDefaults.SlideAnimationSpec) takes any AnimationSpec<Float>, the Compose convention for motion. Animations turned off on the device win over whatever is passed: segmentSlide() returns no slide then and the face moves at once (a JVM test pins both cases). A device test checks a 1s spec is still travelling at 350ms and ends on the new segment. Existing calls are unchanged.
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.
What
The owner wants the slide speed set in the app, not changed in DDS. Their words: "속도는 dds에서 바꾸지 말고 기본값만 정하고 앱에서 값을 정해서 보낼 수 있게" and "기본값은 지금처럼 두고, 더 느리게 하고 싶으면 앱 쪽에서 변수로 보내면 바뀌게".
DdsSegmentedControl(slideAnimationSpec: AnimationSpec<Float> = DdsSegmentedDefaults.SlideAnimationSpec). The default is unchanged: 200ms (DdsMotion.Base) withDdsMotion.Standard, the same move as 0.9.0. An app can pass any spec, for exampletween(400, easing = DdsMotion.Standard).AnimationSpecis how Compose components take motion settings, andDdsMotionstays the source of the durations and easings.segmentSlide(spec, reducedMotion)(it readsrememberReducedMotion()), so a JVM test pins it.Docs: guide §12 (both languages), both changelogs (0.9.1),
VERSION_NAME0.9.1, both READMEs.Tests
SegmentedTest: an app's spec is the one used; with animations off there is no slide for either the app's spec or the default.SegmentedOnDeviceTest.anAppCanSlowTheSlideDown: with a 1s linear spec the face is still travelling at 350ms (the default would have arrived), and it ends on the new segment.Verified locally
SegmentedTest6/6 and every other unit suite 0 failures / 0 errors.check-android-sourcesandcheck-docs-syncare clean.SegmentedOnDeviceTest25/25 (failures="0" errors="0" skipped="0"), includinganAppCanSlowTheSlideDown. The phone was restored afterwards.