147 Commits

Author SHA1 Message Date
rightnao
e708d98c74 [TabLayout] Re-adding mistakenly removed tab layout theme
PiperOrigin-RevId: 523239345
2023-04-11 20:47:24 -07:00
rightnao
b706506c3d [Badge] Add attribute to automatically adjust badge so that it is within the anchor view's grandparent view's bounds
PiperOrigin-RevId: 523171594
2023-04-11 20:00:06 -07:00
pekingme
9f1caa2c64 [Tokens] Upgraded to v0.162.
PiperOrigin-RevId: 517446114
2023-03-20 21:23:07 +00:00
rightnao
34d6a14700 [TabLayout] Fix issue with indicator not being drawn when viewpager starts scrolling before onLayout is called
PiperOrigin-RevId: 512062664
2023-02-27 20:45:19 +00:00
rightnao
e9246ed636 [TabLayout] Fix scrolling issue when using scrollable tab layout with viewpager
Resolves https://github.com/material-components/material-components-android/issues/3138

PiperOrigin-RevId: 508444050
2023-02-09 20:53:59 +00:00
pekingme
23dc14ca3a [Tokens] Updated to v0.157.
PiperOrigin-RevId: 505978081
2023-01-31 20:01:13 +00:00
pubiqq
2465192173 [TabLayout] Fix confusing documentation
Resolves https://github.com/material-components/material-components-android/pull/3098

GIT_ORIGIN_REV_ID=200a9d2f97bffa86a2b8ee3c3746fc7b5718b7a5
PiperOrigin-RevId: 495029269
2022-12-13 13:37:50 -05:00
dsn5ft
87ce239b01 [Docs] Remove smart characters from doc comments
PiperOrigin-RevId: 494733732
2022-12-12 16:40:01 -05:00
leticiars
997feacfd8 Automated g4 rollback of changelist 493122430
PiperOrigin-RevId: 493140204
2022-12-06 15:23:48 -05:00
pubiqq
139600418b [TabLayout] Fix confusing documentation
Resolves https://github.com/material-components/material-components-android/pull/3098

GIT_ORIGIN_REV_ID=200a9d2f97bffa86a2b8ee3c3746fc7b5718b7a5
PiperOrigin-RevId: 493122430
2022-12-06 15:23:12 -05:00
rightnao
319467123f [TabLayout] Fix bug with setScrollPosition not updating indicator due to onLayout call drawing the indicator below the selected tab.
Resolves https://github.com/material-components/material-components-android/issues/3101

PiperOrigin-RevId: 492562100
2022-12-02 18:38:40 -05:00
pekingme
2019bf90be [Tokens] Upgraded to version v0.147.
PiperOrigin-RevId: 492551875
2022-12-02 18:34:12 -05:00
pekingme
17e3581642 [Tokens] Upgraded to v0.145
PiperOrigin-RevId: 492291163
2022-12-02 15:11:37 +00:00
pekingme
b9963a5212 [Tokens][Android] Omitted more comments when configuration specifies no comments.
PiperOrigin-RevId: 492290497
2022-12-02 15:04:22 +00:00
pekingme
8ee6c00f73 [Tokens] Upgraded to v0.142
Added lStar CSLs for new neutral palettes in v31 and above.

PiperOrigin-RevId: 491693724
2022-11-30 17:31:11 -05:00
rightnao
84b7bc3320 [TabLayout] Fixing bug with animation flicker when using tabs with ViewPager2
PiperOrigin-RevId: 491460655
2022-11-29 15:21:12 -05:00
pekingme
12ef329276 [Tokens] Upgraded to v0.141
PiperOrigin-RevId: 490324728
2022-11-23 15:13:20 -05:00
pekingme
b2b546b205 [Tokens] Internal updates.
PiperOrigin-RevId: 490295053
2022-11-23 15:11:19 -05:00
rightnao
4a0e1a0cdb [TabLayout] Fix bug with selected tab text appearance when swiping in viewpager.
PiperOrigin-RevId: 489559352
2022-11-18 22:36:16 +00:00
pubiqq
cb1905dbff [TabLayout] Fix default tabTextAppearance
Resolves https://github.com/material-components/material-components-android/pull/3085

