56 Commits

Author SHA1 Message Date
dsn5ft
d13bfdf3cd [Predictive Back] Update SearchView and NavigationView to unregister back callbacks when detached from window
Resolves https://github.com/material-components/material-components-android/issues/4176

PiperOrigin-RevId: 633969673
2024-05-15 16:58:34 +00:00
pubiqq
510881a469 [Internal] Stop using deprecated androidx.core.view.* methods
Resolves https://github.com/material-components/material-components-android/pull/4117

GIT_ORIGIN_REV_ID=dd157e8360c2511810496693cec1616fce578655
PiperOrigin-RevId: 632284856
2024-05-13 17:37:38 +00:00
Ga\u00ebtan Muller
b3fe6a7f61 [Cleanup] Remove redundant version checks for api <= 19.
Resolves https://github.com/material-components/material-components-android/pull/3849

GIT_ORIGIN_REV_ID=47bb2fcc8031740e5a7d4f741f1ada2af025e126
PiperOrigin-RevId: 632154861
2024-05-09 18:46:02 +00:00
dsn5ft
c8b9b1c0bb [Predictive Back][Navigation Drawer] Animate corners during predictive back when no drawerLayoutCornerSize is set
PiperOrigin-RevId: 596056382
2024-01-05 23:58:37 +00:00
dsn5ft
bccbd4f778 [Predictive Back][NavigationView] Fix issue where predictive back is not enabled in NavigationView after rotating the screen or restarting the activity when the NavigationView is already opened as a drawer
Resolves https://github.com/material-components/material-components-android/issues/3593

PiperOrigin-RevId: 569181523
2023-10-02 13:38:12 +00:00
pubiqq
0663019f45 [Color] Add ColorStateListDrawable support
Resolves https://github.com/material-components/material-components-android/pull/3538

GIT_ORIGIN_REV_ID=1bf9e320dc148e1bc959e7577372d3a393f35574
PiperOrigin-RevId: 563258432
2023-09-07 12:37:54 +00:00
rightnao
eba40e9345 [NavigationView] Set material drawable background if the background has been set as a ColorStateList
resolves https://github.com/material-components/material-components-android/issues/3529

PiperOrigin-RevId: 558861471
2023-08-21 19:12:27 +00:00
rightnao
e3b255b3a0 [Docs] Crosslink github docs in javadocs
PiperOrigin-RevId: 546393704
2023-07-11 19:37:37 +00:00
afohrman
f2e70d2d66 [Android U] Replaced BuildCompat#isAtLeastU() method calls with explicit SDK checks for UPSIDE_DOWN_CAKE.
Before 1.12.0-alpha01 which was released on 6/7, BuildCompat#isAtLeastU() only returns true if API level is greater than 33 and the version running is a pre-release. Two things happened on 6/7 -- the version became a "platform stable" version, and core library version 1.12.0-alpha01 was released, which changes BuildCompat#isAtLeastU() to return true if the version is 34 and stable.

PiperOrigin-RevId: 540304068
2023-06-14 12:45:51 -07:00
hunterstich
a67a885668 [Predictive Back] Update components to use BackEventCompat
Clients should prefer listening to back events using androidx.activity.OnBackPressedCallback which has been updated to forward BackEventCompat objects in androidx.activity:activity:1.8.0-alpha05. This updates component predictive back APIs to take in BackEventCompat objects instead of android.window.BackEvent objects to simplify usage - getting rid of the need for version checks and object conversions.

PiperOrigin-RevId: 540290323
2023-06-14 12:44:53 -07:00
pfthomas
022e217770 [Navigation] Add itemTextAppearanceActiveBoldEnabled attr
Resolves https://github.com/material-components/material-components-android/issues/3191
Resolves https://github.com/material-components/material-components-android/issues/3293

PiperOrigin-RevId: 539977391
2023-06-14 15:14:24 +00:00
hunterstich
c031144d26 [NavigationView] Updated NavigationView to use ViewOutlineProvider to handle corner clipping when possible and remove drawerLayoutCornerClippingEnabled attribute.
PiperOrigin-RevId: 527633449
2023-04-27 16:38:17 -04:00
dsn5ft
9405121f62 [Predictive Back] Update side container back helper to support containers with arbitrary child views
PiperOrigin-RevId: 525466973
2023-04-19 14:12:04 -07:00
dsn5ft
2c297faf4b [Predictive Back][Navigation Drawer] Infrastructure for back handling in components + Navigation Drawer predictive back support
- Added MaterialBackHandler interface and MaterialBackOrchestrator class
- Implemented animations in MaterialSideContainerBackHelper for NavigationView when DrawerLayout parent

