69 Commits

Author SHA1 Message Date
conradchen
7b8faef12b [TopAppBar] Fix input rectangle being modified in onRequestChildRectangleOnScreen()
Resolves https://github.com/material-components/material-components-android/issues/3054

PiperOrigin-RevId: 491440304
2022-11-28 17:17:40 -05:00
rightnao
c8108b1f8e [TopAppBar] Update motion specs
PiperOrigin-RevId: 480953621
2022-10-13 21:01:26 +00:00
rightnao
c587dd1259 [AppBarLayout] Adding new attribute liftOnScrollColor that disables elevation overlay and allows users to change the app bar color
PiperOrigin-RevId: 477794812
2022-10-03 16:57:13 +00:00
rightnao
9df6c9d072 [AppBarLayout] Fix issue with a physical keyboard scroll not collapsing toolbar
PiperOrigin-RevId: 471608866
2022-09-01 17:22:43 -07:00
rightnao
14415a1308 [AppBarLayout] Make a new setter for scroll effect and make SCROLL_EFFECT_COMPRESS public
resolves https://github.com/material-components/material-components-android/issues/2894

PiperOrigin-RevId: 471289613
2022-08-31 15:55:37 -07:00
conradchen
10ac255bb2 Automated g4 rollback of changelist 457744460
PiperOrigin-RevId: 459744654
2022-07-08 13:27:04 -07:00
conradchen
ca2da6c6a4 Automated g4 rollback of changelist 454163860
PiperOrigin-RevId: 457744460
2022-06-29 14:36:58 +00:00
conradchen
687e73590d [TopAppBar] Exclude gone views from scroll range calculation
Resolves https://github.com/material-components/material-components-android/issues/2709

PiperOrigin-RevId: 454163860
2022-06-10 16:38:51 -07:00
pubiqq
382ce9c792 [TopAppBar] Fix copy constructors
Resolves https://github.com/material-components/material-components-android/pull/2686

GIT_ORIGIN_REV_ID=7f62b56c7edf01046e85b474d1cf0f17c6153b68
PiperOrigin-RevId: 450440535
2022-05-23 11:20:15 -04:00
Material Design Team
4b81bb1d1a [AppBarLayout] Loosen check for scrollable child when adding a11y actions
Adding the a11y delegate and a11y actions was dependent on there being a CoordinatorLayout child that both inherits from certain scrolling classes (NestedScrollingChild, ListView, ScrollView) and has an AppBarLayout scrolling behavior. This was too restrictive and so we only check for a behavior.

Any scrolling child may add an a11y delegate or scroll action to the parent CoordinatorLayout.

PiperOrigin-RevId: 448335380
2022-05-12 17:24:36 -04:00
Material Design Team
72228f4f35 [AppBarLayout] Fix scrolling for a11y
Ensure the CoL can scroll to the bottommost elements of the scrolling child, which may not be visible due to the app bar.
Also, set the node info properties to expose the CoL to auto-scrolling.

PiperOrigin-RevId: 447596411
2022-05-10 09:48:55 -04:00
dsn5ft
d6c435461e [AppBarLayout] Add setLiftOnScrollTargetView() method
Resolves https://github.com/material-components/material-components-android/pull/2544

PiperOrigin-RevId: 442823082
2022-04-19 12:02:59 -04:00
conradchen
05be1b92c5 [TopAppBar] Fix app:expanded=false not working
When an AppBarLayout is loaded, it will load the attribute and set up a non-forcing pending action. However when it's measured, the current scroll state will be saved and restored, which will override the non-forcing pending action. This behavior is incorrect - if there's a pending action, we shouldn't restore the scrolling state because it's meant to be changed.

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

PiperOrigin-RevId: 440960254
2022-04-11 15:47:00 -04:00
conradchen
698cf9b45e [AppBarLayout] Save and restore scroll state during scroll range recalculation
When scroll range changes, the current scroll position may not make sense anymore. Therefore we need to save the scroll state and restore it after the scroll range is invalidated. This change reuses and refactors the existing saving instance state logic to support this need. Also adds a flag to denote "fully expanded" state to avoid improper scroll position calculation when views are still being initialized.

PiperOrigin-RevId: 421348135
2022-01-13 12:15:17 -05:00
Material Design Team
cfc00aa5a3 Update android core class definitions across material
PiperOrigin-RevId: 414839941
2021-12-08 14:56:25 +00:00
conradchen
acb7958c66 [TopAppBar] Fix top app bar snapping issue
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
2021-12-06 19:34:30 +00:00
Material Design Team
a487c89185 Internal change
PiperOrigin-RevId: 412135443
2021-11-29 17:35:39 +00:00
Khang NT
b935604e2c [AppBarLayout] Fix snap issue with transparent status bar
Resolves https://github.com/material-components/material-components-android/pull/2387

GIT_ORIGIN_REV_ID=47538c3b4cb10337c537d1ef532bd1d73b216ae3
PiperOrigin-RevId: 406835368
2021-11-01 19:53:05 +00:00
conradchen
7fc006c5e4 [TopAppBar] Fix the issue that top app bars not collapsed when top padding is set
In the snap logic we didn't take the AppBarLayout's top padding into account, therefore in certain cases the scrolling will be incorrectly snapped to the top of CollapsingToolbarLayout instead of the bottom of it, which cause the title not collapsed.

