2177 Commits

Author SHA1 Message Date
conradchen
edbc4e1f64 [M3][Textfield] Create M3 styles
PiperOrigin-RevId: 391773145
2021-08-23 09:22:14 -07:00
dsn5ft
f428f20829 [M3][Color] Updated colorPrimaryDark to point to colorPrimary
Also updated Catalog edge-to-edge logic to handle "light status bar", and default to edge-to-edge enabled for Q+

PiperOrigin-RevId: 391763801
2021-08-23 09:21:21 -07:00
dsn5ft
18490ff82d [M3][Top App Bar] Added new AppBarLayout, CollapsingToolbarLayout, and Toolbar styles and updated Catalog pages + demos
PiperOrigin-RevId: 391755524
2021-08-23 09:20:24 -07:00
dsn5ft
b9e5797c73 [M3][Color] Set up elevation overlays and colors in themes + theme overlays
PiperOrigin-RevId: 391744768
2021-08-23 09:19:24 -07:00
pekingme
0995f99965 [M3][Tokens] Integrated color system resources.
PiperOrigin-RevId: 391597925
2021-08-23 09:18:25 -07:00
dsn5ft
5d940f1ff8 [M3][Catalog] Update Catalog theme(s) to Material3 and fix Material3 date/time picker theme overlays
PiperOrigin-RevId: 391581833
2021-08-23 09:17:02 -07:00
pfthomas
ec3f96cbb9 [CollapsingToolbarLayout] Fix expanded height incorrect after rotation
PiperOrigin-RevId: 391547762
2021-08-18 10:27:05 -07:00
dsn5ft
17a459abd3 [M3][Color] Removed disabled color theme attrs
PiperOrigin-RevId: 391544286
2021-08-18 10:26:23 -07:00
conradchen
04b06ae425 [M3] Create M3 ripple alpha resources
PiperOrigin-RevId: 391532414
2021-08-18 10:25:38 -07:00
hunterstich
baf55ec93c [M3][Typography] Add new typography system TextAppearance styles and set attrs in theme.
PiperOrigin-RevId: 391388105
2021-08-18 10:06:03 -07:00
conradchen
126df4c082 [Tab] Fix icon tint not applied on lower SDKs
On SDK < 23 if the icon is not a TintAwareDrawable, DrawableCompat.wrap() will return a new drawable which wraps the original drawable. However in the original logic after we set the tint to the icon, we didn't really set the tinted icon back to the tab or the image view, therefore the tint is not showing.

Moves the tint logic to updateTextAndIcon() to ensure tinted icons will be used in the image view.

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

PiperOrigin-RevId: 391368322
2021-08-18 10:02:28 -07:00
conradchen
a682ab0ee0 [AppBar] Make it possible to disable app bars' shadow
Originally we always set the outline provider of app bars to BOUND, even if the outline provider is set to none explicitly in the XML file.

Checks if the outline provider is set to BACKGROUND before we override it, to prevent unwanted overriding from happening.

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

PiperOrigin-RevId: 391339943
2021-08-18 10:01:27 -07:00
Natalia Kuznetsova
cdeeb824cb [TextInputLayout] Adding getter and setter for boxCollapsedPaddingTop
Resolves https://github.com/material-components/material-components-android/pull/2289

GIT_ORIGIN_REV_ID=50ec191fbca0e2223ac322adb3f36035186b4bca
PiperOrigin-RevId: 391122971
2021-08-16 13:49:38 -07:00
hunterstich
beb51dc938 [M3][Typography] Define new typography system theme attributes.
PiperOrigin-RevId: 390658242
2021-08-16 13:46:04 -07:00
dsn5ft
1ed1c29de3 [M3][Color] Define new color system theme attributes
PiperOrigin-RevId: 390612653
2021-08-16 13:44:53 -07:00
dsn5ft
45f4fa0ac8 [MaterialTimePicker] Add some defensive null checks for internal views
PiperOrigin-RevId: 390608782
2021-08-16 13:43:58 -07:00
jeremymuhia
10edc29b4f [TextInputLayout] fix counterTextColor java docs
PiperOrigin-RevId: 390602431
2021-08-16 13:43:10 -07:00
dsn5ft
c3691284aa [M3] Update Dark dialog theme to have correct dark dynamic color theme overlay
PiperOrigin-RevId: 390235966
2021-08-16 13:42:24 -07:00
conradchen
27757d026a [M3] Create M3 skeleton themes
PiperOrigin-RevId: 390228317
2021-08-16 13:36:10 -07:00
dsn5ft
57e3bc02fa [i18n] Updated some string translations for date picker, time picker, and text field
PiperOrigin-RevId: 389899697
2021-08-10 21:08:28 -07:00
pekingme
a55f3b8ee9 [LinearProgressIndicator] Fixed the transparent strip drawn at the ends of the indicator.
Resolves https://github.com/material-components/material-components-android/issues/1947

