2001 Commits

Author SHA1 Message Date
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
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