217 Commits

Author SHA1 Message Date
pekingme
57f3cdbda3 [Tokens] Updated token version to 31.0.0
PiperOrigin-RevId: 859699661
2026-01-22 19:49:30 +00:00
dsn5ft
00e5edac88 [i18n] Update string translations
(copyright year + snackbar close button content description)

PiperOrigin-RevId: 853819674
2026-01-12 16:16:19 +00:00
Material Design Team
0b669dab7d [Slider] Adjust thumb-track gap only for the pressed thumb
The gap between the thumb and track is now calculated on the fly for each thumb, considering whether the thumb is currently pressed.

PiperOrigin-RevId: 839683792
2025-12-04 16:46:53 +00:00
Material Design Team
7fc1c4ff14 [Slider][A11y] Fix D-Pad focus trap on horizontal sliders.
On D-Pad controlled devices like Android TV, pressing up or down on a focused horizontal slider would change its value instead of moving focus to an adjacent UI element. This trapped users in the slider.

This CL fixes the focus trap by removing the key handlers for DPAD_UP and DPAD_DOWN, allowing the Android system to handle focus navigation as expected.

PiperOrigin-RevId: 837044072
2025-12-02 15:14:33 +00:00
leticiars
c4d19f6f7d [Slider] Fix ACTION_CANCEL motion touch event handling so that the slider resets its state if a cancel happens. Also don't let slider update incorrectly when a touch event may be overlapping with back gesture inset areas, as the back event takes precedence.
PiperOrigin-RevId: 828106972
2025-11-07 17:51:26 +00:00
leticiars
1bf522fbbf [Slider][a11y] Change thumb width when it's keyboard focused.
Refactored so that each thumb is an individual drawable, so that they can change width independently. Plus, with this change a custom thumb drawable no longer changes its width when pressed.

PiperOrigin-RevId: 822162251
2025-10-22 16:08:15 +00:00
Material Design Team
aa623f0fac [Slider][A11y] Fix slider D-Pad keys to modify value instead of focus
Previously, Up/Down arrow keys navigated focus instead of changing the slider value. This change updates keyboard handling so all D-Pad keys modify the slider value: Up/Down increment/decrement the value, and Left/Right increment/decrement based on layout direction.

PiperOrigin-RevId: 821593460
2025-10-20 14:53:21 +00:00
leticiars
ce092fa5dd [Slider] Only one value label should be shown at a time for the range slider (except for the mode where the labels are always visible).
PiperOrigin-RevId: 819785653
2025-10-20 14:51:18 +00:00
Material Design Team
3d8d23dadb [Slider][A11y] Use arrow keys for value adjustment and TAB for navigation
Refactors Slider/RangeSlider keyboard navigation for a more intuitive and accessible experience, removing the need to press ENTER to toggle between navigation and value adjustment modes.

With this change:

- Arrow keys (+/-/=/DPAD) always adjust the value of the focused thumb.
- TAB and Shift+TAB always navigate focus between thumbs.

This simplifies event handling by ensuring `activeThumbIdx` stays synchronized with `focusedThumbIdx` during keyboard input.

Also fixes regressions in `SliderTouchTest` by preventing `onFocusChanged` logic (now conditioned on `activeThumbIdx == -1`) from incorrectly overriding thumb selection during touch events.

PiperOrigin-RevId: 816168251
2025-10-07 19:55:02 +00:00
pubiqq
a17e208d45 [Internal] Restore binary compatibility (ViewOverlay)
Resolves https://github.com/material-components/material-components-android/issues/4821
Resolves https://github.com/material-components/material-components-android/pull/4822

  - 88fa6714b38456cd39e2104992034a99bab00fc7 by pubiqq <serj.ese@gmail.com>

PiperOrigin-RevId: 776589862
2025-06-27 16:31:41 +00:00
dsn5ft
e62e66d7bc [Slider] Add ability to specify purely visual tick count in continuous mode
PiperOrigin-RevId: 764271536
2025-05-28 22:49:09 +00:00
Material Design Team
ab52e6afc4 [Slider][A11y] Prevent duplicate accessibility announcements
PiperOrigin-RevId: 764175507
2025-05-28 13:32:21 +00:00
Material Design Team
5af24b321a Automated g4 rollback of changelist 762520075
PiperOrigin-RevId: 762603362
2025-05-27 18:46:28 +00:00
Material Design Team
917ce60aa5 [Slider][A11y] Prevent duplicate accessibility announcements
PiperOrigin-RevId: 762520075
2025-05-23 21:54:41 +00:00
pubiqq
9ae6b7f4b3 [Slider] Get default minTouchTargetSize from material attributes
Resolves https://github.com/material-components/material-components-android/pull/4546

  - ceb3c6e7ea0eb09e5020a928f9185f86a566c0dc by pubiqq <serj.ese@gmail.com>