PiperOrigin-RevId: 388966812
2021-08-05 18:24:15 -04:00
pekingme
456abd5471 [LinearProgressIndicator] Added null check in requestAnimatorAfterCurrentCycle for disjoint indeterminate animator.
PiperOrigin-RevId: 388962420
2021-08-05 18:22:17 -04:00
pekingme
f9f57d7d3c [CircularProgressIndicator] Fixed the transparent strip drawn at the ends of the indicator.
Resolves partially https://github.com/material-components/material-components-android/issues/1947

PiperOrigin-RevId: 388953254
2021-08-05 18:21:37 -04:00
dsn5ft
e2c911b9e5 [AppBarLayout] Add setLiftableOverrideEnabled() method to allow toggling between automatic and manual setLifted() behavior
PiperOrigin-RevId: 388786221
2021-08-05 18:20:57 -04:00
dsn5ft
67f9e9da88 [AppBarLayout] Updated setLifted() to preserve lifted state if using setLiftable() programmatically
PiperOrigin-RevId: 388539565
2021-08-05 18:19:51 -04:00
Material Design Team
9fb73b50ff [BottomSheetBehavior] Apply the max width/height during measure instead of modifying layout params
Previously the BottomSheetBehavior was checking the measured size during onLayout and if it exceeded the max width or height configured it would "adjust" them by directly modifying the width and height on the layout params and then posting a setLayoutParams. This has many problems and is fundamentally the wrong way to do it. First off, a view should never modify the layout params that are configured on it for two reasons, one, they are properties of the parent view group, not the view itself, and two, they are almost always intended for users of the view group to configure, not the view group itself. Modifying the layout params directly is clobbering any previously configured parameter and permanently changing the layout (for example consider the case where the max width is set to 100dp and then later set to 200dp, the view would not be allowed to grow to 200dp because its layout params would already have been clobbered). Secondly the post is a very bad way to apply this max, not only does it trigger an entire layout pass a second time but it does so after having completed the first layout pass so it will cause the bottom sheet to render at the original size and then the capped size, it's both inefficient and will cause user visible jank.

The correct way to apply a maximum width/height is to do it during layout by incorporating it into the measure specs that are passed to the child. This doesn't clobber any state that the user of the view configured (i.e. when the parent measure specs change, e.g. due to screen rotation, the views correctly relayout) and it avoids doing multiple layout passes, the child can measure itself to the correct size the first time.

PiperOrigin-RevId: 387379138
2021-07-30 10:55:45 -04:00
pfthomas
47868d884e [DatePicker] Date selector hint incorrectly localized
PiperOrigin-RevId: 387066584
2021-07-29 14:28:10 -04:00
Material Design Team
cbf7bcad59 Internal change
PiperOrigin-RevId: 386513223
2021-07-28 14:29:52 -04:00
dsn5ft
3008d782e7 [AppBarLayout] Added listener for when lift on scroll background elevation and color change
PiperOrigin-RevId: 386243658
2021-07-28 14:26:55 -04:00
conradchen
b51692da7d [Transition] Fix NPE when removing window background
Null background is a totally valid state. Handles the nullness to prevent NPE from happening.

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

PiperOrigin-RevId: 386081632
2021-07-22 11:55:11 -04:00
conradchen
ac1caf460a [BottomAppBar] Fix default style not being applied
The constructors was not properly cascaded.

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

PiperOrigin-RevId: 385155453
2021-07-22 11:54:28 -04:00
Material Design Team
3eea60727f [AppBarLayout] Modify updateAppBarLayoutDrawableState logic to only require a child at an offset for conditions that depend on that child. For conditions that can be determined just based on the AppBarLayout, always check those conditions.
PiperOrigin-RevId: 385026332
2021-07-22 10:17:08 -04:00
dsn5ft
aaa0444308 [AppBarLayout] Added support for statusBarForeground lift on scroll elevation overlay for edge to edge mode and updated demo
Helpful for the case where the Top App Bar text/icons are still visible underneath a transparent status bar, when the Top App Bar is scrolled up.

PiperOrigin-RevId: 384985602
2021-07-22 10:11:22 -04:00
conradchen
a2e76736c5 [BottomSheetBehavior] Fix ViewDragHelper state inconsistency
When BottomSheetBehavior is set to not draggable, it's still forwarding touch event to ViewDragHelper, which causes ViewDragHelper changes its state to dragging although it's not really dragging. This causes bugs like if we change draggable to true during "no-effect" dragging, ViewDragHelper won't report the dragging state change because it thinks the state is not changing.

Fixes this by avoiding forwarding touch events to ViewDragHelper when it's not draggable, so its state won't be changed.

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

PiperOrigin-RevId: 384942764
2021-07-15 12:37:35 -04:00
zmunm
4acc56dceb [MaterialCardView] Add invalidate when stroke changed
Resolves https://github.com/material-components/material-components-android/pull/2173

GIT_ORIGIN_REV_ID=424c5862c22b41064ef473869bb0ca707bd53c13
PiperOrigin-RevId: 384921024
2021-07-15 12:35:51 -04:00
Maxwell
3bb0911d1b [BottomAppBar] Add functions for checking (STATE_SCROLLED_UP | STATE_SCROLLED_DOWN)
Resolves https://github.com/material-components/material-components-android/pull/2279