GIT_ORIGIN_REV_ID=5c801bb6b6e9df227094106dedc5defa24b99077
PiperOrigin-RevId: 489517504
2022-11-18 16:57:53 -05:00
rightnao
857f481edd [TabLayout] Fixing bug with animation cancelling if tab is double-tapped
resolves https://github.com/material-components/material-components-android/issues/3069

PiperOrigin-RevId: 487376299
2022-11-10 18:22:41 +00:00
rightnao
f9a37c5077 [TabLayout] Fix tab indicator animation
resolves https://github.com/material-components/material-components-android/issues/3047

PiperOrigin-RevId: 486241080
2022-11-07 16:00:53 +00:00
pekingme
d0460f3a70 [Tabs] Integrated tokens into M3 styles.
PiperOrigin-RevId: 481709158
2022-10-17 20:01:47 +00:00
pekingme
34a1dde7b6 [Tabs] Fixed potential NPE when updating tab view.
PiperOrigin-RevId: 479643436
2022-10-11 14:03:44 +00:00
rightnao
00220d0ad6 [TabLayout] Add selectedTabTextAppearance attribute
Resolves https://github.com/material-components/material-components-android/issues/2159

PiperOrigin-RevId: 477238120
2022-09-27 23:56:23 +00:00
rightnao
3c0c9e75f5 [TabLayout] Setting a custom view on the tab should replace the current custom view
PiperOrigin-RevId: 473057129
2022-09-12 12:25:10 -04:00
pubiqq
d68c0f8dc5 [TabLayout] Do not impose margins in custom tab views
Resolves https://github.com/material-components/material-components-android/pull/2910

GIT_ORIGIN_REV_ID=d9ba645464601814cccff5c30118807e8f3f4ef6
PiperOrigin-RevId: 471814138
2022-09-02 13:01:35 -07:00
rightnao
d1c5a52cf4 [TabLayout] Update motion attributes for tab layout
PiperOrigin-RevId: 468736364
2022-08-22 15:23:26 -04:00
Material Design Team
44cc9b745c Add @CanIgnoreReturnValue to some APIs that return this.
PiperOrigin-RevId: 468721442
2022-08-22 15:22:27 -04:00
pubiqq
cebf5919ad [TabLayout] Fix icon position in icon-only tabs
Resolves https://github.com/material-components/material-components-android/issues/2767
Resolves https://github.com/material-components/material-components-android/pull/2768

GIT_ORIGIN_REV_ID=8dd880e76b80172e57573a600f3d65de846a55c0
PiperOrigin-RevId: 465559826
2022-08-05 20:26:07 +00:00
conradchen
a65a262933 Automated g4 rollback of changelist 457501629
PiperOrigin-RevId: 463094334
2022-07-25 16:17:20 +00:00
conradchen
d1895cdd35 [Tab] Mutate selected indicator drawable when it's being set
Wrapping and mutating a given drawable which is supposed to be tinted is a standard practice across the Material library. This CL applies the same logic to Tab's selected indicator drawables and also refactoring the relevant logic a bit to make it cleaner.

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

PiperOrigin-RevId: 460765659
2022-07-13 19:53:29 +00:00
conradchen
36efca0aa2 [Tab] Refine tab update logic from ViewPager adapters
Refines the logic so only the affected tabs will be updated.

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

PiperOrigin-RevId: 457501629
2022-06-27 20:09:36 +00:00
pekingme
2fc2e6a167 [Tab] Fixed indicator not updating when a tab to the start/left of the selected tab is removed.
PiperOrigin-RevId: 456322731
2022-06-23 18:34:24 +00:00
pubiqq
3ca41be8f0 [General] Fix typos
Resolves https://github.com/material-components/material-components-android/pull/2654

GIT_ORIGIN_REV_ID=b8f6728979875629f2c813ef90d2f671cf56b4eb
PiperOrigin-RevId: 442852630
2022-04-19 14:48:55 -04:00
jeremymuhia
9c2df2811c [TabLayout] tabs with padding in fixed mode shouldn't scroll
Resolves https://github.com/material-components/material-components-android/issues/2410

