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
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
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
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
Halo's showing position depends on the focused thumb index, which
would not be updated if there's no need to snap the thumb position.
This causes halo shows under the previously focused thumb if you
click on the exact position of the new thumb.
Always updates the focused thumb when doing snapping to solve the
issue.
Resolves https://www.google.com/url?q=https://github.com/material-components/material-components-android/issues/2150
PiperOrigin-RevId: 381533677
When the selected date is in the end month, the UTC timestamp of it
will be larger than the end month's, which cause us incorrectly
treat the selected date as invalid.
Fixes the logic by consistently use Month as the time unit to do
comparison.
Resolves https://github.com/material-components/material-components-android/issues/2101
PiperOrigin-RevId: 381280448
GridView used to display days in months can be scrolled when there are more rows
than the space can contain. Usually this happens when a month spans over 6 rows. In this case, the position of the day in a month will not be the same as its corresponding view position in the grid view. This can cause:
1. Wrong day view being highlighted.
2. Crashes due to out-of-bound index. (The day position can be larger than view
counts due to invisible days.)
PiperOrigin-RevId: 379382943
The listeners were deprecated in favor of `NavigationBarView#OnItemSelectedListener` and `NavigationBarView#OnItemReselectedListener`, but deprecation documentation was never added, so it's unclear what developers should use instead.
Also removed internal usages of these deprecated usages in the catalog and in tests.
PiperOrigin-RevId: 378021534
Flinging the AppBarLayout can cause a negative number to be passed to CollapsingTextHelper#calculateOffsets, causing the collapsed title in fade mode to be positioned incorrectly.
PiperOrigin-RevId: 374704850
The placeholder TextView previously appeared and disappeared with no fade, which led to a jarring effect and an overlap between the hint text and the placeholder text.
PiperOrigin-RevId: 373713144
Allow instantiating ElevationOverlayProvider without access to a Context object, e.g. in Drawables where only Resources and Theme might be available.
PiperOrigin-RevId: 372977696