PiperOrigin-RevId: 517399606
2023-03-20 21:10:22 +00:00
hunterstich
e3b493f5eb [NavigationView] Removed canvas clipping by default and added an option to enabled/disable manually
Clipping was used to clip navigation view and its children to a shape appearace. This is primarily useful when using a headerLayout that contains full bleed content that would obscure the top end corner shape. Material3 does not use as much imagery/color in the NavigationView header and disabling clipping by default is a nice performace improvement.

PiperOrigin-RevId: 513301639
2023-03-01 23:08:28 +00:00
pubiqq
e06a11982b [Internal] Add compat method to get the screen size
Resolves https://github.com/material-components/material-components-android/pull/3221

GIT_ORIGIN_REV_ID=9323e23689386561d38b0c8c73114e0db7a30557
PiperOrigin-RevId: 509548792
2023-02-15 10:25:53 -08:00
rightnao
cb384c5c2c [NavigationView] Disable drawing left and right insets if the nav bar is not edge to edge
resolves https://github.com/material-components/material-components-android/issues/3016

PiperOrigin-RevId: 484304490
2022-10-28 07:44:17 -07:00
pubiqq
88c448ed19 [NavigationView] Fix subheaderInsetEnd setter
Resolves https://github.com/material-components/material-components-android/pull/2979
Resolves https://github.com/material-components/material-components-android/issues/2975
Resolves https://github.com/material-components/material-components-android/issues/2976

GIT_ORIGIN_REV_ID=47659c14a2bc72f5c383e3b59dd9d45b60f6af95
PiperOrigin-RevId: 475868928
2022-09-22 17:36:02 +00:00
jeremymuhia
cfc307ed4e [NavigationView] fix navigation view item ripple
PiperOrigin-RevId: 434516655
2022-03-14 18:55:40 +00:00
Material Design Team
a487c89185 Internal change
PiperOrigin-RevId: 412135443
2021-11-29 17:35:39 +00:00
hunterstich
e8c1d98b16 [NavigationView] Added support for changing item size, divider insets, label insets, and corner size.
PiperOrigin-RevId: 398261933
2021-09-23 19:23:44 +00:00
conradchen
5d092b75a6 [Color] Internal change
PiperOrigin-RevId: 372355438
2021-05-07 12:14:33 -04:00
Tad Fisher
a6a750b4ae [NavigationView] Fix obtaining Activity in setupInsetScrimsListener
Resolves https://github.com/material-components/material-components-android/pull/1628
Resolves https://github.com/material-components/material-components-android/issues/1627

GIT_ORIGIN_REV_ID=4042d13c8326144184e46795b217b9172b6552ad
PiperOrigin-RevId: 327446397
2020-08-19 17:44:12 -04:00
Gabriele Mariotti
e6f05bca7e [NavigationView] Support for shapeAppearance and shapeAppearanceOverlay attributes
Resolves https://github.com/material-components/material-components-android/pull/1535

GIT_ORIGIN_REV_ID=f676794634c788fb906bc36c0feadb1628e36fb4
PiperOrigin-RevId: 323783155
2020-07-29 10:39:14 -04:00
marianomartin
555356b03f Internal cleanup
PiperOrigin-RevId: 318134343
2020-06-26 14:06:52 -04:00
Material Design Team
073382034a Migrate android.support.v4.content.ContextCompat to androidx
Android X migration

PiperOrigin-RevId: 315791679
2020-06-11 17:27:51 -07: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
marianomartin
f71d80a960 [NavigationView] Logic error when drawing nav bar scrim
Resolves https://github.com/material-components/material-components-android/issues/629

PiperOrigin-RevId: 273365055
2019-10-08 10:34:29 -04:00
Material Design Team
05367d4358 Fix fragment leak in Material NavigationView
Need to unregister the ViewTreeObserver, which was previously registered on the top-most View in the entire hierarchy.

