Skip to content

feat(android): an app can set the segmented slide's speed (0.9.1) - #154

Merged
jlc488 merged 1 commit into
mainfrom
feat/segmented-slide-speed
Nov 13, 2026
Merged

jlc488 merged 1 commit into
mainfrom
feat/segmented-slide-speed

Conversation

@jlc488

@jlc488 jlc488 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

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) with DdsMotion.Standard, the same move as 0.9.0. An app can pass any spec, for example tween(400, easing = DdsMotion.Standard). AnimationSpec is how Compose components take motion settings, and DdsMotion stays the source of the durations and easings.
  • Reduced motion wins. With animations turned off on the device, the face moves at once whatever the app passed. The rule lives in segmentSlide(spec, reducedMotion) (it reads rememberReducedMotion()), so a JVM test pins it.
  • Existing calls are unchanged. Android only; the web keeps its CSS duration.

Docs: guide §12 (both languages), both changelogs (0.9.1), VERSION_NAME 0.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

  • The full Android CI command: BUILD SUCCESSFUL; SegmentedTest 6/6 and every other unit suite 0 failures / 0 errors. check-android-sources and check-docs-sync are clean.
  • Device run on SM-F971N (Android 17): SegmentedOnDeviceTest 25/25 (failures="0" errors="0" skipped="0"), including anAppCanSlowTheSlideDown. The phone was restored afterwards.

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.
@jlc488
jlc488 merged commit 47f30be into main Nov 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant