145 Commits

Author SHA1 Message Date
dsn5ft
241aa5cd8b [CollapsingToolbarLayout] Added experimental API to allow generic customizations of the StaticLayout.Builder used for the title text
Example usage:

```
collapsingToolbarLayout.setStaticLayoutBuilderConfigurer(
    builder ->
        builder.setLineBreakConfig(
            new LineBreakConfig.Builder()
                .setLineBreakWordStyle(LineBreakConfig.LINE_BREAK_WORD_STYLE_PHRASE)
                .build()));
```

PiperOrigin-RevId: 455625977
2022-06-23 18:32:33 +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
dsn5ft
c5b37e6ea6 [MaterialToolbar] Add clearNavigationIconTint() method
Resolves https://github.com/material-components/material-components-android/issues/2678

PiperOrigin-RevId: 453220817
2022-06-06 14:25:49 -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
Venugopal Rao Gubbala
7b043c3b68 [CollapsingToolbarLayout] Allow application to Set ellipsis to Title in CollapsingToolBar
Resolves https://github.com/material-components/material-components-android/pull/2636

GIT_ORIGIN_REV_ID=f6c2b07c1eb936ed2de47b7586688a5f6b322e48
PiperOrigin-RevId: 445200467
2022-04-28 16:26:58 -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
dsn5ft
b49284ec75 [M3][Toolbar] Hide shadows on all M3 Toolbar styles, not just Surface style
Resolves https://github.com/material-components/material-components-android/issues/2552

PiperOrigin-RevId: 429059800
2022-02-18 15:40:35 +00:00
P1NG2WIN
b01051b8bc [MaterialToolbar] Support scaleType and adjustViewBounds for logo
Resolves https://github.com/material-components/material-components-android/pull/2562

GIT_ORIGIN_REV_ID=c675c6a12e2fc242d2e9e019913df650b87eea2b
PiperOrigin-RevId: 428837808
2022-02-15 19:52:03 +00:00
pfthomas
0f2b5378f7 [Top App Bar][ActionMode] Make title and subtitle match ActionBar's
Resolves https://github.com/material-components/material-components-android/issues/2189

PiperOrigin-RevId: 425712147
2022-02-01 22:00:53 -08: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
Dan Nizri
b7c7d18834
Revert "[Material Toolbar] Change logo scaleType and set logo adjustViewBounds" 2021-12-01 18:41:20 -05:00
Jose Figueroa
71a110fe89
Merge pull request #2406 from P1NG2WIN/master
[Material Toolbar] Change logo scaleType and set logo adjustViewBounds
2021-12-01 16:47:25 -05:00
Material Design Team
a487c89185 Internal change
PiperOrigin-RevId: 412135443
2021-11-29 17:35:39 +00:00
jeremymuhia
65754bd152 [CollapsingToolbarLayout][a11y] collapsing toolbar layout not respecting system level bold
PiperOrigin-RevId: 410846065
2021-11-29 16:53:01 +00:00
P1NG2WIN
9f7a6ea667 fix 2021-11-04 03:42:55 +02:00
P1NG2WIN
71489349df Merge remote-tracking branch 'origin/master' 2021-11-02 12:59:53 +02:00
P1NG2WIN
2cf8ef0c96 fix 2021-11-02 12:59:35 +02: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
dsn5ft
9ae56ceedd [Javadocs] Remove all broken attr links from Javadocs
PiperOrigin-RevId: 404246710
2021-10-20 19:06:18 +00:00
pekingme
9de9319b1e [Resources] Added styles in res-public.
PiperOrigin-RevId: 403451624
2021-10-18 15:31:13 -04:00
P1NG2WIN
18d95124c7
Merge branch 'master' into master 2021-10-14 14:28:26 +02:00
Riccardo Ciovati
1b8fb30370 [CollapsingToolbarLayout] Allow customizing the title position interpolator
Resolves https://github.com/material-components/material-components-android/pull/1757

GIT_ORIGIN_REV_ID=87dea3a74d8a8f460cc9beb32bcb783f71ee6e63
PiperOrigin-RevId: 401826042
2021-10-11 10:59:08 -04:00
P1NG2WIN
0f3e86dfdc fix 2021-10-06 01:34:09 +02: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
P1NG2WIN
db0a58cd3f refresh layout 2021-10-03 21:26:04 +02:00
P1NG2WIN
a84c7541df logoScaleType + logoAdjustViewBounds 2021-10-03 21:23:58 +02:00
dsn5ft
c40ac672d8 [M3][Docs] Updated Top App Bar dev doc to Material3 and added new styles/attrs to res-public
PiperOrigin-RevId: 398465771
2021-09-23 19:37:46 +00: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
dsn5ft
445c4979b3 [M3][Top App Bar] Updated ActionBar and ActionMode styling
PiperOrigin-RevId: 397107223
2021-09-20 10:59:34 -07:00
huangtongnao
b7786451ca [AppBarLayout] fix stateListAnimator related elevation bug
Resolves https://github.com/material-components/material-components-android/pull/1190

GIT_ORIGIN_REV_ID=61ad9889e0c99f89b5df70f5bddb86ebd745af4f
PiperOrigin-RevId: 394234794
2021-09-01 17:05:16 -04:00
extmkv
9382bb03c3 [CollapsingToolbarLayout] When scrimAnimator already created we must update the duration when calling setScrimAnimationDuration
Resolves https://github.com/material-components/material-components-android/pull/1575

GIT_ORIGIN_REV_ID=7e3f5f99fa650b0282a5338eac254ec71593e795
PiperOrigin-RevId: 394035205
2021-09-01 17:03:15 -04:00
dsn5ft
ebacf79ec1 [M3][Top App Bar] Reorganize styles
PiperOrigin-RevId: 392705930
2021-08-24 15:57:22 -04:00
conradchen
8123c63747 [Menu] Fix toolbar menu arrow not visible
In toolbar styles we use android:theme to override text and icon colors and set ?attr/colorControlNormal to ?attr/colorOnPrimary, which is the same color (white) in the light mode as the menu background. To override this behavior again, we need to use ?attr/popupTheme and set ?attr/colorControlNormal to ?attr/colorOnSurface.

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

PiperOrigin-RevId: 392003704
2021-08-23 09:36:09 -07:00
dsn5ft
cb74134075 [M3][Top App Bar] Fixed collapsing toolbar collapsed title text appearance
PiperOrigin-RevId: 391821355
2021-08-23 09:27:39 -07:00
dsn5ft
18490ff82d [M3][Top App Bar] Added new AppBarLayout, CollapsingToolbarLayout, and Toolbar styles and updated Catalog pages + demos
PiperOrigin-RevId: 391755524
2021-08-23 09:20:24 -07:00
pfthomas
ec3f96cbb9 [CollapsingToolbarLayout] Fix expanded height incorrect after rotation
PiperOrigin-RevId: 391547762
2021-08-18 10:27:05 -07: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
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
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
ae82585b79 [CollapsingToolbarLayout] Added experimental setRtlTextDirectionHeuristicsEnabled() method
PiperOrigin-RevId: 377044268
2021-06-02 16:47:05 -04:00