34 Commits

Author SHA1 Message Date
ruben
cde09d4b4e [Slider] Add missing functionality from SeekBar regarding touch events and value changes
Resolves https://github.com/material-components/material-components-android/pull/831

GIT_ORIGIN_REV_ID=70dd0a10ef204837b01ed9593cfdd9bcf9137228
Co-authored-by: cketcham <cketcham@gmail.com>
PiperOrigin-RevId: 287545665
2019-12-30 14:15:50 -05:00
cketcham
a011ace28f Remove ticksCoordinates from SliderState
There's no point in caching ticksCoordinates since it will have to be recalculated based on the new width once it's laid out again.

Resolves https://github.com/material-components/material-components-android/issues/793

PiperOrigin-RevId: 287363665
2019-12-30 14:14:55 -05:00
cketcham
9ae1494597 Add option to hide the Slider's label
This creates 3 options, to have the label floating, within the bounds of the view, or not shown.

Resolves https://github.com/material-components/material-components-android/issues/703

PiperOrigin-RevId: 287244827
2019-12-30 13:31:52 -05:00
cketcham
354edd09f4 Rename method in Slider
PiperOrigin-RevId: 286912170
2019-12-23 15:43:11 -05:00
cketcham
df61bff112 Fixed halo rendering bug for Slider
Using a hardware layer was causing problems in some versions of Android when drawing the halo ripple. Hardware layer really only needs to be used when the slider is disabled.

PiperOrigin-RevId: 286640042
2019-12-21 08:51:03 -05:00
cketcham
e38d260d69 Prevent unnecessary invalidation for Slider if the values haven't changed
PiperOrigin-RevId: 286632473
2019-12-21 08:50:33 -05:00
cketcham
5f631d48f0 Fix logic for when to draw Slider's compat halo
PiperOrigin-RevId: 286629247
2019-12-21 08:50:09 -05:00
cketcham
d8641182f9 Remove call to Slider's requestDisallowInterceptTouchEvent(false) in ACTION_UP
On the start of a new touch event on the parent, this will be reset.

PiperOrigin-RevId: 286623951
2019-12-21 08:49:30 -05:00
cketcham
3e212efdc2 Add getters and setters for colors for Slider
Resolves http://github.com/material-components/material-components-android/issues/770

PiperOrigin-RevId: 286472940
2019-12-21 08:47:32 -05:00
ruben
a7da96fac0 [Slider] Fixed behaviour when Slider is in a scrolling container
Resolves https://github.com/material-components/material-components-android/pull/833

GIT_ORIGIN_REV_ID=86b976f757fb8354ffe502c5acc32b6954890bb9
PiperOrigin-RevId: 286431744
2019-12-19 15:49:27 -05:00
cketcham
b2deaa3f22 Update the radius of the Slider RippleDrawable
PiperOrigin-RevId: 286239127
2019-12-18 15:56:40 -05:00
cketcham
dc17035a8b Fix height of Slider when floating label is false
PiperOrigin-RevId: 286201599
2019-12-18 15:55:40 -05:00
cketcham
f28cc095a7 Reorganized and updated comments in Slider
PiperOrigin-RevId: 286194091
2019-12-18 15:54:30 -05:00
cketcham
921d392602 Rename slider tick and track color attributes to keep them together when sorted alphabetically
PiperOrigin-RevId: 285972204
2019-12-17 17:06:10 -05:00
cketcham
1723dd4580 Recaulculate Slider ticks when the step size changes
PiperOrigin-RevId: 285968387
2019-12-17 17:05:44 -05:00
cketcham
b1816e118b Draw the halo color instead of the thumb color for the compat halo for Slider
PiperOrigin-RevId: 285489212
2019-12-16 16:01:03 -05:00
cketcham
6adbcc2777 Rename Slider forceDrawCompatShadow to be forceDrawCompatHalo
PiperOrigin-RevId: 285442759
2019-12-16 16:00:24 -05:00
cketcham
fe160f33e6 Add option to set the track height of the Slider
PiperOrigin-RevId: 284667379
2019-12-10 07:25:07 -05:00
cketcham
df94cd1bca Remove the requirement to setClipChildren false on the parent of Slider
Draw the Slider label with ViewOverlay, and update the way the halo is drawn pre lollipop. This stops any clipping that happens by the bounds view.

Resolves https://github.com/material-components/material-components-android/issues/697

PiperOrigin-RevId: 284650572
2019-12-10 07:24:00 -05:00
marianomartin
58190deb21 [Slider] Cannot set stepSize < 1.0
Resolves https://github.com/material-components/material-components-android/issues/704

PiperOrigin-RevId: 282783034
2019-12-02 17:31:47 -05:00
cketcham
5d1a369ea0 Update Slider to use TooltipDrawable
PiperOrigin-RevId: 282583539
2019-12-02 17:27:40 -05:00
xxfast
45bfd96a61 [Slider] Fix slider to invalidate after set value
Resolves https://github.com/material-components/material-components-android/pull/720

GIT_ORIGIN_REV_ID=e1eaf165d734b1c60c05116d200af4ff6f5c583e
PiperOrigin-RevId: 277319683
2019-11-01 13:28:40 -07:00
cketcham
4e1da2a4be Update Slider to use RippleDrawable for Lollipop and above
PiperOrigin-RevId: 276528198
2019-11-01 13:28:40 -07:00
marianomartin
115313c0c0 Expose a class for themeoverlay in style
This moves functionality from ThemeEnforcement into a stand alone class.

Resolves https://github.com/material-components/material-components-android/issues/665

PiperOrigin-RevId: 275481343
2019-10-21 10:24:19 -04:00
cketcham
349f91c07b Always draw the Slider's label
Also adds an option to toggle floating the label above the views around the slider, or adding extra height to the slider to keep the label inside the bounds.

PiperOrigin-RevId: 272713986
2019-10-03 15:43:03 -04:00
cketcham
88535c8f22 Only set the Slider thumb drawable state if the drawable is stateful
PiperOrigin-RevId: 271617473
2019-09-27 15:00:03 -04:00
cketcham
fb4025aad4 Refactor to use Style directly for Paint in Slider
PiperOrigin-RevId: 271612458
2019-09-27 14:58:55 -04:00
cketcham
f8fe052ed3 Add support for Slider thumb elevation
PiperOrigin-RevId: 269866946
2019-09-20 10:56:07 -04:00
cketcham
eab7b7bc1b Update Slider thumb to use MaterialShapeDrawable
This will easily allow us to support elevation and potentially custom shapes in the future.

PiperOrigin-RevId: 268932921
2019-09-18 14:12:11 -04:00
cketcham
38e95a5f3c Remove the gap between the thumb and track in disabled mode
PiperOrigin-RevId: 268905977
2019-09-18 14:04:28 -04:00
cketcham
97ca231d70 Allow the radius of the thumb and halo around the thumb to be set by the style
PiperOrigin-RevId: 268735380
2019-09-18 13:01:22 -04:00
cketcham
8a26d84ac4 Add initial Slider implementation
PiperOrigin-RevId: 268558997
2019-09-12 14:22:38 -04:00
cketcham
b12e1720a6 Remove restriction requiring Slider valueFrom and valueTo to be set
The default is from 0 to 1.

PiperOrigin-RevId: 268480998
2019-09-12 14:07:32 -04:00
marianomartin
53d4185ff9 Internal cleanup
PiperOrigin-RevId: 267368841
2019-09-12 13:47:15 -04:00