PiperOrigin-RevId: 432032683
2022-03-03 09:56:30 -05:00
hunterstich
a295de9728 [TabLayout] Added fade inidcator animation mode.
PiperOrigin-RevId: 417842993
2021-12-22 14:48:54 -05:00
Material Design Team
cfc00aa5a3 Update android core class definitions across material
PiperOrigin-RevId: 414839941
2021-12-08 14:56:25 +00:00
Material Design Team
a487c89185 Internal change
PiperOrigin-RevId: 412135443
2021-11-29 17:35:39 +00:00
conradchen
04a6b6c39e [M3][Tab] Do not enforce text appearance with M3 styles
PiperOrigin-RevId: 409445341
2021-11-16 12:35:44 -05:00
conradchen
823c34a90c [Tab] Fix NPE caused by set a position less than 0
If somehow scroll position is set to -1 with and position offset greater than 0.5, we will decide it's a valid scroll position which causes NPE for selected child not found.

Fixes this by checking if position is valid regardless the offset and falling back to 0 if a negative position is given.

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

PiperOrigin-RevId: 408894188
2021-11-10 16:12:49 -05:00
conradchen
328d269e6d [Tab] Fix NPE caused by null tab indicator
PiperOrigin-RevId: 397841987
2021-09-21 08:22:49 -07:00
conradchen
868f8aaba3 [Tab] Fix setting tab indicator and its full-width flag
1. When a new tab indicator drawable is set, we didn't correctly restore the previous set indicator height to the new drawable, or set the drawing bound to the intrinsic height of the drawable, if the indicator height was not specified. This result in a 0-height drawing bound after setting the tab indicator, which makes it disappear and can never go back if the tab indicator gravity is not "stretch" (which will recalculate the height after moving the indicator). Fixes this by correctly set the drawing bounds after a new tab indicator drawable is set.

2. After we set full-width flag of tab indicator, the width won't be updated until we move the tab indicator. Fixes this by explicitly triggering the recalculation of tab indicator's drawing bound after changing the flag.

Resolves: https://github.com/material-components/material-components-android/issues/2354
PiperOrigin-RevId: 397823617
2021-09-21 08:14:25 -07:00
conradchen
8a1f221e39 [Tab] Fix isSelected() may returns incorrect result
Resolves https://github.com/material-components/material-components-android/issues/2379

PiperOrigin-RevId: 397394397
2021-09-20 12:16:44 -07:00
serniebanders
6a30ac164a [M3][Docs] Update tabs documentation to describe M3 themes/styles.
Additionally exposes M3 tabs styles in res-public

PiperOrigin-RevId: 396627778
2021-09-16 12:38:21 -07:00
conradchen
804cd600b0 [M3][Tab] Make secondary style change label color when selected
To align with the behavior of the main style.

PiperOrigin-RevId: 392037281
2021-08-23 09:44:30 -07:00
conradchen
60782a5d9b [M3][Tab] Create M3 styles
PiperOrigin-RevId: 391849752
2021-08-23 09:29:03 -07:00
conradchen
126df4c082 [Tab] Fix icon tint not applied on lower SDKs
On SDK < 23 if the icon is not a TintAwareDrawable, DrawableCompat.wrap() will return a new drawable which wraps the original drawable. However in the original logic after we set the tint to the icon, we didn't really set the tinted icon back to the tab or the image view, therefore the tint is not showing.

Moves the tint logic to updateTextAndIcon() to ensure tinted icons will be used in the image view.

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

PiperOrigin-RevId: 391368322
2021-08-18 10:02:28 -07:00
conradchen
e92ebdef09 [Tab] Redraw indicators after their color is updated
Also supports setting indicator color to transparent.

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

PiperOrigin-RevId: 381541396
2021-06-28 13:07:40 -07:00
connieshi
da2d8264d1 [Tabs][BottomNav] Do not show tooltip on long press for L and M devices to avoid freezing devices on repeated long press.
PiperOrigin-RevId: 355428951
2021-02-04 20:54:30 -05:00