This CL fixes a couple of badge state related issues. First, it prevents the badges created before restoring instance states from being overwritten by the old instance states. Second, it makes badges reload their default style settings everytime when its being recreated so if the environment has been changed, the default values will reflect the environment change.
This CL also fixes that several attributes were not correctly saved/restored or their default values were not correctly loaded.
Resolves https://github.com/material-components/material-components-android/issues/2032
PiperOrigin-RevId: 420096508
1. Consolidates single selected ID and multiple selected IDs to a single selected
ID set.
2. Separates View states and internal checked states so we can focus and enforce
policies much easier on only internal states.
PiperOrigin-RevId: 420087718
The snack bar content layout is by default horizontal, and we only change it to vertical when the action view is too wide and ellipsizes the message text. Therefore if the layout orientation is already vertical, we should just keep the layout and no need to check if the message text is multi-line again.
Resolves https://github.com/material-components/material-components-android/issues/1876
PiperOrigin-RevId: 419885582
1. Consolidates single selected ID and multiple selected IDs to a single selected
ID set.
2. Separates View states and internal checked states so we can focus and enforce
policies much easier on only internal states.
Resolves https://github.com/material-components/material-components-android/issues/2263
PiperOrigin-RevId: 418054400
Changes are mostly to keep start/end layouts and icon views hidden (visibility = gone) when they are not needed.
Resolves https://github.com/material-components/material-components-android/pull/2326
GIT_ORIGIN_REV_ID=0393ac65d562bc87d340ec7bb260ebba99a1ac3b
Co-authored-by: leticiarossi <9288695+leticiarossi@users.noreply.github.com>
PiperOrigin-RevId: 418038435
The same remapping is done on API 21+ by framework base themes. On API levels lower than 21, AppCompat base themes "backport" the behavior to map window background to a separate color resources. With Material 3 we want a consistent and clear behavior, this CL explicitly remaps android:windowBackground to android:colorBackground so the behavior will be the same across all API levels.
PiperOrigin-RevId: 417711790
We missed to include top/bottom insets of button styles into dialog action margin calculation. Also the paddings between titles and messages were not correct.
PiperOrigin-RevId: 417626927
It seems like on Android 8 & 9 framework's View implementation has a bug that under certain scenarios if we set a view's visibility when view.getParent() is null, it can cause NPE crash.
Fixes this by switching the order of addView and setVisibility() call.
Resolves https://github.com/material-components/material-components-android/issues/917
PiperOrigin-RevId: 413978332
During a previous refactoring, the maxWidth enforcement logic was incorrectly moved to the inner layout of snackbar. Moves the logic back to the outer layout so it can be properly applied.
PiperOrigin-RevId: 413938993
Unlike other child views of AppBarLayout, CollapsingToolbarLayout will shift its top boundary to consume the window insets as well. Therefore we need to shift the top boundary back when calculating snapping positions to have a consistent logic with other views.
This CL also simplifies the calculation so the origin of the y-coordinate used in the calculation will always be the top of the AppBarLayout.
PiperOrigin-RevId: 413750156
According to the spec the centered dialog theme overlay should have message text start-aligned and it's also the previous behavior in old MaterialComponent theme overlay.
Spec: https://m3.material.io/components/dialogs/specs
PiperOrigin-RevId: 413671708
The issue is caused by failing to correctly take the daylight saving time into account - internally we use UTC time to represent dates, however when generating month titles we try to calculate the time difference of the UTC time and the local time, which can result in off-by-one errors when the first day of the month is also the first day of the daylight saving time, e.g., April 1, 1979 in Poland.
Fixes this by always using UTC time to generate month titles. Also clears the relevant implementation for a little bit since context is actually not required when we only need to format years and months.
Resolves https://github.com/material-components/material-components-android/issues/1935
PiperOrigin-RevId: 413505587
Use canvas.clipRect() to avoid drawing strokes in cutout areas instead of painting-it-white approach we are using right now.
PiperOrigin-RevId: 413246249
In the original logic we compares interpolated text size to decide if the available width should be the collapsed one or the expanded one. This logic wouldn't work if the collapsed text size and the expanded text size are the same. Refactors the logic to make the decision by interpolating fraction directly.
Resolves https://github.com/material-components/material-components-android/issues/2459
PiperOrigin-RevId: 410901171
After letter spacing is correctly set in CollapsingTextHelper.calculateUsingTextSize(), we no longer need to set letter spacing separately for collapsed and expanded titles. Also this enhances the logic by using textPaint consistently in CollapsingTextHelper.calculateBaseOffsets(), which was not the case before the change. (We got text height from textPaint and text width from tmpPaint.)
PiperOrigin-RevId: 410888232
Now clicking on dropdown menu via switch access triggers the dropdown list. Plus, the arrow icon is set to be not important for a11y only for screen readers.
PiperOrigin-RevId: 410858001