272 Commits

Author SHA1 Message Date
cketcham
432b46cc83 Add shapes theming infrastructure.
Add shapeAppearance and shapeAppearanceOverlay attributes. These attributes combine to support shapes theming. ShapeAppearance is modeled after TextAppearance. A shapeAppearance attribute contains a style reference that is meant to be defined at the theme level. Since changing anything defined in the shapeAppearance would clobber everything else in the ShapeAppearance, the shapeAppearanceOverlay attribute is provided for clients to modify the shapeAppearance.

PiperOrigin-RevId: 215242636
2018-10-02 14:21:40 -04:00
Material Design Team
493c090a88 Set a default contentDescription on TextInputLayout's character counter unless it is overflowed.
PiperOrigin-RevId: 215026891
2018-10-01 12:24:49 -04:00
connieshi
b698c972cb Add MDC bridge theme target that does not include all of material components as a transitive dependency.
PiperOrigin-RevId: 214995615
2018-10-01 12:24:09 -04:00
ldjesper
9cbfddc61b Add attributes to disable Material Theme Colors for Selection Controls
These attributes are necessary for custom drawables.

PiperOrigin-RevId: 214969700
2018-09-28 17:03:18 -04:00
cketcham
8bd94e9276 Rename ShapePathModel to ShapeAppearanceModel.
This commit renames ShapePathModel to ShapeAppearanceModel to align with the new shapeAppearance attributes that will be added for shape theming.

PiperOrigin-RevId: 214818189
2018-09-28 16:30:13 -04:00
cketcham
575d1cb48f Update EdgeTreatment docs
PiperOrigin-RevId: 214647748
2018-09-28 16:29:56 -04:00
cketcham
c6a08a4b68 Allow for centering on EdgeTreatments
PiperOrigin-RevId: 214613004
2018-09-28 16:28:45 -04:00
cketcham
0527fe7d09 Fix MaterialShapeDrawable path so it is correctly convex on API 21 and 22
PiperOrigin-RevId: 214461440
2018-09-28 16:28:01 -04:00
melaniegoetz
24c40ffa2a Fix NPE in BottomSheetBehaviour
PiperOrigin-RevId: 214297001
2018-09-28 16:27:08 -04:00
dniz
868e80ed6f Add support for anchoring Snackbars to Views so they can be placed above
navigational elements and FABs

This commit also disables the pushing up of FABs when an anchor view is set

PiperOrigin-RevId: 214287486
2018-09-28 16:24:01 -04:00
dniz
e853c84767 Fix AppBarLayout liftOnScroll target view caching
PiperOrigin-RevId: 214066255
2018-09-28 16:19:17 -04:00
dniz
e48d3d73a6 Add Snackbar animationMode attr to public values
PiperOrigin-RevId: 214048648
2018-09-28 16:18:58 -04:00
melaniegoetz
4bca4ec9e2 set mtrl_fab_ripple_color to use colorOnSecondary rather than color:white
PiperOrigin-RevId: 214028313
2018-09-28 16:15:46 -04:00
connieshi
fee1efe5c0 Migrate ChipDrawable to inherit from MaterialShapeDrawable instead of Drawable.
PiperOrigin-RevId: 213991051
2018-09-28 16:15:10 -04:00
ldjesper
5df0d8b760 Fix draw bounds for MaterialShapeDrawable stroke and fill
PiperOrigin-RevId: 213877586
2018-09-28 16:12:57 -04:00
ldjesper
03edbf3d5f Switch MaterialShapeDrawable to RectF
PiperOrigin-RevId: 213872653
2018-09-28 16:12:36 -04:00
dniz
8064a7672f New enter and exit animations for Snackbars
- Original slide animation will be used for Widget.Design and unstyled Snackbars
- New fade + scale animation will be used for Widget.MaterialComponents Snackbars