PiperOrigin-RevId: 268532017
2019-09-12 14:21:38 -04:00
marianomartin
215a839598 Internal cleanup
PiperOrigin-RevId: 267504117
2019-09-12 13:48:16 -04:00
cketcham
7bb525ff59 Update usages of ShapeAppearanceModel to use Builder pattern
PiperOrigin-RevId: 266144471
2019-08-29 15:39:51 -04:00
marianomartin
0d4515cb46 Internal cleanup
PiperOrigin-RevId: 265971745
2019-08-29 14:59:20 -04:00
cketcham
86d4328e24 Add @NonNull and @Nullable annotations
PiperOrigin-RevId: 265447585
2019-08-29 11:24:58 -04:00
cketcham
a1a763dde9 Fixing NavigationView scrims
NavigationView tries to determine if it is behind the status bar by checking if it's at the top of the screen. If it is and there are insets, it will draw a scrim. It also tries to determine if it is under the system nav. If it is and the system nav isn't fully transparent, it will also draw a scrim.

PiperOrigin-RevId: 264167166
2019-08-20 11:13:04 -04:00
marianomartin
19aeb9b7a2 Delegate overscrollmode in navigation view to inflated MenuView
PiperOrigin-RevId: 256988688
2019-07-09 12:54:18 -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
afohrman
ab87dd51fb Add shaped selected item background to NavigationView and update the item background color.
PiperOrigin-RevId: 247490949
2019-05-16 12:38:14 -04:00
afohrman
56efa7f634 Add elevation overlay support for NavigationView.
PiperOrigin-RevId: 245312138
2019-04-29 15:49:56 -07:00
afohrman
6b055ffbeb Automated g4 rollback of changelist 243898425
PiperOrigin-RevId: 244049761
2019-04-19 21:29:34 -04:00
afohrman
9dfecb6e36 Support elevation overlays for Navigation Drawers.
This sets the default elevation for Widget.MaterialComponents.NavigationView to 16dp instead of 0dp.

PiperOrigin-RevId: 243898425
2019-04-19 21:23:04 -04:00
afohrman
ed4260f5fb Use the framework's setFitsSystemWindows method rather than the deprecated ViewUtils version.
PiperOrigin-RevId: 243667717
2019-04-19 21:06:28 -04:00
afohrman
6e98554a8c Remove unnecessary return tag in NavigationView#getCheckedItem().
The @return tag is redundant; return tags are not required in cases where the tag does not add value.

PiperOrigin-RevId: 243663808
2019-04-19 21:05:32 -04:00
Material Design Team
6096d60959 Roll Forward of CL 242858439
PiperOrigin-RevId: 243197143
2019-04-19 15:48:51 -04:00
Material Design Team
3666e15298 Automated g4 rollback of changelist 242858439
PiperOrigin-RevId: 242907738
2019-04-19 15:30:07 -04:00
Material Design Team
3f12bd50e2 Add a itemMaxLines Attribute to NavigationView
Add a itemMaxLines attr to NavigationView and propagate it down to the internal CheckedTextView.

Also, make a slight change to design_navigation_item.xml layout to accommodate multiple lines of text. Without the layout change, the layout_height of the item is set to "?attr/listPreferredItemHeightSmall" so it can't contain an arbitrary number of lines. It can also chop lines in the middle.

To fix this, we change layout_height to "wrap_content" and add a minHeight attribute set to "?attr/listPreferredItemHeightSmall". This results in the same behavior for single line items but expands appropriately to contain items with multiple rows.

PiperOrigin-RevId: 242858439
2019-04-19 15:15:23 -04:00
Material Design Team
a13ff980a5 Automated g4 rollback of changelist 241720142
PiperOrigin-RevId: 241804673
2019-04-05 15:48:38 -04:00
Material Design Team
264e816f56 * Add selected (Active) item default background to NavigationView - introducing seven itemShape* attributes for this purpose
PiperOrigin-RevId: 241720142
2019-04-05 15:43:56 -04:00
Material Design Team
c5aea4d74f Automated g4 rollback of changelist 232310103
PiperOrigin-RevId: 232890148
2019-02-11 11:17:51 -08:00