2136 Commits

Author SHA1 Message Date
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
dniz
af35dfb86b [CollapsingToolbarLayout] Fixed multiline RTL collapsed title text position
PiperOrigin-RevId: 382073266
2021-07-01 06:46:14 -07:00
leticiars
782dffa8b7 [Divider] Added new Divider component to the library and Divider doc.
PiperOrigin-RevId: 381858673
2021-06-28 13:08:28 -07:00
conradchen
e92ebdef09 [Tab] Redraw indicators after their color is updated
Also supports setting indicator color to transparent.

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

PiperOrigin-RevId: 381541396
2021-06-28 13:07:40 -07:00
conradchen
8431bd43eb [RangeSlider] Fix halo showing under wrong thumbs
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
2021-06-28 13:06:21 -07:00
conradchen
5973920cff [Badge] Update badge position after clearing numbers
Resolves https://github.com/material-components/material-components-android/issues/2123

PiperOrigin-RevId: 381337622
2021-06-28 13:03:50 -07:00
conradchen
cb5d622f13 [DatePicker] Avoid NPE caused by getSelection() before created
Resolves https://github.com/material-components/material-components-android/issues/2169

PiperOrigin-RevId: 381325077
2021-06-28 13:00:18 -07:00
conradchen
eb7b11478b [DatePicker] Fix opening at the selected date in the end month
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
2021-06-28 12:56:36 -07:00
conradchen
35c2af3c2d [TimePicker] Hide cancel button when it's not cancelable
Resolves https://github.com/material-components/material-components-android/issues/2245

PiperOrigin-RevId: 381268475
2021-06-28 12:54:41 -07:00
conradchen
c08a07d7e8 [Chip] Fix icon tint states are not updated after setting new icon
A drawable's tint will affect the result of drawable.isStateful().
After updating a new icon drawable, we should set tint first before
we check and update its state.

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

PiperOrigin-RevId: 381262641
2021-06-28 12:49:17 -07:00
leticiars
acf08f7640 [Divider] Added divider demo in catalog
PiperOrigin-RevId: 381249847
2021-06-28 12:47:45 -07:00
conradchen
8a4f42aca7 [TextField] Make clear text icon focusable
The current logic hides clear text icon whenever edit text loses its
focus. Therefore, the clear text icon can never be focused. Changes
the logic so it retains clear text icon if it has focus.

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

PiperOrigin-RevId: 380802379
2021-06-24 13:00:34 -07:00
conradchen
b0558dc006 [Snackbar] Fix memory leak caused by not resetting anchor views
PiperOrigin-RevId: 379830572
2021-06-17 14:51:36 -04:00
Sascha Huth
77c2a8383c [BottomSheet] make FloatRange for setHalfExpandedRatio() exclusive
Resolves https://github.com/material-components/material-components-android/pull/2239

GIT_ORIGIN_REV_ID=2eb3b01052ed017f23a53e5db121bb0c571f0fe6
PiperOrigin-RevId: 379791479
2021-06-17 14:30:42 -04:00
haodong
cd5c2cc03f [ProgressIndicator] Added the OnAnimationEndListener adder and remover for spring animation used in determinate drawable.
Resolves https://github.com/material-components/material-components-android/issues/1919

PiperOrigin-RevId: 379523158
2021-06-15 22:04:10 -07:00
conradchen
f732070619 [ProgressIndicator] Fix NPE caused by animatorCompleteCallback not set
PiperOrigin-RevId: 379509725
2021-06-15 22:03:11 -07:00
Material Design Team
f9a1b170dd Internal cleanup.
PiperOrigin-RevId: 379505436
2021-06-15 22:02:19 -07:00
conradchen
281688a2f2 [DatePicker] Fix DatePicker crashes and and potential issue of range selection
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
2021-06-15 21:56:07 -07:00
haodong
209bad3299 [ProgressIndicator] Enabled switch from indeterminate mode to determinate mode while visible.
Resolves https://github.com/material-components/material-components-android/issues/1921