PiperOrigin-RevId: 213669605
2018-09-28 16:10:27 -04:00
marianomartin
027e10548f Fix color subsystem for MaterialCardView
PiperOrigin-RevId: 213649174
2018-09-28 16:10:13 -04:00
dniz
a313443f9e Update AppBarLayout liftOnScroll to support nested scrolling targets
- Add liftOnScrollTargetViewId attribute to allow client to specify the scrolling view that should be listened to for updating AppBarLayout lifted state.
- Use View#canScrollVertically instead of View#getScrollY to determine lifted state.

PiperOrigin-RevId: 213614055
2018-09-28 14:55:37 -04:00
marianomartin
1ddb5f585a MaterialCardView update foreground drawables instead of creating new ones.
PiperOrigin-RevId: 213594729
2018-09-28 14:55:12 -04:00
melaniegoetz
69eebe785f TabLayout functionality to set label visibility
PiperOrigin-RevId: 213554775
2018-09-28 14:54:44 -04:00
gauthams
3ec2906ad8 Fix FloatingToolbar improperly inflating MaterialButton on API 23.
This was due to FloatingToolbar using <Button> for its layouts in API 23-25, which got automatically inflated to <MaterialButton> via the custom view inflater in MDC themes. However, the default MaterialButton styling (especially backgroundTint) was overriding the styling in the <Button>, resulting in a broken FloatingToolbar. This issue was not encountered on API 24/25 since there were likely theme/style changes in those versions that override this Button. From API 26 onwards, FloatingToolbar uses a TextView and ImageView instead of Button.

PiperOrigin-RevId: 213517896
2018-09-28 14:54:14 -04:00
dniz
35a0839ad6 Add defStyleRes to materialThemeOverlay wrapping
- Fixes materialThemeOverlay case where client is not using our theme or style (e.g., AppCompat + component with no style set)
- Also refactors createThemedContext() to use obtainStyledAttributes with defStyleAttr and defStyleRes instead of getTheme().resolveAttribute()

PiperOrigin-RevId: 213464594
2018-09-28 14:53:34 -04:00
Material Design Team
843b38a132 Automated g4 rollback of changelist 213442351
PiperOrigin-RevId: 213461630
2018-09-28 14:53:18 -04:00
marianomartin
731586fae6 Fix color subsystem for card view
PiperOrigin-RevId: 213442351
2018-09-28 14:52:58 -04:00
dniz
dff21575fb Add ContextUtils getActivity() method
PiperOrigin-RevId: 213356904
2018-09-28 14:52:27 -04:00
leticiars
df551410c4 Fixing padding of hint label when there is a leading icon
PiperOrigin-RevId: 213277053
2018-09-28 14:49:23 -04:00
leticiars
f317d634cf Fixing text overlapping end toggle drawable when app starts.
PiperOrigin-RevId: 212885605
2018-09-14 11:04:37 -04:00
ldjesper
20bbf1523b Improvements to readability and javadoc of MaterialShapeDrawable
PiperOrigin-RevId: 212875571
2018-09-14 11:04:01 -04:00
connieshi
b6e96bf4d0 To avoid extra memory allocation, only run workaround for a framework bug that doesn't support themed color referenced in ColorStateList for API level < 23 when the Android version is pre-API 23.
Add test for setting a chip's text color to a CSL that references a themed color.

PiperOrigin-RevId: 212871700
2018-09-14 11:03:34 -04:00
ldjesper
f79c91e53e Allow different stroke and fill colors for MaterialShapeDrawable
PiperOrigin-RevId: 212857049
2018-09-14 11:03:07 -04:00
connieshi
f64b2fb3c7 Automated g4 rollback of changelist 212803097
PiperOrigin-RevId: 212821631
2018-09-14 11:02:38 -04:00
connieshi
5b701669ac Reuse text color from ChipDrawable#getTextAppearance instead of using additional resources to refetch it.
PiperOrigin-RevId: 212803097
2018-09-14 11:02:17 -04:00
afohrman
7fb37e86ba Make MaterialShapeDrawable anti-alias its Paint.
Anti-aliasing the Paint by default eliminates the appearance of jagged edges and corners.

