43 Commits

Author SHA1 Message Date
Material Design Team
a200a5ef17 [NavigationRail] Moves OnNavigationItem listeners to the NavigationBarView class
to be easier used by developers and other libraries

An example of where the current implementation fails is in Jetpack Navigation component where we rely on setOnNavigationItemSelectedListener and the similar methods in NavigationBarView (setOnItemSelectedListener) are protected.

PiperOrigin-RevId: 367467206
2021-04-08 20:43:35 -04:00
dniz
fed90a9e57 [Nav Rail / Bottom Nav / Nav Bar] API Fixes
Resolves https://github.com/material-components/material-components-android/issues/2131

PiperOrigin-RevId: 365873683
2021-03-31 10:27:45 -04:00
raajkumars
aca5bfb6f7 [Bottom Navigation] Extracted common logic from bottom navigation component into navigation package.
PiperOrigin-RevId: 345029590
2020-12-02 09:55:26 -05:00
afohrman
9a5192ae5e [BottomNavigationView] Updated BottomNavigationView to draw compat shadows and elevation overlays in pre-21 and remove top divider for non-legacy backgrounds.
Previously, `BottomNavigationView` was using `MaterialShapeDrawable` but an elevation value that was set would not actually take effect. It turns out that this is because `BottomNavigationView` did not properly call the appropriate elevation methods. This commit fixes the handling of elevation. It also removes the top divider in pre-21 cases where there is a `MaterialShapeDrawable` background - otherwise the top divider is kept for compatibility with existing legacy versions.

PiperOrigin-RevId: 335867951
2020-10-08 16:13:02 +00:00
dniz
cbc7af2054 [BottomNavigationView] Added setItemOnTouchListener method to support custom touch handling
PiperOrigin-RevId: 325814575
2020-08-10 13:25:26 -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
connieshi
5889993bb3 Update BottomNavigation to respect left/right system insets
PiperOrigin-RevId: 313180090
2020-05-26 16:00:06 -04:00
marianomartin
368b54c0ee Fix setItemRippleColor links
PiperOrigin-RevId: 300799013
2020-03-13 16:01:11 -07:00
isabellekim
5ef93e9351 Javadoc updates for BottomNavigationView.
PiperOrigin-RevId: 300567464
2020-03-13 11:05:25 -04:00
connieshi
de005027bc Fix bug in bottom navigation badge state restoration that did not set the badges on the menu item views.
Update catalog demo to save and restore states in the bottom navigation demos.

PiperOrigin-RevId: 278436621
2019-11-06 10:14:43 -05:00
marianomartin
56fbbe9ee5 Fix BottomNavigationView SavedState bug for null loader
Resolves https://github.com/material-components/material-components-android/issues/549

PiperOrigin-RevId: 278416562
2019-11-06 10:13:46 -05:00
marianomartin
115313c0c0 Expose a class for themeoverlay in style
This moves functionality from ThemeEnforcement into a stand alone class.

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

PiperOrigin-RevId: 275481343
2019-10-21 10:24:19 -04:00
marianomartin
215a839598 Internal cleanup
PiperOrigin-RevId: 267504117
2019-09-12 13:48:16 -04:00
marianomartin
0d4515cb46 Internal cleanup
PiperOrigin-RevId: 265971745
2019-08-29 14:59:20 -04:00
cketcham
08a26c929e Add @NonNull and @Nullable annotations
PiperOrigin-RevId: 264750215
2019-08-26 11:21:15 -04:00
connieshi
276bec8385 Update BottomNavigation to respect bottom system insets
PiperOrigin-RevId: 260031378
2019-07-29 16:35:59 -04:00
marianomartin
152f05adbc Internal cleanup
PiperOrigin-RevId: 256180803
2019-07-03 14:09:17 -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
2de39fafe0 Internal cleanup
PiperOrigin-RevId: 253799644
2019-06-18 13:57:49 -04:00
connieshi
ee913784dc Rename BottomNavigationView#showBadge to BottomNavigationView#getOrCreateBadge(). No longer ensures that the badge is visible. User should call BadgeDrawable#setVisible(boolean).
PiperOrigin-RevId: 253231582
2019-06-18 13:28:31 -04:00
marianomartin
455ba2557b Internal cleanup
PiperOrigin-RevId: 249490219
2019-05-24 14:22:06 -04:00
Material Design Team
3c5f9f6cb0 Migrate CoordinatorLayout android support libraries to androidx
PiperOrigin-RevId: 248819271
2019-05-21 12:03:28 -04:00
afohrman
d77864bbbf Support ColorDrawables as the basis for MaterialShapeDrawable initialization in
BottomNavigationView.