GIT_ORIGIN_REV_ID=93704406cbf827eddf9273b5f4b2e8a3cb467c03
PiperOrigin-RevId: 384775019
2021-07-15 12:34:59 -04:00
Afzal Najam
c3713724de [BottomSheet] Fix fitToContents reference in comment
Resolves https://github.com/material-components/material-components-android/pull/2196

GIT_ORIGIN_REV_ID=d996a3692496f60bd895df1a3a22b6bb4697d41f
PiperOrigin-RevId: 384750498
2021-07-15 12:33:43 -04:00
conradchen
7085319b35 [Chip] Fix touching cannot put focus on chips with Talkback
We disabled ChipTouchHelper on purpose to workaround a Talkback issue but we didn't stop forwarding touch/hover events to ChipTouchHelper, which cause some Talkback logic work incorrectly on certain API levels.

Adds a state variable to avoid using ChipTouchHelper when it's not registered as accessibility delegate to solve the issue.

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

PiperOrigin-RevId: 383911836
2021-07-12 19:41:11 +00:00
Material Design Team
2d589bd351 [RangeSlider] Fix minSeparation having no effect when stepSize > 0
Resolves https://github.com/material-components/material-components-android/issues/2147

Note: `minSeparation` cannot be set as a dimension when using `stepSize`, make sure to use `rangeSlider.setMinSeparationValue()`.
PiperOrigin-RevId: 383893367
2021-07-12 19:39:32 +00:00
conradchen
31ca1106ab [Chip] Report a11y class name as RadioButton in single selection mode
Also consolidates the logic of reporting a11y class name.

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

PiperOrigin-RevId: 383849367
2021-07-12 19:38:32 +00:00
ymarian
b06446006c [Card] Fix checked icon tint for API < 21, BitmapDrawables
Resolves https://github.com/material-components/material-components-android/issues/1993

PiperOrigin-RevId: 383754894
2021-07-09 15:29:15 -04:00
Wilson Filho
a38d2d89a8 [BottomSheet] Add maxHeight to bottom sheet behavior
Resolves https://github.com/material-components/material-components-android/pull/2216

GIT_ORIGIN_REV_ID=be136b9c5cedfb018b5a05fecac5ea9a3e242f36
PiperOrigin-RevId: 383682661
2021-07-09 15:28:02 -04:00
Ian Lake
501ef8ea2a [NavigationRailView] Update inset handling for Navigation Rail & Bottom Nav
Resolves https://github.com/material-components/material-components-android/pull/2253

GIT_ORIGIN_REV_ID=b6c2270b8855e38231c29cbfd48949afd785258c
PiperOrigin-RevId: 383632982
2021-07-08 16:01:01 +00:00
conradchen
4044183f46 [TextInputLayout] Apply tint when setting start icons
If startIconTint is a plain color, refreshStartIconDrawableState() won't update the tint to the new drawable. To solve the issue and make the logic be consistent, calls applyStartIconTint() when a new icon is set.

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

PiperOrigin-RevId: 383632467
2021-07-08 15:59:37 +00:00
conradchen
456f135627 [Button] Fix progress indicator is not shown when set as the icon
MaterialButton is using TextViewCompat.setCompoundDrawablesRelative() under the hood to implement setIcon() operation. TextViewCompat won't call its compound drawables' setVisible() method, on which we rely to start progress indicator drawables automatically.

Calls setVisible() explicitly to start progressing.

Also adds a demo to catalog.

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

PiperOrigin-RevId: 383483364
2021-07-08 15:58:13 +00:00
conradchen
717774ec7f [TextField] Do not load default drawable if custom end icon is being used
Resolves https://github.com/material-components/material-components-android/issues/2085

PiperOrigin-RevId: 382785324
2021-07-07 19:21:28 +00:00
conradchen
db8b239021 [Slider] Do not invoke OnChangeListeners when restoring states
Calling setValueInternal() will invoke OnChangeListeners if the values have been changed. We shouldn't unconditionally invoke listeners again, otherwise:

- If values haven't changed, OnChangeListeners will still be fired.
- If values have changed, OnChangeListeners will be fired twice.

Removes the unconditional invocation to solve the issue.

PiperOrigin-RevId: 382785198
2021-07-07 19:20:57 +00:00
dniz
655dde062a [CollapsingToolbarLayout] Added option to add extra height when title text spans across multiple lines
PiperOrigin-RevId: 382716405
2021-07-02 08:16:09 -04:00
conradchen
58ceeab63c [SnackBar] Handle anchor view properly so no memory leak will happen
The anchor view can be detached even when the snack bar (or any
transient bottom bar) is showing. If this situation happens the
global layout listener it registers with the anchor view will
become not removable due to a bug/intended behavior of Android View's
implementation.

We need to remove the listener when the anchor view is detached to
fix the issue.

This CL also refactors the whole implementation of anchor view and consolidates
the anchoring/unanchoring logic to improve readability and robustness of it.

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

PiperOrigin-RevId: 382603130
2021-07-02 08:15:03 -04:00
dniz
9ebf1a1387 [CollapsingToolbarLayout] Added option to force always applying system window inset top regardless of layout_height
PiperOrigin-RevId: 382286923
2021-07-01 06:49:33 -07:00