Anti-aliasing is currently supported by calling setPaintFlags() on MaterialShapeDrawable, but it is not yet enabled by default.

PiperOrigin-RevId: 212709536
2018-09-14 11:00:52 -04:00
dniz
461101bc5b Fix Gradle build by removing Java 8 method reference
PiperOrigin-RevId: 212685609
2018-09-14 11:00:30 -04:00
dniz
02382c612a Update Chip to use compat setLayoutDirection() method
PiperOrigin-RevId: 212680124
2018-09-14 10:59:52 -04:00
cketcham
655b3dc1b0 Add materialThemeOverlay attribute
PiperOrigin-RevId: 212665868
2018-09-14 10:58:21 -04:00
gauthams
ba44d62af4 Update MaterialButton setRippleColor to properly convert it's ColorStateList before setting rippleColor
PiperOrigin-RevId: 212636260
2018-09-14 10:57:50 -04:00
ldjesper
3219f7dc3e Standardize Selection Controls across API versions and maintain XML configs
PiperOrigin-RevId: 212510051
2018-09-14 10:57:21 -04:00
ldjesper
c6266f23ef Modify CheckBox to color without alpha.
PiperOrigin-RevId: 212484594
2018-09-14 10:56:49 -04:00
dniz
752b7b2ca1 Use specific color surface resource instead of reusing background
PiperOrigin-RevId: 212432542
2018-09-14 10:55:37 -04:00
melaniegoetz
09b22f37d0 Fix DayNight hardcoding certain color values
PiperOrigin-RevId: 212364719
2018-09-14 10:54:12 -04:00
Material Design Team
850795da31 Delegates CollapsingTextHelper text attributes processing to TextAppearance.
This removes duplication between the 2 implementations and automatically fixes font loading bug in CollapsingToolbarLayout & TextInputLayout. It has a side effect of changing font loading from sync to async but it shouldn't affect anyone since font loading wasn't really working in the first place. It may affect the UIs that were affected by the original bug though.

To alleviate possible "font flickering" due to async loading, CollapsingTextHelper defers the TextPaint changes until the font is actually loaded.

Another scenario the async loading would have an impact on is when the font is manually overwritten with CollapsingTextHelper.setTypeface() while async op is still ongoing. The result of async load would then overwrite the font back to the originally requested. This happens in TextInputLayout which overwrites its own font setting to this of its child whenever its added. This may happen before async op completes. To guard against that, any direct font setting automatically cancels the async load (cancels == ignores the result when it comes).

PiperOrigin-RevId: 212328671
2018-09-14 10:53:39 -04:00
melaniegoetz
8f02385c84 Color subsystem updates for MDC-FAB
PiperOrigin-RevId: 212311827
2018-09-14 10:53:01 -04:00
dniz
3dc5733f36 Update Snackbar to use new color system
PiperOrigin-RevId: 212275277
2018-09-14 10:52:33 -04:00
connieshi
d796149d25 Update chip to use themed color attributes.
PiperOrigin-RevId: 212104772
2018-09-14 10:51:49 -04:00
Alex Saveau
3edda8be14 Add baseline alignment support to TextInputLayout.
Resolves https://github.com/material-components/material-components-android/issues/13.
Resolves https://github.com/material-components/material-components-android/pull/56.

PiperOrigin-RevId: 212022367
2018-09-14 10:51:16 -04:00
ldjesper
8a3856922f Style Material RadioButton
PiperOrigin-RevId: 211998722
2018-09-14 10:50:38 -04:00
cketcham
a8c0d6f762 Remove workaround for background drawable state for TextInputLayout
It appears this workaround is no longer necessary and is causing the EditText to lose its padding on sdk 21 and 22.

PiperOrigin-RevId: 211798802
2018-09-07 11:55:57 -04:00
Material Design Team
a5d38d43d6 Changes SwitchMaterial coloring to composites instead of blends.
Also provides color layering utilities and removes text color changes.

PiperOrigin-RevId: 211692944
2018-09-07 11:55:28 -04:00