This commit removes backgroundTint from the BottomNavigationView styles and instead sets the respective default colors as ColorDrawable backgrounds of the BottomNavigationView. This allows BottomNavigationView to respect colors set in android:background without requiring the client to override backgroundTint.

PiperOrigin-RevId: 244669964
2019-04-29 15:16:23 -07:00
connieshi
9d488d9208 Begin integrating BadgeDrawable into BottomNavigationView.
TODO:
- update javadocs to provide guidance on how to interact with BottomNavigation + Badging.
- Save badge states.
- Support displaying badges when bottom navigation item doesn't show an icon.
PiperOrigin-RevId: 244197244
2019-04-19 21:51:25 -04:00
connieshi
7d8b2117a0 Automated g4 rollback of changelist 242675939
PiperOrigin-RevId: 242751222
2019-04-19 13:26:30 -04:00
connieshi
00ffe5eea8 Begin integrating BadgeDrawable into BottomNavigationView.
TODO:
- update javadocs to provide guidance on how to call Badging API.
- Save badge states.
- Support displaying badges when bottom navigation item doesn't show an icon.
PiperOrigin-RevId: 242675939
2019-04-19 13:21:35 -04:00
dniz
833258417d Add @RequiresApi(VERSION_CODES.LOLLIPOP) to overriden setElevation() methods
that call super.setElevation()

PiperOrigin-RevId: 239171863
2019-03-22 16:50:21 -04:00
afohrman
d6cb34970a Support elevation overlays for BottomNavigationView.
PiperOrigin-RevId: 238729801
2019-03-22 16:17:46 -04:00
isabellekim
6c3b51022e Adds itemRippleColor attribute to the BottomNavigationView as an alternative for itemBackground to support using ripples based on theme attributes pre-23. And update BottomNavigationView ripples to match TabLayout ripples.
PiperOrigin-RevId: 235237859
2019-02-24 14:37:45 -05:00
marianomartin
6a7b1b2ce2 Mutate background drawable before changing tint
PiperOrigin-RevId: 226181425
2018-12-21 11:25:39 -05:00
cketcham
dc72aaeed4 Migrate Gradle build and sources to androidx
PiperOrigin-RevId: 225551505
2018-12-21 11:07:45 -05:00
marianomartin
a083017520 Add backgroundTint support to BottomNav
PiperOrigin-RevId: 225384496
2018-12-21 10:41:14 -05:00
marianomartin
ba696b6984 Verify typography subsystem is complete for Bottom Navigation
PiperOrigin-RevId: 204798141
2018-07-17 18:09:19 -04:00
dniz
91196d1163 Add get/setItemBackground() Drawable methods to BottomNavigationView
PiperOrigin-RevId: 198911383
2018-06-04 10:50:40 -04:00
afohrman
7af4ff7ee9 Remove resource version of label visibility mode setter.
This method does not provide clear value to the user. I considered deprecating it, but since it was introduced in an alpha release, it can just be deleted.

PiperOrigin-RevId: 193966844
2018-04-30 11:57:08 -04:00
afohrman
2f2ba0ce3d Add "enabled" suffix to itemHorizontalTranslation attribute name.
The suffix makes it clearer that the attribute is boolean.

This attribute was introduced in an alpha release, so it is fine to rename.

PiperOrigin-RevId: 193964290
2018-04-30 11:56:12 -04:00
afohrman
95ac4dacfe Remove resource version of setItemHorizontalTranslation.
A resource version for this method does not provide much value to the user.

PiperOrigin-RevId: 193962413
2018-04-30 11:54:52 -04:00
afohrman
785b44a688 Change default itemIconSize for bottom nav.
Update default icon size from 0dp to 24dp. 24dp is a more reasonable default to be used in cases where itemIconSize is not set in the theme or style provided.

PiperOrigin-RevId: 193675565
2018-04-30 11:36:15 -04:00
afohrman
fcbc5b560f Change itemIconSize to use pixels instead of dp.
PiperOrigin-RevId: 193513323
2018-04-30 11:33:42 -04:00
dniz
9ca33544ac Update package name to com.google.android.material
PiperOrigin-RevId: 193236235
2018-04-30 11:24:23 -04:00