PiperOrigin-RevId: 760682756
2025-05-21 17:54:26 +00:00
Ga\u00ebtan Muller
65e5f1aba1 [Internal] Remove the internal ViewOverlay compat layer
Resolves https://github.com/material-components/material-components-android/pull/4736

GIT_ORIGIN_REV_ID=9eced1439e9503f5cc88cc3f2834f55e5466448c
PiperOrigin-RevId: 756779136
2025-05-12 18:15:01 +00:00
pubiqq
23957e0d7f [Slider] Fix label bounds for vertical slider in RTL
Resolves https://github.com/material-components/material-components-android/pull/4760
Resolves https://github.com/material-components/material-components-android/issues/4759

GIT_ORIGIN_REV_ID=b7ca68735a77733f621c8be87b8e5e85a57ab325
PiperOrigin-RevId: 755915079
2025-05-07 19:32:14 +00:00
pekingme
3a2969935f [Slider] Added Expressive styles.
PiperOrigin-RevId: 750463306
2025-04-23 19:49:00 +00:00
pfthomas
781d344142 [Slider] Centered Slider Expressive updates
- update the Centered Slider to show the track starting from the center

PiperOrigin-RevId: 750301810
2025-04-22 20:39:48 +00:00
pekingme
72d011d48a [Slider] Reorganized styles.
PiperOrigin-RevId: 749840827
2025-04-22 20:16:58 +00:00
pfthomas
efea65b0eb [Slider][a11y] Add state description to VirtualView node
PiperOrigin-RevId: 741685200
2025-03-31 14:48:57 +00:00
pfthomas
cd909c2b7d [Slider] Add centered configuration
- add attr `centered` to enable the new centered configuration, see https://m3.material.io/components/sliders/overview#227dd2d1-8be6-4646-b8e6-f05bbac583e5
- prevent drawing the ticks in the gap spaces around the thumb and under it for better visuals

PiperOrigin-RevId: 741161174
2025-03-27 15:42:51 +00:00
rightnao
37adad28af [Tokens] Update tokens to 16.0.2
PiperOrigin-RevId: 739249542
2025-03-24 15:27:25 +00:00
pekingme
67b6dcebe5 [Tokens] Upgraded to 15.0.26
PiperOrigin-RevId: 731761144
2025-03-03 19:50:32 +00:00
pekingme
c39dc388b3 [Tokens] Upgraded to version 15.0.12.
PiperOrigin-RevId: 730510849
2025-02-25 19:32:33 +00:00
pekingme
7c5dce0f82 [Tokens] Updated to 14.0.0.
PiperOrigin-RevId: 728471950
2025-02-20 15:36:11 +00:00
pubiqq
660423f5a2 [Slider] Add new tick visibility modes
Resolves https://github.com/material-components/material-components-android/pull/2897

GIT_ORIGIN_REV_ID=82e11301b0ecf48b7d8486e8b29954bd1c4aebe8
PiperOrigin-RevId: 720997942
2025-01-31 15:20:30 +00:00
manabu-nakamura
9302f54855 [Slider] Fixed behaviour when Slider is in a scrolling container
Resolves https://github.com/material-components/material-components-android/pull/4511

GIT_ORIGIN_REV_ID=58e771c48f0a4bf13f62a303a9495a73f414b73b
PiperOrigin-RevId: 720309810
2025-01-28 19:49:47 +00:00
pekingme
9a2890c249 [Resources] Updated translated string resources.
Resolves https://github.com/material-components/material-components-android/issues/4553

PiperOrigin-RevId: 720282586
2025-01-28 19:47:24 +00:00
pubiqq
54778a9ae4 [Slider] Improve track icon bounds calculation
Resolves https://github.com/material-components/material-components-android/pull/4535

GIT_ORIGIN_REV_ID=080a4db213a47dae1e65f6b4edb2235f183599bd
PiperOrigin-RevId: 716316682
2025-01-16 19:59:20 +00:00
manabu-nakamura
867fd010f8 [Slider] remove unnecessary code
Resolves https://github.com/material-components/material-components-android/pull/4537

GIT_ORIGIN_REV_ID=e508df4affbda49f20a64dba7502fb21d90f0a3a
PiperOrigin-RevId: 716261754
2025-01-16 19:58:37 +00:00
pubiqq
bc2fdeadaf [Internal] Prefer platform methods to compat ones
Resolves https://github.com/material-components/material-components-android/pull/4532

GIT_ORIGIN_REV_ID=180dec736f2521579e483317a4d537629d8f247b
PiperOrigin-RevId: 715494344
2025-01-15 18:06:07 +00:00
pubiqq
b31711cd9e [Slider] Slider, don't warn about track icons if you don't have any
Resolves https://github.com/material-components/material-components-android/pull/4531