PiperOrigin-RevId: 378944543
2021-06-14 18:33:33 +00:00
Material Design Team
b4982f9cdc [BottomSheet] Adds additional methods that are restricted to the library. They will be used for Experiment and deleted/revised after experiment.
PiperOrigin-RevId: 378874986
2021-06-14 18:32:13 +00:00
afohrman
720088c5c2 [BottomNavigationView] Added deprecation Javadoc for BottomNavigationView#OnNavigationItemSelectedListener and BottomNavigationView#OnNavigationItemReselectedListener.
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
2021-06-09 18:20:52 +00:00
Material Design Team
ed719b2ad9 Update @SuppressWarnings annotations for go/nullness diagnostics
PiperOrigin-RevId: 377367820
2021-06-09 18:06:34 +00:00
dniz
ae82585b79 [CollapsingToolbarLayout] Added experimental setRtlTextDirectionHeuristicsEnabled() method
PiperOrigin-RevId: 377044268
2021-06-02 16:47:05 -04:00
hunterstich
b3b12f9051 Automated g4 rollback of changelist 372931550
PiperOrigin-RevId: 375483052
2021-05-24 17:11:44 -07:00
haodong
e3343326ab [MaterialToolbar & BottomAppBar] Updated navigationIconTint implementation to mutate drawable to prevent tinting drawable globally
Resolves https://github.com/material-components/material-components-android/issues/2207

PiperOrigin-RevId: 375130975
2021-05-21 14:12:02 -07:00
dniz
5c147722ed [CollapsingToolbarLayout] Added support for expanded and collapsed title text color attributes
PiperOrigin-RevId: 375103699
2021-05-21 14:10:28 -07:00
conradchen
7adfd93d80 [TooltipDrawable] Adding android:textColor support
PiperOrigin-RevId: 374887222
2021-05-20 14:03:30 -07:00
haodong
f9687312cb [ProgressIndicator] Fix first animated progress update issue.
Resolves https://github.com/material-components/material-components-android/issues/2051

PiperOrigin-RevId: 374712804
2021-05-19 13:23:36 -07:00
hunterstich
0ef2e910ce [TopAppBar] Fix title fade mode collapsing title position errors.
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
2021-05-19 13:21:52 -07:00
dniz
9b92fd8f46 [TextAppearance] Added a TextAppearanceConfig.shouldLoadFontSynchronously() check to allow forcing synchronous font loading for edge cases
PiperOrigin-RevId: 374702022
2021-05-19 13:19:40 -07:00
dniz
841f229592 [CollapsingToolbarLayout] Fixed RTL text only laying out as RTL when actual text is RTL
PiperOrigin-RevId: 374663684
2021-05-19 11:00:25 -07:00
conradchen
b8c9f4949d [MaterialShapeDrawable] Move static paint initialization to static block
PiperOrigin-RevId: 374650659
2021-05-19 10:59:31 -07:00
conradchen
b420eab0bc [TimePicker] Make display divider styling more flexible
PiperOrigin-RevId: 373818786
2021-05-14 15:32:10 -04:00
afohrman
c92e6934d5 [TextInputLayout] Added a fade transition to placeholder TextView's appear and disappear.
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
2021-05-14 15:29:49 -04:00
conradchen
818f253ade [MaterialTimePicker] Make time text input fields stying more flexible
PiperOrigin-RevId: 373199267
2021-05-14 15:20:30 -04:00
Material Design Team
43cfc050f8 [Elevation] Added manual constructor for ElevationOverlayProvider.
Allow instantiating ElevationOverlayProvider without access to a Context object, e.g. in Drawables where only Resources and Theme might be available.

PiperOrigin-RevId: 372977696
2021-05-11 12:58:36 -04:00
conradchen
37f0ca1a97 [MaterialDatePicker] Make calendar day of week label stying more flexible
PiperOrigin-RevId: 372976792
2021-05-11 12:56:55 -04:00
Material Design Team
915336b36c Automated g4 rollback of changelist 372538097
PiperOrigin-RevId: 372931550
2021-05-11 12:55:35 -04:00
hunterstich
c7541833b7 [CollapsingToolbarLayout] Updated fade mode to allow expanded title to translate 1:1 with scrolling content.
PiperOrigin-RevId: 372565826
2021-05-07 12:27:54 -04:00
leticiars
87b50c6aee [TextInputLayout] Fixed cutout padding so text field outline doesn't overlap collapsed hint.
Resolves https://github.com/material-components/material-components-android/issues/2127

PiperOrigin-RevId: 372563674
2021-05-07 12:27:01 -04:00
hunterstich
bd4914dd8b [Badge] Support differing offsets for badges with/without text, support badge width and padding in styles.
PiperOrigin-RevId: 372538097
2021-05-07 12:25:52 -04:00
leticiars
73bf653ef2 Automated g4 rollback of changelist 372177002
PiperOrigin-RevId: 372384266
2021-05-07 12:16:55 -04:00