PiperOrigin-RevId: 400749401
2021-10-05 09:04:10 -04:00
conradchen
4bec3e2b13 [AppBar] Fix incorrect scroll position after orientation changes
An app bar remembers the visible percentage of its first visible child during recreation to restore its scroll position. However, if an app bar is "fully" scrolled (scrolled to its maximum range), gets recreated, and changes its size after recreation, it can become not fully scrolled even if it keeps the same visible percentage of its first visible child, due to the difference in its own size. This can result in unexpected "gaps" in the layout due to inconsistency between AppBar layout's scroll position and the content view's.

Fixes this by remembering the "fully scrolled" state and restore it during recreation.

PiperOrigin-RevId: 398013525
2021-09-23 19:18:08 +00: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
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
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
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
hunterstich
586d5543e2 [AppBarLayout] Added compress scroll effect.
PiperOrigin-RevId: 370090494
2021-04-23 14:49:12 -04:00
dniz
2a639a311e [AppBarLayout] Fix spec link in Javadoc
PiperOrigin-RevId: 353032509
2021-01-21 12:55:18 -08:00
dniz
4a0f60c62d [AppBarLayout] Added isLifted() getter
PiperOrigin-RevId: 331606863
2020-09-15 09:27:58 -07:00
marianomartin
555356b03f Internal cleanup
PiperOrigin-RevId: 318134343
2020-06-26 14:06:52 -04:00
Material Design Team
342ea9ad25 Internal cleanup
PiperOrigin-RevId: 317147378
2020-06-19 13:42:35 -04:00
Material Design Team
76ffe35fef Cleanup
PiperOrigin-RevId: 313865830
2020-06-01 16:52:06 -04:00
isabellekim
1f9de68025 [All] Add support for materialThemeOverlay
Resolves https://github.com/material-components/material-components-android/pull/948

GIT_ORIGIN_REV_ID=5a8bb35a56c1b813df47d964de8482a26e0da66d
PiperOrigin-RevId: 293839172
2020-02-10 09:55:19 -05:00
Material Design Team
0a03911f89 Add more a11y support to AppBarLayout's BaseBehavior.
PiperOrigin-RevId: 289692654
2020-01-14 15:05:59 -08:00
dniz
2059499085 Fix AppBarLayout statusBarForeground issue where status bar drawable is drawn behind content
Resolves https://github.com/material-components/material-components-android/issues/824

PiperOrigin-RevId: 285981837
2019-12-17 17:07:12 -05:00
Material Design Team
5f017cd5cd Migrate away from deprecated behavior annotation
PiperOrigin-RevId: 271616445
2019-09-27 14:59:16 -04:00
Material Design Team
5e9b0dd917 Automated g4 rollback of changelist 267646424
PiperOrigin-RevId: 267814621
2019-09-12 13:51:28 -04:00
Material Design Team
2d03e4084d Migrate away from deprecated behavior annotation
PiperOrigin-RevId: 267646424
2019-09-12 13:49:58 -04:00
marianomartin
215a839598 Internal cleanup
PiperOrigin-RevId: 267504117
2019-09-12 13:48:16 -04:00
cketcham
cb1674662a Add @NonNull and @Nullable annotations
PiperOrigin-RevId: 264619150
2019-08-26 11:01:22 -04:00
dniz
cc73c2a630 Update TODOs
PiperOrigin-RevId: 259535844
2019-07-23 11:21:39 -04:00
isabellekim
a628bf516b Revert the library to compile with Java 7: revert lambdas, add necessary casts, and make some variables final.
Continue compile shrine demo, catalog, and tests with Java 8.

PiperOrigin-RevId: 257874888
2019-07-15 19:19:23 -04:00
marianomartin
164bf0fabd Internal cleanup
PiperOrigin-RevId: 255609320
2019-07-03 14:02:53 -04:00
dniz
5df3bebd63 Update elevation overlays to be based absolute elevation, factoring in the elevation of all parent views
Will follow-up with TabLayout absolute elevation separately

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

PiperOrigin-RevId: 255404830
2019-07-03 13:55:49 -04:00
marianomartin
367b295624 Internal cleanup
PiperOrigin-RevId: 254414602
2019-06-24 17:12:42 -04:00
dniz
3b7e1b4d71 Update AppBarLayout lift on scroll finding of liftOnScrollTargetViewId to be based on nested scrolling view instead of Activity when possible
PiperOrigin-RevId: 253637012
2019-06-18 13:47:01 -04:00
marianomartin
b9147d4f2d Remove some lint warnings from baseline
PiperOrigin-RevId: 253036361
2019-06-18 13:24:50 -04:00
cketcham
bff75f2d3e Update to lamdas
PiperOrigin-RevId: 252846439
2019-06-18 13:21:02 -04:00
marianomartin
5a5d311a36 Check more lint warnings, show warnings as errors.
PiperOrigin-RevId: 252822573
2019-06-18 13:20:15 -04:00
Material Design Team
3c5f9f6cb0 Migrate CoordinatorLayout android support libraries to androidx
PiperOrigin-RevId: 248819271
2019-05-21 12:03:28 -04:00