GIT_ORIGIN_REV_ID=4d23fdc773e9ba6fd4d1842be4590bb4417ff32f
PiperOrigin-RevId: 713752392
2025-01-10 15:31:44 +00:00
pubiqq
d28488d774 [Slider] Fix label pivots
Resolves https://github.com/material-components/material-components-android/pull/4509

GIT_ORIGIN_REV_ID=a26da16d8389df1de090c737c50c6c1e12f77df8
PiperOrigin-RevId: 713697809
2025-01-10 15:25:12 +00:00
pubiqq
e6e9385059 [Slider] Fix thumb visibility for vertical slider on API 23
Resolves https://github.com/material-components/material-components-android/pull/4505

GIT_ORIGIN_REV_ID=ed5a3af3ec63ea820651897eac2caa85ece13288
PiperOrigin-RevId: 712937074
2025-01-08 18:04:33 +00:00
pubiqq
9ce14ae3fd [Slider] Refactor track icon tinting
Resolves https://github.com/material-components/material-components-android/pull/4521

GIT_ORIGIN_REV_ID=674feb5f080ee2ea79245b17314d852893ece7d7
PiperOrigin-RevId: 712886599
2025-01-07 14:36:28 +00:00
pubiqq
ddda777dda [Slider] Always update track bounds before drawing icons
Resolves https://github.com/material-components/material-components-android/pull/4488

GIT_ORIGIN_REV_ID=0437dc5fd010715429822287ec12a8f77bffbe92
PiperOrigin-RevId: 712658525
2025-01-07 14:24:56 +00:00
pekingme
4f7bf293ea [Tokens] Updated token outputs to v13.2.0 and integrated new AppBar tokens.
PiperOrigin-RevId: 703208208
2024-12-10 17:57:50 +00:00
pfthomas
63e1ec9a54 [Slider] a11y fixes
- demos are scrollable
- fix issue where increment is reversed when Slider is vertical

PiperOrigin-RevId: 703087896
2024-12-10 17:56:45 +00:00
pfthomas
35a82030f5 [Slider] a11y fixes
Resolves https://github.com/material-components/material-components-android/issues/2176

PiperOrigin-RevId: 702789538
2024-12-04 23:59:28 +00:00
pfthomas
05fa0ce58f [Slider] Update corner behavior
- add corner "squishy" effect as the thumb approaches the edges of the track.

PiperOrigin-RevId: 700775657
2024-12-02 20:06:28 +00:00
pfthomas
e1c83edbcb [Slider] Fix vertical slider broken with always visible labels
Resolves https://github.com/material-components/material-components-android/issues/4391

PiperOrigin-RevId: 700333450
2024-12-02 19:43:42 +00:00
pfthomas
60c09d98a1 [Slider] Add extra track icons support
- added support for start and end track icons
- removed the hide/show track icon logic to let the user implement it for more flexibility
- added demo
- updated tests + doc

PiperOrigin-RevId: 696960630
2024-11-21 17:25:26 +00:00
pfthomas
5bcda8a8d7 [Slider] Add vertical support
- added "orientation" attr allowing for vertical support
- updated tests and doc
- added demo

PiperOrigin-RevId: 695856298
2024-11-21 17:15:02 +00:00
pfthomas
2e95296eac [Slider] Add support for track icons
- added trackIconActive, trackIconActiveSize and trackIconActiveColor attrs
- added trackIconInactive, trackIconInactiveSize and trackIconInactiveColor attrs
- added tests and demos
- updated documentation

PiperOrigin-RevId: 689804000
2024-10-25 18:51:04 +00:00
pfthomas
7f4413dc4f [Slider] Make track corner size customizable
- add setTrackCornerSize/getTrackCornerSize to customize the track corners
- simplify track drawing logic for legacy Slider
- add demos

PiperOrigin-RevId: 688146199
2024-10-22 20:10:53 +00:00
manabu-nakamura
9bf5eddd8a [Slider] Make sure label is removed with slider is hidden
Resolves https://github.com/material-components/material-components-android/issues/4319
Resolves https://github.com/material-components/material-components-android/pull/4320

GIT_ORIGIN_REV_ID=6b96f2d40b77900b3479e3af61d3fa6f7c3e7c9d
PiperOrigin-RevId: 684473315
2024-10-14 16:33:10 +00:00
pekingme
237f5ec946 [Slider] Updated to show tooltips when focus by a11y.
PiperOrigin-RevId: 683257820
2024-10-09 16:36:10 +00:00
rightnao
1f56cd1783 [Slider] Fixes an exception caused by DecimalFormat not taking into account locale
PiperOrigin-RevId: 681165249
2024-10-07 14:17:23 +00:00
Material Design Team
59a753af24 Automated g4 rollback of changelist 676427467
PiperOrigin-RevId: 680642368
2024-10-01 19:04:24 +00:00